Merge pull request #3452 from aserna3/master

[UI] Remove DolphinQt
This commit is contained in:
Mathew Maidment
2016-01-05 20:48:27 -05:00
36 changed files with 0 additions and 3311 deletions
-3
View File
@@ -8,9 +8,6 @@ add_subdirectory(UICommon)
add_subdirectory(VideoCommon)
add_subdirectory(VideoBackends)
if(ENABLE_QT)
add_subdirectory(DolphinQt)
endif()
if(ENABLE_QT2)
add_subdirectory(DolphinQt2)
endif()
-38
View File
@@ -1,38 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <memory>
#include <QDesktopServices>
#include <QUrl>
#include "ui_AboutDialog.h"
#include "Common/Common.h"
#include "DolphinQt/AboutDialog.h"
#include "DolphinQt/Utils/Resources.h"
DAboutDialog::DAboutDialog(QWidget* parent_widget)
: QDialog(parent_widget)
{
setWindowModality(Qt::WindowModal);
setAttribute(Qt::WA_DeleteOnClose);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui = std::make_unique<Ui::DAboutDialog>();
m_ui->setupUi(this);
m_ui->lblGitRev->setText(QString::fromUtf8(scm_desc_str));
m_ui->lblGitInfo->setText(m_ui->lblGitInfo->text().arg(QString::fromUtf8(scm_branch_str),
QString::fromUtf8(scm_rev_git_str)));
m_ui->lblFinePrint->setText(m_ui->lblFinePrint->text().arg(QStringLiteral("2015")));
m_ui->lblLicenseAuthorsSupport->setText(m_ui->lblLicenseAuthorsSupport->text()
.arg(QStringLiteral("https://github.com/dolphin-emu/dolphin/blob/master/license.txt"))
.arg(QStringLiteral("https://github.com/dolphin-emu/dolphin/graphs/contributors"))
.arg(QStringLiteral("https://forums.dolphin-emu.org/")));
m_ui->lblLogo->setPixmap(Resources::GetPixmap(Resources::DOLPHIN_LOGO_LARGE));
}
DAboutDialog::~DAboutDialog()
{
}
-26
View File
@@ -1,26 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <QDialog>
// Predefinitions
namespace Ui
{
class DAboutDialog;
}
class DAboutDialog final : public QDialog
{
Q_OBJECT
public:
explicit DAboutDialog(QWidget* parent_widget = nullptr);
~DAboutDialog();
private:
std::unique_ptr<Ui::DAboutDialog> m_ui;
};
-151
View File
@@ -1,151 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DAboutDialog</class>
<widget class="QDialog" name="DAboutDialog">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>About Dolphin</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="rightMargin">
<number>22</number>
</property>
<property name="horizontalSpacing">
<number>18</number>
</property>
<property name="verticalSpacing">
<number>13</number>
</property>
<item row="5" column="1">
<widget class="QLabel" name="lblLicenseAuthorsSupport">
<property name="text">
<string>&lt;a href=&quot;%1&quot;&gt;License&lt;/a&gt; | &lt;a href=&quot;%2&quot;&gt;Authors&lt;/a&gt; | &lt;a href=&quot;%3&quot;&gt;Support&lt;/a&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lblGitInfo">
<property name="font">
<font>
<pointsize>7</pointsize>
</font>
</property>
<property name="text">
<string>Branch: %1
Revision: %2</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="6">
<widget class="QLabel" name="lblLogo">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="margin">
<number>16</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lblChkForUpdates">
<property name="text">
<string>Check for updates: &lt;a href=&quot;https://dolphin-emu.org/download&quot;&gt;dolphin-emu.org/download&lt;/a&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lblDolphin">
<property name="font">
<font>
<pointsize>31</pointsize>
</font>
</property>
<property name="text">
<string>Dolphin</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="lblFinePrint">
<property name="font">
<font>
<pointsize>7</pointsize>
</font>
</property>
<property name="text">
<string>© 2003-%1 Dolphin Team. “GameCube” and “Wii” are trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lblGitRev">
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">&lt;git shortrev&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="lblAbout">
<property name="text">
<string>Dolphin is a free and open-source GameCube and Wii emulator.
This software should not be used to play games you do not legally own.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
-88
View File
@@ -1,88 +0,0 @@
# 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
AboutDialog.cpp
AboutDialog.h
Host.cpp
Main.cpp
MainWindow.cpp
MainWindow.h
SystemInfo.cpp
GameList/GameFile.cpp
GameList/GameGrid.cpp
GameList/GameTracker.cpp
GameList/GameTree.cpp
Utils/Resources.cpp
Utils/Utils.cpp
VideoInterface/RenderWidget.cpp
)
set(UIS
AboutDialog.ui
MainWindow.ui
SystemInfo.ui
GameList/GameGrid.ui
GameList/GameTree.ui
)
list(APPEND LIBS core uicommon)
if(APPLE)
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)
if(APPLE)
# Note: This is based on the DolphinWX version.
include(BundleUtilities)
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHINQT_BINARY}.app)
# Ask for an application bundle.
set_target_properties(${DOLPHINQT_BINARY} PROPERTIES
MACOSX_BUNDLE true
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
)
# get rid of any old copies
file (REMOVE_RECURSE ${BUNDLE_PATH}/Contents/Resources/Sys)
if(NOT SKIP_POSTPROCESS_BUNDLE)
# Fix up the bundle after it is finished.
# There does not seem to be an easy way to run CMake commands post-build,
# so we invoke CMake again on a generated script.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/postprocess_bundle.cmake "
include(BundleUtilities)
message(\"Fixing up application bundle: ${BUNDLE_PATH}\")
message(\"(Note: This is only necessary to produce a redistributable binary.\")
message(\"To skip, pass -DSKIP_POSTPROCESS_BUNDLE=1 to cmake.)\")
set(BU_CHMOD_BUNDLE_ITEMS ON)
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/Tools/deploy-mac.py -p platforms/libqcocoa.dylib \"${BUNDLE_PATH}\")
file(INSTALL ${CMAKE_SOURCE_DIR}/Data/Sys
DESTINATION ${BUNDLE_PATH}/Contents/Resources
)
")
add_custom_command(TARGET ${DOLPHINQT_BINARY} POST_BUILD
COMMAND ${CMAKE_COMMAND} -P postprocess_bundle.cmake
)
else()
add_custom_command(OUTPUT ${BUNDLE_PATH}/Contents/Resources/Sys
COMMAND ln -nfs ${CMAKE_SOURCE_DIR}/Data/Sys ${BUNDLE_PATH}/Contents/Resources/Sys
VERBATIM
)
add_custom_target(CopyDataIntoBundleQt ALL
DEPENDS ${BUNDLE_PATH}/Contents/Resources/Sys
)
endif()
else()
install(TARGETS ${DOLPHINQT_BINARY} RUNTIME DESTINATION ${bindir})
endif()
-189
View File
@@ -1,189 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>v140</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>
<SubSystem Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Windows</SubSystem>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\VideoInterface;$(ProjectDir)\GameList;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<!--QRC and UI files are handled automatically-->
<ItemGroup>
<QtResource Include="*.qrc" />
</ItemGroup>
<ItemGroup>
<QtUi Include="*.ui" />
<QtUi Include="GameList\*.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" />
<QtMoc Include="SystemInfo.h" />
<QtMoc Include="VideoInterface\RenderWidget.h" />
<QtMoc Include="GameList\GameFile.h" />
<QtMoc Include="GameList\GameGrid.h" />
<QtMoc Include="GameList\GameTracker.h" />
<QtMoc Include="GameList\GameTree.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="$(QtMocOutPrefix)SystemInfo.cpp" />
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GameGrid.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GameTracker.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GameTree.cpp" />
<ClCompile Include="GameList\GameFile.cpp" />
<ClCompile Include="GameList\GameGrid.cpp" />
<ClCompile Include="GameList\GameTracker.cpp" />
<ClCompile Include="GameList\GameTree.cpp" />
<ClCompile Include="SystemInfo.cpp" />
<ClCompile Include="Utils\Resources.cpp" />
<ClCompile Include="Utils\Utils.cpp" />
<ClCompile Include="VideoInterface\RenderWidget.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>
<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" />
<BinaryFiles Include="$(TargetPath)" />
<AllInputFiles Include="@(DataDirFiles);@(ExternalDlls);@(BinaryFiles)" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameList\GameFile.h" />
<ClInclude Include="GameList\GameGrid.h" />
<ClInclude Include="GameList\GameTracker.h" />
<ClInclude Include="GameList\GameTree.h" />
<ClInclude Include="Host.h" />
<ClInclude Include="Utils\Resources.h" />
<ClInclude Include="Utils\Utils.h" />
<ClInclude Include="VideoInterface\RenderWidget.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>
@@ -1,109 +0,0 @@
<?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="SystemInfo.cpp" />
<ClCompile Include="Utils\Resources.cpp">
<Filter>Utils</Filter>
</ClCompile>
<ClCompile Include="Utils\Utils.cpp">
<Filter>Utils</Filter>
</ClCompile>
<ClCompile Include="GameList\GameFile.cpp">
<Filter>GameList</Filter>
</ClCompile>
<ClCompile Include="GameList\GameGrid.cpp">
<Filter>GameList</Filter>
</ClCompile>
<ClCompile Include="GameList\GameTracker.cpp">
<Filter>GameList</Filter>
</ClCompile>
<ClCompile Include="GameList\GameTree.cpp">
<Filter>GameList</Filter>
</ClCompile>
<ClCompile Include="VideoInterface\RenderWidget.cpp">
<Filter>VideoInterface</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)MainWindow.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)SystemInfo.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)GameGrid.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)GameTracker.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)GameTree.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)AboutDialog.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="AboutDialog.h" />
<QtMoc Include="MainWindow.h" />
<QtMoc Include="SystemInfo.h" />
<QtMoc Include="VideoInterface\RenderWidget.h" />
<QtMoc Include="GameList\GameFile.h" />
<QtMoc Include="GameList\GameGrid.h" />
<QtMoc Include="GameList\GameTracker.h" />
<QtMoc Include="GameList\GameTree.h" />
</ItemGroup>
<ItemGroup>
<QtUi Include="*.ui" />
<QtUi Include="GameList\*.ui">
<Filter>GameList</Filter>
</QtUi>
</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>
<Filter Include="Generated Files">
<UniqueIdentifier>{c18a1fb3-64ff-4249-b808-d73a56ea3a2d}</UniqueIdentifier>
</Filter>
<Filter Include="GameList">
<UniqueIdentifier>{be9925db-448c-46d8-a5a3-fb957490d3ef}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Host.h" />
<ClInclude Include="Utils\Resources.h">
<Filter>Utils</Filter>
</ClInclude>
<ClInclude Include="Utils\Utils.h">
<Filter>Utils</Filter>
</ClInclude>
<ClInclude Include="VideoInterface\RenderWidget.h">
<Filter>VideoInterface</Filter>
</ClInclude>
<ClInclude Include="GameList\GameFile.h">
<Filter>GameList</Filter>
</ClInclude>
<ClInclude Include="GameList\GameGrid.h">
<Filter>GameList</Filter>
</ClInclude>
<ClInclude Include="GameList\GameTracker.h">
<Filter>GameList</Filter>
</ClInclude>
<ClInclude Include="GameList\GameTree.h">
<Filter>GameList</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--For some stupid reason this has to be in the .user file...-->
<LocalDebuggerCommand>$(BinaryOutputDir)$(TargetFileName)</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(BinaryOutputDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>
-393
View File
@@ -1,393 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <algorithm>
#include <memory>
#include <QDataStream>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QXmlStreamReader>
#include "Common/Common.h"
#include "Common/CommonPaths.h"
#include "Common/FileUtil.h"
#include "Common/Hash.h"
#include "Common/IniFile.h"
#include "Common/StringUtil.h"
#include "Core/ConfigManager.h"
#include "DiscIO/VolumeCreator.h"
#include "DolphinQt/GameList/GameFile.h"
static const u32 CACHE_REVISION = 0x00E; // Last changed in PR 3309
static const u32 DATASTREAM_REVISION = 15; // Introduced in Qt 5.2
static QMap<DiscIO::IVolume::ELanguage, QString> ConvertLocalizedStrings(std::map<DiscIO::IVolume::ELanguage, std::string> strings)
{
QMap<DiscIO::IVolume::ELanguage, QString> result;
for (auto entry : strings)
result.insert(entry.first, QString::fromStdString(entry.second).trimmed());
return result;
}
template<class to, class from>
static QMap<to, QString> CastLocalizedStrings(QMap<from, QString> strings)
{
QMap<to, QString> result;
auto end = strings.cend();
for (auto it = strings.cbegin(); it != end; ++it)
result.insert((to)it.key(), it.value());
return result;
}
static QString GetLanguageString(DiscIO::IVolume::ELanguage language, QMap<DiscIO::IVolume::ELanguage, QString> strings)
{
if (strings.contains(language))
return strings.value(language);
// English tends to be a good fallback when the requested language isn't available
if (language != DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH)
{
if (strings.contains(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH))
return strings.value(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH);
}
// If English isn't available either, just pick something
if (!strings.empty())
return strings.cbegin().value();
return QStringLiteral("");
}
GameFile::GameFile(const QString& fileName)
: m_file_name(fileName)
{
QFileInfo info(m_file_name);
QDir directory = info.absoluteDir();
m_folder_name = directory.dirName();
if (LoadFromCache())
{
m_valid = true;
// Wii banners can only be read if there is a savefile,
// so sometimes caches don't contain banners. Let's check
// if a banner has become available after the cache was made.
if (m_banner.isNull())
{
int width, height;
std::vector<u32> buffer = DiscIO::IVolume::GetWiiBanner(&width, &height, m_title_id);
ReadBanner(buffer, width, height);
if (!m_banner.isNull())
SaveToCache();
}
}
else
{
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(fileName.toStdString()));
if (volume != nullptr)
{
m_platform = volume->GetVolumeType();
m_short_names = ConvertLocalizedStrings(volume->GetNames(false));
m_long_names = ConvertLocalizedStrings(volume->GetNames(true));
m_descriptions = ConvertLocalizedStrings(volume->GetDescriptions());
m_company = QString::fromStdString(volume->GetCompany());
m_country = volume->GetCountry();
m_blob_type = volume->GetBlobType();
m_file_size = volume->GetRawSize();
m_volume_size = volume->GetSize();
// A temporary variable is necessary here to convert between
// quint64 (needed by GameFile's cache code) and u64 (needed by GetTitleID)
u64 title_id;
volume->GetTitleID(&title_id);
m_title_id = title_id;
m_unique_id = QString::fromStdString(volume->GetUniqueID());
m_disc_number = volume->GetDiscNumber();
m_revision = volume->GetRevision();
int width, height;
std::vector<u32> buffer = volume->GetBanner(&width, &height);
ReadBanner(buffer, width, height);
m_valid = true;
SaveToCache();
}
}
if (m_company.isEmpty() && m_unique_id.size() >= 6)
m_company = QString::fromStdString(DiscIO::GetCompanyFromID(m_unique_id.mid(4, 2).toStdString()));
if (m_valid)
{
IniFile ini = SConfig::LoadGameIni(m_unique_id.toStdString(), m_revision);
std::string issues_temp;
ini.GetIfExists("EmuState", "EmulationStateId", &m_emu_state);
ini.GetIfExists("EmuState", "EmulationIssues", &issues_temp);
m_issues = QString::fromStdString(issues_temp);
}
if (!IsValid() && IsElfOrDol())
{
m_valid = true;
m_file_size = info.size();
m_platform = DiscIO::IVolume::ELF_DOL;
}
// Metadata can optionally be stored in XML and PNG files. Typical for DOLs and ELFs, but also works
// with volumes. icon.png and meta.xml are the file names used by Homebrew Channel. The ability to use
// files with the same name as the main file is provided as an alternative for those who want to have
// multiple files in one folder instead of having a Homebrew Channel-style folder structure.
if (!ReadXML(directory.filePath(info.baseName() + QStringLiteral(".xml"))))
ReadXML(directory.filePath(QStringLiteral("meta.xml")));
QImage banner(directory.filePath(info.baseName() + QStringLiteral(".png")));
if (banner.isNull())
banner.load(directory.filePath(QStringLiteral("icon.png")));
if (!banner.isNull())
m_banner = QPixmap::fromImage(banner);
}
bool GameFile::LoadFromCache()
{
QString filename = CreateCacheFilename();
if (filename.isEmpty())
return false;
QFile file(filename);
if (!file.exists())
return false;
if (!file.open(QFile::ReadOnly))
return false;
// Increment CACHE_REVISION if the code below is modified (GameFile.cpp)
QDataStream stream(&file);
stream.setVersion(DATASTREAM_REVISION);
u32 cache_rev;
stream >> cache_rev;
if (cache_rev != CACHE_REVISION)
return false;
u32 country;
u32 platform;
u32 blob_type;
QMap<u8, QString> short_names;
QMap<u8, QString> long_names;
QMap<u8, QString> descriptions;
stream >> short_names
>> long_names
>> descriptions
>> m_company
>> m_unique_id
>> m_title_id
>> blob_type
>> m_file_size
>> m_volume_size
>> country
>> m_banner
>> platform
>> m_disc_number
>> m_revision;
m_country = (DiscIO::IVolume::ECountry)country;
m_platform = (DiscIO::IVolume::EPlatform)platform;
m_blob_type = (DiscIO::BlobType)blob_type;
m_short_names = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(short_names);
m_long_names = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(long_names);
m_descriptions = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(descriptions);
file.close();
return true;
}
void GameFile::SaveToCache()
{
if (!File::IsDirectory(File::GetUserPath(D_CACHE_IDX)))
File::CreateDir(File::GetUserPath(D_CACHE_IDX));
QString filename = CreateCacheFilename();
if (filename.isEmpty())
return;
if (QFile::exists(filename))
QFile::remove(filename);
QFile file(filename);
if (!file.open(QFile::WriteOnly))
return;
// Increment CACHE_REVISION if the code below is modified (GameFile.cpp)
QDataStream stream(&file);
stream.setVersion(DATASTREAM_REVISION);
stream << CACHE_REVISION;
stream << CastLocalizedStrings<u8>(m_short_names)
<< CastLocalizedStrings<u8>(m_long_names)
<< CastLocalizedStrings<u8>(m_descriptions)
<< m_company
<< m_unique_id
<< m_title_id
<< (u32)m_blob_type
<< m_file_size
<< m_volume_size
<< (u32)m_country
<< m_banner
<< (u32)m_platform
<< m_disc_number
<< m_revision;
}
bool GameFile::IsElfOrDol() const
{
return m_file_name.endsWith(QStringLiteral(".elf"), Qt::CaseInsensitive) ||
m_file_name.endsWith(QStringLiteral(".dol"), Qt::CaseInsensitive);
}
QString GameFile::CreateCacheFilename() const
{
std::string filename, pathname, extension;
SplitPath(m_file_name.toStdString(), &pathname, &filename, &extension);
if (filename.empty())
return QStringLiteral(""); // must be a disc drive
// Filename.extension_HashOfFolderPath_Size.cache
// Append hash to prevent ISO name-clashing in different folders.
filename.append(StringFromFormat("%s_%x_%llx.qcache",
extension.c_str(), HashFletcher((const u8*)pathname.c_str(), pathname.size()),
(unsigned long long)File::GetSize(m_file_name.toStdString())));
QString fullname = QString::fromStdString(File::GetUserPath(D_CACHE_IDX));
fullname += QString::fromStdString(filename);
return fullname;
}
// Outputs to m_banner
void GameFile::ReadBanner(const std::vector<u32>& buffer, int width, int height)
{
QImage banner(width, height, QImage::Format_RGB888);
for (int i = 0; i < width * height; i++)
{
int x = i % width, y = i / width;
banner.setPixel(x, y, qRgb((buffer[i] & 0xFF0000) >> 16,
(buffer[i] & 0x00FF00) >> 8,
(buffer[i] & 0x0000FF) >> 0));
}
if (!banner.isNull())
m_banner = QPixmap::fromImage(banner);
}
// Outputs to m_short_names, m_long_names, m_descriptions, m_company.
// Returns whether a file was found, not whether it contained useful data.
bool GameFile::ReadXML(const QString& file_path)
{
// The format of Homebrew Channel XML metadata is described at:
// http://wiibrew.org/wiki/Homebrew_Channel#Adding_Text
QFile file(file_path);
if (!file.open(QIODevice::ReadOnly))
return false;
QXmlStreamReader reader(&file);
if (reader.readNextStartElement() && reader.name() == QStringLiteral("app"))
{
while (reader.readNextStartElement())
{
QStringRef name = reader.name();
if (name == QStringLiteral("name"))
{
m_short_names = { { DiscIO::IVolume::LANGUAGE_UNKNOWN, reader.readElementText() } };
m_long_names = m_short_names;
}
else if (name == QStringLiteral("short_description"))
{
m_descriptions = { { DiscIO::IVolume::LANGUAGE_UNKNOWN, reader.readElementText() } };
}
else if (name == QStringLiteral("coder"))
{
m_company = reader.readElementText();
}
else
{
reader.skipCurrentElement();
}
// Elements that we aren't using:
// version (can be written in any format)
// release_date (YYYYmmddHHMMSS format)
// long_description (can be several screens long!)
}
}
return true;
}
QString GameFile::GetDescription(DiscIO::IVolume::ELanguage language) const
{
return GetLanguageString(language, m_descriptions);
}
QString GameFile::GetDescription() const
{
bool wii = m_platform != DiscIO::IVolume::GAMECUBE_DISC;
return GetDescription(SConfig::GetInstance().GetCurrentLanguage(wii));
}
QString GameFile::GetName(bool prefer_long, DiscIO::IVolume::ELanguage language) const
{
return GetLanguageString(language, prefer_long ? m_long_names : m_short_names);
}
QString GameFile::GetName(bool prefer_long) const
{
bool wii = m_platform != DiscIO::IVolume::GAMECUBE_DISC;
QString name = GetName(prefer_long, SConfig::GetInstance().GetCurrentLanguage(wii));
if (name.isEmpty())
{
// No usable name, return filename (better than nothing)
std::string name_temp, extension;
SplitPath(m_file_name.toStdString(), nullptr, &name_temp, &extension);
name = QString::fromStdString(name_temp + extension);
}
return name;
}
const QString GameFile::GetWiiFSPath() const
{
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(m_file_name.toStdString()));
QString ret;
if (volume == nullptr)
return ret;
if (volume->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC)
{
u64 title_id;
volume->GetTitleID(&title_id);
std::string path = StringFromFormat("%s/title/%08x/%08x/data/",
File::GetUserPath(D_WIIROOT_IDX).c_str(), (u32)(title_id >> 32), (u32)title_id);
if (!File::Exists(path))
File::CreateFullPath(path);
if (path[0] == '.')
ret = QDir::currentPath() + QString::fromStdString(path).mid((int)strlen(ROOT_DIR));
else
ret = QString::fromStdString(path);
}
return ret;
}
-95
View File
@@ -1,95 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <QMap>
#include <QPixmap>
#include <QString>
#include <string>
#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h"
#include "DolphinQt/Utils/Resources.h"
class GameFile final
{
public:
GameFile(const QString& fileName);
GameFile(const std::string& fileName) : GameFile(QString::fromStdString(fileName)) {}
bool IsValid() const { return m_valid; }
QString GetFileName() { return m_file_name; }
QString GetFolderName() { return m_folder_name; }
QString GetName(bool prefer_long, DiscIO::IVolume::ELanguage language) const;
QString GetName(bool prefer_long) const;
QString GetDescription(DiscIO::IVolume::ELanguage language) const;
QString GetDescription() const;
QString GetCompany() const { return m_company; }
u16 GetRevision() const { return m_revision; }
const QString GetUniqueID() const { return m_unique_id; }
const QString GetWiiFSPath() const;
DiscIO::IVolume::ECountry GetCountry() const { return m_country; }
DiscIO::IVolume::EPlatform GetPlatform() const { return m_platform; }
DiscIO::BlobType GetBlobType() const { return m_blob_type; }
const QString GetIssues() const { return m_issues; }
int GetEmuState() const { return m_emu_state; }
bool IsCompressed() const
{
return m_blob_type == DiscIO::BlobType::GCZ || m_blob_type == DiscIO::BlobType::CISO ||
m_blob_type == DiscIO::BlobType::WBFS;
}
u64 GetFileSize() const { return m_file_size; }
u64 GetVolumeSize() const { return m_volume_size; }
// 0 is the first disc, 1 is the second disc
u8 GetDiscNumber() const { return m_disc_number; }
const QPixmap GetBitmap() const
{
if (m_banner.isNull())
return Resources::GetPixmap(Resources::BANNER_MISSING);
return m_banner;
}
private:
QString m_file_name;
QString m_folder_name;
QMap<DiscIO::IVolume::ELanguage, QString> m_short_names;
QMap<DiscIO::IVolume::ELanguage, QString> m_long_names;
QMap<DiscIO::IVolume::ELanguage, QString> m_descriptions;
QString m_company;
QString m_unique_id;
quint64 m_title_id;
QString m_issues;
int m_emu_state = 0;
quint64 m_file_size = 0;
quint64 m_volume_size = 0;
DiscIO::IVolume::ECountry m_country = DiscIO::IVolume::COUNTRY_UNKNOWN;
DiscIO::IVolume::EPlatform m_platform;
DiscIO::BlobType m_blob_type;
u16 m_revision = 0;
QPixmap m_banner;
bool m_valid = false;
u8 m_disc_number = 0;
bool LoadFromCache();
void SaveToCache();
bool IsElfOrDol() const;
QString CreateCacheFilename() const;
// Outputs to m_banner
void ReadBanner(const std::vector<u32>& buffer, int width, int height);
// Outputs to m_short_names, m_long_names, m_descriptions, m_company.
// Returns whether a file was found, not whether it contained useful data.
bool ReadXML(const QString& file_path);
};
@@ -1,95 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <memory>
#include "ui_GameGrid.h"
#include "DolphinQt/GameList/GameGrid.h"
// Game banner image size
static const u32 GRID_BANNER_WIDTH = 144;
static const u32 GRID_BANNER_HEIGHT = 48;
static const u32 ICON_BANNER_WIDTH = 64;
static const u32 ICON_BANNER_HEIGHT = 64;
DGameGrid::DGameGrid(QWidget* parent_widget) :
QListWidget(parent_widget)
{
m_ui = std::make_unique<Ui::DGameGrid>();
m_ui->setupUi(this);
SetViewStyle(STYLE_GRID);
connect(this, &QListWidget::itemActivated, this, &DGameGrid::StartGame);
}
DGameGrid::~DGameGrid()
{
for (QListWidgetItem* i : m_items.keys())
delete i;
}
GameFile* DGameGrid::SelectedGame()
{
if (!selectedItems().empty())
return m_items.value(selectedItems().at(0));
else
return nullptr;
}
void DGameGrid::SelectGame(GameFile* game)
{
if (game == nullptr)
return;
if (!selectedItems().empty())
selectedItems().at(0)->setSelected(false);
m_items.key(game)->setSelected(true);
}
void DGameGrid::SetViewStyle(GameListStyle newStyle)
{
if (newStyle == STYLE_GRID)
{
m_current_style = STYLE_GRID;
setIconSize(QSize(GRID_BANNER_WIDTH, GRID_BANNER_HEIGHT));
setViewMode(QListView::IconMode);
}
else
{
m_current_style = STYLE_ICON;
setIconSize(QSize(ICON_BANNER_WIDTH, ICON_BANNER_HEIGHT));
setViewMode(QListView::ListMode);
}
// QListView resets this when you change the view mode, so let's set it again
setDragEnabled(false);
}
void DGameGrid::AddGame(GameFile* gameItem)
{
if (m_items.values().contains(gameItem))
return;
m_items.values().append(gameItem);
QListWidgetItem* i = new QListWidgetItem;
i->setIcon(QIcon(gameItem->GetBitmap()
.scaled(GRID_BANNER_WIDTH, GRID_BANNER_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation)));
i->setText(gameItem->GetName(false));
if (gameItem->IsCompressed())
i->setTextColor(QColor("#00F"));
addItem(i);
m_items.insert(i, gameItem);
}
void DGameGrid::RemoveGame(GameFile* gameItem)
{
if (!m_items.values().contains(gameItem))
return;
QListWidgetItem* i = m_items.key(gameItem);
m_items.remove(i);
delete i;
}
-44
View File
@@ -1,44 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <QListWidget>
#include "DolphinQt/GameList/GameTracker.h"
// Predefinitions
namespace Ui
{
class DGameGrid;
}
class DGameGrid final : public QListWidget, public AbstractGameList
{
Q_OBJECT
public:
explicit DGameGrid(QWidget* parent_widget = nullptr);
~DGameGrid();
// AbstractGameList stuff
virtual GameFile* SelectedGame();
virtual void SelectGame(GameFile* game);
virtual void SetViewStyle(GameListStyle newStyle);
virtual void AddGame(GameFile* gameItem);
virtual void RemoveGame(GameFile* gameItem);
signals:
void StartGame();
private:
std::unique_ptr<Ui::DGameGrid> m_ui;
QMap<QListWidgetItem*, GameFile*> m_items;
GameListStyle m_current_style;
};
@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DGameGrid</class>
<widget class="QListWidget" name="DGameGrid">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>254</width>
<height>190</height>
</rect>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget>
<resources/>
<connections/>
</ui>
@@ -1,240 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/CDUtils.h"
#include "Common/FileSearch.h"
#include "Common/FileUtil.h"
#include "Core/ConfigManager.h"
#include "DolphinQt/GameList/GameGrid.h"
#include "DolphinQt/GameList/GameTracker.h"
#include "DolphinQt/GameList/GameTree.h"
void AbstractGameList::AddGames(QList<GameFile*> items)
{
for (GameFile* o : items)
AddGame(o);
}
void AbstractGameList::RemoveGames(QList<GameFile*> items)
{
for (GameFile* o : items)
RemoveGame(o);
}
DGameTracker::DGameTracker(QWidget* parent_widget)
: QStackedWidget(parent_widget),
m_watcher(new QFileSystemWatcher(this))
{
connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &DGameTracker::ScanForGames);
m_tree_widget = new DGameTree(this);
addWidget(m_tree_widget);
connect(m_tree_widget, &DGameTree::StartGame, this, &DGameTracker::StartGame);
m_grid_widget = new DGameGrid(this);
addWidget(m_grid_widget);
connect(m_grid_widget, &DGameGrid::StartGame, this, &DGameTracker::StartGame);
SetViewStyle(STYLE_LIST);
}
DGameTracker::~DGameTracker()
{
for (GameFile* file : m_games.values())
delete file;
}
void DGameTracker::SetViewStyle(GameListStyle newStyle)
{
if (newStyle == m_current_style)
return;
m_current_style = newStyle;
if (newStyle == STYLE_LIST || newStyle == STYLE_TREE)
{
m_tree_widget->SelectGame(SelectedGame());
setCurrentWidget(m_tree_widget);
m_tree_widget->SetViewStyle(newStyle);
}
else
{
m_grid_widget->SelectGame(SelectedGame());
setCurrentWidget(m_grid_widget);
m_grid_widget->SetViewStyle(newStyle);
}
}
GameFile* DGameTracker::SelectedGame()
{
if (currentWidget() == m_grid_widget)
return m_grid_widget->SelectedGame();
else
return m_tree_widget->SelectedGame();
}
void DGameTracker::ScanForGames()
{
setDisabled(true);
delete m_watcher;
m_watcher = new QFileSystemWatcher(this);
for (std::string dir : SConfig::GetInstance().m_ISOFolder)
m_watcher->addPath(QString::fromStdString(dir));
if (SConfig::GetInstance().m_RecursiveISOFolder)
{
for (std::string dir : FindSubdirectories(SConfig::GetInstance().m_ISOFolder, /*recursive*/ true))
m_watcher->addPath(QString::fromStdString(dir));
}
std::vector<std::string> exts;
if (SConfig::GetInstance().m_ListGC)
{
exts.push_back(".gcm");
exts.push_back(".gcz");
}
if (SConfig::GetInstance().m_ListWii || SConfig::GetInstance().m_ListGC)
{
exts.push_back(".iso");
exts.push_back(".ciso");
exts.push_back(".wbfs");
}
if (SConfig::GetInstance().m_ListWad)
exts.push_back(".wad");
if (SConfig::GetInstance().m_ListElfDol)
{
exts.push_back(".dol");
exts.push_back(".elf");
}
auto rFilenames = DoFileSearch(exts, SConfig::GetInstance().m_ISOFolder, SConfig::GetInstance().m_RecursiveISOFolder);
QList<GameFile*> newItems;
QStringList allItems;
if (!rFilenames.empty())
{
for (u32 i = 0; i < rFilenames.size(); i++)
{
std::string FileName;
SplitPath(rFilenames[i], nullptr, &FileName, nullptr);
QString NameAndPath = QString::fromStdString(rFilenames[i]);
allItems.append(NameAndPath);
if (m_games.keys().contains(NameAndPath))
continue;
GameFile* obj = new GameFile(rFilenames[i]);
if (obj->IsValid())
{
bool list = true;
switch (obj->GetCountry())
{
case DiscIO::IVolume::COUNTRY_AUSTRALIA:
if (!SConfig::GetInstance().m_ListAustralia)
list = false;
break;
case DiscIO::IVolume::COUNTRY_EUROPE:
if (!SConfig::GetInstance().m_ListPal)
list = false;
break;
case DiscIO::IVolume::COUNTRY_FRANCE:
if (!SConfig::GetInstance().m_ListFrance)
list = false;
break;
case DiscIO::IVolume::COUNTRY_GERMANY:
if (!SConfig::GetInstance().m_ListGermany)
list = false;
break;
case DiscIO::IVolume::COUNTRY_ITALY:
if (!SConfig::GetInstance().m_ListItaly)
list = false;
break;
case DiscIO::IVolume::COUNTRY_JAPAN:
if (!SConfig::GetInstance().m_ListJap)
list = false;
break;
case DiscIO::IVolume::COUNTRY_KOREA:
if (!SConfig::GetInstance().m_ListKorea)
list = false;
break;
case DiscIO::IVolume::COUNTRY_NETHERLANDS:
if (!SConfig::GetInstance().m_ListNetherlands)
list = false;
break;
case DiscIO::IVolume::COUNTRY_RUSSIA:
if (!SConfig::GetInstance().m_ListRussia)
list = false;
break;
case DiscIO::IVolume::COUNTRY_SPAIN:
if (!SConfig::GetInstance().m_ListSpain)
list = false;
break;
case DiscIO::IVolume::COUNTRY_TAIWAN:
if (!SConfig::GetInstance().m_ListTaiwan)
list = false;
break;
case DiscIO::IVolume::COUNTRY_USA:
if (!SConfig::GetInstance().m_ListUsa)
list = false;
break;
case DiscIO::IVolume::COUNTRY_WORLD:
if (!SConfig::GetInstance().m_ListWorld)
list = false;
break;
case DiscIO::IVolume::COUNTRY_UNKNOWN:
default:
if (!SConfig::GetInstance().m_ListUnknown)
list = false;
break;
}
if (list)
newItems.append(obj);
}
}
}
// Process all the new GameFiles
for (GameFile* o : newItems)
m_games.insert(o->GetFileName(), o);
// Check for games that were removed
QList<GameFile*> removedGames;
for (QString& path : m_games.keys())
{
if (!allItems.contains(path))
{
removedGames.append(m_games.value(path));
m_games.remove(path);
}
}
m_tree_widget->AddGames(newItems);
m_grid_widget->AddGames(newItems);
m_tree_widget->RemoveGames(removedGames);
m_grid_widget->RemoveGames(removedGames);
for (GameFile* file : removedGames)
delete file;
setDisabled(false);
}
void DGameTracker::SelectLastBootedGame()
{
if (!SConfig::GetInstance().m_LastFilename.empty() && File::Exists(SConfig::GetInstance().m_LastFilename))
{
QString lastfilename = QString::fromStdString(SConfig::GetInstance().m_LastFilename);
for (GameFile* game : m_games.values())
{
if (game->GetFileName() == lastfilename)
{
m_tree_widget->SelectGame(game);
break;
}
}
}
}
@@ -1,68 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <QFileSystemWatcher>
#include <QList>
#include <QMap>
#include <QStackedWidget>
#include "DolphinQt/GameList/GameFile.h"
// Predefinitions
class DGameGrid;
class DGameTree;
enum GameListStyle
{
STYLE_LIST,
STYLE_TREE,
STYLE_GRID,
STYLE_ICON
};
class AbstractGameList
{
public:
virtual GameFile* SelectedGame() = 0;
virtual void SelectGame(GameFile* game) = 0;
virtual void SetViewStyle(GameListStyle newStyle) = 0;
virtual void AddGame(GameFile* item) = 0;
void AddGames(QList<GameFile*> items);
virtual void RemoveGame(GameFile* item) = 0;
void RemoveGames(QList<GameFile*> items);
};
class DGameTracker final : public QStackedWidget
{
Q_OBJECT
public:
DGameTracker(QWidget* parent_widget = nullptr);
~DGameTracker();
GameListStyle ViewStyle() const { return m_current_style; }
void SetViewStyle(GameListStyle newStyle);
GameFile* SelectedGame();
void SelectLastBootedGame();
signals:
void StartGame();
public slots:
void ScanForGames();
private:
QMap<QString, GameFile*> m_games;
QFileSystemWatcher* m_watcher;
GameListStyle m_current_style;
DGameGrid* m_grid_widget = nullptr;
DGameTree* m_tree_widget = nullptr;
};
-167
View File
@@ -1,167 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <memory>
#include "ui_GameTree.h"
#include "DolphinQt/GameList/GameTree.h"
#include "DolphinQt/Utils/Resources.h"
#include "DolphinQt/Utils/Utils.h"
// Game banner image size
static const u32 BANNER_WIDTH = 96;
static const u32 BANNER_HEIGHT = 32;
DGameTree::DGameTree(QWidget* parent_widget) :
QTreeWidget(parent_widget)
{
m_ui = std::make_unique<Ui::DGameTree>();
m_ui->setupUi(this);
SetViewStyle(STYLE_TREE);
setIconSize(QSize(BANNER_WIDTH, BANNER_HEIGHT));
sortByColumn(COL_TITLE, Qt::AscendingOrder);
connect(this, &QTreeWidget::itemActivated, this, &DGameTree::ItemActivated);
}
DGameTree::~DGameTree()
{
int count = topLevelItemCount();
for (int a = 0; a < count; a++)
takeTopLevelItem(0);
for (QTreeWidgetItem* i : m_path_nodes.values())
{
count = i->childCount();
for (int a = 0; a < count; a++)
i->takeChild(0);
}
for (QTreeWidgetItem* i : m_path_nodes.values())
delete i;
for (QTreeWidgetItem* i : m_items.keys())
delete i;
}
void DGameTree::ResizeAllCols()
{
for (int i = 0; i < columnCount(); i++)
resizeColumnToContents(i);
}
void DGameTree::ItemActivated(QTreeWidgetItem* item)
{
if (!m_path_nodes.values().contains(item))
emit StartGame();
}
GameFile* DGameTree::SelectedGame()
{
if (!selectedItems().empty())
return m_items.value(selectedItems().at(0));
else
return nullptr;
}
void DGameTree::SelectGame(GameFile* game)
{
if (game == nullptr)
return;
if (!selectedItems().empty())
selectedItems().at(0)->setSelected(false);
m_items.key(game)->setSelected(true);
}
void DGameTree::SetViewStyle(GameListStyle newStyle)
{
if (newStyle == STYLE_LIST)
{
m_current_style = STYLE_LIST;
setIndentation(0);
RebuildTree();
}
else
{
m_current_style = STYLE_TREE;
setIndentation(20);
RebuildTree();
}
}
void DGameTree::AddGame(GameFile* item)
{
if (m_items.values().contains(item))
return;
QString folder = item->GetFolderName();
if (!m_path_nodes.contains(folder))
{
QTreeWidgetItem* i = new QTreeWidgetItem;
i->setText(0, folder);
m_path_nodes.insert(folder, i);
if (m_current_style == STYLE_TREE)
addTopLevelItem(i);
}
QTreeWidgetItem* i = new QTreeWidgetItem;
i->setIcon(COL_TYPE, QIcon(Resources::GetPlatformPixmap(item->GetPlatform())));
i->setIcon(COL_BANNER, QIcon(item->GetBitmap()));
i->setText(COL_TITLE, item->GetName(true));
i->setText(COL_DESCRIPTION, item->GetDescription());
i->setIcon(COL_REGION, QIcon(Resources::GetRegionPixmap(item->GetCountry())));
i->setText(COL_SIZE, NiceSizeFormat(item->GetFileSize()));
i->setIcon(COL_STATE, QIcon(Resources::GetRatingPixmap(item->GetEmuState())));
if (item->IsCompressed())
{
for (int col = 0; col < columnCount(); col++)
i->setTextColor(col, QColor("#00F"));
}
m_items.insert(i, item);
RebuildTree(); // TODO: only call this once per group of items added
}
void DGameTree::RemoveGame(GameFile* item)
{
if (!m_items.values().contains(item))
return;
QTreeWidgetItem* i = m_items.key(item);
m_items.remove(i);
delete i;
}
void DGameTree::RebuildTree()
{
GameFile* currentGame = SelectedGame();
int count = topLevelItemCount();
for (int a = 0; a < count; a++)
takeTopLevelItem(0);
for (QTreeWidgetItem* i : m_path_nodes.values())
{
count = i->childCount();
for (int a = 0; a < count; a++)
i->takeChild(0);
}
if (m_current_style == STYLE_TREE)
{
for (QTreeWidgetItem* i : m_path_nodes.values())
addTopLevelItem(i);
for (QTreeWidgetItem* i : m_items.keys())
m_path_nodes.value(m_items.value(i)->GetFolderName())->addChild(i);
}
else
{
for (QTreeWidgetItem* i : m_items.keys())
addTopLevelItem(i);
}
expandAll();
ResizeAllCols();
SelectGame(currentGame);
}
-62
View File
@@ -1,62 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <QTreeWidget>
#include "DolphinQt/GameList/GameTracker.h"
// Predefinitions
namespace Ui
{
class DGameTree;
}
class DGameTree final : public QTreeWidget, public AbstractGameList
{
Q_OBJECT
public:
explicit DGameTree(QWidget* parent_widget = nullptr);
~DGameTree();
// AbstractGameList stuff
virtual GameFile* SelectedGame();
virtual void SelectGame(GameFile* game);
virtual void SetViewStyle(GameListStyle newStyle);
virtual void AddGame(GameFile* item);
virtual void RemoveGame(GameFile* item);
signals:
void StartGame();
private slots:
void ItemActivated(QTreeWidgetItem* item);
private:
enum Columns
{
COL_TYPE = 0,
COL_BANNER = 1,
COL_TITLE = 2,
COL_DESCRIPTION = 3,
COL_REGION = 4,
COL_SIZE = 5,
COL_STATE = 6
};
std::unique_ptr<Ui::DGameTree> m_ui;
GameListStyle m_current_style;
QMap<QTreeWidgetItem*, GameFile*> m_items;
QMap<QString, QTreeWidgetItem*> m_path_nodes;
void RebuildTree();
void ResizeAllCols();
};
@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DGameTree</class>
<widget class="QTreeWidget" name="DGameTree">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>396</width>
<height>296</height>
</rect>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Banner</string>
</property>
</column>
<column>
<property name="text">
<string>Title</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>Region</string>
</property>
</column>
<column>
<property name="text">
<string>Size</string>
</property>
</column>
<column>
<property name="text">
<string>State</string>
</property>
</column>
</widget>
<resources/>
<connections/>
</ui>
-102
View File
@@ -1,102 +0,0 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <cstring>
#include <QApplication>
#include <QResizeEvent>
#include "Common/MsgHandler.h"
#include "Core/Host.h"
#include "DolphinQt/Host.h"
#include "DolphinQt/MainWindow.h"
HostTitleEvent::HostTitleEvent(const std::string& title)
: QEvent((QEvent::Type)HostEvent::TitleEvent),
m_title(title)
{
}
void Host_Message(int id)
{
// TODO
}
void Host_UpdateMainFrame()
{
// TODO
}
void Host_UpdateTitle(const std::string& title)
{
qApp->postEvent(g_main_window, new HostTitleEvent(title));
}
void* Host_GetRenderHandle()
{
return (void*)(g_main_window->GetRenderWidget()->winId());
}
void Host_RequestRenderWindowSize(int w, int h)
{
DRenderWidget* render_widget = g_main_window->GetRenderWidget();
qApp->postEvent(render_widget, new QResizeEvent(QSize(w, h), render_widget->size()));
}
bool Host_RendererHasFocus()
{
return g_main_window->RenderWidgetHasFocus();
}
bool Host_UIHasFocus()
{
return g_main_window->isActiveWindow();
}
bool Host_RendererIsFullscreen()
{
return false; // TODO
}
void Host_RequestFullscreen(bool enable)
{
// TODO
}
void Host_NotifyMapLoaded()
{
// TODO
}
void Host_UpdateDisasmDialog()
{
// TODO
}
void Host_SetStartupDebuggingParameters()
{
// TODO
}
void Host_SetWiiMoteConnectionState(int state)
{
// TODO
}
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
}
-19
View File
@@ -1,19 +0,0 @@
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <QEvent>
#include <string>
enum HostEvent {
TitleEvent = QEvent::User + 1,
};
class HostTitleEvent final : public QEvent
{
public:
HostTitleEvent(const std::string& title);
const std::string m_title;
};

Some files were not shown because too many files have changed in this diff Show More