diff --git a/launcher/include/accountmanager.h b/launcher/include/accountmanager.h index ab159ab..d2901b3 100644 --- a/launcher/include/accountmanager.h +++ b/launcher/include/accountmanager.h @@ -23,16 +23,16 @@ public: AccountRole = Qt::UserRole, }; - int rowCount(const QModelIndex &index = QModelIndex()) const override; + [[nodiscard]] int rowCount(const QModelIndex &index) const override; - QVariant data(const QModelIndex &index, int role) const override; + [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override; - QHash roleNames() const override; + [[nodiscard]] QHash roleNames() const override; Q_INVOKABLE Account *createSquareEnixAccount(const QString &username, int licenseType, bool isFreeTrial); Q_INVOKABLE Account *createSapphireAccount(const QString &lobbyUrl, const QString &username); - Account *getByUuid(const QString &uuid) const; + [[nodiscard]] Account *getByUuid(const QString &uuid) const; Q_INVOKABLE bool canDelete(Account *account) const; Q_INVOKABLE void deleteAccount(Account *account); diff --git a/launcher/src/accountmanager.cpp b/launcher/src/accountmanager.cpp index 8190c7d..6407b95 100644 --- a/launcher/src/accountmanager.cpp +++ b/launcher/src/accountmanager.cpp @@ -15,8 +15,8 @@ void AccountManager::load() { auto config = KSharedConfig::openStateConfig(); for (const auto &id : config->groupList()) { - if (id.contains("account-")) { - auto account = new Account(m_launcher, QString(id).remove("account-"), this); + if (id.contains(QLatin1String("account-"))) { + auto account = new Account(m_launcher, QString(id).remove(QLatin1String("account-")), this); m_accounts.append(account); } } @@ -74,7 +74,7 @@ Account *AccountManager::createSapphireAccount(const QString &lobbyUrl, const QS Account *AccountManager::getByUuid(const QString &uuid) const { - for (auto &account : m_accounts) { + for (const auto &account : m_accounts) { if (account->uuid() == uuid) { return account; } @@ -92,7 +92,7 @@ bool AccountManager::canDelete(Account *account) const void AccountManager::deleteAccount(Account *account) { auto config = KSharedConfig::openStateConfig(); - config->deleteGroup(QString("account-%1").arg(account->uuid())); + config->deleteGroup(QStringLiteral("account-%1").arg(account->uuid())); config->sync(); const int row = m_accounts.indexOf(account);