Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit 1ebb572

Browse files
committed
small stuff
1 parent c15b365 commit 1ebb572

File tree

9 files changed

+45
-8
lines changed

9 files changed

+45
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ Makefile*
3737
# QtCtreator CMake
3838
CMakeLists.txt.user
3939

40+
*.json.user
41+
.qpmx-dev-cache
42+

.qmake.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
load(qt_build_config)
22

33
CONFIG += warning_clean exceptions c++14
4-
win32:cross_compile: CONFIG += winrt
54
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12
65

76
versionAtLeast(QT_VERSION, 5.11.0): CONFIG += sample_test_model

src/datasync/exception.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Exception::Exception(const Defaults &defaults, const QString &message) :
1212
Exception{defaults.setupName(), message}
1313
{}
1414

15-
Exception::Exception(const Exception * const other) :
15+
Exception::Exception(const Exception * const other) : //MAJOR use normal copy ctr instead
1616
QException{},
1717
_setupName{other->_setupName},
1818
_message{other->_message}

src/datasync/remoteconfig.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ void RemoteConfig::setKeepaliveTimeout(int keepaliveTimeout)
5757
d->keepaliveTimeout = keepaliveTimeout;
5858
}
5959

60+
QVariantMap RemoteConfig::storedHeaders() const
61+
{
62+
QVariantMap map;
63+
for(auto it = d->headers.constBegin(); it != d->headers.constEnd(); ++it)
64+
map.insert(QString::fromUtf8(it.key()), QString::fromUtf8(it.value()));
65+
return map;
66+
}
67+
68+
void RemoteConfig::setStoredHeaders(const QVariantMap &map)
69+
{
70+
d->headers.clear();
71+
for(auto it = map.constBegin(); it != map.constEnd(); ++it)
72+
d->headers.insert(it.key().toUtf8(), it.value().toString().toUtf8());
73+
}
74+
6075

6176

6277
QDataStream &QtDataSync::operator<<(QDataStream &stream, const RemoteConfig &deviceInfo)

src/datasync/remoteconfig.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <QtCore/qurl.h>
66
#include <QtCore/qhash.h>
77
#include <QtCore/qshareddata.h>
8+
#include <QtCore/qvariant.h>
89

910
#include "QtDataSync/qtdatasync_global.h"
1011

@@ -21,10 +22,12 @@ class Q_DATASYNC_EXPORT RemoteConfig
2122
//! A access secret needed in order to connect to the server
2223
Q_PROPERTY(QString accessKey READ accessKey WRITE setAccessKey)
2324
//! A collection of additional HTTP headers to be sent with the request
24-
Q_PROPERTY(HeaderHash headers READ headers WRITE setHeaders)
25+
Q_PROPERTY(QtDataSync::RemoteConfig::HeaderHash headers READ headers WRITE setHeaders STORED false)
2526
//! The keep alive timeout to be used to send pings to the server
2627
Q_PROPERTY(int keepaliveTimeout READ keepaliveTimeout WRITE setKeepaliveTimeout)
2728

29+
Q_PROPERTY(QVariantMap storedHeaders READ storedHeaders WRITE setStoredHeaders)
30+
2831
public:
2932
//! Typedef for a hash of additional HTTP headers
3033
using HeaderHash = QHash<QByteArray, QByteArray>;
@@ -66,6 +69,9 @@ class Q_DATASYNC_EXPORT RemoteConfig
6669
private:
6770
QSharedDataPointer<RemoteConfigPrivate> d;
6871

72+
QVariantMap storedHeaders() const;
73+
void setStoredHeaders(const QVariantMap &map);
74+
6975
friend Q_DATASYNC_EXPORT QDataStream &operator<<(QDataStream &stream, const RemoteConfig &deviceInfo);
7076
friend Q_DATASYNC_EXPORT QDataStream &operator>>(QDataStream &stream, RemoteConfig &deviceInfo);
7177
};

src/datasync/setup.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void Setup::setCleanupTimeout(unsigned long timeout)
2929
SetupPrivate::timeout = timeout;
3030
}
3131

32-
void Setup::removeSetup(const QString &name, bool waitForFinished)
32+
void Setup::removeSetup(const QString &name, bool waitForFinished) //TODO add awaitable version
3333
{
3434
QMutexLocker _(&SetupPrivate::setupMutex);
3535
if(!SetupPrivate::engines.contains(name))
@@ -106,6 +106,17 @@ Setup::Setup() :
106106
d{new SetupPrivate()}
107107
{}
108108

109+
Setup::Setup(Setup &&other) noexcept
110+
{
111+
swap(d, other.d);
112+
}
113+
114+
Setup &Setup::operator=(Setup &&other) noexcept
115+
{
116+
swap(d, other.d);
117+
return *this;
118+
}
119+
109120
Setup::~Setup() = default;
110121

111122
QString Setup::localDir() const

src/datasync/setup.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Q_DATASYNC_EXPORT Setup
6868
//! The serializer to be used to serialize and deserialize data to and from the store
6969
Q_PROPERTY(QJsonSerializer* serializer READ serializer WRITE setSerializer RESET resetSerializer)
7070
//! An optional conflict resolver to handle merge conflicts
71-
Q_PROPERTY(ConflictResolver* conflictResolver READ conflictResolver WRITE setConflictResolver RESET resetConflictResolver)
71+
Q_PROPERTY(QtDataSync::ConflictResolver* conflictResolver READ conflictResolver WRITE setConflictResolver RESET resetConflictResolver)
7272
//! An alternative handler for fatal errors
7373
Q_PROPERTY(FatalErrorHandler fatalErrorHandler READ fatalErrorHandler WRITE setFatalErrorHandler RESET resetFatalErrorHandler)
7474
//! The size of the internal database cache, in bytes
@@ -80,7 +80,7 @@ class Q_DATASYNC_EXPORT Setup
8080
//! The ssl configuration to be used to connect to the remote
8181
Q_PROPERTY(QSslConfiguration sslConfiguration READ sslConfiguration WRITE setSslConfiguration RESET resetSslConfiguration)
8282
//! The configuration to be used to connect to the remote
83-
Q_PROPERTY(RemoteConfig remoteConfiguration READ remoteConfiguration WRITE setRemoteConfiguration RESET resetRemoteConfiguration)
83+
Q_PROPERTY(QtDataSync::RemoteConfig remoteConfiguration READ remoteConfiguration WRITE setRemoteConfiguration RESET resetRemoteConfiguration)
8484
//! The name of the preferred keystore provider
8585
Q_PROPERTY(QString keyStoreProvider READ keyStoreProvider WRITE setKeyStoreProvider RESET resetKeyStoreProvider)
8686
//! The algorithmic scheme to be used for new signature keys
@@ -192,6 +192,8 @@ class Q_DATASYNC_EXPORT Setup
192192
static KeyStore *loadKeystore(const QString &provider, QObject *parent = nullptr, const QString &setupName = DefaultSetup);
193193

194194
Setup();
195+
Setup(Setup &&other) noexcept;
196+
Setup &operator=(Setup &&other) noexcept;
195197
~Setup();
196198

197199
//! @readAcFn{Setup::localDir}
@@ -401,4 +403,5 @@ Q_DECL_CONSTEXPR inline int GB(intmax_t value)
401403
}
402404

403405
}
406+
404407
#endif // QTDATASYNC_SETUP_H

src/plugins/keystores/keystores.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ TEMPLATE = subdirs
33
SUBDIRS += plain
44
qtHaveModule(KWallet): SUBDIRS += kwallet
55
unix:!android:!ios:system(pkg-config --exists libsecret-1): SUBDIRS += secretservice
6-
win32:!winrt: SUBDIRS += wincred
6+
win32:!cross_compile: SUBDIRS += wincred
77
mac|ios: SUBDIRS += keychain
88
android:qtHaveModule(androidextras): SUBDIRS += android
99

tools/tools.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TEMPLATE = subdirs
22

3-
!android:!ios:!winrt: SUBDIRS += appserver
3+
!cross_compile: SUBDIRS += appserver
44

55
prepareRecursiveTarget(lrelease)
66
QMAKE_EXTRA_TARGETS += lrelease run-tests

0 commit comments

Comments
 (0)