diff options
Diffstat (limited to 'src/yuzu/uisettings.h')
| -rw-r--r-- | src/yuzu/uisettings.h | 79 |
1 files changed, 68 insertions, 11 deletions
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 3485a6347..549a39e1b 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "common/settings.h" | 15 | #include "common/settings.h" |
| 16 | #include "common/settings_enums.h" | 16 | #include "common/settings_enums.h" |
| 17 | #include "configuration/qt_config.h" | ||
| 17 | 18 | ||
| 18 | using Settings::Category; | 19 | using Settings::Category; |
| 19 | using Settings::ConfirmStop; | 20 | using Settings::ConfirmStop; |
| @@ -37,15 +38,15 @@ namespace UISettings { | |||
| 37 | bool IsDarkTheme(); | 38 | bool IsDarkTheme(); |
| 38 | 39 | ||
| 39 | struct ContextualShortcut { | 40 | struct ContextualShortcut { |
| 40 | QString keyseq; | 41 | std::string keyseq; |
| 41 | QString controller_keyseq; | 42 | std::string controller_keyseq; |
| 42 | int context; | 43 | int context; |
| 43 | bool repeat; | 44 | bool repeat; |
| 44 | }; | 45 | }; |
| 45 | 46 | ||
| 46 | struct Shortcut { | 47 | struct Shortcut { |
| 47 | QString name; | 48 | std::string name; |
| 48 | QString group; | 49 | std::string group; |
| 49 | ContextualShortcut shortcut; | 50 | ContextualShortcut shortcut; |
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| @@ -58,11 +59,19 @@ enum class Theme { | |||
| 58 | MidnightBlueColorful, | 59 | MidnightBlueColorful, |
| 59 | }; | 60 | }; |
| 60 | 61 | ||
| 62 | static constexpr Theme default_theme{ | ||
| 63 | #ifdef _WIN32 | ||
| 64 | Theme::DarkColorful | ||
| 65 | #else | ||
| 66 | Theme::DefaultColorful | ||
| 67 | #endif | ||
| 68 | }; | ||
| 69 | |||
| 61 | using Themes = std::array<std::pair<const char*, const char*>, 6>; | 70 | using Themes = std::array<std::pair<const char*, const char*>, 6>; |
| 62 | extern const Themes themes; | 71 | extern const Themes themes; |
| 63 | 72 | ||
| 64 | struct GameDir { | 73 | struct GameDir { |
| 65 | QString path; | 74 | std::string path; |
| 66 | bool deep_scan = false; | 75 | bool deep_scan = false; |
| 67 | bool expanded = false; | 76 | bool expanded = false; |
| 68 | bool operator==(const GameDir& rhs) const { | 77 | bool operator==(const GameDir& rhs) const { |
| @@ -144,15 +153,15 @@ struct Values { | |||
| 144 | Category::Screenshots}; | 153 | Category::Screenshots}; |
| 145 | Setting<u32> screenshot_height{linkage, 0, "screenshot_height", Category::Screenshots}; | 154 | Setting<u32> screenshot_height{linkage, 0, "screenshot_height", Category::Screenshots}; |
| 146 | 155 | ||
| 147 | QString roms_path; | 156 | std::string roms_path; |
| 148 | QString symbols_path; | 157 | std::string symbols_path; |
| 149 | QString game_dir_deprecated; | 158 | std::string game_dir_deprecated; |
| 150 | bool game_dir_deprecated_deepscan; | 159 | bool game_dir_deprecated_deepscan; |
| 151 | QVector<UISettings::GameDir> game_dirs; | 160 | QVector<GameDir> game_dirs; |
| 152 | QStringList recent_files; | 161 | QStringList recent_files; |
| 153 | QString language; | 162 | std::string language; |
| 154 | 163 | ||
| 155 | QString theme; | 164 | std::string theme; |
| 156 | 165 | ||
| 157 | // Shortcut name <Shortcut, context> | 166 | // Shortcut name <Shortcut, context> |
| 158 | std::vector<Shortcut> shortcuts; | 167 | std::vector<Shortcut> shortcuts; |
| @@ -206,6 +215,54 @@ extern Values values; | |||
| 206 | 215 | ||
| 207 | u32 CalculateWidth(u32 height, Settings::AspectRatio ratio); | 216 | u32 CalculateWidth(u32 height, Settings::AspectRatio ratio); |
| 208 | 217 | ||
| 218 | void SaveWindowState(); | ||
| 219 | void RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig); | ||
| 220 | |||
| 221 | // This shouldn't have anything except static initializers (no functions). So | ||
| 222 | // QKeySequence(...).toString() is NOT ALLOWED HERE. | ||
| 223 | // This must be in alphabetical order according to action name as it must have the same order as | ||
| 224 | // UISetting::values.shortcuts, which is alphabetically ordered. | ||
| 225 | // clang-format off | ||
| 226 | const std::array<Shortcut, 23> default_hotkeys{{ | ||
| 227 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Mute/Unmute")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+M"), std::string("Home+Dpad_Right"), Qt::WindowShortcut, false}}, | ||
| 228 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Volume Down")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("-"), std::string("Home+Dpad_Down"), Qt::ApplicationShortcut, true}}, | ||
| 229 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Volume Up")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("="), std::string("Home+Dpad_Up"), Qt::ApplicationShortcut, true}}, | ||
| 230 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Capture Screenshot")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+P"), std::string("Screenshot"), Qt::WidgetWithChildrenShortcut, false}}, | ||
| 231 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change Adapting Filter")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("F8"), std::string("Home+L"), Qt::ApplicationShortcut, false}}, | ||
| 232 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change Docked Mode")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("F10"), std::string("Home+X"), Qt::ApplicationShortcut, false}}, | ||
| 233 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change GPU Accuracy")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("F9"), std::string("Home+R"), Qt::ApplicationShortcut, false}}, | ||
| 234 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Continue/Pause Emulation")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("F4"), std::string("Home+Plus"), Qt::WindowShortcut, false}}, | ||
| 235 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Exit Fullscreen")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Esc"), std::string(""), Qt::WindowShortcut, false}}, | ||
| 236 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Exit yuzu")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+Q"), std::string("Home+Minus"), Qt::WindowShortcut, false}}, | ||
| 237 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Fullscreen")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("F11"), std::string("Home+B"), Qt::WindowShortcut, false}}, | ||
| 238 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load File")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+O"), std::string(""), Qt::WidgetWithChildrenShortcut, false}}, | ||
| 239 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load/Remove Amiibo")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("F2"), std::string("Home+A"), Qt::WidgetWithChildrenShortcut, false}}, | ||
| 240 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Restart Emulation")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("F6"), std::string("R+Plus+Minus"), Qt::WindowShortcut, false}}, | ||
| 241 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Stop Emulation")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("F5"), std::string("L+Plus+Minus"), Qt::WindowShortcut, false}}, | ||
| 242 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Record")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+F7"), std::string(""), Qt::ApplicationShortcut, false}}, | ||
| 243 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Reset")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+F6"), std::string(""), Qt::ApplicationShortcut, false}}, | ||
| 244 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Start/Stop")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+F5"), std::string(""), Qt::ApplicationShortcut, false}}, | ||
| 245 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Filter Bar")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+F"), std::string(""), Qt::WindowShortcut, false}}, | ||
| 246 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Framerate Limit")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+U"), std::string("Home+Y"), Qt::ApplicationShortcut, false}}, | ||
| 247 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Mouse Panning")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+F9"), std::string(""), Qt::ApplicationShortcut, false}}, | ||
| 248 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Renderdoc Capture")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string(""), std::string(""), Qt::ApplicationShortcut, false}}, | ||
| 249 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Status Bar")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string("Ctrl+S"), std::string(""), Qt::WindowShortcut, false}}, | ||
| 250 | }}; | ||
| 251 | // clang-format on | ||
| 252 | |||
| 209 | } // namespace UISettings | 253 | } // namespace UISettings |
| 210 | 254 | ||
| 211 | Q_DECLARE_METATYPE(UISettings::GameDir*); | 255 | Q_DECLARE_METATYPE(UISettings::GameDir*); |
| 256 | |||
| 257 | // These metatype declarations cannot be in common/settings.h because core is devoid of QT | ||
| 258 | Q_DECLARE_METATYPE(Settings::CpuAccuracy); | ||
| 259 | Q_DECLARE_METATYPE(Settings::GpuAccuracy); | ||
| 260 | Q_DECLARE_METATYPE(Settings::FullscreenMode); | ||
| 261 | Q_DECLARE_METATYPE(Settings::NvdecEmulation); | ||
| 262 | Q_DECLARE_METATYPE(Settings::ResolutionSetup); | ||
| 263 | Q_DECLARE_METATYPE(Settings::ScalingFilter); | ||
| 264 | Q_DECLARE_METATYPE(Settings::AntiAliasing); | ||
| 265 | Q_DECLARE_METATYPE(Settings::RendererBackend); | ||
| 266 | Q_DECLARE_METATYPE(Settings::ShaderBackend); | ||
| 267 | Q_DECLARE_METATYPE(Settings::AstcRecompression); | ||
| 268 | Q_DECLARE_METATYPE(Settings::AstcDecodeMode); | ||