Merge some lime stuff

This commit is contained in:
OpenSauce 2024-07-26 04:14:26 +02:00 committed by Gamer64ytb
parent 24f0861d59
commit 813247fb55
5 changed files with 29 additions and 36 deletions

View File

@ -8,6 +8,8 @@ cmake_policy(SET CMP0069 NEW)
# Honor visibility properties for all targets
# Set the default so subdirectory cmake_minimum_required calls won't unset the policy.
cmake_policy(SET CMP0063 NEW)
# Allow conditions to be used in cmake_dependent_option
cmake_policy(SET CMP0127 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
@ -80,7 +82,7 @@ option(ENABLE_OPENAL "Enables the OpenAL audio backend" ON)
CMAKE_DEPENDENT_OPTION(ENABLE_LIBUSB "Enable libusb for GameCube Adapter support" ON "NOT IOS" OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_SOFTWARE_RENDERER "Enables the software renderer" ON "NOT ANDROID" OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_OPENGL "Enables the OpenGL renderer" ON "NOT APPLE" OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_OPENGL "Enables the OpenGL renderer" ON "NOT APPLE AND NOT (LINUX AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"aarch64\")" OFF)
option(ENABLE_VULKAN "Enables the Vulkan renderer" ON)
option(ENABLE_PROFILING "Enables integration with the Tracy profiler" ON)

View File

@ -601,7 +601,6 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QStr
QAction* uninstall_dlc = uninstall_menu->addAction(tr("DLC"));
QAction* remove_play_time_data = context_menu.addAction(tr("Remove Play Time Data"));
QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry"));
#if !defined(__APPLE__)
QMenu* shortcut_menu = context_menu.addMenu(tr("Create Shortcut"));
@ -672,9 +671,6 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QStr
uninstall_update->setEnabled(has_update);
uninstall_dlc->setEnabled(has_dlc);
auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
navigate_to_gamedb_entry->setVisible(it != compatibility_list.end());
connect(favorite, &QAction::triggered, [this, program_id]() { ToggleFavorite(program_id); });
connect(open_save_location, &QAction::triggered, this, [this, program_id] {
emit OpenFolderRequested(program_id, GameListOpenTarget::SAVE_DATA);
@ -724,9 +720,6 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QStr
[this, path, program_id] { emit DumpRomFSRequested(path, program_id); });
connect(remove_play_time_data, &QAction::triggered,
[this, program_id]() { emit RemovePlayTimeRequested(program_id); });
connect(navigate_to_gamedb_entry, &QAction::triggered, this, [this, program_id]() {
emit NavigateToGamedbEntryRequested(program_id, compatibility_list);
});
connect(properties, &QAction::triggered, this,
[this, path]() { emit OpenPerGameGeneralRequested(path); });
connect(open_shader_cache_location, &QAction::triggered, this, [this, program_id] {

View File

@ -100,8 +100,6 @@ signals:
void CreateShortcut(u64 program_id, const std::string& game_path,
GameListShortcutTarget target);
void RemovePlayTimeRequested(u64 program_id);
void NavigateToGamedbEntryRequested(u64 program_id,
const CompatibilityList& compatibility_list);
void OpenPerGameGeneralRequested(const QString file);
void DumpRomFSRequested(QString game_path, u64 program_id);
void OpenDirectory(const QString& directory);

View File

@ -355,6 +355,11 @@ void GMainWindow::InitializeWidgets() {
secondary_window->hide();
secondary_window->setParent(nullptr);
action_secondary_fullscreen = new QAction(secondary_window);
action_secondary_toggle_screen = new QAction(secondary_window);
action_secondary_swap_screen = new QAction(secondary_window);
action_secondary_rotate_screen = new QAction(secondary_window);
game_list = new GameList(*play_time_manager, this);
ui->horizontalLayout->addWidget(game_list);
@ -610,7 +615,7 @@ void GMainWindow::InitializeSaveStateMenuActions() {
UpdateSaveStates();
}
void GMainWindow::InitializeHotkeys() {
void GMainWindow::InitializeHotkeys() { // TODO: This code kind of sucks
hotkey_registry.LoadHotkeys();
const QString main_window = QStringLiteral("Main Window");
@ -653,28 +658,32 @@ void GMainWindow::InitializeHotkeys() {
link_action_shortcut(ui->action_Show_Room, QStringLiteral("Multiplayer Show Current Room"));
link_action_shortcut(ui->action_Leave_Room, QStringLiteral("Multiplayer Leave Room"));
const auto add_secondary_window_hotkey = [this](QKeySequence hotkey, const char* slot) {
const auto add_secondary_window_hotkey = [this](QAction* action, QKeySequence hotkey,
const char* slot) {
// This action will fire specifically when secondary_window is in focus
QAction* secondary_window_action = new QAction(secondary_window);
secondary_window_action->setShortcut(hotkey);
connect(secondary_window_action, SIGNAL(triggered()), this, slot);
secondary_window->addAction(secondary_window_action);
action->setShortcut(hotkey);
disconnect(action, SIGNAL(triggered()), this, slot);
connect(action, SIGNAL(triggered()), this, slot);
secondary_window->addAction(action);
};
// Use the same fullscreen hotkey as the main window
const auto fullscreen_hotkey = hotkey_registry.GetKeySequence(main_window, fullscreen);
add_secondary_window_hotkey(fullscreen_hotkey, SLOT(ToggleSecondaryFullscreen()));
add_secondary_window_hotkey(action_secondary_fullscreen, fullscreen_hotkey,
SLOT(ToggleSecondaryFullscreen()));
const auto toggle_screen_hotkey =
hotkey_registry.GetKeySequence(main_window, toggle_screen_layout);
add_secondary_window_hotkey(toggle_screen_hotkey, SLOT(ToggleScreenLayout()));
add_secondary_window_hotkey(action_secondary_toggle_screen, toggle_screen_hotkey,
SLOT(ToggleScreenLayout()));
const auto swap_screen_hotkey = hotkey_registry.GetKeySequence(main_window, swap_screens);
add_secondary_window_hotkey(swap_screen_hotkey, SLOT(TriggerSwapScreens()));
add_secondary_window_hotkey(action_secondary_swap_screen, swap_screen_hotkey,
SLOT(TriggerSwapScreens()));
const auto rotate_screen_hotkey = hotkey_registry.GetKeySequence(main_window, rotate_screens);
add_secondary_window_hotkey(rotate_screen_hotkey, SLOT(TriggerRotateScreens()));
add_secondary_window_hotkey(action_secondary_rotate_screen, rotate_screen_hotkey,
SLOT(TriggerRotateScreens()));
const auto connect_shortcut = [&](const QString& action_name, const auto& function) {
const auto* hotkey = hotkey_registry.GetHotkey(main_window, action_name, this);
@ -844,8 +853,6 @@ void GMainWindow::ConnectWidgetEvents() {
connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder);
connect(game_list, &GameList::RemovePlayTimeRequested, this,
&GMainWindow::OnGameListRemovePlayTimeData);
connect(game_list, &GameList::NavigateToGamedbEntryRequested, this,
&GMainWindow::OnGameListNavigateToGamedbEntry);
connect(game_list, &GameList::CreateShortcut, this, &GMainWindow::OnGameListCreateShortcut);
connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS);
connect(game_list, &GameList::AddDirectory, this, &GMainWindow::OnGameListAddDirectory);
@ -1706,17 +1713,6 @@ void GMainWindow::OnGameListRemovePlayTimeData(u64 program_id) {
game_list->PopulateAsync(UISettings::values.game_dirs);
}
void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
const CompatibilityList& compatibility_list) {
auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
QString directory;
if (it != compatibility_list.end())
directory = it->second.second;
QDesktopServices::openUrl(QUrl(QStringLiteral("https://citra-emu.org/game/") + directory));
}
bool GMainWindow::CreateShortcutLink(const std::filesystem::path& shortcut_path,
const std::string& comment,
const std::filesystem::path& icon_path,

View File

@ -231,8 +231,6 @@ private slots:
void OnGameListLoadFile(QString game_path);
void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target);
void OnGameListRemovePlayTimeData(u64 program_id);
void OnGameListNavigateToGamedbEntry(u64 program_id,
const CompatibilityList& compatibility_list);
void OnGameListCreateShortcut(u64 program_id, const std::string& game_path,
GameListShortcutTarget target);
void OnGameListDumpRomFS(QString game_path, u64 program_id);
@ -407,6 +405,12 @@ private:
u32 newest_slot;
u64 newest_slot_time;
// Secondary window actions
QAction* action_secondary_fullscreen;
QAction* action_secondary_toggle_screen;
QAction* action_secondary_swap_screen;
QAction* action_secondary_rotate_screen;
QTranslator translator;
// stores default icon theme search paths for the platform