diff --git a/app/src/handlers/confighandler.cpp b/app/src/handlers/confighandler.cpp index 88ad828f2a5fc01e9030bc3eab686656bf05dfa8..bcb3cd820ca411bf4ce247c9b12973e53156431b 100644 --- a/app/src/handlers/confighandler.cpp +++ b/app/src/handlers/confighandler.cpp @@ -23,14 +23,14 @@ QJsonObject ConfigHandler::getAppConfigInstallTypes() { if (appConfigInstallTypes_.isEmpty()) { QJsonObject installTypes = appConfig_.get("install_types"); - foreach (const QString &key, installTypes.keys()) { + for (const QString &key : installTypes.keys()) { QJsonObject installtype = installTypes[key].toObject(); installtype["destination"] = convertPathString(installtype["destination"].toString()); installtype["generic_destination"] = convertPathString(installtype["generic_destination"].toString()); installTypes[key] = installtype; } QJsonObject installTypesAlias = appConfig_.get("install_types_alias"); - foreach (const QString &key, installTypesAlias.keys()) { + for (const QString &key : installTypesAlias.keys()) { QJsonObject installTypeAlias = installTypesAlias[key].toObject(); QString baseKey = installTypeAlias["base"].toString(); if (installTypes.contains(baseKey)) { diff --git a/app/src/handlers/itemhandler.cpp b/app/src/handlers/itemhandler.cpp index e7e7c8273160ef63cd9963bd2968fe1713c58761..6fe9a26436fda3e3ea29055aaa1c9bf2c6abfb36 100644 --- a/app/src/handlers/itemhandler.cpp +++ b/app/src/handlers/itemhandler.cpp @@ -135,7 +135,7 @@ void ItemHandler::uninstall(const QString &itemKey) #ifdef QTLIB_UNIX destDir.setPath(configHandler_->getAppConfigInstallTypes()[installType].toObject()["destination"].toString()); - foreach (const QJsonValue &filename, installedItem["files"].toArray()) { + for (const QJsonValue &filename : installedItem["files"].toArray()) { QFileInfo fileInfo(destDir.path() + "/" + filename.toString()); // plasmapkg: Installation process has should be saved plasmapkg into destination directory @@ -180,7 +180,7 @@ void ItemHandler::uninstall(const QString &itemKey) #else destDir.setPath(configHandler_->getAppConfigInstallTypes()[installType].toObject()["generic_destination"].toString()); - foreach (const QJsonValue &filename, installedItem["files"].toArray()) { + for (const QJsonValue &filename : installedItem["files"].toArray()) { QFileInfo fileInfo(destDir.path() + "/" + filename.toString()); if (fileInfo.isDir()) { qtlib::Dir(fileInfo.filePath()).remove(); @@ -392,7 +392,7 @@ void ItemHandler::installDownloadedFile(qtlib::NetworkResource *resource) destDir.make(); QJsonArray installedFiles; - foreach (const QFileInfo &fileInfo, tempDestDir.list()) { + for (const QFileInfo &fileInfo : tempDestDir.list()) { installedFiles.append(QJsonValue(fileInfo.fileName())); if (fileInfo.isDir()) { qtlib::Dir(fileInfo.filePath()).move(destDir.path() + "/" + fileInfo.fileName()); diff --git a/app/src/handlers/ocsapihandler.cpp b/app/src/handlers/ocsapihandler.cpp index 310ed88a5e7fe20c2a858b7a23de316fe341867d..eb5f075c78f6f9b4ce72b2ee2c6d1acd34f45d13 100644 --- a/app/src/handlers/ocsapihandler.cpp +++ b/app/src/handlers/ocsapihandler.cpp @@ -14,7 +14,7 @@ bool OcsApiHandler::addProviders(const QString &providerFileUrl) { QJsonArray providers = qtlib::OcsApi::getProviderFile(QUrl(providerFileUrl)); if (!providers.isEmpty()) { - foreach (const QJsonValue &providerValue, providers) { + for (const QJsonValue &providerValue : providers) { QJsonObject provider = providerValue.toObject(); if (provider.contains("location")) { // Use location (API base URL) as unique key @@ -42,7 +42,7 @@ bool OcsApiHandler::updateAllCategories(bool force) { QJsonObject providers = configHandler_->getUsrConfigProviders(); if (!providers.isEmpty()) { - foreach (const QString &providerKey, providers.keys()) { + for (const QString &providerKey : providers.keys()) { updateCategories(providerKey, force); } return true; @@ -68,7 +68,7 @@ bool OcsApiHandler::updateCategories(const QString &providerKey, bool force) // Data type variation workaround, convert object to array QJsonArray responseData; if (response["data"].isObject()) { - foreach (const QJsonValue &dataValue, response["data"].toObject()) { + for (const QJsonValue &dataValue : response["data"].toObject()) { responseData.append(dataValue); } } @@ -85,7 +85,7 @@ bool OcsApiHandler::updateCategories(const QString &providerKey, bool force) } QJsonObject newProviderCategories; - foreach (const QJsonValue &dataValue, responseData) { + for (const QJsonValue &dataValue : responseData) { QJsonObject data = dataValue.toObject(); // Data type variation workaround, convert int to string @@ -152,13 +152,13 @@ QJsonObject OcsApiHandler::getContents(const QString &providerKeys, const QStrin QJsonObject providers = configHandler_->getUsrConfigProviders(); QJsonObject categories = configHandler_->getUsrConfigCategories(); - foreach (const QString &providerKey, providers.keys()) { + for (const QString &providerKey : providers.keys()) { if (!providerKeyList.isEmpty() && !providerKeyList.contains(providerKey)) { continue; } QStringList categoryIdList; QJsonObject providerCategories = categories[providerKey].toObject(); - foreach (const QString &categoryKey, providerCategories.keys()) { + for (const QString &categoryKey : providerCategories.keys()) { if (!categoryKeyList.isEmpty() && !categoryKeyList.contains(categoryKey)) { continue; } diff --git a/app/src/websockets/websocketserver.cpp b/app/src/websockets/websocketserver.cpp index 2ccc371c53b3ecf57162cf909239847f83a490f6..672bb7398abcadcfcdfc9887812f4eb2c56b0dc7 100644 --- a/app/src/websockets/websocketserver.cpp +++ b/app/src/websockets/websocketserver.cpp @@ -346,7 +346,7 @@ void WebSocketServer::sendMessage(const QString &id, const QString &func, const QByteArray binaryMessage = qtlib::Json(object).toJson(); QString textMessage = QString::fromUtf8(binaryMessage); - foreach (QWebSocket *wsClient, wsClients_) { + for (QWebSocket *wsClient : wsClients_) { wsClient->sendTextMessage(textMessage); //wsClient->sendBinaryMessage(binaryMessage); }