mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 04:57:44 +00:00
Small C++ fixes
This commit is contained in:
parent
f557424155
commit
14854a6187
6 changed files with 13 additions and 16 deletions
|
@ -30,9 +30,9 @@ Q_SIGNALS:
|
||||||
void finishedUpdating();
|
void finishedUpdating();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUrl dalamudVersionManifestUrl(Profile::DalamudChannel channel) const;
|
[[nodiscard]] QUrl dalamudVersionManifestUrl(Profile::DalamudChannel channel) const;
|
||||||
QUrl dalamudLatestPackageUrl(Profile::DalamudChannel channel) const;
|
[[nodiscard]] QUrl dalamudLatestPackageUrl(Profile::DalamudChannel channel) const;
|
||||||
QUrl dalamudAssetManifestUrl() const;
|
[[nodiscard]] QUrl dalamudAssetManifestUrl() const;
|
||||||
|
|
||||||
LauncherCore &launcher;
|
LauncherCore &launcher;
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ public:
|
||||||
[[nodiscard]] bool isSteamDeck() const;
|
[[nodiscard]] bool isSteamDeck() const;
|
||||||
|
|
||||||
Q_INVOKABLE void refreshNews();
|
Q_INVOKABLE void refreshNews();
|
||||||
Headline *headline() const;
|
[[nodiscard]] Headline *headline() const;
|
||||||
|
|
||||||
Q_INVOKABLE void openOfficialLauncher(Profile *profile);
|
Q_INVOKABLE void openOfficialLauncher(Profile *profile);
|
||||||
Q_INVOKABLE void openSystemInfo(Profile *profile);
|
Q_INVOKABLE void openSystemInfo(Profile *profile);
|
||||||
|
|
|
@ -25,7 +25,7 @@ void AccountManager::load()
|
||||||
int AccountManager::rowCount(const QModelIndex &index) const
|
int AccountManager::rowCount(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
return m_accounts.size();
|
return static_cast<int>(m_accounts.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant AccountManager::data(const QModelIndex &index, int role) const
|
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->deleteGroup(QStringLiteral("account-%1").arg(account->uuid()));
|
||||||
config->sync();
|
config->sync();
|
||||||
|
|
||||||
const int row = m_accounts.indexOf(account);
|
const int row = static_cast<int>(m_accounts.indexOf(account));
|
||||||
beginRemoveRows(QModelIndex(), row, row);
|
beginRemoveRows(QModelIndex(), row, row);
|
||||||
m_accounts.removeAll(account);
|
m_accounts.removeAll(account);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
|
@ -103,7 +103,7 @@ void AccountManager::deleteAccount(Account *account)
|
||||||
|
|
||||||
void AccountManager::insertAccount(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);
|
m_accounts.append(account);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "assetupdater.h"
|
#include "assetupdater.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
@ -17,6 +16,7 @@ const QString dotnetDesktopPackageURL = "https://dotnetcli.azureedge.net/dotnet/
|
||||||
AssetUpdater::AssetUpdater(Profile &profile, LauncherCore &launcher, QObject *parent)
|
AssetUpdater::AssetUpdater(Profile &profile, LauncherCore &launcher, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, launcher(launcher)
|
, launcher(launcher)
|
||||||
|
, chosenChannel(profile.dalamudChannel())
|
||||||
, m_profile(profile)
|
, m_profile(profile)
|
||||||
{
|
{
|
||||||
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||||
|
@ -86,8 +86,6 @@ void AssetUpdater::update()
|
||||||
{
|
{
|
||||||
QNetworkRequest request(dalamudVersionManifestUrl(m_profile.dalamudChannel()));
|
QNetworkRequest request(dalamudVersionManifestUrl(m_profile.dalamudChannel()));
|
||||||
|
|
||||||
chosenChannel = m_profile.dalamudChannel();
|
|
||||||
|
|
||||||
remoteDalamudVersion.clear();
|
remoteDalamudVersion.clear();
|
||||||
remoteRuntimeVersion.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
|
// 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.
|
// start at the first character of the json '{' and work our way up.
|
||||||
QString reassmbled;
|
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];
|
char t = str[i];
|
||||||
if (QChar(t).isPrint())
|
if (QChar(t).isPrint())
|
||||||
reassmbled += t;
|
reassmbled += t;
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
#include "account.h"
|
#include "account.h"
|
||||||
|
|
|
@ -48,7 +48,7 @@ void ProfileManager::deleteProfile(Profile *profile)
|
||||||
config->deleteGroup(QStringLiteral("profile-%1").arg(profile->uuid()));
|
config->deleteGroup(QStringLiteral("profile-%1").arg(profile->uuid()));
|
||||||
config->sync();
|
config->sync();
|
||||||
|
|
||||||
const int row = m_profiles.indexOf(profile);
|
const int row = static_cast<int>(m_profiles.indexOf(profile));
|
||||||
beginRemoveRows(QModelIndex(), row, row);
|
beginRemoveRows(QModelIndex(), row, row);
|
||||||
m_profiles.removeAll(profile);
|
m_profiles.removeAll(profile);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
|
@ -64,7 +64,7 @@ QString ProfileManager::getDefaultWinePrefixPath()
|
||||||
return QDir::homePath() + QStringLiteral("/.wine");
|
return QDir::homePath() + QStringLiteral("/.wine");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return "";
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProfileManager::getDefaultGamePath(const QString &uuid)
|
QString ProfileManager::getDefaultGamePath(const QString &uuid)
|
||||||
|
@ -105,7 +105,7 @@ void ProfileManager::load()
|
||||||
int ProfileManager::rowCount(const QModelIndex &index) const
|
int ProfileManager::rowCount(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
return m_profiles.size();
|
return static_cast<int>(m_profiles.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ProfileManager::data(const QModelIndex &index, int role) const
|
QVariant ProfileManager::data(const QModelIndex &index, int role) const
|
||||||
|
@ -129,7 +129,7 @@ QHash<int, QByteArray> ProfileManager::roleNames() const
|
||||||
|
|
||||||
void ProfileManager::insertProfile(Profile *profile)
|
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);
|
m_profiles.append(profile);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue