diff --git a/.qmake.conf b/.qmake.conf index 3f48fb4..0893f69 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -5,4 +5,9 @@ win32:cross_compile: CONFIG += winrt DEFINES += QT_DEPRECATED_WARNINGS QT_ASCII_CAST_WARNINGS -MODULE_VERSION = 4.0.0 +MODULE_VERSION_MAJOR = 4 +MODULE_VERSION_MINOR = 0 +MODULE_VERSION_PATCH = 1 +MODULE_VERSION_IMPORT = $${MODULE_VERSION_MAJOR}.$${MODULE_VERSION_MINOR} +MODULE_VERSION = $${MODULE_VERSION_MAJOR}.$${MODULE_VERSION_MINOR}.$${MODULE_VERSION_PATCH} + diff --git a/.travis.yml b/.travis.yml index e430fe2..e9e1554 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,8 @@ osx_image: xcode9.2 env: global: - - QT_VER=5.10.0 + - QPMX_CACHE_DIR=$HOME/.qpmx-cache + - QT_VER=5.10.1 - EXTRA_MODULES=".qtremoteobjects .skycoder42.jsonserializer" - STATIC_QT_MODS="qttools qtwebsockets qtscxml qtremoteobjects" - STATIC_EXTRA_MODS="qtjsonserializer" @@ -20,7 +21,7 @@ matrix: env: - PLATFORM=gcc_64 - BUILD_DOC=true - - EXTRA_PKG="libsecret-1-dev gnome-keyring" #in order to build secrectservice keystore + - EXTRA_PKG="libsecret-1-dev" #in order to build secrectservice keystore - os: linux env: - PLATFORM=android_armv7 @@ -59,10 +60,10 @@ deploy: before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ - #TODO rm qpmx locks + - rm -fr $QPMX_CACHE_DIR/locks cache: directories: - - $HOME/.cache/Skycoder42/qpmx - $HOME/.gradle/caches/ - $HOME/.gradle/wrapper/ - $HOME/.android/build-cache + - $QPMX_CACHE_DIR diff --git a/README.md b/README.md index f76ba8c..b1a9fa5 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ auto store = new QtDataSync::DataStore(this); //Use the "default setup" //store an entry store->save({42, "tree"}); //load all entries -foreach(Data d, store->loadAll()) { +for(Data d : store->loadAll()) { qDebug() << d.key << d.value; }); ``` diff --git a/appveyor.yml b/appveyor.yml index 8c2e3a8..2ec3d57 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ image: version: build-{build} environment: - QT_VER: 5.10.0 + QT_VER: 5.10.1 EXTRA_MODULES: .qtremoteobjects;.skycoder42.jsonserializer STATIC_QT_MODS: qttools qtwebsockets qtscxml qtremoteobjects STATIC_EXTRA_MODS: qtjsonserializer diff --git a/doc/datatypestore.dox b/doc/datatypestore.dox index 13de849..5355902 100644 --- a/doc/datatypestore.dox +++ b/doc/datatypestore.dox @@ -225,7 +225,7 @@ initially. This can be a potentially long operation, and thus you should only us number of datasets does not get extremly big. One additional feature of the store is that it provides read-only STL iterators for easy access. -Using it with foreach however is currently not possible, as the store is not a value type. +Using it with for/foreach however is currently not possible, as the store is not a value type. @sa DataStore, DataStore::loadAll, DataTypeStore */ diff --git a/examples/datasync/Sample/accountdialog.cpp b/examples/datasync/Sample/accountdialog.cpp index 70840a9..df063b6 100644 --- a/examples/datasync/Sample/accountdialog.cpp +++ b/examples/datasync/Sample/accountdialog.cpp @@ -70,7 +70,7 @@ void AccountDialog::exec(const QString &setup, QWidget *parent) void AccountDialog::updateDevices(const QList &devices) { ui->treeWidget->clear(); - foreach(auto device, devices) { + for(auto device : devices) { auto item = new QTreeWidgetItem(ui->treeWidget); item->setText(0, device.name()); item->setText(1, printFingerprint(device.fingerprint())); @@ -111,7 +111,7 @@ void AccountDialog::login(QtDataSync::LoginRequest request) QString AccountDialog::printFingerprint(const QByteArray &fingerprint) { QByteArrayList res; - foreach(char c, fingerprint) + for(char c : fingerprint) res.append(QByteArray(1, c).toHex()); return QString::fromUtf8(res.join(':')); } diff --git a/examples/datasync/Sample/exchangedialog.cpp b/examples/datasync/Sample/exchangedialog.cpp index cddc034..eac7edc 100644 --- a/examples/datasync/Sample/exchangedialog.cpp +++ b/examples/datasync/Sample/exchangedialog.cpp @@ -35,7 +35,7 @@ void ExchangeDialog::exec(QtDataSync::AccountManager *manager, QWidget *parent) void ExchangeDialog::devicesChanged(QList devices) { ui->treeWidget->clear(); - foreach(auto dev, devices) { + for(auto dev : devices) { auto item = new QTreeWidgetItem(ui->treeWidget); item->setText(0, dev.name()); item->setText(1, QStringLiteral("%1:%2").arg(dev.address().toString()).arg(dev.port())); diff --git a/src/datasync/changecontroller.cpp b/src/datasync/changecontroller.cpp index 770ddba..c5db346 100644 --- a/src/datasync/changecontroller.cpp +++ b/src/datasync/changecontroller.cpp @@ -143,7 +143,7 @@ void ChangeController::uploadNext(bool emitStarted) //skip stuff already beeing uploaded (could still have changed, but to prevent errors) auto skip = false; - foreach(auto mKey, _activeUploads.keys()) { + for(auto mKey : _activeUploads.keys()) { if(key == mKey) { skip = true; break; diff --git a/src/datasync/changeemitter.cpp b/src/datasync/changeemitter.cpp index 3b038d2..499dbbe 100644 --- a/src/datasync/changeemitter.cpp +++ b/src/datasync/changeemitter.cpp @@ -58,7 +58,7 @@ void ChangeEmitter::triggerRemoteClear(const QByteArray &typeName) { if(_cache) { QWriteLocker _(&_cache->lock); - foreach(auto key, _cache->cache.keys()) { + for(auto key : _cache->cache.keys()) { if(key.typeName == typeName) _cache->cache.remove(key); } diff --git a/src/datasync/cryptocontroller.cpp b/src/datasync/cryptocontroller.cpp index c04d05a..e934f4f 100644 --- a/src/datasync/cryptocontroller.cpp +++ b/src/datasync/cryptocontroller.cpp @@ -129,7 +129,7 @@ QStringList CryptoController::allKeystoreKeys() QStringList CryptoController::availableKeystoreKeys() { QStringList keys; - foreach(auto key, factory->allKeys()) { + for(auto key : factory->allKeys()) { if(factory->isAvailable(key)) keys.append(key); } @@ -860,7 +860,7 @@ void CryptoController::cleanCiphers() const auto keys = settings()->childKeys(); settings()->endGroup(); - foreach(auto key, keys) { + for(auto key : keys) { auto ok = false; auto keyIndex = key.toUInt(&ok); if(!ok) diff --git a/src/datasync/datastore.cpp b/src/datasync/datastore.cpp index 78cee13..dbc116b 100644 --- a/src/datasync/datastore.cpp +++ b/src/datasync/datastore.cpp @@ -54,9 +54,8 @@ QStringList DataStore::keys(int metaTypeId) const QVariantList DataStore::loadAll(int metaTypeId) const { - auto jsonList = d->store->loadAll(d->typeName(metaTypeId)); QVariantList resList; - foreach(auto val, jsonList) + for(auto val : d->store->loadAll(d->typeName(metaTypeId))) resList.append(d->serializer->deserialize(val, metaTypeId)); return resList; } @@ -139,17 +138,15 @@ void DataStore::update(int metaTypeId, QObject *object) const QVariantList DataStore::search(int metaTypeId, const QString &query, SearchMode mode) const { - auto jsonList = d->store->find(d->typeName(metaTypeId), query, mode); QVariantList resList; - foreach(auto val, jsonList) + for(auto val : d->store->find(d->typeName(metaTypeId), query, mode)) resList.append(d->serializer->deserialize(val, metaTypeId)); return resList; } void DataStore::iterate(int metaTypeId, const function &iterator) const { - auto keyList = keys(metaTypeId); - foreach(auto key, keyList) { + for(auto key : keys(metaTypeId)) { if(!iterator(load(metaTypeId, key))) break; } diff --git a/src/datasync/datastore.h b/src/datasync/datastore.h index b782c8f..95c5e27 100644 --- a/src/datasync/datastore.h +++ b/src/datasync/datastore.h @@ -238,9 +238,8 @@ template QList DataStore::keys() const { QTDATASYNC_STORE_ASSERT(T); - auto kList = keys(); QList rList; - foreach(auto k, kList) + for(auto k : keys()) rList.append(QVariant(k).template value()); return rList; } @@ -249,9 +248,8 @@ template QList DataStore::loadAll() const { QTDATASYNC_STORE_ASSERT(T); - auto mList = loadAll(qMetaTypeId()); QList rList; - foreach(auto v, mList) + for(auto v : loadAll(qMetaTypeId())) rList.append(v.template value()); return rList; } @@ -302,9 +300,8 @@ template QList DataStore::search(const QString &query, SearchMode mode) const { QTDATASYNC_STORE_ASSERT(T); - auto mList = search(qMetaTypeId(), query, mode); QList rList; - foreach(auto v, mList) + for(auto v : search(qMetaTypeId(), query, mode)) rList.append(v.template value()); return rList; } diff --git a/src/datasync/datastoremodel.cpp b/src/datasync/datastoremodel.cpp index a45a333..bfd3f96 100644 --- a/src/datasync/datastoremodel.cpp +++ b/src/datasync/datastoremodel.cpp @@ -317,7 +317,7 @@ void DataStoreModelPrivate::createRoleNames() void DataStoreModelPrivate::clearHashObjects() { if(QMetaType::typeFlags(type).testFlag(QMetaType::PointerToQObject)) { - foreach(auto v, dataHash) + for(auto v : dataHash) deleteObject(v); } dataHash.clear(); diff --git a/src/datasync/datatypestore.h b/src/datasync/datatypestore.h index 746d6e5..d15f828 100644 --- a/src/datasync/datatypestore.h +++ b/src/datasync/datatypestore.h @@ -330,7 +330,7 @@ CachingDataTypeStore::CachingDataTypeStore(DataStore *store, QObjec _data() { auto userProp = TType::staticMetaObject.userProperty(); - foreach(auto data, store->loadAll()) + for(auto data : store->loadAll()) _data.insert(userProp.readOnGadget(&data).template value(), data); connect(_store, &DataStore::dataChanged, @@ -474,7 +474,7 @@ CachingDataTypeStore::CachingDataTypeStore(DataStore *store, QObje _data() { auto userProp = TType::staticMetaObject.userProperty(); - foreach(auto data, store->loadAll()){ + for(auto data : store->loadAll()){ data->setParent(this); _data.insert(userProp.read(data).template value(), data); } @@ -616,7 +616,7 @@ void CachingDataTypeStore::evalDataResetted() auto data = _data; _data.clear(); emit dataResetted(); - foreach(auto d, data) + for(auto d : data) d->deleteLater(); } diff --git a/src/datasync/defaults.cpp b/src/datasync/defaults.cpp index c7ada8e..a7719bf 100644 --- a/src/datasync/defaults.cpp +++ b/src/datasync/defaults.cpp @@ -244,7 +244,7 @@ void DefaultsPrivate::clearDefaults() for(auto it = setupDefaults.constBegin(); it != setupDefaults.constEnd(); it++) weakRefs.append({it.key(), it.value().toWeakRef()}); setupDefaults.clear(); - foreach(auto ref, weakRefs) { + for(auto ref : weakRefs) { #undef QTDATASYNC_LOG #define QTDATASYNC_LOG ref.second.toStrongRef()->logger if(ref.second) @@ -305,7 +305,7 @@ DefaultsPrivate::DefaultsPrivate(const QString &setupName, const QDir &storageDi DefaultsPrivate::~DefaultsPrivate() { QMutexLocker _(&roMutex); - foreach(auto node, roNodes) + for(auto node : roNodes) node->deleteLater(); roNodes.clear(); } diff --git a/src/datasync/emitteradapter.cpp b/src/datasync/emitteradapter.cpp index 82d3990..083a0a8 100644 --- a/src/datasync/emitteradapter.cpp +++ b/src/datasync/emitteradapter.cpp @@ -138,7 +138,7 @@ void EmitterAdapter::dropCached(const QByteArray &typeName) return; QWriteLocker _(&_cache->lock); - foreach(auto key, _cache->cache.keys()) { + for(auto key : _cache->cache.keys()) { if(key.typeName == typeName) _cache->cache.remove(key); } diff --git a/src/datasync/migrationhelper.cpp b/src/datasync/migrationhelper.cpp index fff0e26..21fdf41 100644 --- a/src/datasync/migrationhelper.cpp +++ b/src/datasync/migrationhelper.cpp @@ -178,7 +178,7 @@ void MigrationRunnable::run() //special: copy headers oldSettings->beginGroup(QStringLiteral("RemoteConnector/headers")); currentSettings->beginGroup(QStringLiteral("connector/") + RemoteConnector::keyRemoteHeaders); - foreach(auto key, oldSettings->childKeys()) { + for(auto key : oldSettings->childKeys()) { copyConf(oldSettings, key, currentSettings, key); } diff --git a/src/datasync/remoteconnector.cpp b/src/datasync/remoteconnector.cpp index cf810b8..937091c 100644 --- a/src/datasync/remoteconnector.cpp +++ b/src/datasync/remoteconnector.cpp @@ -516,7 +516,7 @@ void RemoteConnector::error(QAbstractSocket::SocketError error) void RemoteConnector::sslErrors(const QList &errors) { auto shouldClose = true; - foreach(auto error, errors) { + for(auto error : errors) { if(error.error() == QSslError::SelfSignedCertificate || error.error() == QSslError::SelfSignedCertificateInChain) shouldClose = shouldClose && @@ -790,9 +790,8 @@ QVariant RemoteConnector::sValue(const QString &key) const if(key == keyRemoteHeaders) { if(settings()->childGroups().contains(keyRemoteHeaders)) { settings()->beginGroup(keyRemoteHeaders); - auto keys = settings()->childKeys(); RemoteConfig::HeaderHash headers; - foreach(auto key, keys) + for(auto key : settings()->childKeys()) headers.insert(key.toUtf8(), settings()->value(key).toByteArray()); settings()->endGroup(); return QVariant::fromValue(headers); @@ -1074,7 +1073,7 @@ void RemoteConnector::onDevices(const DevicesMessage &message) if(checkIdle(message)) { logDebug() << "Received list of devices with" << message.devices.size() << "entries"; _deviceCache.clear(); - foreach(auto device, message.devices) + for(auto device : message.devices) _deviceCache.append(DeviceInfo{get<0>(device), get<1>(device), get<2>(device)}); emit devicesListed(_deviceCache); } @@ -1180,7 +1179,7 @@ void RemoteConnector::onDeviceKeys(const DeviceKeysMessage &message) reply.cmac = _cryptoController->generateEncryptionKeyCmac(reply.keyIndex); //cmac for the new key //do not store this mac to be send again! - foreach(auto info, message.devices) { + for(auto info : message.devices) { try { //verify the device knows the previous secret (which is still the current one) auto cryptInfo = QSharedPointer::create(_cryptoController->rng(), diff --git a/src/datasync/synchelper.cpp b/src/datasync/synchelper.cpp index 2a12084..2103453 100644 --- a/src/datasync/synchelper.cpp +++ b/src/datasync/synchelper.cpp @@ -106,7 +106,7 @@ void hashNext(QCryptographicHash &hash, const QJsonValue &value) hash.addData(value.toString().toUtf8()); break; case QJsonValue::Array: - foreach(auto v, value.toArray()) + for(auto v : value.toArray()) hashNext(hash, v); break; case QJsonValue::Object: diff --git a/src/datasync/userexchangemanager.cpp b/src/datasync/userexchangemanager.cpp index 2ac2fbe..3ea060d 100644 --- a/src/datasync/userexchangemanager.cpp +++ b/src/datasync/userexchangemanager.cpp @@ -202,7 +202,7 @@ void UserExchangeManager::readDatagram() auto isSelf = false; if(datagram.senderPort() == d->socket->localPort()) { - foreach(auto addr, QNetworkInterface::allAddresses()) { + for(auto addr : QNetworkInterface::allAddresses()) { if(addr.isEqual(datagram.senderAddress())) { isSelf = true; break; @@ -250,7 +250,7 @@ void UserExchangeManager::readDatagram() //try to find the already existing user info for that data bool found = false; - foreach(auto key, d->devices.keys()) { + for(auto key : d->devices.keys()) { if(info == key) { found = true; if(isInfo) { //isInfo -> reset timeout, update name if neccessary diff --git a/src/imports/qmldatasync/qmldatasync.pro b/src/imports/datasync/datasync.pro similarity index 63% rename from src/imports/qmldatasync/qmldatasync.pro rename to src/imports/datasync/datasync.pro index 57f8203..56ba5d2 100644 --- a/src/imports/qmldatasync/qmldatasync.pro +++ b/src/imports/datasync/datasync.pro @@ -1,40 +1,43 @@ QT = core datasync qml +CXX_MODULE = datasync TARGETPATH = de/skycoder42/QtDataSync -IMPORT_VERSION = 1.0 +TARGET = declarative_datasync +IMPORT_VERSION = $$MODULE_VERSION_IMPORT +DEFINES += "VERSION_MAJOR=$$MODULE_VERSION_MAJOR" +DEFINES += "VERSION_MINOR=$$MODULE_VERSION_MINOR" -HEADERS += qmldatasync_plugin.h \ +HEADERS += \ qqmldatastore.h \ qqmlsyncmanager.h \ qqmlaccountmanager.h \ qqmldatastoremodel.h \ - qqmluserexchangemanager.h + qqmluserexchangemanager.h \ + qtdatasync_plugin.h -SOURCES += qmldatasync_plugin.cpp \ +SOURCES += \ qqmldatastore.cpp \ qqmlsyncmanager.cpp \ qqmlaccountmanager.cpp \ qqmldatastoremodel.cpp \ - qqmluserexchangemanager.cpp + qqmluserexchangemanager.cpp \ + qtdatasync_plugin.cpp OTHER_FILES += qmldir -IMPORT_VERSION = 1.0 - generate_qmltypes { typeextra1.target = qmltypes typeextra1.depends += export LD_LIBRARY_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/lib/:$(LD_LIBRARY_PATH)" - qmltypes.depends += typeextra1 - typeextra2.target = qmltypes typeextra2.depends += export QML2_IMPORT_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/qml/" - qmltypes.depends += typeextra2 QMAKE_EXTRA_TARGETS += typeextra1 typeextra2 } load(qml_plugin) generate_qmltypes { + qmltypes.depends = ../../../qml/$$TARGETPATH/$(TARGET) #overwrite the target deps + mfirst.target = all mfirst.depends += qmltypes QMAKE_EXTRA_TARGETS += mfirst diff --git a/src/imports/qmldatasync/plugins.qmltypes b/src/imports/datasync/plugins.qmltypes similarity index 97% rename from src/imports/qmldatasync/plugins.qmltypes rename to src/imports/datasync/plugins.qmltypes index fff30f4..5ec70f6 100644 --- a/src/imports/qmldatasync/plugins.qmltypes +++ b/src/imports/datasync/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable de.skycoder42.QtDataSync 1.0' +// 'qmlplugindump -nonrelocatable de.skycoder42.QtDataSync 4.0' Module { dependencies: ["QtQuick 2.8"] @@ -140,7 +140,7 @@ Module { } Component { name: "QtDataSync::DeviceInfo" - exports: ["de.skycoder42.QtDataSync/DeviceInfo 1.0"] + exports: ["de.skycoder42.QtDataSync/DeviceInfo 4.0"] isCreatable: false exportMetaObjectRevisions: [0] Property { name: "deviceId"; type: "QUuid" } @@ -149,7 +149,7 @@ Module { } Component { name: "QtDataSync::LoginRequest" - exports: ["de.skycoder42.QtDataSync/LoginRequest 1.0"] + exports: ["de.skycoder42.QtDataSync/LoginRequest 4.0"] isCreatable: false exportMetaObjectRevisions: [0] Property { name: "device"; type: "QtDataSync::DeviceInfo"; isReadonly: true } @@ -160,7 +160,7 @@ Module { Component { name: "QtDataSync::QQmlAccountManager" prototype: "QtDataSync::AccountManager" - exports: ["de.skycoder42.QtDataSync/AccountManager 1.0"] + exports: ["de.skycoder42.QtDataSync/AccountManager 4.0"] exportMetaObjectRevisions: [0] Property { name: "setupName"; type: "string" } Property { name: "node"; type: "QRemoteObjectNode"; isPointer: true } @@ -242,7 +242,7 @@ Module { Component { name: "QtDataSync::QQmlDataStore" prototype: "QtDataSync::DataStore" - exports: ["de.skycoder42.QtDataSync/DataStore 1.0"] + exports: ["de.skycoder42.QtDataSync/DataStore 4.0"] exportMetaObjectRevisions: [0] Property { name: "setupName"; type: "string" } Property { name: "valid"; type: "bool"; isReadonly: true } @@ -316,7 +316,7 @@ Module { Component { name: "QtDataSync::QQmlDataStoreModel" prototype: "QtDataSync::DataStoreModel" - exports: ["de.skycoder42.QtDataSync/DataStoreModel 1.0"] + exports: ["de.skycoder42.QtDataSync/DataStoreModel 4.0"] exportMetaObjectRevisions: [0] Property { name: "setupName"; type: "string" } Property { name: "dataStore"; type: "QQmlDataStore"; isPointer: true } @@ -354,7 +354,7 @@ Module { Component { name: "QtDataSync::QQmlSyncManager" prototype: "QtDataSync::SyncManager" - exports: ["de.skycoder42.QtDataSync/SyncManager 1.0"] + exports: ["de.skycoder42.QtDataSync/SyncManager 4.0"] exportMetaObjectRevisions: [0] Property { name: "setupName"; type: "string" } Property { name: "node"; type: "QRemoteObjectNode"; isPointer: true } @@ -401,7 +401,7 @@ Module { Component { name: "QtDataSync::QQmlUserExchangeManager" prototype: "QtDataSync::UserExchangeManager" - exports: ["de.skycoder42.QtDataSync/UserExchangeManager 1.0"] + exports: ["de.skycoder42.QtDataSync/UserExchangeManager 4.0"] exportMetaObjectRevisions: [0] Property { name: "DataExchangePort"; type: "ushort"; isReadonly: true } Property { name: "setupName"; type: "string" } @@ -548,7 +548,7 @@ Module { } Component { name: "QtDataSync::UserInfo" - exports: ["de.skycoder42.QtDataSync/UserInfo 1.0"] + exports: ["de.skycoder42.QtDataSync/UserInfo 4.0"] isCreatable: false exportMetaObjectRevisions: [0] Property { name: "name"; type: "string"; isReadonly: true } diff --git a/src/imports/qmldatasync/qmldir b/src/imports/datasync/qmldir similarity index 75% rename from src/imports/qmldatasync/qmldir rename to src/imports/datasync/qmldir index 31d28e7..4aaaf74 100644 --- a/src/imports/qmldatasync/qmldir +++ b/src/imports/datasync/qmldir @@ -1,4 +1,4 @@ module de.skycoder42.QtDataSync -plugin declarative_qmldatasync +plugin declarative_datasync classname QtDataSyncDeclarativeModule typeinfo plugins.qmltypes diff --git a/src/imports/qmldatasync/qqmlaccountmanager.cpp b/src/imports/datasync/qqmlaccountmanager.cpp similarity index 100% rename from src/imports/qmldatasync/qqmlaccountmanager.cpp rename to src/imports/datasync/qqmlaccountmanager.cpp diff --git a/src/imports/qmldatasync/qqmlaccountmanager.h b/src/imports/datasync/qqmlaccountmanager.h similarity index 100% rename from src/imports/qmldatasync/qqmlaccountmanager.h rename to src/imports/datasync/qqmlaccountmanager.h diff --git a/src/imports/qmldatasync/qqmldatastore.cpp b/src/imports/datasync/qqmldatastore.cpp similarity index 100% rename from src/imports/qmldatasync/qqmldatastore.cpp rename to src/imports/datasync/qqmldatastore.cpp diff --git a/src/imports/qmldatasync/qqmldatastore.h b/src/imports/datasync/qqmldatastore.h similarity index 100% rename from src/imports/qmldatasync/qqmldatastore.h rename to src/imports/datasync/qqmldatastore.h diff --git a/src/imports/qmldatasync/qqmldatastoremodel.cpp b/src/imports/datasync/qqmldatastoremodel.cpp similarity index 100% rename from src/imports/qmldatasync/qqmldatastoremodel.cpp rename to src/imports/datasync/qqmldatastoremodel.cpp diff --git a/src/imports/qmldatasync/qqmldatastoremodel.h b/src/imports/datasync/qqmldatastoremodel.h similarity index 100% rename from src/imports/qmldatasync/qqmldatastoremodel.h rename to src/imports/datasync/qqmldatastoremodel.h diff --git a/src/imports/qmldatasync/qqmlsyncmanager.cpp b/src/imports/datasync/qqmlsyncmanager.cpp similarity index 100% rename from src/imports/qmldatasync/qqmlsyncmanager.cpp rename to src/imports/datasync/qqmlsyncmanager.cpp diff --git a/src/imports/qmldatasync/qqmlsyncmanager.h b/src/imports/datasync/qqmlsyncmanager.h similarity index 100% rename from src/imports/qmldatasync/qqmlsyncmanager.h rename to src/imports/datasync/qqmlsyncmanager.h diff --git a/src/imports/qmldatasync/qqmluserexchangemanager.cpp b/src/imports/datasync/qqmluserexchangemanager.cpp similarity index 100% rename from src/imports/qmldatasync/qqmluserexchangemanager.cpp rename to src/imports/datasync/qqmluserexchangemanager.cpp diff --git a/src/imports/qmldatasync/qqmluserexchangemanager.h b/src/imports/datasync/qqmluserexchangemanager.h similarity index 100% rename from src/imports/qmldatasync/qqmluserexchangemanager.h rename to src/imports/datasync/qqmluserexchangemanager.h diff --git a/src/imports/datasync/qtdatasync_plugin.cpp b/src/imports/datasync/qtdatasync_plugin.cpp new file mode 100644 index 0000000..0bfe700 --- /dev/null +++ b/src/imports/datasync/qtdatasync_plugin.cpp @@ -0,0 +1,33 @@ +#include "qtdatasync_plugin.h" + +#include + +#include "qqmldatastore.h" +#include "qqmldatastoremodel.h" +#include "qqmlsyncmanager.h" +#include "qqmlaccountmanager.h" +#include "qqmluserexchangemanager.h" + +QtDataSyncDeclarativeModule::QtDataSyncDeclarativeModule(QObject *parent) : + QQmlExtensionPlugin(parent) +{} + +void QtDataSyncDeclarativeModule::registerTypes(const char *uri) +{ + Q_ASSERT(qstrcmp(uri, "de.skycoder42.QtDataSync") == 0); + + //Version 4.0 + qmlRegisterUncreatableType(uri, 4, 0, "DeviceInfo", QStringLiteral("Q_GADGETS cannot be created from QML")); + qmlRegisterUncreatableType(uri, 4, 0, "LoginRequest", QStringLiteral("Q_GADGETS cannot be created from QML")); + qmlRegisterUncreatableType(uri, 4, 0, "UserInfo", QStringLiteral("Q_GADGETS cannot be created from QML")); + + qmlRegisterType(uri, 4, 0, "DataStore"); + qmlRegisterType(uri, 4, 0, "DataStoreModel"); + qmlRegisterType(uri, 4, 0, "SyncManager"); + qmlRegisterType(uri, 4, 0, "AccountManager"); + qmlRegisterType(uri, 4, 0, "UserExchangeManager"); + + // Check to make shure no module update is forgotten + static_assert(VERSION_MAJOR == 4 && VERSION_MINOR == 0, "QML module version needs to be updated"); + +} diff --git a/src/imports/qmldatasync/qmldatasync_plugin.h b/src/imports/datasync/qtdatasync_plugin.h similarity index 75% rename from src/imports/qmldatasync/qmldatasync_plugin.h rename to src/imports/datasync/qtdatasync_plugin.h index c9f2b50..8e59e1e 100644 --- a/src/imports/qmldatasync/qmldatasync_plugin.h +++ b/src/imports/datasync/qtdatasync_plugin.h @@ -1,5 +1,5 @@ -#ifndef QMLDATASYNC_PLUGIN_H -#define QMLDATASYNC_PLUGIN_H +#ifndef QTDATASYNC_PLUGIN_H +#define QTDATASYNC_PLUGIN_H #include @@ -13,4 +13,4 @@ class QtDataSyncDeclarativeModule : public QQmlExtensionPlugin void registerTypes(const char *uri) override; }; -#endif // QMLDATASYNC_PLUGIN_H +#endif // QTDATASYNC_PLUGIN_H diff --git a/src/imports/imports.pro b/src/imports/imports.pro index c6c6ab5..477ade7 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -1,9 +1,9 @@ TEMPLATE = subdirs SUBDIRS += \ - qmldatasync + datasync -qmldatasync.CONFIG += no_lrelease_target +datasync.CONFIG += no_lrelease_target prepareRecursiveTarget(lrelease) QMAKE_EXTRA_TARGETS += lrelease diff --git a/src/imports/qmldatasync/qmldatasync_plugin.cpp b/src/imports/qmldatasync/qmldatasync_plugin.cpp deleted file mode 100644 index abac6fe..0000000 --- a/src/imports/qmldatasync/qmldatasync_plugin.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "qmldatasync_plugin.h" - -#include - -#include "qqmldatastore.h" -#include "qqmldatastoremodel.h" -#include "qqmlsyncmanager.h" -#include "qqmlaccountmanager.h" -#include "qqmluserexchangemanager.h" - -QtDataSyncDeclarativeModule::QtDataSyncDeclarativeModule(QObject *parent) : - QQmlExtensionPlugin(parent) -{} - -void QtDataSyncDeclarativeModule::registerTypes(const char *uri) -{ - Q_ASSERT(qstrcmp(uri, "de.skycoder42.QtDataSync") == 0); - - qmlRegisterUncreatableType(uri, 1, 0, "DeviceInfo", QStringLiteral("Q_GADGETS cannot be created from QML")); - qmlRegisterUncreatableType(uri, 1, 0, "LoginRequest", QStringLiteral("Q_GADGETS cannot be created from QML")); - qmlRegisterUncreatableType(uri, 1, 0, "UserInfo", QStringLiteral("Q_GADGETS cannot be created from QML")); - - qmlRegisterType(uri, 1, 0, "DataStore"); - qmlRegisterType(uri, 1, 0, "DataStoreModel"); - qmlRegisterType(uri, 1, 0, "SyncManager"); - qmlRegisterType(uri, 1, 0, "AccountManager"); - qmlRegisterType(uri, 1, 0, "UserExchangeManager"); -} diff --git a/tests/auto/datasync/IntegrationTest/tst_integration.cpp b/tests/auto/datasync/IntegrationTest/tst_integration.cpp index ffb6523..4b2b6b8 100644 --- a/tests/auto/datasync/IntegrationTest/tst_integration.cpp +++ b/tests/auto/datasync/IntegrationTest/tst_integration.cpp @@ -39,6 +39,10 @@ private Q_SLOTS: void IntegrationTest::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif //QLoggingCategory::setFilterRules(QStringLiteral("qtdatasync.*.debug=true")); QByteArray confPath { SETUP_FILE }; @@ -315,7 +319,7 @@ void IntegrationTest::testLiveSync() //verify data changes QCOMPARE(dataSpy.size(), 20); QStringList keys; - foreach(auto sig, QList>(dataSpy)) + for(auto sig : QList>(dataSpy)) keys.append(sig[0].toString()); QCOMPAREUNORDERED(keys, TestLib::generateDataKeys(20, 39)); @@ -454,13 +458,13 @@ void IntegrationTest::testPassiveSync() //verify data changes on 1 QCOMPARE(data1Spy.size(), 20); QStringList keys; - foreach(auto sig, QList>(data1Spy)) + for(auto sig : QList>(data1Spy)) keys.append(sig[0].toString()); QCOMPAREUNORDERED(keys, TestLib::generateDataKeys(20, 39)); //and on 2 QCOMPARE(data2Spy.size(), 20); keys.clear(); - foreach(auto sig, QList>(data2Spy)) + for(auto sig : QList>(data2Spy)) keys.append(sig[0].toString()); QCOMPAREUNORDERED(keys, TestLib::generateDataKeys(20, 39)); diff --git a/tests/auto/datasync/TestAppServer/tst_appserver.cpp b/tests/auto/datasync/TestAppServer/tst_appserver.cpp index a53558d..a650807 100644 --- a/tests/auto/datasync/TestAppServer/tst_appserver.cpp +++ b/tests/auto/datasync/TestAppServer/tst_appserver.cpp @@ -118,6 +118,10 @@ private Q_SLOTS: void TestAppServer::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif QByteArray confPath { SETUP_FILE }; QVERIFY(QFile::exists(QString::fromUtf8(confPath))); qputenv("QDSAPP_CONFIG_FILE", confPath); @@ -1584,7 +1588,7 @@ void TestAppServer::testListAndRemoveDevices() //verify the keys, verify partner, remove others auto ok = false; - foreach (auto info, infos) { + for(auto info : infos) { QVERIFY(std::get<0>(info) != devId); if(std::get<0>(info) == partnerDevId) { QCOMPARE(std::get<1>(info), partnerName); diff --git a/tests/auto/datasync/TestChangeController/tst_changecontroller.cpp b/tests/auto/datasync/TestChangeController/tst_changecontroller.cpp index e07a73b..6005b04 100644 --- a/tests/auto/datasync/TestChangeController/tst_changecontroller.cpp +++ b/tests/auto/datasync/TestChangeController/tst_changecontroller.cpp @@ -38,6 +38,10 @@ private Q_SLOTS: void TestChangeController::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif try { TestLib::init(); Setup setup; diff --git a/tests/auto/datasync/TestCryptoController/tst_cryptocontroller.cpp b/tests/auto/datasync/TestCryptoController/tst_cryptocontroller.cpp index 2bef5b6..525457e 100644 --- a/tests/auto/datasync/TestCryptoController/tst_cryptocontroller.cpp +++ b/tests/auto/datasync/TestCryptoController/tst_cryptocontroller.cpp @@ -43,6 +43,10 @@ private Q_SLOTS: void TestCryptoController::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif QVERIFY(qputenv("PLUGIN_KEYSTORES_PATH", PLUGIN_DIR)); try { diff --git a/tests/auto/datasync/TestDataStore/tst_datastore.cpp b/tests/auto/datasync/TestDataStore/tst_datastore.cpp index 80b86bf..ed8ca10 100644 --- a/tests/auto/datasync/TestDataStore/tst_datastore.cpp +++ b/tests/auto/datasync/TestDataStore/tst_datastore.cpp @@ -34,6 +34,10 @@ private Q_SLOTS: void TestDataStore::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif try { TestLib::init(); Setup setup; diff --git a/tests/auto/datasync/TestDataTypeStore/tst_datatypestore.cpp b/tests/auto/datasync/TestDataTypeStore/tst_datatypestore.cpp index 0f951c3..c8ba2f7 100644 --- a/tests/auto/datasync/TestDataTypeStore/tst_datatypestore.cpp +++ b/tests/auto/datasync/TestDataTypeStore/tst_datatypestore.cpp @@ -27,6 +27,10 @@ private Q_SLOTS: void TestDataTypeStore::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif try { TestLib::init(); Setup setup; diff --git a/tests/auto/datasync/TestKeystorePlugins/tst_keystoreplugins.cpp b/tests/auto/datasync/TestKeystorePlugins/tst_keystoreplugins.cpp index 7c7d6fc..88ee892 100644 --- a/tests/auto/datasync/TestKeystorePlugins/tst_keystoreplugins.cpp +++ b/tests/auto/datasync/TestKeystorePlugins/tst_keystoreplugins.cpp @@ -20,6 +20,10 @@ private Q_SLOTS: void TestKeystorePlugins::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif try { TestLib::init(); Setup setup; diff --git a/tests/auto/datasync/TestLib/mockconnection.cpp b/tests/auto/datasync/TestLib/mockconnection.cpp index d0d1fc3..6a73585 100644 --- a/tests/auto/datasync/TestLib/mockconnection.cpp +++ b/tests/auto/datasync/TestLib/mockconnection.cpp @@ -21,7 +21,7 @@ MockConnection::MockConnection(QWebSocket *socket, QObject *parent) : QFAIL(qUtf8Printable(QString::number(error) + QStringLiteral(" - ") + _socket->errorString())); }); connect(_socket, &QWebSocket::sslErrors, this, [this](const QList &errors) { - foreach(auto error, errors) + for(auto error : errors) QFAIL(qUtf8Printable(error.errorString())); }); } diff --git a/tests/auto/datasync/TestLib/mockserver.cpp b/tests/auto/datasync/TestLib/mockserver.cpp index 52f3c1b..1c5fa57 100644 --- a/tests/auto/datasync/TestLib/mockserver.cpp +++ b/tests/auto/datasync/TestLib/mockserver.cpp @@ -24,7 +24,7 @@ MockServer::MockServer(QObject *parent) : QFAIL(qUtf8Printable(error.errorString())); }); connect(_server, &QWebSocketServer::sslErrors, this, [this](const QList &errors) { - foreach(auto error, errors) + for(auto error : errors) QFAIL(qUtf8Printable(error.errorString())); }); } diff --git a/tests/auto/datasync/TestLib/testlib.cpp b/tests/auto/datasync/TestLib/testlib.cpp index df4275a..4389ead 100644 --- a/tests/auto/datasync/TestLib/testlib.cpp +++ b/tests/auto/datasync/TestLib/testlib.cpp @@ -77,7 +77,7 @@ TestLib::DataSet TestLib::generateDataJson(int from, int to) QJsonArray TestLib::dataListJson(const TestLib::DataSet &data) { QJsonArray v; - foreach(auto d, data) + for(auto d : data) v.append(d); return v; } diff --git a/tests/auto/datasync/TestLib/testlib.h b/tests/auto/datasync/TestLib/testlib.h index 3217ec9..83be276 100644 --- a/tests/auto/datasync/TestLib/testlib.h +++ b/tests/auto/datasync/TestLib/testlib.h @@ -33,7 +33,7 @@ class TestLib namespace Tst { template -bool compareUnordered(QList actual, QList expected, QByteArray aName, QByteArray eName, const char *file, int line) { +bool compareUnordered(const QList &actual, QList expected, QByteArray aName, QByteArray eName, const char *file, int line) { if(actual.size() != expected.size()) { QTest::qFail(aName + " and " + eName + " differ in size (" + @@ -45,7 +45,7 @@ bool compareUnordered(QList actual, QList expected, QByteArray aName, QByt } auto i = 0; - foreach(auto a, actual) { + for(auto a : actual) { if(!expected.removeOne(a)) { QTest::qFail("Data of " + aName + " at index" + QByteArray::number(i) + diff --git a/tests/auto/datasync/TestLocalStore/tst_localstore.cpp b/tests/auto/datasync/TestLocalStore/tst_localstore.cpp index cfd9ff3..35b3e9c 100644 --- a/tests/auto/datasync/TestLocalStore/tst_localstore.cpp +++ b/tests/auto/datasync/TestLocalStore/tst_localstore.cpp @@ -46,6 +46,10 @@ private Q_SLOTS: void TestLocalStore::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif try { TestLib::init(); Setup setup; @@ -636,7 +640,7 @@ void TestLocalStore::testAsync() })); } - foreach(auto f, futures) + for(auto f : futures) f.waitForFinished(); } catch(QException &e) { QFAIL(e.what()); diff --git a/tests/auto/datasync/TestMessages/tst_messages.cpp b/tests/auto/datasync/TestMessages/tst_messages.cpp index f03da91..80cfde5 100644 --- a/tests/auto/datasync/TestMessages/tst_messages.cpp +++ b/tests/auto/datasync/TestMessages/tst_messages.cpp @@ -51,6 +51,10 @@ private Q_SLOTS: void TestMessages::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif QMetaType::registerComparators(); QMetaType::registerComparators(); QMetaType::registerComparators>(); diff --git a/tests/auto/datasync/TestMigrationHelper/tst_migrationhelper.cpp b/tests/auto/datasync/TestMigrationHelper/tst_migrationhelper.cpp index e1cc25d..2e5a39d 100644 --- a/tests/auto/datasync/TestMigrationHelper/tst_migrationhelper.cpp +++ b/tests/auto/datasync/TestMigrationHelper/tst_migrationhelper.cpp @@ -29,6 +29,10 @@ private Q_SLOTS: void TestMigrationHelper::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif try { //QLoggingCategory::setFilterRules(QStringLiteral("qtdatasync.default.migration.debug=true")); TestLib::init(); diff --git a/tests/auto/datasync/TestRemoteConnector/tst_remoteconnector.cpp b/tests/auto/datasync/TestRemoteConnector/tst_remoteconnector.cpp index 55a27df..dafe478 100644 --- a/tests/auto/datasync/TestRemoteConnector/tst_remoteconnector.cpp +++ b/tests/auto/datasync/TestRemoteConnector/tst_remoteconnector.cpp @@ -97,6 +97,10 @@ private Q_SLOTS: void TestRemoteConnector::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif //QLoggingCategory::setFilterRules(QStringLiteral("qtdatasync.*.debug=true")); qRegisterMetaType("RemoteEvent"); diff --git a/tests/auto/datasync/TestRoThreadedBackend/tst_rothreadedbackend.cpp b/tests/auto/datasync/TestRoThreadedBackend/tst_rothreadedbackend.cpp index 7283f5b..3a5362f 100644 --- a/tests/auto/datasync/TestRoThreadedBackend/tst_rothreadedbackend.cpp +++ b/tests/auto/datasync/TestRoThreadedBackend/tst_rothreadedbackend.cpp @@ -26,11 +26,20 @@ class TestRoThreadedBackend : public QObject Q_OBJECT private Q_SLOTS: - void testExchangeDevice(); + void initTestCase(); + void testExchangeDevice(); void testRemoteObjects(); }; +void TestRoThreadedBackend::initTestCase() +{ +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif +} + void TestRoThreadedBackend::testExchangeDevice() { ExchangeBuffer p1; diff --git a/tests/auto/datasync/TestSyncController/tst_synccontroller.cpp b/tests/auto/datasync/TestSyncController/tst_synccontroller.cpp index 12b55fe..9481ee3 100644 --- a/tests/auto/datasync/TestSyncController/tst_synccontroller.cpp +++ b/tests/auto/datasync/TestSyncController/tst_synccontroller.cpp @@ -34,6 +34,10 @@ private Q_SLOTS: void TestSyncController::initTestCase() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif try { TestLib::init(); Setup setup; diff --git a/tests/auto/qml/TestQmlDataSync/tst_qmldatasync.cpp b/tests/auto/qml/TestQmlDataSync/tst_qmldatasync.cpp index 0b2a051..cc7cfa1 100644 --- a/tests/auto/qml/TestQmlDataSync/tst_qmldatasync.cpp +++ b/tests/auto/qml/TestQmlDataSync/tst_qmldatasync.cpp @@ -8,6 +8,10 @@ static QTemporaryDir tDir; static void initImportPath() { +#ifdef Q_OS_LINUX + if(!qgetenv("LD_PRELOAD").contains("Qt5DataSync")) + qWarning() << "No LD_PRELOAD set - this may fail on systems with multiple version of the modules"; +#endif qputenv("PLUGIN_KEYSTORES_PATH", KEYSTORE_PATH); qputenv("QML2_IMPORT_PATH", QML_PATH); diff --git a/tests/auto/qml/TestQmlDataSync/tst_qmldatasync.qml b/tests/auto/qml/TestQmlDataSync/tst_qmldatasync.qml index a1bdc34..b97ac36 100644 --- a/tests/auto/qml/TestQmlDataSync/tst_qmldatasync.qml +++ b/tests/auto/qml/TestQmlDataSync/tst_qmldatasync.qml @@ -1,5 +1,5 @@ import QtQuick 2.5 -import de.skycoder42.QtDataSync 1.0 +import de.skycoder42.QtDataSync 4.0 import QtTest 1.1 Item { diff --git a/tools/appserver/app.cpp b/tools/appserver/app.cpp index c549611..dce39e1 100644 --- a/tools/appserver/app.cpp +++ b/tools/appserver/app.cpp @@ -236,9 +236,9 @@ QString App::findConfig() const tmpPaths.removeDuplicates(); configNames.removeDuplicates(); - foreach(auto path, tmpPaths) { + for(auto path : tmpPaths) { QDir dir(path); - foreach(auto config, configNames) { + for(auto config : configNames) { if(dir.exists(config)) return dir.absoluteFilePath(config); } diff --git a/tools/appserver/client.cpp b/tools/appserver/client.cpp index be303c3..75bd6a1 100644 --- a/tools/appserver/client.cpp +++ b/tools/appserver/client.cpp @@ -276,7 +276,7 @@ void Client::error() void Client::sslErrors(const QList &errors) { - foreach(auto error, errors) { + for(auto error : errors) { qWarning() << "SSL error:" << error.errorString(); } @@ -524,7 +524,7 @@ void Client::onListDevices(const ListDevicesMessage &message) checkIdle(message); DevicesMessage devMessage; - foreach (auto device, _database->listDevices(_deviceId)) + for(auto device : _database->listDevices(_deviceId)) devMessage.devices.append(device); sendMessage(devMessage); @@ -617,7 +617,7 @@ void Client::onNewKey(const NewKeyMessage &message, QDataStream &stream) message.cmac, message.deviceKeys); if(ok) { - foreach(auto info, message.deviceKeys) + for(auto info : message.deviceKeys) emit forceDisconnect(get<0>(info)); sendMessage(NewKeyAckMessage{message}); } else @@ -631,7 +631,7 @@ void Client::triggerDownload(bool forceUpdate, bool skipNoChanges) auto cnt = _downLimit - _activeDownloads.size(); if(cnt >= _downThreshold) { auto changes = _database->loadNextChanges(_deviceId, cnt, _activeDownloads.size()); - foreach(auto change, changes) { + for(auto change : changes) { if(_cachedChanges == 0) { updateChange = true; _cachedChanges = _database->changeCount(_deviceId) - _activeDownloads.size(); diff --git a/tools/appserver/clientconnector.cpp b/tools/appserver/clientconnector.cpp index 7e332a3..7d7d799 100644 --- a/tools/appserver/clientconnector.cpp +++ b/tools/appserver/clientconnector.cpp @@ -159,7 +159,7 @@ void ClientConnector::serverError() void ClientConnector::sslErrors(const QList &errors) { - foreach(auto error, errors) { + for(auto error : errors) { qWarning() << "SSL error:" << error.errorString(); } diff --git a/tools/appserver/databasecontroller.cpp b/tools/appserver/databasecontroller.cpp index f744547..7f86881 100644 --- a/tools/appserver/databasecontroller.cpp +++ b/tools/appserver/databasecontroller.cpp @@ -597,7 +597,7 @@ bool DatabaseController::updateExchangeKey(const QUuid &deviceId, quint32 keyInd throw DatabaseException(db); auto userId = updateKeyCountQuery.value(0).toULongLong(); - foreach(auto device, deviceKeys) { + for(auto device : deviceKeys) { //check if the device belongs to the same user Query checkAllowedQuery(db); checkAllowedQuery.prepare(QStringLiteral("SELECT 1 FROM devices " @@ -766,7 +766,7 @@ void DatabaseController::initDatabase(quint64 quota, bool forceQuota) QSqlDriver::EventNotifications }; auto driver = db.driver(); - foreach(auto feature, features) { + for(auto feature : features) { if(!driver->hasFeature(feature)) throw DatabaseException(QSqlError(QStringLiteral("Driver does not support feature %1").arg(feature))); }