all repos — mgba @ 6ab7e178be1cd076965b035276e66491c41ee454

mGBA Game Boy Advance Emulator

src/platform/qt/SettingsView.cpp (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#include "SettingsView.h"
  7
  8#include "AudioProcessor.h"
  9#include "ConfigController.h"
 10#include "Display.h"
 11#include "GBAApp.h"
 12#include "GBAKeyEditor.h"
 13#include "InputController.h"
 14#include "ShaderSelector.h"
 15#include "ShortcutView.h"
 16
 17#include <mgba/core/serialize.h>
 18#include <mgba/core/version.h>
 19#include <mgba/internal/gba/gba.h>
 20
 21using namespace QGBA;
 22
 23SettingsView::SettingsView(ConfigController* controller, InputController* inputController, ShortcutController* shortcutController, QWidget* parent)
 24	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
 25	, m_controller(controller)
 26{
 27	m_ui.setupUi(this);
 28
 29	reloadConfig();
 30
 31	if (m_ui.savegamePath->text().isEmpty()) {
 32		m_ui.savegameSameDir->setChecked(true);
 33	}
 34	connect(m_ui.savegameSameDir, &QAbstractButton::toggled, [this] (bool e) {
 35		if (e) {
 36			m_ui.savegamePath->clear();
 37		}
 38	});
 39	connect(m_ui.savegameBrowse, &QAbstractButton::pressed, [this] () {
 40		QString path = GBAApp::app()->getOpenDirectoryName(this, "Select directory");
 41		if (!path.isNull()) {
 42			m_ui.savegameSameDir->setChecked(false);
 43			m_ui.savegamePath->setText(path);
 44		}
 45	});
 46
 47	if (m_ui.savestatePath->text().isEmpty()) {
 48		m_ui.savestateSameDir->setChecked(true);
 49	}
 50	connect(m_ui.savestateSameDir, &QAbstractButton::toggled, [this] (bool e) {
 51		if (e) {
 52			m_ui.savestatePath->clear();
 53		}
 54	});
 55	connect(m_ui.savestateBrowse, &QAbstractButton::pressed, [this] () {
 56		QString path = GBAApp::app()->getOpenDirectoryName(this, "Select directory");
 57		if (!path.isNull()) {
 58			m_ui.savestateSameDir->setChecked(false);
 59			m_ui.savestatePath->setText(path);
 60		}
 61	});
 62
 63	if (m_ui.screenshotPath->text().isEmpty()) {
 64		m_ui.screenshotSameDir->setChecked(true);
 65	}
 66	connect(m_ui.screenshotSameDir, &QAbstractButton::toggled, [this] (bool e) {
 67		if (e) {
 68			m_ui.screenshotPath->clear();
 69		}
 70	});
 71	connect(m_ui.screenshotBrowse, &QAbstractButton::pressed, [this] () {
 72		QString path = GBAApp::app()->getOpenDirectoryName(this, "Select directory");
 73		if (!path.isNull()) {
 74			m_ui.screenshotSameDir->setChecked(false);
 75			m_ui.screenshotPath->setText(path);
 76		}
 77	});
 78
 79	if (m_ui.patchPath->text().isEmpty()) {
 80		m_ui.patchSameDir->setChecked(true);
 81	}
 82	connect(m_ui.patchSameDir, &QAbstractButton::toggled, [this] (bool e) {
 83		if (e) {
 84			m_ui.patchPath->clear();
 85		}
 86	});
 87	connect(m_ui.patchBrowse, &QAbstractButton::pressed, [this] () {
 88		QString path = GBAApp::app()->getOpenDirectoryName(this, "Select directory");
 89		if (!path.isNull()) {
 90			m_ui.patchSameDir->setChecked(false);
 91			m_ui.patchPath->setText(path);
 92		}
 93	});
 94	connect(m_ui.clearCache, &QAbstractButton::pressed, this, &SettingsView::libraryCleared);
 95
 96	// TODO: Move to reloadConfig()
 97	QVariant audioDriver = m_controller->getQtOption("audioDriver");
 98#ifdef BUILD_QT_MULTIMEDIA
 99	m_ui.audioDriver->addItem(tr("Qt Multimedia"), static_cast<int>(AudioProcessor::Driver::QT_MULTIMEDIA));
100	if (!audioDriver.isNull() && audioDriver.toInt() == static_cast<int>(AudioProcessor::Driver::QT_MULTIMEDIA)) {
101		m_ui.audioDriver->setCurrentIndex(m_ui.audioDriver->count() - 1);
102	}
103#endif
104
105#ifdef BUILD_SDL
106	m_ui.audioDriver->addItem(tr("SDL"), static_cast<int>(AudioProcessor::Driver::SDL));
107	if (audioDriver.isNull() || audioDriver.toInt() == static_cast<int>(AudioProcessor::Driver::SDL)) {
108		m_ui.audioDriver->setCurrentIndex(m_ui.audioDriver->count() - 1);
109	}
110#endif
111
112	// TODO: Move to reloadConfig()
113	QVariant displayDriver = m_controller->getQtOption("displayDriver");
114	m_ui.displayDriver->addItem(tr("Software (Qt)"), static_cast<int>(Display::Driver::QT));
115	if (!displayDriver.isNull() && displayDriver.toInt() == static_cast<int>(Display::Driver::QT)) {
116		m_ui.displayDriver->setCurrentIndex(m_ui.displayDriver->count() - 1);
117	}
118
119#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY)
120	m_ui.displayDriver->addItem(tr("OpenGL"), static_cast<int>(Display::Driver::OPENGL));
121	if (displayDriver.isNull() || displayDriver.toInt() == static_cast<int>(Display::Driver::OPENGL)) {
122		m_ui.displayDriver->setCurrentIndex(m_ui.displayDriver->count() - 1);
123	}
124#endif
125
126#ifdef BUILD_GL
127	m_ui.displayDriver->addItem(tr("OpenGL (force version 1.x)"), static_cast<int>(Display::Driver::OPENGL1));
128	if (!displayDriver.isNull() && displayDriver.toInt() == static_cast<int>(Display::Driver::OPENGL1)) {
129		m_ui.displayDriver->setCurrentIndex(m_ui.displayDriver->count() - 1);
130	}
131#endif
132
133	// TODO: Move to reloadConfig()
134	QVariant cameraDriver = m_controller->getQtOption("cameraDriver");
135	m_ui.cameraDriver->addItem(tr("None (Still Image)"), static_cast<int>(InputController::CameraDriver::NONE));
136	if (cameraDriver.isNull() || cameraDriver.toInt() == static_cast<int>(InputController::CameraDriver::NONE)) {
137		m_ui.cameraDriver->setCurrentIndex(m_ui.cameraDriver->count() - 1);
138	}
139
140#ifdef BUILD_QT_MULTIMEDIA
141	m_ui.cameraDriver->addItem(tr("Qt Multimedia"), static_cast<int>(InputController::CameraDriver::QT_MULTIMEDIA));
142	if (!cameraDriver.isNull() && cameraDriver.toInt() == static_cast<int>(InputController::CameraDriver::QT_MULTIMEDIA)) {
143		m_ui.cameraDriver->setCurrentIndex(m_ui.cameraDriver->count() - 1);
144	}
145#endif
146
147#ifdef M_CORE_GBA
148	connect(m_ui.gbaBiosBrowse, &QPushButton::clicked, [this]() {
149		selectBios(m_ui.gbaBios);
150	});
151#else
152	m_ui.gbaBiosBrowse->hide();
153#endif
154
155#ifdef M_CORE_GB
156	connect(m_ui.gbBiosBrowse, &QPushButton::clicked, [this]() {
157		selectBios(m_ui.gbBios);
158	});
159	connect(m_ui.gbcBiosBrowse, &QPushButton::clicked, [this]() {
160		selectBios(m_ui.gbcBios);
161	});
162
163	QList<QColor> defaultColors;
164	defaultColors.append(QColor(0xF8, 0xF8, 0xF8));
165	defaultColors.append(QColor(0xA8, 0xA8, 0xA8));
166	defaultColors.append(QColor(0x50, 0x50, 0x50));
167	defaultColors.append(QColor(0x00, 0x00, 0x00));
168	bool ok;
169	if (m_controller->getOption("gb.pal[0]").toUInt(&ok) || ok) {
170		defaultColors[0] = QColor::fromRgb(m_controller->getOption("gb.pal[0]").toUInt());
171	}
172	if (m_controller->getOption("gb.pal[1]").toUInt(&ok) || ok) {
173		defaultColors[1] = QColor::fromRgb(m_controller->getOption("gb.pal[1]").toUInt());
174	}
175	if (m_controller->getOption("gb.pal[2]").toUInt(&ok) || ok) {
176		defaultColors[2] = QColor::fromRgb(m_controller->getOption("gb.pal[2]").toUInt());
177	}
178	if (m_controller->getOption("gb.pal[3]").toUInt(&ok) || ok) {
179		defaultColors[3] = QColor::fromRgb(m_controller->getOption("gb.pal[3]").toUInt());
180	}
181	m_colorPickers[0] = ColorPicker(m_ui.color0, defaultColors[0]);
182	m_colorPickers[1] = ColorPicker(m_ui.color1, defaultColors[1]);
183	m_colorPickers[2] = ColorPicker(m_ui.color2, defaultColors[2]);
184	m_colorPickers[3] = ColorPicker(m_ui.color3, defaultColors[3]);
185	for (int colorId = 0; colorId < 4; ++colorId) {
186		connect(&m_colorPickers[colorId], &ColorPicker::colorChanged, this, [this, colorId](const QColor& color) {
187			m_gbColors[colorId] = color.rgb();
188		});
189	}
190#else
191	m_ui.gbBiosBrowse->hide();
192	m_ui.gbcBiosBrowse->hide();
193	m_ui.gb->hide();
194#endif
195
196	GBAKeyEditor* editor = new GBAKeyEditor(inputController, InputController::KEYBOARD, QString(), this);
197	m_ui.stackedWidget->addWidget(editor);
198	m_ui.tabs->addItem(tr("Keyboard"));
199	connect(m_ui.buttonBox, &QDialogButtonBox::accepted, editor, &GBAKeyEditor::save);
200
201	GBAKeyEditor* buttonEditor = nullptr;
202#ifdef BUILD_SDL
203	inputController->recalibrateAxes();
204	const char* profile = inputController->profileForType(SDL_BINDING_BUTTON);
205	buttonEditor = new GBAKeyEditor(inputController, SDL_BINDING_BUTTON, profile);
206	m_ui.stackedWidget->addWidget(buttonEditor);
207	m_ui.tabs->addItem(tr("Controllers"));
208	connect(m_ui.buttonBox, &QDialogButtonBox::accepted, buttonEditor, &GBAKeyEditor::save);
209#endif
210
211	connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &SettingsView::updateConfig);
212	connect(m_ui.buttonBox, &QDialogButtonBox::clicked, [this, editor, buttonEditor](QAbstractButton* button) {
213		if (m_ui.buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) {
214			updateConfig();
215			editor->save();
216			if (buttonEditor) {
217				buttonEditor->save();
218			}
219		}
220	});
221
222	m_ui.languages->setItemData(0, QLocale("en"));
223	QDir ts(":/translations/");
224	for (auto name : ts.entryList()) {
225		if (!name.endsWith(".qm") || !name.startsWith(binaryName)) {
226			continue;
227		}
228		QLocale locale(name.remove(QString("%0-").arg(binaryName)).remove(".qm"));
229		m_ui.languages->addItem(locale.nativeLanguageName(), locale);
230		if (locale == QLocale()) {
231			m_ui.languages->setCurrentIndex(m_ui.languages->count() - 1);
232		}
233	}
234
235	ShortcutView* shortcutView = new ShortcutView();
236	shortcutView->setController(shortcutController);
237	shortcutView->setInputController(inputController);
238	m_ui.stackedWidget->addWidget(shortcutView);
239	m_ui.tabs->addItem(tr("Shortcuts"));
240}
241
242SettingsView::~SettingsView() {
243#if defined(BUILD_GL) || defined(BUILD_GLES)
244	setShaderSelector(nullptr);
245#endif
246}
247
248void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) {
249#if defined(BUILD_GL) || defined(BUILD_GLES)
250	if (m_shader) {
251		auto items = m_ui.tabs->findItems(tr("Shaders"), Qt::MatchFixedString);
252		for (const auto& item : items) {
253			m_ui.tabs->removeItemWidget(item);
254		}
255		m_ui.stackedWidget->removeWidget(m_shader);
256		m_shader->setParent(nullptr);
257	}
258	m_shader = shaderSelector;
259	if (shaderSelector) {
260		m_ui.stackedWidget->addWidget(m_shader);
261		m_ui.tabs->addItem(tr("Shaders"));
262		connect(m_ui.buttonBox, &QDialogButtonBox::accepted, m_shader, &ShaderSelector::saved);
263	}
264#endif
265}
266
267void SettingsView::selectBios(QLineEdit* bios) {
268	QString filename = GBAApp::app()->getOpenFileName(this, tr("Select BIOS"));
269	if (!filename.isEmpty()) {
270		bios->setText(filename);
271	}
272}
273
274void SettingsView::updateConfig() {
275	saveSetting("gba.bios", m_ui.gbaBios);
276	saveSetting("gb.bios", m_ui.gbBios);
277	saveSetting("gbc.bios", m_ui.gbcBios);
278	saveSetting("useBios", m_ui.useBios);
279	saveSetting("skipBios", m_ui.skipBios);
280	saveSetting("audioBuffers", m_ui.audioBufferSize);
281	saveSetting("sampleRate", m_ui.sampleRate);
282	saveSetting("videoSync", m_ui.videoSync);
283	saveSetting("audioSync", m_ui.audioSync);
284	saveSetting("frameskip", m_ui.frameskip);
285	saveSetting("fpsTarget", m_ui.fpsTarget);
286	saveSetting("lockAspectRatio", m_ui.lockAspectRatio);
287	saveSetting("lockIntegerScaling", m_ui.lockIntegerScaling);
288	saveSetting("volume", m_ui.volume);
289	saveSetting("mute", m_ui.mute);
290	saveSetting("rewindEnable", m_ui.rewind);
291	saveSetting("rewindBufferCapacity", m_ui.rewindCapacity);
292	saveSetting("rewindSave", m_ui.rewindSave);
293	saveSetting("resampleVideo", m_ui.resampleVideo);
294	saveSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
295	saveSetting("suspendScreensaver", m_ui.suspendScreensaver);
296	saveSetting("pauseOnFocusLost", m_ui.pauseOnFocusLost);
297	saveSetting("savegamePath", m_ui.savegamePath);
298	saveSetting("savestatePath", m_ui.savestatePath);
299	saveSetting("screenshotPath", m_ui.screenshotPath);
300	saveSetting("patchPath", m_ui.patchPath);
301	saveSetting("libraryStyle", m_ui.libraryStyle->currentIndex());
302	saveSetting("showLibrary", m_ui.showLibrary);
303	saveSetting("preload", m_ui.preload);
304
305	if (m_ui.fastForwardUnbounded->isChecked()) {
306		saveSetting("fastForwardRatio", "-1");
307	} else {
308		saveSetting("fastForwardRatio", m_ui.fastForwardRatio);
309	}
310
311	switch (m_ui.idleOptimization->currentIndex() + IDLE_LOOP_IGNORE) {
312	case IDLE_LOOP_IGNORE:
313		saveSetting("idleOptimization", "ignore");
314		break;
315	case IDLE_LOOP_REMOVE:
316		saveSetting("idleOptimization", "remove");
317		break;
318	case IDLE_LOOP_DETECT:
319		saveSetting("idleOptimization", "detect");
320		break;
321	}
322
323	int loadState = SAVESTATE_RTC;
324	loadState |= m_ui.loadStateScreenshot->isChecked() ? SAVESTATE_SCREENSHOT : 0;
325	loadState |= m_ui.loadStateSave->isChecked() ? SAVESTATE_SAVEDATA : 0;
326	loadState |= m_ui.loadStateCheats->isChecked() ? SAVESTATE_CHEATS : 0;
327	saveSetting("loadStateExtdata", loadState);
328
329	int saveState = SAVESTATE_RTC | SAVESTATE_METADATA;
330	saveState |= m_ui.saveStateScreenshot->isChecked() ? SAVESTATE_SCREENSHOT : 0;
331	saveState |= m_ui.saveStateSave->isChecked() ? SAVESTATE_SAVEDATA : 0;
332	saveState |= m_ui.saveStateCheats->isChecked() ? SAVESTATE_CHEATS : 0;
333	saveSetting("saveStateExtdata", saveState);
334
335	QVariant audioDriver = m_ui.audioDriver->itemData(m_ui.audioDriver->currentIndex());
336	if (audioDriver != m_controller->getQtOption("audioDriver")) {
337		m_controller->setQtOption("audioDriver", audioDriver);
338		AudioProcessor::setDriver(static_cast<AudioProcessor::Driver>(audioDriver.toInt()));
339		emit audioDriverChanged();
340	}
341
342	QVariant displayDriver = m_ui.displayDriver->itemData(m_ui.displayDriver->currentIndex());
343	if (displayDriver != m_controller->getQtOption("displayDriver")) {
344		m_controller->setQtOption("displayDriver", displayDriver);
345		Display::setDriver(static_cast<Display::Driver>(displayDriver.toInt()));
346		setShaderSelector(nullptr);
347		emit displayDriverChanged();
348	}
349
350	QVariant cameraDriver = m_ui.cameraDriver->itemData(m_ui.cameraDriver->currentIndex());
351	if (cameraDriver != m_controller->getQtOption("cameraDriver")) {
352		m_controller->setQtOption("cameraDriver", cameraDriver);
353		emit cameraDriverChanged();
354	}
355
356	QLocale language = m_ui.languages->itemData(m_ui.languages->currentIndex()).toLocale();
357	if (language != m_controller->getQtOption("language").toLocale() && !(language.bcp47Name() == QLocale::system().bcp47Name() && m_controller->getQtOption("language").isNull())) {
358		m_controller->setQtOption("language", language.bcp47Name());
359		emit languageChanged();
360	}
361
362	if (m_gbColors[0] | m_gbColors[1] | m_gbColors[2] | m_gbColors[3]) {
363		m_controller->setOption("gb.pal[0]", m_gbColors[0]);
364		m_controller->setOption("gb.pal[1]", m_gbColors[1]);
365		m_controller->setOption("gb.pal[2]", m_gbColors[2]);
366		m_controller->setOption("gb.pal[3]", m_gbColors[3]);
367	}
368
369	m_controller->write();
370
371	emit pathsChanged();
372	emit biosLoaded(PLATFORM_GBA, m_ui.gbaBios->text());
373}
374
375void SettingsView::reloadConfig() {	
376	loadSetting("bios", m_ui.gbaBios);
377	loadSetting("gba.bios", m_ui.gbaBios);
378	loadSetting("gb.bios", m_ui.gbBios);
379	loadSetting("gbc.bios", m_ui.gbcBios);
380	loadSetting("useBios", m_ui.useBios);
381	loadSetting("skipBios", m_ui.skipBios);
382	loadSetting("audioBuffers", m_ui.audioBufferSize);
383	loadSetting("sampleRate", m_ui.sampleRate);
384	loadSetting("videoSync", m_ui.videoSync);
385	loadSetting("audioSync", m_ui.audioSync);
386	loadSetting("frameskip", m_ui.frameskip);
387	loadSetting("fpsTarget", m_ui.fpsTarget);
388	loadSetting("lockAspectRatio", m_ui.lockAspectRatio);
389	loadSetting("lockIntegerScaling", m_ui.lockIntegerScaling);
390	loadSetting("volume", m_ui.volume);
391	loadSetting("mute", m_ui.mute);
392	loadSetting("rewindEnable", m_ui.rewind);
393	loadSetting("rewindBufferCapacity", m_ui.rewindCapacity);
394	loadSetting("rewindSave", m_ui.rewindSave);
395	loadSetting("resampleVideo", m_ui.resampleVideo);
396	loadSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
397	loadSetting("suspendScreensaver", m_ui.suspendScreensaver);
398	loadSetting("pauseOnFocusLost", m_ui.pauseOnFocusLost);
399	loadSetting("savegamePath", m_ui.savegamePath);
400	loadSetting("savestatePath", m_ui.savestatePath);
401	loadSetting("screenshotPath", m_ui.screenshotPath);
402	loadSetting("patchPath", m_ui.patchPath);
403	loadSetting("showLibrary", m_ui.showLibrary);
404	loadSetting("preload", m_ui.preload);
405
406	m_ui.libraryStyle->setCurrentIndex(loadSetting("libraryStyle").toInt());
407
408	double fastForwardRatio = loadSetting("fastForwardRatio").toDouble();
409	if (fastForwardRatio <= 0) {
410		m_ui.fastForwardUnbounded->setChecked(true);
411		m_ui.fastForwardRatio->setEnabled(false);
412	} else {
413		m_ui.fastForwardUnbounded->setChecked(false);
414		m_ui.fastForwardRatio->setEnabled(true);
415		m_ui.fastForwardRatio->setValue(fastForwardRatio);
416	}
417
418	QString idleOptimization = loadSetting("idleOptimization");
419	if (idleOptimization == "ignore") {
420		m_ui.idleOptimization->setCurrentIndex(0);
421	} else if (idleOptimization == "remove") {
422		m_ui.idleOptimization->setCurrentIndex(1);
423	} else if (idleOptimization == "detect") {
424		m_ui.idleOptimization->setCurrentIndex(2);
425	}
426
427	bool ok;
428	int loadState = loadSetting("loadStateExtdata").toInt(&ok);
429	if (!ok) {
430		loadState = SAVESTATE_SCREENSHOT | SAVESTATE_RTC;
431	}
432	m_ui.loadStateScreenshot->setChecked(loadState & SAVESTATE_SCREENSHOT);
433	m_ui.loadStateSave->setChecked(loadState & SAVESTATE_SAVEDATA);
434	m_ui.loadStateCheats->setChecked(loadState & SAVESTATE_CHEATS);
435
436	int saveState = loadSetting("saveStateExtdata").toInt(&ok);
437	if (!ok) {
438		saveState = SAVESTATE_SCREENSHOT | SAVESTATE_SAVEDATA | SAVESTATE_CHEATS | SAVESTATE_RTC | SAVESTATE_METADATA;
439	}
440	m_ui.saveStateScreenshot->setChecked(saveState & SAVESTATE_SCREENSHOT);
441	m_ui.saveStateSave->setChecked(saveState & SAVESTATE_SAVEDATA);
442	m_ui.saveStateCheats->setChecked(saveState & SAVESTATE_CHEATS);
443}
444
445void SettingsView::saveSetting(const char* key, const QAbstractButton* field) {
446	m_controller->setOption(key, field->isChecked());
447	m_controller->updateOption(key);
448}
449
450void SettingsView::saveSetting(const char* key, const QComboBox* field) {
451	saveSetting(key, field->lineEdit());
452}
453
454void SettingsView::saveSetting(const char* key, const QDoubleSpinBox* field) {
455	saveSetting(key, field->value());
456}
457
458void SettingsView::saveSetting(const char* key, const QLineEdit* field) {
459	saveSetting(key, field->text());
460}
461
462void SettingsView::saveSetting(const char* key, const QSlider* field) {
463	saveSetting(key, field->value());
464}
465
466void SettingsView::saveSetting(const char* key, const QSpinBox* field) {
467	saveSetting(key, field->value());
468}
469
470void SettingsView::saveSetting(const char* key, const QVariant& field) {
471	m_controller->setOption(key, field);
472	m_controller->updateOption(key);
473}
474
475void SettingsView::loadSetting(const char* key, QAbstractButton* field) {
476	QString option = loadSetting(key);
477	field->setChecked(!option.isNull() && option != "0");
478}
479
480void SettingsView::loadSetting(const char* key, QComboBox* field) {
481	loadSetting(key, field->lineEdit());
482}
483
484void SettingsView::loadSetting(const char* key, QDoubleSpinBox* field) {
485	QString option = loadSetting(key);
486	field->setValue(option.toDouble());
487}
488
489void SettingsView::loadSetting(const char* key, QLineEdit* field) {
490	QString option = loadSetting(key);
491	field->setText(option);
492}
493
494void SettingsView::loadSetting(const char* key, QSlider* field) {
495	QString option = loadSetting(key);
496	field->setValue(option.toInt());
497}
498
499void SettingsView::loadSetting(const char* key, QSpinBox* field) {
500	QString option = loadSetting(key);
501	field->setValue(option.toInt());
502}
503
504QString SettingsView::loadSetting(const char* key) {
505	return m_controller->getOption(key);
506}