mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-22 03:43:42 +00:00
Edit uisettings.h
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -23,54 +24,54 @@ using Settings::SwitchableSetting;
|
|||||||
|
|
||||||
#ifndef CANNOT_EXPLICITLY_INSTANTIATE
|
#ifndef CANNOT_EXPLICITLY_INSTANTIATE
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
extern template class Setting<bool>;
|
extern template class Setting<bool>;
|
||||||
extern template class Setting<std::string>;
|
extern template class Setting<std::string>;
|
||||||
extern template class Setting<u16, true>;
|
extern template class Setting<u16, true>;
|
||||||
extern template class Setting<u32>;
|
extern template class Setting<u32>;
|
||||||
extern template class Setting<u8, true>;
|
extern template class Setting<u8, true>;
|
||||||
extern template class Setting<u8>;
|
extern template class Setting<u8>;
|
||||||
extern template class Setting<unsigned long long>;
|
extern template class Setting<unsigned long long>;
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace UISettings {
|
namespace UISettings {
|
||||||
|
|
||||||
bool IsDarkTheme();
|
bool IsDarkTheme();
|
||||||
|
|
||||||
struct ContextualShortcut {
|
struct ContextualShortcut {
|
||||||
std::string keyseq;
|
std::string keyseq;
|
||||||
std::string controller_keyseq;
|
std::string controller_keyseq;
|
||||||
int context;
|
int context;
|
||||||
bool repeat;
|
bool repeat;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Shortcut {
|
struct Shortcut {
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string group;
|
std::string group;
|
||||||
ContextualShortcut shortcut;
|
ContextualShortcut shortcut;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Theme {
|
enum class Theme {
|
||||||
Default,
|
Default,
|
||||||
DefaultColorful,
|
DefaultColorful,
|
||||||
Dark,
|
Dark,
|
||||||
DarkColorful,
|
DarkColorful,
|
||||||
MidnightBlue,
|
MidnightBlue,
|
||||||
MidnightBlueColorful,
|
MidnightBlueColorful,
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr Theme default_theme{
|
static constexpr Theme default_theme{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Theme::DarkColorful
|
Theme::DarkColorful
|
||||||
#else
|
#else
|
||||||
Theme::DefaultColorful
|
Theme::DefaultColorful
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
using Themes = std::array<std::pair<const char*, const char*>, 6>;
|
using Themes = std::array<std::pair<const char*, const char*>, 6>;
|
||||||
extern const Themes themes;
|
extern const Themes themes;
|
||||||
|
|
||||||
struct GameDir {
|
struct GameDir {
|
||||||
std::string path;
|
std::string path;
|
||||||
bool deep_scan = false;
|
bool deep_scan = false;
|
||||||
bool expanded = false;
|
bool expanded = false;
|
||||||
@@ -80,9 +81,9 @@ struct GameDir {
|
|||||||
bool operator!=(const GameDir& rhs) const {
|
bool operator!=(const GameDir& rhs) const {
|
||||||
return !operator==(rhs);
|
return !operator==(rhs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Values {
|
struct Values {
|
||||||
Settings::Linkage linkage{1000};
|
Settings::Linkage linkage{1000};
|
||||||
|
|
||||||
QByteArray geometry;
|
QByteArray geometry;
|
||||||
@@ -164,6 +165,9 @@ struct Values {
|
|||||||
|
|
||||||
std::string theme;
|
std::string theme;
|
||||||
|
|
||||||
|
Setting<std::string> accent_color{linkage, "#4a9eff", "accent_color", Category::Ui};
|
||||||
|
Setting<bool> enable_rainbow_mode{linkage, false, "enable_rainbow_mode", Category::Ui};
|
||||||
|
|
||||||
// Shortcut name <Shortcut, context>
|
// Shortcut name <Shortcut, context>
|
||||||
std::vector<Shortcut> shortcuts;
|
std::vector<Shortcut> shortcuts;
|
||||||
|
|
||||||
@@ -218,21 +222,21 @@ struct Values {
|
|||||||
bool configuration_applied;
|
bool configuration_applied;
|
||||||
bool reset_to_defaults;
|
bool reset_to_defaults;
|
||||||
bool shortcut_already_warned{false};
|
bool shortcut_already_warned{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Values values;
|
extern Values values;
|
||||||
|
|
||||||
u32 CalculateWidth(u32 height, Settings::AspectRatio ratio);
|
u32 CalculateWidth(u32 height, Settings::AspectRatio ratio);
|
||||||
|
|
||||||
void SaveWindowState();
|
void SaveWindowState();
|
||||||
void RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig);
|
void RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig);
|
||||||
|
|
||||||
// This shouldn't have anything except static initializers (no functions). So
|
// This shouldn't have anything except static initializers (no functions). So
|
||||||
// QKeySequence(...).toString() is NOT ALLOWED HERE.
|
// QKeySequence(...).toString() is NOT ALLOWED HERE.
|
||||||
// This must be in alphabetical order according to action name as it must have the same order as
|
// This must be in alphabetical order according to action name as it must have the same order as
|
||||||
// UISetting::values.shortcuts, which is alphabetically ordered.
|
// UISetting::values.shortcuts, which is alphabetically ordered.
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const std::array<Shortcut, 29> default_hotkeys{{
|
const std::array<Shortcut, 29> default_hotkeys{{
|
||||||
{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}},
|
{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}},
|
||||||
{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}},
|
{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}},
|
||||||
{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}},
|
{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}},
|
||||||
@@ -262,7 +266,7 @@ const std::array<Shortcut, 29> default_hotkeys{{
|
|||||||
{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}},
|
{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}},
|
||||||
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Renderdoc Capture")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string(""), std::string(""), Qt::ApplicationShortcut, false}},
|
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Toggle Renderdoc Capture")).toStdString(), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")).toStdString(), {std::string(""), std::string(""), Qt::ApplicationShortcut, false}},
|
||||||
{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}},
|
{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}},
|
||||||
}};
|
}};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
} // namespace UISettings
|
} // namespace UISettings
|
||||||
|
|||||||
Reference in New Issue
Block a user