diff --git a/src/images/discord.png b/src/images/discord.png new file mode 100644 index 000000000..2fa455fd1 Binary files /dev/null and b/src/images/discord.png differ diff --git a/src/images/github.png b/src/images/github.png new file mode 100644 index 000000000..22b101798 Binary files /dev/null and b/src/images/github.png differ diff --git a/src/images/ko-fi.png b/src/images/ko-fi.png new file mode 100644 index 000000000..d19991b5f Binary files /dev/null and b/src/images/ko-fi.png differ diff --git a/src/images/youtube.png b/src/images/youtube.png new file mode 100644 index 000000000..362ac5781 Binary files /dev/null and b/src/images/youtube.png differ diff --git a/src/qt_gui/about_dialog.cpp b/src/qt_gui/about_dialog.cpp index a932d65a0..aa7b4ab51 100644 --- a/src/qt_gui/about_dialog.cpp +++ b/src/qt_gui/about_dialog.cpp @@ -1,13 +1,89 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include +#include +#include +#include +#include #include "about_dialog.h" #include "ui_about_dialog.h" AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); + + preloadImages(); + + ui->image_1->setAttribute(Qt::WA_Hover, true); + ui->image_2->setAttribute(Qt::WA_Hover, true); + ui->image_3->setAttribute(Qt::WA_Hover, true); + ui->image_4->setAttribute(Qt::WA_Hover, true); + + ui->image_1->installEventFilter(this); + ui->image_2->installEventFilter(this); + ui->image_3->installEventFilter(this); + ui->image_4->installEventFilter(this); } AboutDialog::~AboutDialog() { delete ui; } + +void AboutDialog::preloadImages() { + originalImages[0] = ui->image_1->pixmap().copy(); + originalImages[1] = ui->image_2->pixmap().copy(); + originalImages[2] = ui->image_3->pixmap().copy(); + originalImages[3] = ui->image_4->pixmap().copy(); + + for (int i = 0; i < 4; ++i) { + QImage image = originalImages[i].toImage(); + + for (int y = 0; y < image.height(); ++y) { + for (int x = 0; x < image.width(); ++x) { + QColor color = image.pixelColor(x, y); + color.setRed(255 - color.red()); + color.setGreen(255 - color.green()); + color.setBlue(255 - color.blue()); + image.setPixelColor(x, y, color); + } + } + invertedImages[i] = QPixmap::fromImage(image); + } +} + +bool AboutDialog::eventFilter(QObject* obj, QEvent* event) { + if (event->type() == QEvent::Enter) { + if (obj == ui->image_1) { + ui->image_1->setPixmap(invertedImages[0]); + } else if (obj == ui->image_2) { + ui->image_2->setPixmap(invertedImages[1]); + } else if (obj == ui->image_3) { + ui->image_3->setPixmap(invertedImages[2]); + } else if (obj == ui->image_4) { + ui->image_4->setPixmap(invertedImages[3]); + } + } else if (event->type() == QEvent::Leave) { + if (obj == ui->image_1) { + ui->image_1->setPixmap(originalImages[0]); + } else if (obj == ui->image_2) { + ui->image_2->setPixmap(originalImages[1]); + } else if (obj == ui->image_3) { + ui->image_3->setPixmap(originalImages[2]); + } else if (obj == ui->image_4) { + ui->image_4->setPixmap(originalImages[3]); + } + + } else if (event->type() == QEvent::MouseButtonPress) { + if (obj == ui->image_1) { + QDesktopServices::openUrl(QUrl("https://github.com/shadps4-emu/shadPS4")); + } else if (obj == ui->image_2) { + QDesktopServices::openUrl(QUrl("https://discord.gg/bFJxfftGW6")); + } else if (obj == ui->image_3) { + QDesktopServices::openUrl(QUrl("https://ko-fi.com/shadps4")); + } else if (obj == ui->image_4) { + QDesktopServices::openUrl(QUrl("https://www.youtube.com/@shadPS4/videos")); + } + return true; + } + return QDialog::eventFilter(obj, event); +} diff --git a/src/qt_gui/about_dialog.h b/src/qt_gui/about_dialog.h index 8c802221b..994b95887 100644 --- a/src/qt_gui/about_dialog.h +++ b/src/qt_gui/about_dialog.h @@ -3,7 +3,11 @@ #pragma once +#include #include +#include +#include +#include namespace Ui { class AboutDialog; @@ -15,7 +19,12 @@ class AboutDialog : public QDialog { public: explicit AboutDialog(QWidget* parent = nullptr); ~AboutDialog(); + bool eventFilter(QObject* obj, QEvent* event); private: Ui::AboutDialog* ui; + + void preloadImages(); + QPixmap originalImages[4]; + QPixmap invertedImages[4]; }; \ No newline at end of file diff --git a/src/qt_gui/about_dialog.ui b/src/qt_gui/about_dialog.ui index e2e76f4c4..36ce773bd 100644 --- a/src/qt_gui/about_dialog.ui +++ b/src/qt_gui/about_dialog.ui @@ -9,7 +9,7 @@ 0 0 780 - 320 + 310 @@ -22,14 +22,14 @@ - 10 - 30 + 15 + 15 271 - 261 + 271 - QFrame::Shape::NoFrame + QFrame::NoFrame @@ -45,7 +45,7 @@ 310 - 40 + 15 171 41 @@ -64,9 +64,9 @@ 310 - 90 + 60 451 - 101 + 70 @@ -85,9 +85,9 @@ 310 - 180 + 130 451 - 101 + 70 @@ -102,6 +102,106 @@ true + + + + 310 + 210 + 80 + 80 + + + + ArrowCursor + + + QFrame::NoFrame + + + + + + :/images/github.png + + + true + + + + + + 400 + 210 + 80 + 80 + + + + ArrowCursor + + + QFrame::NoFrame + + + + + + :/images/discord.png + + + true + + + + + + 490 + 210 + 80 + 80 + + + + ArrowCursor + + + QFrame::NoFrame + + + + + + :/images/ko-fi.png + + + true + + + + + + 580 + 210 + 80 + 80 + + + + ArrowCursor + + + QFrame::NoFrame + + + + + + :/images/youtube.png + + + true + + diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index 959b055c8..56e7880a2 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -267,6 +267,11 @@ void MainWindow::CreateConnects() { }); #endif + connect(ui->keys_shortcuts, &QAction::triggered, this, [this]() { + auto aboutDialog = new AboutDialog(this); + aboutDialog->exec(); + }); + connect(ui->aboutAct, &QAction::triggered, this, [this]() { auto aboutDialog = new AboutDialog(this); aboutDialog->exec(); @@ -947,6 +952,7 @@ void MainWindow::SetUiIcons(bool isWhite) { ui->downloadCheatsPatchesAct->setIcon( RecolorIcon(ui->downloadCheatsPatchesAct->icon(), isWhite)); ui->dumpGameListAct->setIcon(RecolorIcon(ui->dumpGameListAct->icon(), isWhite)); + ui->keys_shortcuts->setIcon(RecolorIcon(ui->keys_shortcuts->icon(), isWhite)); ui->aboutAct->setIcon(RecolorIcon(ui->aboutAct->icon(), isWhite)); ui->setlistModeListAct->setIcon(RecolorIcon(ui->setlistModeListAct->icon(), isWhite)); ui->setlistModeGridAct->setIcon(RecolorIcon(ui->setlistModeGridAct->icon(), isWhite)); diff --git a/src/qt_gui/main_window_ui.h b/src/qt_gui/main_window_ui.h index a51e37d1e..db98799af 100644 --- a/src/qt_gui/main_window_ui.h +++ b/src/qt_gui/main_window_ui.h @@ -30,6 +30,7 @@ public: QAction* updaterAct; #endif QAction* aboutAct; + QAction* keys_shortcuts; QAction* configureAct; QAction* setThemeDark; QAction* setThemeLight; @@ -140,6 +141,9 @@ public: aboutAct = new QAction(MainWindow); aboutAct->setObjectName("aboutAct"); aboutAct->setIcon(QIcon(":images/about_icon.png")); + keys_shortcuts = new QAction(MainWindow); + keys_shortcuts->setObjectName("keys_shortcuts"); + keys_shortcuts->setIcon(QIcon(":images/about_icon.png")); configureAct = new QAction(MainWindow); configureAct->setObjectName("configureAct"); configureAct->setIcon(QIcon(":images/settings_icon.png")); @@ -298,6 +302,7 @@ public: #ifdef ENABLE_UPDATER menuHelp->addAction(updaterAct); #endif + menuHelp->addAction(keys_shortcuts); menuHelp->addAction(aboutAct); retranslateUi(MainWindow); @@ -317,6 +322,8 @@ public: QCoreApplication::translate("MainWindow", "Check for Updates", nullptr)); #endif aboutAct->setText(QCoreApplication::translate("MainWindow", "About shadPS4", nullptr)); + keys_shortcuts->setText( + QCoreApplication::translate("MainWindow", "Keys and Shortcuts", nullptr)); configureAct->setText(QCoreApplication::translate("MainWindow", "Configure...", nullptr)); #if QT_CONFIG(tooltip) bootInstallPkgAct->setToolTip(QCoreApplication::translate( diff --git a/src/shadps4.qrc b/src/shadps4.qrc index a59cb0621..cd7c32b6b 100644 --- a/src/shadps4.qrc +++ b/src/shadps4.qrc @@ -24,5 +24,9 @@ images/flag_us.png images/flag_world.png images/flag_china.png + images/github.png + images/discord.png + images/ko-fi.png + images/youtube.png