Qt: Add icons for game list entry type (disc/exe)

This commit is contained in:
Connor McLaughlin 2020-01-08 13:50:44 +10:00
parent ecc8109d43
commit 25f55690f2
4 changed files with 25 additions and 6 deletions

View file

@ -10,7 +10,7 @@ class GameListModel : public QAbstractTableModel
public: public:
enum Column : int enum Column : int
{ {
// Column_Icon, Column_Type,
Column_Code, Column_Code,
Column_Title, Column_Title,
Column_Region, Column_Region,
@ -65,10 +65,6 @@ public:
case Column_Title: case Column_Title:
return QString::fromStdString(ge.title); return QString::fromStdString(ge.title);
case Column_Region:
// return QString(Settings::GetConsoleRegionName(ge.region));
return {};
case Column_Size: case Column_Size:
return QString("%1 MB").arg(static_cast<double>(ge.total_size) / 1048576.0, 0, 'f', 2); return QString("%1 MB").arg(static_cast<double>(ge.total_size) / 1048576.0, 0, 'f', 2);
@ -81,6 +77,18 @@ public:
{ {
switch (index.column()) switch (index.column())
{ {
case Column_Type:
{
switch (ge.type)
{
case GameList::EntryType::Disc:
return m_type_disc_pixmap;
case GameList::EntryType::PSExe:
default:
return m_type_exe_pixmap;
}
}
case Column_Region: case Column_Region:
{ {
switch (ge.region) switch (ge.region)
@ -112,6 +120,9 @@ public:
switch (section) switch (section)
{ {
case Column_Type:
return "Type";
case Column_Code: case Column_Code:
return "Code"; return "Code";
@ -146,6 +157,9 @@ private:
void loadCommonImages() void loadCommonImages()
{ {
// TODO: Use svg instead of png // TODO: Use svg instead of png
m_type_disc_pixmap.load(QStringLiteral(":/icons/media-optical-24.png"));
m_type_exe_pixmap.load(QStringLiteral(":/icons/applications-system-24.png"));
m_region_eu_pixmap.load(QStringLiteral(":/icons/flag-eu.png"));
m_region_jp_pixmap.load(QStringLiteral(":/icons/flag-jp.png")); m_region_jp_pixmap.load(QStringLiteral(":/icons/flag-jp.png"));
m_region_us_pixmap.load(QStringLiteral(":/icons/flag-us.png")); m_region_us_pixmap.load(QStringLiteral(":/icons/flag-us.png"));
m_region_eu_pixmap.load(QStringLiteral(":/icons/flag-eu.png")); m_region_eu_pixmap.load(QStringLiteral(":/icons/flag-eu.png"));
@ -154,6 +168,9 @@ private:
GameList* m_game_list; GameList* m_game_list;
int m_size; int m_size;
QPixmap m_type_disc_pixmap;
QPixmap m_type_exe_pixmap;
QPixmap m_region_jp_pixmap; QPixmap m_region_jp_pixmap;
QPixmap m_region_eu_pixmap; QPixmap m_region_eu_pixmap;
QPixmap m_region_us_pixmap; QPixmap m_region_us_pixmap;
@ -207,5 +224,5 @@ void GameListWidget::resizeEvent(QResizeEvent* event)
{ {
QStackedWidget::resizeEvent(event); QStackedWidget::resizeEvent(event);
QtUtils::ResizeColumnsForTableView(m_table_view, {100, -1, 60, 100}); QtUtils::ResizeColumnsForTableView(m_table_view, {32, 80, -1, 60, 100});
} }

View file

@ -16,6 +16,7 @@
<file>icons/applications-development.png</file> <file>icons/applications-development.png</file>
<file>icons/applications-other.png</file> <file>icons/applications-other.png</file>
<file>icons/applications-system.png</file> <file>icons/applications-system.png</file>
<file>icons/applications-system-24.png</file>
<file>icons/audio-card.png</file> <file>icons/audio-card.png</file>
<file>icons/document-open.png</file> <file>icons/document-open.png</file>
<file>icons/document-save.png</file> <file>icons/document-save.png</file>
@ -24,6 +25,7 @@
<file>icons/input-gaming.png</file> <file>icons/input-gaming.png</file>
<file>icons/media-flash.png</file> <file>icons/media-flash.png</file>
<file>icons/media-optical.png</file> <file>icons/media-optical.png</file>
<file>icons/media-optical-24.png</file>
<file>icons/media-playback-pause.png</file> <file>icons/media-playback-pause.png</file>
<file>icons/media-playback-start.png</file> <file>icons/media-playback-start.png</file>
<file>icons/system-shutdown.png</file> <file>icons/system-shutdown.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB