commit
079be1db9a
|
@ -8,9 +8,6 @@ add_subdirectory(UICommon)
|
||||||
add_subdirectory(VideoCommon)
|
add_subdirectory(VideoCommon)
|
||||||
add_subdirectory(VideoBackends)
|
add_subdirectory(VideoBackends)
|
||||||
|
|
||||||
if(ENABLE_QT)
|
|
||||||
add_subdirectory(DolphinQt)
|
|
||||||
endif()
|
|
||||||
if(ENABLE_QT2)
|
if(ENABLE_QT2)
|
||||||
add_subdirectory(DolphinQt2)
|
add_subdirectory(DolphinQt2)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
};
|
|
|
@ -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><a href="%1">License</a> | <a href="%2">Authors</a> | <a href="%3">Support</a></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: <a href="https://dolphin-emu.org/download">dolphin-emu.org/download</a></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"><git shortrev></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>
|
|
|
@ -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()
|
|
|
@ -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) > $([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) > $([System.IO.File]::GetLastWriteTime('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)').Ticks)" />
|
|
||||||
<Message Text="Copy: @(BinaryFiles) -> $(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>
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
};
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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>
|
|
|
@ -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
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
};
|
|
|
@ -1,80 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDocumentTypes</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleTypeExtensions</key>
|
|
||||||
<array>
|
|
||||||
<string>ciso</string>
|
|
||||||
<string>dol</string>
|
|
||||||
<string>elf</string>
|
|
||||||
<string>gcm</string>
|
|
||||||
<string>gcz</string>
|
|
||||||
<string>iso</string>
|
|
||||||
<string>wad</string>
|
|
||||||
<string>wbfs</string>
|
|
||||||
</array>
|
|
||||||
<key>CFBundleTypeIconFile</key>
|
|
||||||
<string>Dolphin.icns</string>
|
|
||||||
<key>CFBundleTypeName</key>
|
|
||||||
<string>Nintendo GC/Wii file</string>
|
|
||||||
<key>CFBundleTypeRole</key>
|
|
||||||
<string>Viewer</string>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>DolphinQt</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>Resources/Dolphin.icns</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>org.dolphin-emu.dolphin</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>English</string>
|
|
||||||
<key>CFBundleLocalizations</key>
|
|
||||||
<array>
|
|
||||||
<string>ar</string>
|
|
||||||
<string>ca</string>
|
|
||||||
<string>cs</string>
|
|
||||||
<string>de</string>
|
|
||||||
<string>el</string>
|
|
||||||
<string>en</string>
|
|
||||||
<string>es</string>
|
|
||||||
<string>fa</string>
|
|
||||||
<string>fr</string>
|
|
||||||
<string>he</string>
|
|
||||||
<string>hu</string>
|
|
||||||
<string>it</string>
|
|
||||||
<string>ja</string>
|
|
||||||
<string>ko</string>
|
|
||||||
<string>nb</string>
|
|
||||||
<string>nl</string>
|
|
||||||
<string>pl</string>
|
|
||||||
<string>pt</string>
|
|
||||||
<string>pt_BR</string>
|
|
||||||
<string>ru</string>
|
|
||||||
<string>sr</string>
|
|
||||||
<string>sv</string>
|
|
||||||
<string>tr</string>
|
|
||||||
<string>zh_CN</string>
|
|
||||||
<string>zh_TW</string>
|
|
||||||
</array>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>${DOLPHIN_WC_DESCRIBE}</string>
|
|
||||||
<key>CFBundleLongVersionString</key>
|
|
||||||
<string>${DOLPHIN_WC_REVISION}</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}</string>
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>Licensed under GPL version 2</string>
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
|
||||||
<string>${OSX_MIN_VERSION}</string>
|
|
||||||
<key>NSHighResolutionCapable</key>
|
|
||||||
<true/>
|
|
||||||
<key>CSResourcesFileMapped</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,65 +0,0 @@
|
||||||
// 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"
|
|
||||||
|
|
||||||
#include "UICommon/UICommon.h"
|
|
||||||
|
|
||||||
static bool IsOsSupported()
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_OSX
|
|
||||||
return QSysInfo::MacintoshVersion >= QSysInfo::MV_10_9;
|
|
||||||
#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.9");
|
|
||||||
#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);
|
|
||||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
|
||||||
// TODO: Add command line options
|
|
||||||
|
|
||||||
UICommon::SetUserDirectory(""); // Auto-detect user folder
|
|
||||||
UICommon::CreateDirectories();
|
|
||||||
UICommon::Init();
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_main_window = new DMainWindow();
|
|
||||||
g_main_window->show();
|
|
||||||
|
|
||||||
int retcode = app.exec();
|
|
||||||
delete g_main_window;
|
|
||||||
Core::Shutdown();
|
|
||||||
UICommon::Shutdown();
|
|
||||||
return retcode;
|
|
||||||
}
|
|
|
@ -1,379 +0,0 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <QActionGroup>
|
|
||||||
#include <QCloseEvent>
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QUrl>
|
|
||||||
|
|
||||||
#include "ui_MainWindow.h"
|
|
||||||
|
|
||||||
#include "Core/BootManager.h"
|
|
||||||
#include "Core/ConfigManager.h"
|
|
||||||
#include "Core/HW/ProcessorInterface.h"
|
|
||||||
|
|
||||||
#include "DolphinQt/AboutDialog.h"
|
|
||||||
#include "DolphinQt/Host.h"
|
|
||||||
#include "DolphinQt/MainWindow.h"
|
|
||||||
#include "DolphinQt/SystemInfo.h"
|
|
||||||
#include "DolphinQt/Utils/Resources.h"
|
|
||||||
|
|
||||||
#include "VideoCommon/VideoConfig.h"
|
|
||||||
|
|
||||||
// The "g_main_window" object as defined in MainWindow.h
|
|
||||||
DMainWindow* g_main_window = nullptr;
|
|
||||||
|
|
||||||
DMainWindow::DMainWindow(QWidget* parent_widget)
|
|
||||||
: QMainWindow(parent_widget)
|
|
||||||
{
|
|
||||||
m_ui = std::make_unique<Ui::DMainWindow>();
|
|
||||||
m_ui->setupUi(this);
|
|
||||||
|
|
||||||
Resources::Init();
|
|
||||||
UpdateIcons();
|
|
||||||
setWindowIcon(Resources::GetIcon(Resources::DOLPHIN_LOGO));
|
|
||||||
|
|
||||||
// Create the GameList
|
|
||||||
m_game_tracker = new DGameTracker(this);
|
|
||||||
m_ui->centralWidget->addWidget(m_game_tracker);
|
|
||||||
m_game_tracker->ScanForGames();
|
|
||||||
m_game_tracker->SelectLastBootedGame();
|
|
||||||
|
|
||||||
// Setup the GameList style switching actions
|
|
||||||
QActionGroup* gamelistGroup = new QActionGroup(this);
|
|
||||||
gamelistGroup->addAction(m_ui->actionListView);
|
|
||||||
gamelistGroup->addAction(m_ui->actionTreeView);
|
|
||||||
gamelistGroup->addAction(m_ui->actionGridView);
|
|
||||||
gamelistGroup->addAction(m_ui->actionIconView);
|
|
||||||
|
|
||||||
// TODO: save/load this from user prefs!
|
|
||||||
m_ui->actionListView->setChecked(true);
|
|
||||||
OnGameListStyleChanged();
|
|
||||||
|
|
||||||
// Connect all the signals/slots
|
|
||||||
connect(this, &DMainWindow::CoreStateChanged, this, &DMainWindow::OnCoreStateChanged);
|
|
||||||
|
|
||||||
connect(m_ui->actionOpen, &QAction::triggered, this, [&]() {
|
|
||||||
QString filename = ShowFileDialog();
|
|
||||||
if (!filename.isNull())
|
|
||||||
StartGame(filename);
|
|
||||||
});
|
|
||||||
connect(m_ui->actionBrowse, &QAction::triggered, this, &DMainWindow::OnBrowse);
|
|
||||||
connect(m_ui->actionExit, &QAction::triggered, this, [&]() {
|
|
||||||
close();
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(m_ui->actionListView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
|
|
||||||
connect(m_ui->actionTreeView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
|
|
||||||
connect(m_ui->actionGridView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
|
|
||||||
connect(m_ui->actionIconView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
|
|
||||||
|
|
||||||
connect(m_ui->actionPlay, &QAction::triggered, this, &DMainWindow::OnPlay);
|
|
||||||
connect(m_game_tracker, &DGameTracker::StartGame, this, &DMainWindow::OnPlay);
|
|
||||||
connect(m_ui->actionStop, &QAction::triggered, this, &DMainWindow::OnStop);
|
|
||||||
connect(m_ui->actionReset, &QAction::triggered, this, &DMainWindow::OnReset);
|
|
||||||
connect(m_ui->actionScreenshot, &QAction::triggered, this, []() {
|
|
||||||
Core::SaveScreenShot();
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(m_ui->actionWebsite, &QAction::triggered, this, []() {
|
|
||||||
QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/")));
|
|
||||||
});
|
|
||||||
connect(m_ui->actionOnlineDocs, &QAction::triggered, this, []() {
|
|
||||||
QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/docs/guides/")));
|
|
||||||
});
|
|
||||||
connect(m_ui->actionGitHub, &QAction::triggered, this, []() {
|
|
||||||
QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/dolphin-emu/dolphin")));
|
|
||||||
});
|
|
||||||
connect(m_ui->actionSystemInfo, &QAction::triggered, this, [&]() {
|
|
||||||
DSystemInfo* dlg = new DSystemInfo(this);
|
|
||||||
dlg->open();
|
|
||||||
});
|
|
||||||
connect(m_ui->actionAbout, &QAction::triggered, this, [&]() {
|
|
||||||
DAboutDialog* dlg = new DAboutDialog(this);
|
|
||||||
dlg->open();
|
|
||||||
});
|
|
||||||
connect(m_ui->actionAboutQt, &QAction::triggered, this, [&]() {
|
|
||||||
QApplication::aboutQt();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update GUI items
|
|
||||||
emit CoreStateChanged(Core::CORE_UNINITIALIZED);
|
|
||||||
|
|
||||||
// Platform-specific stuff
|
|
||||||
#ifdef Q_OS_MACX
|
|
||||||
m_ui->toolbar->setMovable(false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
DMainWindow::~DMainWindow()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DMainWindow::event(QEvent* e)
|
|
||||||
{
|
|
||||||
if (e->type() == HostEvent::TitleEvent)
|
|
||||||
{
|
|
||||||
HostTitleEvent* htev = (HostTitleEvent*)e;
|
|
||||||
m_ui->statusbar->showMessage(QString::fromStdString(htev->m_title), 1500);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return QMainWindow::event(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DMainWindow::closeEvent(QCloseEvent* ce)
|
|
||||||
{
|
|
||||||
if (!OnStop())
|
|
||||||
ce->ignore();
|
|
||||||
else
|
|
||||||
QMainWindow::closeEvent(ce);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Emulation
|
|
||||||
|
|
||||||
void DMainWindow::StartGame(const QString filename)
|
|
||||||
{
|
|
||||||
m_render_widget = std::make_unique<DRenderWidget>();
|
|
||||||
m_render_widget->setWindowTitle(tr("Dolphin")); // TODO
|
|
||||||
m_render_widget->setWindowIcon(windowIcon());
|
|
||||||
|
|
||||||
if (SConfig::GetInstance().bFullscreen)
|
|
||||||
{
|
|
||||||
m_render_widget->setWindowFlags(m_render_widget->windowFlags() | Qt::BypassWindowManagerHint);
|
|
||||||
g_Config.bFullscreen = !g_Config.bBorderlessFullscreen;
|
|
||||||
m_render_widget->showFullScreen();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_ui->centralWidget->addWidget(m_render_widget.get());
|
|
||||||
m_ui->centralWidget->setCurrentWidget(m_render_widget.get());
|
|
||||||
|
|
||||||
if (SConfig::GetInstance().bRenderWindowAutoSize)
|
|
||||||
{
|
|
||||||
// Resize main window to fit render
|
|
||||||
m_render_widget->setMinimumSize(SConfig::GetInstance().iRenderWindowWidth,
|
|
||||||
SConfig::GetInstance().iRenderWindowHeight);
|
|
||||||
qApp->processEvents(); // Force a redraw so the window has time to resize
|
|
||||||
m_render_widget->setMinimumSize(0, 0); // Allow the widget to scale down
|
|
||||||
}
|
|
||||||
m_render_widget->adjustSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!BootManager::BootCore(filename.toStdString()))
|
|
||||||
{
|
|
||||||
QMessageBox::critical(this, tr("Fatal error"), tr("Failed to init Core"), QMessageBox::Ok);
|
|
||||||
if (SConfig::GetInstance().bFullscreen)
|
|
||||||
m_render_widget->close();
|
|
||||||
else
|
|
||||||
m_ui->centralWidget->removeWidget(m_render_widget.get());
|
|
||||||
m_render_widget.reset();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DisableScreensaver();
|
|
||||||
emit CoreStateChanged(Core::CORE_RUN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DMainWindow::DisableScreensaver()
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
// Prevents Windows from sleeping or turning off the display
|
|
||||||
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void DMainWindow::EnableScreensaver()
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
// Allows Windows to sleep and turn off the display
|
|
||||||
SetThreadExecutionState(ES_CONTINUOUS);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DMainWindow::RequestBootFilename()
|
|
||||||
{
|
|
||||||
// If a game is already selected, just return the filename
|
|
||||||
if (m_game_tracker->SelectedGame() != nullptr)
|
|
||||||
return m_game_tracker->SelectedGame()->GetFileName();
|
|
||||||
|
|
||||||
return ShowFileDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DMainWindow::ShowFileDialog()
|
|
||||||
{
|
|
||||||
return QFileDialog::getOpenFileName(this, tr("Open File"), QString(),
|
|
||||||
tr("All supported ROMs (%1);;All files (*)")
|
|
||||||
.arg(QStringLiteral("*.gcm *.iso *.ciso *.gcz *.wbfs *.elf *.dol *.dff *.tmd *.wad")));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DMainWindow::ShowFolderDialog()
|
|
||||||
{
|
|
||||||
return QFileDialog::getExistingDirectory(this, tr("Browse for a directory to add"),
|
|
||||||
QDir::homePath(), QFileDialog::ShowDirsOnly);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DMainWindow::DoStartPause()
|
|
||||||
{
|
|
||||||
if (Core::GetState() == Core::CORE_RUN)
|
|
||||||
{
|
|
||||||
Core::SetState(Core::CORE_PAUSE);
|
|
||||||
emit CoreStateChanged(Core::CORE_PAUSE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Core::SetState(Core::CORE_RUN);
|
|
||||||
emit CoreStateChanged(Core::CORE_RUN);
|
|
||||||
}
|
|
||||||
if (SConfig::GetInstance().bHideCursor)
|
|
||||||
m_render_widget->setCursor(Qt::BlankCursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DMainWindow::OnBrowse()
|
|
||||||
{
|
|
||||||
std::string path = ShowFolderDialog().toStdString();
|
|
||||||
std::vector<std::string>& iso_folder = SConfig::GetInstance().m_ISOFolder;
|
|
||||||
if (!path.empty())
|
|
||||||
{
|
|
||||||
auto itResult = std::find(iso_folder.begin(), iso_folder.end(), path);
|
|
||||||
|
|
||||||
if (itResult == iso_folder.end())
|
|
||||||
{
|
|
||||||
iso_folder.push_back(path);
|
|
||||||
SConfig::GetInstance().SaveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_game_tracker->ScanForGames();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DMainWindow::OnPlay()
|
|
||||||
{
|
|
||||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
||||||
{
|
|
||||||
DoStartPause();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// initialize Core and boot the game
|
|
||||||
QString filename = RequestBootFilename();
|
|
||||||
if (!filename.isNull())
|
|
||||||
StartGame(filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DMainWindow::OnStop()
|
|
||||||
{
|
|
||||||
if (Core::GetState() == Core::CORE_UNINITIALIZED || m_isStopping)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Ask for confirmation in case the user accidentally clicked Stop / Escape
|
|
||||||
if (SConfig::GetInstance().bConfirmStop)
|
|
||||||
{
|
|
||||||
// Pause emulation if it isn't already
|
|
||||||
bool wasPaused = false;
|
|
||||||
if (Core::GetState() == Core::CORE_PAUSE)
|
|
||||||
{
|
|
||||||
wasPaused = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Core::SetState(Core::CORE_PAUSE);
|
|
||||||
emit CoreStateChanged(Core::CORE_PAUSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
QMessageBox::StandardButton ret = QMessageBox::question(m_render_widget.get(), tr("Please confirm..."),
|
|
||||||
tr("Do you want to stop the current emulation?"),
|
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
|
||||||
|
|
||||||
if (ret == QMessageBox::No)
|
|
||||||
{
|
|
||||||
if (!wasPaused)
|
|
||||||
DoStartPause();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DMainWindow::Stop()
|
|
||||||
{
|
|
||||||
m_isStopping = true;
|
|
||||||
|
|
||||||
// TODO: Movie stuff
|
|
||||||
// TODO: Show the author/description dialog here
|
|
||||||
|
|
||||||
BootManager::Stop();
|
|
||||||
EnableScreensaver();
|
|
||||||
// TODO: Restore original window title
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// If batch mode was specified on the command-line, exit now.
|
|
||||||
//if (m_bBatchMode)
|
|
||||||
// Close(true);
|
|
||||||
|
|
||||||
if (SConfig::GetInstance().bFullscreen)
|
|
||||||
m_render_widget->close();
|
|
||||||
else
|
|
||||||
m_ui->centralWidget->removeWidget(m_render_widget.get());
|
|
||||||
m_render_widget.reset();
|
|
||||||
|
|
||||||
emit CoreStateChanged(Core::CORE_UNINITIALIZED);
|
|
||||||
m_isStopping = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DMainWindow::OnReset()
|
|
||||||
{
|
|
||||||
// TODO: Movie needs to be reset here
|
|
||||||
ProcessorInterface::ResetButton_Tap();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DMainWindow::OnGameListStyleChanged()
|
|
||||||
{
|
|
||||||
if (m_ui->actionListView->isChecked())
|
|
||||||
m_game_tracker->SetViewStyle(STYLE_LIST);
|
|
||||||
else if (m_ui->actionTreeView->isChecked())
|
|
||||||
m_game_tracker->SetViewStyle(STYLE_TREE);
|
|
||||||
else if (m_ui->actionGridView->isChecked())
|
|
||||||
m_game_tracker->SetViewStyle(STYLE_GRID);
|
|
||||||
else if (m_ui->actionIconView->isChecked())
|
|
||||||
m_game_tracker->SetViewStyle(STYLE_ICON);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DMainWindow::OnCoreStateChanged(Core::EState state)
|
|
||||||
{
|
|
||||||
bool is_not_initialized = (state == Core::CORE_UNINITIALIZED);
|
|
||||||
bool is_running = (state == Core::CORE_RUN);
|
|
||||||
bool is_paused = (state == Core::CORE_PAUSE);
|
|
||||||
|
|
||||||
// Update the toolbar
|
|
||||||
m_ui->actionPlay->setEnabled(is_not_initialized || is_running || is_paused);
|
|
||||||
if (is_running)
|
|
||||||
{
|
|
||||||
m_ui->actionPlay->setIcon(Resources::GetIcon(Resources::TOOLBAR_PAUSE));
|
|
||||||
m_ui->actionPlay->setText(tr("Pause"));
|
|
||||||
}
|
|
||||||
else if (is_paused || is_not_initialized)
|
|
||||||
{
|
|
||||||
m_ui->actionPlay->setIcon(Resources::GetIcon(Resources::TOOLBAR_PLAY));
|
|
||||||
m_ui->actionPlay->setText(tr("Play"));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ui->actionStop->setEnabled(!is_not_initialized);
|
|
||||||
m_ui->actionOpen->setEnabled(is_not_initialized);
|
|
||||||
m_game_tracker->setEnabled(is_not_initialized);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update all the icons used in DMainWindow with fresh ones from
|
|
||||||
// "Resources". Call this function after changing the icon theme.
|
|
||||||
void DMainWindow::UpdateIcons()
|
|
||||||
{
|
|
||||||
// Play/Pause is handled in OnCoreStateChanged().
|
|
||||||
m_ui->actionStop->setIcon(Resources::GetIcon(Resources::TOOLBAR_STOP));
|
|
||||||
m_ui->actionScreenshot->setIcon(Resources::GetIcon(Resources::TOOLBAR_SCREENSHOT));
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <QMainWindow>
|
|
||||||
|
|
||||||
#include "Core/Core.h"
|
|
||||||
|
|
||||||
#include "DolphinQt/GameList/GameTracker.h"
|
|
||||||
#include "DolphinQt/VideoInterface/RenderWidget.h"
|
|
||||||
|
|
||||||
// Predefinitions
|
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class DMainWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
class DMainWindow final : public QMainWindow
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit DMainWindow(QWidget* parent_widget = nullptr);
|
|
||||||
~DMainWindow();
|
|
||||||
|
|
||||||
// DRenderWidget
|
|
||||||
bool RenderWidgetHasFocus() const { return m_render_widget->isActiveWindow(); }
|
|
||||||
DRenderWidget* GetRenderWidget() { return m_render_widget.get(); }
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void CoreStateChanged(Core::EState state);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
// Main toolbar (also used by DRenderWidget)
|
|
||||||
bool OnStop();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
// Emulation
|
|
||||||
void StartGame(const QString filename);
|
|
||||||
void OnCoreStateChanged(Core::EState state);
|
|
||||||
|
|
||||||
// Main toolbar
|
|
||||||
void OnBrowse();
|
|
||||||
void OnPlay();
|
|
||||||
void OnReset();
|
|
||||||
|
|
||||||
// View menu
|
|
||||||
void OnGameListStyleChanged();
|
|
||||||
|
|
||||||
// Misc.
|
|
||||||
void UpdateIcons();
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool event(QEvent* e) override;
|
|
||||||
void closeEvent(QCloseEvent* ce) override;
|
|
||||||
std::unique_ptr<Ui::DMainWindow> m_ui;
|
|
||||||
DGameTracker* m_game_tracker;
|
|
||||||
|
|
||||||
// Misc.
|
|
||||||
void DisableScreensaver();
|
|
||||||
void EnableScreensaver();
|
|
||||||
// Emulation
|
|
||||||
QString RequestBootFilename();
|
|
||||||
QString ShowFileDialog();
|
|
||||||
QString ShowFolderDialog();
|
|
||||||
void DoStartPause();
|
|
||||||
bool Stop();
|
|
||||||
|
|
||||||
std::unique_ptr<DRenderWidget> m_render_widget;
|
|
||||||
bool m_isStopping = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Pointer to the only instance of DMainWindow, used by Host_*
|
|
||||||
extern DMainWindow* g_main_window;
|
|
|
@ -1,253 +0,0 @@
|
||||||
<?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>990</width>
|
|
||||||
<height>590</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Dolphin</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="unifiedTitleAndToolBarOnMac">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QStackedWidget" name="centralWidget"/>
|
|
||||||
<widget class="QMenuBar" name="menubar">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>990</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="nativeMenuBar">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QMenu" name="mnuFile">
|
|
||||||
<property name="title">
|
|
||||||
<string>Fi&le</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionOpen"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionBrowse"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionExit"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="mnuEmulation">
|
|
||||||
<property name="title">
|
|
||||||
<string>E&mulation</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionPlay"/>
|
|
||||||
<addaction name="actionStop"/>
|
|
||||||
<addaction name="actionReset"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionScreenshot"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="mnuOptions">
|
|
||||||
<property name="title">
|
|
||||||
<string>Optio&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>&View</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QMenu" name="mnuListStyle">
|
|
||||||
<property name="title">
|
|
||||||
<string>&List style</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionListView"/>
|
|
||||||
<addaction name="actionTreeView"/>
|
|
||||||
<addaction name="actionGridView"/>
|
|
||||||
<addaction name="actionIconView"/>
|
|
||||||
</widget>
|
|
||||||
<addaction name="mnuListStyle"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="mnuHelp">
|
|
||||||
<property name="title">
|
|
||||||
<string>Help</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionWebsite"/>
|
|
||||||
<addaction name="actionOnlineDocs"/>
|
|
||||||
<addaction name="actionGitHub"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionSystemInfo"/>
|
|
||||||
<addaction name="actionAbout"/>
|
|
||||||
<addaction name="actionAboutQt"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="mnuMovie">
|
|
||||||
<property name="title">
|
|
||||||
<string>Movie</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<addaction name="mnuFile"/>
|
|
||||||
<addaction name="mnuView"/>
|
|
||||||
<addaction name="mnuEmulation"/>
|
|
||||||
<addaction name="mnuMovie"/>
|
|
||||||
<addaction name="mnuOptions"/>
|
|
||||||
<addaction name="mnuTools"/>
|
|
||||||
<addaction name="mnuHelp"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
|
||||||
<widget class="QToolBar" name="toolbar">
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Toolbar</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>TopToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<addaction name="actionPlay"/>
|
|
||||||
<addaction name="actionStop"/>
|
|
||||||
<addaction name="actionScreenshot"/>
|
|
||||||
</widget>
|
|
||||||
<action name="actionWebsite">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Website</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionOnlineDocs">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Online Documentation</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionGitHub">
|
|
||||||
<property name="text">
|
|
||||||
<string>&GitHub Repository</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionAbout">
|
|
||||||
<property name="text">
|
|
||||||
<string>&About</string>
|
|
||||||
</property>
|
|
||||||
<property name="menuRole">
|
|
||||||
<enum>QAction::AboutRole</enum>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionOpen">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Open...</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Open file...</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+O</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionSystemInfo">
|
|
||||||
<property name="text">
|
|
||||||
<string>&System Information</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionPlay">
|
|
||||||
<property name="text">
|
|
||||||
<string>Play</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>F10</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconVisibleInMenu">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionStop">
|
|
||||||
<property name="text">
|
|
||||||
<string>Stop</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Esc</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconVisibleInMenu">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionAboutQt">
|
|
||||||
<property name="text">
|
|
||||||
<string>About &Qt</string>
|
|
||||||
</property>
|
|
||||||
<property name="menuRole">
|
|
||||||
<enum>QAction::AboutQtRole</enum>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionListView">
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&List view</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionTreeView">
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Tree view</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionGridView">
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Grid view</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionIconView">
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Icon view</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionBrowse">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Browse for ISOs...</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionExit">
|
|
||||||
<property name="text">
|
|
||||||
<string>Exit</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionReset">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Reset</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionScreenshot">
|
|
||||||
<property name="text">
|
|
||||||
<string>Screenshot</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconVisibleInMenu">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
Binary file not shown.
|
@ -1,109 +0,0 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <QClipboard>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QThread>
|
|
||||||
|
|
||||||
#include "ui_SystemInfo.h"
|
|
||||||
|
|
||||||
#include "Common/Common.h"
|
|
||||||
#include "Common/CPUDetect.h"
|
|
||||||
|
|
||||||
#include "DolphinQt/SystemInfo.h"
|
|
||||||
|
|
||||||
DSystemInfo::DSystemInfo(QWidget* parent_widget) :
|
|
||||||
QDialog(parent_widget)
|
|
||||||
{
|
|
||||||
setWindowModality(Qt::WindowModal);
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
|
|
||||||
m_ui = std::make_unique<Ui::DSystemInfo>();
|
|
||||||
m_ui->setupUi(this);
|
|
||||||
|
|
||||||
UpdateSystemInfo();
|
|
||||||
|
|
||||||
QPushButton* btn = m_ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
|
|
||||||
connect(btn, &QPushButton::pressed, this, &DSystemInfo::CopyPressed);
|
|
||||||
}
|
|
||||||
|
|
||||||
DSystemInfo::~DSystemInfo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSystemInfo::CopyPressed()
|
|
||||||
{
|
|
||||||
QClipboard* clipboard = QApplication::clipboard();
|
|
||||||
clipboard->setText(m_ui->txtSysInfo->toPlainText());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSystemInfo::UpdateSystemInfo()
|
|
||||||
{
|
|
||||||
QString sysinfo;
|
|
||||||
|
|
||||||
sysinfo += QStringLiteral("System\n===========================\n");
|
|
||||||
sysinfo += QStringLiteral("OS: %1\n").arg(GetOS());
|
|
||||||
sysinfo += QStringLiteral("CPU: %1, %2 logical processors\n")
|
|
||||||
.arg(QString::fromStdString(cpu_info.Summarize()))
|
|
||||||
.arg(QThread::idealThreadCount());
|
|
||||||
|
|
||||||
sysinfo += QStringLiteral("\nDolphin\n===========================\n");
|
|
||||||
sysinfo += QStringLiteral("SCM: branch %1, rev %2\n")
|
|
||||||
.arg(QString::fromUtf8(scm_branch_str))
|
|
||||||
.arg(QString::fromUtf8(scm_rev_git_str));
|
|
||||||
|
|
||||||
sysinfo += QStringLiteral("\nGUI\n===========================\n");
|
|
||||||
sysinfo += QStringLiteral("Compiled for Qt: %1\n").arg(QStringLiteral(QT_VERSION_STR));
|
|
||||||
sysinfo += QStringLiteral("Running on Qt: %1").arg(QString::fromUtf8(qVersion()));
|
|
||||||
|
|
||||||
m_ui->txtSysInfo->setPlainText(sysinfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DSystemInfo::GetOS() const
|
|
||||||
{
|
|
||||||
QString ret;
|
|
||||||
/* DON'T REORDER WITHOUT READING Qt DOCS! */
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
ret += QStringLiteral("Windows ");
|
|
||||||
switch (QSysInfo::WindowsVersion) {
|
|
||||||
case QSysInfo::WV_VISTA: ret += QStringLiteral("Vista"); break;
|
|
||||||
case QSysInfo::WV_WINDOWS7: ret += QStringLiteral("7"); break;
|
|
||||||
case QSysInfo::WV_WINDOWS8: ret += QStringLiteral("8"); break;
|
|
||||||
case QSysInfo::WV_WINDOWS8_1: ret += QStringLiteral("8.1"); break;
|
|
||||||
case QSysInfo::WV_WINDOWS10: ret += QStringLiteral("10"); break;
|
|
||||||
default: ret += QStringLiteral("(unknown)"); break;
|
|
||||||
}
|
|
||||||
#elif defined(Q_OS_MAC)
|
|
||||||
ret += QStringLiteral("Mac OS X ");
|
|
||||||
switch (QSysInfo::MacintoshVersion) {
|
|
||||||
case QSysInfo::MV_10_9: ret += QStringLiteral("10.9"); break;
|
|
||||||
case QSysInfo::MV_10_10: ret += QStringLiteral("10.10"); break;
|
|
||||||
case QSysInfo::MV_10_11: ret += QStringLiteral("10.11"); break;
|
|
||||||
default: ret += QStringLiteral("(unknown)"); break;
|
|
||||||
}
|
|
||||||
#elif defined(Q_OS_LINUX)
|
|
||||||
ret += QStringLiteral("Linux");
|
|
||||||
#elif defined(Q_OS_FREEBSD)
|
|
||||||
ret += QStringLiteral("FreeBSD");
|
|
||||||
#elif defined(Q_OS_OPENBSD)
|
|
||||||
ret += QStringLiteral("OpenBSD");
|
|
||||||
#elif defined(Q_OS_NETBSD)
|
|
||||||
ret += QStringLiteral("NetBSD");
|
|
||||||
#elif defined(Q_OS_BSD4)
|
|
||||||
ret += QStringLiteral("Other BSD");
|
|
||||||
#elif defined(Q_OS_UNIX)
|
|
||||||
ret += QStringLiteral("Unix");
|
|
||||||
#else
|
|
||||||
ret += QStringLiteral("Unknown");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_WS_X11) || defined(Q_OS_X11)
|
|
||||||
ret += QStringLiteral(" X11");
|
|
||||||
#elif defined(Q_WS_WAYLAND)
|
|
||||||
ret += QStringLiteral(" Wayland");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class DSystemInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
class DSystemInfo final : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit DSystemInfo(QWidget* parent_widget = nullptr);
|
|
||||||
~DSystemInfo();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void CopyPressed();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<Ui::DSystemInfo> m_ui;
|
|
||||||
|
|
||||||
void UpdateSystemInfo();
|
|
||||||
QString GetOS() const;
|
|
||||||
};
|
|
|
@ -1,71 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>DSystemInfo</class>
|
|
||||||
<widget class="QDialog" name="DSystemInfo">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>446</width>
|
|
||||||
<height>298</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>System Information</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QPlainTextEdit" name="txtSysInfo">
|
|
||||||
<property name="readOnly">
|
|
||||||
<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::Close</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>DSystemInfo</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>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>DSystemInfo</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>316</x>
|
|
||||||
<y>260</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
|
@ -1,121 +0,0 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QFile>
|
|
||||||
|
|
||||||
#include "Common/CommonPaths.h"
|
|
||||||
#include "Common/FileUtil.h"
|
|
||||||
#include "Core/ConfigManager.h"
|
|
||||||
|
|
||||||
#include "DolphinQt/Utils/Resources.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_DIR + DIR_SEP);
|
|
||||||
|
|
||||||
m_regions.resize(DiscIO::IVolume::NUMBER_OF_COUNTRIES);
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_JAPAN].load(GetImageFilename("Flag_Japan", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_EUROPE].load(GetImageFilename("Flag_Europe", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_USA].load(GetImageFilename("Flag_USA", dir));
|
|
||||||
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_AUSTRALIA].load(GetImageFilename("Flag_Australia", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_FRANCE].load(GetImageFilename("Flag_France", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_GERMANY].load(GetImageFilename("Flag_Germany", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_ITALY].load(GetImageFilename("Flag_Italy", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_KOREA].load(GetImageFilename("Flag_Korea", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_NETHERLANDS].load(GetImageFilename("Flag_Netherlands", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_RUSSIA].load(GetImageFilename("Flag_Russia", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_SPAIN].load(GetImageFilename("Flag_Spain", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_TAIWAN].load(GetImageFilename("Flag_Taiwan", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_WORLD].load(GetImageFilename("Flag_International", dir));
|
|
||||||
m_regions[DiscIO::IVolume::COUNTRY_UNKNOWN].load(GetImageFilename("Flag_Unknown", dir));
|
|
||||||
|
|
||||||
m_platforms.resize(4);
|
|
||||||
m_platforms[0].load(GetImageFilename("Platform_Gamecube", dir));
|
|
||||||
m_platforms[1].load(GetImageFilename("Platform_Wii", dir));
|
|
||||||
m_platforms[2].load(GetImageFilename("Platform_Wad", dir));
|
|
||||||
m_platforms[3].load(GetImageFilename("Platform_File", dir));
|
|
||||||
|
|
||||||
m_ratings.resize(6);
|
|
||||||
m_ratings[0].load(GetImageFilename("rating0", dir));
|
|
||||||
m_ratings[1].load(GetImageFilename("rating1", dir));
|
|
||||||
m_ratings[2].load(GetImageFilename("rating2", dir));
|
|
||||||
m_ratings[3].load(GetImageFilename("rating3", dir));
|
|
||||||
m_ratings[4].load(GetImageFilename("rating4", dir));
|
|
||||||
m_ratings[5].load(GetImageFilename("rating5", dir));
|
|
||||||
|
|
||||||
m_pixmaps.resize(NUM_ICONS);
|
|
||||||
m_pixmaps[DOLPHIN_LOGO].load(GetImageFilename("Dolphin", dir));
|
|
||||||
m_pixmaps[DOLPHIN_LOGO_LARGE].load(GetImageFilename("dolphin_logo", dir));
|
|
||||||
m_pixmaps[BANNER_MISSING].load(GetImageFilename("nobanner", dir));
|
|
||||||
UpdatePixmaps();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Resources::UpdatePixmaps()
|
|
||||||
{
|
|
||||||
QString dir = QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().theme_name));
|
|
||||||
m_pixmaps[TOOLBAR_OPEN].load(GetImageFilename("open", dir));
|
|
||||||
m_pixmaps[TOOLBAR_REFRESH].load(GetImageFilename("refresh", dir));
|
|
||||||
m_pixmaps[TOOLBAR_BROWSE].load(GetImageFilename("browse", dir));
|
|
||||||
m_pixmaps[TOOLBAR_PLAY].load(GetImageFilename("play", dir));
|
|
||||||
m_pixmaps[TOOLBAR_STOP].load(GetImageFilename("stop", dir));
|
|
||||||
m_pixmaps[TOOLBAR_PAUSE].load(GetImageFilename("pause", dir));
|
|
||||||
m_pixmaps[TOOLBAR_FULLSCREEN].load(GetImageFilename("fullscreen", dir));
|
|
||||||
m_pixmaps[TOOLBAR_SCREENSHOT].load(GetImageFilename("screenshot", dir));
|
|
||||||
m_pixmaps[TOOLBAR_CONFIGURE].load(GetImageFilename("config", dir));
|
|
||||||
m_pixmaps[TOOLBAR_GRAPHICS].load(GetImageFilename("graphics", dir));
|
|
||||||
m_pixmaps[TOOLBAR_CONTROLLERS].load(GetImageFilename("classic", dir));
|
|
||||||
m_pixmaps[TOOLBAR_HELP].load(GetImageFilename("config", dir)); // TODO
|
|
||||||
// TODO: toolbar[MEMCARD];
|
|
||||||
// TODO: toolbar[HOTKEYS];
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Resources::GetImageFilename(const char* name, QString dir)
|
|
||||||
{
|
|
||||||
QString fileName = QString::fromUtf8(name);
|
|
||||||
if (qApp->devicePixelRatio() >= 2)
|
|
||||||
{
|
|
||||||
fileName.prepend(dir).append(QStringLiteral("@2x.png"));
|
|
||||||
if (QFile::exists(fileName))
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
return fileName.prepend(dir).append(QStringLiteral(".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));
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
// 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_GRAPHICS,
|
|
||||||
TOOLBAR_CONTROLLERS,
|
|
||||||
TOOLBAR_HELP,
|
|
||||||
MEMCARD,
|
|
||||||
HOTKEYS,
|
|
||||||
DOLPHIN_LOGO,
|
|
||||||
DOLPHIN_LOGO_LARGE,
|
|
||||||
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;
|
|
||||||
|
|
||||||
static QString GetImageFilename(const char* name, QString dir);
|
|
||||||
};
|
|
|
@ -1,28 +0,0 @@
|
||||||
// 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 = {
|
|
||||||
QStringLiteral("KB"),
|
|
||||||
QStringLiteral("MB"),
|
|
||||||
QStringLiteral("GB"),
|
|
||||||
QStringLiteral("TB"),
|
|
||||||
QStringLiteral("PB"),
|
|
||||||
QStringLiteral("EB")
|
|
||||||
};
|
|
||||||
QStringListIterator i(list);
|
|
||||||
QString unit = QStringLiteral("b");
|
|
||||||
double num = size;
|
|
||||||
while (num >= 1024.0 && i.hasNext())
|
|
||||||
{
|
|
||||||
unit = i.next();
|
|
||||||
num /= 1024.0;
|
|
||||||
}
|
|
||||||
return QStringLiteral("%1 %2").arg(QString::number(num, 'f', 1)).arg(unit);
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
|
||||||
|
|
||||||
QString NiceSizeFormat(s64 size);
|
|
|
@ -1,27 +0,0 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include <QCloseEvent>
|
|
||||||
#include <QMessageBox>
|
|
||||||
|
|
||||||
#include "DolphinQt/MainWindow.h"
|
|
||||||
#include "DolphinQt/VideoInterface/RenderWidget.h"
|
|
||||||
|
|
||||||
DRenderWidget::DRenderWidget(QWidget* parent_widget)
|
|
||||||
: QWidget(parent_widget)
|
|
||||||
{
|
|
||||||
setAttribute(Qt::WA_NativeWindow, true);
|
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, true);
|
|
||||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DRenderWidget::closeEvent(QCloseEvent* e)
|
|
||||||
{
|
|
||||||
if (!g_main_window->OnStop())
|
|
||||||
{
|
|
||||||
e->ignore();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QWidget::closeEvent(e);
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
class DRenderWidget final : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
DRenderWidget(QWidget* parent_widget = nullptr);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// Some window managers start window dragging if an "empty" window area was clicked.
|
|
||||||
// Prevent this by intercepting the mouse press event.
|
|
||||||
void mousePressEvent(QMouseEvent*) override {}
|
|
||||||
void paintEvent(QPaintEvent*) override {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void closeEvent(QCloseEvent* e) override;
|
|
||||||
};
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ VisualStudioVersion = 14.0.23107.0
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\DolphinWX.vcxproj", "{47411FDB-1BF2-48D0-AB4E-C7C41160F898}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\DolphinWX.vcxproj", "{47411FDB-1BF2-48D0-AB4E-C7C41160F898}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DolphinQt", "Core\DolphinQt\DolphinQt.vcxproj", "{69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core\Core.vcxproj", "{E54CF649-140E-4255-81A5-30A673C1FB36}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core\Core.vcxproj", "{E54CF649-140E-4255-81A5-30A673C1FB36}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioCommon", "Core\AudioCommon\AudioCommon.vcxproj", "{54AA7840-5BEB-4A0C-9452-74BA4CC7FD44}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioCommon", "Core\AudioCommon\AudioCommon.vcxproj", "{54AA7840-5BEB-4A0C-9452-74BA4CC7FD44}"
|
||||||
|
|
Loading…
Reference in New Issue