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

Change Account::m_url to QString and rename to m_avatarUrl

This commit is contained in:
Joshua Goins 2023-12-17 11:05:57 -05:00
parent bc941dc9c2
commit c8258421d5
2 changed files with 6 additions and 6 deletions

View file

@ -110,6 +110,6 @@ private:
AccountConfig m_config; AccountConfig m_config;
QString m_key; QString m_key;
QUrl m_url; QString m_avatarUrl;
LauncherCore &m_launcher; LauncherCore &m_launcher;
}; };

View file

@ -73,7 +73,7 @@ void Account::setLodestoneId(const QString &id)
QString Account::avatarUrl() const QString Account::avatarUrl() const
{ {
return m_url.toString(); return m_avatarUrl;
} }
bool Account::isSapphire() const bool Account::isSapphire() const
@ -221,12 +221,12 @@ void Account::fetchAvatar()
return; return;
} }
const auto cacheLocation = QStandardPaths::standardLocations(QStandardPaths::CacheLocation)[0] + QStringLiteral("/avatars"); const QString cacheLocation = QStandardPaths::standardLocations(QStandardPaths::CacheLocation)[0] + QStringLiteral("/avatars");
if (!QDir().exists(cacheLocation)) { if (!QDir().exists(cacheLocation)) {
QDir().mkpath(cacheLocation); QDir().mkpath(cacheLocation);
} }
const QString filename(QStringLiteral("%1/%2.jpg").arg(cacheLocation, lodestoneId())); const QString filename = QStringLiteral("%1/%2.jpg").arg(cacheLocation, lodestoneId());
if (!QFile(filename).exists()) { if (!QFile(filename).exists()) {
qDebug() << "Did not find lodestone character " << lodestoneId() << " in cache, fetching from xivapi."; qDebug() << "Did not find lodestone character " << lodestoneId() << " in cache, fetching from xivapi.";
@ -252,13 +252,13 @@ void Account::fetchAvatar()
file.write(avatarReply->readAll()); file.write(avatarReply->readAll());
file.close(); file.close();
m_url = QUrl(QStringLiteral("file:///%1").arg(filename)); m_avatarUrl = QStringLiteral("file:///%1").arg(filename);
Q_EMIT avatarUrlChanged(); Q_EMIT avatarUrlChanged();
}); });
} }
}); });
} else { } else {
m_url = QUrl(QStringLiteral("file:///%1").arg(filename)); m_avatarUrl = QStringLiteral("file:///%1").arg(filename);
Q_EMIT avatarUrlChanged(); Q_EMIT avatarUrlChanged();
} }
} }