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#pragma once
7
8#include <QDialog>
9
10#include "ColorPicker.h"
11
12#include <mgba/core/core.h>
13
14#ifdef M_CORE_GB
15#include <mgba/gb/interface.h>
16#endif
17
18#include "ui_SettingsView.h"
19
20namespace QGBA {
21
22class ConfigController;
23class InputController;
24class ShortcutController;
25class ShaderSelector;
26
27class SettingsView : public QDialog {
28Q_OBJECT
29
30public:
31 SettingsView(ConfigController* controller, InputController* inputController, ShortcutController* shortcutController, QWidget* parent = nullptr);
32 ~SettingsView();
33
34 void setShaderSelector(ShaderSelector* shaderSelector);
35
36signals:
37 void biosLoaded(int platform, const QString&);
38 void audioDriverChanged();
39 void displayDriverChanged();
40 void cameraDriverChanged();
41 void pathsChanged();
42 void languageChanged();
43 void libraryCleared();
44
45private slots:
46 void selectBios(QLineEdit*);
47 void updateConfig();
48 void reloadConfig();
49
50private:
51 Ui::SettingsView m_ui;
52
53 ConfigController* m_controller;
54 InputController* m_input;
55 ShaderSelector* m_shader = nullptr;
56
57#ifdef M_CORE_GB
58 uint32_t m_gbColors[12]{};
59 ColorPicker m_colorPickers[12];
60 static QList<enum GBModel> s_gbModelList;
61#endif
62
63 void saveSetting(const char* key, const QAbstractButton*);
64 void saveSetting(const char* key, const QComboBox*);
65 void saveSetting(const char* key, const QDoubleSpinBox*);
66 void saveSetting(const char* key, const QLineEdit*);
67 void saveSetting(const char* key, const QSlider*);
68 void saveSetting(const char* key, const QSpinBox*);
69 void saveSetting(const char* key, const QVariant&);
70
71 void loadSetting(const char* key, QAbstractButton*, bool defaultVal = false);
72 void loadSetting(const char* key, QComboBox*);
73 void loadSetting(const char* key, QDoubleSpinBox*);
74 void loadSetting(const char* key, QLineEdit*);
75 void loadSetting(const char* key, QSlider*, int defaultVal = 0);
76 void loadSetting(const char* key, QSpinBox*);
77 QString loadSetting(const char* key);
78};
79
80}