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

View file

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