Merge pull request #3623 from rukai/dolphinQtAbout

DQt2: About Dialog
This commit is contained in:
Mathew Maidment 2016-03-09 03:16:40 -05:00
commit 1c7f5b139d
7 changed files with 111 additions and 2 deletions

View File

@ -0,0 +1,68 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <QLabel>
#include <QTextEdit>
#include <QVBoxLayout>
#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("<p style='margin-top:0px; margin-bottom:0px; font-size:9pt;'>");
QString medium = QStringLiteral("<p style='margin-top:15px; font-size:11pt;'>");
text.append(QStringLiteral("<p style='font-size:50pt; font-weight:400; margin-bottom:0px;'>") +
tr("Dolphin") + QStringLiteral("</p>"));
text.append(QStringLiteral("<p style='font-size:18pt; margin-top:0px;'>%1</p>")
.arg(QString::fromUtf8(scm_desc_str)));
text.append(small + tr("Branch: ") + QString::fromUtf8(scm_branch_str) + QStringLiteral("</p>"));
text.append(small + tr("Revision: ") + QString::fromUtf8(scm_rev_git_str) + QStringLiteral("</p>"));
text.append(small + tr("Compiled: ") + QStringLiteral(__DATE__ " " __TIME__ "</p>"));
text.append(medium + tr("Check for updates: ") +
QStringLiteral("<a href='https://dolphin-emu.org/download'>dolphin-emu.org/download</a></p>"));
text.append(medium + tr("Dolphin is a free and open-source GameCube and Wii emulator.") + QStringLiteral("</p>"));
text.append(medium + tr("This software should not be used to play games you do not legally own.") + QStringLiteral("</p>"));
text.append(medium + QStringLiteral(
"<a href='https://github.com/dolphin-emu/dolphin/blob/master/license.txt'>%1</a> | "
"<a href='https://github.com/dolphin-emu/dolphin/graphs/contributors'>%2</a> | "
"<a href='https://forums.dolphin-emu.org/'>%3</a></p>"
).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);
}

View File

@ -0,0 +1,15 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <QDialog>
class AboutDialog final : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget* parent = nullptr);
};

View File

@ -4,6 +4,7 @@ add_definitions(-DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(SRCS set(SRCS
AboutDialog.cpp
Host.cpp Host.cpp
Main.cpp Main.cpp
MainWindow.cpp MainWindow.cpp

View File

@ -10,6 +10,7 @@
#include "Core/BootManager.h" #include "Core/BootManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "DolphinQt2/AboutDialog.h"
#include "DolphinQt2/Host.h" #include "DolphinQt2/Host.h"
#include "DolphinQt2/MainWindow.h" #include "DolphinQt2/MainWindow.h"
#include "DolphinQt2/Resources.h" #include "DolphinQt2/Resources.h"
@ -54,6 +55,7 @@ void MainWindow::ConnectMenuBar()
connect(m_menu_bar, &MenuBar::Exit, this, &MainWindow::close); 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::ShowTable, m_game_list, &GameList::SetTableView);
connect(m_menu_bar, &MenuBar::ShowList, m_game_list, &GameList::SetListView); connect(m_menu_bar, &MenuBar::ShowList, m_game_list, &GameList::SetListView);
connect(m_menu_bar, &MenuBar::ShowAboutDialog, this, &MainWindow::ShowAboutDialog);
} }
void MainWindow::ConnectToolBar() void MainWindow::ConnectToolBar()
@ -261,3 +263,9 @@ void MainWindow::ShowPathsDialog()
m_paths_dialog->raise(); m_paths_dialog->raise();
m_paths_dialog->activateWindow(); m_paths_dialog->activateWindow();
} }
void MainWindow::ShowAboutDialog()
{
AboutDialog* about = new AboutDialog(this);
about->show();
}

View File

@ -56,6 +56,7 @@ private:
void HideRenderWidget(); void HideRenderWidget();
void ShowPathsDialog(); void ShowPathsDialog();
void ShowAboutDialog();
QStackedWidget* m_stack; QStackedWidget* m_stack;
ToolBar* m_tool_bar; ToolBar* m_tool_bar;

View File

@ -3,8 +3,10 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <QAction> #include <QAction>
#include <QActionGroup> #include <QDesktopServices>
#include <QUrl>
#include "DolphinQt2/AboutDialog.h"
#include "DolphinQt2/MenuBar.h" #include "DolphinQt2/MenuBar.h"
#include "DolphinQt2/Settings.h" #include "DolphinQt2/Settings.h"
@ -17,7 +19,7 @@ MenuBar::MenuBar(QWidget* parent)
addMenu(tr("Options")); addMenu(tr("Options"));
addMenu(tr("Tools")); addMenu(tr("Tools"));
AddViewMenu(); AddViewMenu();
addMenu(tr("Help")); AddHelpMenu();
} }
void MenuBar::AddFileMenu() void MenuBar::AddFileMenu()
@ -35,6 +37,17 @@ void MenuBar::AddViewMenu()
AddTableColumnsMenu(view_menu); 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) void MenuBar::AddGameListTypeSection(QMenu* view_menu)
{ {
QAction* table_view = view_menu->addAction(tr("Table")); QAction* table_view = view_menu->addAction(tr("Table"));

View File

@ -21,9 +21,12 @@ signals:
void ShowTable(); void ShowTable();
void ShowList(); void ShowList();
void ShowAboutDialog();
private: private:
void AddFileMenu(); void AddFileMenu();
void AddViewMenu(); void AddViewMenu();
void AddHelpMenu();
void AddGameListTypeSection(QMenu* view_menu); void AddGameListTypeSection(QMenu* view_menu);
void AddTableColumnsMenu(QMenu* view_menu); void AddTableColumnsMenu(QMenu* view_menu);