diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index 8da95c59a9..efc04e1f43 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -8,9 +8,6 @@ add_subdirectory(UICommon) add_subdirectory(VideoCommon) add_subdirectory(VideoBackends) -if(ENABLE_QT) - add_subdirectory(DolphinQt) -endif() if(ENABLE_QT2) add_subdirectory(DolphinQt2) endif() diff --git a/Source/Core/DolphinQt/AboutDialog.cpp b/Source/Core/DolphinQt/AboutDialog.cpp deleted file mode 100644 index 3ef7f91b48..0000000000 --- a/Source/Core/DolphinQt/AboutDialog.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include -#include -#include - -#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(); - 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() -{ -} diff --git a/Source/Core/DolphinQt/AboutDialog.h b/Source/Core/DolphinQt/AboutDialog.h deleted file mode 100644 index fa476a1024..0000000000 --- a/Source/Core/DolphinQt/AboutDialog.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include -#include - -// Predefinitions -namespace Ui -{ -class DAboutDialog; -} - -class DAboutDialog final : public QDialog -{ - Q_OBJECT - -public: - explicit DAboutDialog(QWidget* parent_widget = nullptr); - ~DAboutDialog(); - -private: - std::unique_ptr m_ui; -}; diff --git a/Source/Core/DolphinQt/AboutDialog.ui b/Source/Core/DolphinQt/AboutDialog.ui deleted file mode 100644 index 5cce02c2b0..0000000000 --- a/Source/Core/DolphinQt/AboutDialog.ui +++ /dev/null @@ -1,151 +0,0 @@ - - - DAboutDialog - - - - 0 - 0 - - - - About Dolphin - - - - 22 - - - 18 - - - 13 - - - - - <a href="%1">License</a> | <a href="%2">Authors</a> | <a href="%3">Support</a> - - - Qt::RichText - - - true - - - - - - - - 7 - - - - Branch: %1 -Revision: %2 - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 0 - 0 - - - - 16 - - - - - - - Check for updates: <a href="https://dolphin-emu.org/download">dolphin-emu.org/download</a> - - - Qt::RichText - - - true - - - - - - - - 31 - - - - Dolphin - - - Qt::PlainText - - - - - - - - 7 - - - - © 2003-%1 Dolphin Team. “GameCube” and “Wii” are trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way. - - - Qt::PlainText - - - Qt::AlignCenter - - - - - - - - 9 - 75 - false - true - - - - <git shortrev> - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - 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. - - - Qt::PlainText - - - - - - - - diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt deleted file mode 100644 index 186db06c5c..0000000000 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ /dev/null @@ -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() diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj b/Source/Core/DolphinQt/DolphinQt.vcxproj deleted file mode 100644 index abb186303c..0000000000 --- a/Source/Core/DolphinQt/DolphinQt.vcxproj +++ /dev/null @@ -1,189 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0} - - - - - Application - v140 - Unicode - - - true - - - false - - - - - - - - - - - - - - - 0x00400000 - false - true - $(ExternalsDir)OpenAL\$(PlatformName);%(AdditionalLibraryDirectories) - iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;%(AdditionalDependencies) - Windows - - - $(ProjectDir)\VideoInterface;$(ProjectDir)\GameList;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {8ada04d7-6db1-4da4-ab55-64fb12a0997b} - - - {4c9f135b-a85e-430c-bad4-4c67ef5fc12c} - - - {ab993f38-c31d-4897-b139-a620c42bc565} - - - {93d73454-2512-424e-9cda-4bb357fe13dd} - - - {ff213b23-2c26-4214-9f88-85271e557e87} - - - {54aa7840-5beb-4a0c-9452-74ba4cc7fd44} - - - {2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4} - - - {41279555-f94f-4ebc-99de-af863c10c5c4} - - - {e54cf649-140e-4255-81a5-30a673c1fb36} - - - {160bdc25-5626-4b0d-bdd8-2953d9777fb5} - - - {6bbd47cf-91fd-4077-b676-8b76980178a9} - - - {96020103-4ba5-4fd2-b4aa-5b6d24492d4e} - - - {ec1a314c-5588-4506-9c1e-2e58e5817f75} - - - {a4c423aa-f57c-46c7-a172-d1a777017d29} - - - {3de9ee35-3e91-4f27-a014-2866ad8c3fe3} - - - {604C8368-F34A-4D55-82C8-CC92A0C13254} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj.filters b/Source/Core/DolphinQt/DolphinQt.vcxproj.filters deleted file mode 100644 index 2c58321344..0000000000 --- a/Source/Core/DolphinQt/DolphinQt.vcxproj.filters +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - Utils - - - Utils - - - GameList - - - GameList - - - GameList - - - GameList - - - VideoInterface - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - - - - - - - - - - - - - - GameList - - - - - - - - {2497846c-00eb-4f1c-b437-2d32eac9027c} - - - {730f2ae7-a686-4bc8-bb49-b4f8bd240329} - - - {c18a1fb3-64ff-4249-b808-d73a56ea3a2d} - - - {be9925db-448c-46d8-a5a3-fb957490d3ef} - - - - - - Utils - - - Utils - - - VideoInterface - - - GameList - - - GameList - - - GameList - - - GameList - - - \ No newline at end of file diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj.user b/Source/Core/DolphinQt/DolphinQt.vcxproj.user deleted file mode 100644 index 5804e0cf2d..0000000000 --- a/Source/Core/DolphinQt/DolphinQt.vcxproj.user +++ /dev/null @@ -1,10 +0,0 @@ - - - - - $(BinaryOutputDir)$(TargetFileName) - $(BinaryOutputDir) - WindowsLocalDebugger - false - - \ No newline at end of file diff --git a/Source/Core/DolphinQt/GameList/GameFile.cpp b/Source/Core/DolphinQt/GameList/GameFile.cpp deleted file mode 100644 index 0d773d1fe0..0000000000 --- a/Source/Core/DolphinQt/GameList/GameFile.cpp +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include -#include - -#include -#include -#include -#include -#include - -#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 ConvertLocalizedStrings(std::map strings) -{ - QMap result; - - for (auto entry : strings) - result.insert(entry.first, QString::fromStdString(entry.second).trimmed()); - - return result; -} - -template -static QMap CastLocalizedStrings(QMap strings) -{ - QMap 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 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 buffer = DiscIO::IVolume::GetWiiBanner(&width, &height, m_title_id); - ReadBanner(buffer, width, height); - if (!m_banner.isNull()) - SaveToCache(); - } - } - else - { - std::unique_ptr 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 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 short_names; - QMap long_names; - QMap 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(short_names); - m_long_names = CastLocalizedStrings(long_names); - m_descriptions = CastLocalizedStrings(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(m_short_names) - << CastLocalizedStrings(m_long_names) - << CastLocalizedStrings(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& 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 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; -} diff --git a/Source/Core/DolphinQt/GameList/GameFile.h b/Source/Core/DolphinQt/GameList/GameFile.h deleted file mode 100644 index 8c16ac85bf..0000000000 --- a/Source/Core/DolphinQt/GameList/GameFile.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include -#include -#include - -#include - -#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 m_short_names; - QMap m_long_names; - QMap 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& 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); -}; diff --git a/Source/Core/DolphinQt/GameList/GameGrid.cpp b/Source/Core/DolphinQt/GameList/GameGrid.cpp deleted file mode 100644 index 4b1887151d..0000000000 --- a/Source/Core/DolphinQt/GameList/GameGrid.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include - -#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(); - 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; -} diff --git a/Source/Core/DolphinQt/GameList/GameGrid.h b/Source/Core/DolphinQt/GameList/GameGrid.h deleted file mode 100644 index 63e665e8a4..0000000000 --- a/Source/Core/DolphinQt/GameList/GameGrid.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include - -#include - -#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 m_ui; - - QMap m_items; - GameListStyle m_current_style; -}; diff --git a/Source/Core/DolphinQt/GameList/GameGrid.ui b/Source/Core/DolphinQt/GameList/GameGrid.ui deleted file mode 100644 index cc910ee63b..0000000000 --- a/Source/Core/DolphinQt/GameList/GameGrid.ui +++ /dev/null @@ -1,25 +0,0 @@ - - - DGameGrid - - - - 0 - 0 - 254 - 190 - - - - true - - - QListView::Adjust - - - true - - - - - diff --git a/Source/Core/DolphinQt/GameList/GameTracker.cpp b/Source/Core/DolphinQt/GameList/GameTracker.cpp deleted file mode 100644 index 3973af7d1b..0000000000 --- a/Source/Core/DolphinQt/GameList/GameTracker.cpp +++ /dev/null @@ -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 items) -{ - for (GameFile* o : items) - AddGame(o); -} -void AbstractGameList::RemoveGames(QList 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 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 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 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; - } - } - } -} diff --git a/Source/Core/DolphinQt/GameList/GameTracker.h b/Source/Core/DolphinQt/GameList/GameTracker.h deleted file mode 100644 index 7f92ac2c00..0000000000 --- a/Source/Core/DolphinQt/GameList/GameTracker.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include -#include -#include -#include - -#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 items); - - virtual void RemoveGame(GameFile* item) = 0; - void RemoveGames(QList 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 m_games; - QFileSystemWatcher* m_watcher; - - GameListStyle m_current_style; - DGameGrid* m_grid_widget = nullptr; - DGameTree* m_tree_widget = nullptr; -}; diff --git a/Source/Core/DolphinQt/GameList/GameTree.cpp b/Source/Core/DolphinQt/GameList/GameTree.cpp deleted file mode 100644 index 4925af6313..0000000000 --- a/Source/Core/DolphinQt/GameList/GameTree.cpp +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include - -#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(); - 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); -} diff --git a/Source/Core/DolphinQt/GameList/GameTree.h b/Source/Core/DolphinQt/GameList/GameTree.h deleted file mode 100644 index 37a1d0dfc7..0000000000 --- a/Source/Core/DolphinQt/GameList/GameTree.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include - -#include - -#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 m_ui; - GameListStyle m_current_style; - - QMap m_items; - QMap m_path_nodes; - - void RebuildTree(); - void ResizeAllCols(); -}; diff --git a/Source/Core/DolphinQt/GameList/GameTree.ui b/Source/Core/DolphinQt/GameList/GameTree.ui deleted file mode 100644 index 22b63d82c3..0000000000 --- a/Source/Core/DolphinQt/GameList/GameTree.ui +++ /dev/null @@ -1,54 +0,0 @@ - - - DGameTree - - - - 0 - 0 - 396 - 296 - - - - true - - - - Type - - - - - Banner - - - - - Title - - - - - Description - - - - - Region - - - - - Size - - - - - State - - - - - - diff --git a/Source/Core/DolphinQt/Host.cpp b/Source/Core/DolphinQt/Host.cpp deleted file mode 100644 index e07796a18b..0000000000 --- a/Source/Core/DolphinQt/Host.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include - -#include -#include - -#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 -} diff --git a/Source/Core/DolphinQt/Host.h b/Source/Core/DolphinQt/Host.h deleted file mode 100644 index 40c4b6c54a..0000000000 --- a/Source/Core/DolphinQt/Host.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include -#include - -enum HostEvent { - TitleEvent = QEvent::User + 1, -}; - -class HostTitleEvent final : public QEvent -{ -public: - HostTitleEvent(const std::string& title); - const std::string m_title; -}; diff --git a/Source/Core/DolphinQt/Info.plist.in b/Source/Core/DolphinQt/Info.plist.in deleted file mode 100644 index aa3f6cb7e2..0000000000 --- a/Source/Core/DolphinQt/Info.plist.in +++ /dev/null @@ -1,80 +0,0 @@ - - - - - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - ciso - dol - elf - gcm - gcz - iso - wad - wbfs - - CFBundleTypeIconFile - Dolphin.icns - CFBundleTypeName - Nintendo GC/Wii file - CFBundleTypeRole - Viewer - - - CFBundleExecutable - DolphinQt - CFBundleIconFile - Resources/Dolphin.icns - CFBundleIdentifier - org.dolphin-emu.dolphin - CFBundleDevelopmentRegion - English - CFBundleLocalizations - - ar - ca - cs - de - el - en - es - fa - fr - he - hu - it - ja - ko - nb - nl - pl - pt - pt_BR - ru - sr - sv - tr - zh_CN - zh_TW - - CFBundlePackageType - APPL - CFBundleShortVersionString - ${DOLPHIN_WC_DESCRIBE} - CFBundleLongVersionString - ${DOLPHIN_WC_REVISION} - CFBundleVersion - ${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR} - NSHumanReadableCopyright - Licensed under GPL version 2 - LSMinimumSystemVersion - ${OSX_MIN_VERSION} - NSHighResolutionCapable - - CSResourcesFileMapped - - - diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp deleted file mode 100644 index 4d64c70f1f..0000000000 --- a/Source/Core/DolphinQt/Main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include -#include -#include -#include -#include -#include - -#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; -} diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp deleted file mode 100644 index 467337489d..0000000000 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include -#include -#include -#include -#include -#include -#include - -#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(); - 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(); - 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& 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)); -} diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h deleted file mode 100644 index 0b2eb74b91..0000000000 --- a/Source/Core/DolphinQt/MainWindow.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include -#include - -#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 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 m_render_widget; - bool m_isStopping = false; -}; - -// Pointer to the only instance of DMainWindow, used by Host_* -extern DMainWindow* g_main_window; diff --git a/Source/Core/DolphinQt/MainWindow.ui b/Source/Core/DolphinQt/MainWindow.ui deleted file mode 100644 index 4f1a209d09..0000000000 --- a/Source/Core/DolphinQt/MainWindow.ui +++ /dev/null @@ -1,253 +0,0 @@ - - - DMainWindow - - - - 0 - 0 - 990 - 590 - - - - Dolphin - - - - 32 - 32 - - - - true - - - - - - 0 - 0 - 990 - 21 - - - - true - - - - Fi&le - - - - - - - - - - E&mulation - - - - - - - - - - Optio&ns - - - - - Tools - - - - - &View - - - - &List style - - - - - - - - - - - Help - - - - - - - - - - - - Movie - - - - - - - - - - - - - - Toolbar - - - Qt::ToolButtonTextUnderIcon - - - TopToolBarArea - - - false - - - - - - - - &Website - - - - - &Online Documentation - - - - - &GitHub Repository - - - - - &About - - - QAction::AboutRole - - - - - &Open... - - - Open file... - - - Ctrl+O - - - - - &System Information - - - - - Play - - - F10 - - - false - - - - - Stop - - - Esc - - - false - - - - - About &Qt - - - QAction::AboutQtRole - - - - - true - - - &List view - - - - - true - - - &Tree view - - - - - true - - - &Grid view - - - - - true - - - &Icon view - - - - - &Browse for ISOs... - - - - - Exit - - - - - &Reset - - - - - Screenshot - - - false - - - - - - diff --git a/Source/Core/DolphinQt/Resources/Dolphin.icns b/Source/Core/DolphinQt/Resources/Dolphin.icns deleted file mode 100644 index 4a17b18dec..0000000000 Binary files a/Source/Core/DolphinQt/Resources/Dolphin.icns and /dev/null differ diff --git a/Source/Core/DolphinQt/SystemInfo.cpp b/Source/Core/DolphinQt/SystemInfo.cpp deleted file mode 100644 index dd53c46ad4..0000000000 --- a/Source/Core/DolphinQt/SystemInfo.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include -#include -#include -#include - -#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(); - 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; -} diff --git a/Source/Core/DolphinQt/SystemInfo.h b/Source/Core/DolphinQt/SystemInfo.h deleted file mode 100644 index 3e010b0259..0000000000 --- a/Source/Core/DolphinQt/SystemInfo.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include -#include - -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 m_ui; - - void UpdateSystemInfo(); - QString GetOS() const; -}; diff --git a/Source/Core/DolphinQt/SystemInfo.ui b/Source/Core/DolphinQt/SystemInfo.ui deleted file mode 100644 index 95506a9857..0000000000 --- a/Source/Core/DolphinQt/SystemInfo.ui +++ /dev/null @@ -1,71 +0,0 @@ - - - DSystemInfo - - - - 0 - 0 - 446 - 298 - - - - System Information - - - - - - true - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - - buttonBox - accepted() - DSystemInfo - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DSystemInfo - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/Source/Core/DolphinQt/Utils/Resources.cpp b/Source/Core/DolphinQt/Utils/Resources.cpp deleted file mode 100644 index f0f8784316..0000000000 --- a/Source/Core/DolphinQt/Utils/Resources.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include -#include - -#include "Common/CommonPaths.h" -#include "Common/FileUtil.h" -#include "Core/ConfigManager.h" - -#include "DolphinQt/Utils/Resources.h" - -QVector Resources::m_platforms; -QVector Resources::m_regions; -QVector Resources::m_ratings; -QVector 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)); -} diff --git a/Source/Core/DolphinQt/Utils/Resources.h b/Source/Core/DolphinQt/Utils/Resources.h deleted file mode 100644 index 40a74455a2..0000000000 --- a/Source/Core/DolphinQt/Utils/Resources.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include -#include -#include - -#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 m_platforms; - static QVector m_regions; - static QVector m_ratings; - static QVector m_pixmaps; - - static QString GetImageFilename(const char* name, QString dir); -}; diff --git a/Source/Core/DolphinQt/Utils/Utils.cpp b/Source/Core/DolphinQt/Utils/Utils.cpp deleted file mode 100644 index b4497e4d6f..0000000000 --- a/Source/Core/DolphinQt/Utils/Utils.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include - -#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); -} diff --git a/Source/Core/DolphinQt/Utils/Utils.h b/Source/Core/DolphinQt/Utils/Utils.h deleted file mode 100644 index 4ef7823525..0000000000 --- a/Source/Core/DolphinQt/Utils/Utils.h +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include - -#include "Common/CommonTypes.h" - -QString NiceSizeFormat(s64 size); diff --git a/Source/Core/DolphinQt/VideoInterface/RenderWidget.cpp b/Source/Core/DolphinQt/VideoInterface/RenderWidget.cpp deleted file mode 100644 index 5162d2b230..0000000000 --- a/Source/Core/DolphinQt/VideoInterface/RenderWidget.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include -#include - -#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); -} diff --git a/Source/Core/DolphinQt/VideoInterface/RenderWidget.h b/Source/Core/DolphinQt/VideoInterface/RenderWidget.h deleted file mode 100644 index 67639e7322..0000000000 --- a/Source/Core/DolphinQt/VideoInterface/RenderWidget.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include - -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; -}; - diff --git a/Source/dolphin-emu.sln b/Source/dolphin-emu.sln index f80da90dc2..3deb2a6ca2 100644 --- a/Source/dolphin-emu.sln +++ b/Source/dolphin-emu.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\DolphinWX.vcxproj", "{47411FDB-1BF2-48D0-AB4E-C7C41160F898}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DolphinQt", "Core\DolphinQt\DolphinQt.vcxproj", "{69D2B16E-122A-4E5D-8C37-8EC7B0F7CEB0}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core\Core.vcxproj", "{E54CF649-140E-4255-81A5-30A673C1FB36}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioCommon", "Core\AudioCommon\AudioCommon.vcxproj", "{54AA7840-5BEB-4A0C-9452-74BA4CC7FD44}"