Merge pull request #6751 from spycrab/qt_show_disc

Qt: Show disc number
This commit is contained in:
Léo Lam 2018-05-05 10:28:40 +02:00 committed by GitHub
commit 6e6bf689e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -74,7 +74,18 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
break; break;
case COL_TITLE: case COL_TITLE:
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole) if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
return QString::fromStdString(game.GetName()); {
QString name = QString::fromStdString(game.GetName());
const int disc_nr = game.GetDiscNumber() + 1;
if (disc_nr > 1)
{
if (!name.contains(QRegExp(QStringLiteral("disc ?%1").arg(disc_nr), Qt::CaseInsensitive)))
{
name.append(tr(" (Disc %1)").arg(disc_nr));
}
}
return name;
}
break; break;
case COL_ID: case COL_ID:
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole) if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)