diff options
Diffstat (limited to 'src/citra_qt/config.cpp')
| -rw-r--r-- | src/citra_qt/config.cpp | 91 |
1 files changed, 90 insertions, 1 deletions
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index 66271aa7b..f6e498128 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); |
| @@ -45,12 +45,17 @@ void Config::ReadValues() { | |||
| 45 | qt_config->beginGroup("Renderer"); | 45 | qt_config->beginGroup("Renderer"); |
| 46 | Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", false).toBool(); | 46 | Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", false).toBool(); |
| 47 | Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool(); | 47 | Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool(); |
| 48 | Settings::values.use_scaled_resolution = qt_config->value("use_scaled_resolution", false).toBool(); | ||
| 48 | 49 | ||
| 49 | Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat(); | 50 | Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat(); |
| 50 | Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat(); | 51 | Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat(); |
| 51 | Settings::values.bg_blue = qt_config->value("bg_blue", 1.0).toFloat(); | 52 | Settings::values.bg_blue = qt_config->value("bg_blue", 1.0).toFloat(); |
| 52 | qt_config->endGroup(); | 53 | qt_config->endGroup(); |
| 53 | 54 | ||
| 55 | qt_config->beginGroup("Audio"); | ||
| 56 | Settings::values.sink_id = qt_config->value("output_engine", "auto").toString().toStdString(); | ||
| 57 | qt_config->endGroup(); | ||
| 58 | |||
| 54 | qt_config->beginGroup("Data Storage"); | 59 | qt_config->beginGroup("Data Storage"); |
| 55 | Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); | 60 | Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); |
| 56 | qt_config->endGroup(); | 61 | qt_config->endGroup(); |
| @@ -68,6 +73,51 @@ void Config::ReadValues() { | |||
| 68 | Settings::values.use_gdbstub = qt_config->value("use_gdbstub", false).toBool(); | 73 | Settings::values.use_gdbstub = qt_config->value("use_gdbstub", false).toBool(); |
| 69 | Settings::values.gdbstub_port = qt_config->value("gdbstub_port", 24689).toInt(); | 74 | Settings::values.gdbstub_port = qt_config->value("gdbstub_port", 24689).toInt(); |
| 70 | qt_config->endGroup(); | 75 | qt_config->endGroup(); |
| 76 | |||
| 77 | qt_config->beginGroup("UI"); | ||
| 78 | |||
| 79 | qt_config->beginGroup("UILayout"); | ||
| 80 | UISettings::values.geometry = qt_config->value("geometry").toByteArray(); | ||
| 81 | UISettings::values.state = qt_config->value("state").toByteArray(); | ||
| 82 | UISettings::values.renderwindow_geometry = qt_config->value("geometryRenderWindow").toByteArray(); | ||
| 83 | UISettings::values.gamelist_header_state = qt_config->value("gameListHeaderState").toByteArray(); | ||
| 84 | UISettings::values.microprofile_geometry = qt_config->value("microProfileDialogGeometry").toByteArray(); | ||
| 85 | UISettings::values.microprofile_visible = qt_config->value("microProfileDialogVisible", false).toBool(); | ||
| 86 | qt_config->endGroup(); | ||
| 87 | |||
| 88 | qt_config->beginGroup("Paths"); | ||
| 89 | UISettings::values.roms_path = qt_config->value("romsPath").toString(); | ||
| 90 | UISettings::values.symbols_path = qt_config->value("symbolsPath").toString(); | ||
| 91 | UISettings::values.gamedir = qt_config->value("gameListRootDir", ".").toString(); | ||
| 92 | UISettings::values.gamedir_deepscan = qt_config->value("gameListDeepScan", false).toBool(); | ||
| 93 | UISettings::values.recent_files = qt_config->value("recentFiles").toStringList(); | ||
| 94 | qt_config->endGroup(); | ||
| 95 | |||
| 96 | qt_config->beginGroup("Shortcuts"); | ||
| 97 | QStringList groups = qt_config->childGroups(); | ||
| 98 | for (auto group : groups) { | ||
| 99 | qt_config->beginGroup(group); | ||
| 100 | |||
| 101 | QStringList hotkeys = qt_config->childGroups(); | ||
| 102 | for (auto hotkey : hotkeys) { | ||
| 103 | qt_config->beginGroup(hotkey); | ||
| 104 | UISettings::values.shortcuts.emplace_back( | ||
| 105 | UISettings::Shortcut(group + "/" + hotkey, | ||
| 106 | UISettings::ContextualShortcut(qt_config->value("KeySeq").toString(), | ||
| 107 | qt_config->value("Context").toInt()))); | ||
| 108 | qt_config->endGroup(); | ||
| 109 | } | ||
| 110 | |||
| 111 | qt_config->endGroup(); | ||
| 112 | } | ||
| 113 | qt_config->endGroup(); | ||
| 114 | |||
| 115 | UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool(); | ||
| 116 | UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool(); | ||
| 117 | UISettings::values.confirm_before_closing = qt_config->value("confirmClose",true).toBool(); | ||
| 118 | UISettings::values.first_start = qt_config->value("firstStart", true).toBool(); | ||
| 119 | |||
| 120 | qt_config->endGroup(); | ||
| 71 | } | 121 | } |
| 72 | 122 | ||
| 73 | void Config::SaveValues() { | 123 | void Config::SaveValues() { |
| @@ -85,6 +135,7 @@ void Config::SaveValues() { | |||
| 85 | qt_config->beginGroup("Renderer"); | 135 | qt_config->beginGroup("Renderer"); |
| 86 | qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer); | 136 | qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer); |
| 87 | qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit); | 137 | qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit); |
| 138 | qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution); | ||
| 88 | 139 | ||
| 89 | // Cast to double because Qt's written float values are not human-readable | 140 | // Cast to double because Qt's written float values are not human-readable |
| 90 | qt_config->setValue("bg_red", (double)Settings::values.bg_red); | 141 | qt_config->setValue("bg_red", (double)Settings::values.bg_red); |
| @@ -92,6 +143,10 @@ void Config::SaveValues() { | |||
| 92 | qt_config->setValue("bg_blue", (double)Settings::values.bg_blue); | 143 | qt_config->setValue("bg_blue", (double)Settings::values.bg_blue); |
| 93 | qt_config->endGroup(); | 144 | qt_config->endGroup(); |
| 94 | 145 | ||
| 146 | qt_config->beginGroup("Audio"); | ||
| 147 | qt_config->setValue("output_engine", QString::fromStdString(Settings::values.sink_id)); | ||
| 148 | qt_config->endGroup(); | ||
| 149 | |||
| 95 | qt_config->beginGroup("Data Storage"); | 150 | qt_config->beginGroup("Data Storage"); |
| 96 | qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd); | 151 | qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd); |
| 97 | qt_config->endGroup(); | 152 | qt_config->endGroup(); |
| @@ -109,10 +164,44 @@ void Config::SaveValues() { | |||
| 109 | qt_config->setValue("use_gdbstub", Settings::values.use_gdbstub); | 164 | qt_config->setValue("use_gdbstub", Settings::values.use_gdbstub); |
| 110 | qt_config->setValue("gdbstub_port", Settings::values.gdbstub_port); | 165 | qt_config->setValue("gdbstub_port", Settings::values.gdbstub_port); |
| 111 | qt_config->endGroup(); | 166 | qt_config->endGroup(); |
| 167 | |||
| 168 | qt_config->beginGroup("UI"); | ||
| 169 | |||
| 170 | qt_config->beginGroup("UILayout"); | ||
| 171 | qt_config->setValue("geometry", UISettings::values.geometry); | ||
| 172 | qt_config->setValue("state", UISettings::values.state); | ||
| 173 | qt_config->setValue("geometryRenderWindow", UISettings::values.renderwindow_geometry); | ||
| 174 | qt_config->setValue("gameListHeaderState", UISettings::values.gamelist_header_state); | ||
| 175 | qt_config->setValue("microProfileDialogGeometry", UISettings::values.microprofile_geometry); | ||
| 176 | qt_config->setValue("microProfileDialogVisible", UISettings::values.microprofile_visible); | ||
| 177 | qt_config->endGroup(); | ||
| 178 | |||
| 179 | qt_config->beginGroup("Paths"); | ||
| 180 | qt_config->setValue("romsPath", UISettings::values.roms_path); | ||
| 181 | qt_config->setValue("symbolsPath", UISettings::values.symbols_path); | ||
| 182 | qt_config->setValue("gameListRootDir", UISettings::values.gamedir); | ||
| 183 | qt_config->setValue("gameListDeepScan", UISettings::values.gamedir_deepscan); | ||
| 184 | qt_config->setValue("recentFiles", UISettings::values.recent_files); | ||
| 185 | qt_config->endGroup(); | ||
| 186 | |||
| 187 | qt_config->beginGroup("Shortcuts"); | ||
| 188 | for (auto shortcut : UISettings::values.shortcuts ) { | ||
| 189 | qt_config->setValue(shortcut.first + "/KeySeq", shortcut.second.first); | ||
| 190 | qt_config->setValue(shortcut.first + "/Context", shortcut.second.second); | ||
| 191 | } | ||
| 192 | qt_config->endGroup(); | ||
| 193 | |||
| 194 | qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode); | ||
| 195 | qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar); | ||
| 196 | qt_config->setValue("confirmClose", UISettings::values.confirm_before_closing); | ||
| 197 | qt_config->setValue("firstStart", UISettings::values.first_start); | ||
| 198 | |||
| 199 | qt_config->endGroup(); | ||
| 112 | } | 200 | } |
| 113 | 201 | ||
| 114 | void Config::Reload() { | 202 | void Config::Reload() { |
| 115 | ReadValues(); | 203 | ReadValues(); |
| 204 | Settings::Apply(); | ||
| 116 | } | 205 | } |
| 117 | 206 | ||
| 118 | void Config::Save() { | 207 | void Config::Save() { |