DolphinQt: Stub Host_* functions & Resource system.

This commit is contained in:
Augustin Cavalier 2014-10-18 11:07:17 -04:00
parent 742f9c6b14
commit 8d4068527b
13 changed files with 560 additions and 164 deletions

View File

@ -1,6 +1,7 @@
# because of generated UI files
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII)
set(CMAKE_AUTOMOC ON)
set(SRCS
@ -8,13 +9,17 @@ set(SRCS
AboutDialog.h
Main.cpp
MainWindow.cpp
MainWindow.h)
MainWindow.h
Host.cpp
Utils/Resources.cpp
Utils/Utils.cpp
VideoInterface/VideoInterface.cpp)
set(UIS
AboutDialog.ui
MainWindow.ui)
set(LIBS common)
set(LIBS core uicommon)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DOLPHINQT_BINARY DolphinQt)

View File

@ -1,152 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0}</ProjectGuid>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0}</ProjectGuid>
<!--
Enable this once wxwidgets is completely removed
<ProjectName>Dolphin</ProjectName>
-->
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\VSProps\Base.props" />
<Import Project="..\..\VSProps\PCHUse.props" />
<Import Project="..\..\VSProps\QtCompile.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<BaseAddress>0x00400000</BaseAddress>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<FixedBaseAddress>true</FixedBaseAddress>
<AdditionalLibraryDirectories>$(ExternalsDir)OpenAL\$(PlatformName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!--QRC and UI files are handled automatically-->
<ItemGroup>
<QtResource Include="*.qrc" />
</ItemGroup>
<ItemGroup>
<QtUi Include="*.ui" />
</ItemGroup>
<!--MOC files need to be listed. Perhaps scan for Q_OBJECT in the future? (like automoc)-->
<!--NOTE: When adding moc'd files, you must list the outputs in the following ItemGroup!-->
<ItemGroup>
<QtMoc Include="AboutDialog.h" />
<QtMoc Include="MainWindow.h" />
</ItemGroup>
<!--TODO figure out how to get QtMoc to add outputs to ClCompile's inputs...-->
<ItemGroup>
<ClCompile Include="$(QtMocOutPrefix)AboutDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MainWindow.cpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AboutDialog.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="MainWindow.cpp" />
</ItemGroup>
<!--Put standard C/C++ headers here-->
-->
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\VSProps\Base.props" />
<Import Project="..\..\VSProps\PCHUse.props" />
<Import Project="..\..\VSProps\QtCompile.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<BaseAddress>0x00400000</BaseAddress>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<FixedBaseAddress>true</FixedBaseAddress>
<AdditionalLibraryDirectories>$(ExternalsDir)OpenAL\$(PlatformName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!--QRC and UI files are handled automatically-->
<ItemGroup>
<QtResource Include="*.qrc" />
</ItemGroup>
<ItemGroup>
<QtUi Include="*.ui" />
</ItemGroup>
<!--MOC files need to be listed. Perhaps scan for Q_OBJECT in the future? (like automoc)-->
<!--NOTE: When adding moc'd files, you must list the outputs in the following ItemGroup!-->
<ItemGroup>
<QtMoc Include="AboutDialog.h" />
<QtMoc Include="MainWindow.h" />
</ItemGroup>
<!--TODO figure out how to get QtMoc to add outputs to ClCompile's inputs...-->
<ItemGroup>
<ClCompile Include="$(QtMocOutPrefix)AboutDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MainWindow.cpp" />
<ClCompile Include="Utils\Resources.cpp" />
<ClCompile Include="Utils\Utils.cpp" />
<ClCompile Include="VideoInterface\VideoInterface.cpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AboutDialog.cpp" />
<ClCompile Include="Host.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="MainWindow.cpp" />
</ItemGroup>
<!--Put standard C/C++ headers here-->
<!--
<ItemGroup>
<ClInclude Include="Main.h" />
</ItemGroup>
-->
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(ExternalsDir)Bochs_disasm\Bochs_disasm.vcxproj">
<Project>{8ada04d7-6db1-4da4-ab55-64fb12a0997b}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)libpng\png\png.vcxproj">
<Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)LZO\LZO.vcxproj">
<Project>{ab993f38-c31d-4897-b139-a620c42bc565}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)SFML\build\vc2010\SFML_Network.vcxproj">
<Project>{93d73454-2512-424e-9cda-4bb357fe13dd}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)zlib\zlib.vcxproj">
<Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)AudioCommon\AudioCommon.vcxproj">
<Project>{54aa7840-5beb-4a0c-9452-74ba4cc7fd44}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)Common\SCMRevGen.vcxproj">
<Project>{41279555-f94f-4ebc-99de-af863c10c5c4}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)Core\Core.vcxproj">
<Project>{e54cf649-140e-4255-81a5-30a673c1fb36}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)DiscIO\DiscIO.vcxproj">
<Project>{160bdc25-5626-4b0d-bdd8-2953d9777fb5}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)InputCommon\InputCommon.vcxproj">
<Project>{6bbd47cf-91fd-4077-b676-8b76980178a9}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\D3D\D3D.vcxproj">
<Project>{96020103-4ba5-4fd2-b4aa-5b6d24492d4e}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\OGL\OGL.vcxproj">
<Project>{ec1a314c-5588-4506-9c1e-2e58e5817f75}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\Software\Software.vcxproj">
<Project>{a4c423aa-f57c-46c7-a172-d1a777017d29}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoCommon\VideoCommon.vcxproj">
<Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\VSProps\QtCompile.targets" />
</ImportGroup>
<!--Copy Exe, Data directory and DLLs which should be located in the executable directory-->
<ItemGroup>
<DataDirFiles Include="$(DolphinRootDir)Data\**\*.*" />
<ExternalDlls Include="$(ExternalsDir)OpenAL\$(PlatformName)\*.dll;$(ExternalsDir)msvcrt\$(PlatformName)\*.dll" />
<BinaryFiles Include="$(TargetPath)" />
<AllInputFiles Include="@(DataDirFiles);@(ExternalDlls);@(BinaryFiles)" />
</ItemGroup>
<!--Disable copying to binary dir for now on the buildbot to prevent packaging of the outputs-->
<Target Name="AfterBuild" Inputs="@(AllInputFiles)" Outputs="@(AllInputFiles -> '$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(Extension)')"
Condition="'$(I_AM_BUILDACUS)'==''">
<Message Text="Copying Data directory..." Importance="High" />
<Copy SourceFiles="@(DataDirFiles)" DestinationFolder="$(BinaryOutputDir)%(RecursiveDir)" Condition="!Exists('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(DataDirFiles.Extension)') OR $([System.DateTime]::Parse('%(ModifiedTime)').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(DataDirFiles.Extension)').Ticks)" />
<Message Text="Copying External .dlls" Importance="High" />
<Copy SourceFiles="@(ExternalDlls)" DestinationFolder="$(BinaryOutputDir)" Condition="!Exists('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)') OR $([System.DateTime]::Parse('%(ModifiedTime)').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)').Ticks)" />
<Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" />
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" />
</Target>
-->
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(ExternalsDir)Bochs_disasm\Bochs_disasm.vcxproj">
<Project>{8ada04d7-6db1-4da4-ab55-64fb12a0997b}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)libpng\png\png.vcxproj">
<Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)LZO\LZO.vcxproj">
<Project>{ab993f38-c31d-4897-b139-a620c42bc565}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)SFML\build\vc2010\SFML_Network.vcxproj">
<Project>{93d73454-2512-424e-9cda-4bb357fe13dd}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)zlib\zlib.vcxproj">
<Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)AudioCommon\AudioCommon.vcxproj">
<Project>{54aa7840-5beb-4a0c-9452-74ba4cc7fd44}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)Common\SCMRevGen.vcxproj">
<Project>{41279555-f94f-4ebc-99de-af863c10c5c4}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)Core\Core.vcxproj">
<Project>{e54cf649-140e-4255-81a5-30a673c1fb36}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)DiscIO\DiscIO.vcxproj">
<Project>{160bdc25-5626-4b0d-bdd8-2953d9777fb5}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)InputCommon\InputCommon.vcxproj">
<Project>{6bbd47cf-91fd-4077-b676-8b76980178a9}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\D3D\D3D.vcxproj">
<Project>{96020103-4ba5-4fd2-b4aa-5b6d24492d4e}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\OGL\OGL.vcxproj">
<Project>{ec1a314c-5588-4506-9c1e-2e58e5817f75}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\Software\Software.vcxproj">
<Project>{a4c423aa-f57c-46c7-a172-d1a777017d29}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoCommon\VideoCommon.vcxproj">
<Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)UICommon\UICommon.vcxproj">
<Project>{604C8368-F34A-4D55-82C8-CC92A0C13254}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\VSProps\QtCompile.targets" />
</ImportGroup>
<!--Copy Exe, Data directory and DLLs which should be located in the executable directory-->
<ItemGroup>
<DataDirFiles Include="$(DolphinRootDir)Data\**\*.*" />
<ExternalDlls Include="$(ExternalsDir)OpenAL\$(PlatformName)\*.dll;$(ExternalsDir)msvcrt\$(PlatformName)\*.dll" />
<BinaryFiles Include="$(TargetPath)" />
<AllInputFiles Include="@(DataDirFiles);@(ExternalDlls);@(BinaryFiles)" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Utils\Resources.h" />
<ClInclude Include="Utils\Utils.h" />
</ItemGroup>
<!--Disable copying to binary dir for now on the buildbot to prevent packaging of the outputs-->
<Target Name="AfterBuild" Inputs="@(AllInputFiles)" Outputs="@(AllInputFiles -> '$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(Extension)')" Condition="'$(I_AM_BUILDACUS)'==''">
<Message Text="Copying Data directory..." Importance="High" />
<Copy SourceFiles="@(DataDirFiles)" DestinationFolder="$(BinaryOutputDir)%(RecursiveDir)" Condition="!Exists('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(DataDirFiles.Extension)') OR $([System.DateTime]::Parse('%(ModifiedTime)').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(DataDirFiles.Extension)').Ticks)" />
<Message Text="Copying External .dlls" Importance="High" />
<Copy SourceFiles="@(ExternalDlls)" DestinationFolder="$(BinaryOutputDir)" Condition="!Exists('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)') OR $([System.DateTime]::Parse('%(ModifiedTime)').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)').Ticks)" />
<Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" />
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" />
</Target>
</Project>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="AboutDialog.cpp" />
<ClCompile Include="Host.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="MainWindow.cpp" />
<ClCompile Include="VideoInterface\VideoInterface.cpp">
<Filter>VideoInterface</Filter>
</ClCompile>
<ClCompile Include="Utils\Resources.cpp">
<Filter>Utils</Filter>
</ClCompile>
<ClCompile Include="Utils\Utils.cpp">
<Filter>Utils</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="AboutDialog.h" />
<QtMoc Include="MainWindow.h" />
</ItemGroup>
<ItemGroup>
<QtUi Include="*.ui" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<Filter Include="VideoInterface">
<UniqueIdentifier>{2497846c-00eb-4f1c-b437-2d32eac9027c}</UniqueIdentifier>
</Filter>
<Filter Include="Utils">
<UniqueIdentifier>{730f2ae7-a686-4bc8-bb49-b4f8bd240329}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Utils\Resources.h">
<Filter>Utils</Filter>
</ClInclude>
<ClInclude Include="Utils\Utils.h">
<Filter>Utils</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,106 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <cstdarg>
#include <cstring>
#include "Common/MsgHandler.h"
#include "Core/Host.h"
void Host_SysMessage(const char *fmt, ...)
{
va_list list;
char msg[512];
va_start(list, fmt);
vsprintf(msg, fmt, list);
va_end(list);
if (msg[strlen(msg)-1] == '\n')
msg[strlen(msg)-1] = '\0';
PanicAlert("%s", msg);
}
void Host_Message(int id)
{
// TODO
}
void* Host_GetRenderHandle()
{
return nullptr;
}
void Host_NotifyMapLoaded()
{
// TODO
}
void Host_UpdateDisasmDialog()
{
// TODO
}
void Host_UpdateMainFrame()
{
// TODO
}
void Host_UpdateTitle(const std::string& title)
{
// TODO
}
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
{
// TODO
}
void Host_RequestRenderWindowSize(int width, int height)
{
// TODO
}
void Host_RequestFullscreen(bool enable_fullscreen)
{
// TODO
}
void Host_SetStartupDebuggingParameters()
{
// TODO
}
void Host_SetWiiMoteConnectionState(int state)
{
// TODO
}
bool Host_UIHasFocus()
{
// TODO
return false;
}
bool Host_RendererHasFocus()
{
// TODO
return false;
}
void Host_ConnectWiimote(int wm_idx, bool connect)
{
// TODO
}
void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
const std::string& config_name)
{
// TODO
}
void Host_RefreshDSPDebuggerWindow()
{
// TODO
}

View File

@ -11,6 +11,9 @@
#include "MainWindow.h"
#include "DolphinQt/Utils/Utils.h"
#include "UICommon/UICommon.h"
static bool IsOsSupported()
{
#ifdef Q_OS_OSX
@ -25,11 +28,11 @@ static bool IsOsSupported()
static QString LowestSupportedOsVersion()
{
#ifdef Q_OS_OSX
return QStringLiteral("Mac OS X 10.7");
return SL("Mac OS X 10.7");
#elif defined(Q_OS_WIN)
return QStringLiteral("Windows Vista SP2");
return SL("Windows Vista SP2");
#else
return QStringLiteral("Unknown");
return SL("Unknown");
#endif
}
@ -38,6 +41,9 @@ int main(int argc, char* argv[])
QApplication app(argc, argv);
// TODO: Add command line options
UICommon::CreateDirectories();
UICommon::Init();
if (!IsOsSupported())
{
QMessageBox::critical(nullptr, QObject::tr("Unsupported OS"),
@ -50,5 +56,7 @@ int main(int argc, char* argv[])
DMainWindow w;
w.show();
return app.exec();
int retcode = app.exec();
UICommon::Shutdown();
return retcode;
}

View File

@ -5,16 +5,23 @@
#include <QDesktopServices>
#include <QUrl>
#include "AboutDialog.h"
#include "MainWindow.h"
#include "ui_MainWindow.h"
#include "Common/StdMakeUnique.h"
DMainWindow::DMainWindow(QWidget* p)
: QMainWindow(p)
#include "DolphinQt/AboutDialog.h"
#include "DolphinQt/MainWindow.h"
#include "DolphinQt/Utils/Resources.h"
#include "DolphinQt/Utils/Utils.h"
DMainWindow::DMainWindow(QWidget* parent_widget)
: QMainWindow(parent_widget)
{
ui = std::make_unique<Ui::DMainWindow>();
ui->setupUi(this);
Resources::Init();
ui->actOpen->setIcon(Resources::GetIcon(Resources::TOOLBAR_OPEN));
}
DMainWindow::~DMainWindow()
@ -23,17 +30,17 @@ DMainWindow::~DMainWindow()
void DMainWindow::on_actWebsite_triggered()
{
QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/")));
QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/")));
}
void DMainWindow::on_actOnlineDocs_triggered()
{
QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/docs/guides/")));
QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/docs/guides/")));
}
void DMainWindow::on_actGitHub_triggered()
{
QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/dolphin-emu/dolphin/")));
QDesktopServices::openUrl(QUrl(SL("https://github.com/dolphin-emu/dolphin/")));
}
void DMainWindow::on_actAbout_triggered()

View File

@ -17,7 +17,7 @@ class DMainWindow : public QMainWindow
Q_OBJECT
public:
explicit DMainWindow(QWidget* p = nullptr);
explicit DMainWindow(QWidget* parent_widget = nullptr);
~DMainWindow();
private slots:

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>998</width>
<height>598</height>
<width>996</width>
<height>596</height>
</rect>
</property>
<property name="windowTitle">
@ -15,8 +15,8 @@
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
@ -31,14 +31,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>998</width>
<height>24</height>
<width>996</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="mnuFile">
<property name="title">
<string>Fi&amp;le</string>
</property>
<addaction name="actOpen"/>
</widget>
<widget class="QMenu" name="mnuEmulation">
<property name="title">
@ -70,8 +71,14 @@
<addaction name="separator"/>
<addaction name="actAbout"/>
</widget>
<widget class="QMenu" name="mnuMovie">
<property name="title">
<string>Movie</string>
</property>
</widget>
<addaction name="mnuFile"/>
<addaction name="mnuEmulation"/>
<addaction name="mnuMovie"/>
<addaction name="mnuOptions"/>
<addaction name="mnuTools"/>
<addaction name="mnuView"/>
@ -88,6 +95,7 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actOpen"/>
</widget>
<action name="actWebsite">
<property name="text">
@ -109,6 +117,14 @@
<string>&amp;About</string>
</property>
</action>
<action name="actOpen">
<property name="text">
<string>Open</string>
</property>
<property name="toolTip">
<string>Open file...</string>
</property>
</action>
</widget>
<resources/>
<connections/>

View File

@ -0,0 +1,101 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "Common/FileUtil.h"
#include "Core/ConfigManager.h"
#include "DolphinQt/Utils/Resources.h"
#include "DolphinQt/Utils/Utils.h"
QVector<QPixmap> Resources::m_platforms;
QVector<QPixmap> Resources::m_regions;
QVector<QPixmap> Resources::m_ratings;
QVector<QPixmap> Resources::m_pixmaps;
void Resources::Init()
{
QString dir = QString::fromStdString(File::GetSysDirectory() + "Resources/");
m_regions.resize(DiscIO::IVolume::NUMBER_OF_COUNTRIES);
m_regions[DiscIO::IVolume::COUNTRY_EUROPE].load(dir + SL("Flag_Europe.png"));
m_regions[DiscIO::IVolume::COUNTRY_FRANCE].load(dir + SL("Flag_France.png"));
m_regions[DiscIO::IVolume::COUNTRY_RUSSIA].load(dir + SL("Flag_Unknown.png")); // TODO
m_regions[DiscIO::IVolume::COUNTRY_USA].load(dir + SL("Flag_USA.png"));
m_regions[DiscIO::IVolume::COUNTRY_JAPAN].load(dir + SL("Flag_Japan.png"));
m_regions[DiscIO::IVolume::COUNTRY_KOREA].load(dir + SL("Flag_Korea.png"));
m_regions[DiscIO::IVolume::COUNTRY_ITALY].load(dir + SL("Flag_Italy.png"));
m_regions[DiscIO::IVolume::COUNTRY_TAIWAN].load(dir + SL("Flag_Taiwan.png"));
m_regions[DiscIO::IVolume::COUNTRY_SDK].load(dir + SL("Flag_SDK.png"));
m_regions[DiscIO::IVolume::COUNTRY_UNKNOWN].load(dir + SL("Flag_Unknown.png"));
m_platforms.resize(3);
m_platforms[0].load(dir + SL("Platform_Gamecube.png"));
m_platforms[1].load(dir + SL("Platform_Wii.png"));
m_platforms[2].load(dir + SL("Platform_Wad.png"));
m_ratings.resize(6);
m_ratings[0].load(dir + SL("rating0.png"));
m_ratings[1].load(dir + SL("rating1.png"));
m_ratings[2].load(dir + SL("rating2.png"));
m_ratings[3].load(dir + SL("rating3.png"));
m_ratings[4].load(dir + SL("rating4.png"));
m_ratings[5].load(dir + SL("rating5.png"));
m_pixmaps.resize(NUM_ICONS);
m_pixmaps[DOLPHIN_LOGO].load(dir + SL("Dolphin.png"));
UpdatePixmaps();
}
void Resources::UpdatePixmaps()
{
QString dir = QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name));
m_pixmaps[TOOLBAR_OPEN].load(dir + SL("open.png"));
m_pixmaps[TOOLBAR_REFRESH].load(dir + SL("refresh.png"));
m_pixmaps[TOOLBAR_BROWSE].load(dir + SL("browse.png"));
m_pixmaps[TOOLBAR_PLAY].load(dir + SL("play.png"));
m_pixmaps[TOOLBAR_STOP].load(dir + SL("stop.png"));
m_pixmaps[TOOLBAR_PAUSE].load(dir + SL("pause.png"));
m_pixmaps[TOOLBAR_FULLSCREEN].load(dir + SL("fullscreen.png"));
m_pixmaps[TOOLBAR_SCREENSHOT].load(dir + SL("screenshot.png"));
m_pixmaps[TOOLBAR_CONFIGURE].load(dir + SL("config.png"));
m_pixmaps[TOOLBAR_PLUGIN_GFX].load(dir + SL("graphics.png"));
m_pixmaps[TOOLBAR_PLUGIN_DSP].load(dir + SL("dsp.png"));
m_pixmaps[TOOLBAR_PLUGIN_GCPAD].load(dir + SL("gcpad.png"));
m_pixmaps[TOOLBAR_PLUGIN_WIIMOTE].load(dir + SL("wiimote.png"));
m_pixmaps[TOOLBAR_HELP].load(dir + SL("nobanner.png")); // TODO
// TODO: toolbar[MEMCARD];
// TODO: toolbar[HOTKEYS];
m_pixmaps[BANNER_MISSING].load(dir + SL("nobanner.png"));
}
QPixmap& Resources::GetRegionPixmap(DiscIO::IVolume::ECountry region)
{
return m_regions[region];
}
QPixmap& Resources::GetPlatformPixmap(int console)
{
if (console >= m_platforms.size() || console < 0)
return m_platforms[0];
return m_platforms[console];
}
QPixmap& Resources::GetRatingPixmap(int rating)
{
if (rating >= m_ratings.size() || rating < 0)
return m_ratings[0];
return m_ratings[rating];
}
QPixmap& Resources::GetPixmap(int id)
{
if (id >= m_pixmaps.size() || id < 0)
return m_pixmaps[0];
return m_pixmaps[id];
}
QIcon Resources::GetIcon(int id)
{
return QIcon(GetPixmap(id));
}

View File

@ -0,0 +1,53 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <QIcon>
#include <QPixmap>
#include <QVector>
#include "DiscIO/Volume.h"
class Resources
{
public:
static void Init();
static void UpdatePixmaps();
static QPixmap& GetPlatformPixmap(int console);
static QPixmap& GetRegionPixmap(DiscIO::IVolume::ECountry region);
static QPixmap& GetRatingPixmap(int rating);
static QPixmap& GetPixmap(int id);
static QIcon GetIcon(int id);
enum
{
TOOLBAR_OPEN = 0,
TOOLBAR_REFRESH,
TOOLBAR_BROWSE,
TOOLBAR_PLAY,
TOOLBAR_STOP,
TOOLBAR_PAUSE,
TOOLBAR_FULLSCREEN,
TOOLBAR_SCREENSHOT,
TOOLBAR_CONFIGURE,
TOOLBAR_PLUGIN_GFX,
TOOLBAR_PLUGIN_DSP,
TOOLBAR_PLUGIN_GCPAD,
TOOLBAR_PLUGIN_WIIMOTE,
TOOLBAR_HELP,
MEMCARD,
HOTKEYS,
DOLPHIN_LOGO,
BANNER_MISSING,
NUM_ICONS
};
private:
static QVector<QPixmap> m_platforms;
static QVector<QPixmap> m_regions;
static QVector<QPixmap> m_ratings;
static QVector<QPixmap> m_pixmaps;
};

View File

@ -0,0 +1,21 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <QStringListIterator>
#include "Utils.h"
QString NiceSizeFormat(s64 size)
{
QStringList list = { SL("KB"), SL("MB"), SL("GB"), SL("TB"), SL("PB"), SL("EB") };
QStringListIterator i(list);
QString unit = SL("b");
double num = size;
while (num >= 1024.0 && i.hasNext())
{
unit = i.next();
num /= 1024.0;
}
return SL("%1 %2").arg(QString::number(num, 'f', 1)).arg(unit);
}

View File

@ -0,0 +1,14 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <QString>
#include "Common/CommonTypes.h"
// Shorter version of QStringLiteral(str)
#define SL(str) QStringLiteral(str)
QString NiceSizeFormat(s64 size);

View File

@ -0,0 +1,11 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "VideoBackends/OGL/GLInterfaceBase.h"
cInterfaceBase* HostGL_CreateGLInterface()
{
// TODO
return nullptr;
}