aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/configuration/configure_debug_controller.cpp
blob: 31ec4838401dbdd33d00e996ba6544ae0fd2f7c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2020 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#include "core/core.h"
#include "ui_configure_debug_controller.h"
#include "yuzu/configuration/configure_debug_controller.h"
#include "yuzu/configuration/configure_input_player.h"

ConfigureDebugController::ConfigureDebugController(QWidget* parent,
                                                   InputCommon::InputSubsystem* input_subsystem,
                                                   InputProfiles* profiles, Core::System& system)
    : QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()),
      debug_controller(
          new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, true)) {
    ui->setupUi(this);

    ui->controllerLayout->addWidget(debug_controller);

    connect(ui->clear_all_button, &QPushButton::clicked, this,
            [this] { debug_controller->ClearAll(); });
    connect(ui->restore_defaults_button, &QPushButton::clicked, this,
            [this] { debug_controller->RestoreDefaults(); });

    RetranslateUI();
}

ConfigureDebugController::~ConfigureDebugController() = default;

void ConfigureDebugController::ApplyConfiguration() {
    debug_controller->ApplyConfiguration();
}

void ConfigureDebugController::changeEvent(QEvent* event) {
    if (event->type() == QEvent::LanguageChange) {
        RetranslateUI();
    }

    QDialog::changeEvent(event);
}

void ConfigureDebugController::RetranslateUI() {
    ui->retranslateUi(this);
}