mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 20:27:45 +00:00
Small code changes to quiet analyzer
This commit is contained in:
parent
3b77932211
commit
98760624a5
14 changed files with 25 additions and 28 deletions
|
@ -55,11 +55,11 @@ public:
|
||||||
physis_Repositories repositories;
|
physis_Repositories repositories;
|
||||||
const char* bootVersion;
|
const char* bootVersion;
|
||||||
|
|
||||||
bool isGameInstalled() const {
|
[[nodiscard]] bool isGameInstalled() const {
|
||||||
return repositories.repositories_count > 0;
|
return repositories.repositories_count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isWineInstalled() const {
|
[[nodiscard]] bool isWineInstalled() const {
|
||||||
return !wineVersion.isEmpty();
|
return !wineVersion.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,12 +102,12 @@ public:
|
||||||
/*
|
/*
|
||||||
* Sets a value in the keychain. This function is asynchronous.
|
* Sets a value in the keychain. This function is asynchronous.
|
||||||
*/
|
*/
|
||||||
void setKeychainValue(QString key, QString value);
|
void setKeychainValue(const QString& key, const QString& value) const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieves a value from the keychain. This function is synchronous.
|
* Retrieves a value from the keychain. This function is synchronous.
|
||||||
*/
|
*/
|
||||||
QString getKeychainValue(QString key);
|
QString getKeychainValue(const QString& key) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AppSettings {
|
struct AppSettings {
|
||||||
|
@ -142,7 +142,7 @@ class LauncherCore : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(SquareBoot* squareBoot MEMBER squareBoot)
|
Q_PROPERTY(SquareBoot* squareBoot MEMBER squareBoot)
|
||||||
public:
|
public:
|
||||||
LauncherCore(bool isSteam);
|
explicit LauncherCore(bool isSteam);
|
||||||
|
|
||||||
// used for qml only, TODO: move this to a dedicated factory
|
// used for qml only, TODO: move this to a dedicated factory
|
||||||
Q_INVOKABLE LoginInformation* createNewLoginInfo() {
|
Q_INVOKABLE LoginInformation* createNewLoginInfo() {
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int getProfileIndex(const QString& name);
|
int getProfileIndex(const QString& name);
|
||||||
Q_INVOKABLE QList<QString> profileList() const;
|
Q_INVOKABLE [[nodiscard]] QList<QString> profileList() const;
|
||||||
int addProfile();
|
int addProfile();
|
||||||
int deleteProfile(const QString& name);
|
int deleteProfile(const QString& name);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ public:
|
||||||
Patcher(QString baseDirectory, GameData* game_data);
|
Patcher(QString baseDirectory, GameData* game_data);
|
||||||
Patcher(QString baseDirectory, BootData* game_data);
|
Patcher(QString baseDirectory, BootData* game_data);
|
||||||
|
|
||||||
void processPatchList(QNetworkAccessManager& mgr, QString patchList);
|
void processPatchList(QNetworkAccessManager& mgr, const QString& patchList);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done();
|
void done();
|
||||||
|
@ -21,7 +21,7 @@ signals:
|
||||||
private:
|
private:
|
||||||
void checkIfDone();
|
void checkIfDone();
|
||||||
|
|
||||||
bool isBoot() const {
|
[[nodiscard]] bool isBoot() const {
|
||||||
return boot_data != nullptr;
|
return boot_data != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ public:
|
||||||
|
|
||||||
void setLauncherMode(bool isLauncher);
|
void setLauncherMode(bool isLauncher);
|
||||||
|
|
||||||
bool isDeck() const;
|
[[nodiscard]] bool isDeck() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LauncherCore& core;
|
LauncherCore& core;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
@ -647,7 +646,7 @@ QString LauncherCore::getDefaultGamePath() {
|
||||||
void LauncherCore::addRegistryKey(const ProfileSettings& settings, QString key, QString value, QString data) {
|
void LauncherCore::addRegistryKey(const ProfileSettings& settings, QString key, QString value, QString data) {
|
||||||
auto process = new QProcess(this);
|
auto process = new QProcess(this);
|
||||||
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
|
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
|
||||||
launchExecutable(settings, process, {"reg", "add", std::move(key), "/v", value, "/d", data, "/f"}, false, false);
|
launchExecutable(settings, process, {"reg", "add", std::move(key), "/v", std::move(value), "/d", std::move(data), "/f"}, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::readGameData(ProfileSettings& profile) {
|
void LauncherCore::readGameData(ProfileSettings& profile) {
|
||||||
|
@ -698,14 +697,14 @@ bool LauncherCore::autoLogin(ProfileSettings& profile) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileSettings::setKeychainValue(QString key, QString value) {
|
void ProfileSettings::setKeychainValue(const QString& key, const QString& value) const {
|
||||||
auto job = new QKeychain::WritePasswordJob("Astra");
|
auto job = new QKeychain::WritePasswordJob("Astra");
|
||||||
job->setTextData(value);
|
job->setTextData(value);
|
||||||
job->setKey(name + "-" + key);
|
job->setKey(name + "-" + key);
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProfileSettings::getKeychainValue(QString key) {
|
QString ProfileSettings::getKeychainValue(const QString& key) const {
|
||||||
auto loop = new QEventLoop();
|
auto loop = new QEventLoop();
|
||||||
|
|
||||||
auto job = new QKeychain::ReadPasswordJob("Astra");
|
auto job = new QKeychain::ReadPasswordJob("Astra");
|
||||||
|
|
|
@ -5,22 +5,23 @@
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
Patcher::Patcher(QString baseDirectory, BootData* boot_data) : boot_data(boot_data), baseDirectory(baseDirectory) {
|
Patcher::Patcher(QString baseDirectory, BootData* boot_data) : boot_data(boot_data), baseDirectory(std::move(baseDirectory)) {
|
||||||
dialog = new QProgressDialog();
|
dialog = new QProgressDialog();
|
||||||
dialog->setLabelText("Checking the FINAL FANTASY XIV Updater/Launcher version.");
|
dialog->setLabelText("Checking the FINAL FANTASY XIV Updater/Launcher version.");
|
||||||
|
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
Patcher::Patcher(QString baseDirectory, GameData* game_data) : game_data(game_data), baseDirectory(baseDirectory) {
|
Patcher::Patcher(QString baseDirectory, GameData* game_data) : game_data(game_data), baseDirectory(std::move(baseDirectory)) {
|
||||||
dialog = new QProgressDialog();
|
dialog = new QProgressDialog();
|
||||||
dialog->setLabelText("Checking the FINAL FANTASY XIV Game version.");
|
dialog->setLabelText("Checking the FINAL FANTASY XIV Game version.");
|
||||||
|
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patcher::processPatchList(QNetworkAccessManager& mgr, QString patchList) {
|
void Patcher::processPatchList(QNetworkAccessManager& mgr, const QString& patchList) {
|
||||||
if (patchList.isEmpty()) {
|
if (patchList.isEmpty()) {
|
||||||
dialog->hide();
|
dialog->hide();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include "steamapi.h"
|
#include "steamapi.h"
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#ifdef ENABLE_STEAM
|
#ifdef ENABLE_STEAM
|
||||||
#include <steam/steam_api.h>
|
#include <steam/steam_api.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*/
|
*/
|
||||||
class DesktopInterface {
|
class DesktopInterface {
|
||||||
public:
|
public:
|
||||||
DesktopInterface(LauncherCore& core);
|
explicit DesktopInterface(LauncherCore& core);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LauncherWindow* window = nullptr;
|
LauncherWindow* window = nullptr;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
class LauncherWindow : public QMainWindow {
|
class LauncherWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit LauncherWindow(LauncherCore& core, QWidget* parent = nullptr);
|
explicit LauncherWindow(LauncherCore& new_headline, QWidget* parent = nullptr);
|
||||||
|
|
||||||
ProfileSettings& currentProfile();
|
ProfileSettings& currentProfile();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
BannerWidget::BannerWidget() : QLabel() {
|
BannerWidget::BannerWidget() : QLabel() {
|
||||||
setCursor(Qt::CursorShape::PointingHandCursor);
|
setCursor(Qt::CursorShape::PointingHandCursor);
|
||||||
|
@ -13,5 +14,5 @@ void BannerWidget::mousePressEvent(QMouseEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BannerWidget::setUrl(QUrl newUrl) {
|
void BannerWidget::setUrl(QUrl newUrl) {
|
||||||
this->url = newUrl;
|
this->url = std::move(newUrl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
|
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
#include "launcherwindow.h"
|
|
||||||
|
|
||||||
GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, LauncherCore& core, QWidget* parent)
|
GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, LauncherCore& core, QWidget* parent)
|
||||||
: QDialog(parent) {
|
: QDialog(parent) {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "aboutwindow.h"
|
#include "aboutwindow.h"
|
||||||
#include "assetupdater.h"
|
#include "assetupdater.h"
|
||||||
|
@ -325,8 +326,8 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
getHeadline(core, [&](Headline headline) {
|
getHeadline(core, [&](Headline new_headline) {
|
||||||
this->headline = headline;
|
this->headline = std::move(new_headline);
|
||||||
reloadNews();
|
reloadNews();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
#include "../launcher/tablet/include/tabletinterface.h"
|
#include "../launcher/tablet/include/tabletinterface.h"
|
||||||
#include "cmdinterface.h"
|
#include "cmdinterface.h"
|
||||||
|
@ -87,5 +86,5 @@ int main(int argc, char* argv[]) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.exec();
|
return QApplication::exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*/
|
*/
|
||||||
class TabletInterface {
|
class TabletInterface {
|
||||||
public:
|
public:
|
||||||
TabletInterface(LauncherCore& core);
|
explicit TabletInterface(LauncherCore& core);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QQmlApplicationEngine* applicationEngine = nullptr;
|
QQmlApplicationEngine* applicationEngine = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue