diff --git a/launcher/include/profilemanager.h b/launcher/include/profilemanager.h index 9bd15a7..1e83e67 100644 --- a/launcher/include/profilemanager.h +++ b/launcher/include/profilemanager.h @@ -23,11 +23,11 @@ public: ProfileRole = 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 Profile *getProfile(int index); @@ -35,7 +35,7 @@ public: Q_INVOKABLE Profile *addProfile(); Q_INVOKABLE void deleteProfile(Profile *profile); - QVector profiles() const; + [[nodiscard]] QVector profiles() const; Q_INVOKABLE bool canDelete(Profile *account) const; diff --git a/launcher/src/profilemanager.cpp b/launcher/src/profilemanager.cpp index f5b6215..4dfd2f6 100644 --- a/launcher/src/profilemanager.cpp +++ b/launcher/src/profilemanager.cpp @@ -31,7 +31,7 @@ int ProfileManager::getProfileIndex(const QString &name) Profile *ProfileManager::addProfile() { auto newProfile = new Profile(m_launcher, QUuid::createUuid().toString(), this); - newProfile->setName("New Profile"); + newProfile->setName(QStringLiteral("New Profile")); newProfile->readWineInfo(); @@ -45,7 +45,7 @@ Profile *ProfileManager::addProfile() void ProfileManager::deleteProfile(Profile *profile) { auto config = KSharedConfig::openStateConfig(); - config->deleteGroup(QString("profile-%1").arg(profile->uuid())); + config->deleteGroup(QStringLiteral("profile-%1").arg(profile->uuid())); config->sync(); const int row = m_profiles.indexOf(profile); @@ -61,7 +61,7 @@ QString ProfileManager::getDefaultWinePrefixPath() #endif #if defined(Q_OS_LINUX) - return QDir::homePath() + "/.wine"; + return QDir::homePath() + QStringLiteral("/.wine"); #endif return ""; @@ -81,7 +81,7 @@ QString ProfileManager::getDefaultGamePath(const QString &uuid) #if defined(Q_OS_LINUX) const QDir appData = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::AppDataLocation)[0]; - const QDir gameDir = appData.absoluteFilePath("game"); + const QDir gameDir = appData.absoluteFilePath(QStringLiteral("game")); return gameDir.absoluteFilePath(uuid); #endif } @@ -90,8 +90,8 @@ void ProfileManager::load() { auto config = KSharedConfig::openStateConfig(); for (const auto &id : config->groupList()) { - if (id.contains("profile-")) { - auto profile = new Profile(m_launcher, QString(id).remove("profile-"), this); + if (id.contains(QLatin1String("profile-"))) { + auto profile = new Profile(m_launcher, QString(id).remove(QLatin1String("profile-")), this); insertProfile(profile); } }