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 connect(m_ui.sgbBiosBrowse, &QPushButton::clicked, [this]() {
163 selectBios(m_ui.sgbBios);
164 });
165
166 QList<QColor> defaultColors;
167 defaultColors.append(QColor(0xF8, 0xF8, 0xF8));
168 defaultColors.append(QColor(0xA8, 0xA8, 0xA8));
169 defaultColors.append(QColor(0x50, 0x50, 0x50));
170 defaultColors.append(QColor(0x00, 0x00, 0x00));
171 bool ok;
172 if (m_controller->getOption("gb.pal[0]").toUInt(&ok) || ok) {
173 defaultColors[0] = QColor::fromRgb(m_controller->getOption("gb.pal[0]").toUInt());
174 }
175 if (m_controller->getOption("gb.pal[1]").toUInt(&ok) || ok) {
176 defaultColors[1] = QColor::fromRgb(m_controller->getOption("gb.pal[1]").toUInt());
177 }
178 if (m_controller->getOption("gb.pal[2]").toUInt(&ok) || ok) {
179 defaultColors[2] = QColor::fromRgb(m_controller->getOption("gb.pal[2]").toUInt());
180 }
181 if (m_controller->getOption("gb.pal[3]").toUInt(&ok) || ok) {
182 defaultColors[3] = QColor::fromRgb(m_controller->getOption("gb.pal[3]").toUInt());
183 }
184 m_colorPickers[0] = ColorPicker(m_ui.color0, defaultColors[0]);
185 m_colorPickers[1] = ColorPicker(m_ui.color1, defaultColors[1]);
186 m_colorPickers[2] = ColorPicker(m_ui.color2, defaultColors[2]);
187 m_colorPickers[3] = ColorPicker(m_ui.color3, defaultColors[3]);
188 for (int colorId = 0; colorId < 4; ++colorId) {
189 connect(&m_colorPickers[colorId], &ColorPicker::colorChanged, this, [this, colorId](const QColor& color) {
190 m_gbColors[colorId] = color.rgb();
191 });
192 }
193#else
194 m_ui.gbBiosBrowse->hide();
195 m_ui.gbcBiosBrowse->hide();
196 m_ui.sgbBiosBrowse->hide();
197 m_ui.gb->hide();
198#endif
199
200 GBAKeyEditor* editor = new GBAKeyEditor(inputController, InputController::KEYBOARD, QString(), this);
201 m_ui.stackedWidget->addWidget(editor);
202 m_ui.tabs->addItem(tr("Keyboard"));
203 connect(m_ui.buttonBox, &QDialogButtonBox::accepted, editor, &GBAKeyEditor::save);
204
205 GBAKeyEditor* buttonEditor = nullptr;
206#ifdef BUILD_SDL
207 inputController->recalibrateAxes();
208 const char* profile = inputController->profileForType(SDL_BINDING_BUTTON);
209 buttonEditor = new GBAKeyEditor(inputController, SDL_BINDING_BUTTON, profile);
210 m_ui.stackedWidget->addWidget(buttonEditor);
211 m_ui.tabs->addItem(tr("Controllers"));
212 connect(m_ui.buttonBox, &QDialogButtonBox::accepted, buttonEditor, &GBAKeyEditor::save);
213#endif
214
215 connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &SettingsView::updateConfig);
216 connect(m_ui.buttonBox, &QDialogButtonBox::clicked, [this, editor, buttonEditor](QAbstractButton* button) {
217 if (m_ui.buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) {
218 updateConfig();
219 editor->save();
220 if (buttonEditor) {
221 buttonEditor->save();
222 }
223 }
224 });
225
226 m_ui.languages->setItemData(0, QLocale("en"));
227 QDir ts(":/translations/");
228 for (auto name : ts.entryList()) {
229 if (!name.endsWith(".qm") || !name.startsWith(binaryName)) {
230 continue;
231 }
232 QLocale locale(name.remove(QString("%0-").arg(binaryName)).remove(".qm"));
233 m_ui.languages->addItem(locale.nativeLanguageName(), locale);
234 if (locale == QLocale()) {
235 m_ui.languages->setCurrentIndex(m_ui.languages->count() - 1);
236 }
237 }
238
239 ShortcutView* shortcutView = new ShortcutView();
240 shortcutView->setController(shortcutController);
241 shortcutView->setInputController(inputController);
242 m_ui.stackedWidget->addWidget(shortcutView);
243 m_ui.tabs->addItem(tr("Shortcuts"));
244}
245
246SettingsView::~SettingsView() {
247#if defined(BUILD_GL) || defined(BUILD_GLES)
248 setShaderSelector(nullptr);
249#endif
250}
251
252void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) {
253#if defined(BUILD_GL) || defined(BUILD_GLES)
254 if (m_shader) {
255 auto items = m_ui.tabs->findItems(tr("Shaders"), Qt::MatchFixedString);
256 for (const auto& item : items) {
257 m_ui.tabs->removeItemWidget(item);
258 }
259 m_ui.stackedWidget->removeWidget(m_shader);
260 m_shader->setParent(nullptr);
261 }
262 m_shader = shaderSelector;
263 if (shaderSelector) {
264 m_ui.stackedWidget->addWidget(m_shader);
265 m_ui.tabs->addItem(tr("Shaders"));
266 connect(m_ui.buttonBox, &QDialogButtonBox::accepted, m_shader, &ShaderSelector::saved);
267 }
268#endif
269}
270
271void SettingsView::selectBios(QLineEdit* bios) {
272 QString filename = GBAApp::app()->getOpenFileName(this, tr("Select BIOS"));
273 if (!filename.isEmpty()) {
274 bios->setText(filename);
275 }
276}
277
278void SettingsView::updateConfig() {
279 saveSetting("gba.bios", m_ui.gbaBios);
280 saveSetting("gb.bios", m_ui.gbBios);
281 saveSetting("gbc.bios", m_ui.gbcBios);
282 saveSetting("sgb.bios", m_ui.sgbBios);
283 saveSetting("useBios", m_ui.useBios);
284 saveSetting("skipBios", m_ui.skipBios);
285 saveSetting("audioBuffers", m_ui.audioBufferSize);
286 saveSetting("sampleRate", m_ui.sampleRate);
287 saveSetting("videoSync", m_ui.videoSync);
288 saveSetting("audioSync", m_ui.audioSync);
289 saveSetting("frameskip", m_ui.frameskip);
290 saveSetting("fpsTarget", m_ui.fpsTarget);
291 saveSetting("lockAspectRatio", m_ui.lockAspectRatio);
292 saveSetting("lockIntegerScaling", m_ui.lockIntegerScaling);
293 saveSetting("volume", m_ui.volume);
294 saveSetting("mute", m_ui.mute);
295 saveSetting("rewindEnable", m_ui.rewind);
296 saveSetting("rewindBufferCapacity", m_ui.rewindCapacity);
297 saveSetting("rewindSave", m_ui.rewindSave);
298 saveSetting("resampleVideo", m_ui.resampleVideo);
299 saveSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
300 saveSetting("suspendScreensaver", m_ui.suspendScreensaver);
301 saveSetting("pauseOnFocusLost", m_ui.pauseOnFocusLost);
302 saveSetting("savegamePath", m_ui.savegamePath);
303 saveSetting("savestatePath", m_ui.savestatePath);
304 saveSetting("screenshotPath", m_ui.screenshotPath);
305 saveSetting("patchPath", m_ui.patchPath);
306 saveSetting("libraryStyle", m_ui.libraryStyle->currentIndex());
307 saveSetting("showLibrary", m_ui.showLibrary);
308 saveSetting("preload", m_ui.preload);
309
310 if (m_ui.fastForwardUnbounded->isChecked()) {
311 saveSetting("fastForwardRatio", "-1");
312 } else {
313 saveSetting("fastForwardRatio", m_ui.fastForwardRatio);
314 }
315
316 switch (m_ui.idleOptimization->currentIndex() + IDLE_LOOP_IGNORE) {
317 case IDLE_LOOP_IGNORE:
318 saveSetting("idleOptimization", "ignore");
319 break;
320 case IDLE_LOOP_REMOVE:
321 saveSetting("idleOptimization", "remove");
322 break;
323 case IDLE_LOOP_DETECT:
324 saveSetting("idleOptimization", "detect");
325 break;
326 }
327
328 int loadState = SAVESTATE_RTC;
329 loadState |= m_ui.loadStateScreenshot->isChecked() ? SAVESTATE_SCREENSHOT : 0;
330 loadState |= m_ui.loadStateSave->isChecked() ? SAVESTATE_SAVEDATA : 0;
331 loadState |= m_ui.loadStateCheats->isChecked() ? SAVESTATE_CHEATS : 0;
332 saveSetting("loadStateExtdata", loadState);
333
334 int saveState = SAVESTATE_RTC | SAVESTATE_METADATA;
335 saveState |= m_ui.saveStateScreenshot->isChecked() ? SAVESTATE_SCREENSHOT : 0;
336 saveState |= m_ui.saveStateSave->isChecked() ? SAVESTATE_SAVEDATA : 0;
337 saveState |= m_ui.saveStateCheats->isChecked() ? SAVESTATE_CHEATS : 0;
338 saveSetting("saveStateExtdata", saveState);
339
340 QVariant audioDriver = m_ui.audioDriver->itemData(m_ui.audioDriver->currentIndex());
341 if (audioDriver != m_controller->getQtOption("audioDriver")) {
342 m_controller->setQtOption("audioDriver", audioDriver);
343 AudioProcessor::setDriver(static_cast<AudioProcessor::Driver>(audioDriver.toInt()));
344 emit audioDriverChanged();
345 }
346
347 QVariant displayDriver = m_ui.displayDriver->itemData(m_ui.displayDriver->currentIndex());
348 if (displayDriver != m_controller->getQtOption("displayDriver")) {
349 m_controller->setQtOption("displayDriver", displayDriver);
350 Display::setDriver(static_cast<Display::Driver>(displayDriver.toInt()));
351 setShaderSelector(nullptr);
352 emit displayDriverChanged();
353 }
354
355 QVariant cameraDriver = m_ui.cameraDriver->itemData(m_ui.cameraDriver->currentIndex());
356 if (cameraDriver != m_controller->getQtOption("cameraDriver")) {
357 m_controller->setQtOption("cameraDriver", cameraDriver);
358 emit cameraDriverChanged();
359 }
360
361 QLocale language = m_ui.languages->itemData(m_ui.languages->currentIndex()).toLocale();
362 if (language != m_controller->getQtOption("language").toLocale() && !(language.bcp47Name() == QLocale::system().bcp47Name() && m_controller->getQtOption("language").isNull())) {
363 m_controller->setQtOption("language", language.bcp47Name());
364 emit languageChanged();
365 }
366
367 if (m_gbColors[0] | m_gbColors[1] | m_gbColors[2] | m_gbColors[3]) {
368 m_controller->setOption("gb.pal[0]", m_gbColors[0]);
369 m_controller->setOption("gb.pal[1]", m_gbColors[1]);
370 m_controller->setOption("gb.pal[2]", m_gbColors[2]);
371 m_controller->setOption("gb.pal[3]", m_gbColors[3]);
372 }
373
374 m_controller->write();
375
376 emit pathsChanged();
377 emit biosLoaded(PLATFORM_GBA, m_ui.gbaBios->text());
378}
379
380void SettingsView::reloadConfig() {
381 loadSetting("bios", m_ui.gbaBios);
382 loadSetting("gba.bios", m_ui.gbaBios);
383 loadSetting("gb.bios", m_ui.gbBios);
384 loadSetting("gbc.bios", m_ui.gbcBios);
385 loadSetting("sgb.bios", m_ui.sgbBios);
386 loadSetting("useBios", m_ui.useBios);
387 loadSetting("skipBios", m_ui.skipBios);
388 loadSetting("audioBuffers", m_ui.audioBufferSize);
389 loadSetting("sampleRate", m_ui.sampleRate);
390 loadSetting("videoSync", m_ui.videoSync);
391 loadSetting("audioSync", m_ui.audioSync);
392 loadSetting("frameskip", m_ui.frameskip);
393 loadSetting("fpsTarget", m_ui.fpsTarget);
394 loadSetting("lockAspectRatio", m_ui.lockAspectRatio);
395 loadSetting("lockIntegerScaling", m_ui.lockIntegerScaling);
396 loadSetting("volume", m_ui.volume);
397 loadSetting("mute", m_ui.mute);
398 loadSetting("rewindEnable", m_ui.rewind);
399 loadSetting("rewindBufferCapacity", m_ui.rewindCapacity);
400 loadSetting("rewindSave", m_ui.rewindSave);
401 loadSetting("resampleVideo", m_ui.resampleVideo);
402 loadSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
403 loadSetting("suspendScreensaver", m_ui.suspendScreensaver);
404 loadSetting("pauseOnFocusLost", m_ui.pauseOnFocusLost);
405 loadSetting("savegamePath", m_ui.savegamePath);
406 loadSetting("savestatePath", m_ui.savestatePath);
407 loadSetting("screenshotPath", m_ui.screenshotPath);
408 loadSetting("patchPath", m_ui.patchPath);
409 loadSetting("showLibrary", m_ui.showLibrary);
410 loadSetting("preload", m_ui.preload);
411
412 m_ui.libraryStyle->setCurrentIndex(loadSetting("libraryStyle").toInt());
413
414 double fastForwardRatio = loadSetting("fastForwardRatio").toDouble();
415 if (fastForwardRatio <= 0) {
416 m_ui.fastForwardUnbounded->setChecked(true);
417 m_ui.fastForwardRatio->setEnabled(false);
418 } else {
419 m_ui.fastForwardUnbounded->setChecked(false);
420 m_ui.fastForwardRatio->setEnabled(true);
421 m_ui.fastForwardRatio->setValue(fastForwardRatio);
422 }
423
424 QString idleOptimization = loadSetting("idleOptimization");
425 if (idleOptimization == "ignore") {
426 m_ui.idleOptimization->setCurrentIndex(0);
427 } else if (idleOptimization == "remove") {
428 m_ui.idleOptimization->setCurrentIndex(1);
429 } else if (idleOptimization == "detect") {
430 m_ui.idleOptimization->setCurrentIndex(2);
431 }
432
433 bool ok;
434 int loadState = loadSetting("loadStateExtdata").toInt(&ok);
435 if (!ok) {
436 loadState = SAVESTATE_SCREENSHOT | SAVESTATE_RTC;
437 }
438 m_ui.loadStateScreenshot->setChecked(loadState & SAVESTATE_SCREENSHOT);
439 m_ui.loadStateSave->setChecked(loadState & SAVESTATE_SAVEDATA);
440 m_ui.loadStateCheats->setChecked(loadState & SAVESTATE_CHEATS);
441
442 int saveState = loadSetting("saveStateExtdata").toInt(&ok);
443 if (!ok) {
444 saveState = SAVESTATE_SCREENSHOT | SAVESTATE_SAVEDATA | SAVESTATE_CHEATS | SAVESTATE_RTC | SAVESTATE_METADATA;
445 }
446 m_ui.saveStateScreenshot->setChecked(saveState & SAVESTATE_SCREENSHOT);
447 m_ui.saveStateSave->setChecked(saveState & SAVESTATE_SAVEDATA);
448 m_ui.saveStateCheats->setChecked(saveState & SAVESTATE_CHEATS);
449}
450
451void SettingsView::saveSetting(const char* key, const QAbstractButton* field) {
452 m_controller->setOption(key, field->isChecked());
453 m_controller->updateOption(key);
454}
455
456void SettingsView::saveSetting(const char* key, const QComboBox* field) {
457 saveSetting(key, field->lineEdit());
458}
459
460void SettingsView::saveSetting(const char* key, const QDoubleSpinBox* field) {
461 saveSetting(key, field->value());
462}
463
464void SettingsView::saveSetting(const char* key, const QLineEdit* field) {
465 saveSetting(key, field->text());
466}
467
468void SettingsView::saveSetting(const char* key, const QSlider* field) {
469 saveSetting(key, field->value());
470}
471
472void SettingsView::saveSetting(const char* key, const QSpinBox* field) {
473 saveSetting(key, field->value());
474}
475
476void SettingsView::saveSetting(const char* key, const QVariant& field) {
477 m_controller->setOption(key, field);
478 m_controller->updateOption(key);
479}
480
481void SettingsView::loadSetting(const char* key, QAbstractButton* field) {
482 QString option = loadSetting(key);
483 field->setChecked(!option.isNull() && option != "0");
484}
485
486void SettingsView::loadSetting(const char* key, QComboBox* field) {
487 loadSetting(key, field->lineEdit());
488}
489
490void SettingsView::loadSetting(const char* key, QDoubleSpinBox* field) {
491 QString option = loadSetting(key);
492 field->setValue(option.toDouble());
493}
494
495void SettingsView::loadSetting(const char* key, QLineEdit* field) {
496 QString option = loadSetting(key);
497 field->setText(option);
498}
499
500void SettingsView::loadSetting(const char* key, QSlider* field) {
501 QString option = loadSetting(key);
502 field->setValue(option.toInt());
503}
504
505void SettingsView::loadSetting(const char* key, QSpinBox* field) {
506 QString option = loadSetting(key);
507 field->setValue(option.toInt());
508}
509
510QString SettingsView::loadSetting(const char* key) {
511 return m_controller->getOption(key);
512}