Skip to content

Commit d542344

Browse files
committed
Qt: Don't need these functions defined in the header
1 parent cd8d6d8 commit d542344

File tree

2 files changed

+72
-21
lines changed

2 files changed

+72
-21
lines changed

src/duckstation-qt/gamelistwidget.cpp

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ GameListModel::GameListModel(GameListWidget* parent)
212212

213213
GameListModel::~GameListModel() = default;
214214

215+
bool GameListModel::getShowLocalizedTitles() const
216+
{
217+
return m_show_localized_titles;
218+
}
219+
215220
void GameListModel::setShowLocalizedTitles(bool enabled)
216221
{
217222
m_show_localized_titles = enabled;
@@ -223,25 +228,25 @@ void GameListModel::setShowLocalizedTitles(bool enabled)
223228
refreshCovers();
224229
}
225230

231+
bool GameListModel::getShowCoverTitles() const
232+
{
233+
return m_show_titles_for_covers;
234+
}
235+
226236
void GameListModel::setShowCoverTitles(bool enabled)
227237
{
228238
m_show_titles_for_covers = enabled;
229239
emit dataChanged(index(0, Column_Cover), index(rowCount() - 1, Column_Cover), {Qt::DisplayRole});
230240
}
231241

232-
void GameListModel::setShowGameIcons(bool enabled)
242+
int GameListModel::getRowHeight() const
233243
{
234-
m_show_game_icons = enabled;
235-
236-
if (enabled)
237-
GameList::ReloadMemcardTimestampCache();
238-
refreshIcons();
244+
return getIconSizeWithPadding();
239245
}
240246

241-
void GameListModel::refreshIcons()
247+
int GameListModel::getIconSize() const
242248
{
243-
m_icon_pixmap_cache.Clear();
244-
emit dataChanged(index(0, Column_Icon), index(rowCount() - 1, Column_Icon), {Qt::DecorationRole});
249+
return m_icon_size;
245250
}
246251

247252
int GameListModel::getIconSizeWithPadding() const
@@ -269,6 +274,17 @@ void GameListModel::setIconSize(int size)
269274
refreshIcons();
270275
}
271276

277+
void GameListModel::refreshIcons()
278+
{
279+
m_icon_pixmap_cache.Clear();
280+
emit dataChanged(index(0, Column_Icon), index(rowCount() - 1, Column_Icon), {Qt::DecorationRole});
281+
}
282+
283+
float GameListModel::getCoverScale() const
284+
{
285+
return m_cover_scale;
286+
}
287+
272288
void GameListModel::setCoverScale(float scale)
273289
{
274290
if (m_cover_scale == scale)
@@ -353,6 +369,11 @@ void GameListModel::updateCacheSize(int num_rows, int num_columns, QSortFilterPr
353369
m_cover_pixmap_cache.SetMaxCapacity(static_cast<u32>(cache_size));
354370
}
355371

372+
qreal GameListModel::getDevicePixelRatio() const
373+
{
374+
return m_device_pixel_ratio;
375+
}
376+
356377
void GameListModel::setDevicePixelRatio(qreal dpr)
357378
{
358379
if (m_device_pixel_ratio == dpr)
@@ -565,6 +586,20 @@ const QPixmap& GameListModel::getFlagPixmapForEntry(const GameList::Entry* ge) c
565586
return it->second;
566587
}
567588

589+
bool GameListModel::getShowGameIcons() const
590+
{
591+
return m_show_game_icons;
592+
}
593+
594+
void GameListModel::setShowGameIcons(bool enabled)
595+
{
596+
m_show_game_icons = enabled;
597+
598+
if (enabled)
599+
GameList::ReloadMemcardTimestampCache();
600+
refreshIcons();
601+
}
602+
568603
QIcon GameListModel::getIconForGame(const QString& path)
569604
{
570605
QIcon ret;
@@ -907,6 +942,21 @@ QVariant GameListModel::headerData(int section, Qt::Orientation orientation, int
907942
return ret;
908943
}
909944

945+
const QPixmap& GameListModel::getNoAchievementsPixmap() const
946+
{
947+
return m_no_achievements_pixmap;
948+
}
949+
950+
const QPixmap& GameListModel::getHasAchievementsPixmap() const
951+
{
952+
return m_has_achievements_pixmap;
953+
}
954+
955+
const QPixmap& GameListModel::getMasteredAchievementsPixmap() const
956+
{
957+
return m_mastered_achievements_pixmap;
958+
}
959+
910960
const GameList::Entry* GameListModel::getTakenGameListEntry(u32 index) const
911961
{
912962
return (m_taken_entries.has_value() && index < m_taken_entries->size()) ? &m_taken_entries.value()[index] : nullptr;

src/duckstation-qt/gamelistwidget.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ class GameListModel final : public QAbstractTableModel
7474
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
7575
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
7676

77-
ALWAYS_INLINE const QPixmap& getNoAchievementsPixmap() const { return m_no_achievements_pixmap; }
78-
ALWAYS_INLINE const QPixmap& getHasAchievementsPixmap() const { return m_has_achievements_pixmap; }
79-
ALWAYS_INLINE const QPixmap& getMasteredAchievementsPixmap() const { return m_mastered_achievements_pixmap; }
77+
const QPixmap& getNoAchievementsPixmap() const;
78+
const QPixmap& getHasAchievementsPixmap() const;
79+
const QPixmap& getMasteredAchievementsPixmap() const;
8080

8181
const GameList::Entry* getTakenGameListEntry(u32 index) const;
8282
bool hasTakenGameList() const;
@@ -87,32 +87,33 @@ class GameListModel final : public QAbstractTableModel
8787

8888
bool titlesLessThan(const GameList::Entry* left, const GameList::Entry* right) const;
8989
bool lessThan(const GameList::Entry* left, const GameList::Entry* right, int column) const;
90-
9190
bool lessThan(const QModelIndex& left_index, const QModelIndex& right_index, int column) const;
9291

93-
bool getShowLocalizedTitles() const { return m_show_localized_titles; }
92+
bool getShowLocalizedTitles() const;
9493
void setShowLocalizedTitles(bool enabled);
9594

96-
bool getShowCoverTitles() const { return m_show_titles_for_covers; }
95+
bool getShowCoverTitles() const;
9796
void setShowCoverTitles(bool enabled);
9897

99-
int getRowHeight() const { return getIconSizeWithPadding(); }
100-
int getIconSize() const { return m_icon_size; }
98+
int getRowHeight() const;
99+
100+
int getIconSize() const;
101101
int getIconSizeWithPadding() const;
102+
void refreshIcons();
102103
void setIconSize(int size);
103-
bool getShowGameIcons() const { return m_show_game_icons; }
104+
105+
bool getShowGameIcons() const;
104106
void setShowGameIcons(bool enabled);
105107
QIcon getIconForGame(const QString& path);
106-
void refreshIcons();
107108

108-
float getCoverScale() const { return m_cover_scale; }
109+
float getCoverScale() const;
109110
void setCoverScale(float scale);
110111
QSize getCoverArtSize() const;
111112
int getCoverArtSpacing() const;
112113
void refreshCovers();
113114
void updateCacheSize(int num_rows, int num_columns, QSortFilterProxyModel* const sort_model, int top_left_row);
114115

115-
qreal getDevicePixelRatio() const { return m_device_pixel_ratio; }
116+
qreal getDevicePixelRatio() const;
116117
void setDevicePixelRatio(qreal dpr);
117118

118119
const QPixmap* lookupIconPixmapForEntry(const GameList::Entry* ge) const;

0 commit comments

Comments
 (0)