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 InputIndex;
25class ShortcutView;
26class ShaderSelector;
27
28class SettingsView : public QDialog {
29Q_OBJECT
30
31public:
32 SettingsView(ConfigController* controller, InputController* inputController, QWidget* parent = nullptr);
33 ~SettingsView();
34
35 void setShaderSelector(ShaderSelector* shaderSelector);
36
37signals:
38 void biosLoaded(int platform, const QString&);
39 void audioDriverChanged();
40 void displayDriverChanged();
41 void cameraDriverChanged();
42 void pathsChanged();
43 void languageChanged();
44 void libraryCleared();
45
46private slots:
47 void selectBios(QLineEdit*);
48 void updateConfig();
49 void reloadConfig();
50
51private:
52 Ui::SettingsView m_ui;
53
54 ConfigController* m_controller;
55 InputController* m_input;
56 ShortcutView* m_shortcutView;
57 ShortcutView* m_keyView;
58 ShaderSelector* m_shader = nullptr;
59
60#ifdef M_CORE_GB
61 uint32_t m_gbColors[12]{};
62 ColorPicker m_colorPickers[12];
63 static QList<enum GBModel> s_gbModelList;
64#endif
65
66 void saveSetting(const char* key, const QAbstractButton*);
67 void saveSetting(const char* key, const QComboBox*);
68 void saveSetting(const char* key, const QDoubleSpinBox*);
69 void saveSetting(const char* key, const QLineEdit*);
70 void saveSetting(const char* key, const QSlider*);
71 void saveSetting(const char* key, const QSpinBox*);
72 void saveSetting(const char* key, const QVariant&);
73
74 void loadSetting(const char* key, QAbstractButton*, bool defaultVal = false);
75 void loadSetting(const char* key, QComboBox*);
76 void loadSetting(const char* key, QDoubleSpinBox*);
77 void loadSetting(const char* key, QLineEdit*);
78 void loadSetting(const char* key, QSlider*);
79 void loadSetting(const char* key, QSpinBox*);
80 QString loadSetting(const char* key);
81};
82
83}