diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..7d8b9393f8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "Externals/Qt"] + path = Externals/Qt + url = https://github.com/dolphin-emu/ext-win-qt.git + branch = master diff --git a/CMakeLists.txt b/CMakeLists.txt index 25cac0851e..eb271feaf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,14 @@ ######################################## # General setup # -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.8) option(ANDROID "Enables a build for Android" OFF) option(USE_EGL "Enables EGL OpenGL Interface" OFF) option(TRY_X11 "Enables X11 Support" ON) option(USE_UPNP "Enables UPnP port mapping support" ON) -option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF) +option(DISABLE_WX "Disable wxWidgets (use Qt or CLI interface)" OFF) +option(ENABLE_QT "Enable Qt (use the experimental Qt interface)" OFF) option(ENABLE_PCH "Use PCH to speed up compilation" ON) option(ENABLE_LTO "Enables Link Time Optimization" OFF) option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF) @@ -640,6 +641,11 @@ if (ANDROID) add_subdirectory(Externals/libiconv-1.14) endif() +if(ENABLE_QT) + find_package(Qt5Widgets REQUIRED) + message("Found Qt version ${Qt5Core_VERSION}, enabling the Qt backend") +endif() + if(NOT DISABLE_WX AND NOT ANDROID) include(FindwxWidgets OPTIONAL) FIND_PACKAGE(wxWidgets COMPONENTS core aui adv) diff --git a/Externals/Qt b/Externals/Qt new file mode 160000 index 0000000000..e2e0b15688 --- /dev/null +++ b/Externals/Qt @@ -0,0 +1 @@ +Subproject commit e2e0b15688568c58ec17b9c22a0dc1969f69b5da diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index 7b4042b604..2563294778 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -6,3 +6,7 @@ add_subdirectory(DolphinWX) add_subdirectory(InputCommon) add_subdirectory(VideoCommon) add_subdirectory(VideoBackends) + +if(ENABLE_QT) + add_subdirectory(DolphinQt) +endif() diff --git a/Source/Core/DolphinQt/AboutDialog.cpp b/Source/Core/DolphinQt/AboutDialog.cpp new file mode 100644 index 0000000000..f76fe2decc --- /dev/null +++ b/Source/Core/DolphinQt/AboutDialog.cpp @@ -0,0 +1,33 @@ +// Copyright 2014 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include +#include + +#include "AboutDialog.h" +#include "ui_AboutDialog.h" +#include "Common/Common.h" +#include "Common/StdMakeUnique.h" + +DAboutDialog::DAboutDialog(QWidget* p) + : QDialog(p) +{ + ui = std::make_unique(); + ui->setupUi(this); + ui->label->setText(ui->label->text().arg(QLatin1String(scm_desc_str), + QStringLiteral("2014"), + QLatin1String(scm_branch_str), + QLatin1String(scm_rev_git_str), + QStringLiteral(__DATE__), + QStringLiteral(__TIME__))); +} + +DAboutDialog::~DAboutDialog() +{ +} + +void DAboutDialog::on_label_linkActivated(const QString &link) +{ + QDesktopServices::openUrl(QUrl(link)); +} diff --git a/Source/Core/DolphinQt/AboutDialog.h b/Source/Core/DolphinQt/AboutDialog.h new file mode 100644 index 0000000000..74b13e0a0a --- /dev/null +++ b/Source/Core/DolphinQt/AboutDialog.h @@ -0,0 +1,28 @@ +// Copyright 2014 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +// Predefinitions +namespace Ui { +class DAboutDialog; +} + +class DAboutDialog : public QDialog +{ + Q_OBJECT + +public: + explicit DAboutDialog(QWidget* p = nullptr); + ~DAboutDialog(); + +private slots: + void on_label_linkActivated(const QString& link); + +private: + std::unique_ptr ui; +}; diff --git a/Source/Core/DolphinQt/AboutDialog.ui b/Source/Core/DolphinQt/AboutDialog.ui new file mode 100644 index 0000000000..339140d79c --- /dev/null +++ b/Source/Core/DolphinQt/AboutDialog.ui @@ -0,0 +1,103 @@ + + + DAboutDialog + + + + 0 + 0 + 375 + 534 + + + + + 0 + 0 + + + + + 375 + 0 + + + + + 375 + 16777215 + + + + About Dolphin + + + + + + + 0 + 0 + + + + <big><b>Dolphin</b></big> %1<br> +© 2003-%2 Dolphin Team<br> +Branch: %3<br> +Revision: %4<br> +Compiled: %5 @ %6<br> +Dolphin is a GameCube/Wii emulator, which was originally written by F|RES and ector. Today Dolphin is an open source project with many contributors, too many to list. If interested, just go check out <a href="https://github.com/dolphin-emu/dolphin">the project page</a>.<br> +<br> +Special thanks to Bushing, Costis, CrowTRobo, Marcan, Segher, Titanik, or9, and Hotquik for their reverse engineering and docs/demos.<br> +<br> +Big thanks to Gilles Mouchard whose Microlib PPC emulator gave our development a kickstart.<br> +<br> +Thanks to Frank Wille for his PowerPC disassembler, which or9 and we modified to include Gekko specifics.<br> +<br> +Thanks to hcs/destop for their GC ADPCM decoder.<br> +<br> +We are not affiliated with Nintendo in any way. GameCube and Wii are trademarks of Nintendo. This emulator should not be used to play games you do not legally own. + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DAboutDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt new file mode 100644 index 0000000000..afd108efaf --- /dev/null +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -0,0 +1,28 @@ +# because of generated UI files +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +set(CMAKE_AUTOMOC ON) + +set(SRCS + AboutDialog.cpp + AboutDialog.h + Main.cpp + MainWindow.cpp + MainWindow.h) + +set(UIS + AboutDialog.ui + MainWindow.ui) + +set(LIBS common) + +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(DOLPHINQT_BINARY DolphinQt) +else() + set(DOLPHINQT_BINARY dolphin-emu-qt) +endif() + +qt5_wrap_ui(UI_HEADERS ${UIS}) +add_executable(${DOLPHINQT_BINARY} ${SRCS} ${UI_HEADERS}) +target_link_libraries(${DOLPHINQT_BINARY} ${LIBS}) +qt5_use_modules(${DOLPHINQT_BINARY} Widgets) diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj b/Source/Core/DolphinQt/DolphinQt.vcxproj new file mode 100644 index 0000000000..f137547714 --- /dev/null +++ b/Source/Core/DolphinQt/DolphinQt.vcxproj @@ -0,0 +1,152 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0} + + + + + Application + v120 + Unicode + + + true + + + false + + + + + + + + + + + + + + + 0x00400000 + false + true + $(ExternalsDir)OpenAL\$(PlatformName);%(AdditionalLibraryDirectories) + iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {8ada04d7-6db1-4da4-ab55-64fb12a0997b} + + + {4c9f135b-a85e-430c-bad4-4c67ef5fc12c} + + + {ab993f38-c31d-4897-b139-a620c42bc565} + + + {93d73454-2512-424e-9cda-4bb357fe13dd} + + + {ff213b23-2c26-4214-9f88-85271e557e87} + + + {54aa7840-5beb-4a0c-9452-74ba4cc7fd44} + + + {2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4} + + + {41279555-f94f-4ebc-99de-af863c10c5c4} + + + {e54cf649-140e-4255-81a5-30a673c1fb36} + + + {160bdc25-5626-4b0d-bdd8-2953d9777fb5} + + + {6bbd47cf-91fd-4077-b676-8b76980178a9} + + + {96020103-4ba5-4fd2-b4aa-5b6d24492d4e} + + + {ec1a314c-5588-4506-9c1e-2e58e5817f75} + + + {a4c423aa-f57c-46c7-a172-d1a777017d29} + + + {3de9ee35-3e91-4f27-a014-2866ad8c3fe3} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj.user b/Source/Core/DolphinQt/DolphinQt.vcxproj.user new file mode 100644 index 0000000000..422ab248b9 --- /dev/null +++ b/Source/Core/DolphinQt/DolphinQt.vcxproj.user @@ -0,0 +1,10 @@ + + + + + $(BinaryOutputDir)$(TargetFileName) + $(BinaryOutputDir) + WindowsLocalDebugger + false + + \ No newline at end of file diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp new file mode 100644 index 0000000000..f2b034fadb --- /dev/null +++ b/Source/Core/DolphinQt/Main.cpp @@ -0,0 +1,54 @@ +// Copyright 2014 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include +#include +#include +#include +#include +#include + +#include "MainWindow.h" + +static bool IsOsSupported() +{ +#ifdef Q_OS_OSX + return QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7; +#elif defined(Q_OS_WIN) + return (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) >= QSysInfo::WV_VISTA; +#else + return true; +#endif +} + +static QString LowestSupportedOsVersion() +{ +#ifdef Q_OS_OSX + return QStringLiteral("Mac OS X 10.7"); +#elif defined(Q_OS_WIN) + return QStringLiteral("Windows Vista SP2"); +#else + return QStringLiteral("Unknown"); +#endif +} + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv); + // TODO: Add command line options + + if (!IsOsSupported()) + { + QMessageBox::critical(nullptr, QObject::tr("Unsupported OS"), + QObject::tr("Dolphin requires %1 or greater.\n" + "Please upgrade to %1 or greater to use Dolphin.") + .arg(LowestSupportedOsVersion())); + return 1; + } + + DMainWindow w; + w.show(); + + return app.exec(); +} diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp new file mode 100644 index 0000000000..2b82949b01 --- /dev/null +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -0,0 +1,43 @@ +// Copyright 2014 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include +#include + +#include "AboutDialog.h" +#include "MainWindow.h" +#include "ui_MainWindow.h" +#include "Common/StdMakeUnique.h" + +DMainWindow::DMainWindow(QWidget* p) + : QMainWindow(p) +{ + ui = std::make_unique(); + ui->setupUi(this); +} + +DMainWindow::~DMainWindow() +{ +} + +void DMainWindow::on_actWebsite_triggered() +{ + QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/"))); +} + +void DMainWindow::on_actOnlineDocs_triggered() +{ + QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/docs/guides/"))); +} + +void DMainWindow::on_actGitHub_triggered() +{ + QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/dolphin-emu/dolphin/"))); +} + +void DMainWindow::on_actAbout_triggered() +{ + DAboutDialog dlg; + dlg.exec(); +} diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h new file mode 100644 index 0000000000..5757bfe8ba --- /dev/null +++ b/Source/Core/DolphinQt/MainWindow.h @@ -0,0 +1,33 @@ +// Copyright 2014 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +// Predefinitions +namespace Ui { +class DMainWindow; +} + +class DMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit DMainWindow(QWidget* p = nullptr); + ~DMainWindow(); + +private slots: + + // Help menu + void on_actWebsite_triggered(); + void on_actOnlineDocs_triggered(); + void on_actGitHub_triggered(); + void on_actAbout_triggered(); + +private: + std::unique_ptr ui; +}; diff --git a/Source/Core/DolphinQt/MainWindow.ui b/Source/Core/DolphinQt/MainWindow.ui new file mode 100644 index 0000000000..29200f44a5 --- /dev/null +++ b/Source/Core/DolphinQt/MainWindow.ui @@ -0,0 +1,115 @@ + + + DMainWindow + + + + 0 + 0 + 998 + 598 + + + + Dolphin + + + + 64 + 64 + + + + Qt::ToolButtonTextUnderIcon + + + true + + + + + + 0 + 0 + 998 + 24 + + + + + Fi&le + + + + + E&mulation + + + + + Optio&ns + + + + + Tools + + + + + &View + + + + + Help + + + + + + + + + + + + + + + + + + toolBar + + + TopToolBarArea + + + false + + + + + &Website + + + + + &Online Documentation + + + + + &Dolphin at GitHub + + + + + &About + + + + + + diff --git a/Source/VSProps/QtCompile.props b/Source/VSProps/QtCompile.props new file mode 100644 index 0000000000..675787e3db --- /dev/null +++ b/Source/VSProps/QtCompile.props @@ -0,0 +1,133 @@ + + + + $(ExternalsDir)Qt\Qt5.3.1\5.3\msvc2013_64_opengl\ + $(QTDIRDefault) + $(QTDIR)\ + false + true + $(QTDIR)include\ + $(QTDIR)lib\ + $(QTDIR)bin\ + $(IntDir) + $(QtToolOutDir)moc_ + d + + + + QT_NO_DEBUG;%(PreprocessorDefinitions) + QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) + QT_USE_QSTRINGBUILDER;QT_NO_CAST_FROM_ASCII;QT_NO_CAST_TO_ASCII;%(PreprocessorDefinitions) + $(ProjectDir);%(AdditionalIncludeDirectories) + $(QtToolOutDir);%(AdditionalIncludeDirectories) + $(QtIncludeDir);%(AdditionalIncludeDirectories) + $(QtIncludeDir)QtCore;%(AdditionalIncludeDirectories) + $(QtIncludeDir)QtGui;%(AdditionalIncludeDirectories) + $(QtIncludeDir)QtWidgets;%(AdditionalIncludeDirectories) + + + $(QtLibDir);%(AdditionalLibraryDirectories) + qtmain$(QtLibSuffix).lib;Qt5Core$(QtLibSuffix).lib;Qt5Gui$(QtLibSuffix).lib;Qt5Widgets$(QtLibSuffix).lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_SECURE_SCL=0 -D_ARCH_64=1 -D_M_X86_64=1 -DPSAPI_VERSION=1 -D_M_X86=1 -DUSE_UPNP -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_UNICODE -DUNICODE + -DQT_NO_DEBUG -DNDEBUG $(MocDefines) + -I$(QtIncludeDir)QtWidgets -I$(QtIncludeDir)QtGui -I$(QtIncludeDir)QtCore -I$(QtIncludeDir) -I$(QtToolOutDir) -I. + -I$(ExternalsDir)zlib -I$(ExternalsDir)SOIL -I$(ExternalsDir)SFML\include -I$(ExternalsDir)portaudio\include -I$(ExternalsDir)polarssl\include -I$(ExternalsDir)miniupnpc\src -I$(ExternalsDir)LZO -I$(ExternalsDir)libusbx\libusb -I$(ExternalsDir)libpng -I$(ExternalsDir)GL -I$(ExternalsDir)Bochs_disasm -I$(ExternalsDir) -I$(CoreDir) $(MocIncludes) + + + + + + + + + + + + + + + + + + + + QtResource + + + QtUi + + + QtMoc + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/VSProps/QtCompile.targets b/Source/VSProps/QtCompile.targets new file mode 100644 index 0000000000..c12753982e --- /dev/null +++ b/Source/VSProps/QtCompile.targets @@ -0,0 +1,10 @@ + + + + QtResourceClean;QtUiClean;QtMocClean;$(CleanDependsOn) + + + \ No newline at end of file diff --git a/Source/VSProps/QtCompile.xml b/Source/VSProps/QtCompile.xml new file mode 100644 index 0000000000..976c2d2b82 --- /dev/null +++ b/Source/VSProps/QtCompile.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Source/dolphin-emu.sln b/Source/dolphin-emu.sln index 141580ca87..d622212281 100644 --- a/Source/dolphin-emu.sln +++ b/Source/dolphin-emu.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 12.0.30723.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\DolphinWX.vcxproj", "{47411FDB-1BF2-48D0-AB4E-C7C41160F898}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DolphinQt", "Core\DolphinQt\DolphinQt.vcxproj", "{69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core\Core.vcxproj", "{E54CF649-140E-4255-81A5-30A673C1FB36}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioCommon", "Core\AudioCommon\AudioCommon.vcxproj", "{54AA7840-5BEB-4A0C-9452-74BA4CC7FD44}" @@ -73,6 +75,10 @@ Global {47411FDB-1BF2-48D0-AB4E-C7C41160F898}.Debug|x64.Build.0 = Debug|x64 {47411FDB-1BF2-48D0-AB4E-C7C41160F898}.Release|x64.ActiveCfg = Release|x64 {47411FDB-1BF2-48D0-AB4E-C7C41160F898}.Release|x64.Build.0 = Release|x64 + {69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0}.Debug|x64.ActiveCfg = Debug|x64 + {69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0}.Debug|x64.Build.0 = Debug|x64 + {69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0}.Release|x64.ActiveCfg = Release|x64 + {69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0}.Release|x64.Build.0 = Release|x64 {E54CF649-140E-4255-81A5-30A673C1FB36}.Debug|x64.ActiveCfg = Debug|x64 {E54CF649-140E-4255-81A5-30A673C1FB36}.Debug|x64.Build.0 = Debug|x64 {E54CF649-140E-4255-81A5-30A673C1FB36}.Release|x64.ActiveCfg = Release|x64