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#include "LogConfigModel.h"
12
13#include <mgba/core/core.h>
14
15#ifdef M_CORE_GB
16#include <mgba/gb/interface.h>
17#endif
18
19#include "ui_SettingsView.h"
20
21namespace QGBA {
22
23class ConfigController;
24class InputController;
25class ShortcutController;
26class ShaderSelector;
27
28class SettingsView : public QDialog {
29Q_OBJECT
30
31public:
32 SettingsView(ConfigController* controller, InputController* inputController, ShortcutController* shortcutController, LogController* logController, 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 cameraChanged(const QByteArray&);
43 void videoRendererChanged();
44 void pathsChanged();
45 void languageChanged();
46 void libraryCleared();
47
48private slots:
49 void selectBios(QLineEdit*);
50 void updateConfig();
51 void reloadConfig();
52
53private:
54 Ui::SettingsView m_ui;
55
56 ConfigController* m_controller;
57 InputController* m_input;
58 ShaderSelector* m_shader = nullptr;
59 LogConfigModel m_logModel;
60
61#ifdef M_CORE_GB
62 uint32_t m_gbColors[12]{};
63 ColorPicker m_colorPickers[12];
64 static QList<enum GBModel> s_gbModelList;
65#endif
66
67 void saveSetting(const char* key, const QAbstractButton*);
68 void saveSetting(const char* key, const QComboBox*);
69 void saveSetting(const char* key, const QDoubleSpinBox*);
70 void saveSetting(const char* key, const QLineEdit*);
71 void saveSetting(const char* key, const QSlider*);
72 void saveSetting(const char* key, const QSpinBox*);
73 void saveSetting(const char* key, const QVariant&);
74
75 void loadSetting(const char* key, QAbstractButton*, bool defaultVal = false);
76 void loadSetting(const char* key, QComboBox*);
77 void loadSetting(const char* key, QDoubleSpinBox*);
78 void loadSetting(const char* key, QLineEdit*);
79 void loadSetting(const char* key, QSlider*, int defaultVal = 0);
80 void loadSetting(const char* key, QSpinBox*, int defaultVal = 0);
81 QString loadSetting(const char* key);
82};
83
84}