mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-17 22:25:37 +00:00
Qt: Move controller setting popups into dialog
This commit is contained in:
parent
8d50ebe538
commit
8776bfe46d
|
@ -41,6 +41,8 @@ set(SRCS
|
||||||
controllerglobalsettingswidget.cpp
|
controllerglobalsettingswidget.cpp
|
||||||
controllerglobalsettingswidget.h
|
controllerglobalsettingswidget.h
|
||||||
controllerglobalsettingswidget.ui
|
controllerglobalsettingswidget.ui
|
||||||
|
controllermacroeditwidget.ui
|
||||||
|
controllermacrowidget.ui
|
||||||
controllersettingsdialog.cpp
|
controllersettingsdialog.cpp
|
||||||
controllersettingsdialog.h
|
controllersettingsdialog.h
|
||||||
controllersettingsdialog.ui
|
controllersettingsdialog.ui
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>833</width>
|
<width>833</width>
|
||||||
<height>562</height>
|
<height>617</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -38,22 +38,62 @@
|
||||||
<widget class="QComboBox" name="controllerType"/>
|
<widget class="QComboBox" name="controllerType"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="settings">
|
<widget class="QToolButton" name="bindings">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Settings</string>
|
<string>Bindings</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="checkbox-multiple-blank-line"/>
|
<iconset theme="gamepad-line">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="macros">
|
<widget class="QToolButton" name="settings">
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="checkbox-multiple-blank-line">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="macros">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Macros</string>
|
<string>Macros</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="flashlight-line"/>
|
<iconset theme="flashlight-line">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -75,7 +115,7 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="automaticBinding">
|
<widget class="QToolButton" name="automaticBinding">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatic Mapping</string>
|
<string>Automatic Mapping</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -83,10 +123,13 @@
|
||||||
<iconset theme="gamepad-line">
|
<iconset theme="gamepad-line">
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="clearBindings">
|
<widget class="QToolButton" name="clearBindings">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Clear Mapping</string>
|
<string>Clear Mapping</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -94,6 +137,9 @@
|
||||||
<iconset theme="file-reduce-line">
|
<iconset theme="file-reduce-line">
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -101,6 +147,9 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QStackedWidget" name="stackedWidget" />
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -26,10 +26,11 @@ ControllerBindingWidget::ControllerBindingWidget(QWidget* parent, ControllerSett
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
populateControllerTypes();
|
populateControllerTypes();
|
||||||
populateBindingWidget();
|
populateWidgets();
|
||||||
|
|
||||||
connect(m_ui.controllerType, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(m_ui.controllerType, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
&ControllerBindingWidget::onTypeChanged);
|
&ControllerBindingWidget::onTypeChanged);
|
||||||
|
connect(m_ui.bindings, &QPushButton::clicked, this, &ControllerBindingWidget::onBindingsClicked);
|
||||||
connect(m_ui.settings, &QPushButton::clicked, this, &ControllerBindingWidget::onSettingsClicked);
|
connect(m_ui.settings, &QPushButton::clicked, this, &ControllerBindingWidget::onSettingsClicked);
|
||||||
connect(m_ui.macros, &QPushButton::clicked, this, &ControllerBindingWidget::onMacrosClicked);
|
connect(m_ui.macros, &QPushButton::clicked, this, &ControllerBindingWidget::onMacrosClicked);
|
||||||
connect(m_ui.automaticBinding, &QPushButton::clicked, this, &ControllerBindingWidget::onAutomaticBindingClicked);
|
connect(m_ui.automaticBinding, &QPushButton::clicked, this, &ControllerBindingWidget::onAutomaticBindingClicked);
|
||||||
|
@ -40,7 +41,7 @@ ControllerBindingWidget::~ControllerBindingWidget() = default;
|
||||||
|
|
||||||
QIcon ControllerBindingWidget::getIcon() const
|
QIcon ControllerBindingWidget::getIcon() const
|
||||||
{
|
{
|
||||||
return m_current_widget->getIcon();
|
return m_bindings_widget->getIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBindingWidget::populateControllerTypes()
|
void ControllerBindingWidget::populateControllerTypes()
|
||||||
|
@ -67,49 +68,93 @@ void ControllerBindingWidget::populateControllerTypes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBindingWidget::populateBindingWidget()
|
void ControllerBindingWidget::populateWidgets()
|
||||||
{
|
{
|
||||||
const bool is_initializing = (m_current_widget == nullptr);
|
const bool is_initializing = (m_ui.stackedWidget->count() == 0);
|
||||||
if (!is_initializing)
|
if (m_bindings_widget)
|
||||||
{
|
{
|
||||||
m_ui.verticalLayout->removeWidget(m_current_widget);
|
m_ui.stackedWidget->removeWidget(m_bindings_widget);
|
||||||
delete m_current_widget;
|
delete m_bindings_widget;
|
||||||
m_current_widget = nullptr;
|
m_bindings_widget = nullptr;
|
||||||
|
}
|
||||||
|
if (m_settings_widget)
|
||||||
|
{
|
||||||
|
m_ui.stackedWidget->removeWidget(m_settings_widget);
|
||||||
|
delete m_settings_widget;
|
||||||
|
m_settings_widget = nullptr;
|
||||||
|
}
|
||||||
|
if (m_macros_widget)
|
||||||
|
{
|
||||||
|
m_ui.stackedWidget->removeWidget(m_macros_widget);
|
||||||
|
delete m_macros_widget;
|
||||||
|
m_macros_widget = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Controller::ControllerInfo* cinfo = Controller::GetControllerInfo(m_controller_type);
|
const Controller::ControllerInfo* cinfo = Controller::GetControllerInfo(m_controller_type);
|
||||||
m_ui.settings->setEnabled(cinfo && cinfo->num_settings > 0);
|
const bool has_settings = (cinfo && cinfo->num_settings > 0);
|
||||||
m_ui.macros->setEnabled(cinfo && cinfo->num_bindings > 0);
|
const bool has_macros = (cinfo && cinfo->num_bindings > 0);
|
||||||
|
m_ui.settings->setEnabled(has_settings);
|
||||||
|
m_ui.macros->setEnabled(has_macros);
|
||||||
|
|
||||||
switch (m_controller_type)
|
switch (m_controller_type)
|
||||||
{
|
{
|
||||||
case ControllerType::AnalogController:
|
case ControllerType::AnalogController:
|
||||||
m_current_widget = ControllerBindingWidget_AnalogController::createInstance(this);
|
m_bindings_widget = ControllerBindingWidget_AnalogController::createInstance(this);
|
||||||
break;
|
break;
|
||||||
case ControllerType::AnalogJoystick:
|
case ControllerType::AnalogJoystick:
|
||||||
m_current_widget = ControllerBindingWidget_AnalogJoystick::createInstance(this);
|
m_bindings_widget = ControllerBindingWidget_AnalogJoystick::createInstance(this);
|
||||||
break;
|
break;
|
||||||
case ControllerType::DigitalController:
|
case ControllerType::DigitalController:
|
||||||
m_current_widget = ControllerBindingWidget_DigitalController::createInstance(this);
|
m_bindings_widget = ControllerBindingWidget_DigitalController::createInstance(this);
|
||||||
break;
|
break;
|
||||||
case ControllerType::GunCon:
|
case ControllerType::GunCon:
|
||||||
m_current_widget = ControllerBindingWidget_GunCon::createInstance(this);
|
m_bindings_widget = ControllerBindingWidget_GunCon::createInstance(this);
|
||||||
break;
|
break;
|
||||||
case ControllerType::NeGcon:
|
case ControllerType::NeGcon:
|
||||||
m_current_widget = ControllerBindingWidget_NeGcon::createInstance(this);
|
m_bindings_widget = ControllerBindingWidget_NeGcon::createInstance(this);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_current_widget = new ControllerBindingWidget_Base(this);
|
m_bindings_widget = new ControllerBindingWidget_Base(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui.verticalLayout->addWidget(m_current_widget, 1);
|
m_ui.stackedWidget->addWidget(m_bindings_widget);
|
||||||
|
m_ui.stackedWidget->setCurrentWidget(m_bindings_widget);
|
||||||
|
|
||||||
|
if (has_settings)
|
||||||
|
{
|
||||||
|
m_settings_widget = new ControllerCustomSettingsWidget(this);
|
||||||
|
m_ui.stackedWidget->addWidget(m_settings_widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (has_macros)
|
||||||
|
{
|
||||||
|
m_macros_widget = new ControllerMacroWidget(this);
|
||||||
|
m_ui.stackedWidget->addWidget(m_macros_widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateHeaderToolButtons();
|
||||||
|
|
||||||
// no need to do this on first init, only changes
|
// no need to do this on first init, only changes
|
||||||
if (!is_initializing)
|
if (!is_initializing)
|
||||||
m_dialog->updateListDescription(m_port_number, this);
|
m_dialog->updateListDescription(m_port_number, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ControllerBindingWidget::updateHeaderToolButtons()
|
||||||
|
{
|
||||||
|
const QWidget* current_widget = m_ui.stackedWidget->currentWidget();
|
||||||
|
const QSignalBlocker bindings_sb(m_ui.bindings);
|
||||||
|
const QSignalBlocker settings_sb(m_ui.settings);
|
||||||
|
const QSignalBlocker macros_sb(m_ui.macros);
|
||||||
|
|
||||||
|
const bool is_bindings = (current_widget == m_bindings_widget);
|
||||||
|
m_ui.bindings->setChecked(is_bindings);
|
||||||
|
m_ui.automaticBinding->setEnabled(is_bindings);
|
||||||
|
m_ui.clearBindings->setEnabled(is_bindings);
|
||||||
|
m_ui.macros->setChecked(current_widget == m_macros_widget);
|
||||||
|
m_ui.settings->setChecked((current_widget == m_settings_widget));
|
||||||
|
}
|
||||||
|
|
||||||
void ControllerBindingWidget::onTypeChanged()
|
void ControllerBindingWidget::onTypeChanged()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
|
@ -132,7 +177,7 @@ void ControllerBindingWidget::onTypeChanged()
|
||||||
g_emu_thread->applySettings();
|
g_emu_thread->applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
populateBindingWidget();
|
populateWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBindingWidget::onAutomaticBindingClicked()
|
void ControllerBindingWidget::onAutomaticBindingClicked()
|
||||||
|
@ -182,16 +227,28 @@ void ControllerBindingWidget::onClearBindingsClicked()
|
||||||
saveAndRefresh();
|
saveAndRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ControllerBindingWidget::onBindingsClicked()
|
||||||
|
{
|
||||||
|
m_ui.stackedWidget->setCurrentWidget(m_bindings_widget);
|
||||||
|
updateHeaderToolButtons();
|
||||||
|
}
|
||||||
|
|
||||||
void ControllerBindingWidget::onSettingsClicked()
|
void ControllerBindingWidget::onSettingsClicked()
|
||||||
{
|
{
|
||||||
ControllerCustomSettingsDialog dialog(this);
|
if (!m_settings_widget)
|
||||||
dialog.exec();
|
return;
|
||||||
|
|
||||||
|
m_ui.stackedWidget->setCurrentWidget(m_settings_widget);
|
||||||
|
updateHeaderToolButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBindingWidget::onMacrosClicked()
|
void ControllerBindingWidget::onMacrosClicked()
|
||||||
{
|
{
|
||||||
ControllerMacroDialog dialog(this);
|
if (!m_macros_widget)
|
||||||
dialog.exec();
|
return;
|
||||||
|
|
||||||
|
m_ui.stackedWidget->setCurrentWidget(m_macros_widget);
|
||||||
|
updateHeaderToolButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBindingWidget::doDeviceAutomaticBinding(const QString& device)
|
void ControllerBindingWidget::doDeviceAutomaticBinding(const QString& device)
|
||||||
|
@ -232,22 +289,22 @@ void ControllerBindingWidget::saveAndRefresh()
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ControllerMacroDialog::ControllerMacroDialog(ControllerBindingWidget* parent) : QDialog(parent)
|
ControllerMacroWidget::ControllerMacroWidget(ControllerBindingWidget* parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
setWindowTitle(tr("Controller Port %1 Macros").arg(parent->getPortNumber() + 1u));
|
setWindowTitle(tr("Controller Port %1 Macros").arg(parent->getPortNumber() + 1u));
|
||||||
createWidgets(parent);
|
createWidgets(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllerMacroDialog::~ControllerMacroDialog() = default;
|
ControllerMacroWidget::~ControllerMacroWidget() = default;
|
||||||
|
|
||||||
void ControllerMacroDialog::updateListItem(u32 index)
|
void ControllerMacroWidget::updateListItem(u32 index)
|
||||||
{
|
{
|
||||||
m_ui.portList->item(static_cast<int>(index))
|
m_ui.portList->item(static_cast<int>(index))
|
||||||
->setText(tr("Macro %1\n%2").arg(index + 1).arg(m_macros[index]->getSummary()));
|
->setText(tr("Macro %1\n%2").arg(index + 1).arg(m_macros[index]->getSummary()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerMacroDialog::createWidgets(ControllerBindingWidget* parent)
|
void ControllerMacroWidget::createWidgets(ControllerBindingWidget* parent)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < NUM_MACROS; i++)
|
for (u32 i = 0; i < NUM_MACROS; i++)
|
||||||
{
|
{
|
||||||
|
@ -260,16 +317,15 @@ void ControllerMacroDialog::createWidgets(ControllerBindingWidget* parent)
|
||||||
updateListItem(i);
|
updateListItem(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui.portList->setCurrentItem(0);
|
m_ui.portList->setCurrentRow(0);
|
||||||
m_ui.container->setCurrentIndex(0);
|
m_ui.container->setCurrentIndex(0);
|
||||||
|
|
||||||
connect(m_ui.buttonBox, &QDialogButtonBox::rejected, this, &ControllerSettingsDialog::close);
|
|
||||||
connect(m_ui.portList, &QListWidget::currentRowChanged, m_ui.container, &QStackedWidget::setCurrentIndex);
|
connect(m_ui.portList, &QListWidget::currentRowChanged, m_ui.container, &QStackedWidget::setCurrentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ControllerMacroEditWidget::ControllerMacroEditWidget(ControllerMacroDialog* parent, ControllerBindingWidget* bwidget,
|
ControllerMacroEditWidget::ControllerMacroEditWidget(ControllerMacroWidget* parent, ControllerBindingWidget* bwidget,
|
||||||
u32 index)
|
u32 index)
|
||||||
: QWidget(parent), m_parent(parent), m_bwidget(bwidget), m_index(index)
|
: QWidget(parent), m_parent(parent), m_bwidget(bwidget), m_index(index)
|
||||||
{
|
{
|
||||||
|
@ -419,22 +475,29 @@ void ControllerMacroEditWidget::updateBinds()
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ControllerCustomSettingsDialog::ControllerCustomSettingsDialog(ControllerBindingWidget* parent) : QDialog(parent)
|
ControllerCustomSettingsWidget::ControllerCustomSettingsWidget(ControllerBindingWidget* parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
QGridLayout* layout = new QGridLayout(this);
|
QGridLayout* layout = new QGridLayout(this);
|
||||||
|
|
||||||
int row = createSettingWidgets(parent, layout);
|
int row = createSettingWidgets(parent, layout);
|
||||||
|
|
||||||
QDialogButtonBox* bbox = new QDialogButtonBox(QDialogButtonBox::Close | QDialogButtonBox::RestoreDefaults, this);
|
QVBoxLayout* bottom_layout = new QVBoxLayout();
|
||||||
connect(bbox, &QDialogButtonBox::rejected, this, &QDialog::accept);
|
bottom_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
connect(bbox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this,
|
QHBoxLayout* bottom_hlayout = new QHBoxLayout();
|
||||||
&ControllerCustomSettingsDialog::restoreDefaults);
|
bottom_hlayout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->addWidget(bbox, row++, 0, 1, 4);
|
QPushButton* restore_defaults = new QPushButton(tr("Restore Default Settings"), this);
|
||||||
|
restore_defaults->setIcon(QIcon::fromTheme(QStringLiteral("restart-line")));
|
||||||
|
connect(restore_defaults, &QPushButton::clicked, this, &ControllerCustomSettingsWidget::restoreDefaults);
|
||||||
|
bottom_hlayout->addWidget(restore_defaults);
|
||||||
|
bottom_hlayout->addStretch(1);
|
||||||
|
bottom_layout->addLayout(bottom_hlayout);
|
||||||
|
bottom_layout->addStretch(1);
|
||||||
|
layout->addLayout(bottom_layout, row++, 0, 1, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllerCustomSettingsDialog::~ControllerCustomSettingsDialog() {}
|
ControllerCustomSettingsWidget::~ControllerCustomSettingsWidget() {}
|
||||||
|
|
||||||
int ControllerCustomSettingsDialog::createSettingWidgets(ControllerBindingWidget* parent, QGridLayout* layout)
|
int ControllerCustomSettingsWidget::createSettingWidgets(ControllerBindingWidget* parent, QGridLayout* layout)
|
||||||
{
|
{
|
||||||
const Controller::ControllerInfo* cinfo = Controller::GetControllerInfo(parent->getControllerType());
|
const Controller::ControllerInfo* cinfo = Controller::GetControllerInfo(parent->getControllerType());
|
||||||
if (!cinfo || cinfo->num_settings == 0)
|
if (!cinfo || cinfo->num_settings == 0)
|
||||||
|
@ -539,7 +602,7 @@ int ControllerCustomSettingsDialog::createSettingWidgets(ControllerBindingWidget
|
||||||
return current_row;
|
return current_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerCustomSettingsDialog::restoreDefaults()
|
void ControllerCustomSettingsWidget::restoreDefaults()
|
||||||
{
|
{
|
||||||
ControllerBindingWidget* parent = static_cast<ControllerBindingWidget*>(this->parent());
|
ControllerBindingWidget* parent = static_cast<ControllerBindingWidget*>(this->parent());
|
||||||
const Controller::ControllerInfo* cinfo = Controller::GetControllerInfo(parent->getControllerType());
|
const Controller::ControllerInfo* cinfo = Controller::GetControllerInfo(parent->getControllerType());
|
||||||
|
@ -689,16 +752,6 @@ void ControllerBindingWidget_Base::initBindingWidgets()
|
||||||
ControllerSettingWidgetBinder::BindWidgetToInputProfileNormalized(sif, widget, config_section, "AnalogSensitivity",
|
ControllerSettingWidgetBinder::BindWidgetToInputProfileNormalized(sif, widget, config_section, "AnalogSensitivity",
|
||||||
range, Controller::DEFAULT_STICK_SENSITIVITY);
|
range, Controller::DEFAULT_STICK_SENSITIVITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// FIXME
|
|
||||||
if (QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QStringLiteral("SmallMotorScale")); widget)
|
|
||||||
ControllerSettingWidgetBinder::BindWidgetToInputProfileFloat(sif, widget, config_section, "SmallMotorScale",
|
|
||||||
Controller::DEFAULT_MOTOR_SCALE);
|
|
||||||
if (QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QStringLiteral("LargeMotorScale")); widget)
|
|
||||||
ControllerSettingWidgetBinder::BindWidgetToInputProfileFloat(sif, widget, config_section, "LargeMotorScale",
|
|
||||||
Controller::DEFAULT_MOTOR_SCALE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -12,14 +12,15 @@
|
||||||
#include "ui_controllerbindingwidget_digital_controller.h"
|
#include "ui_controllerbindingwidget_digital_controller.h"
|
||||||
#include "ui_controllerbindingwidget_guncon.h"
|
#include "ui_controllerbindingwidget_guncon.h"
|
||||||
#include "ui_controllerbindingwidget_negcon.h"
|
#include "ui_controllerbindingwidget_negcon.h"
|
||||||
#include "ui_controllermacrodialog.h"
|
#include "ui_controllermacrowidget.h"
|
||||||
#include "ui_controllermacroeditwidget.h"
|
#include "ui_controllermacroeditwidget.h"
|
||||||
|
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
|
||||||
class InputBindingWidget;
|
class InputBindingWidget;
|
||||||
class ControllerSettingsDialog;
|
class ControllerSettingsDialog;
|
||||||
class ControllerMacroDialog;
|
class ControllerCustomSettingsWidget;
|
||||||
|
class ControllerMacroWidget;
|
||||||
class ControllerMacroEditWidget;
|
class ControllerMacroEditWidget;
|
||||||
class ControllerBindingWidget_Base;
|
class ControllerBindingWidget_Base;
|
||||||
|
|
||||||
|
@ -44,12 +45,14 @@ private Q_SLOTS:
|
||||||
void onTypeChanged();
|
void onTypeChanged();
|
||||||
void onAutomaticBindingClicked();
|
void onAutomaticBindingClicked();
|
||||||
void onClearBindingsClicked();
|
void onClearBindingsClicked();
|
||||||
|
void onBindingsClicked();
|
||||||
void onSettingsClicked();
|
void onSettingsClicked();
|
||||||
void onMacrosClicked();
|
void onMacrosClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void populateControllerTypes();
|
void populateControllerTypes();
|
||||||
void populateBindingWidget();
|
void populateWidgets();
|
||||||
|
void updateHeaderToolButtons();
|
||||||
void doDeviceAutomaticBinding(const QString& device);
|
void doDeviceAutomaticBinding(const QString& device);
|
||||||
void saveAndRefresh();
|
void saveAndRefresh();
|
||||||
|
|
||||||
|
@ -61,18 +64,20 @@ private:
|
||||||
ControllerType m_controller_type;
|
ControllerType m_controller_type;
|
||||||
u32 m_port_number;
|
u32 m_port_number;
|
||||||
|
|
||||||
ControllerBindingWidget_Base* m_current_widget = nullptr;
|
ControllerBindingWidget_Base* m_bindings_widget = nullptr;
|
||||||
|
ControllerCustomSettingsWidget* m_settings_widget = nullptr;
|
||||||
|
ControllerMacroWidget* m_macros_widget = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class ControllerMacroDialog : public QDialog
|
class ControllerMacroWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ControllerMacroDialog(ControllerBindingWidget* parent);
|
ControllerMacroWidget(ControllerBindingWidget* parent);
|
||||||
~ControllerMacroDialog();
|
~ControllerMacroWidget();
|
||||||
|
|
||||||
void updateListItem(u32 index);
|
void updateListItem(u32 index);
|
||||||
|
|
||||||
|
@ -81,7 +86,7 @@ private:
|
||||||
|
|
||||||
void createWidgets(ControllerBindingWidget* parent);
|
void createWidgets(ControllerBindingWidget* parent);
|
||||||
|
|
||||||
Ui::ControllerMacroDialog m_ui;
|
Ui::ControllerMacroWidget m_ui;
|
||||||
ControllerSettingsDialog* m_dialog;
|
ControllerSettingsDialog* m_dialog;
|
||||||
std::array<ControllerMacroEditWidget*, NUM_MACROS> m_macros;
|
std::array<ControllerMacroEditWidget*, NUM_MACROS> m_macros;
|
||||||
};
|
};
|
||||||
|
@ -93,7 +98,7 @@ class ControllerMacroEditWidget : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ControllerMacroEditWidget(ControllerMacroDialog* parent, ControllerBindingWidget* bwidget, u32 index);
|
ControllerMacroEditWidget(ControllerMacroWidget* parent, ControllerBindingWidget* bwidget, u32 index);
|
||||||
~ControllerMacroEditWidget();
|
~ControllerMacroEditWidget();
|
||||||
|
|
||||||
QString getSummary() const;
|
QString getSummary() const;
|
||||||
|
@ -109,7 +114,7 @@ private:
|
||||||
|
|
||||||
Ui::ControllerMacroEditWidget m_ui;
|
Ui::ControllerMacroEditWidget m_ui;
|
||||||
|
|
||||||
ControllerMacroDialog* m_parent;
|
ControllerMacroWidget* m_parent;
|
||||||
ControllerBindingWidget* m_bwidget;
|
ControllerBindingWidget* m_bwidget;
|
||||||
u32 m_index;
|
u32 m_index;
|
||||||
|
|
||||||
|
@ -119,13 +124,13 @@ private:
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class ControllerCustomSettingsDialog : public QDialog
|
class ControllerCustomSettingsWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ControllerCustomSettingsDialog(ControllerBindingWidget* parent);
|
ControllerCustomSettingsWidget(ControllerBindingWidget* parent);
|
||||||
~ControllerCustomSettingsDialog();
|
~ControllerCustomSettingsWidget();
|
||||||
|
|
||||||
int createSettingWidgets(ControllerBindingWidget* parent, QGridLayout* layout);
|
int createSettingWidgets(ControllerBindingWidget* parent, QGridLayout* layout);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ControllerMacroDialog</class>
|
<class>ControllerMacroWidget</class>
|
||||||
<widget class="QDialog" name="ControllerMacroDialog">
|
<widget class="QWidget" name="ControllerMacroWidget">
|
||||||
<property name="windowModality">
|
|
||||||
<enum>Qt::WindowModal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -20,6 +17,18 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QListWidget" name="portList">
|
<widget class="QListWidget" name="portList">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -52,15 +61,7 @@
|
||||||
<widget class="QStackedWidget" name="container"/>
|
<widget class="QStackedWidget" name="container"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="1" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Close</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
|
@ -188,7 +188,7 @@
|
||||||
<QtUi Include="controllersettingsdialog.ui">
|
<QtUi Include="controllersettingsdialog.ui">
|
||||||
<FileType>Document</FileType>
|
<FileType>Document</FileType>
|
||||||
</QtUi>
|
</QtUi>
|
||||||
<QtUi Include="controllermacrodialog.ui">
|
<QtUi Include="controllermacrowidget.ui">
|
||||||
<FileType>Document</FileType>
|
<FileType>Document</FileType>
|
||||||
</QtUi>
|
</QtUi>
|
||||||
<QtUi Include="controllermacroeditwidget.ui">
|
<QtUi Include="controllermacroeditwidget.ui">
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
<ClCompile Include="$(IntDir)moc_generalsettingswidget.cpp" />
|
<ClCompile Include="$(IntDir)moc_generalsettingswidget.cpp" />
|
||||||
<ClCompile Include="advancedsettingswidget.cpp" />
|
<ClCompile Include="advancedsettingswidget.cpp" />
|
||||||
<ClCompile Include="$(IntDir)moc_advancedsettingswidget.cpp" />
|
<ClCompile Include="$(IntDir)moc_advancedsettingswidget.cpp" />
|
||||||
<ClCompile Include="$(IntDir)moc_gamepropertiesdialog.cpp" />
|
|
||||||
<ClCompile Include="gdbconnection.cpp" />
|
<ClCompile Include="gdbconnection.cpp" />
|
||||||
<ClCompile Include="$(IntDir)moc_gdbconnection.cpp" />
|
<ClCompile Include="$(IntDir)moc_gdbconnection.cpp" />
|
||||||
<ClCompile Include="gdbserver.cpp" />
|
<ClCompile Include="gdbserver.cpp" />
|
||||||
|
@ -186,6 +185,8 @@
|
||||||
<QtUi Include="controllerbindingwidget_analog_joystick.ui" />
|
<QtUi Include="controllerbindingwidget_analog_joystick.ui" />
|
||||||
<QtUi Include="controllerbindingwidget_negcon.ui" />
|
<QtUi Include="controllerbindingwidget_negcon.ui" />
|
||||||
<QtUi Include="controllerbindingwidget_guncon.ui" />
|
<QtUi Include="controllerbindingwidget_guncon.ui" />
|
||||||
|
<QtUi Include="controllermacrowidget.ui" />
|
||||||
|
<QtUi Include="controllermacroeditwidget.ui" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Natvis Include="qt5.natvis" />
|
<Natvis Include="qt5.natvis" />
|
||||||
|
|
Loading…
Reference in a new issue