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

Small C++ fixes

This commit is contained in:
Joshua Goins 2023-09-17 09:02:11 -04:00
parent f557424155
commit 14854a6187
6 changed files with 13 additions and 16 deletions

View file

@ -30,9 +30,9 @@ Q_SIGNALS:
void finishedUpdating();
private:
QUrl dalamudVersionManifestUrl(Profile::DalamudChannel channel) const;
QUrl dalamudLatestPackageUrl(Profile::DalamudChannel channel) const;
QUrl dalamudAssetManifestUrl() const;
[[nodiscard]] QUrl dalamudVersionManifestUrl(Profile::DalamudChannel channel) const;
[[nodiscard]] QUrl dalamudLatestPackageUrl(Profile::DalamudChannel channel) const;
[[nodiscard]] QUrl dalamudAssetManifestUrl() const;
LauncherCore &launcher;

View file

@ -148,7 +148,7 @@ public:
[[nodiscard]] bool isSteamDeck() const;
Q_INVOKABLE void refreshNews();
Headline *headline() const;
[[nodiscard]] Headline *headline() const;
Q_INVOKABLE void openOfficialLauncher(Profile *profile);
Q_INVOKABLE void openSystemInfo(Profile *profile);

View file

@ -25,7 +25,7 @@ void AccountManager::load()
int AccountManager::rowCount(const QModelIndex &index) const
{
Q_UNUSED(index);
return m_accounts.size();
return static_cast<int>(m_accounts.size());
}
QVariant AccountManager::data(const QModelIndex &index, int role) const
@ -95,7 +95,7 @@ void AccountManager::deleteAccount(Account *account)
config->deleteGroup(QStringLiteral("account-%1").arg(account->uuid()));
config->sync();
const int row = m_accounts.indexOf(account);
const int row = static_cast<int>(m_accounts.indexOf(account));
beginRemoveRows(QModelIndex(), row, row);
m_accounts.removeAll(account);
endRemoveRows();
@ -103,7 +103,7 @@ void AccountManager::deleteAccount(Account *account)
void AccountManager::insertAccount(Account *account)
{
beginInsertRows(QModelIndex(), m_accounts.size(), m_accounts.size());
beginInsertRows(QModelIndex(), static_cast<int>(m_accounts.size()), static_cast<int>(m_accounts.size()));
m_accounts.append(account);
endInsertRows();
}

View file

@ -4,7 +4,6 @@
#include "assetupdater.h"
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QNetworkReply>
#include <QStandardPaths>
@ -17,6 +16,7 @@ const QString dotnetDesktopPackageURL = "https://dotnetcli.azureedge.net/dotnet/
AssetUpdater::AssetUpdater(Profile &profile, LauncherCore &launcher, QObject *parent)
: QObject(parent)
, launcher(launcher)
, chosenChannel(profile.dalamudChannel())
, m_profile(profile)
{
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
@ -86,8 +86,6 @@ void AssetUpdater::update()
{
QNetworkRequest request(dalamudVersionManifestUrl(m_profile.dalamudChannel()));
chosenChannel = m_profile.dalamudChannel();
remoteDalamudVersion.clear();
remoteRuntimeVersion.clear();
@ -106,7 +104,7 @@ void AssetUpdater::update()
// bytes, ex: \xFF\xFE{\x00\"\x00""A\x00s\x00s\x00""e\x00m\x00 so we
// start at the first character of the json '{' and work our way up.
QString reassmbled;
for (int i = str.indexOf('{'); i < str.size(); i++) {
for (int i = static_cast<int>(str.indexOf('{')); i < str.size(); i++) {
char t = str[i];
if (QChar(t).isPrint())
reassmbled += t;

View file

@ -6,7 +6,6 @@
#include <KLocalizedString>
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include <QProcess>
#include "account.h"

View file

@ -48,7 +48,7 @@ void ProfileManager::deleteProfile(Profile *profile)
config->deleteGroup(QStringLiteral("profile-%1").arg(profile->uuid()));
config->sync();
const int row = m_profiles.indexOf(profile);
const int row = static_cast<int>(m_profiles.indexOf(profile));
beginRemoveRows(QModelIndex(), row, row);
m_profiles.removeAll(profile);
endRemoveRows();
@ -64,7 +64,7 @@ QString ProfileManager::getDefaultWinePrefixPath()
return QDir::homePath() + QStringLiteral("/.wine");
#endif
return "";
Q_UNREACHABLE();
}
QString ProfileManager::getDefaultGamePath(const QString &uuid)
@ -105,7 +105,7 @@ void ProfileManager::load()
int ProfileManager::rowCount(const QModelIndex &index) const
{
Q_UNUSED(index);
return m_profiles.size();
return static_cast<int>(m_profiles.size());
}
QVariant ProfileManager::data(const QModelIndex &index, int role) const
@ -129,7 +129,7 @@ QHash<int, QByteArray> ProfileManager::roleNames() const
void ProfileManager::insertProfile(Profile *profile)
{
beginInsertRows(QModelIndex(), m_profiles.size(), m_profiles.size());
beginInsertRows(QModelIndex(), static_cast<int>(m_profiles.size()), static_cast<int>(m_profiles.size()));
m_profiles.append(profile);
endInsertRows();
}