Qt: Begin settings view revamp
@@ -15,6 +15,7 @@ - OpenEmu core for OS X
- Libretro: Settings for using BIOS and skipping intro - Libretro: Customizable idle loop removal - Implemented cycle counting for sprite rendering + - Cleaner, unified settings window Bugfixes: - Util: Fix PowerPC PNG read/write pixel order - VFS: Fix VFileReadline and remove _vfdReadline
@@ -105,9 +105,6 @@ QPushButton* setAll = new QPushButton(tr("Set all"));
connect(setAll, SIGNAL(pressed()), this, SLOT(setAll())); layout->addWidget(setAll); - QPushButton* save = new QPushButton(tr("Save")); - connect(save, SIGNAL(pressed()), this, SLOT(save())); - layout->addWidget(save); layout->setSpacing(6); m_keyOrder = QList<KeyEditor*>{
@@ -9,10 +9,13 @@ #include "AudioProcessor.h"
#include "ConfigController.h" #include "Display.h" #include "GBAApp.h" +#include "GBAKeyEditor.h" +#include "InputController.h" +#include "ShortcutView.h" using namespace QGBA; -SettingsView::SettingsView(ConfigController* controller, QWidget* parent) +SettingsView::SettingsView(ConfigController* controller, InputController* inputController, ShortcutController* shortcutController, QWidget* parent) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) , m_controller(controller) {@@ -94,6 +97,23 @@ if (m_ui.buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) {
updateConfig(); } }); + + GBAKeyEditor* editor = new GBAKeyEditor(inputController, InputController::KEYBOARD, QString(), this); + m_ui.tabWidget->addTab(editor, "Keyboard"); + connect(m_ui.buttonBox, SIGNAL(accepted()), editor, SLOT(save())); + +#ifdef BUILD_SDL + inputController->recalibrateAxes(); + const char* profile = inputController->profileForType(SDL_BINDING_BUTTON); + editor = new GBAKeyEditor(inputController, SDL_BINDING_BUTTON, profile); + m_ui.tabWidget->addTab(editor, "Controllers"); + connect(m_ui.buttonBox, SIGNAL(accepted()), editor, SLOT(save())); +#endif + + ShortcutView* shortcutView = new ShortcutView(); + shortcutView->setController(shortcutController); + shortcutView->setInputController(inputController); + m_ui.tabWidget->addTab(shortcutView, "Shortcuts"); } void SettingsView::selectBios() {
@@ -13,12 +13,14 @@
namespace QGBA { class ConfigController; +class InputController; +class ShortcutController; class SettingsView : public QDialog { Q_OBJECT public: - SettingsView(ConfigController* controller, QWidget* parent = nullptr); + SettingsView(ConfigController* controller, InputController* inputController, ShortcutController* shortcutController, QWidget* parent = nullptr); signals: void biosLoaded(const QString&);@@ -33,6 +35,7 @@ private:
Ui::SettingsView m_ui; ConfigController* m_controller; + InputController* m_input; void saveSetting(const char* key, const QAbstractButton*); void saveSetting(const char* key, const QComboBox*);
@@ -6,8 +6,8 @@ <property name="geometry">
<rect> <x>0</x> <y>0</y> - <width>707</width> - <height>420</height> + <width>417</width> + <height>457</height> </rect> </property> <property name="sizePolicy">@@ -24,11 +24,17 @@ <property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum> </property> <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Audio/Video</string> + </attribute> <layout class="QFormLayout" name="formLayout"> <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> + <enum>QFormLayout::FieldsStayAtSizeHint</enum> </property> <item row="0" column="0"> <widget class="QLabel" name="label_14">@@ -120,6 +126,50 @@ <string>Sample rate:</string>
</property> </widget> </item> + <item row="2" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_14"> + <item> + <widget class="QComboBox" name="sampleRate"> + <property name="editable"> + <bool>true</bool> + </property> + <property name="currentText" stdset="0"> + <string>44100</string> + </property> + <property name="currentIndex"> + <number>2</number> + </property> + <item> + <property name="text"> + <string>22050</string> + </property> + </item> + <item> + <property name="text"> + <string>32000</string> + </property> + </item> + <item> + <property name="text"> + <string>44100</string> + </property> + </item> + <item> + <property name="text"> + <string>48000</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>Hz</string> + </property> + </widget> + </item> + </layout> + </item> <item row="3" column="0"> <widget class="QLabel" name="label_17"> <property name="text">@@ -153,13 +203,6 @@ </property>
</widget> </item> </layout> - </item> - <item row="4" column="0" colspan="2"> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> </item> <item row="5" column="0"> <widget class="QLabel" name="label_10">@@ -237,13 +280,6 @@ </widget>
</item> </layout> </item> - <item row="8" column="0" colspan="2"> - <widget class="Line" name="line_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> <item row="9" column="0"> <widget class="QLabel" name="label_2"> <property name="text">@@ -283,61 +319,30 @@ <string>Resample video</string>
</property> </widget> </item> - <item row="2" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_14"> - <item> - <widget class="QComboBox" name="sampleRate"> - <property name="editable"> - <bool>true</bool> - </property> - <property name="currentText" stdset="0"> - <string>44100</string> - </property> - <property name="currentIndex"> - <number>2</number> - </property> - <item> - <property name="text"> - <string>22050</string> - </property> - </item> - <item> - <property name="text"> - <string>32000</string> - </property> - </item> - <item> - <property name="text"> - <string>44100</string> - </property> - </item> - <item> - <property name="text"> - <string>48000</string> - </property> - </item> - </widget> - </item> - <item> - <widget class="QLabel" name="label_20"> - <property name="text"> - <string>Hz</string> - </property> - </widget> - </item> - </layout> + <item row="4" column="0" colspan="2"> + <widget class="Line" name="line_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="8" column="0" colspan="2"> + <widget class="Line" name="line_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> </item> </layout> - </item> - <item> - <widget class="Line" name="line_5"> - <property name="orientation"> - <enum>Qt::Vertical</enum> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Running</string> + </attribute> + <layout class="QFormLayout" name="formLayout_2"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::FieldsStayAtSizeHint</enum> </property> - </widget> - </item> - <item> - <layout class="QFormLayout" name="formLayout_4"> <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="text">@@ -366,35 +371,31 @@ </widget>
</item> </layout> </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="skipBios"> + <item row="1" column="1"> + <widget class="QCheckBox" name="useBios"> <property name="text"> - <string>Skip BIOS intro</string> + <string>Use BIOS file</string> </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <widget class="Line" name="line_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <property name="checked"> + <bool>true</bool> </property> </widget> </item> - <item row="5" column="1"> - <widget class="QCheckBox" name="rewind"> + <item row="4" column="0"> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Enable rewind</string> + <string>Create rewind state:</string> </property> </widget> </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_4"> + <item row="4" column="1"> + <widget class="QCheckBox" name="rewind"> <property name="text"> - <string>Create rewind state:</string> + <string>Enable rewind</string> </property> </widget> </item> - <item row="6" column="1"> + <item row="5" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_12"> <item> <widget class="QLabel" name="label_5">@@ -415,14 +416,14 @@ </widget>
</item> </layout> </item> - <item row="7" column="0"> + <item row="6" column="0"> <widget class="QLabel" name="label_8"> <property name="text"> <string>Rewind history:</string> </property> </widget> </item> - <item row="7" column="1"> + <item row="6" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_13"> <item> <widget class="QSpinBox" name="rewindCapacity"/>@@ -436,21 +437,53 @@ </widget>
</item> </layout> </item> - <item row="11" column="0" colspan="2"> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <item row="8" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Fast forward speed</string> + </property> + </widget> + </item> + <item row="8" column="1"> + <widget class="QDoubleSpinBox" name="fastForwardRatio"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="suffix"> + <string>×</string> + </property> + <property name="minimum"> + <double>0.010000000000000</double> + </property> + <property name="maximum"> + <double>20.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.500000000000000</double> + </property> + <property name="value"> + <double>5.000000000000000</double> </property> </widget> </item> - <item row="12" column="1"> + <item row="9" column="1"> + <widget class="QCheckBox" name="fastForwardUnbounded"> + <property name="text"> + <string>Unbounded</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="11" column="1"> <widget class="QCheckBox" name="allowOpposingDirections"> <property name="text"> <string>Allow opposing input directions</string> </property> </widget> </item> - <item row="13" column="1"> + <item row="12" column="1"> <widget class="QCheckBox" name="suspendScreensaver"> <property name="text"> <string>Suspend screensaver</string>@@ -460,14 +493,14 @@ <bool>true</bool>
</property> </widget> </item> - <item row="14" column="0"> + <item row="13" column="0"> <widget class="QLabel" name="label_15"> <property name="text"> <string>Idle loops</string> </property> </widget> </item> - <item row="14" column="1"> + <item row="13" column="1"> <widget class="QComboBox" name="idleOptimization"> <item> <property name="text">@@ -486,65 +519,37 @@ </property>
</item> </widget> </item> - <item row="9" column="1"> - <widget class="QDoubleSpinBox" name="fastForwardRatio"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="suffix"> - <string>×</string> - </property> - <property name="minimum"> - <double>0.010000000000000</double> - </property> - <property name="maximum"> - <double>20.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.500000000000000</double> - </property> - <property name="value"> - <double>5.000000000000000</double> - </property> - </widget> - </item> - <item row="9" column="0"> - <widget class="QLabel" name="label_18"> + <item row="2" column="1"> + <widget class="QCheckBox" name="skipBios"> <property name="text"> - <string>Fast forward speed</string> + <string>Skip BIOS intro</string> </property> </widget> </item> - <item row="10" column="1"> - <widget class="QCheckBox" name="fastForwardUnbounded"> - <property name="text"> - <string>Unbounded</string> - </property> - <property name="checked"> - <bool>true</bool> + <item row="3" column="0" colspan="2"> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="8" column="0" colspan="2"> - <widget class="Line" name="line_6"> + <item row="7" column="0" colspan="2"> + <widget class="Line" name="line_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="useBios"> - <property name="text"> - <string>Use BIOS file</string> - </property> - <property name="checked"> - <bool>true</bool> + <item row="10" column="0" colspan="2"> + <widget class="Line" name="line_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> </layout> - </item> - </layout> + </widget> + </widget> </item> <item> <widget class="QDialogButtonBox" name="buttonBox">
@@ -20,7 +20,6 @@ #include "ConfigController.h"
#include "Display.h" #include "GameController.h" #include "GBAApp.h" -#include "GBAKeyEditor.h" #include "GDBController.h" #include "GDBWindow.h" #include "GIFView.h"@@ -36,7 +35,6 @@ #include "SensorView.h"
#include "SettingsView.h" #include "ShaderSelector.h" #include "ShortcutController.h" -#include "ShortcutView.h" #include "VideoView.h" extern "C" {@@ -344,27 +342,12 @@ m_controller->exportSharkport(filename);
} } -void Window::openKeymapWindow() { - GBAKeyEditor* keyEditor = new GBAKeyEditor(&m_inputController, InputController::KEYBOARD); - openView(keyEditor); -} - void Window::openSettingsWindow() { - SettingsView* settingsWindow = new SettingsView(m_config); + SettingsView* settingsWindow = new SettingsView(m_config, &m_inputController, m_shortcutController); connect(settingsWindow, SIGNAL(biosLoaded(const QString&)), m_controller, SLOT(loadBIOS(const QString&))); connect(settingsWindow, SIGNAL(audioDriverChanged()), m_controller, SLOT(reloadAudioDriver())); connect(settingsWindow, SIGNAL(displayDriverChanged()), this, SLOT(mustRestart())); openView(settingsWindow); -} - -void Window::openShortcutWindow() { -#ifdef BUILD_SDL - m_inputController.recalibrateAxes(); -#endif - ShortcutView* shortcutView = new ShortcutView(); - shortcutView->setController(m_shortcutController); - shortcutView->setInputController(&m_inputController); - openView(shortcutView); } void Window::openOverrideWindow() {@@ -406,14 +389,6 @@ void Window::openROMInfo() {
ROMInfo* romInfo = new ROMInfo(m_controller); openView(romInfo); } - -#ifdef BUILD_SDL -void Window::openGamepadWindow() { - const char* profile = m_inputController.profileForType(SDL_BINDING_BUTTON); - GBAKeyEditor* keyEditor = new GBAKeyEditor(&m_inputController, SDL_BINDING_BUTTON, profile); - openView(keyEditor); -} -#endif #ifdef USE_FFMPEG void Window::openVideoWindow() {@@ -1190,18 +1165,6 @@
toolsMenu->addSeparator(); addControlledAction(toolsMenu, toolsMenu->addAction(tr("Settings..."), this, SLOT(openSettingsWindow())), "settings"); - addControlledAction(toolsMenu, toolsMenu->addAction(tr("Edit shortcuts..."), this, SLOT(openShortcutWindow())), - "shortcuts"); - - QAction* keymap = new QAction(tr("Remap keyboard..."), toolsMenu); - connect(keymap, SIGNAL(triggered()), this, SLOT(openKeymapWindow())); - addControlledAction(toolsMenu, keymap, "remapKeyboard"); - -#ifdef BUILD_SDL - QAction* gamepad = new QAction(tr("Remap gamepad..."), toolsMenu); - connect(gamepad, SIGNAL(triggered()), this, SLOT(openGamepadWindow())); - addControlledAction(toolsMenu, gamepad, "remapGamepad"); -#endif toolsMenu->addSeparator();
@@ -75,10 +75,7 @@
void importSharkport(); void exportSharkport(); - void openKeymapWindow(); void openSettingsWindow(); - void openShortcutWindow(); - void openOverrideWindow(); void openSensorWindow(); void openCheatsWindow();@@ -89,10 +86,6 @@ void openIOViewer();
void openAboutScreen(); void openROMInfo(); - -#ifdef BUILD_SDL - void openGamepadWindow(); -#endif #ifdef USE_FFMPEG void openVideoWindow();