Skip to content

Commit 3b1dcde

Browse files
committed
Qt: Force memory card editor icons to 32x32
1 parent d4b85ef commit 3b1dcde

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/duckstation-qt/memorycardeditorwindow.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static constexpr std::array<std::pair<ConsoleRegion, const char*>, 3> MEMORY_CAR
3737
{ConsoleRegion::NTSC_J, "BI"},
3838
{ConsoleRegion::PAL, "BE"},
3939
}};
40+
static constexpr int MEMORY_CARD_ICON_SIZE = 32;
4041
static constexpr int MEMORY_CARD_ICON_FRAME_DURATION_MS = 200;
4142

4243
namespace {
@@ -141,8 +142,10 @@ MemoryCardEditorWindow::MemoryCardEditorWindow() : QWidget()
141142
m_card_b.table = m_ui.cardB;
142143
m_card_b.blocks_free_label = m_ui.cardBUsage;
143144

144-
QtUtils::SetColumnWidthsForTableView(m_card_a.table, {32, -1, 155, 45});
145-
QtUtils::SetColumnWidthsForTableView(m_card_b.table, {32, -1, 155, 45});
145+
m_file_icon_width = MEMORY_CARD_ICON_SIZE + style()->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, this);
146+
m_file_icon_height = MEMORY_CARD_ICON_SIZE + style()->pixelMetric(QStyle::PM_FocusFrameVMargin, nullptr, this);
147+
QtUtils::SetColumnWidthsForTableView(m_card_a.table, {m_file_icon_width, -1, 155, 45});
148+
QtUtils::SetColumnWidthsForTableView(m_card_b.table, {m_file_icon_width, -1, 155, 45});
146149

147150
createCardButtons(&m_card_a, m_ui.buttonBoxA);
148151
createCardButtons(&m_card_b, m_ui.buttonBoxB);
@@ -381,6 +384,8 @@ void MemoryCardEditorWindow::updateCardTable(Card* card)
381384
const int row = card->table->rowCount();
382385
card->table->insertRow(row);
383386

387+
card->table->setRowHeight(row, m_file_icon_height);
388+
384389
QString title_str(QString::fromStdString(fi.title));
385390
if (fi.deleted)
386391
title_str += tr(" (Deleted)");

src/duckstation-qt/memorycardeditorwindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ private Q_SLOTS:
9999
Card m_card_a;
100100
Card m_card_b;
101101
u32 m_current_frame_index = 0;
102+
int m_file_icon_width = 0;
103+
int m_file_icon_height = 0;
102104

103105
QTimer* m_animation_timer = nullptr;
104106
};

0 commit comments

Comments
 (0)