diff --git a/src/duckstation-qt/consolesettingswidget.ui b/src/duckstation-qt/consolesettingswidget.ui
index 713c73791..252af2543 100644
--- a/src/duckstation-qt/consolesettingswidget.ui
+++ b/src/duckstation-qt/consolesettingswidget.ui
@@ -40,9 +40,9 @@
-
-
- NTSC-J (Japan)
-
+
+ NTSC-J (Japan)
+
-
@@ -109,6 +109,8 @@
-
+
+
+
diff --git a/src/duckstation-qt/duckstation-qt.vcxproj.filters b/src/duckstation-qt/duckstation-qt.vcxproj.filters
index 2252a61f2..648aa4fbd 100644
--- a/src/duckstation-qt/duckstation-qt.vcxproj.filters
+++ b/src/duckstation-qt/duckstation-qt.vcxproj.filters
@@ -31,13 +31,13 @@
+
-
@@ -60,6 +60,7 @@
+
diff --git a/src/duckstation-qt/gamelistwidget.cpp b/src/duckstation-qt/gamelistwidget.cpp
index 3e6b898fc..a2cbce438 100644
--- a/src/duckstation-qt/gamelistwidget.cpp
+++ b/src/duckstation-qt/gamelistwidget.cpp
@@ -2,6 +2,7 @@
#include "core/settings.h"
#include "qthostinterface.h"
#include "qtutils.h"
+#include
#include
class GameListModel : public QAbstractTableModel
@@ -21,6 +22,7 @@ public:
GameListModel(GameList* game_list, QObject* parent = nullptr)
: QAbstractTableModel(parent), m_game_list(game_list), m_size(static_cast(m_game_list->GetEntryCount()))
{
+ loadCommonImages();
}
~GameListModel() = default;
@@ -45,30 +47,61 @@ public:
if (!index.isValid())
return {};
- if (role != Qt::DisplayRole)
- return {};
-
const int row = index.row();
if (row < 0 || row >= static_cast(m_game_list->GetEntryCount()))
return {};
const GameList::GameListEntry& ge = m_game_list->GetEntries()[row];
- switch (index.column())
+
+ switch (role)
{
- case Column_Code:
- return QString::fromStdString(ge.code);
+ case Qt::DisplayRole:
+ {
+ switch (index.column())
+ {
+ case Column_Code:
+ return QString::fromStdString(ge.code);
- case Column_Title:
- return QString::fromStdString(ge.title);
+ case Column_Title:
+ return QString::fromStdString(ge.title);
- case Column_Region:
- return QString(Settings::GetConsoleRegionName(ge.region));
+ case Column_Region:
+ // return QString(Settings::GetConsoleRegionName(ge.region));
+ return {};
- case Column_Size:
- return QString("%1 MB").arg(static_cast(ge.total_size) / 1048576.0, 0, 'f', 2);
+ case Column_Size:
+ return QString("%1 MB").arg(static_cast(ge.total_size) / 1048576.0, 0, 'f', 2);
- default:
- return {};
+ default:
+ return {};
+ }
+ }
+
+ case Qt::DecorationRole:
+ {
+ switch (index.column())
+ {
+ case Column_Region:
+ {
+ switch (ge.region)
+ {
+ case ConsoleRegion::NTSC_J:
+ return m_region_jp_pixmap;
+ case ConsoleRegion::NTSC_U:
+ return m_region_us_pixmap;
+ case ConsoleRegion::PAL:
+ default:
+ return m_region_eu_pixmap;
+ }
+ }
+
+ default:
+ return {};
+ }
+
+ default:
+ return {};
+ }
}
}
@@ -110,8 +143,20 @@ public:
}
private:
+ void loadCommonImages()
+ {
+ // TODO: Use svg instead of png
+ m_region_jp_pixmap.load(QStringLiteral(":/icons/flag-jp.png"));
+ m_region_us_pixmap.load(QStringLiteral(":/icons/flag-us.png"));
+ m_region_eu_pixmap.load(QStringLiteral(":/icons/flag-eu.png"));
+ }
+
GameList* m_game_list;
int m_size;
+
+ QPixmap m_region_jp_pixmap;
+ QPixmap m_region_eu_pixmap;
+ QPixmap m_region_us_pixmap;
};
GameListWidget::GameListWidget(QWidget* parent /* = nullptr */) : QStackedWidget(parent) {}
@@ -135,6 +180,7 @@ void GameListWidget::initialize(QtHostInterface* host_interface)
m_table_view->setCurrentIndex({});
m_table_view->horizontalHeader()->setHighlightSections(false);
m_table_view->verticalHeader()->hide();
+ m_table_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
m_table_view->resizeColumnsToContents();
connect(m_table_view, &QTableView::doubleClicked, this, &GameListWidget::onTableViewItemDoubleClicked);
@@ -161,5 +207,5 @@ void GameListWidget::resizeEvent(QResizeEvent* event)
{
QStackedWidget::resizeEvent(event);
- QtUtils::ResizeColumnsForTableView(m_table_view, {100, -1, 100, 100});
+ QtUtils::ResizeColumnsForTableView(m_table_view, {100, -1, 60, 100});
}
diff --git a/src/duckstation-qt/qtutils.cpp b/src/duckstation-qt/qtutils.cpp
index baa527d79..a85cd651c 100644
--- a/src/duckstation-qt/qtutils.cpp
+++ b/src/duckstation-qt/qtutils.cpp
@@ -4,6 +4,8 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -34,7 +36,12 @@ void ResizeColumnsForTableView(QTableView* view, const std::initializer_listwidth() - total_width - 2, 1);
+ const int padding = 2;
+ const int scrollbar_width = ((view->verticalScrollBar() && view->verticalScrollBar()->isVisible()) ||
+ view->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOn) ?
+ view->style()->pixelMetric(QStyle::PM_ScrollBarExtent) :
+ 0;
+ const int flex_width = std::max(view->width() - total_width - scrollbar_width - padding, 1);
int column_index = 0;
for (const int spec_width : widths)
diff --git a/src/duckstation-qt/resources/icons.qrc b/src/duckstation-qt/resources/icons.qrc
index f461499bf..b2a7e40ec 100644
--- a/src/duckstation-qt/resources/icons.qrc
+++ b/src/duckstation-qt/resources/icons.qrc
@@ -1,5 +1,11 @@
+ icons/flag-eu.png
+ icons/flag-eu.svg
+ icons/flag-jp.png
+ icons/flag-jp.svg
+ icons/flag-us.png
+ icons/flag-us.svg
icons/applications-internet.png
icons/system-search.png
icons/list-add.png
diff --git a/src/duckstation-qt/resources/icons/flag-eu.png b/src/duckstation-qt/resources/icons/flag-eu.png
new file mode 100644
index 000000000..318ff09bd
Binary files /dev/null and b/src/duckstation-qt/resources/icons/flag-eu.png differ
diff --git a/src/duckstation-qt/resources/icons/flag-eu.svg b/src/duckstation-qt/resources/icons/flag-eu.svg
new file mode 100644
index 000000000..0fa4e2414
--- /dev/null
+++ b/src/duckstation-qt/resources/icons/flag-eu.svg
@@ -0,0 +1,29 @@
+
\ No newline at end of file
diff --git a/src/duckstation-qt/resources/icons/flag-jp.png b/src/duckstation-qt/resources/icons/flag-jp.png
new file mode 100644
index 000000000..46b15cb30
Binary files /dev/null and b/src/duckstation-qt/resources/icons/flag-jp.png differ
diff --git a/src/duckstation-qt/resources/icons/flag-jp.svg b/src/duckstation-qt/resources/icons/flag-jp.svg
new file mode 100644
index 000000000..05ca6995a
--- /dev/null
+++ b/src/duckstation-qt/resources/icons/flag-jp.svg
@@ -0,0 +1,5 @@
+
+
\ No newline at end of file
diff --git a/src/duckstation-qt/resources/icons/flag-us.png b/src/duckstation-qt/resources/icons/flag-us.png
new file mode 100644
index 000000000..c54624c8d
Binary files /dev/null and b/src/duckstation-qt/resources/icons/flag-us.png differ
diff --git a/src/duckstation-qt/resources/icons/flag-us.svg b/src/duckstation-qt/resources/icons/flag-us.svg
new file mode 100644
index 000000000..3f1081ccf
--- /dev/null
+++ b/src/duckstation-qt/resources/icons/flag-us.svg
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file