Skycoder42
6 years ago
No known key found for this signature in database
GPG Key ID: 8E01AD9EF0578D2B
4 changed files with
40 additions and
0 deletions
-
src/mvvmcore/settingsviewmodel.cpp
-
src/mvvmcore/settingsviewmodel.h
-
src/mvvmdatasynccore/datasyncsettingsviewmodel.cpp
-
src/mvvmdatasynccore/datasyncsettingsviewmodel.h
|
|
@ -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 { |
|
|
|
|
|
@ -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
|
|
|
|
|
|
@ -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<DataSyncSettingsEntry> *dataStore, const QString &setupFile) |
|
|
|
{ |
|
|
|
return { |
|
|
|
{paramDataTypeStore, QVariant::fromValue<QtDataSync::DataTypeStoreBase*>(dataStore)}, |
|
|
|
{paramSetupFile, setupFile} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
DataSyncSettingsViewModel::DataSyncSettingsViewModel(QObject *parent) : |
|
|
|
SettingsViewModel{parent} |
|
|
|
{} |
|
|
|
|
|
@ -3,10 +3,13 @@ |
|
|
|
|
|
|
|
#include <QtCore/qobject.h> |
|
|
|
#include <QtCore/qscopedpointer.h> |
|
|
|
#include <QtDataSync/DataStore> |
|
|
|
#include <QtDataSync/DataTypeStore> |
|
|
|
|
|
|
|
#include <QtMvvmCore/settingsviewmodel.h> |
|
|
|
|
|
|
|
#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<DataSyncSettingsEntry> *dataStore, const QString &setupFile = {}); |
|
|
|
|
|
|
|
Q_INVOKABLE explicit DataSyncSettingsViewModel(QObject *parent = nullptr); |
|
|
|
|
|
|
|
protected: |
|
|
|