Add Rich Presence to Achievement Dialog Header

This refactors the Rich Presence generation to store to a member field that can be exposed to the UI to display the Rich Presence in the achievement header. It still updates at its original rate of once per two minutes, but calls an update on the dialog when that ticks.
This commit is contained in:
LillyJadeKatrin
2023-06-17 12:40:07 -04:00
parent 900439ea0d
commit 38bd04c439
3 changed files with 24 additions and 15 deletions

View File

@ -20,6 +20,7 @@
#include <rcheevos/include/rc_runtime.h>
#include "Core/AchievementManager.h"
#include "Core/Config/AchievementSettings.h"
#include "Core/Core.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
@ -101,11 +102,9 @@ void AchievementHeaderWidget::UpdateData()
m_game_progress_soft->setValue(point_spread.hard_unlocks);
m_game_progress_soft->setRange(0, point_spread.total_count);
m_game_progress_soft->setValue(point_spread.hard_unlocks + point_spread.soft_unlocks);
// TODO: RP needs a minor refactor to work here, will be a future PR
// m_rich_presence->setText(QString::fromStdString(AchievementManager::GetInstance()->GenerateRichPresence()));
// m_rich_presence->setVisible(Config::Get(Config::RA_RICH_PRESENCE_ENABLED));
m_rich_presence->setText(QString{});
m_rich_presence->setVisible(false);
m_rich_presence->setText(
QString::fromUtf8(AchievementManager::GetInstance()->GetRichPresence().data()));
m_rich_presence->setVisible(Config::Get(Config::RA_RICH_PRESENCE_ENABLED));
m_user_box->setVisible(false);
m_game_box->setVisible(true);