Qt: only add version update hint to bootable applications

This commit is contained in:
Megamouse 2020-02-15 10:24:35 +01:00
parent 1c2df15755
commit 1cb1d14d0c
3 changed files with 12 additions and 6 deletions

View File

@ -75,8 +75,8 @@ bool game_compatibility::ReadJSON(const QJsonObject& json_data, bool after_downl
// Add date if possible
status.date = json_result.value("date").toString();
// Add version if possible
status.version = json_result.value("update").toString();
// Add latest version if possible
status.latest_version = json_result.value("update").toString();
// Add status to map
m_compat_database.emplace(std::pair<std::string, compat_status>(sstr(key), status));

View File

@ -22,7 +22,7 @@ struct compat_status
QString color;
QString text;
QString tooltip;
QString version;
QString latest_version;
};
class game_compatibility : public QObject

View File

@ -1980,16 +1980,22 @@ int game_list_frame::PopulateGameList()
// Version
QString app_version = qstr(game->info.app_ver);
const QString unknown = localized.category.unknown;
if (app_version == localized.category.unknown)
if (app_version == unknown)
{
// Fall back to Disc/Pkg Revision
app_version = qstr(game->info.version);
}
if (!game->compat.version.isEmpty() && (app_version == localized.category.unknown || game->compat.version.toDouble() > app_version.toDouble()))
if (game->info.bootable && !game->compat.latest_version.isEmpty())
{
app_version = tr("%0 (Update available: %1)").arg(app_version, game->compat.version);
// If the app is bootable and the compat database contains info about the latest patch version:
// add a hint for available software updates if the app version is unknown or lower than the latest version.
if (app_version == unknown || game->compat.latest_version.toDouble() > app_version.toDouble())
{
app_version = tr("%0 (Update available: %1)").arg(app_version, game->compat.latest_version);
}
}
// Playtimes