From c493bd9cc927f9119960e6dc084d374a2ec75d26 Mon Sep 17 00:00:00 2001 From: spycrab Date: Sun, 14 Jan 2018 19:15:45 +0100 Subject: Implement "About" dialog --- dist/icons/icons.qrc | 5 ++ dist/icons/yuzu.png | Bin 0 -> 7719 bytes src/yuzu/CMakeLists.txt | 9 ++- src/yuzu/about_dialog.cpp | 15 ++++ src/yuzu/about_dialog.h | 23 ++++++ src/yuzu/aboutdialog.ui | 191 ++++++++++++++++++++++++++++++++++++++++++++++ src/yuzu/main.cpp | 9 +++ src/yuzu/main.h | 1 + 8 files changed, 250 insertions(+), 3 deletions(-) create mode 100644 dist/icons/icons.qrc create mode 100644 dist/icons/yuzu.png create mode 100644 src/yuzu/about_dialog.cpp create mode 100644 src/yuzu/about_dialog.h create mode 100644 src/yuzu/aboutdialog.ui diff --git a/dist/icons/icons.qrc b/dist/icons/icons.qrc new file mode 100644 index 000000000..575cd0861 --- /dev/null +++ b/dist/icons/icons.qrc @@ -0,0 +1,5 @@ + + + yuzu.png + + \ No newline at end of file diff --git a/dist/icons/yuzu.png b/dist/icons/yuzu.png new file mode 100644 index 000000000..81a745344 Binary files /dev/null and b/dist/icons/yuzu.png differ diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 5b446dc36..c52d5627a 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -4,6 +4,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) set(SRCS + about_dialog.cpp configuration/config.cpp configuration/configure_debug.cpp configuration/configure_dialog.cpp @@ -26,6 +27,7 @@ set(SRCS ) set(HEADERS + about_dialog.h configuration/config.h configuration/configure_debug.h configuration/configure_dialog.h @@ -47,6 +49,7 @@ set(HEADERS ) set(UIS + aboutdialog.ui configuration/configure.ui configuration/configure_debug.ui configuration/configure_general.ui @@ -58,7 +61,7 @@ set(UIS main.ui ) -# file(GLOB_RECURSE ICONS ${CMAKE_SOURCE_DIR}/dist/icons/*) +file(GLOB_RECURSE ICONS ${CMAKE_SOURCE_DIR}/dist/icons/*) file(GLOB_RECURSE THEMES ${CMAKE_SOURCE_DIR}/dist/qt_themes/*) create_directory_groups(${SRCS} ${HEADERS} ${UIS}) @@ -72,10 +75,10 @@ endif() if (APPLE) set(MACOSX_ICON "../../dist/yuzu.icns") set_source_files_properties(${MACOSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - add_executable(yuzu MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS} ${MACOSX_ICON}) + add_executable(yuzu MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS} ${MACOSX_ICON} ${ICONS}) set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) else() - add_executable(yuzu ${SRCS} ${HEADERS} ${UI_HDRS}) + add_executable(yuzu ${SRCS} ${HEADERS} ${UI_HDRS} ${ICONS}) endif() target_link_libraries(yuzu PRIVATE common core input_common video_core) target_link_libraries(yuzu PRIVATE Boost::boost glad Qt5::OpenGL Qt5::Widgets) diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp new file mode 100644 index 000000000..0f1b6cdc6 --- /dev/null +++ b/src/yuzu/about_dialog.cpp @@ -0,0 +1,15 @@ +// Copyright 2018 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/scm_rev.h" +#include "ui_aboutdialog.h" +#include "yuzu/about_dialog.h" + +AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) { + ui->setupUi(this); + ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg( +Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc)); +} + +AboutDialog::~AboutDialog() {} diff --git a/src/yuzu/about_dialog.h b/src/yuzu/about_dialog.h new file mode 100644 index 000000000..2eb6e28f5 --- /dev/null +++ b/src/yuzu/about_dialog.h @@ -0,0 +1,23 @@ +// Copyright 2018 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +namespace Ui { +class AboutDialog; +} + +class AboutDialog : public QDialog { + Q_OBJECT + +public: + explicit AboutDialog(QWidget* parent); + ~AboutDialog(); + +private: + std::unique_ptr ui; +}; diff --git a/src/yuzu/aboutdialog.ui b/src/yuzu/aboutdialog.ui new file mode 100644 index 000000000..cdcaa15b0 --- /dev/null +++ b/src/yuzu/aboutdialog.ui @@ -0,0 +1,191 @@ + + + AboutDialog + + + + 0 + 0 + 616 + 261 + + + + About yuzu + + + + + + + + + + + 0 + 0 + + + + <html><head/><body><p><img src=":/icons/yuzu.png"/></p></body></html> + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-size:28pt;">yuzu</span></p></body></html> + + + + + + + + 0 + 0 + + + + <html><head/><body><p>%1 | %2-%3</p></body></html> + + + + + + + + 0 + 0 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt;">yuzu is an experimental open-source emulator for the Nintendo Switch licensed under GPLv2.0 or any later version.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt;">This software should not be used to play games you have not legally obtained.</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + <html><head/><body><p><a href="https://yuzu-emu.org/"><span style=" text-decoration: underline; color:#0000ff;">Website</span></a> | <a href="https://github.com/yuzu-emu"><span style=" text-decoration: underline; color:#0000ff;">Source Code</span></a> | <a href="https://github.com/yuzu-emu/yuzu/graphs/contributors"><span style=" text-decoration: underline; color:#0000ff;">Contributors</span></a> | <a href="https://github.com/yuzu-emu/yuzu/blob/master/license.txt"><span style=" text-decoration: underline; color:#0000ff;">License</span></a></p></body></html> + + + true + + + + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-size:7pt;">&quot;Nintendo Switch&quot; is a trademark of Nintendo. yuzu is not affiliated with Nintendo in any way.</span></p></body></html> + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + AboutDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AboutDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 99a62c432..5e0d1d0d5 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -26,6 +26,7 @@ #include "core/gdbstub/gdbstub.h" #include "core/loader/loader.h" #include "core/settings.h" +#include "yuzu/about_dialog.h" #include "yuzu/bootmanager.h" #include "yuzu/configuration/config.h" #include "yuzu/configuration/configure_dialog.h" @@ -264,6 +265,9 @@ void GMainWindow::ConnectMenuEvents() { ui.action_Show_Filter_Bar->setShortcut(tr("CTRL+F")); connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); + + // Help + connect(ui.action_About, &QAction::triggered, this, &GMainWindow::OnAbout); } void GMainWindow::OnDisplayTitleBars(bool show) { @@ -581,6 +585,11 @@ void GMainWindow::OnConfigure() { } } +void GMainWindow::OnAbout() { + AboutDialog aboutDialog(this); + aboutDialog.exec(); +} + void GMainWindow::OnToggleFilterBar() { game_list->setFilterVisible(ui.action_Show_Filter_Bar->isChecked()); if (ui.action_Show_Filter_Bar->isChecked()) { diff --git a/src/yuzu/main.h b/src/yuzu/main.h index e37ef2b85..d3f3b3e59 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -124,6 +124,7 @@ private slots: void OnMenuSelectGameListRoot(); void OnMenuRecentFile(); void OnConfigure(); + void OnAbout(); void OnToggleFilterBar(); void OnDisplayTitleBars(bool); void ToggleWindowMode(); -- cgit v1.2.3