From 77efb2d134ea49f1b96f2a820218961c5344d911 Mon Sep 17 00:00:00 2001 From: Rukai Date: Thu, 11 Feb 2016 22:59:44 +1100 Subject: [PATCH] About dialog displays version numbers and handy links --- Source/Core/DolphinQt2/AboutDialog.cpp | 68 ++++++++++++++++++++++++++ Source/Core/DolphinQt2/AboutDialog.h | 15 ++++++ Source/Core/DolphinQt2/CMakeLists.txt | 1 + Source/Core/DolphinQt2/MainWindow.cpp | 8 +++ Source/Core/DolphinQt2/MainWindow.h | 1 + Source/Core/DolphinQt2/MenuBar.cpp | 17 ++++++- Source/Core/DolphinQt2/MenuBar.h | 3 ++ 7 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 Source/Core/DolphinQt2/AboutDialog.cpp create mode 100644 Source/Core/DolphinQt2/AboutDialog.h diff --git a/Source/Core/DolphinQt2/AboutDialog.cpp b/Source/Core/DolphinQt2/AboutDialog.cpp new file mode 100644 index 0000000000..75e0052262 --- /dev/null +++ b/Source/Core/DolphinQt2/AboutDialog.cpp @@ -0,0 +1,68 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include +#include +#include + +#include "Common/Common.h" +#include "DolphinQt2/AboutDialog.h" +#include "DolphinQt2/Resources.h" + +AboutDialog::AboutDialog(QWidget* parent) + : QDialog(parent) +{ + setWindowTitle(tr("About Dolphin")); + setAttribute(Qt::WA_DeleteOnClose); + + QString text = QStringLiteral(""); + QString small = QStringLiteral("

"); + QString medium = QStringLiteral("

"); + + text.append(QStringLiteral("

") + + tr("Dolphin") + QStringLiteral("

")); + text.append(QStringLiteral("

%1

") + .arg(QString::fromUtf8(scm_desc_str))); + + text.append(small + tr("Branch: ") + QString::fromUtf8(scm_branch_str) + QStringLiteral("

")); + text.append(small + tr("Revision: ") + QString::fromUtf8(scm_rev_git_str) + QStringLiteral("

")); + text.append(small + tr("Compiled: ") + QStringLiteral(__DATE__ " " __TIME__ "

")); + + text.append(medium + tr("Check for updates: ") + + QStringLiteral("dolphin-emu.org/download

")); + text.append(medium + tr("Dolphin is a free and open-source GameCube and Wii emulator.") + QStringLiteral("

")); + text.append(medium + tr("This software should not be used to play games you do not legally own.") + QStringLiteral("

")); + text.append(medium + QStringLiteral( + "%1 | " + "%2 | " + "%3

" + ).arg(tr("Licence")).arg(tr("Authors")).arg(tr("Support"))); + + QLabel* text_label = new QLabel(text); + text_label->setTextInteractionFlags(Qt::TextBrowserInteraction); + text_label->setOpenExternalLinks(true); + + QLabel* copyright = new QLabel(tr( + "© 2003-%1 Dolphin Team. “GameCube” and “Wii” are" + " trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way." + ).arg(QStringLiteral(__DATE__).right(4))); + + QLabel* logo = new QLabel(); + logo->setPixmap(Resources::GetMisc(Resources::LOGO_LARGE)); + logo->setContentsMargins(30, 0, 30, 0); + + QVBoxLayout* main_layout = new QVBoxLayout; + QHBoxLayout* h_layout = new QHBoxLayout; + + setLayout(main_layout); + main_layout->addLayout(h_layout); + main_layout->addWidget(copyright); + copyright->setAlignment(Qt::AlignCenter); + copyright->setContentsMargins(0, 15, 0, 0); + + h_layout->setAlignment(Qt::AlignLeft); + h_layout->addWidget(logo); + h_layout->addWidget(text_label); +} + diff --git a/Source/Core/DolphinQt2/AboutDialog.h b/Source/Core/DolphinQt2/AboutDialog.h new file mode 100644 index 0000000000..812e6ce807 --- /dev/null +++ b/Source/Core/DolphinQt2/AboutDialog.h @@ -0,0 +1,15 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include + +class AboutDialog final : public QDialog +{ + Q_OBJECT +public: + explicit AboutDialog(QWidget* parent = nullptr); +}; + diff --git a/Source/Core/DolphinQt2/CMakeLists.txt b/Source/Core/DolphinQt2/CMakeLists.txt index d66dece122..2000a2b8be 100644 --- a/Source/Core/DolphinQt2/CMakeLists.txt +++ b/Source/Core/DolphinQt2/CMakeLists.txt @@ -4,6 +4,7 @@ add_definitions(-DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ set(CMAKE_AUTOMOC ON) set(SRCS + AboutDialog.cpp Host.cpp Main.cpp MainWindow.cpp diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index 833f4da4dc..3ba7f25809 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -10,6 +10,7 @@ #include "Core/BootManager.h" #include "Core/Core.h" +#include "DolphinQt2/AboutDialog.h" #include "DolphinQt2/Host.h" #include "DolphinQt2/MainWindow.h" #include "DolphinQt2/Resources.h" @@ -49,6 +50,7 @@ void MainWindow::ConnectMenuBar() connect(m_menu_bar, &MenuBar::Exit, this, &MainWindow::close); connect(m_menu_bar, &MenuBar::ShowTable, m_game_list, &GameList::SetTableView); connect(m_menu_bar, &MenuBar::ShowList, m_game_list, &GameList::SetListView); + connect(m_menu_bar, &MenuBar::ShowAboutDialog, this, &MainWindow::ShowAboutDialog); } void MainWindow::ConnectToolBar() @@ -256,3 +258,9 @@ void MainWindow::ShowPathsDialog() m_paths_dialog->raise(); m_paths_dialog->activateWindow(); } + +void MainWindow::ShowAboutDialog() +{ + AboutDialog* about = new AboutDialog(this); + about->show(); +} diff --git a/Source/Core/DolphinQt2/MainWindow.h b/Source/Core/DolphinQt2/MainWindow.h index ab81a57e9f..e772a0e4a1 100644 --- a/Source/Core/DolphinQt2/MainWindow.h +++ b/Source/Core/DolphinQt2/MainWindow.h @@ -55,6 +55,7 @@ private: void HideRenderWidget(); void ShowPathsDialog(); + void ShowAboutDialog(); QStackedWidget* m_stack; ToolBar* m_tool_bar; diff --git a/Source/Core/DolphinQt2/MenuBar.cpp b/Source/Core/DolphinQt2/MenuBar.cpp index c6605d4259..7e90263b74 100644 --- a/Source/Core/DolphinQt2/MenuBar.cpp +++ b/Source/Core/DolphinQt2/MenuBar.cpp @@ -3,8 +3,10 @@ // Refer to the license.txt file included. #include -#include +#include +#include +#include "DolphinQt2/AboutDialog.h" #include "DolphinQt2/MenuBar.h" #include "DolphinQt2/Settings.h" @@ -17,7 +19,7 @@ MenuBar::MenuBar(QWidget* parent) addMenu(tr("Options")); addMenu(tr("Tools")); AddViewMenu(); - addMenu(tr("Help")); + AddHelpMenu(); } void MenuBar::AddFileMenu() @@ -35,6 +37,17 @@ void MenuBar::AddViewMenu() AddTableColumnsMenu(view_menu); } +void MenuBar::AddHelpMenu() +{ + QMenu* help_menu = addMenu(tr("Help")); + QAction* documentation = help_menu->addAction(tr("Online Documentation")); + connect(documentation, &QAction::triggered, this, [=]() { + QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/docs/guides"))); + }); + help_menu->addAction(tr("About"), this, SIGNAL(ShowAboutDialog())); +} + + void MenuBar::AddGameListTypeSection(QMenu* view_menu) { QAction* table_view = view_menu->addAction(tr("Table")); diff --git a/Source/Core/DolphinQt2/MenuBar.h b/Source/Core/DolphinQt2/MenuBar.h index 4252151f86..a9442956c8 100644 --- a/Source/Core/DolphinQt2/MenuBar.h +++ b/Source/Core/DolphinQt2/MenuBar.h @@ -21,9 +21,12 @@ signals: void ShowTable(); void ShowList(); + void ShowAboutDialog(); + private: void AddFileMenu(); void AddViewMenu(); + void AddHelpMenu(); void AddGameListTypeSection(QMenu* view_menu); void AddTableColumnsMenu(QMenu* view_menu);