mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-21 11:33:35 +00:00
Edit uisettings.cpp
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
||||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
// SPDX-FileCopyrightText: 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@@ -9,13 +9,13 @@
|
|||||||
|
|
||||||
#ifndef CANNOT_EXPLICITLY_INSTANTIATE
|
#ifndef CANNOT_EXPLICITLY_INSTANTIATE
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
template class Setting<bool>;
|
template class Setting<bool>;
|
||||||
template class Setting<std::string>;
|
template class Setting<std::string>;
|
||||||
template class Setting<u16, true>;
|
template class Setting<u16, true>;
|
||||||
template class Setting<u32>;
|
template class Setting<u32>;
|
||||||
template class Setting<u8, true>;
|
template class Setting<u8, true>;
|
||||||
template class Setting<u8>;
|
template class Setting<u8>;
|
||||||
template class Setting<unsigned long long>;
|
template class Setting<unsigned long long>;
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -23,24 +23,24 @@ namespace FS = Common::FS;
|
|||||||
|
|
||||||
namespace UISettings {
|
namespace UISettings {
|
||||||
|
|
||||||
const Themes themes{{
|
const Themes themes{{
|
||||||
{"Default", "default"},
|
{"Default", "default"},
|
||||||
{"Default Colorful", "colorful"},
|
{"Default Colorful", "colorful"},
|
||||||
{"Dark", "qdarkstyle"},
|
{"Dark", "qdarkstyle"},
|
||||||
{"Dark Colorful", "colorful_dark"},
|
{"Dark Colorful", "colorful_dark"},
|
||||||
{"Midnight Blue", "qdarkstyle_midnight_blue"},
|
{"Midnight Blue", "qdarkstyle_midnight_blue"},
|
||||||
{"Midnight Blue Colorful", "colorful_midnight_blue"},
|
{"Midnight Blue Colorful", "colorful_midnight_blue"},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
bool IsDarkTheme() {
|
bool IsDarkTheme() {
|
||||||
const auto& theme = UISettings::values.theme;
|
const auto& theme = UISettings::values.theme;
|
||||||
return theme == std::string("qdarkstyle") || theme == std::string("qdarkstyle_midnight_blue") ||
|
return theme == std::string("qdarkstyle") || theme == std::string("qdarkstyle_midnight_blue") ||
|
||||||
theme == std::string("colorful_dark") || theme == std::string("colorful_midnight_blue");
|
theme == std::string("colorful_dark") || theme == std::string("colorful_midnight_blue");
|
||||||
}
|
}
|
||||||
|
|
||||||
Values values = {};
|
Values values = {};
|
||||||
|
|
||||||
u32 CalculateWidth(u32 height, Settings::AspectRatio ratio) {
|
u32 CalculateWidth(u32 height, Settings::AspectRatio ratio) {
|
||||||
switch (ratio) {
|
switch (ratio) {
|
||||||
case Settings::AspectRatio::R4_3:
|
case Settings::AspectRatio::R4_3:
|
||||||
return height * 4 / 3;
|
return height * 4 / 3;
|
||||||
@@ -56,9 +56,9 @@ u32 CalculateWidth(u32 height, Settings::AspectRatio ratio) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return height * 16 / 9;
|
return height * 16 / 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveWindowState() {
|
void SaveWindowState() {
|
||||||
const auto window_state_config_loc =
|
const auto window_state_config_loc =
|
||||||
FS::PathToUTF8String(FS::GetCitronPath(FS::CitronPath::ConfigDir) / "window_state.ini");
|
FS::PathToUTF8String(FS::GetCitronPath(FS::CitronPath::ConfigDir) / "window_state.ini");
|
||||||
|
|
||||||
@@ -72,9 +72,9 @@ void SaveWindowState() {
|
|||||||
config.setValue(QStringLiteral("microProfileDialogGeometry"), values.microprofile_geometry);
|
config.setValue(QStringLiteral("microProfileDialogGeometry"), values.microprofile_geometry);
|
||||||
|
|
||||||
config.sync();
|
config.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig) {
|
void RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig) {
|
||||||
const auto window_state_config_loc =
|
const auto window_state_config_loc =
|
||||||
FS::PathToUTF8String(FS::GetCitronPath(FS::CitronPath::ConfigDir) / "window_state.ini");
|
FS::PathToUTF8String(FS::GetCitronPath(FS::CitronPath::ConfigDir) / "window_state.ini");
|
||||||
|
|
||||||
@@ -110,6 +110,6 @@ void RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig) {
|
|||||||
config.value(QStringLiteral("gameListHeaderState")).toByteArray();
|
config.value(QStringLiteral("gameListHeaderState")).toByteArray();
|
||||||
values.microprofile_geometry =
|
values.microprofile_geometry =
|
||||||
config.value(QStringLiteral("microProfileDialogGeometry")).toByteArray();
|
config.value(QStringLiteral("microProfileDialogGeometry")).toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace UISettings
|
} // namespace UISettings
|
||||||
|
|||||||
Reference in New Issue
Block a user