Refresh debug controller settings
This commit is contained in:
parent
d6a0975e5d
commit
160341fcf8
|
@ -18,12 +18,8 @@ ControllerDialog::ControllerDialog(QWidget* parent) : QWidget(parent, Qt::Dialog
|
||||||
setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) |
|
setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) |
|
||||||
Qt::WindowMaximizeButtonHint);
|
Qt::WindowMaximizeButtonHint);
|
||||||
|
|
||||||
PlayerControlPreview* widget = new PlayerControlPreview(this);
|
widget = new PlayerControlPreview(this);
|
||||||
const auto& players = Settings::values.players.GetValue();
|
refreshConfiguration();
|
||||||
constexpr std::size_t player = 0;
|
|
||||||
widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs);
|
|
||||||
widget->SetConnectedStatus(players[player].connected);
|
|
||||||
widget->SetControllerType(players[player].controller_type);
|
|
||||||
QLayout* layout = new QVBoxLayout(this);
|
QLayout* layout = new QVBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->addWidget(widget);
|
layout->addWidget(widget);
|
||||||
|
@ -36,6 +32,14 @@ ControllerDialog::ControllerDialog(QWidget* parent) : QWidget(parent, Qt::Dialog
|
||||||
widget->setFocus();
|
widget->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ControllerDialog::refreshConfiguration() {
|
||||||
|
const auto& players = Settings::values.players.GetValue();
|
||||||
|
constexpr std::size_t player = 0;
|
||||||
|
widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs);
|
||||||
|
widget->SetConnectedStatus(players[player].connected);
|
||||||
|
widget->SetControllerType(players[player].controller_type);
|
||||||
|
}
|
||||||
|
|
||||||
QAction* ControllerDialog::toggleViewAction() {
|
QAction* ControllerDialog::toggleViewAction() {
|
||||||
if (toggle_view_action == nullptr) {
|
if (toggle_view_action == nullptr) {
|
||||||
toggle_view_action = new QAction(windowTitle(), this);
|
toggle_view_action = new QAction(windowTitle(), this);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
class QAction;
|
class QAction;
|
||||||
class QHideEvent;
|
class QHideEvent;
|
||||||
class QShowEvent;
|
class QShowEvent;
|
||||||
|
class PlayerControlPreview;
|
||||||
|
|
||||||
class ControllerDialog : public QWidget {
|
class ControllerDialog : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -18,6 +19,7 @@ public:
|
||||||
|
|
||||||
/// Returns a QAction that can be used to toggle visibility of this dialog.
|
/// Returns a QAction that can be used to toggle visibility of this dialog.
|
||||||
QAction* toggleViewAction();
|
QAction* toggleViewAction();
|
||||||
|
void refreshConfiguration();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent* ev) override;
|
void showEvent(QShowEvent* ev) override;
|
||||||
|
@ -25,4 +27,5 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAction* toggle_view_action = nullptr;
|
QAction* toggle_view_action = nullptr;
|
||||||
|
PlayerControlPreview* widget;
|
||||||
};
|
};
|
||||||
|
|
|
@ -690,9 +690,9 @@ void GMainWindow::InitializeDebugWidgets() {
|
||||||
waitTreeWidget->hide();
|
waitTreeWidget->hide();
|
||||||
debug_menu->addAction(waitTreeWidget->toggleViewAction());
|
debug_menu->addAction(waitTreeWidget->toggleViewAction());
|
||||||
|
|
||||||
controllerDialog = new ControllerDialog(this);
|
controller_dialog = new ControllerDialog(this);
|
||||||
controllerDialog->hide();
|
controller_dialog->hide();
|
||||||
debug_menu->addAction(controllerDialog->toggleViewAction());
|
debug_menu->addAction(controller_dialog->toggleViewAction());
|
||||||
|
|
||||||
connect(this, &GMainWindow::EmulationStarting, waitTreeWidget,
|
connect(this, &GMainWindow::EmulationStarting, waitTreeWidget,
|
||||||
&WaitTreeWidget::OnEmulationStarting);
|
&WaitTreeWidget::OnEmulationStarting);
|
||||||
|
@ -2342,6 +2342,7 @@ void GMainWindow::OnConfigure() {
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_dialog.ApplyConfiguration();
|
configure_dialog.ApplyConfiguration();
|
||||||
|
controller_dialog->refreshConfiguration();
|
||||||
InitializeHotkeys();
|
InitializeHotkeys();
|
||||||
if (UISettings::values.theme != old_theme) {
|
if (UISettings::values.theme != old_theme) {
|
||||||
UpdateUITheme();
|
UpdateUITheme();
|
||||||
|
|
|
@ -314,7 +314,7 @@ private:
|
||||||
ProfilerWidget* profilerWidget;
|
ProfilerWidget* profilerWidget;
|
||||||
MicroProfileDialog* microProfileDialog;
|
MicroProfileDialog* microProfileDialog;
|
||||||
WaitTreeWidget* waitTreeWidget;
|
WaitTreeWidget* waitTreeWidget;
|
||||||
ControllerDialog* controllerDialog;
|
ControllerDialog* controller_dialog;
|
||||||
|
|
||||||
QAction* actions_recent_files[max_recent_files_item];
|
QAction* actions_recent_files[max_recent_files_item];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue