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: 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
@@ -23,54 +24,54 @@ using Settings::SwitchableSetting;
|
||||
|
||||
#ifndef CANNOT_EXPLICITLY_INSTANTIATE
|
||||
namespace Settings {
|
||||
extern template class Setting<bool>;
|
||||
extern template class Setting<std::string>;
|
||||
extern template class Setting<u16, true>;
|
||||
extern template class Setting<u32>;
|
||||
extern template class Setting<u8, true>;
|
||||
extern template class Setting<u8>;
|
||||
extern template class Setting<unsigned long long>;
|
||||
extern template class Setting<bool>;
|
||||
extern template class Setting<std::string>;
|
||||
extern template class Setting<u16, true>;
|
||||
extern template class Setting<u32>;
|
||||
extern template class Setting<u8, true>;
|
||||
extern template class Setting<u8>;
|
||||
extern template class Setting<unsigned long long>;
|
||||
} // namespace Settings
|
||||
#endif
|
||||
|
||||
namespace UISettings {
|
||||
|
||||
bool IsDarkTheme();
|
||||
bool IsDarkTheme();
|
||||
|
||||
struct ContextualShortcut {
|
||||
struct ContextualShortcut {
|
||||
std::string keyseq;
|
||||
std::string controller_keyseq;
|
||||
int context;
|
||||
bool repeat;
|
||||
};
|
||||
};
|
||||
|
||||
struct Shortcut {
|
||||
struct Shortcut {
|
||||
std::string name;
|
||||
std::string group;
|
||||
ContextualShortcut shortcut;
|
||||
};
|
||||
};
|
||||
|
||||
enum class Theme {
|
||||
enum class Theme {
|
||||
Default,
|
||||
DefaultColorful,
|
||||
Dark,
|
||||
DarkColorful,
|
||||
MidnightBlue,
|
||||
MidnightBlueColorful,
|
||||
};
|
||||
};
|
||||
|
||||
static constexpr Theme default_theme{
|
||||
#ifdef _WIN32
|
||||
static constexpr Theme default_theme{
|
||||
#ifdef _WIN32
|
||||
Theme::DarkColorful
|
||||
#else
|
||||
#else
|
||||
Theme::DefaultColorful
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
using Themes = std::array<std::pair<const char*, const char*>, 6>;
|
||||
extern const Themes themes;
|
||||
using Themes = std::array<std::pair<const char*, const char*>, 6>;
|
||||
extern const Themes themes;
|
||||
|
||||
struct GameDir {
|
||||
struct GameDir {
|
||||
std::string path;
|
||||
bool deep_scan = false;
|
||||
bool expanded = false;
|
||||
@@ -80,9 +81,9 @@ struct GameDir {
|
||||
bool operator!=(const GameDir& rhs) const {
|
||||
return !operator==(rhs);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
struct Values {
|
||||
struct Values {
|
||||
Settings::Linkage linkage{1000};
|
||||
|
||||
QByteArray geometry;
|
||||
@@ -164,6 +165,9 @@ struct Values {
|
||||
|
||||
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>
|
||||
std::vector<Shortcut> shortcuts;
|
||||
|
||||
@@ -218,21 +222,21 @@ struct Values {
|
||||
bool configuration_applied;
|
||||
bool reset_to_defaults;
|
||||
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 RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig);
|
||||
void SaveWindowState();
|
||||
void RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig);
|
||||
|
||||
// This shouldn't have anything except static initializers (no functions). So
|
||||
// QKeySequence(...).toString() is NOT ALLOWED HERE.
|
||||
// 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.
|
||||
// clang-format off
|
||||
const std::array<Shortcut, 29> default_hotkeys{{
|
||||
// This shouldn't have anything except static initializers (no functions). So
|
||||
// QKeySequence(...).toString() is NOT ALLOWED HERE.
|
||||
// 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.
|
||||
// clang-format off
|
||||
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 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}},
|
||||
@@ -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 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}},
|
||||
}};
|
||||
}};
|
||||
// clang-format on
|
||||
|
||||
} // namespace UISettings
|
||||
|
||||
Reference in New Issue
Block a user