QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
remoteconfig.h
1 #ifndef QTDATASYNC_REMOTECONFIG_H
2 #define QTDATASYNC_REMOTECONFIG_H
3 
4 #include <QtCore/qobject.h>
5 #include <QtCore/qurl.h>
6 #include <QtCore/qhash.h>
7 #include <QtCore/qshareddata.h>
8 #include <QtCore/qvariant.h>
9 
10 #include "QtDataSync/qtdatasync_global.h"
11 
12 namespace QtDataSync {
13 
14 class RemoteConfigPrivate;
16 class Q_DATASYNC_EXPORT RemoteConfig
17 {
18  Q_GADGET
19 
21  Q_PROPERTY(QUrl url READ url WRITE setUrl)
23  Q_PROPERTY(QString accessKey READ accessKey WRITE setAccessKey)
25  Q_PROPERTY(QtDataSync::RemoteConfig::HeaderHash headers READ headers WRITE setHeaders STORED false)
27  Q_PROPERTY(int keepaliveTimeout READ keepaliveTimeout WRITE setKeepaliveTimeout)
28 
30  Q_PROPERTY(QVariantMap storedHeaders READ storedHeaders WRITE setStoredHeaders REVISION 2)
31 
32 public:
35 
37  RemoteConfig(const QUrl &url = {},
38  const QString &accessKey = {},
39  const HeaderHash &headers = {},
40  int keepaliveTimeout = 1); //1 minute between ping messages (nginx timeout is 75 seconds be default)
42  RemoteConfig(const RemoteConfig &other);
44  RemoteConfig(RemoteConfig &&other) noexcept;
45  ~RemoteConfig();
46 
48  RemoteConfig &operator=(const RemoteConfig &other);
50  RemoteConfig &operator=(RemoteConfig &&other) noexcept;
51 
53  bool operator==(const RemoteConfig &other) const;
55  bool operator!=(const RemoteConfig &other) const;
56 
58  QUrl url() const;
60  QString accessKey() const;
62  HeaderHash headers() const;
64  int keepaliveTimeout() const;
65 
67  void setUrl(QUrl url);
69  void setAccessKey(QString accessKey);
71  void setHeaders(HeaderHash headers);
73  void setKeepaliveTimeout(int keepaliveTimeout);
74 
75 private:
77 
78  QVariantMap storedHeaders() const;
79  void setStoredHeaders(const QVariantMap &map);
80 
81  friend Q_DATASYNC_EXPORT QDataStream &operator<<(QDataStream &stream, const RemoteConfig &deviceInfo);
82  friend Q_DATASYNC_EXPORT QDataStream &operator>>(QDataStream &stream, RemoteConfig &deviceInfo);
83 };
84 
86 Q_DATASYNC_EXPORT QDataStream &operator<<(QDataStream &stream, const RemoteConfig &deviceInfo);
88 Q_DATASYNC_EXPORT QDataStream &operator>>(QDataStream &stream, RemoteConfig &deviceInfo);
89 
90 }
91 
92 Q_DECLARE_METATYPE(QtDataSync::RemoteConfig)
93 Q_DECLARE_TYPEINFO(QtDataSync::RemoteConfig, Q_MOVABLE_TYPE);
94 
95 
96 #endif // QTDATASYNC_REMOTECONFIG_H
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
Q_DATASYNC_EXPORT QDataStream & operator<<(QDataStream &stream, const DeviceInfo &deviceInfo)
Stream operator to stream into a QDataStream.
The primary namespace of the QtDataSync library.
Q_DATASYNC_EXPORT QDataStream & operator>>(QDataStream &stream, DeviceInfo &deviceInfo)
Stream operator to stream out of a QDataStream.
A configuration on how to connect to a remote server.
Definition: remoteconfig.h:16
bool operator!=(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
QHash< QByteArray, QByteArray > HeaderHash