diff options
| author | 2016-04-10 20:21:34 -0400 | |
|---|---|---|
| committer | 2016-04-10 20:21:34 -0400 | |
| commit | a1b81469a3a72f0a6550075e2a693e31dab31ea9 (patch) | |
| tree | 196b2ae1191198f1c47af2c33a145931c853c915 /src/citra_qt/config.cpp | |
| parent | Merge pull request #1653 from mailwl/blx-lr (diff) | |
| parent | Add more stuff to configure. (diff) | |
| download | yuzu-a1b81469a3a72f0a6550075e2a693e31dab31ea9.tar.gz yuzu-a1b81469a3a72f0a6550075e2a693e31dab31ea9.tar.xz yuzu-a1b81469a3a72f0a6550075e2a693e31dab31ea9.zip | |
Merge pull request #1368 from LittleWhite-tb/configure-widget
Implementation for a configure widget
Diffstat (limited to 'src/citra_qt/config.cpp')
| -rw-r--r-- | src/citra_qt/config.cpp | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index 8e247ff5c..ecf5c5a75 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp | |||
| @@ -7,12 +7,12 @@ | |||
| 7 | #include <QStringList> | 7 | #include <QStringList> |
| 8 | 8 | ||
| 9 | #include "citra_qt/config.h" | 9 | #include "citra_qt/config.h" |
| 10 | #include "citra_qt/ui_settings.h" | ||
| 10 | 11 | ||
| 11 | #include "common/file_util.h" | 12 | #include "common/file_util.h" |
| 12 | #include "core/settings.h" | 13 | #include "core/settings.h" |
| 13 | 14 | ||
| 14 | Config::Config() { | 15 | Config::Config() { |
| 15 | |||
| 16 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. | 16 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. |
| 17 | qt_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "qt-config.ini"; | 17 | qt_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "qt-config.ini"; |
| 18 | FileUtil::CreateFullPath(qt_config_loc); | 18 | FileUtil::CreateFullPath(qt_config_loc); |
| @@ -67,6 +67,51 @@ void Config::ReadValues() { | |||
| 67 | Settings::values.use_gdbstub = qt_config->value("use_gdbstub", false).toBool(); | 67 | Settings::values.use_gdbstub = qt_config->value("use_gdbstub", false).toBool(); |
| 68 | Settings::values.gdbstub_port = qt_config->value("gdbstub_port", 24689).toInt(); | 68 | Settings::values.gdbstub_port = qt_config->value("gdbstub_port", 24689).toInt(); |
| 69 | qt_config->endGroup(); | 69 | qt_config->endGroup(); |
| 70 | |||
| 71 | qt_config->beginGroup("UI"); | ||
| 72 | |||
| 73 | qt_config->beginGroup("UILayout"); | ||
| 74 | UISettings::values.geometry = qt_config->value("geometry").toByteArray(); | ||
| 75 | UISettings::values.state = qt_config->value("state").toByteArray(); | ||
| 76 | UISettings::values.renderwindow_geometry = qt_config->value("geometryRenderWindow").toByteArray(); | ||
| 77 | UISettings::values.gamelist_header_state = qt_config->value("gameListHeaderState").toByteArray(); | ||
| 78 | UISettings::values.microprofile_geometry = qt_config->value("microProfileDialogGeometry").toByteArray(); | ||
| 79 | UISettings::values.microprofile_visible = qt_config->value("microProfileDialogVisible", false).toBool(); | ||
| 80 | qt_config->endGroup(); | ||
| 81 | |||
| 82 | qt_config->beginGroup("Paths"); | ||
| 83 | UISettings::values.roms_path = qt_config->value("romsPath").toString(); | ||
| 84 | UISettings::values.symbols_path = qt_config->value("symbolsPath").toString(); | ||
| 85 | UISettings::values.gamedir = qt_config->value("gameListRootDir", ".").toString(); | ||
| 86 | UISettings::values.gamedir_deepscan = qt_config->value("gameListDeepScan", false).toBool(); | ||
| 87 | UISettings::values.recent_files = qt_config->value("recentFiles").toStringList(); | ||
| 88 | qt_config->endGroup(); | ||
| 89 | |||
| 90 | qt_config->beginGroup("Shortcuts"); | ||
| 91 | QStringList groups = qt_config->childGroups(); | ||
| 92 | for (auto group : groups) { | ||
| 93 | qt_config->beginGroup(group); | ||
| 94 | |||
| 95 | QStringList hotkeys = qt_config->childGroups(); | ||
| 96 | for (auto hotkey : hotkeys) { | ||
| 97 | qt_config->beginGroup(hotkey); | ||
| 98 | UISettings::values.shortcuts.emplace_back( | ||
| 99 | UISettings::Shortcut(group + "/" + hotkey, | ||
| 100 | UISettings::ContextualShortcut(qt_config->value("KeySeq").toString(), | ||
| 101 | qt_config->value("Context").toInt()))); | ||
| 102 | qt_config->endGroup(); | ||
| 103 | } | ||
| 104 | |||
| 105 | qt_config->endGroup(); | ||
| 106 | } | ||
| 107 | qt_config->endGroup(); | ||
| 108 | |||
| 109 | UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool(); | ||
| 110 | UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool(); | ||
| 111 | UISettings::values.confirm_before_closing = qt_config->value("confirmClose",true).toBool(); | ||
| 112 | UISettings::values.first_start = qt_config->value("firstStart", true).toBool(); | ||
| 113 | |||
| 114 | qt_config->endGroup(); | ||
| 70 | } | 115 | } |
| 71 | 116 | ||
| 72 | void Config::SaveValues() { | 117 | void Config::SaveValues() { |
| @@ -107,6 +152,39 @@ void Config::SaveValues() { | |||
| 107 | qt_config->setValue("use_gdbstub", Settings::values.use_gdbstub); | 152 | qt_config->setValue("use_gdbstub", Settings::values.use_gdbstub); |
| 108 | qt_config->setValue("gdbstub_port", Settings::values.gdbstub_port); | 153 | qt_config->setValue("gdbstub_port", Settings::values.gdbstub_port); |
| 109 | qt_config->endGroup(); | 154 | qt_config->endGroup(); |
| 155 | |||
| 156 | qt_config->beginGroup("UI"); | ||
| 157 | |||
| 158 | qt_config->beginGroup("UILayout"); | ||
| 159 | qt_config->setValue("geometry", UISettings::values.geometry); | ||
| 160 | qt_config->setValue("state", UISettings::values.state); | ||
| 161 | qt_config->setValue("geometryRenderWindow", UISettings::values.renderwindow_geometry); | ||
| 162 | qt_config->setValue("gameListHeaderState", UISettings::values.gamelist_header_state); | ||
| 163 | qt_config->setValue("microProfileDialogGeometry", UISettings::values.microprofile_geometry); | ||
| 164 | qt_config->setValue("microProfileDialogVisible", UISettings::values.microprofile_visible); | ||
| 165 | qt_config->endGroup(); | ||
| 166 | |||
| 167 | qt_config->beginGroup("Paths"); | ||
| 168 | qt_config->setValue("romsPath", UISettings::values.roms_path); | ||
| 169 | qt_config->setValue("symbolsPath", UISettings::values.symbols_path); | ||
| 170 | qt_config->setValue("gameListRootDir", UISettings::values.gamedir); | ||
| 171 | qt_config->setValue("gameListDeepScan", UISettings::values.gamedir_deepscan); | ||
| 172 | qt_config->setValue("recentFiles", UISettings::values.recent_files); | ||
| 173 | qt_config->endGroup(); | ||
| 174 | |||
| 175 | qt_config->beginGroup("Shortcuts"); | ||
| 176 | for (auto shortcut : UISettings::values.shortcuts ) { | ||
| 177 | qt_config->setValue(shortcut.first + "/KeySeq", shortcut.second.first); | ||
| 178 | qt_config->setValue(shortcut.first + "/Context", shortcut.second.second); | ||
| 179 | } | ||
| 180 | qt_config->endGroup(); | ||
| 181 | |||
| 182 | qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode); | ||
| 183 | qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar); | ||
| 184 | qt_config->setValue("confirmClose", UISettings::values.confirm_before_closing); | ||
| 185 | qt_config->setValue("firstStart", UISettings::values.first_start); | ||
| 186 | |||
| 187 | qt_config->endGroup(); | ||
| 110 | } | 188 | } |
| 111 | 189 | ||
| 112 | void Config::Reload() { | 190 | void Config::Reload() { |