Qt: Move flag/star icons to resources

This commit is contained in:
Connor McLaughlin 2022-06-04 15:53:31 +10:00 committed by refractionpcsx2
parent 28795e549b
commit ea1f451d35
45 changed files with 38 additions and 190 deletions

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 608 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 608 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 274 B

View File

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 412 B

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 278 B

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 959 B

After

Width:  |  Height:  |  Size: 959 B

View File

Before

Width:  |  Height:  |  Size: 581 B

After

Width:  |  Height:  |  Size: 581 B

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 307 B

View File

Before

Width:  |  Height:  |  Size: 473 B

After

Width:  |  Height:  |  Size: 473 B

View File

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 544 B

View File

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 531 B

View File

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 462 B

View File

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "GameListModel.h"
#include "QtHost.h"
#include "common/FileSystem.h"
#include "common/Path.h"
#include "common/StringUtil.h"
@ -457,17 +458,19 @@ void GameListModel::loadCommonImages()
m_type_exe_pixmap = QIcon(QStringLiteral(":/icons/applications-system-24.png")).pixmap(QSize(24, 24));
m_type_playlist_pixmap = QIcon(QStringLiteral(":/icons/address-book-new-22.png")).pixmap(QSize(22, 22));
const QString base_path(QtHost::GetResourcesBasePath());
for (u32 i = 0; i < static_cast<u32>(GameList::Region::Count); i++)
{
m_region_pixmaps[i] = QIcon(
QStringLiteral(":/icons/flags/%1.png").arg(GameList::RegionToString(static_cast<GameList::Region>(i))))
QStringLiteral("%1/icons/flags/%2.png").arg(base_path).arg(GameList::RegionToString(static_cast<GameList::Region>(i))))
.pixmap(QSize(42, 30));
}
for (u32 i = 1; i < GameList::CompatibilityRatingCount; i++)
m_compatibility_pixmaps[i].load(QStringLiteral(":/icons/star-%1.png").arg(i - 1));
m_compatibility_pixmaps[i].load(QStringLiteral("%1/icons/star-%2.png").arg(base_path).arg(i - 1));
m_placeholder_pixmap.load(QString::fromStdString(Path::Combine(EmuFolders::Resources, "cover-placeholder.png")));
m_placeholder_pixmap.load(QStringLiteral("%1/cover-placeholder.png").arg(base_path));
}
void GameListModel::setColumnDisplayNames()

View File

@ -137,6 +137,7 @@ static void makeIconsMasks(QWidget* menu)
void MainWindow::setupAdditionalUi()
{
setWindowIcon(QIcon(QStringLiteral("%1/icons/AppIconLarge.png").arg(QtHost::GetResourcesBasePath())));
makeIconsMasks(menuBar());
const bool toolbar_visible = Host::GetBaseBoolSettingValue("UI", "ShowToolbar", false);

View File

@ -16,10 +16,6 @@
<property name="windowTitle">
<string>PCSX2</string>
</property>
<property name="windowIcon">
<iconset resource="resources/resources.qrc">
<normaloff>:/icons/AppIconLarge.png</normaloff>:/icons/AppIconLarge.png</iconset>
</property>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>

View File

@ -421,6 +421,11 @@ QString QtHost::GetAppConfigSuffix()
#endif
}
QString QtHost::GetResourcesBasePath()
{
return QString::fromStdString(EmuFolders::Resources);
}
std::optional<std::vector<u8>> Host::ReadResourceFile(const char* filename)
{
const std::string path(Path::Combine(EmuFolders::Resources, filename));

View File

@ -59,6 +59,9 @@ namespace QtHost
/// Returns the debug/devel config indicator.
QString GetAppConfigSuffix();
/// Returns the base path for resources. This may be : prefixed, if we're using embedded resources.
QString GetResourcesBasePath();
/// Thread-safe settings access.
void SetBaseBoolSettingValue(const char* section, const char* key, bool value);
void SetBaseIntSettingValue(const char* section, const char* key, int value);

View File

@ -23,6 +23,7 @@
#include "pcsx2/ps2/BiosTools.h"
#include "BIOSSettingsWidget.h"
#include "QtHost.h"
#include "QtUtils.h"
#include "SettingWidgetBinder.h"
#include "SettingsDialog.h"
@ -112,6 +113,7 @@ void BIOSSettingsWidget::updateSearchDirectory()
void BIOSSettingsWidget::listRefreshed(const QVector<BIOSInfo>& items)
{
const std::string selected_bios(Host::GetBaseStringSettingValue("Filenames", "BIOS"));
const QString res_path(QtHost::GetResourcesBasePath());
QSignalBlocker sb(m_ui.fileList);
for (const BIOSInfo& bi : items)
@ -123,30 +125,30 @@ void BIOSSettingsWidget::listRefreshed(const QVector<BIOSInfo>& items)
switch (bi.region)
{
case 2: // Japan
item->setIcon(0, QIcon(QStringLiteral(":/icons/flags/NTSC-J.png")));
item->setIcon(0, QIcon(QStringLiteral("%1/icons/flags/NTSC-J.png").arg(res_path)));
break;
case 3: // USA
item->setIcon(0, QIcon(QStringLiteral(":/icons/flags/NTSC-U.png")));
item->setIcon(0, QIcon(QStringLiteral("%1/icons/flags/NTSC-U.png").arg(res_path)));
break;
case 4: // Europe
item->setIcon(0, QIcon(QStringLiteral(":/icons/flags/PAL-E.png")));
item->setIcon(0, QIcon(QStringLiteral("%1/icons/flags/PAL-E.png").arg(res_path)));
break;
case 7: // China
item->setIcon(0, QIcon(QStringLiteral(":/icons//flags/NTSC-C.png")));
item->setIcon(0, QIcon(QStringLiteral("%1/icons//flags/NTSC-C.png").arg(res_path)));
break;
case 5: // HK
item->setIcon(0, QIcon(QStringLiteral(":/icons/flags/NTSC-HK.png")));
item->setIcon(0, QIcon(QStringLiteral("%1/icons/flags/NTSC-HK.png").arg(res_path)));
break;
case 6: // Free
case 0: // T10K
case 1: // Test
default:
item->setIcon(0, QIcon(QStringLiteral(":/icons/flags/NTSC-J.png")));
item->setIcon(0, QIcon(QStringLiteral("%1/icons/flags/NTSC-J.png").arg(res_path)));
break;
}

View File

@ -20,10 +20,24 @@
#include "Frontend/GameList.h"
#include "GameSummaryWidget.h"
#include "QtHost.h"
GameSummaryWidget::GameSummaryWidget(const GameList::Entry* entry, SettingsDialog* dialog, QWidget* parent)
{
m_ui.setupUi(this);
const QString base_path(QtHost::GetResourcesBasePath());
for (int i = 0; i < m_ui.region->count(); i++)
{
m_ui.region->setItemIcon(i, QIcon(
QStringLiteral("%1/icons/flags/%2.png").arg(base_path).arg(GameList::RegionToString(static_cast<GameList::Region>(i)))));
}
for (int i = 1; i < m_ui.compatibility->count(); i++)
{
m_ui.compatibility->setItemIcon(i, QIcon(
QStringLiteral("%1/icons/star-%2.png").arg(base_path).arg(i)));
}
populateUi(entry);
}

View File

@ -101,262 +101,146 @@
<property name="text">
<string>NTSC-B (Brazil)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/NTSC-B.png</normaloff>:/icons/flags/NTSC-B.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>NTSC-C (China)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/NTSC-C.png</normaloff>:/icons/flags/NTSC-C.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>NTSC-HK (Hong Kong)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/NTSC-HK.png</normaloff>:/icons/flags/NTSC-HK.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>NTSC-J (Japan)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/NTSC-J.png</normaloff>:/icons/flags/NTSC-J.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>NTSC-K (Korea)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/NTSC-K.png</normaloff>:/icons/flags/NTSC-K.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>NTSC-T (Taiwan)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/NTSC-T.png</normaloff>:/icons/flags/NTSC-T.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>NTSC-U (US)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/NTSC-U.png</normaloff>:/icons/flags/NTSC-U.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Other</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/Other.png</normaloff>:/icons/flags/Other.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-A (Australia)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-A.png</normaloff>:/icons/flags/PAL-A.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-AF (South Africa)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-AF.png</normaloff>:/icons/flags/PAL-AF.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-AU (Austria)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-AU.png</normaloff>:/icons/flags/PAL-AU.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-BE (Belgium)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-BE.png</normaloff>:/icons/flags/PAL-BE.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-E (Europe/Australia)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-E.png</normaloff>:/icons/flags/PAL-E.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-F (France)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-F.png</normaloff>:/icons/flags/PAL-F.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-FI (Finland)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-FI.png</normaloff>:/icons/flags/PAL-FI.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-G (Germany)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-G.png</normaloff>:/icons/flags/PAL-G.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-GR (Greece)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-GR.png</normaloff>:/icons/flags/PAL-GR.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-I (Italy)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-I.png</normaloff>:/icons/flags/PAL-I.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-IN (India)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-IN.png</normaloff>:/icons/flags/PAL-IN.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-M (Europe/Australia)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-M.png</normaloff>:/icons/flags/PAL-M.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-NL (Netherlands)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-NL.png</normaloff>:/icons/flags/PAL-NL.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-NO (Norway)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-NO.png</normaloff>:/icons/flags/PAL-NO.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-P (Portugal)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-P.png</normaloff>:/icons/flags/PAL-P.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-R (Russia)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-R.png</normaloff>:/icons/flags/PAL-R.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-S (Spain)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-S.png</normaloff>:/icons/flags/PAL-S.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-SC (Scandinavia)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-SC.png</normaloff>:/icons/flags/PAL-SC.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-SW (Sweden)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-SW.png</normaloff>:/icons/flags/PAL-SW.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-SWI (Switzerland)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-SWI.png</normaloff>:/icons/flags/PAL-SWI.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>PAL-UK (United Kingdom)</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/flags/PAL-UK.png</normaloff>:/icons/flags/PAL-UK.png</iconset>
</property>
</item>
</widget>
</item>
@ -392,56 +276,32 @@
<property name="text">
<string>Unknown</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/star-0.png</normaloff>:/icons/star-0.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Not Bootable</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/star-1.png</normaloff>:/icons/star-1.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Reaches Intro</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/star-2.png</normaloff>:/icons/star-2.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Reaches Menu</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/star-3.png</normaloff>:/icons/star-3.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>In-Game</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/star-4.png</normaloff>:/icons/star-4.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Perfect</string>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/star-5.png</normaloff>:/icons/star-5.png</iconset>
</property>
</item>
</item>z
</widget>
</item>
<item row="4" column="0">

View File

@ -1,7 +1,6 @@
<RCC>
<qresource>
<file>icons/address-book-new-22.png</file>
<file>icons/AppIconLarge.png</file>
<file>icons/applications-system-24.png</file>
<file>icons/black/svg/artboard-2-line.svg</file>
<file>icons/black/svg/book-open-line.svg</file>
@ -45,46 +44,11 @@
<file>icons/black/svg/window-2-line.svg</file>
<file>icons/black/index.theme</file>
<file>icons/discord.png</file>
<file>icons/flags/NTSC-B.png</file>
<file>icons/flags/NTSC-C.png</file>
<file>icons/flags/NTSC-HK.png</file>
<file>icons/flags/NTSC-J.png</file>
<file>icons/flags/NTSC-K.png</file>
<file>icons/flags/NTSC-T.png</file>
<file>icons/flags/NTSC-U.png</file>
<file>icons/flags/Other.png</file>
<file>icons/flags/PAL-A.png</file>
<file>icons/flags/PAL-AF.png</file>
<file>icons/flags/PAL-AU.png</file>
<file>icons/flags/PAL-BE.png</file>
<file>icons/flags/PAL-E.png</file>
<file>icons/flags/PAL-F.png</file>
<file>icons/flags/PAL-FI.png</file>
<file>icons/flags/PAL-G.png</file>
<file>icons/flags/PAL-GR.png</file>
<file>icons/flags/PAL-I.png</file>
<file>icons/flags/PAL-IN.png</file>
<file>icons/flags/PAL-M.png</file>
<file>icons/flags/PAL-NL.png</file>
<file>icons/flags/PAL-NO.png</file>
<file>icons/flags/PAL-P.png</file>
<file>icons/flags/PAL-R.png</file>
<file>icons/flags/PAL-S.png</file>
<file>icons/flags/PAL-SC.png</file>
<file>icons/flags/PAL-SW.png</file>
<file>icons/flags/PAL-SWI.png</file>
<file>icons/flags/PAL-UK.png</file>
<file>icons/logo.png</file>
<file>icons/media-optical-24.png</file>
<file>icons/media-optical-gear-24.png</file>
<file>icons/media-optical.png</file>
<file>icons/QT.png</file>
<file>icons/star-0.png</file>
<file>icons/star-1.png</file>
<file>icons/star-2.png</file>
<file>icons/star-3.png</file>
<file>icons/star-4.png</file>
<file>icons/star-5.png</file>
<file>icons/update.png</file>
<file>icons/white/svg/artboard-2-line.svg</file>
<file>icons/white/svg/book-open-line.svg</file>