Gui: Adding Pause button working, full screen button and labels to buttons on main window gui (#2634)

* Adding names to gui buttoms and adjusting spacing.

* moving refresh button to last slot.

* Changing the implementation to tooltips for hover over them - qstring to detect background color.

* Fixing some themes with inverted tooltip base

* Suggestions / Fixes - Pause and FullScreen Buttons

* Update REUSE.toml

* cleaning up

* Icons stuff

* clang

* Buttons toggle - Cleaning code - Fixing Icons

* cleaning boolean

* Toggle pause and play icons and label to "Resume" when paused.

* Simplifying the toggles.

* New icons and final Push to review

* Reuse

* Icon rename, adding f9 press for pause game when no gui is on without needed of debug menu

* clang + reuse

* clang dosent work on this part

* again Clang

* Last fix for review. Light theme white resume icon fix.

* Proper fix for Resume icon

* New Rebase

* Fixed Orientation with docking issues and cleaning boxlayout code

* Adding spacer to separate actions, sizeslider on top of search bar. And adding margins

* Fixed Background not showing on OLED Theme

* Fixing check marks

* Adding all Daniel Suggestions and fixed F9 not working with debug menu open.

* Clang

* reverting all OLED theme changes

* Final suggestions
This commit is contained in:
Dmugetsu 2025-03-26 15:50:52 -06:00 committed by GitHub
parent 5caab76a45
commit ae2c9a745e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 324 additions and 91 deletions

View file

@ -49,8 +49,10 @@ path = [
"src/images/pause_icon.png", "src/images/pause_icon.png",
"src/images/play_icon.png", "src/images/play_icon.png",
"src/images/ps4_controller.png", "src/images/ps4_controller.png",
"src/images/refresh_icon.png", "src/images/restart_game_icon.png",
"src/images/refreshlist_icon.png",
"src/images/settings_icon.png", "src/images/settings_icon.png",
"src/images/fullscreen_icon.png",
"src/images/stop_icon.png", "src/images/stop_icon.png",
"src/images/utils_icon.png", "src/images/utils_icon.png",
"src/images/shadPS4.icns", "src/images/shadPS4.icns",

View file

@ -107,6 +107,7 @@ static bool showBackgroundImage = true;
static bool isFullscreen = false; static bool isFullscreen = false;
static std::string fullscreenMode = "Windowed"; static std::string fullscreenMode = "Windowed";
static bool isHDRAllowed = false; static bool isHDRAllowed = false;
static bool showLabelsUnderIcons = true;
// Language // Language
u32 m_language = 1; // english u32 m_language = 1; // english
@ -176,6 +177,14 @@ bool getIsFullscreen() {
return isFullscreen; return isFullscreen;
} }
bool getShowLabelsUnderIcons() {
return showLabelsUnderIcons;
}
bool setShowLabelsUnderIcons() {
return false;
}
std::string getFullscreenMode() { std::string getFullscreenMode() {
return fullscreenMode; return fullscreenMode;
} }
@ -427,6 +436,9 @@ void setVblankDiv(u32 value) {
void setIsFullscreen(bool enable) { void setIsFullscreen(bool enable) {
isFullscreen = enable; isFullscreen = enable;
} }
static void setShowLabelsUnderIcons(bool enable) {
showLabelsUnderIcons = enable;
}
void setFullscreenMode(std::string mode) { void setFullscreenMode(std::string mode) {
fullscreenMode = mode; fullscreenMode = mode;

View file

@ -26,6 +26,8 @@ bool GetLoadGameSizeEnabled();
std::filesystem::path GetSaveDataPath(); std::filesystem::path GetSaveDataPath();
void setLoadGameSizeEnabled(bool enable); void setLoadGameSizeEnabled(bool enable);
bool getIsFullscreen(); bool getIsFullscreen();
bool getShowLabelsUnderIcons();
bool setShowLabelsUnderIcons();
std::string getFullscreenMode(); std::string getFullscreenMode();
bool isNeoModeConsole(); bool isNeoModeConsole();
bool isDevKitConsole(); bool isDevKitConsole();

View file

@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "SDL3/SDL_log.h"
#include "layer.h" #include "layer.h"
#include <imgui.h> #include <imgui.h>
@ -117,22 +118,6 @@ void L::DrawMenuBar() {
EndMainMenuBar(); EndMainMenuBar();
} }
if (IsKeyPressed(ImGuiKey_F9, false)) {
if (io.KeyCtrl && io.KeyAlt) {
if (!DebugState.ShouldPauseInSubmit()) {
DebugState.RequestFrameDump(dump_frame_count);
}
}
if (!io.KeyCtrl && !io.KeyAlt) {
if (isSystemPaused) {
DebugState.ResumeGuestThreads();
} else {
DebugState.PauseGuestThreads();
}
}
}
if (open_popup_options) { if (open_popup_options) {
OpenPopup("GPU Tools Options"); OpenPopup("GPU Tools Options");
just_opened_options = true; just_opened_options = true;
@ -381,6 +366,32 @@ void L::Draw() {
visibility_toggled = true; visibility_toggled = true;
} }
if (IsKeyPressed(ImGuiKey_F9, false)) {
if (io.KeyCtrl && io.KeyAlt) {
if (!DebugState.ShouldPauseInSubmit()) {
DebugState.RequestFrameDump(dump_frame_count);
}
} else {
if (DebugState.IsGuestThreadsPaused()) {
DebugState.ResumeGuestThreads();
SDL_Log("Game resumed from Keyboard");
show_pause_status = false;
} else {
DebugState.PauseGuestThreads();
SDL_Log("Game paused from Keyboard");
show_pause_status = true;
}
visibility_toggled = true;
}
}
if (show_pause_status) {
ImVec2 pos = ImVec2(10, 10);
ImU32 color = IM_COL32(255, 255, 255, 255);
ImGui::GetForegroundDrawList()->AddText(pos, color, "Game Paused Press F9 to Resume");
}
if (show_simple_fps) { if (show_simple_fps) {
if (Begin("Video Info", nullptr, if (Begin("Video Info", nullptr,
ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration |

View file

@ -19,6 +19,7 @@ public:
static void SetupSettings(); static void SetupSettings();
void Draw() override; void Draw() override;
bool show_pause_status = false;
}; };
} // namespace Core::Devtools } // namespace Core::Devtools

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 965 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 658 B

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "SDL3/SDL_events.h"
#include <QDockWidget> #include <QDockWidget>
#include <QKeyEvent> #include <QKeyEvent>
#include <QPlainTextEdit> #include <QPlainTextEdit>
@ -132,23 +134,160 @@ void MainWindow::CreateActions() {
m_theme_act_group->addAction(ui->setThemeOled); m_theme_act_group->addAction(ui->setThemeOled);
} }
void MainWindow::PauseGame() {
SDL_Event event;
SDL_memset(&event, 0, sizeof(event));
event.type = SDL_EVENT_TOGGLE_PAUSE;
is_paused = !is_paused;
UpdateToolbarButtons();
SDL_PushEvent(&event);
}
void MainWindow::toggleLabelsUnderIcons() {
bool showLabels = ui->toggleLabelsAct->isChecked();
Config::setShowLabelsUnderIcons();
UpdateToolbarLabels();
if (isGameRunning) {
UpdateToolbarButtons();
}
}
void MainWindow::toggleFullscreen() {
SDL_Event event;
SDL_memset(&event, 0, sizeof(event));
event.type = SDL_EVENT_TOGGLE_FULLSCREEN;
SDL_PushEvent(&event);
}
QWidget* MainWindow::createButtonWithLabel(QPushButton* button, const QString& labelText,
bool showLabel) {
QWidget* container = new QWidget(this);
QVBoxLayout* layout = new QVBoxLayout(container);
layout->setAlignment(Qt::AlignCenter | Qt::AlignBottom);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(button);
QLabel* label = nullptr;
if (showLabel && ui->toggleLabelsAct->isChecked()) {
label = new QLabel(labelText, this);
label->setAlignment(Qt::AlignCenter | Qt::AlignBottom);
layout->addWidget(label);
button->setToolTip("");
} else {
button->setToolTip(labelText);
}
container->setLayout(layout);
container->setProperty("buttonLabel", QVariant::fromValue(label));
return container;
}
QWidget* createSpacer(QWidget* parent) {
QWidget* spacer = new QWidget(parent);
spacer->setFixedWidth(15);
spacer->setFixedHeight(15);
return spacer;
}
void MainWindow::AddUiWidgets() { void MainWindow::AddUiWidgets() {
// add toolbar widgets // add toolbar widgets
QApplication::setStyle("Fusion"); QApplication::setStyle("Fusion");
ui->toolBar->setObjectName("mw_toolbar");
ui->toolBar->addWidget(ui->playButton); bool showLabels = ui->toggleLabelsAct->isChecked();
ui->toolBar->addWidget(ui->pauseButton); ui->toolBar->clear();
ui->toolBar->addWidget(ui->stopButton);
ui->toolBar->addWidget(ui->refreshButton); ui->toolBar->addWidget(createSpacer(this));
ui->toolBar->addWidget(ui->settingsButton); ui->toolBar->addWidget(createButtonWithLabel(ui->playButton, tr("Play"), showLabels));
ui->toolBar->addWidget(ui->controllerButton); ui->toolBar->addWidget(createButtonWithLabel(ui->pauseButton, tr("Pause"), showLabels));
ui->toolBar->addWidget(ui->keyboardButton); ui->toolBar->addWidget(createButtonWithLabel(ui->stopButton, tr("Stop"), showLabels));
ui->toolBar->addWidget(createButtonWithLabel(ui->restartButton, tr("Restart"), showLabels));
ui->toolBar->addWidget(createSpacer(this));
ui->toolBar->addWidget(createButtonWithLabel(ui->settingsButton, tr("Settings"), showLabels));
ui->toolBar->addWidget(
createButtonWithLabel(ui->fullscreenButton, tr("Full Screen"), showLabels));
ui->toolBar->addWidget(createSpacer(this));
ui->toolBar->addWidget(
createButtonWithLabel(ui->controllerButton, tr("Controllers"), showLabels));
ui->toolBar->addWidget(createButtonWithLabel(ui->keyboardButton, tr("Keyboard"), showLabels));
ui->toolBar->addWidget(createSpacer(this));
QFrame* line = new QFrame(this); QFrame* line = new QFrame(this);
line->setFrameShape(QFrame::StyledPanel); line->setFrameShape(QFrame::VLine);
line->setFrameShadow(QFrame::Sunken); line->setFrameShadow(QFrame::Sunken);
line->setMinimumWidth(2);
ui->toolBar->addWidget(line); ui->toolBar->addWidget(line);
ui->toolBar->addWidget(ui->sizeSliderContainer); ui->toolBar->addWidget(createSpacer(this));
ui->toolBar->addWidget(ui->mw_searchbar); if (showLabels) {
QLabel* pauseButtonLabel = ui->pauseButton->parentWidget()->findChild<QLabel*>();
if (pauseButtonLabel) {
pauseButtonLabel->setVisible(false);
}
}
ui->toolBar->addWidget(
createButtonWithLabel(ui->refreshButton, tr("Refresh List"), showLabels));
ui->toolBar->addWidget(createSpacer(this));
QBoxLayout* toolbarLayout = new QBoxLayout(QBoxLayout::TopToBottom);
toolbarLayout->setSpacing(2);
toolbarLayout->setContentsMargins(2, 2, 2, 2);
ui->sizeSliderContainer->setFixedWidth(150);
QWidget* searchSliderContainer = new QWidget(this);
QBoxLayout* searchSliderLayout = new QBoxLayout(QBoxLayout::TopToBottom);
searchSliderLayout->setContentsMargins(0, 0, 6, 6);
searchSliderLayout->setSpacing(2);
ui->mw_searchbar->setFixedWidth(150);
searchSliderLayout->addWidget(ui->sizeSliderContainer);
searchSliderLayout->addWidget(ui->mw_searchbar);
searchSliderContainer->setLayout(searchSliderLayout);
ui->toolBar->addWidget(searchSliderContainer);
if (!showLabels) {
toolbarLayout->addWidget(searchSliderContainer);
}
ui->playButton->setVisible(true);
ui->pauseButton->setVisible(false);
}
void MainWindow::UpdateToolbarButtons() {
// add toolbar widgets when game is running
bool showLabels = ui->toggleLabelsAct->isChecked();
ui->playButton->setVisible(false);
ui->pauseButton->setVisible(true);
if (showLabels) {
QLabel* playButtonLabel = ui->playButton->parentWidget()->findChild<QLabel*>();
if (playButtonLabel)
playButtonLabel->setVisible(false);
}
if (is_paused) {
ui->pauseButton->setIcon(ui->playButton->icon());
ui->pauseButton->setToolTip(tr("Resume"));
} else {
if (isIconBlack) {
ui->pauseButton->setIcon(QIcon(":images/pause_icon.png"));
} else {
ui->pauseButton->setIcon(RecolorIcon(QIcon(":images/pause_icon.png"), isWhite));
}
ui->pauseButton->setToolTip(tr("Pause"));
}
if (showLabels) {
QLabel* pauseButtonLabel = ui->pauseButton->parentWidget()->findChild<QLabel*>();
if (pauseButtonLabel) {
pauseButtonLabel->setText(is_paused ? tr("Resume") : tr("Pause"));
pauseButtonLabel->setVisible(true);
}
}
}
void MainWindow::UpdateToolbarLabels() {
AddUiWidgets();
} }
void MainWindow::CreateDockWindows() { void MainWindow::CreateDockWindows() {
@ -253,6 +392,8 @@ void MainWindow::CreateConnects() {
connect(ui->refreshButton, &QPushButton::clicked, this, &MainWindow::RefreshGameTable); connect(ui->refreshButton, &QPushButton::clicked, this, &MainWindow::RefreshGameTable);
connect(ui->showGameListAct, &QAction::triggered, this, &MainWindow::ShowGameList); connect(ui->showGameListAct, &QAction::triggered, this, &MainWindow::ShowGameList);
connect(this, &MainWindow::ExtractionFinished, this, &MainWindow::RefreshGameTable); connect(this, &MainWindow::ExtractionFinished, this, &MainWindow::RefreshGameTable);
connect(ui->toggleLabelsAct, &QAction::toggled, this, &MainWindow::toggleLabelsUnderIcons);
connect(ui->fullscreenButton, &QPushButton::clicked, this, &MainWindow::toggleFullscreen);
connect(ui->sizeSlider, &QSlider::valueChanged, this, [this](int value) { connect(ui->sizeSlider, &QSlider::valueChanged, this, [this](int value) {
if (isTableList) { if (isTableList) {
@ -276,6 +417,7 @@ void MainWindow::CreateConnects() {
}); });
connect(ui->playButton, &QPushButton::clicked, this, &MainWindow::StartGame); connect(ui->playButton, &QPushButton::clicked, this, &MainWindow::StartGame);
connect(ui->pauseButton, &QPushButton::clicked, this, &MainWindow::PauseGame);
connect(m_game_grid_frame.get(), &QTableWidget::cellDoubleClicked, this, connect(m_game_grid_frame.get(), &QTableWidget::cellDoubleClicked, this,
&MainWindow::StartGame); &MainWindow::StartGame);
connect(m_game_list_frame.get(), &QTableWidget::cellDoubleClicked, this, connect(m_game_list_frame.get(), &QTableWidget::cellDoubleClicked, this,
@ -743,6 +885,8 @@ void MainWindow::StartGame() {
return; return;
} }
StartEmulator(path); StartEmulator(path);
UpdateToolbarButtons();
} }
} }
@ -1217,7 +1361,9 @@ void MainWindow::SetUiIcons(bool isWhite) {
ui->pauseButton->setIcon(RecolorIcon(ui->pauseButton->icon(), isWhite)); ui->pauseButton->setIcon(RecolorIcon(ui->pauseButton->icon(), isWhite));
ui->stopButton->setIcon(RecolorIcon(ui->stopButton->icon(), isWhite)); ui->stopButton->setIcon(RecolorIcon(ui->stopButton->icon(), isWhite));
ui->refreshButton->setIcon(RecolorIcon(ui->refreshButton->icon(), isWhite)); ui->refreshButton->setIcon(RecolorIcon(ui->refreshButton->icon(), isWhite));
ui->restartButton->setIcon(RecolorIcon(ui->restartButton->icon(), isWhite));
ui->settingsButton->setIcon(RecolorIcon(ui->settingsButton->icon(), isWhite)); ui->settingsButton->setIcon(RecolorIcon(ui->settingsButton->icon(), isWhite));
ui->fullscreenButton->setIcon(RecolorIcon(ui->fullscreenButton->icon(), isWhite));
ui->controllerButton->setIcon(RecolorIcon(ui->controllerButton->icon(), isWhite)); ui->controllerButton->setIcon(RecolorIcon(ui->controllerButton->icon(), isWhite));
ui->keyboardButton->setIcon(RecolorIcon(ui->keyboardButton->icon(), isWhite)); ui->keyboardButton->setIcon(RecolorIcon(ui->keyboardButton->icon(), isWhite));
ui->refreshGameListAct->setIcon(RecolorIcon(ui->refreshGameListAct->icon(), isWhite)); ui->refreshGameListAct->setIcon(RecolorIcon(ui->refreshGameListAct->icon(), isWhite));

View file

@ -5,6 +5,7 @@
#include <QActionGroup> #include <QActionGroup>
#include <QDragEnterEvent> #include <QDragEnterEvent>
#include <QProcess>
#include <QTranslator> #include <QTranslator>
#include "background_music_player.h" #include "background_music_player.h"
@ -38,6 +39,8 @@ public:
void InstallDragDropPkg(std::filesystem::path file, int pkgNum, int nPkg); void InstallDragDropPkg(std::filesystem::path file, int pkgNum, int nPkg);
void InstallDirectory(); void InstallDirectory();
void StartGame(); void StartGame();
void PauseGame();
bool showLabels;
private Q_SLOTS: private Q_SLOTS:
void ConfigureGuiFromSettings(); void ConfigureGuiFromSettings();
@ -47,15 +50,21 @@ private Q_SLOTS:
void RefreshGameTable(); void RefreshGameTable();
void HandleResize(QResizeEvent* event); void HandleResize(QResizeEvent* event);
void OnLanguageChanged(const std::string& locale); void OnLanguageChanged(const std::string& locale);
void toggleLabelsUnderIcons();
private: private:
Ui_MainWindow* ui; Ui_MainWindow* ui;
void AddUiWidgets(); void AddUiWidgets();
void UpdateToolbarLabels();
void UpdateToolbarButtons();
QWidget* createButtonWithLabel(QPushButton* button, const QString& labelText, bool showLabel);
void CreateActions(); void CreateActions();
void toggleFullscreen();
void CreateRecentGameActions(); void CreateRecentGameActions();
void CreateDockWindows(); void CreateDockWindows();
void GetPhysicalDevices(); void GetPhysicalDevices();
void LoadGameLists(); void LoadGameLists();
#ifdef ENABLE_UPDATER #ifdef ENABLE_UPDATER
void CheckUpdateMain(bool checkSave); void CheckUpdateMain(bool checkSave);
#endif #endif
@ -73,6 +82,9 @@ private:
bool isIconBlack = false; bool isIconBlack = false;
bool isTableList = true; bool isTableList = true;
bool isGameRunning = false; bool isGameRunning = false;
bool isWhite = false;
bool is_paused = false;
QActionGroup* m_icon_size_act_group = nullptr; QActionGroup* m_icon_size_act_group = nullptr;
QActionGroup* m_list_mode_act_group = nullptr; QActionGroup* m_list_mode_act_group = nullptr;
QActionGroup* m_theme_act_group = nullptr; QActionGroup* m_theme_act_group = nullptr;

View file

@ -19,7 +19,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, Qt::white); themePalette.setColor(QPalette::WindowText, Qt::white);
themePalette.setColor(QPalette::Base, QColor(20, 20, 20)); themePalette.setColor(QPalette::Base, QColor(20, 20, 20));
themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53)); themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
themePalette.setColor(QPalette::ToolTipBase, Qt::white); themePalette.setColor(QPalette::ToolTipBase, QColor(20, 20, 20));
themePalette.setColor(QPalette::ToolTipText, Qt::white); themePalette.setColor(QPalette::ToolTipText, Qt::white);
themePalette.setColor(QPalette::Text, Qt::white); themePalette.setColor(QPalette::Text, Qt::white);
themePalette.setColor(QPalette::Button, QColor(53, 53, 53)); themePalette.setColor(QPalette::Button, QColor(53, 53, 53));
@ -37,18 +37,18 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
"border-radius: 4px; padding: 5px; }" "border-radius: 4px; padding: 5px; }"
"QLineEdit:focus {" "QLineEdit:focus {"
"border: 1px solid #2A82DA; }"); "border: 1px solid #2A82DA; }");
themePalette.setColor(QPalette::Window, QColor(240, 240, 240)); // Light gray themePalette.setColor(QPalette::Window, QColor(240, 240, 240)); // Light gray
themePalette.setColor(QPalette::WindowText, Qt::black); // Black themePalette.setColor(QPalette::WindowText, Qt::black); // Black
themePalette.setColor(QPalette::Base, QColor(230, 230, 230, 80)); // Grayish themePalette.setColor(QPalette::Base, QColor(230, 230, 230, 80)); // Grayish
themePalette.setColor(QPalette::ToolTipBase, Qt::black); // Black themePalette.setColor(QPalette::ToolTipBase, QColor(230, 230, 230, 80)); // Grayish
themePalette.setColor(QPalette::ToolTipText, Qt::black); // Black themePalette.setColor(QPalette::ToolTipText, Qt::black); // Black
themePalette.setColor(QPalette::Text, Qt::black); // Black themePalette.setColor(QPalette::Text, Qt::black); // Black
themePalette.setColor(QPalette::Button, QColor(240, 240, 240)); // Light gray themePalette.setColor(QPalette::Button, QColor(240, 240, 240)); // Light gray
themePalette.setColor(QPalette::ButtonText, Qt::black); // Black themePalette.setColor(QPalette::ButtonText, Qt::black); // Black
themePalette.setColor(QPalette::BrightText, Qt::red); // Red themePalette.setColor(QPalette::BrightText, Qt::red); // Red
themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::HighlightedText, Qt::white); // White themePalette.setColor(QPalette::HighlightedText, Qt::white); // White
qApp->setPalette(themePalette); qApp->setPalette(themePalette);
break; break;
case Theme::Green: case Theme::Green:
@ -62,8 +62,9 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, Qt::white); // White text themePalette.setColor(QPalette::WindowText, Qt::white); // White text
themePalette.setColor(QPalette::Base, QColor(25, 40, 25)); // Darker green base themePalette.setColor(QPalette::Base, QColor(25, 40, 25)); // Darker green base
themePalette.setColor(QPalette::AlternateBase, themePalette.setColor(QPalette::AlternateBase,
QColor(53, 69, 53)); // Dark green alternate base QColor(53, 69, 53)); // Dark green alternate base
themePalette.setColor(QPalette::ToolTipBase, Qt::white); // White tooltip background themePalette.setColor(QPalette::ToolTipBase,
QColor(25, 40, 25)); // White tooltip background
themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text
themePalette.setColor(QPalette::Text, Qt::white); // White text themePalette.setColor(QPalette::Text, Qt::white); // White text
themePalette.setColor(QPalette::Button, QColor(53, 69, 53)); // Dark green button themePalette.setColor(QPalette::Button, QColor(53, 69, 53)); // Dark green button
@ -85,8 +86,9 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, Qt::white); // White text themePalette.setColor(QPalette::WindowText, Qt::white); // White text
themePalette.setColor(QPalette::Base, QColor(20, 40, 60)); // Darker blue base themePalette.setColor(QPalette::Base, QColor(20, 40, 60)); // Darker blue base
themePalette.setColor(QPalette::AlternateBase, themePalette.setColor(QPalette::AlternateBase,
QColor(40, 60, 90)); // Dark blue alternate base QColor(40, 60, 90)); // Dark blue alternate base
themePalette.setColor(QPalette::ToolTipBase, Qt::white); // White tooltip background themePalette.setColor(QPalette::ToolTipBase,
QColor(20, 40, 60)); // White tooltip background
themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text
themePalette.setColor(QPalette::Text, Qt::white); // White text themePalette.setColor(QPalette::Text, Qt::white); // White text
themePalette.setColor(QPalette::Button, QColor(40, 60, 90)); // Dark blue button themePalette.setColor(QPalette::Button, QColor(40, 60, 90)); // Dark blue button
@ -109,8 +111,9 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, Qt::white); // White text themePalette.setColor(QPalette::WindowText, Qt::white); // White text
themePalette.setColor(QPalette::Base, QColor(80, 30, 90)); // Darker violet base themePalette.setColor(QPalette::Base, QColor(80, 30, 90)); // Darker violet base
themePalette.setColor(QPalette::AlternateBase, themePalette.setColor(QPalette::AlternateBase,
QColor(100, 50, 120)); // Violet alternate base QColor(100, 50, 120)); // Violet alternate base
themePalette.setColor(QPalette::ToolTipBase, Qt::white); // White tooltip background themePalette.setColor(QPalette::ToolTipBase,
QColor(80, 30, 90)); // White tooltip background
themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text
themePalette.setColor(QPalette::Text, Qt::white); // White text themePalette.setColor(QPalette::Text, Qt::white); // White text
themePalette.setColor(QPalette::Button, QColor(100, 50, 120)); // Violet button themePalette.setColor(QPalette::Button, QColor(100, 50, 120)); // Violet button
@ -133,7 +136,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, QColor(249, 245, 215)); themePalette.setColor(QPalette::WindowText, QColor(249, 245, 215));
themePalette.setColor(QPalette::Base, QColor(29, 32, 33)); themePalette.setColor(QPalette::Base, QColor(29, 32, 33));
themePalette.setColor(QPalette::AlternateBase, QColor(50, 48, 47)); themePalette.setColor(QPalette::AlternateBase, QColor(50, 48, 47));
themePalette.setColor(QPalette::ToolTipBase, QColor(249, 245, 215)); themePalette.setColor(QPalette::ToolTipBase, QColor(29, 32, 33));
themePalette.setColor(QPalette::ToolTipText, QColor(249, 245, 215)); themePalette.setColor(QPalette::ToolTipText, QColor(249, 245, 215));
themePalette.setColor(QPalette::Text, QColor(249, 245, 215)); themePalette.setColor(QPalette::Text, QColor(249, 245, 215));
themePalette.setColor(QPalette::Button, QColor(40, 40, 40)); themePalette.setColor(QPalette::Button, QColor(40, 40, 40));
@ -155,7 +158,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, QColor(192, 202, 245)); themePalette.setColor(QPalette::WindowText, QColor(192, 202, 245));
themePalette.setColor(QPalette::Base, QColor(25, 28, 39)); themePalette.setColor(QPalette::Base, QColor(25, 28, 39));
themePalette.setColor(QPalette::AlternateBase, QColor(36, 40, 59)); themePalette.setColor(QPalette::AlternateBase, QColor(36, 40, 59));
themePalette.setColor(QPalette::ToolTipBase, QColor(192, 202, 245)); themePalette.setColor(QPalette::ToolTipBase, QColor(25, 28, 39));
themePalette.setColor(QPalette::ToolTipText, QColor(192, 202, 245)); themePalette.setColor(QPalette::ToolTipText, QColor(192, 202, 245));
themePalette.setColor(QPalette::Text, QColor(192, 202, 245)); themePalette.setColor(QPalette::Text, QColor(192, 202, 245));
themePalette.setColor(QPalette::Button, QColor(30, 30, 41)); themePalette.setColor(QPalette::Button, QColor(30, 30, 41));

View file

@ -20,6 +20,7 @@ public:
QAction* setIconSizeSmallAct; QAction* setIconSizeSmallAct;
QAction* setIconSizeMediumAct; QAction* setIconSizeMediumAct;
QAction* setIconSizeLargeAct; QAction* setIconSizeLargeAct;
QAction* toggleLabelsAct;
QAction* setlistModeListAct; QAction* setlistModeListAct;
QAction* setlistModeGridAct; QAction* setlistModeGridAct;
QAction* setlistElfAct; QAction* setlistElfAct;
@ -50,6 +51,8 @@ public:
QPushButton* settingsButton; QPushButton* settingsButton;
QPushButton* controllerButton; QPushButton* controllerButton;
QPushButton* keyboardButton; QPushButton* keyboardButton;
QPushButton* fullscreenButton;
QPushButton* restartButton;
QWidget* sizeSliderContainer; QWidget* sizeSliderContainer;
QHBoxLayout* sizeSliderContainer_layout; QHBoxLayout* sizeSliderContainer_layout;
@ -104,7 +107,15 @@ public:
showGameListAct->setCheckable(true); showGameListAct->setCheckable(true);
refreshGameListAct = new QAction(MainWindow); refreshGameListAct = new QAction(MainWindow);
refreshGameListAct->setObjectName("refreshGameListAct"); refreshGameListAct->setObjectName("refreshGameListAct");
refreshGameListAct->setIcon(QIcon(":images/refresh_icon.png")); refreshGameListAct->setIcon(QIcon(":images/refreshlist_icon.png"));
toggleLabelsAct = new QAction(MainWindow);
toggleLabelsAct->setObjectName("toggleLabelsAct");
toggleLabelsAct->setText(
QCoreApplication::translate("MainWindow", "Show Labels Under Icons"));
toggleLabelsAct->setCheckable(true);
toggleLabelsAct->setChecked(Config::getShowLabelsUnderIcons());
setIconSizeTinyAct = new QAction(MainWindow); setIconSizeTinyAct = new QAction(MainWindow);
setIconSizeTinyAct->setObjectName("setIconSizeTinyAct"); setIconSizeTinyAct->setObjectName("setIconSizeTinyAct");
setIconSizeTinyAct->setCheckable(true); setIconSizeTinyAct->setCheckable(true);
@ -210,20 +221,28 @@ public:
stopButton->setIconSize(QSize(40, 40)); stopButton->setIconSize(QSize(40, 40));
refreshButton = new QPushButton(centralWidget); refreshButton = new QPushButton(centralWidget);
refreshButton->setFlat(true); refreshButton->setFlat(true);
refreshButton->setIcon(QIcon(":images/refresh_icon.png")); refreshButton->setIcon(QIcon(":images/refreshlist_icon.png"));
refreshButton->setIconSize(QSize(32, 32)); refreshButton->setIconSize(QSize(40, 40));
fullscreenButton = new QPushButton(centralWidget);
fullscreenButton->setFlat(true);
fullscreenButton->setIcon(QIcon(":images/fullscreen_icon.png"));
fullscreenButton->setIconSize(QSize(38, 38));
settingsButton = new QPushButton(centralWidget); settingsButton = new QPushButton(centralWidget);
settingsButton->setFlat(true); settingsButton->setFlat(true);
settingsButton->setIcon(QIcon(":images/settings_icon.png")); settingsButton->setIcon(QIcon(":images/settings_icon.png"));
settingsButton->setIconSize(QSize(44, 44)); settingsButton->setIconSize(QSize(40, 40));
controllerButton = new QPushButton(centralWidget); controllerButton = new QPushButton(centralWidget);
controllerButton->setFlat(true); controllerButton->setFlat(true);
controllerButton->setIcon(QIcon(":images/controller_icon.png")); controllerButton->setIcon(QIcon(":images/controller_icon.png"));
controllerButton->setIconSize(QSize(40, 40)); controllerButton->setIconSize(QSize(55, 48));
keyboardButton = new QPushButton(centralWidget); keyboardButton = new QPushButton(centralWidget);
keyboardButton->setFlat(true); keyboardButton->setFlat(true);
keyboardButton->setIcon(QIcon(":images/keyboard_icon.png")); keyboardButton->setIcon(QIcon(":images/keyboard_icon.png"));
keyboardButton->setIconSize(QSize(48, 44)); keyboardButton->setIconSize(QSize(50, 50));
restartButton = new QPushButton(centralWidget);
restartButton->setFlat(true);
restartButton->setIcon(QIcon(":images/restart_game_icon.png"));
restartButton->setIconSize(QSize(40, 40));
sizeSliderContainer = new QWidget(centralWidget); sizeSliderContainer = new QWidget(centralWidget);
sizeSliderContainer->setObjectName("sizeSliderContainer"); sizeSliderContainer->setObjectName("sizeSliderContainer");
@ -304,6 +323,7 @@ public:
menuView->addAction(refreshGameListAct); menuView->addAction(refreshGameListAct);
menuView->addAction(menuGame_List_Mode->menuAction()); menuView->addAction(menuGame_List_Mode->menuAction());
menuView->addAction(menuGame_List_Icons->menuAction()); menuView->addAction(menuGame_List_Icons->menuAction());
menuView->addAction(toggleLabelsAct);
menuView->addAction(menuThemes->menuAction()); menuView->addAction(menuThemes->menuAction());
menuThemes->addAction(setThemeDark); menuThemes->addAction(setThemeDark);
menuThemes->addAction(setThemeLight); menuThemes->addAction(setThemeLight);

View file

@ -11,6 +11,7 @@
#include "common/config.h" #include "common/config.h"
#include "common/elf_info.h" #include "common/elf_info.h"
#include "common/version.h" #include "common/version.h"
#include "core/debug_state.h"
#include "core/libraries/kernel/time.h" #include "core/libraries/kernel/time.h"
#include "core/libraries/pad/pad.h" #include "core/libraries/pad/pad.h"
#include "imgui/renderer/imgui_core.h" #include "imgui/renderer/imgui_core.h"
@ -396,6 +397,25 @@ void WindowSDL::WaitEvent() {
case SDL_EVENT_QUIT: case SDL_EVENT_QUIT:
is_open = false; is_open = false;
break; break;
case SDL_EVENT_TOGGLE_FULLSCREEN: {
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) {
SDL_SetWindowFullscreen(window, 0);
} else {
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
}
break;
}
case SDL_EVENT_TOGGLE_PAUSE:
SDL_Log("Received SDL_EVENT_TOGGLE_PAUSE");
if (DebugState.IsGuestThreadsPaused()) {
SDL_Log("Game Resumed");
DebugState.ResumeGuestThreads();
} else {
SDL_Log("Game Paused");
DebugState.PauseGuestThreads();
}
break;
default: default:
break; break;
} }

View file

@ -7,6 +7,8 @@
#include "core/libraries/pad/pad.h" #include "core/libraries/pad/pad.h"
#include "input/controller.h" #include "input/controller.h"
#include "string" #include "string"
#define SDL_EVENT_TOGGLE_FULLSCREEN (SDL_EVENT_USER + 1)
#define SDL_EVENT_TOGGLE_PAUSE (SDL_EVENT_USER + 2)
struct SDL_Window; struct SDL_Window;
struct SDL_Gamepad; struct SDL_Gamepad;

View file

@ -1,38 +1,40 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>images/shadps4.ico</file> <file>images/shadps4.ico</file>
<file>images/about_icon.png</file> <file>images/about_icon.png</file>
<file>images/dump_icon.png</file> <file>images/dump_icon.png</file>
<file>images/play_icon.png</file> <file>images/play_icon.png</file>
<file>images/pause_icon.png</file> <file>images/pause_icon.png</file>
<file>images/stop_icon.png</file> <file>images/stop_icon.png</file>
<file>images/utils_icon.png</file> <file>images/utils_icon.png</file>
<file>images/file_icon.png</file> <file>images/file_icon.png</file>
<file>images/trophy_icon.png</file> <file>images/folder_icon.png</file>
<file>images/folder_icon.png</file> <file>images/themes_icon.png</file>
<file>images/themes_icon.png</file> <file>images/iconsize_icon.png</file>
<file>images/iconsize_icon.png</file> <file>images/list_icon.png</file>
<file>images/list_icon.png</file> <file>images/grid_icon.png</file>
<file>images/grid_icon.png</file> <file>images/exit_icon.png</file>
<file>images/exit_icon.png</file> <file>images/settings_icon.png</file>
<file>images/settings_icon.png</file> <file>images/controller_icon.png</file>
<file>images/controller_icon.png</file> <file>images/restart_game_icon.png</file>
<file>images/refresh_icon.png</file> <file>images/update_icon.png</file>
<file>images/update_icon.png</file> <file>images/list_mode_icon.png</file>
<file>images/list_mode_icon.png</file> <file>images/flag_jp.png</file>
<file>images/flag_jp.png</file> <file>images/flag_eu.png</file>
<file>images/flag_eu.png</file> <file>images/flag_unk.png</file>
<file>images/flag_unk.png</file> <file>images/flag_us.png</file>
<file>images/flag_us.png</file> <file>images/flag_world.png</file>
<file>images/flag_world.png</file> <file>images/flag_china.png</file>
<file>images/flag_china.png</file> <file>images/github.png</file>
<file>images/github.png</file> <file>images/discord.png</file>
<file>images/discord.png</file> <file>images/ko-fi.png</file>
<file>images/ko-fi.png</file> <file>images/youtube.png</file>
<file>images/youtube.png</file> <file>images/website.png</file>
<file>images/website.png</file> <file>images/ps4_controller.png</file>
<file>images/ps4_controller.png</file> <file>images/keyboard_icon.png</file>
<file>images/keyboard_icon.png</file> <file>images/KBM.png</file>
<file>images/KBM.png</file> <file>images/fullscreen_icon.png</file>
</qresource> <file>images/refreshlist_icon.png</file>
<file>images/trophy_icon.png</file>
</qresource>
</RCC> </RCC>