game_list_p: Mark some constants as constexpr

Consistency change with how we mark constants in the rest of the
codebase.

Co-Authored-By: LC <712067+lioncash@users.noreply.github.com>
This commit is contained in:
FearlessTobi 2020-09-09 17:06:15 +02:00
parent e97ecdc2b8
commit 84c42bf581

View File

@ -123,8 +123,8 @@ static QString GetRegionFromSMDH(const Loader::SMDH& smdh) {
class GameListItem : public QStandardItem { class GameListItem : public QStandardItem {
public: public:
// used to access type from item index // used to access type from item index
static const int TypeRole = Qt::UserRole + 1; static constexpr int TypeRole = Qt::UserRole + 1;
static const int SortRole = Qt::UserRole + 2; static constexpr int SortRole = Qt::UserRole + 2;
GameListItem() = default; GameListItem() = default;
explicit GameListItem(const QString& string) : QStandardItem(string) { explicit GameListItem(const QString& string) : QStandardItem(string) {
setData(string, SortRole); setData(string, SortRole);
@ -146,11 +146,11 @@ static const std::unordered_map<UISettings::GameListIconSize, int> IconSizes{
*/ */
class GameListItemPath : public GameListItem { class GameListItemPath : public GameListItem {
public: public:
static const int TitleRole = SortRole + 1; static constexpr int TitleRole = SortRole + 1;
static const int FullPathRole = SortRole + 2; static constexpr int FullPathRole = SortRole + 2;
static const int ProgramIdRole = SortRole + 3; static constexpr int ProgramIdRole = SortRole + 3;
static const int ExtdataIdRole = SortRole + 4; static constexpr int ExtdataIdRole = SortRole + 4;
static const int LongTitleRole = SortRole + 5; static constexpr int LongTitleRole = SortRole + 5;
GameListItemPath() = default; GameListItemPath() = default;
GameListItemPath(const QString& game_path, const std::vector<u8>& smdh_data, u64 program_id, GameListItemPath(const QString& game_path, const std::vector<u8>& smdh_data, u64 program_id,
@ -179,8 +179,9 @@ public:
memcpy(&smdh, smdh_data.data(), sizeof(Loader::SMDH)); memcpy(&smdh, smdh_data.data(), sizeof(Loader::SMDH));
// Get icon from SMDH // Get icon from SMDH
if (UISettings::values.game_list_icon_size != UISettings::GameListIconSize::NoIcon) if (UISettings::values.game_list_icon_size != UISettings::GameListIconSize::NoIcon) {
setData(GetQPixmapFromSMDH(smdh, large), Qt::DecorationRole); setData(GetQPixmapFromSMDH(smdh, large), Qt::DecorationRole);
}
// Get title from SMDH // Get title from SMDH
setData(GetQStringShortTitleFromSMDH(smdh, Loader::SMDH::TitleLanguage::English), setData(GetQStringShortTitleFromSMDH(smdh, Loader::SMDH::TitleLanguage::English),
@ -235,7 +236,7 @@ public:
class GameListItemCompat : public GameListItem { class GameListItemCompat : public GameListItem {
Q_DECLARE_TR_FUNCTIONS(GameListItemCompat) Q_DECLARE_TR_FUNCTIONS(GameListItemCompat)
public: public:
static const int CompatNumberRole = SortRole; static constexpr int CompatNumberRole = SortRole;
GameListItemCompat() = default; GameListItemCompat() = default;
explicit GameListItemCompat(const QString& compatibility) { explicit GameListItemCompat(const QString& compatibility) {
setData(type(), TypeRole); setData(type(), TypeRole);
@ -307,7 +308,7 @@ public:
*/ */
class GameListItemSize : public GameListItem { class GameListItemSize : public GameListItem {
public: public:
static const int SizeRole = SortRole; static constexpr int SizeRole = SortRole;
GameListItemSize() = default; GameListItemSize() = default;
explicit GameListItemSize(const qulonglong size_bytes) { explicit GameListItemSize(const qulonglong size_bytes) {
@ -343,7 +344,7 @@ public:
class GameListDir : public GameListItem { class GameListDir : public GameListItem {
public: public:
static const int GameDirRole = Qt::UserRole + 2; static constexpr int GameDirRole = Qt::UserRole + 2;
explicit GameListDir(UISettings::GameDir& directory, explicit GameListDir(UISettings::GameDir& directory,
GameListItemType dir_type = GameListItemType::CustomDir) GameListItemType dir_type = GameListItemType::CustomDir)