mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
Add about menu
This commit is contained in:
parent
7571e58ce5
commit
1769783dc7
6 changed files with 92 additions and 5 deletions
|
@ -185,8 +185,8 @@ set(RENDERER_SW_SOURCE_FILES src/core/renderer_sw/renderer_sw.cpp)
|
||||||
|
|
||||||
# Frontend source files
|
# Frontend source files
|
||||||
if(ENABLE_QT_GUI)
|
if(ENABLE_QT_GUI)
|
||||||
set(FRONTEND_SOURCE_FILES src/panda_qt/main.cpp src/panda_qt/screen.cpp src/panda_qt/main_window.cpp)
|
set(FRONTEND_SOURCE_FILES src/panda_qt/main.cpp src/panda_qt/screen.cpp src/panda_qt/main_window.cpp src/panda_qt/about_window.cpp)
|
||||||
set(FRONTEND_HEADER_FILES include/panda_qt/screen.hpp include/panda_qt/main_window.hpp)
|
set(FRONTEND_HEADER_FILES include/panda_qt/screen.hpp include/panda_qt/main_window.hpp include/panda_qt/about_window.hpp)
|
||||||
|
|
||||||
source_group("Source Files\\Qt" FILES ${FRONTEND_SOURCE_FILES})
|
source_group("Source Files\\Qt" FILES ${FRONTEND_SOURCE_FILES})
|
||||||
source_group("Header Files\\Qt" FILES ${FRONTEND_HEADER_FILES})
|
source_group("Header Files\\Qt" FILES ${FRONTEND_HEADER_FILES})
|
||||||
|
@ -429,7 +429,7 @@ if(ENABLE_QT_GUI)
|
||||||
qt_add_resources(Alber "app_images"
|
qt_add_resources(Alber "app_images"
|
||||||
PREFIX "/"
|
PREFIX "/"
|
||||||
FILES
|
FILES
|
||||||
docs/img/rsob_icon.png
|
docs/img/rsob_icon.png docs/img/rstarstruck_icon.png
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
target_compile_definitions(Alber PUBLIC "PANDA3DS_FRONTEND_SDL=1")
|
target_compile_definitions(Alber PUBLIC "PANDA3DS_FRONTEND_SDL=1")
|
||||||
|
|
BIN
docs/img/rstarstruck_icon.png
Normal file
BIN
docs/img/rstarstruck_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.9 KiB |
12
include/panda_qt/about_window.hpp
Normal file
12
include/panda_qt/about_window.hpp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class AboutWindow : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
AboutWindow(QWidget* parent = nullptr);
|
||||||
|
};
|
|
@ -12,6 +12,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "emulator.hpp"
|
#include "emulator.hpp"
|
||||||
|
#include "panda_qt/about_window.hpp"
|
||||||
#include "panda_qt/screen.hpp"
|
#include "panda_qt/screen.hpp"
|
||||||
#include "services/hid.hpp"
|
#include "services/hid.hpp"
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ class MainWindow : public QMainWindow {
|
||||||
std::vector<EmulatorMessage> messageQueue;
|
std::vector<EmulatorMessage> messageQueue;
|
||||||
|
|
||||||
ScreenWidget screen;
|
ScreenWidget screen;
|
||||||
|
AboutWindow* aboutWindow;
|
||||||
QComboBox* themeSelect = nullptr;
|
QComboBox* themeSelect = nullptr;
|
||||||
QMenuBar* menuBar = nullptr;
|
QMenuBar* menuBar = nullptr;
|
||||||
|
|
||||||
|
@ -65,6 +67,7 @@ class MainWindow : public QMainWindow {
|
||||||
void emuThreadMainLoop();
|
void emuThreadMainLoop();
|
||||||
void selectROM();
|
void selectROM();
|
||||||
void dumpRomFS();
|
void dumpRomFS();
|
||||||
|
void showAboutMenu();
|
||||||
void sendMessage(const EmulatorMessage& message);
|
void sendMessage(const EmulatorMessage& message);
|
||||||
void dispatchMessage(const EmulatorMessage& message);
|
void dispatchMessage(const EmulatorMessage& message);
|
||||||
|
|
||||||
|
|
62
src/panda_qt/about_window.cpp
Normal file
62
src/panda_qt/about_window.cpp
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
#include "panda_qt/about_window.hpp"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QTextEdit>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
// Based on https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/DolphinQt/AboutDialog.cpp
|
||||||
|
|
||||||
|
AboutWindow::AboutWindow(QWidget* parent) : QDialog(parent) {
|
||||||
|
resize(200, 200);
|
||||||
|
|
||||||
|
setWindowTitle(tr("About Panda3DS"));
|
||||||
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
|
const QString text =
|
||||||
|
QStringLiteral(R"(
|
||||||
|
<p style='font-size:38pt; font-weight:400;'>Panda3DS</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
%ABOUT_PANDA3DS%<br>
|
||||||
|
<a href='https://panda3ds.com/'>%SUPPORT%</a><br>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a>%AUTHORS%</a>
|
||||||
|
</p>
|
||||||
|
)")
|
||||||
|
.replace(QStringLiteral("%ABOUT_PANDA3DS%"), tr("Panda3DS is a free and open source Nintendo 3DS emulator, for Windows, MacOS and Linux"))
|
||||||
|
.replace(QStringLiteral("%SUPPORT%"), tr("Visit panda3ds.com for help with Panda3DS and links to our official support sites."))
|
||||||
|
.replace(
|
||||||
|
QStringLiteral("%AUTHORS%"), tr("Panda3DS is developed by volunteers in their spare time. Below is a list of some of these"
|
||||||
|
" volunteers who've agreed to be listed here, in no particular order.<br>If you think you should be "
|
||||||
|
"listed here too, please inform us<br><br>"
|
||||||
|
"- Peach (wheremyfoodat)<br>"
|
||||||
|
"- noumidev<br>"
|
||||||
|
"- liuk707<br>"
|
||||||
|
"- Wunk<br>"
|
||||||
|
"- marysaka<br>"
|
||||||
|
"- Sky<br>"
|
||||||
|
"- merryhime<br>"
|
||||||
|
"- TGP17<br>")
|
||||||
|
);
|
||||||
|
|
||||||
|
QLabel* textLabel = new QLabel(text);
|
||||||
|
textLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
|
textLabel->setOpenExternalLinks(true);
|
||||||
|
|
||||||
|
QLabel* logo = new QLabel();
|
||||||
|
logo->setPixmap(QPixmap(":/docs/img/rstarstruck_icon.png"));
|
||||||
|
logo->setContentsMargins(30, 0, 30, 0);
|
||||||
|
|
||||||
|
QVBoxLayout* mainLayout = new QVBoxLayout;
|
||||||
|
QHBoxLayout* hLayout = new QHBoxLayout;
|
||||||
|
|
||||||
|
setLayout(mainLayout);
|
||||||
|
mainLayout->addLayout(hLayout);
|
||||||
|
|
||||||
|
hLayout->setAlignment(Qt::AlignLeft);
|
||||||
|
hLayout->addWidget(logo);
|
||||||
|
hLayout->addWidget(textLabel);
|
||||||
|
}
|
|
@ -20,7 +20,6 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
|
||||||
auto fileMenu = menuBar->addMenu(tr("File"));
|
auto fileMenu = menuBar->addMenu(tr("File"));
|
||||||
auto emulationMenu = menuBar->addMenu(tr("Emulation"));
|
auto emulationMenu = menuBar->addMenu(tr("Emulation"));
|
||||||
auto toolsMenu = menuBar->addMenu(tr("Tools"));
|
auto toolsMenu = menuBar->addMenu(tr("Tools"));
|
||||||
auto helpMenu = menuBar->addMenu(tr("Help"));
|
|
||||||
auto aboutMenu = menuBar->addMenu(tr("About"));
|
auto aboutMenu = menuBar->addMenu(tr("About"));
|
||||||
|
|
||||||
// Create and bind actions for them
|
// Create and bind actions for them
|
||||||
|
@ -37,6 +36,9 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
|
||||||
auto dumpRomFSAction = toolsMenu->addAction(tr("Dump RomFS"));
|
auto dumpRomFSAction = toolsMenu->addAction(tr("Dump RomFS"));
|
||||||
connect(dumpRomFSAction, &QAction::triggered, this, &MainWindow::dumpRomFS);
|
connect(dumpRomFSAction, &QAction::triggered, this, &MainWindow::dumpRomFS);
|
||||||
|
|
||||||
|
auto aboutAction = aboutMenu->addAction(tr("About Panda3DS"));
|
||||||
|
connect(aboutAction, &QAction::triggered, this, &MainWindow::showAboutMenu);
|
||||||
|
|
||||||
// Set up theme selection
|
// Set up theme selection
|
||||||
setTheme(Theme::Dark);
|
setTheme(Theme::Dark);
|
||||||
themeSelect = new QComboBox(this);
|
themeSelect = new QComboBox(this);
|
||||||
|
@ -50,6 +52,9 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
|
||||||
themeSelect->show();
|
themeSelect->show();
|
||||||
connect(themeSelect, &QComboBox::currentIndexChanged, this, [&](int index) { setTheme(static_cast<Theme>(index)); });
|
connect(themeSelect, &QComboBox::currentIndexChanged, this, [&](int index) { setTheme(static_cast<Theme>(index)); });
|
||||||
|
|
||||||
|
// Set up misc objects
|
||||||
|
aboutWindow = new AboutWindow(nullptr);
|
||||||
|
|
||||||
emu = new Emulator();
|
emu = new Emulator();
|
||||||
emu->setOutputSize(screen.surfaceWidth, screen.surfaceHeight);
|
emu->setOutputSize(screen.surfaceWidth, screen.surfaceHeight);
|
||||||
|
|
||||||
|
@ -136,6 +141,7 @@ MainWindow::~MainWindow() {
|
||||||
|
|
||||||
delete emu;
|
delete emu;
|
||||||
delete menuBar;
|
delete menuBar;
|
||||||
|
delete aboutWindow;
|
||||||
delete themeSelect;
|
delete themeSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +221,6 @@ void MainWindow::setTheme(Theme theme) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case Theme::System: {
|
case Theme::System: {
|
||||||
qApp->setPalette(this->style()->standardPalette());
|
qApp->setPalette(this->style()->standardPalette());
|
||||||
qApp->setStyle(QStyleFactory::create("WindowsVista"));
|
qApp->setStyle(QStyleFactory::create("WindowsVista"));
|
||||||
|
@ -260,6 +265,11 @@ void MainWindow::dumpRomFS() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::showAboutMenu() {
|
||||||
|
AboutWindow about(this);
|
||||||
|
about.exec();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::dispatchMessage(const EmulatorMessage& message) {
|
void MainWindow::dispatchMessage(const EmulatorMessage& message) {
|
||||||
switch (message.type) {
|
switch (message.type) {
|
||||||
case MessageType::LoadROM:
|
case MessageType::LoadROM:
|
||||||
|
|
Loading…
Add table
Reference in a new issue