Browse Source

add more param fns

pull/2/head
Skycoder42 6 years ago
parent
commit
4d70f3ee2d
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 8
      src/mvvmcore/settingsviewmodel.cpp
  2. 1
      src/mvvmcore/settingsviewmodel.h
  3. 24
      src/mvvmdatasynccore/datasyncsettingsviewmodel.cpp
  4. 7
      src/mvvmdatasynccore/datasyncsettingsviewmodel.h

8
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 {

1
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

24
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<DataSyncSettingsEntry> *dataStore, const QString &setupFile)
{
return {
{paramDataTypeStore, QVariant::fromValue<QtDataSync::DataTypeStoreBase*>(dataStore)},
{paramSetupFile, setupFile}
};
}
DataSyncSettingsViewModel::DataSyncSettingsViewModel(QObject *parent) :
SettingsViewModel{parent}
{}

7
src/mvvmdatasynccore/datasyncsettingsviewmodel.h

@ -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:

Loading…
Cancel
Save