all repos — mgba @ 21e7d763206959ac325f1d5d6e55bb61433c700e

mGBA Game Boy Advance Emulator

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