diff options
author | Kevin Funk <kevin.funk.ford@kdab.com> | 2017-09-20 17:04:20 +0200 |
---|---|---|
committer | Brett Stottlemyer <bstottle@ford.com> | 2017-09-22 11:10:22 +0000 |
commit | 08fe8d56e4e3507b274a2332435faab4294f1676 (patch) | |
tree | 4ad6dd188ed7bec2ab5c43ec7cee2fefd37d9cdb /tests/auto/integration/tst_integration.cpp | |
parent | 092da44ffde5ad73a60b15782cf217bff5dc632d (diff) |
Turn PersistedStore into a QObject
The idea is to make this class usable from within QML.
One idea how this could be used inside QML:
Node {
registryUrl: "local:myUrl"
persistedStore: DiskStore { root: "/fs/rwdata/" }
// or: InMemoryStore {}
// or: SqlStore { database: "myDB" }
// or: ...
}
Note: This patch breaks source and binary compatibility due to the
following changes:
- enum StorageOwnership
- void setPersistedStore(QRemoteObjectPersistedStore *store, StorageOwnership ownership=DoNotPassOwnership);
+ void setPersistedStore(QRemoteObjectPersistedStore *store);
Change-Id: Ib6668fec9d688ecee81be66f53dedc35597baae9
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Diffstat (limited to 'tests/auto/integration/tst_integration.cpp')
-rw-r--r-- | tests/auto/integration/tst_integration.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/auto/integration/tst_integration.cpp b/tests/auto/integration/tst_integration.cpp index f5c7b99..f12a259 100644 --- a/tests/auto/integration/tst_integration.cpp +++ b/tests/auto/integration/tst_integration.cpp @@ -92,10 +92,12 @@ private: int m_value; }; -class Persist : public QRemoteObjectPersistedStore +class TestPersistedStore : public QRemoteObjectPersistedStore { + Q_OBJECT + public: - Persist() : type(EngineReplica::HYBRID) {} + TestPersistedStore() : type(EngineReplica::HYBRID) {} void saveProperties(const QString &, const QByteArray &, const QVariantList &values) override { type = values.at(0).value<EngineReplica::EngineType>(); @@ -104,6 +106,7 @@ public: { return QVariantList() << QVariant::fromValue(type); } +private: EngineReplica::EngineType type; }; @@ -150,7 +153,8 @@ private slots: QRemoteObjectNode client; client.connectToNode(hostUrl); Q_SET_OBJECT_NAME(client); - client.setPersistedStore(new Persist, QRemoteObjectNode::PassOwnershipToNode); + TestPersistedStore store; + client.setPersistedStore(&store); const QScopedPointer<EngineReplica> engine_r(client.acquire<EngineReplica>()); QCOMPARE(engine_r->engineType(), EngineReplica::HYBRID); @@ -158,7 +162,7 @@ private slots: void persistTest() { - Persist persist; + TestPersistedStore store; QRemoteObjectHost host(hostUrl); SET_NODE_NAME(host); @@ -169,7 +173,7 @@ private slots: QRemoteObjectNode client; client.connectToNode(hostUrl); Q_SET_OBJECT_NAME(client); - client.setPersistedStore(&persist); + client.setPersistedStore(&store); QScopedPointer<EngineReplica> engine_r(client.acquire<EngineReplica>()); engine_r->waitForSource(); |