Browse Source

move to UISettings for qt exclusively

pull/353/head
lizzie 4 weeks ago
committed by Caio Oliveira
parent
commit
b24eaf0966
No known key found for this signature in database GPG Key ID: 362DA3DC1901E080
  1. 2
      src/common/CMakeLists.txt
  2. 13
      src/common/settings.h
  3. 3
      src/qt_common/CMakeLists.txt
  4. 6
      src/qt_common/config/shared_translation.cpp
  5. 13
      src/qt_common/config/uisettings.h
  6. 8
      src/qt_common/gamemode.cpp
  7. 0
      src/qt_common/gamemode.h
  8. 22
      src/yuzu/main_window.cpp
  9. 4
      src/yuzu_cmd/yuzu.cpp

2
src/common/CMakeLists.txt

@ -65,8 +65,6 @@ add_library(
fs/fs_util.h fs/fs_util.h
fs/path_util.cpp fs/path_util.cpp
fs/path_util.h fs/path_util.h
gamemode.cpp
gamemode.h
hash.h hash.h
heap_tracker.cpp heap_tracker.cpp
heap_tracker.h heap_tracker.h

13
src/common/settings.h

@ -621,19 +621,6 @@ struct Values {
true, true,
true}; true};
// Linux/MinGW may support (requires libdl support)
SwitchableSetting<bool> enable_gamemode{linkage,
#ifndef _MSC_VER
true,
#else
false,
#endif
"enable_gamemode", Category::UiGeneral};
#ifdef __unix__
SwitchableSetting<bool> gui_force_x11{linkage, false, "gui_force_x11", Category::UiGeneral};
Setting<bool> gui_hide_backend_warning{linkage, false, "gui_hide_backend_warning", Category::UiGeneral};
#endif
// Controls // Controls
InputSetting<std::array<PlayerInput, 10>> players; InputSetting<std::array<PlayerInput, 10>> players;

3
src/qt_common/CMakeLists.txt

@ -5,6 +5,9 @@ add_library(qt_common STATIC
qt_common.h qt_common.h
qt_common.cpp qt_common.cpp
gamemode.cpp
gamemode.h
config/uisettings.cpp config/uisettings.cpp
config/uisettings.h config/uisettings.h
config/qt_config.cpp config/qt_config.cpp

6
src/qt_common/config/shared_translation.cpp

@ -433,10 +433,10 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent)
tr("Whether or not to check for updates upon startup.")); tr("Whether or not to check for updates upon startup."));
// Linux // Linux
INSERT(Settings, enable_gamemode, tr("Enable Gamemode"), QString());
INSERT(UISettings, enable_gamemode, tr("Enable Gamemode"), QString());
#ifdef __unix__ #ifdef __unix__
INSERT(Settings, gui_force_x11, tr("Force X11 as Graphics Backend"), QString());
INSERT(Settings, gui_hide_backend_warning, QString(), QString());
INSERT(UISettings, gui_force_x11, tr("Force X11 as Graphics Backend"), QString());
INSERT(UISettings, gui_hide_backend_warning, QString(), QString());
#endif #endif
// Ui Debugging // Ui Debugging

13
src/qt_common/config/uisettings.h

@ -142,6 +142,19 @@ struct Values {
Setting<bool> check_for_updates{linkage, true, "check_for_updates", Category::UiGeneral}; Setting<bool> check_for_updates{linkage, true, "check_for_updates", Category::UiGeneral};
// Linux/MinGW may support (requires libdl support)
SwitchableSetting<bool> enable_gamemode{linkage,
#ifndef _MSC_VER
true,
#else
false,
#endif
"enable_gamemode", Category::UiGeneral};
#ifdef __unix__
SwitchableSetting<bool> gui_force_x11{linkage, false, "gui_force_x11", Category::UiGeneral};
Setting<bool> gui_hide_backend_warning{linkage, false, "gui_hide_backend_warning", Category::UiGeneral};
#endif
// Discord RPC // Discord RPC
Setting<bool> enable_discord_presence{linkage, false, "enable_discord_presence", Category::Ui}; Setting<bool> enable_discord_presence{linkage, false, "enable_discord_presence", Category::Ui};

8
src/common/gamemode.cpp → src/qt_common/gamemode.cpp

@ -9,15 +9,15 @@
#ifdef __unix__ #ifdef __unix__
#include <lib/gamemode_client.h> #include <lib/gamemode_client.h>
#endif #endif
#include "common/gamemode.h"
#include "qt_common/gamemode.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/settings.h"
#include "qt_common/config/uisettings.h"
namespace Common::FeralGamemode { namespace Common::FeralGamemode {
/// @brief Start the gamemode client /// @brief Start the gamemode client
void Start() noexcept { void Start() noexcept {
if (Settings::values.enable_gamemode) {
if (UISettings::values.enable_gamemode) {
#ifdef __unix__ #ifdef __unix__
if (gamemode_request_start() < 0) { if (gamemode_request_start() < 0) {
#ifdef __linux__ #ifdef __linux__
@ -34,7 +34,7 @@ void Start() noexcept {
/// @brief Stop the gmemode client /// @brief Stop the gmemode client
void Stop() noexcept { void Stop() noexcept {
if (Settings::values.enable_gamemode) {
if (UISettings::values.enable_gamemode) {
#ifdef __unix__ #ifdef __unix__
if (gamemode_request_end() < 0) { if (gamemode_request_end() < 0) {
#ifdef __linux__ #ifdef __linux__

0
src/common/gamemode.h → src/qt_common/gamemode.h

22
src/yuzu/main_window.cpp

@ -164,7 +164,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#endif #endif
#include "common/gamemode.h"
#include "qt_common/gamemode.h"
#ifdef _WIN32 #ifdef _WIN32
#include "core/core_timing.h" #include "core/core_timing.h"
@ -421,7 +421,7 @@ MainWindow::MainWindow(bool has_broken_vulkan)
SetupSigInterrupts(); SetupSigInterrupts();
#endif #endif
SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue());
SetGamemodeEnabled(UISettings::values.enable_gamemode.GetValue());
UISettings::RestoreWindowState(config); UISettings::RestoreWindowState(config);
@ -3371,9 +3371,9 @@ void MainWindow::OnConfigure() {
const auto old_theme = UISettings::values.theme; const auto old_theme = UISettings::values.theme;
const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue();
const auto old_language_index = Settings::values.language_index.GetValue(); const auto old_language_index = Settings::values.language_index.GetValue();
const bool old_gamemode = Settings::values.enable_gamemode.GetValue();
const bool old_gamemode = UISettings::values.enable_gamemode.GetValue();
#ifdef __unix__ #ifdef __unix__
const bool old_force_x11 = Settings::values.gui_force_x11.GetValue();
const bool old_force_x11 = UISettings::values.gui_force_x11.GetValue();
#endif #endif
Settings::SetConfiguringGlobal(true); Settings::SetConfiguringGlobal(true);
@ -3434,12 +3434,12 @@ void MainWindow::OnConfigure() {
if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) { if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) {
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
} }
if (Settings::values.enable_gamemode.GetValue() != old_gamemode) {
SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue());
if (UISettings::values.enable_gamemode.GetValue() != old_gamemode) {
SetGamemodeEnabled(UISettings::values.enable_gamemode.GetValue());
} }
#ifdef __unix__ #ifdef __unix__
if (Settings::values.gui_force_x11.GetValue() != old_force_x11) {
GraphicsBackend::SetForceX11(Settings::values.gui_force_x11.GetValue());
if (UISettings::values.gui_force_x11.GetValue() != old_force_x11) {
GraphicsBackend::SetForceX11(UISettings::values.gui_force_x11.GetValue());
} }
#endif #endif
@ -4386,7 +4386,7 @@ void MainWindow::OnCheckGraphicsBackend() {
if (!isWayland) if (!isWayland)
return; return;
const bool currently_hidden = Settings::values.gui_hide_backend_warning.GetValue();
const bool currently_hidden = UISettings::values.gui_hide_backend_warning.GetValue();
if (currently_hidden) if (currently_hidden)
return; return;
@ -4409,11 +4409,11 @@ void MainWindow::OnCheckGraphicsBackend() {
const bool hide = cb->isChecked(); const bool hide = cb->isChecked();
if (hide != currently_hidden) { if (hide != currently_hidden) {
Settings::values.gui_hide_backend_warning.SetValue(hide);
UISettings::values.gui_hide_backend_warning.SetValue(hide);
} }
if (msgbox.clickedButton() == okButton) { if (msgbox.clickedButton() == okButton) {
Settings::values.gui_force_x11.SetValue(true);
UISettings::values.gui_force_x11.SetValue(true);
GraphicsBackend::SetForceX11(true); GraphicsBackend::SetForceX11(true);
QMessageBox::information(this, QMessageBox::information(this,
tr("Restart Required"), tr("Restart Required"),

4
src/yuzu_cmd/yuzu.cpp

@ -59,7 +59,6 @@ __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
} }
#endif #endif
#include "common/gamemode.h"
static void PrintHelp(const char* argv0) { static void PrintHelp(const char* argv0) {
std::cout << "Usage: " << argv0 std::cout << "Usage: " << argv0
@ -424,8 +423,6 @@ int main(int argc, char** argv) {
// Just exit right away. // Just exit right away.
exit(0); exit(0);
}); });
Common::FeralGamemode::Start();
void(system.Run()); void(system.Run());
if (system.DebuggerEnabled()) { if (system.DebuggerEnabled()) {
system.InitializeDebugger(); system.InitializeDebugger();
@ -436,7 +433,6 @@ int main(int argc, char** argv) {
system.DetachDebugger(); system.DetachDebugger();
void(system.Pause()); void(system.Pause());
system.ShutdownMainProcess(); system.ShutdownMainProcess();
Common::FeralGamemode::Stop();
detached_tasks.WaitForAllTasks(); detached_tasks.WaitForAllTasks();
return 0; return 0;
} }

Loading…
Cancel
Save