diff --git a/launcher/core/include/launchercore.h b/launcher/core/include/launchercore.h index 1495acc..5d78f6a 100755 --- a/launcher/core/include/launchercore.h +++ b/launcher/core/include/launchercore.h @@ -55,11 +55,11 @@ public: physis_Repositories repositories; const char* bootVersion; - bool isGameInstalled() const { + [[nodiscard]] bool isGameInstalled() const { return repositories.repositories_count > 0; } - bool isWineInstalled() const { + [[nodiscard]] bool isWineInstalled() const { return !wineVersion.isEmpty(); } @@ -102,12 +102,12 @@ public: /* * 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. */ - QString getKeychainValue(QString key); + QString getKeychainValue(const QString& key) const; }; struct AppSettings { @@ -142,7 +142,7 @@ class LauncherCore : public QObject { Q_OBJECT Q_PROPERTY(SquareBoot* squareBoot MEMBER squareBoot) public: - LauncherCore(bool isSteam); + explicit LauncherCore(bool isSteam); // used for qml only, TODO: move this to a dedicated factory Q_INVOKABLE LoginInformation* createNewLoginInfo() { @@ -159,7 +159,7 @@ public: } int getProfileIndex(const QString& name); - Q_INVOKABLE QList profileList() const; + Q_INVOKABLE [[nodiscard]] QList profileList() const; int addProfile(); int deleteProfile(const QString& name); diff --git a/launcher/core/include/patcher.h b/launcher/core/include/patcher.h index 777d0f1..d48473c 100644 --- a/launcher/core/include/patcher.h +++ b/launcher/core/include/patcher.h @@ -13,7 +13,7 @@ public: Patcher(QString baseDirectory, GameData* game_data); Patcher(QString baseDirectory, BootData* game_data); - void processPatchList(QNetworkAccessManager& mgr, QString patchList); + void processPatchList(QNetworkAccessManager& mgr, const QString& patchList); signals: void done(); @@ -21,7 +21,7 @@ signals: private: void checkIfDone(); - bool isBoot() const { + [[nodiscard]] bool isBoot() const { return boot_data != nullptr; } diff --git a/launcher/core/include/steamapi.h b/launcher/core/include/steamapi.h index 7526c29..efaac31 100644 --- a/launcher/core/include/steamapi.h +++ b/launcher/core/include/steamapi.h @@ -8,7 +8,7 @@ public: void setLauncherMode(bool isLauncher); - bool isDeck() const; + [[nodiscard]] bool isDeck() const; private: LauncherCore& core; diff --git a/launcher/core/src/launchercore.cpp b/launcher/core/src/launchercore.cpp index d4460bf..ff37152 100755 --- a/launcher/core/src/launchercore.cpp +++ b/launcher/core/src/launchercore.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -647,7 +646,7 @@ QString LauncherCore::getDefaultGamePath() { void LauncherCore::addRegistryKey(const ProfileSettings& settings, QString key, QString value, QString data) { auto process = new QProcess(this); 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) { @@ -698,14 +697,14 @@ bool LauncherCore::autoLogin(ProfileSettings& profile) { 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"); job->setTextData(value); job->setKey(name + "-" + key); job->start(); } -QString ProfileSettings::getKeychainValue(QString key) { +QString ProfileSettings::getKeychainValue(const QString& key) const { auto loop = new QEventLoop(); auto job = new QKeychain::ReadPasswordJob("Astra"); diff --git a/launcher/core/src/patcher.cpp b/launcher/core/src/patcher.cpp index bf3359f..add3a41 100644 --- a/launcher/core/src/patcher.cpp +++ b/launcher/core/src/patcher.cpp @@ -5,22 +5,23 @@ #include #include #include +#include -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->setLabelText("Checking the FINAL FANTASY XIV Updater/Launcher version."); 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->setLabelText("Checking the FINAL FANTASY XIV Game version."); dialog->show(); } -void Patcher::processPatchList(QNetworkAccessManager& mgr, QString patchList) { +void Patcher::processPatchList(QNetworkAccessManager& mgr, const QString& patchList) { if (patchList.isEmpty()) { dialog->hide(); diff --git a/launcher/core/src/steamapi.cpp b/launcher/core/src/steamapi.cpp index 8b564f7..0b6569e 100644 --- a/launcher/core/src/steamapi.cpp +++ b/launcher/core/src/steamapi.cpp @@ -1,8 +1,6 @@ #include "steamapi.h" #include "launchercore.h" -#include - #ifdef ENABLE_STEAM #include #endif diff --git a/launcher/desktop/include/desktopinterface.h b/launcher/desktop/include/desktopinterface.h index c1d3e67..9506c5a 100644 --- a/launcher/desktop/include/desktopinterface.h +++ b/launcher/desktop/include/desktopinterface.h @@ -9,7 +9,7 @@ */ class DesktopInterface { public: - DesktopInterface(LauncherCore& core); + explicit DesktopInterface(LauncherCore& core); private: LauncherWindow* window = nullptr; diff --git a/launcher/desktop/include/launcherwindow.h b/launcher/desktop/include/launcherwindow.h index 58cf6ab..0679689 100644 --- a/launcher/desktop/include/launcherwindow.h +++ b/launcher/desktop/include/launcherwindow.h @@ -15,7 +15,7 @@ class LauncherWindow : public QMainWindow { Q_OBJECT public: - explicit LauncherWindow(LauncherCore& core, QWidget* parent = nullptr); + explicit LauncherWindow(LauncherCore& new_headline, QWidget* parent = nullptr); ProfileSettings& currentProfile(); diff --git a/launcher/desktop/src/autologinwindow.cpp b/launcher/desktop/src/autologinwindow.cpp index 532f4d7..9ff906b 100644 --- a/launcher/desktop/src/autologinwindow.cpp +++ b/launcher/desktop/src/autologinwindow.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include diff --git a/launcher/desktop/src/bannerwidget.cpp b/launcher/desktop/src/bannerwidget.cpp index da12a38..65deafc 100644 --- a/launcher/desktop/src/bannerwidget.cpp +++ b/launcher/desktop/src/bannerwidget.cpp @@ -2,6 +2,7 @@ #include #include +#include BannerWidget::BannerWidget() : QLabel() { setCursor(Qt::CursorShape::PointingHandCursor); @@ -13,5 +14,5 @@ void BannerWidget::mousePressEvent(QMouseEvent* event) { } void BannerWidget::setUrl(QUrl newUrl) { - this->url = newUrl; + this->url = std::move(newUrl); } diff --git a/launcher/desktop/src/gamescopesettingswindow.cpp b/launcher/desktop/src/gamescopesettingswindow.cpp index c9a2f9a..2c836f7 100644 --- a/launcher/desktop/src/gamescopesettingswindow.cpp +++ b/launcher/desktop/src/gamescopesettingswindow.cpp @@ -8,7 +8,6 @@ #include #include "launchercore.h" -#include "launcherwindow.h" GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, LauncherCore& core, QWidget* parent) : QDialog(parent) { diff --git a/launcher/desktop/src/launcherwindow.cpp b/launcher/desktop/src/launcherwindow.cpp index 1c93fa6..b9a25b0 100644 --- a/launcher/desktop/src/launcherwindow.cpp +++ b/launcher/desktop/src/launcherwindow.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "aboutwindow.h" #include "assetupdater.h" @@ -325,8 +326,8 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo QCoreApplication::quit(); }); - getHeadline(core, [&](Headline headline) { - this->headline = headline; + getHeadline(core, [&](Headline new_headline) { + this->headline = std::move(new_headline); reloadNews(); }); diff --git a/launcher/main.cpp b/launcher/main.cpp index c8f8e7a..5ee151b 100755 --- a/launcher/main.cpp +++ b/launcher/main.cpp @@ -2,7 +2,6 @@ #include #include -#include #include "../launcher/tablet/include/tabletinterface.h" #include "cmdinterface.h" @@ -87,5 +86,5 @@ int main(int argc, char* argv[]) { #endif } - return app.exec(); + return QApplication::exec(); } diff --git a/launcher/tablet/include/tabletinterface.h b/launcher/tablet/include/tabletinterface.h index e8f5187..bb429d4 100644 --- a/launcher/tablet/include/tabletinterface.h +++ b/launcher/tablet/include/tabletinterface.h @@ -10,7 +10,7 @@ */ class TabletInterface { public: - TabletInterface(LauncherCore& core); + explicit TabletInterface(LauncherCore& core); private: QQmlApplicationEngine* applicationEngine = nullptr;