mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-05-12 15:49:39 -06:00
qt: Exclude some features logic if disabled at compile time (#1630)
* Qt: Exclude more logic if disabled * Fix license * Fix * Exclude stress test logic * Fix RequestStop
This commit is contained in:
parent
671faf8dca
commit
e9846de5be
@ -60,7 +60,9 @@
|
||||
#include "citra_qt/debugger/profiler.h"
|
||||
#include "citra_qt/debugger/registers.h"
|
||||
#include "citra_qt/debugger/wait_tree.h"
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
#include "citra_qt/discord.h"
|
||||
#endif
|
||||
#include "citra_qt/dumping/dumping_dialog.h"
|
||||
#include "citra_qt/game_list.h"
|
||||
#include "citra_qt/hotkeys.h"
|
||||
@ -341,8 +343,10 @@ GMainWindow::GMainWindow(Core::System& system_)
|
||||
default_theme_paths = QIcon::themeSearchPaths();
|
||||
UpdateUITheme();
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
|
||||
discord_rpc->Update();
|
||||
#endif
|
||||
|
||||
play_time_manager = std::make_unique<PlayTime::PlayTimeManager>();
|
||||
|
||||
@ -1511,7 +1515,10 @@ void GMainWindow::ShutdownGame() {
|
||||
|
||||
AllowOSSleep();
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
discord_rpc->Pause();
|
||||
#endif
|
||||
|
||||
emu_thread->RequestStop();
|
||||
|
||||
// Release emu threads from any breakpoints
|
||||
@ -1539,8 +1546,9 @@ void GMainWindow::ShutdownGame() {
|
||||
|
||||
OnCloseMovie();
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
discord_rpc->Update();
|
||||
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
Common::Linux::StopGamemode();
|
||||
#endif
|
||||
@ -1591,6 +1599,7 @@ void GMainWindow::ShutdownGame() {
|
||||
secondary_window->ReleaseRenderTarget();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DEVELOPER_OPTIONS
|
||||
void GMainWindow::StartLaunchStressTest(const QString& game_path) {
|
||||
QThreadPool::globalInstance()->start([this, game_path] {
|
||||
do {
|
||||
@ -1600,6 +1609,7 @@ void GMainWindow::StartLaunchStressTest(const QString& game_path) {
|
||||
} while (emulation_running);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
void GMainWindow::StoreRecentFile(const QString& filename) {
|
||||
UISettings::values.recent_files.prepend(filename);
|
||||
@ -2476,8 +2486,9 @@ void GMainWindow::OnStartGame() {
|
||||
play_time_manager->SetProgramId(game_title_id);
|
||||
play_time_manager->Start();
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
discord_rpc->Update();
|
||||
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
Common::Linux::StartGamemode();
|
||||
#endif
|
||||
@ -2801,7 +2812,9 @@ void GMainWindow::OnConfigure() {
|
||||
const int old_input_profile_index = Settings::values.current_input_profile_index;
|
||||
const auto old_input_profiles = Settings::values.input_profiles;
|
||||
const auto old_touch_from_button_maps = Settings::values.touch_from_button_maps;
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue();
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
const bool old_gamemode = Settings::values.enable_gamemode.GetValue();
|
||||
#endif
|
||||
@ -2813,9 +2826,11 @@ void GMainWindow::OnConfigure() {
|
||||
if (UISettings::values.theme != old_theme) {
|
||||
UpdateUITheme();
|
||||
}
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) {
|
||||
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
|
||||
}
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
if (Settings::values.enable_gamemode.GetValue() != old_gamemode) {
|
||||
SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue());
|
||||
@ -4171,18 +4186,16 @@ void GMainWindow::RetranslateStatusBar() {
|
||||
multiplayer_state->retranslateUi();
|
||||
}
|
||||
|
||||
void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
|
||||
if (state) {
|
||||
discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(system);
|
||||
} else {
|
||||
discord_rpc = std::make_unique<DiscordRPC::NullImpl>();
|
||||
}
|
||||
#else
|
||||
discord_rpc = std::make_unique<DiscordRPC::NullImpl>();
|
||||
#endif
|
||||
discord_rpc->Update();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __unix__
|
||||
void GMainWindow::SetGamemodeEnabled(bool state) {
|
||||
|
||||
@ -66,9 +66,11 @@ namespace Camera {
|
||||
class QtMultimediaCameraHandlerFactory;
|
||||
}
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
namespace DiscordRPC {
|
||||
class DiscordInterface;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace PlayTime {
|
||||
class PlayTimeManager;
|
||||
@ -107,7 +109,9 @@ public:
|
||||
|
||||
GameList* game_list;
|
||||
std::unique_ptr<PlayTime::PlayTimeManager> play_time_manager;
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc;
|
||||
#endif
|
||||
|
||||
bool DropAction(QDropEvent* event);
|
||||
void AcceptDropEvent(QDropEvent* event);
|
||||
@ -168,7 +172,9 @@ private:
|
||||
void BootGame(const QString& filename);
|
||||
void ShutdownGame();
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
void SetDiscordEnabled(bool state);
|
||||
#endif
|
||||
void LoadAmiibo(const QString& filename);
|
||||
|
||||
/**
|
||||
@ -306,7 +312,9 @@ private slots:
|
||||
#endif
|
||||
void OnSwitchDiskResources(VideoCore::LoadCallbackStage stage, std::size_t value,
|
||||
std::size_t total);
|
||||
#ifdef ENABLE_DEVELOPER_OPTIONS
|
||||
void StartLaunchStressTest(const QString& game_path);
|
||||
#endif
|
||||
|
||||
private:
|
||||
Q_INVOKABLE void OnMoviePlaybackCompleted();
|
||||
@ -436,8 +444,8 @@ private:
|
||||
|
||||
std::shared_ptr<Camera::QtMultimediaCameraHandlerFactory> qt_cameras;
|
||||
|
||||
// Prompt shown when update check succeeds
|
||||
#ifdef ENABLE_QT_UPDATE_CHECKER
|
||||
// Prompt shown when update check succeeds
|
||||
QFuture<QString> update_future;
|
||||
QFutureWatcher<QString> update_watcher;
|
||||
#endif
|
||||
|
||||
@ -566,8 +566,12 @@ void QtConfig::ReadMiscellaneousValues() {
|
||||
|
||||
ReadBasicSetting(Settings::values.log_filter);
|
||||
ReadBasicSetting(Settings::values.log_regex_filter);
|
||||
#ifdef __unix__
|
||||
ReadBasicSetting(Settings::values.enable_gamemode);
|
||||
#endif
|
||||
#ifdef ENABLE_QT_UPDATE_CHECKER
|
||||
ReadBasicSetting(UISettings::values.check_for_update_on_start);
|
||||
#endif
|
||||
|
||||
qt_config->endGroup();
|
||||
}
|
||||
@ -810,7 +814,9 @@ void QtConfig::ReadUIValues() {
|
||||
UISettings::values.theme =
|
||||
ReadSetting(QStringLiteral("theme"), QString::fromUtf8(UISettings::themes[0].second))
|
||||
.toString();
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
ReadBasicSetting(UISettings::values.enable_discord_presence);
|
||||
#endif
|
||||
ReadBasicSetting(UISettings::values.screenshot_resolution_factor);
|
||||
|
||||
ReadUILayoutValues();
|
||||
@ -1137,9 +1143,12 @@ void QtConfig::SaveMiscellaneousValues() {
|
||||
|
||||
WriteBasicSetting(Settings::values.log_filter);
|
||||
WriteBasicSetting(Settings::values.log_regex_filter);
|
||||
#ifdef __unix__
|
||||
WriteBasicSetting(Settings::values.enable_gamemode);
|
||||
#endif
|
||||
#ifdef ENABLE_QT_UPDATE_CHECKER
|
||||
WriteBasicSetting(UISettings::values.check_for_update_on_start);
|
||||
|
||||
#endif
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
||||
@ -1328,7 +1337,9 @@ void QtConfig::SaveUIValues() {
|
||||
if (global) {
|
||||
WriteSetting(QStringLiteral("theme"), UISettings::values.theme,
|
||||
QString::fromUtf8(UISettings::themes[0].second));
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
WriteBasicSetting(UISettings::values.enable_discord_presence);
|
||||
#endif
|
||||
WriteBasicSetting(UISettings::values.screenshot_resolution_factor);
|
||||
|
||||
SaveUILayoutValues();
|
||||
|
||||
@ -90,8 +90,10 @@ void ConfigureGeneral::SetConfiguration() {
|
||||
ui->toggle_background_mute->setChecked(
|
||||
UISettings::values.mute_when_in_background.GetValue());
|
||||
ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue());
|
||||
#ifdef ENABLE_QT_UPDATE_CHECKER
|
||||
ui->toggle_update_checker->setChecked(
|
||||
UISettings::values.check_for_update_on_start.GetValue());
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
ui->toggle_gamemode->setChecked(Settings::values.enable_gamemode.GetValue());
|
||||
#endif
|
||||
@ -178,7 +180,9 @@ void ConfigureGeneral::ApplyConfiguration() {
|
||||
UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked();
|
||||
UISettings::values.mute_when_in_background = ui->toggle_background_mute->isChecked();
|
||||
UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked();
|
||||
#ifdef ENABLE_QT_UPDATE_CHECKER
|
||||
UISettings::values.check_for_update_on_start = ui->toggle_update_checker->isChecked();
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
Settings::values.enable_gamemode = ui->toggle_gamemode->isChecked();
|
||||
#endif
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Copyright 2017 Citra Emulator Project
|
||||
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
@ -23,12 +23,15 @@ ConfigureWeb::ConfigureWeb(QWidget* parent)
|
||||
ConfigureWeb::~ConfigureWeb() = default;
|
||||
|
||||
void ConfigureWeb::SetConfiguration() {
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
ui->toggle_discordrpc->setChecked(UISettings::values.enable_discord_presence.GetValue());
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConfigureWeb::ApplyConfiguration() {
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
UISettings::values.enable_discord_presence = ui->toggle_discordrpc->isChecked();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConfigureWeb::RetranslateUI() {
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
// Copyright 2017 Citra Emulator Project
|
||||
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <QFutureWatcher>
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
|
||||
@ -107,7 +107,9 @@ signals:
|
||||
void AddDirectory();
|
||||
void ShowList(bool show);
|
||||
void PopulatingCompleted();
|
||||
#ifdef ENABLE_DEVELOPER_OPTIONS
|
||||
void StartingLaunchStressTest(const QString& game_path);
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void OnItemExpanded(const QModelIndex& item);
|
||||
|
||||
@ -83,12 +83,16 @@ struct Values {
|
||||
Settings::Setting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
|
||||
Settings::Setting<bool> mute_when_in_background{false, "muteWhenInBackground"};
|
||||
Settings::Setting<bool> hide_mouse{false, "hideInactiveMouse"};
|
||||
#ifdef ENABLE_QT_UPDATE_CHECKER
|
||||
Settings::Setting<bool> check_for_update_on_start{true, "check_for_update_on_start"};
|
||||
#endif
|
||||
|
||||
Settings::Setting<std::string> inserted_cartridge{"", "inserted_cartridge"};
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
// Discord RPC
|
||||
Settings::Setting<bool> enable_discord_presence{true, "enable_discord_presence"};
|
||||
#endif
|
||||
|
||||
// Game List
|
||||
Settings::Setting<GameListIconSize> game_list_icon_size{GameListIconSize::LargeIcon,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user