From 4d70f3ee2dd59ee78064486050a3c779a1947aa1 Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Wed, 1 Aug 2018 19:09:34 +0200 Subject: [PATCH] add more param fns --- src/mvvmcore/settingsviewmodel.cpp | 8 +++++++ src/mvvmcore/settingsviewmodel.h | 1 + .../datasyncsettingsviewmodel.cpp | 24 +++++++++++++++++++ .../datasyncsettingsviewmodel.h | 7 ++++++ 4 files changed, 40 insertions(+) diff --git a/src/mvvmcore/settingsviewmodel.cpp b/src/mvvmcore/settingsviewmodel.cpp index 058fba4..dfa10b9 100644 --- a/src/mvvmcore/settingsviewmodel.cpp +++ b/src/mvvmcore/settingsviewmodel.cpp @@ -22,6 +22,14 @@ ISettingsAccessor *SettingsViewModel::accessor() const SettingsViewModel::~SettingsViewModel() = default; +QVariantHash SettingsViewModel::showParams(ISettingsAccessor *accessor, const QString &setupFile) +{ + return { + {paramAccessor, QVariant::fromValue(accessor)}, + {paramSetupFile, setupFile} + }; +} + QVariantHash SettingsViewModel::showParams(QSettings *settings, const QString &setupFile) { return { diff --git a/src/mvvmcore/settingsviewmodel.h b/src/mvvmcore/settingsviewmodel.h index d4840f3..7172c4d 100644 --- a/src/mvvmcore/settingsviewmodel.h +++ b/src/mvvmcore/settingsviewmodel.h @@ -38,6 +38,7 @@ public: static const QString paramSetupFile; //! Generates show parameter to show a settings viewmodel via ViewModel::show + static QVariantHash showParams(ISettingsAccessor *accessor, const QString &setupFile = {}); static QVariantHash showParams(QSettings *settings, const QString &setupFile = {}); //! Invokable constructor diff --git a/src/mvvmdatasynccore/datasyncsettingsviewmodel.cpp b/src/mvvmdatasynccore/datasyncsettingsviewmodel.cpp index 21e97c0..3adddb0 100644 --- a/src/mvvmdatasynccore/datasyncsettingsviewmodel.cpp +++ b/src/mvvmdatasynccore/datasyncsettingsviewmodel.cpp @@ -13,6 +13,30 @@ const QString DataSyncSettingsViewModel::paramSetup(QStringLiteral("setup")); const QString DataSyncSettingsViewModel::paramDataStore(QStringLiteral("dataStore")); const QString DataSyncSettingsViewModel::paramDataTypeStore(QStringLiteral("dataTypeStore")); +QVariantHash DataSyncSettingsViewModel::showParams(const QString &setup, const QString &setupFile) +{ + return { + {paramSetup, setup}, + {paramSetupFile, setupFile} + }; +} + +QVariantHash DataSyncSettingsViewModel::showParams(QtDataSync::DataStore *dataStore, const QString &setupFile) +{ + return { + {paramDataStore, QVariant::fromValue(dataStore)}, + {paramSetupFile, setupFile} + }; +} + +QVariantHash DataSyncSettingsViewModel::showParams(QtDataSync::DataTypeStore *dataStore, const QString &setupFile) +{ + return { + {paramDataTypeStore, QVariant::fromValue(dataStore)}, + {paramSetupFile, setupFile} + }; +} + DataSyncSettingsViewModel::DataSyncSettingsViewModel(QObject *parent) : SettingsViewModel{parent} {} diff --git a/src/mvvmdatasynccore/datasyncsettingsviewmodel.h b/src/mvvmdatasynccore/datasyncsettingsviewmodel.h index c334fd6..ff042a3 100644 --- a/src/mvvmdatasynccore/datasyncsettingsviewmodel.h +++ b/src/mvvmdatasynccore/datasyncsettingsviewmodel.h @@ -3,10 +3,13 @@ #include #include +#include +#include #include #include "QtMvvmDataSyncCore/qtmvvmdatasynccore_global.h" +#include "QtMvvmDataSyncCore/datasyncsettingsentry.h" namespace QtMvvm { @@ -19,6 +22,10 @@ public: static const QString paramDataStore; static const QString paramDataTypeStore; + static QVariantHash showParams(const QString &setup, const QString &setupFile = {}); + static QVariantHash showParams(QtDataSync::DataStore *dataStore, const QString &setupFile = {}); + static QVariantHash showParams(QtDataSync::DataTypeStore *dataStore, const QString &setupFile = {}); + Q_INVOKABLE explicit DataSyncSettingsViewModel(QObject *parent = nullptr); protected: