Qt: Begin settings view revamp

This commit is contained in:
Jeffrey Pfau 2016-01-11 00:49:14 -08:00
parent baccd4ef2f
commit 2b5da04d9c
7 changed files with 188 additions and 206 deletions

View File

@ -15,6 +15,7 @@ Features:
- 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

View File

@ -105,9 +105,6 @@ GBAKeyEditor::GBAKeyEditor(InputController* controller, int type, const QString&
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*>{

View File

@ -9,10 +9,13 @@
#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 @@ SettingsView::SettingsView(ConfigController* controller, QWidget* parent)
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() {

View File

@ -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*);

View File

@ -6,8 +6,8 @@
<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 @@
<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 @@
</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">
@ -154,13 +204,6 @@
</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">
<property name="text">
@ -237,13 +280,6 @@
</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 @@
</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 @@
</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>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="rewind">
<property name="text">
<string>Enable rewind</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Create rewind state:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="4" column="1">
<widget class="QCheckBox" name="rewind">
<property name="text">
<string>Enable rewind</string>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_5">
@ -415,14 +416,14 @@
</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,57 +437,14 @@
</item>
</layout>
</item>
<item row="11" column="0" colspan="2">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="allowOpposingDirections">
<item row="8" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Allow opposing input directions</string>
<string>Fast forward speed</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QCheckBox" name="suspendScreensaver">
<property name="text">
<string>Suspend screensaver</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Idle loops</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QComboBox" name="idleOptimization">
<item>
<property name="text">
<string>Run all</string>
</property>
</item>
<item>
<property name="text">
<string>Remove known</string>
</property>
</item>
<item>
<property name="text">
<string>Detect and remove</string>
</property>
</item>
</widget>
</item>
<item row="9" column="1">
<item row="8" column="1">
<widget class="QDoubleSpinBox" name="fastForwardRatio">
<property name="enabled">
<bool>false</bool>
@ -508,14 +466,7 @@
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Fast forward speed</string>
</property>
</widget>
</item>
<item row="10" column="1">
<item row="9" column="1">
<widget class="QCheckBox" name="fastForwardUnbounded">
<property name="text">
<string>Unbounded</string>
@ -525,26 +476,80 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="11" column="1">
<widget class="QCheckBox" name="allowOpposingDirections">
<property name="text">
<string>Allow opposing input directions</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="useBios">
<item row="12" column="1">
<widget class="QCheckBox" name="suspendScreensaver">
<property name="text">
<string>Use BIOS file</string>
<string>Suspend screensaver</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Idle loops</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QComboBox" name="idleOptimization">
<item>
<property name="text">
<string>Run all</string>
</property>
</item>
<item>
<property name="text">
<string>Remove known</string>
</property>
</item>
<item>
<property name="text">
<string>Detect and remove</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="skipBios">
<property name="text">
<string>Skip BIOS intro</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<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="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">

View File

@ -20,7 +20,6 @@
#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 "SettingsView.h"
#include "ShaderSelector.h"
#include "ShortcutController.h"
#include "ShortcutView.h"
#include "VideoView.h"
extern "C" {
@ -344,29 +342,14 @@ void Window::exportSharkport() {
}
}
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() {
OverrideView* overrideWindow = new OverrideView(m_controller, m_config);
openView(overrideWindow);
@ -407,14 +390,6 @@ void Window::openROMInfo() {
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() {
if (!m_videoView) {
@ -1190,18 +1165,6 @@ void Window::setupMenu(QMenuBar* menubar) {
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();

View File

@ -75,10 +75,7 @@ public slots:
void importSharkport();
void exportSharkport();
void openKeymapWindow();
void openSettingsWindow();
void openShortcutWindow();
void openOverrideWindow();
void openSensorWindow();
void openCheatsWindow();
@ -90,10 +87,6 @@ public slots:
void openAboutScreen();
void openROMInfo();
#ifdef BUILD_SDL
void openGamepadWindow();
#endif
#ifdef USE_FFMPEG
void openVideoWindow();
#endif