Minor Qt GUI update (#363)

* Minor Qt GUI update

* Update gui_context_menus.h

* Update gui_context_menus.h

* Update game_info.cpp
This commit is contained in:
Xphalnos 2024-08-04 15:07:10 +02:00 committed by GitHub
parent 6d0a763145
commit 21462523de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 63 additions and 48 deletions

View File

@ -29,8 +29,10 @@ jobs:
uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
with: with:
version: 6.7.2 version: 6.7.2
host: windows
target: desktop
arch: win64_msvc2019_64 arch: win64_msvc2019_64
archives: qtsvg qtbase archives: qtbase
- name: Configure CMake - name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <QHeaderView> #include <QHeaderView>
#include "elf_viewer.h" #include "elf_viewer.h"
ElfViewer::ElfViewer(QWidget* parent) : QTableWidget(parent) { ElfViewer::ElfViewer(QWidget* parent) : QTableWidget(parent) {

View File

@ -14,6 +14,7 @@
#include <QTreeView> #include <QTreeView>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget> #include <QWidget>
#include "core/loader/elf.h" #include "core/loader/elf.h"
#include "game_list_frame.h" #include "game_list_frame.h"

View File

@ -14,6 +14,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget> #include <QWidget>
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#include "common/config.h" #include "common/config.h"
#include "game_info.h" #include "game_info.h"
#include "game_list_utils.h" #include "game_list_utils.h"

View File

@ -5,6 +5,7 @@
#include <thread> #include <thread>
#include <QProgressDialog> #include <QProgressDialog>
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#include "game_info.h" #include "game_info.h"
GameInfoClass::GameInfoClass() = default; GameInfoClass::GameInfoClass() = default;

View File

@ -7,6 +7,7 @@
#include <QObject> #include <QObject>
#include <QPixmap> #include <QPixmap>
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#include "common/config.h" #include "common/config.h"
#include "core/file_format/psf.h" #include "core/file_format/psf.h"
#include "game_list_utils.h" #include "game_list_utils.h"

View File

@ -1,8 +1,6 @@
// 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 "game_install_dialog.h"
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QDir> #include <QDir>
#include <QFileDialog> #include <QFileDialog>
@ -14,6 +12,8 @@
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "game_install_dialog.h"
GameInstallDialog::GameInstallDialog() : m_gamesDirectory(nullptr) { GameInstallDialog::GameInstallDialog() : m_gamesDirectory(nullptr) {
auto layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
@ -21,8 +21,8 @@ GameInstallDialog::GameInstallDialog() : m_gamesDirectory(nullptr) {
layout->addStretch(); layout->addStretch();
layout->addWidget(SetupDialogActions()); layout->addWidget(SetupDialogActions());
setWindowTitle("Shadps4 - Choose directory"); setWindowTitle("shadPS4 - Choose directory");
setWindowIcon(QIcon(":/images/shadps4.ico")); setWindowIcon(QIcon(":images/shadps4.ico"));
} }
GameInstallDialog::~GameInstallDialog() {} GameInstallDialog::~GameInstallDialog() {}
@ -47,7 +47,7 @@ QWidget* GameInstallDialog::SetupGamesDirectory() {
layout->addWidget(m_gamesDirectory); layout->addWidget(m_gamesDirectory);
// Browse button. // Browse button.
auto browse = new QPushButton("..."); auto browse = new QPushButton("Browse");
connect(browse, &QPushButton::clicked, this, &GameInstallDialog::Browse); connect(browse, &QPushButton::clicked, this, &GameInstallDialog::Browse);

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <QDialog> #include <QDialog>
#include "common/config.h" #include "common/config.h"
#include "common/path_util.h" #include "common/path_util.h"

View File

@ -190,17 +190,17 @@ void GameListFrame::SetRegionFlag(int row, int column, QString itemStr) {
QTableWidgetItem* item = new QTableWidgetItem(); QTableWidgetItem* item = new QTableWidgetItem();
QImage scaledPixmap; QImage scaledPixmap;
if (itemStr == "Japan") { if (itemStr == "Japan") {
scaledPixmap = QImage(":/images/flag_jp.png"); scaledPixmap = QImage(":images/flag_jp.png");
} else if (itemStr == "Europe") { } else if (itemStr == "Europe") {
scaledPixmap = QImage(":/images/flag_eu.png"); scaledPixmap = QImage(":images/flag_eu.png");
} else if (itemStr == "USA") { } else if (itemStr == "USA") {
scaledPixmap = QImage(":/images/flag_us.png"); scaledPixmap = QImage(":images/flag_us.png");
} else if (itemStr == "Asia") { } else if (itemStr == "Asia") {
scaledPixmap = QImage(":/images/flag_china.png"); scaledPixmap = QImage(":images/flag_china.png");
} else if (itemStr == "World") { } else if (itemStr == "World") {
scaledPixmap = QImage(":/images/flag_world.png"); scaledPixmap = QImage(":images/flag_world.png");
} else { } else {
scaledPixmap = QImage(":/images/flag_unk.png"); scaledPixmap = QImage(":images/flag_unk.png");
} }
QWidget* widget = new QWidget(this); QWidget* widget = new QWidget(this);
QVBoxLayout* layout = new QVBoxLayout(widget); QVBoxLayout* layout = new QVBoxLayout(widget);

View File

@ -16,6 +16,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget> #include <QWidget>
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#include "game_info.h" #include "game_info.h"
#include "game_list_utils.h" #include "game_list_utils.h"
#include "gui_context_menus.h" #include "gui_context_menus.h"

View File

@ -165,12 +165,12 @@ public:
if (createShortcutLinux(linkPath, ebootPath, iconPath)) { if (createShortcutLinux(linkPath, ebootPath, iconPath)) {
#endif #endif
QMessageBox::information( QMessageBox::information(
nullptr, "Shortcut Creation", nullptr, "Shortcut creation",
QString("Shortcut created successfully:\n %1").arg(linkPath)); QString("Shortcut created successfully!\n %1").arg(linkPath));
} else { } else {
QMessageBox::critical( QMessageBox::critical(
nullptr, "Error", nullptr, "Error",
QString("Error creating shortcut:\n %1").arg(linkPath)); QString("Error creating shortcut!\n %1").arg(linkPath));
} }
} else { } else {
QMessageBox::critical(nullptr, "Error", "Failed to convert icon."); QMessageBox::critical(nullptr, "Error", "Failed to convert icon.");
@ -183,11 +183,11 @@ public:
if (createShortcutLinux(linkPath, ebootPath, iconPath)) { if (createShortcutLinux(linkPath, ebootPath, iconPath)) {
#endif #endif
QMessageBox::information( QMessageBox::information(
nullptr, "Shortcut Creation", nullptr, "Shortcut creation",
QString("Shortcut created successfully:\n %1").arg(linkPath)); QString("Shortcut created successfully!\n %1").arg(linkPath));
} else { } else {
QMessageBox::critical(nullptr, "Error", QMessageBox::critical(nullptr, "Error",
QString("Error creating shortcut:\n %1").arg(linkPath)); QString("Error creating shortcut!\n %1").arg(linkPath));
} }
} }
} }
@ -308,7 +308,7 @@ private:
QFile shortcutFile(linkPath); QFile shortcutFile(linkPath);
if (!shortcutFile.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!shortcutFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::critical(nullptr, "Error", QMessageBox::critical(nullptr, "Error",
QString("Error creating shortcut:\n %1").arg(linkPath)); QString("Error creating shortcut!\n %1").arg(linkPath));
return false; return false;
} }

View File

@ -8,6 +8,7 @@
#include <QProgressDialog> #include <QProgressDialog>
#include <QStatusBar> #include <QStatusBar>
#include <QtConcurrent> #include <QtConcurrent>
#include "common/io_file.h" #include "common/io_file.h"
#include "common/version.h" #include "common/version.h"
#include "core/file_format/pkg.h" #include "core/file_format/pkg.h"

View File

@ -10,6 +10,7 @@
#include <QMimeData> #include <QMimeData>
#include <QScopedPointer> #include <QScopedPointer>
#include <fmt/core.h> #include <fmt/core.h>
#include "common/config.h" #include "common/config.h"
#include "common/path_util.h" #include "common/path_util.h"
#include "core/file_format/psf.h" #include "core/file_format/psf.h"

View File

@ -7,25 +7,6 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
QPalette themePalette; QPalette themePalette;
switch (theme) { switch (theme) {
case Theme::Light:
mw_searchbar->setStyleSheet("background-color: #ffffff; /* Light gray background */"
"color: #000000; /* Black text */"
"padding: 5px;");
themePalette.setColor(QPalette::Window, QColor(240, 240, 240)); // Light gray
themePalette.setColor(QPalette::WindowText, Qt::black); // Black
themePalette.setColor(QPalette::Base, QColor(230, 230, 230, 80)); // Grayish
themePalette.setColor(QPalette::ToolTipBase, Qt::black); // Black
themePalette.setColor(QPalette::ToolTipText, Qt::black); // Black
themePalette.setColor(QPalette::Text, Qt::black); // Black
themePalette.setColor(QPalette::Button, QColor(240, 240, 240)); // Light gray
themePalette.setColor(QPalette::ButtonText, Qt::black); // Black
themePalette.setColor(QPalette::BrightText, Qt::red); // Red
themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::HighlightedText, Qt::white); // White
qApp->setPalette(themePalette);
break;
case Theme::Dark: case Theme::Dark:
mw_searchbar->setStyleSheet("background-color: #1e1e1e; /* Dark background */" mw_searchbar->setStyleSheet("background-color: #1e1e1e; /* Dark background */"
"color: #ffffff; /* White text */" "color: #ffffff; /* White text */"
@ -48,6 +29,25 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
qApp->setPalette(themePalette); qApp->setPalette(themePalette);
break; break;
case Theme::Light:
mw_searchbar->setStyleSheet("background-color: #ffffff; /* Light gray background */"
"color: #000000; /* Black text */"
"padding: 5px;");
themePalette.setColor(QPalette::Window, QColor(240, 240, 240)); // Light gray
themePalette.setColor(QPalette::WindowText, Qt::black); // Black
themePalette.setColor(QPalette::Base, QColor(230, 230, 230, 80)); // Grayish
themePalette.setColor(QPalette::ToolTipBase, Qt::black); // Black
themePalette.setColor(QPalette::ToolTipText, Qt::black); // Black
themePalette.setColor(QPalette::Text, Qt::black); // Black
themePalette.setColor(QPalette::Button, QColor(240, 240, 240)); // Light gray
themePalette.setColor(QPalette::ButtonText, Qt::black); // Black
themePalette.setColor(QPalette::BrightText, Qt::red); // Red
themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::HighlightedText, Qt::white); // White
qApp->setPalette(themePalette);
break;
case Theme::Green: case Theme::Green:
mw_searchbar->setStyleSheet("background-color: #354535; /* Dark green background */" mw_searchbar->setStyleSheet("background-color: #354535; /* Dark green background */"
"color: #ffffff; /* White text */" "color: #ffffff; /* White text */"

View File

@ -2,13 +2,14 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#pragma once #pragma once
#include <QApplication> #include <QApplication>
#include <QLineEdit> #include <QLineEdit>
#include <QWidget> #include <QWidget>
enum class Theme : int { enum class Theme : int {
Light,
Dark, Dark,
Light,
Green, Green,
Blue, Blue,
Violet, Violet,

View File

@ -44,8 +44,8 @@ public:
QAction* gameInstallPathAct; QAction* gameInstallPathAct;
QAction* dumpGameListAct; QAction* dumpGameListAct;
QAction* pkgViewerAct; QAction* pkgViewerAct;
QAction* setThemeLight;
QAction* setThemeDark; QAction* setThemeDark;
QAction* setThemeLight;
QAction* setThemeGreen; QAction* setThemeGreen;
QAction* setThemeBlue; QAction* setThemeBlue;
QAction* setThemeViolet; QAction* setThemeViolet;
@ -76,7 +76,7 @@ public:
MainWindow->setObjectName("MainWindow"); MainWindow->setObjectName("MainWindow");
// MainWindow->resize(1280, 720); // MainWindow->resize(1280, 720);
QIcon icon; QIcon icon;
icon.addFile(QString::fromUtf8(":/images/shadps4.ico"), QSize(), QIcon::Normal, QIcon::Off); icon.addFile(QString::fromUtf8(":images/shadps4.ico"), QSize(), QIcon::Normal, QIcon::Off);
MainWindow->setWindowIcon(icon); MainWindow->setWindowIcon(icon);
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(0); sizePolicy.setHorizontalStretch(0);
@ -136,13 +136,13 @@ public:
pkgViewerAct->setObjectName("pkgViewer"); pkgViewerAct->setObjectName("pkgViewer");
pkgViewerAct->setObjectName("pkgViewer"); pkgViewerAct->setObjectName("pkgViewer");
pkgViewerAct->setIcon(QIcon(":images/file_icon.png")); pkgViewerAct->setIcon(QIcon(":images/file_icon.png"));
setThemeLight = new QAction(MainWindow);
setThemeLight->setObjectName("setThemeLight");
setThemeLight->setCheckable(true);
setThemeLight->setChecked(true);
setThemeDark = new QAction(MainWindow); setThemeDark = new QAction(MainWindow);
setThemeDark->setObjectName("setThemeDark"); setThemeDark->setObjectName("setThemeDark");
setThemeDark->setCheckable(true); setThemeDark->setCheckable(true);
setThemeDark->setChecked(true);
setThemeLight = new QAction(MainWindow);
setThemeLight->setObjectName("setThemeLight");
setThemeLight->setCheckable(true);
setThemeGreen = new QAction(MainWindow); setThemeGreen = new QAction(MainWindow);
setThemeGreen->setObjectName("setThemeGreen"); setThemeGreen->setObjectName("setThemeGreen");
setThemeGreen->setCheckable(true); setThemeGreen->setCheckable(true);
@ -285,7 +285,7 @@ public:
} // setupUi } // setupUi
void retranslateUi(QMainWindow* MainWindow) { void retranslateUi(QMainWindow* MainWindow) {
MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "Shadps4", nullptr)); MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "shadPS4", nullptr));
addElfFolderAct->setText( addElfFolderAct->setText(
QCoreApplication::translate("MainWindow", "Open/Add Elf Folder", nullptr)); QCoreApplication::translate("MainWindow", "Open/Add Elf Folder", nullptr));
bootInstallPkgAct->setText( bootInstallPkgAct->setText(
@ -332,8 +332,8 @@ public:
menuSettings->setTitle(QCoreApplication::translate("MainWindow", "Settings", nullptr)); menuSettings->setTitle(QCoreApplication::translate("MainWindow", "Settings", nullptr));
menuUtils->setTitle(QCoreApplication::translate("MainWindow", "Utils", nullptr)); menuUtils->setTitle(QCoreApplication::translate("MainWindow", "Utils", nullptr));
menuThemes->setTitle(QCoreApplication::translate("MainWindow", "Themes", nullptr)); menuThemes->setTitle(QCoreApplication::translate("MainWindow", "Themes", nullptr));
setThemeLight->setText(QCoreApplication::translate("MainWindow", "Light", nullptr));
setThemeDark->setText(QCoreApplication::translate("MainWindow", "Dark", nullptr)); setThemeDark->setText(QCoreApplication::translate("MainWindow", "Dark", nullptr));
setThemeLight->setText(QCoreApplication::translate("MainWindow", "Light", nullptr));
setThemeGreen->setText(QCoreApplication::translate("MainWindow", "Green", nullptr)); setThemeGreen->setText(QCoreApplication::translate("MainWindow", "Green", nullptr));
setThemeBlue->setText(QCoreApplication::translate("MainWindow", "Blue", nullptr)); setThemeBlue->setText(QCoreApplication::translate("MainWindow", "Blue", nullptr));
setThemeViolet->setText(QCoreApplication::translate("MainWindow", "Violet", nullptr)); setThemeViolet->setText(QCoreApplication::translate("MainWindow", "Violet", nullptr));

View File

@ -3,6 +3,7 @@
#include <QHeaderView> #include <QHeaderView>
#include <QWidget> #include <QWidget>
#include "pkg_viewer.h" #include "pkg_viewer.h"
PKGViewer::PKGViewer(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent, PKGViewer::PKGViewer(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent,

View File

@ -15,6 +15,7 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#include "common/io_file.h" #include "common/io_file.h"
#include "core/file_format/pkg.h" #include "core/file_format/pkg.h"
#include "core/file_format/pkg_type.h" #include "core/file_format/pkg_type.h"

View File

@ -16,6 +16,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget> #include <QWidget>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include "common/types.h" #include "common/types.h"
#include "core/file_format/trp.h" #include "core/file_format/trp.h"