DolphinQt: initial commit.

This adds the beginning of the DolphinQt user interface. It doesn't
do anything useful yet and only builds via CMake.
This commit is contained in:
Augustin Cavalier 2014-09-14 15:03:07 -04:00 committed by Shawn Hoffman
parent 847f78e4cc
commit 16c6a19190
10 changed files with 445 additions and 2 deletions

View File

@ -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)

View File

@ -6,3 +6,7 @@ add_subdirectory(DolphinWX)
add_subdirectory(InputCommon)
add_subdirectory(VideoCommon)
add_subdirectory(VideoBackends)
if(ENABLE_QT)
add_subdirectory(DolphinQt)
endif()

View File

@ -0,0 +1,37 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <QDesktopServices>
#include <QUrl>
#include "AboutDialog.h"
#include "ui_AboutDialog.h"
// TODO
#define scm_desc_str "unknown"
#define scm_branch_str "unknown"
#define scm_rev_git_str "0000000"
DAboutDialog::DAboutDialog(QWidget *p) :
QDialog(p),
ui(new Ui::DAboutDialog)
{
ui->setupUi(this);
ui->label->setText(ui->label->text().arg(scm_desc_str,
"2014",
scm_branch_str,
scm_rev_git_str,
__DATE__,
__TIME__));
}
DAboutDialog::~DAboutDialog()
{
delete ui;
}
void DAboutDialog::on_label_linkActivated(const QString &link)
{
QDesktopServices::openUrl(QUrl(link));
}

View File

@ -0,0 +1,27 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <QDialog>
// Predefinitions
namespace Ui {
class DAboutDialog;
}
class DAboutDialog : public QDialog
{
Q_OBJECT
public:
explicit DAboutDialog(QWidget *p = 0);
~DAboutDialog();
private slots:
void on_label_linkActivated(const QString &link);
private:
Ui::DAboutDialog *ui;
};

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DAboutDialog</class>
<widget class="QDialog" name="DAboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>375</width>
<height>534</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>375</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>375</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>About Dolphin</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;big&gt;&lt;b&gt;Dolphin&lt;/b&gt;&lt;/big&gt; %1&lt;br&gt;
© 2003-%2 Dolphin Team&lt;br&gt;
Branch: %3&lt;br&gt;
Revision: %4&lt;br&gt;
Compiled: %5 @ %6&lt;br&gt;
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 &lt;a href=&quot;https://github.com/dolphin-emu/dolphin&quot;&gt;the project page&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
Special thanks to Bushing, Costis, CrowTRobo, Marcan, Segher, Titanik, or9, and Hotquik for their reverse engineering and docs/demos.&lt;br&gt;
&lt;br&gt;
Big thanks to Gilles Mouchard whose Microlib PPC emulator gave our development a kickstart.&lt;br&gt;
&lt;br&gt;
Thanks to Frank Wille for his PowerPC disassembler, which or9 and we modified to include Gekko specifics.&lt;br&gt;
&lt;br&gt;
Thanks to hcs/destop for their GC ADPCM decoder.&lt;br&gt;
&lt;br&gt;
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.</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DAboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,21 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR}) # because of generated UI files
set(CMAKE_AUTOMOC ON)
set(SRCS AboutDialog.cpp
AboutDialog.h
Main.cpp
MainWindow.cpp
MainWindow.h)
set(UIS AboutDialog.ui
MainWindow.ui)
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})
qt5_use_modules(${DOLPHINQT_BINARY} Widgets)

View File

@ -0,0 +1,54 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <QApplication>
#include <QDesktopServices>
#include <QFile>
#include <QMessageBox>
#include <QSysInfo>
#include <QUrl>
#include "MainWindow.h"
static bool IsOsSupported()
{
#ifdef Q_OS_OSX
return QSysInfo::MacVersion >= 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();
}

View File

@ -0,0 +1,44 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <QDesktopServices>
#include <QUrl>
#include "AboutDialog.h"
#include "MainWindow.h"
#include "ui_MainWindow.h"
DMainWindow::DMainWindow(QWidget *p) :
QMainWindow(p),
ui(new Ui::DMainWindow)
{
ui->setupUi(this);
}
DMainWindow::~DMainWindow()
{
delete ui;
}
void DMainWindow::on_actWebsite_triggered()
{
QDesktopServices::openUrl(QUrl("https://dolphin-emu.org/"));
}
void DMainWindow::on_actOnlineDocs_triggered()
{
QDesktopServices::openUrl(QUrl("https://dolphin-emu.org/docs/guides/"));
}
void DMainWindow::on_actGitHub_triggered()
{
QDesktopServices::openUrl(QUrl("https://github.com/dolphin-emu/dolphin/"));
}
void DMainWindow::on_actAbout_triggered()
{
DAboutDialog dlg;
dlg.exec();
}

View File

@ -0,0 +1,32 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <QMainWindow>
// Predefinitions
namespace Ui {
class DMainWindow;
}
class DMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit DMainWindow(QWidget *p = 0);
~DMainWindow();
private slots:
// Help menu
void on_actWebsite_triggered();
void on_actOnlineDocs_triggered();
void on_actGitHub_triggered();
void on_actAbout_triggered();
private:
Ui::DMainWindow *ui;
};

View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DMainWindow</class>
<widget class="QMainWindow" name="DMainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>998</width>
<height>598</height>
</rect>
</property>
<property name="windowTitle">
<string>Dolphin</string>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<property name="unifiedTitleAndToolBarOnMac">
<bool>true</bool>
</property>
<widget class="QStackedWidget" name="wgtCentral"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>998</width>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="mnuFile">
<property name="title">
<string>Fi&amp;le</string>
</property>
</widget>
<widget class="QMenu" name="mnuEmulation">
<property name="title">
<string>E&amp;mulation</string>
</property>
</widget>
<widget class="QMenu" name="mnuOptions">
<property name="title">
<string>Optio&amp;ns</string>
</property>
</widget>
<widget class="QMenu" name="mnuTools">
<property name="title">
<string>Tools</string>
</property>
</widget>
<widget class="QMenu" name="mnuView">
<property name="title">
<string>&amp;View</string>
</property>
</widget>
<widget class="QMenu" name="mnuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actWebsite"/>
<addaction name="actOnlineDocs"/>
<addaction name="actGitHub"/>
<addaction name="separator"/>
<addaction name="actAbout"/>
</widget>
<addaction name="mnuFile"/>
<addaction name="mnuEmulation"/>
<addaction name="mnuOptions"/>
<addaction name="mnuTools"/>
<addaction name="mnuView"/>
<addaction name="mnuHelp"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolbar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="actWebsite">
<property name="text">
<string>&amp;Website</string>
</property>
</action>
<action name="actOnlineDocs">
<property name="text">
<string>&amp;Online Documentation</string>
</property>
</action>
<action name="actGitHub">
<property name="text">
<string>&amp;Dolphin at GitHub</string>
</property>
</action>
<action name="actAbout">
<property name="text">
<string>&amp;About</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>