Qt: Add RA Game ID to game properties

pull/3794/head
Stenzek 3 weeks ago
parent 1cafea4e5b
commit b91b9b247f
No known key found for this signature in database

@ -2190,6 +2190,11 @@ std::string Achievements::GetProfileURL(std::string_view username)
return fmt::format("https://retroachievements.org/user/{}", Path::URLEncode(username));
}
std::string Achievements::GetGameURL(u32 game_id)
{
return fmt::format("https://retroachievements.org/game/{}", game_id);
}
u32 Achievements::GetPauseThrottleFrames()
{
if (!IsActive())

@ -180,6 +180,9 @@ SmallString GetLoggedInUserPointsSummary();
/// Returns a URL for the given user's profile.
std::string GetProfileURL(std::string_view username);
/// Returns the URL for the given game ID.
std::string GetGameURL(u32 game_id);
/// Returns the URL for the specified game icon, using the game ID.
std::string GetGameBadgeURL(u32 game_id);

@ -302,6 +302,21 @@ void GameSummaryWidget::populateUi(const GameList::Entry* entry)
for (const std::string& name : InputManager::GetInputProfileNames())
m_ui.inputProfile->addItem(QString::fromStdString(name));
if (entry->achievements_game_id != 0)
{
m_ui.openRetroAchievementsGame->setIcon(QIcon(QtHost::GetResourceQPath(Achievements::RA_LOGO_SVG_ICON_NAME, true)));
m_ui.openRetroAchievementsGame->setText(tr("Game ID: %1").arg(entry->achievements_game_id));
m_ui.openRetroAchievementsGame->setEnabled(true);
connect(
m_ui.openRetroAchievementsGame, &QAbstractButton::clicked, this,
[this, game_id = entry->achievements_game_id]() { QtUtils::OpenURL(this, Achievements::GetGameURL(game_id)); });
}
else
{
m_ui.verifyLayout->removeWidget(m_ui.openRetroAchievementsGame);
QtUtils::SafeDeleteWidget(m_ui.openRetroAchievementsGame);
}
reloadGameSettings();
// Don't populate tracks when we're running from disc, because the core might have exclusive access.

@ -294,10 +294,17 @@
</layout>
</item>
<item row="13" column="0" colspan="3">
<layout class="QHBoxLayout" name="verifyLayout" stretch="1,0">
<layout class="QHBoxLayout" name="verifyLayout" stretch="1,0,0">
<item>
<widget class="QLabel" name="tracksLabel"/>
</item>
<item>
<widget class="QPushButton" name="openRetroAchievementsGame">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="computeHashes">
<property name="text">

Loading…
Cancel
Save