GameListModel: invert role-column choice tree
This commit is contained in:
parent
1afb0a134d
commit
051cbf1962
|
@ -21,17 +21,24 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
QSharedPointer<GameFile> game = m_games[index.row()];
|
QSharedPointer<GameFile> game = m_games[index.row()];
|
||||||
if (role == Qt::DecorationRole)
|
|
||||||
{
|
|
||||||
switch (index.column())
|
switch (index.column())
|
||||||
{
|
{
|
||||||
case COL_PLATFORM:
|
case COL_PLATFORM:
|
||||||
|
if (role == Qt::DecorationRole)
|
||||||
return Resources::GetPlatform(static_cast<int>(game->GetPlatformID()));
|
return Resources::GetPlatform(static_cast<int>(game->GetPlatformID()));
|
||||||
|
break;
|
||||||
case COL_COUNTRY:
|
case COL_COUNTRY:
|
||||||
|
if (role == Qt::DecorationRole)
|
||||||
return Resources::GetCountry(static_cast<int>(game->GetCountryID()));
|
return Resources::GetCountry(static_cast<int>(game->GetCountryID()));
|
||||||
|
break;
|
||||||
case COL_RATING:
|
case COL_RATING:
|
||||||
|
if (role == Qt::DecorationRole)
|
||||||
return Resources::GetRating(game->GetRating());
|
return Resources::GetRating(game->GetRating());
|
||||||
|
break;
|
||||||
case COL_BANNER:
|
case COL_BANNER:
|
||||||
|
if (role == Qt::DecorationRole)
|
||||||
|
{
|
||||||
// GameCube banners are 96x32, but Wii banners are 192x64.
|
// GameCube banners are 96x32, but Wii banners are 192x64.
|
||||||
// TODO: use custom banners from rom directory like DolphinWX?
|
// TODO: use custom banners from rom directory like DolphinWX?
|
||||||
QPixmap banner = game->GetBanner();
|
QPixmap banner = game->GetBanner();
|
||||||
|
@ -39,23 +46,29 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
|
||||||
banner.height() / GAMECUBE_BANNER_SIZE.height()));
|
banner.height() / GAMECUBE_BANNER_SIZE.height()));
|
||||||
return banner;
|
return banner;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
if (role == Qt::DisplayRole)
|
|
||||||
{
|
|
||||||
switch (index.column())
|
|
||||||
{
|
|
||||||
case COL_TITLE:
|
case COL_TITLE:
|
||||||
|
if (role == Qt::DisplayRole)
|
||||||
return game->GetLongName();
|
return game->GetLongName();
|
||||||
|
break;
|
||||||
case COL_ID:
|
case COL_ID:
|
||||||
|
if (role == Qt::DisplayRole)
|
||||||
return game->GetGameID();
|
return game->GetGameID();
|
||||||
|
break;
|
||||||
case COL_DESCRIPTION:
|
case COL_DESCRIPTION:
|
||||||
|
if (role == Qt::DisplayRole)
|
||||||
return game->GetDescription();
|
return game->GetDescription();
|
||||||
|
break;
|
||||||
case COL_MAKER:
|
case COL_MAKER:
|
||||||
|
if (role == Qt::DisplayRole)
|
||||||
return game->GetMaker();
|
return game->GetMaker();
|
||||||
|
break;
|
||||||
case COL_SIZE:
|
case COL_SIZE:
|
||||||
|
if (role == Qt::DisplayRole)
|
||||||
return FormatSize(game->GetFileSize());
|
return FormatSize(game->GetFileSize());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue