2018-11-02 03:10:51 +01:00
|
|
|
// Copyright 2016 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include "ui_configure_touchscreen_advanced.h"
|
|
|
|
#include "yuzu/configuration/config.h"
|
|
|
|
#include "yuzu/configuration/configure_touchscreen_advanced.h"
|
|
|
|
|
|
|
|
ConfigureTouchscreenAdvanced::ConfigureTouchscreenAdvanced(QWidget* parent)
|
|
|
|
: QDialog(parent), ui(std::make_unique<Ui::ConfigureTouchscreenAdvanced>()) {
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2019-07-22 23:28:10 +02:00
|
|
|
connect(ui->restore_defaults_button, &QPushButton::clicked, this,
|
2019-05-26 06:39:23 +02:00
|
|
|
&ConfigureTouchscreenAdvanced::RestoreDefaults);
|
2018-11-02 03:10:51 +01:00
|
|
|
|
2019-05-26 06:39:23 +02:00
|
|
|
LoadConfiguration();
|
2018-11-03 17:55:39 +01:00
|
|
|
resize(0, 0);
|
2018-11-02 03:10:51 +01:00
|
|
|
}
|
|
|
|
|
2018-11-03 17:55:39 +01:00
|
|
|
ConfigureTouchscreenAdvanced::~ConfigureTouchscreenAdvanced() = default;
|
|
|
|
|
2019-06-06 00:39:46 +02:00
|
|
|
void ConfigureTouchscreenAdvanced::changeEvent(QEvent* event) {
|
|
|
|
if (event->type() == QEvent::LanguageChange) {
|
|
|
|
RetranslateUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
QDialog::changeEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfigureTouchscreenAdvanced::RetranslateUI() {
|
|
|
|
ui->retranslateUi(this);
|
|
|
|
}
|
|
|
|
|
2019-05-26 06:39:23 +02:00
|
|
|
void ConfigureTouchscreenAdvanced::ApplyConfiguration() {
|
2018-11-02 03:10:51 +01:00
|
|
|
Settings::values.touchscreen.finger = ui->finger_box->value();
|
|
|
|
Settings::values.touchscreen.diameter_x = ui->diameter_x_box->value();
|
|
|
|
Settings::values.touchscreen.diameter_y = ui->diameter_y_box->value();
|
|
|
|
Settings::values.touchscreen.rotation_angle = ui->angle_box->value();
|
|
|
|
}
|
|
|
|
|
2019-05-26 06:39:23 +02:00
|
|
|
void ConfigureTouchscreenAdvanced::LoadConfiguration() {
|
2018-11-02 03:10:51 +01:00
|
|
|
ui->finger_box->setValue(Settings::values.touchscreen.finger);
|
|
|
|
ui->diameter_x_box->setValue(Settings::values.touchscreen.diameter_x);
|
|
|
|
ui->diameter_y_box->setValue(Settings::values.touchscreen.diameter_y);
|
|
|
|
ui->angle_box->setValue(Settings::values.touchscreen.rotation_angle);
|
|
|
|
}
|
|
|
|
|
2019-05-26 06:39:23 +02:00
|
|
|
void ConfigureTouchscreenAdvanced::RestoreDefaults() {
|
2018-11-02 03:10:51 +01:00
|
|
|
ui->finger_box->setValue(0);
|
|
|
|
ui->diameter_x_box->setValue(15);
|
|
|
|
ui->diameter_y_box->setValue(15);
|
|
|
|
ui->angle_box->setValue(0);
|
|
|
|
}
|