About Window (#458)

This commit is contained in:
¥IGA 2024-08-17 18:13:37 +02:00 committed by GitHub
parent ecf7f36763
commit 3be2e4b2b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 164 additions and 1 deletions

View File

@ -547,7 +547,10 @@ set(EMULATOR src/emulator.cpp
if(ENABLE_QT_GUI) if(ENABLE_QT_GUI)
qt_add_resources(RESOURCE_FILES src/shadps4.qrc) qt_add_resources(RESOURCE_FILES src/shadps4.qrc)
set(QT_GUI src/qt_gui/main_window_ui.h set(QT_GUI src/qt_gui/about_dialog.cpp
src/qt_gui/about_dialog.h
src/qt_gui/about_dialog.ui
src/qt_gui/main_window_ui.h
src/qt_gui/main_window.cpp src/qt_gui/main_window.cpp
src/qt_gui/main_window.h src/qt_gui/main_window.h
src/qt_gui/gui_context_menus.h src/qt_gui/gui_context_menus.h

View File

@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "about_dialog.h"
#include "ui_about_dialog.h"
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
ui->setupUi(this);
}
AboutDialog::~AboutDialog() {
delete ui;
}

21
src/qt_gui/about_dialog.h Normal file
View File

@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog {
Q_OBJECT
public:
explicit AboutDialog(QWidget* parent = nullptr);
~AboutDialog();
private:
Ui::AboutDialog* ui;
};

110
src/qt_gui/about_dialog.ui Normal file
View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
SPDX-License-Identifier: GPL-2.0-or-later -->
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>780</width>
<height>320</height>
</rect>
</property>
<property name="windowTitle">
<string>About shadPS4</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>:/images/shadps4.ico</normaloff>:/images/shadps4.ico</iconset>
</property>
<widget class="QLabel" name="shad_logo">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>271</width>
<height>261</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>:/images/shadps4.ico</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="shad_title">
<property name="geometry">
<rect>
<x>310</x>
<y>40</y>
<width>171</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>24</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>shadPS4</string>
</property>
</widget>
<widget class="QLabel" name="shad_text">
<property name="geometry">
<rect>
<x>310</x>
<y>90</y>
<width>451</width>
<height>101</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>shadPS4 is an experimental open-source emulator for the PlayStation 4.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="shad_text_2">
<property name="geometry">
<rect>
<x>310</x>
<y>180</y>
<width>451</width>
<height>101</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>This software should not be used to play games you have not legally obtained.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<connections/>
</ui>

View File

@ -9,6 +9,7 @@
#include <QStatusBar> #include <QStatusBar>
#include <QtConcurrent> #include <QtConcurrent>
#include "about_dialog.h"
#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"
@ -206,6 +207,11 @@ void MainWindow::CreateConnects() {
settingsDialog->exec(); settingsDialog->exec();
}); });
connect(ui->aboutAct, &QAction::triggered, this, [this]() {
auto aboutDialog = new AboutDialog(this);
aboutDialog->exec();
});
connect(ui->setIconSizeTinyAct, &QAction::triggered, this, [this]() { connect(ui->setIconSizeTinyAct, &QAction::triggered, this, [this]() {
if (isTableList) { if (isTableList) {
m_game_list_frame->icon_size = m_game_list_frame->icon_size =

View File

@ -45,6 +45,7 @@ public:
QAction* gameInstallPathAct; QAction* gameInstallPathAct;
QAction* dumpGameListAct; QAction* dumpGameListAct;
QAction* pkgViewerAct; QAction* pkgViewerAct;
QAction* aboutAct;
QAction* setThemeDark; QAction* setThemeDark;
QAction* setThemeLight; QAction* setThemeLight;
QAction* setThemeGreen; QAction* setThemeGreen;
@ -70,6 +71,7 @@ public:
QMenu* menuSettings; QMenu* menuSettings;
QMenu* menuUtils; QMenu* menuUtils;
QMenu* menuThemes; QMenu* menuThemes;
QMenu* menuAbout;
QToolBar* toolBar; QToolBar* toolBar;
void setupUi(QMainWindow* MainWindow) { void setupUi(QMainWindow* MainWindow) {
@ -139,6 +141,8 @@ 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"));
aboutAct = new QAction(MainWindow);
aboutAct->setObjectName("aboutAct");
setThemeDark = new QAction(MainWindow); setThemeDark = new QAction(MainWindow);
setThemeDark->setObjectName("setThemeDark"); setThemeDark->setObjectName("setThemeDark");
setThemeDark->setCheckable(true); setThemeDark->setCheckable(true);
@ -245,6 +249,8 @@ public:
menuThemes = new QMenu(menuView); menuThemes = new QMenu(menuView);
menuThemes->setObjectName("menuThemes"); menuThemes->setObjectName("menuThemes");
menuThemes->setIcon(QIcon(":images/themes_icon.png")); menuThemes->setIcon(QIcon(":images/themes_icon.png"));
menuAbout = new QMenu(menuBar);
menuAbout->setObjectName("menuAbout");
MainWindow->setMenuBar(menuBar); MainWindow->setMenuBar(menuBar);
toolBar = new QToolBar(MainWindow); toolBar = new QToolBar(MainWindow);
toolBar->setObjectName("toolBar"); toolBar->setObjectName("toolBar");
@ -253,6 +259,7 @@ public:
menuBar->addAction(menuFile->menuAction()); menuBar->addAction(menuFile->menuAction());
menuBar->addAction(menuView->menuAction()); menuBar->addAction(menuView->menuAction());
menuBar->addAction(menuSettings->menuAction()); menuBar->addAction(menuSettings->menuAction());
menuBar->addAction(menuAbout->menuAction());
menuFile->addAction(bootInstallPkgAct); menuFile->addAction(bootInstallPkgAct);
menuFile->addAction(bootGameAct); menuFile->addAction(bootGameAct);
menuFile->addAction(addElfFolderAct); menuFile->addAction(addElfFolderAct);
@ -282,6 +289,7 @@ public:
menuSettings->addAction(menuUtils->menuAction()); menuSettings->addAction(menuUtils->menuAction());
menuUtils->addAction(dumpGameListAct); menuUtils->addAction(dumpGameListAct);
menuUtils->addAction(pkgViewerAct); menuUtils->addAction(pkgViewerAct);
menuAbout->addAction(aboutAct);
retranslateUi(MainWindow); retranslateUi(MainWindow);
@ -295,6 +303,7 @@ public:
bootInstallPkgAct->setText( bootInstallPkgAct->setText(
QCoreApplication::translate("MainWindow", "Install Packages (PKG)", nullptr)); QCoreApplication::translate("MainWindow", "Install Packages (PKG)", nullptr));
bootGameAct->setText(QCoreApplication::translate("MainWindow", "Boot Game", nullptr)); bootGameAct->setText(QCoreApplication::translate("MainWindow", "Boot Game", nullptr));
aboutAct->setText(QCoreApplication::translate("MainWindow", "About", nullptr));
#if QT_CONFIG(tooltip) #if QT_CONFIG(tooltip)
bootInstallPkgAct->setToolTip(QCoreApplication::translate( bootInstallPkgAct->setToolTip(QCoreApplication::translate(
"MainWindow", "Install application from a .pkg file", nullptr)); "MainWindow", "Install application from a .pkg file", nullptr));
@ -337,6 +346,7 @@ 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));
menuAbout->setTitle(QCoreApplication::translate("MainWindow", "About", nullptr));
setThemeDark->setText(QCoreApplication::translate("MainWindow", "Dark", nullptr)); setThemeDark->setText(QCoreApplication::translate("MainWindow", "Dark", nullptr));
setThemeLight->setText(QCoreApplication::translate("MainWindow", "Light", nullptr)); setThemeLight->setText(QCoreApplication::translate("MainWindow", "Light", nullptr));
setThemeGreen->setText(QCoreApplication::translate("MainWindow", "Green", nullptr)); setThemeGreen->setText(QCoreApplication::translate("MainWindow", "Green", nullptr));