src/platform/qt/SettingsView.h (view raw)
1/* Copyright (c) 2013-2014 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef QGBA_SETTINGS_VIEW
7#define QGBA_SETTINGS_VIEW
8
9#include <QDialog>
10
11#include "ColorPicker.h"
12
13#include <mgba/core/core.h>
14
15#include "ui_SettingsView.h"
16
17namespace QGBA {
18
19class ConfigController;
20class InputController;
21class ShortcutController;
22class ShaderSelector;
23
24class SettingsView : public QDialog {
25Q_OBJECT
26
27public:
28 SettingsView(ConfigController* controller, InputController* inputController, ShortcutController* shortcutController, QWidget* parent = nullptr);
29 ~SettingsView();
30
31 void setShaderSelector(ShaderSelector* shaderSelector);
32
33signals:
34 void biosLoaded(int platform, const QString&);
35 void audioDriverChanged();
36 void displayDriverChanged();
37 void cameraDriverChanged();
38 void pathsChanged();
39 void languageChanged();
40 void libraryCleared();
41
42private slots:
43 void selectBios(QLineEdit*);
44 void updateConfig();
45 void reloadConfig();
46
47private:
48 Ui::SettingsView m_ui;
49
50 ConfigController* m_controller;
51 InputController* m_input;
52 ShaderSelector* m_shader = nullptr;
53 uint32_t m_gbColors[4]{};
54 ColorPicker m_colorPickers[4];
55
56 void saveSetting(const char* key, const QAbstractButton*);
57 void saveSetting(const char* key, const QComboBox*);
58 void saveSetting(const char* key, const QDoubleSpinBox*);
59 void saveSetting(const char* key, const QLineEdit*);
60 void saveSetting(const char* key, const QSlider*);
61 void saveSetting(const char* key, const QSpinBox*);
62 void saveSetting(const char* key, const QVariant&);
63
64 void loadSetting(const char* key, QAbstractButton*);
65 void loadSetting(const char* key, QComboBox*);
66 void loadSetting(const char* key, QDoubleSpinBox*);
67 void loadSetting(const char* key, QLineEdit*);
68 void loadSetting(const char* key, QSlider*);
69 void loadSetting(const char* key, QSpinBox*);
70 QString loadSetting(const char* key);
71};
72
73}
74
75#endif