1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 19:57:45 +00:00

Add button to clear lodestone avatar cache

This commit is contained in:
Joshua Goins 2023-10-08 13:22:49 -04:00
parent 1157f7b1ab
commit bc1b6fe2c8
3 changed files with 25 additions and 0 deletions

View file

@ -175,6 +175,8 @@ public:
[[nodiscard]] Profile *currentProfile() const; [[nodiscard]] Profile *currentProfile() const;
void setCurrentProfile(Profile *profile); void setCurrentProfile(Profile *profile);
Q_INVOKABLE void clearAvatarCache();
signals: signals:
void loadingFinished(); void loadingFinished();
void gameInstallationChanged(); void gameInstallationChanged();

View file

@ -824,3 +824,12 @@ void LauncherCore::setCurrentProfile(Profile *profile)
Q_EMIT currentProfileChanged(); Q_EMIT currentProfileChanged();
} }
} }
void LauncherCore::clearAvatarCache()
{
const auto cacheLocation = QStandardPaths::standardLocations(QStandardPaths::CacheLocation)[0] + QStringLiteral("/avatars");
qInfo() << cacheLocation;
if (QDir(cacheLocation).exists()) {
QDir(cacheLocation).removeRecursively();
}
}

View file

@ -87,4 +87,18 @@ FormCard.FormCardPage {
onCheckedChanged: LauncherCore.showDevTools = checked onCheckedChanged: LauncherCore.showDevTools = checked
} }
} }
FormCard.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true
FormCard.FormButtonDelegate {
text: i18n("Clear Lodestone Avatar Cache")
description: i18n("Refreshes the avatars for all accounts, and requires Astra to restart to take effect.")
icon.name: "delete"
onClicked: LauncherCore.clearAvatarCache()
}
}
} }