From 3e4cea7f6fdd5c1588402908bcd62362bf9a8313 Mon Sep 17 00:00:00 2001 From: EmptyChaos Date: Wed, 13 Jul 2016 01:11:29 +0000 Subject: [PATCH 1/2] DolphinQt2: Fix MSBuild for Visual Studio. Null VideoBackend is not being linked correctly. --- Source/Core/DolphinQt2/DolphinQt2.vcxproj | 3 +++ Source/Core/DolphinQt2/MainWindow.cpp | 1 + Source/dolphin-emu.sln | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt2/DolphinQt2.vcxproj b/Source/Core/DolphinQt2/DolphinQt2.vcxproj index 1c69275b5b..d44d38f533 100644 --- a/Source/Core/DolphinQt2/DolphinQt2.vcxproj +++ b/Source/Core/DolphinQt2/DolphinQt2.vcxproj @@ -189,6 +189,9 @@ {a4c423aa-f57c-46c7-a172-d1a777017d29} + + {53A5391B-737E-49A8-BC8F-312ADA00736F} + {3de9ee35-3e91-4f27-a014-2866ad8c3fe3} diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index 7d9cf61820..012e9c1209 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -8,6 +8,7 @@ #include #include "Core/BootManager.h" +#include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/HW/ProcessorInterface.h" #include "Core/Movie.h" diff --git a/Source/dolphin-emu.sln b/Source/dolphin-emu.sln index 88595c8d44..b0b19982ae 100644 --- a/Source/dolphin-emu.sln +++ b/Source/dolphin-emu.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\DolphinWX.vcxproj", "{47411FDB-1BF2-48D0-AB4E-C7C41160F898}" EndProject @@ -73,6 +73,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "curl", "..\Externals\curl\curl.vcxproj", "{BB00605C-125F-4A21-B33B-7BF418322DCB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D3D12", "Core\VideoBackends\D3D12\D3D12.vcxproj", "{570215B7-E32F-4438-95AE-C8D955F9FCA3}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DolphinQt2", "Core\DolphinQt2\DolphinQt2.vcxproj", "{FA3FA62B-6F58-4B86-9453-4D149940A066}" EndProject Global From 0efb19e66afa3bda97a8ebb0cce47b923fbc7084 Mon Sep 17 00:00:00 2001 From: EmptyChaos Date: Wed, 13 Jul 2016 05:52:45 +0000 Subject: [PATCH 2/2] DolphinQt2: Experimental GUI Warning Prompt. Add a GUI prompt to tell users not to use DolphinQt by accident. --- Source/Core/DolphinQt2/CMakeLists.txt | 1 + Source/Core/DolphinQt2/DolphinQt2.vcxproj | 7 +- .../DolphinQt2/DolphinQt2.vcxproj.filters | 7 +- .../Core/DolphinQt2/InDevelopmentWarning.cpp | 120 ++++++++++++++++++ Source/Core/DolphinQt2/InDevelopmentWarning.h | 16 +++ Source/Core/DolphinQt2/Main.cpp | 17 ++- Source/Core/DolphinQt2/Settings.cpp | 7 + Source/Core/DolphinQt2/Settings.h | 1 + 8 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 Source/Core/DolphinQt2/InDevelopmentWarning.cpp create mode 100644 Source/Core/DolphinQt2/InDevelopmentWarning.h diff --git a/Source/Core/DolphinQt2/CMakeLists.txt b/Source/Core/DolphinQt2/CMakeLists.txt index b03d17bdf1..3f73b69d26 100644 --- a/Source/Core/DolphinQt2/CMakeLists.txt +++ b/Source/Core/DolphinQt2/CMakeLists.txt @@ -6,6 +6,7 @@ set(CMAKE_AUTOMOC ON) set(SRCS AboutDialog.cpp Host.cpp + InDevelopmentWarning.cpp Main.cpp MainWindow.cpp MenuBar.cpp diff --git a/Source/Core/DolphinQt2/DolphinQt2.vcxproj b/Source/Core/DolphinQt2/DolphinQt2.vcxproj index d44d38f533..5605bd5ce3 100644 --- a/Source/Core/DolphinQt2/DolphinQt2.vcxproj +++ b/Source/Core/DolphinQt2/DolphinQt2.vcxproj @@ -1,4 +1,4 @@ - + @@ -90,6 +90,7 @@ + @@ -105,6 +106,7 @@ + @@ -129,6 +131,7 @@ + @@ -230,4 +233,4 @@ - + \ No newline at end of file diff --git a/Source/Core/DolphinQt2/DolphinQt2.vcxproj.filters b/Source/Core/DolphinQt2/DolphinQt2.vcxproj.filters index 77def9d722..b9292a98ea 100644 --- a/Source/Core/DolphinQt2/DolphinQt2.vcxproj.filters +++ b/Source/Core/DolphinQt2/DolphinQt2.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -87,6 +87,10 @@ Generated Files + + + Generated Files + @@ -119,6 +123,7 @@ + diff --git a/Source/Core/DolphinQt2/InDevelopmentWarning.cpp b/Source/Core/DolphinQt2/InDevelopmentWarning.cpp new file mode 100644 index 0000000000..5defcfb52e --- /dev/null +++ b/Source/Core/DolphinQt2/InDevelopmentWarning.cpp @@ -0,0 +1,120 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "DolphinQt2/InDevelopmentWarning.h" +#include "DolphinQt2/Resources.h" + +static bool LaunchDolphinWX() +{ + QFileInfo file_info; + for (auto path : {"/Dolphin.exe", "/dolphin-emu", "/Dolphin"}) + { + file_info.setFile(qApp->applicationDirPath() + QString::fromUtf8(path)); + if (file_info.isExecutable()) + return QProcess::startDetached(file_info.absoluteFilePath(), {}); + } + return false; +} + +InDevelopmentWarning::InDevelopmentWarning(QWidget* parent) + : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint) +{ + QWidget* container = new QWidget(this); + QDialogButtonBox* std_buttons = + new QDialogButtonBox(QDialogButtonBox::Cancel, Qt::Horizontal, this); + QLabel* heading = new QLabel(container); + QLabel* icon = new QLabel(container); + QLabel* body = new QLabel(container); + + QCommandLinkButton* btn_dolphinwx = new QCommandLinkButton( + tr("Run DolphinWX Instead"), tr("Recommended for normal users"), container); + QCommandLinkButton* btn_run = new QCommandLinkButton(tr("Use DolphinQt Anyway"), container); + + container->setForegroundRole(QPalette::Text); + container->setBackgroundRole(QPalette::Base); + container->setAutoFillBackground(true); + + std_buttons->setContentsMargins(10, 0, 10, 0); + + QFont heading_font{heading->font()}; + heading_font.setPointSizeF(heading_font.pointSizeF() * 1.5); + heading->setFont(heading_font); + heading->setText(tr("DolphinQt Experimental GUI")); + heading->setForegroundRole(QPalette::Text); + heading->setAlignment(Qt::AlignTop | Qt::AlignLeft); + + icon->setPixmap(style()->standardPixmap(QStyle::SP_MessageBoxWarning, nullptr, this)); + icon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + QString body_text = tr( + "

DolphinQt is a new experimental GUI that is eventually intended to replace " + "the current GUI based on wxWidgets. The implementation is very " + "incomplete, even basic functionality like changing settings and " + "attaching gamepads may be missing or not work at all.

\n" + "

Only developers working on the DolphinQt implementation should use it at " + "the present time; normal users are recommended to continue using the " + "older DolphinWX GUI for the time being.

\n" + "

Bug Reports: At the current time there is no point making bug reports " + "about the DolphinQt GUI as the list of what is broken is much longer " + "than the list of things that work.

\n"); + body->setText(body_text); + body->setWordWrap(true); + body->setForegroundRole(QPalette::Text); + body->setAlignment(Qt::AlignTop | Qt::AlignLeft); + body->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + btn_dolphinwx->setDefault(true); + + connect(btn_dolphinwx, &QCommandLinkButton::clicked, this, [this](bool) { + if (!LaunchDolphinWX()) + QMessageBox::critical( + this, tr("Failed to launch"), + tr("Could not start DolphinWX. Check for dolphin.exe in the installation directory.")); + reject(); + }); + connect(btn_run, &QCommandLinkButton::clicked, this, [this](bool) { accept(); }); + connect(std_buttons->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, + [this](bool) { reject(); }); + + QVBoxLayout* body_column = new QVBoxLayout(); + body_column->addWidget(heading); + body_column->addSpacing(10); + body_column->addWidget(body); + body_column->addWidget(btn_dolphinwx); + body_column->addSpacing(10); + body_column->addWidget(btn_run); + body_column->setMargin(0); + body_column->setSpacing(0); + + QHBoxLayout* icon_layout = new QHBoxLayout(container); + icon_layout->addWidget(icon, 0, Qt::AlignTop); + icon_layout->addLayout(body_column); + icon_layout->setContentsMargins(15, 10, 10, 10); + icon_layout->setSpacing(15); + + QVBoxLayout* top_layout = new QVBoxLayout(this); + top_layout->addWidget(container); + top_layout->addWidget(std_buttons); + top_layout->setSpacing(10); + top_layout->setContentsMargins(0, 0, 0, 10); + + setWindowIcon(Resources::GetMisc(Resources::LOGO_SMALL)); + setWindowTitle(tr("DolphinQt2 Experimental GUI")); + setMinimumSize(460, 320); + resize(minimumSizeHint()); +} + +InDevelopmentWarning::~InDevelopmentWarning() +{ +} diff --git a/Source/Core/DolphinQt2/InDevelopmentWarning.h b/Source/Core/DolphinQt2/InDevelopmentWarning.h new file mode 100644 index 0000000000..f5a7fb8753 --- /dev/null +++ b/Source/Core/DolphinQt2/InDevelopmentWarning.h @@ -0,0 +1,16 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include + +class InDevelopmentWarning final : public QDialog +{ + Q_OBJECT + +public: + explicit InDevelopmentWarning(QWidget* parent = nullptr); + ~InDevelopmentWarning(); +}; diff --git a/Source/Core/DolphinQt2/Main.cpp b/Source/Core/DolphinQt2/Main.cpp index 3f32763951..6b2186fa6d 100644 --- a/Source/Core/DolphinQt2/Main.cpp +++ b/Source/Core/DolphinQt2/Main.cpp @@ -8,8 +8,10 @@ #include "Core/BootManager.h" #include "Core/Core.h" #include "DolphinQt2/Host.h" +#include "DolphinQt2/InDevelopmentWarning.h" #include "DolphinQt2/MainWindow.h" #include "DolphinQt2/Resources.h" +#include "DolphinQt2/Settings.h" #include "UICommon/UICommon.h" int main(int argc, char* argv[]) @@ -26,9 +28,18 @@ int main(int argc, char* argv[]) QObject::connect(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::aboutToBlock, &app, &Core::HostDispatchJobs); - MainWindow win; - win.show(); - int retval = app.exec(); + int retval = 0; + if (Settings().IsInDevelopmentWarningEnabled()) + { + InDevelopmentWarning warning_box; + retval = warning_box.exec() == QDialog::Rejected; + } + if (!retval) + { + MainWindow win; + win.show(); + retval = app.exec(); + } BootManager::Stop(); Core::Shutdown(); diff --git a/Source/Core/DolphinQt2/Settings.cpp b/Source/Core/DolphinQt2/Settings.cpp index 291f56dee6..d2df0af7b3 100644 --- a/Source/Core/DolphinQt2/Settings.cpp +++ b/Source/Core/DolphinQt2/Settings.cpp @@ -23,6 +23,13 @@ QString Settings::GetThemeDir() const return QString::fromStdString(File::GetThemeDir(theme_name.toStdString())); } +bool Settings::IsInDevelopmentWarningEnabled() const +{ + // There's intentionally no way to set this from the UI. + // Add it to your INI manually instead. + return value(QStringLiteral("ShowDevelopmentWarning"), true).toBool(); +} + QString Settings::GetLastGame() const { return value(QStringLiteral("GameList/LastGame")).toString(); diff --git a/Source/Core/DolphinQt2/Settings.h b/Source/Core/DolphinQt2/Settings.h index 9ecacdf6f1..357ca13f95 100644 --- a/Source/Core/DolphinQt2/Settings.h +++ b/Source/Core/DolphinQt2/Settings.h @@ -18,6 +18,7 @@ public: // UI QString GetThemeDir() const; + bool IsInDevelopmentWarningEnabled() const; // GameList QString GetLastGame() const;