Skycoder42
7 years ago
10 changed files with 269 additions and 62 deletions
@ -1,5 +1,9 @@ |
|||
TEMPLATE = subdirs |
|||
|
|||
SUBDIRS += \ |
|||
mvvmquick \ |
|||
mvvmcore |
|||
mvvmquick \ |
|||
mvvmcore |
|||
|
|||
qtHaveModule(datasync) { |
|||
SUBDIRS += mvvmdatasynccore |
|||
} |
|||
|
@ -0,0 +1,34 @@ |
|||
QT += core qml quick mvvmdatasynccore |
|||
CXX_MODULE = mvvmdatasynccore |
|||
TARGETPATH = de/skycoder42/QtMvvm/DataSync/Core |
|||
TARGET = declarative_mvvmdatasynccore |
|||
IMPORT_VERSION = $$MODULE_VERSION_IMPORT |
|||
DEFINES += "VERSION_MAJOR=$$MODULE_VERSION_MAJOR" |
|||
DEFINES += "VERSION_MINOR=$$MODULE_VERSION_MINOR" |
|||
|
|||
HEADERS += \ |
|||
qtmvvmdatasynccore_plugin.h |
|||
|
|||
SOURCES += \ |
|||
qtmvvmdatasynccore_plugin.cpp |
|||
|
|||
OTHER_FILES += qmldir |
|||
|
|||
generate_qmltypes { |
|||
typeextra1.target = qmltypes |
|||
typeextra1.depends += export LD_LIBRARY_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/lib/:$(LD_LIBRARY_PATH)" |
|||
typeextra2.target = qmltypes |
|||
typeextra2.depends += export QML2_IMPORT_PATH := "$$shadowed($$dirname(_QMAKE_CONF_))/qml/" |
|||
QMAKE_EXTRA_TARGETS += typeextra1 typeextra2 |
|||
} |
|||
|
|||
CONFIG += qmlcache |
|||
load(qml_plugin) |
|||
|
|||
generate_qmltypes { |
|||
qmltypes.depends = ../../../qml/$$TARGETPATH/$(TARGET) #overwrite the target deps |
|||
|
|||
mfirst.target = all |
|||
mfirst.depends += qmltypes |
|||
QMAKE_EXTRA_TARGETS += mfirst |
|||
} |
@ -0,0 +1,164 @@ |
|||
import QtQuick.tooling 1.2 |
|||
|
|||
// This file describes the plugin-supplied types contained in the library. |
|||
// It is used for QML tooling purposes only. |
|||
// |
|||
// This file was auto-generated by: |
|||
// 'qmlplugindump -nonrelocatable de.skycoder42.QtMvvm.DataSync.Core 1.0' |
|||
|
|||
Module { |
|||
dependencies: [ |
|||
"QtQml 2.2", |
|||
"QtQml.Models 2.3", |
|||
"de.skycoder42.QtMvvm.Core 1.0" |
|||
] |
|||
Component { |
|||
name: "QtMvvm::AccountModel" |
|||
prototype: "QAbstractListModel" |
|||
exports: ["de.skycoder42.QtMvvm.DataSync.Core/AccountModel 1.0"] |
|||
exportMetaObjectRevisions: [0] |
|||
Enum { |
|||
name: "Roles" |
|||
values: { |
|||
"NameRole": 0, |
|||
"FingerPrintRole": 257 |
|||
} |
|||
} |
|||
Method { name: "reload" } |
|||
Method { |
|||
name: "setup" |
|||
Parameter { name: "accountManager"; type: "QtDataSync::AccountManager"; isPointer: true } |
|||
Parameter { name: "syncManager"; type: "QtDataSync::SyncManager"; isPointer: true } |
|||
} |
|||
Method { |
|||
name: "removeDevice" |
|||
type: "bool" |
|||
Parameter { name: "index"; type: "QModelIndex" } |
|||
} |
|||
Method { |
|||
name: "removeDevice" |
|||
type: "bool" |
|||
Parameter { name: "row"; type: "int" } |
|||
} |
|||
} |
|||
Component { |
|||
name: "QtMvvm::DataSyncViewModel" |
|||
prototype: "QtMvvm::ViewModel" |
|||
exports: ["de.skycoder42.QtMvvm.DataSync.Core/DataSyncViewModel 1.0"] |
|||
isCreatable: false |
|||
exportMetaObjectRevisions: [0] |
|||
Property { |
|||
name: "syncManager" |
|||
type: "QtDataSync::SyncManager" |
|||
isReadonly: true |
|||
isPointer: true |
|||
} |
|||
Property { |
|||
name: "accountManager" |
|||
type: "QtDataSync::AccountManager" |
|||
isReadonly: true |
|||
isPointer: true |
|||
} |
|||
Property { name: "colorMap"; type: "ColorMap" } |
|||
Property { name: "statusString"; type: "string"; isReadonly: true } |
|||
Property { name: "accountModel"; type: "QtMvvm::AccountModel"; isReadonly: true; isPointer: true } |
|||
Signal { |
|||
name: "syncManagerChanged" |
|||
Parameter { name: "syncManager"; type: "QtDataSync::SyncManager"; isPointer: true } |
|||
} |
|||
Signal { |
|||
name: "accountManagerChanged" |
|||
Parameter { name: "accountManager"; type: "QtDataSync::AccountManager"; isPointer: true } |
|||
} |
|||
Signal { |
|||
name: "colorMapChanged" |
|||
Parameter { name: "colorMap"; type: "ColorMap" } |
|||
} |
|||
Signal { name: "ready" } |
|||
Method { name: "syncOrConnect" } |
|||
Method { name: "showDeviceInfo" } |
|||
Method { name: "startExport" } |
|||
Method { name: "startImport" } |
|||
Method { name: "performReset" } |
|||
Method { name: "changeRemote" } |
|||
Method { name: "startNetworkExchange" } |
|||
Method { |
|||
name: "setColorMap" |
|||
Parameter { name: "colorMap"; type: "ColorMap" } |
|||
} |
|||
Method { name: "resetColorMap" } |
|||
Method { |
|||
name: "formatFingerPrint" |
|||
type: "string" |
|||
Parameter { name: "fingerPrint"; type: "QByteArray" } |
|||
} |
|||
} |
|||
Component { |
|||
name: "QtMvvm::ExchangeDevicesModel" |
|||
prototype: "QAbstractListModel" |
|||
exports: [ |
|||
"de.skycoder42.QtMvvm.DataSync.Core/ExchangeDevicesModel 1.0" |
|||
] |
|||
exportMetaObjectRevisions: [0] |
|||
Enum { |
|||
name: "Roles" |
|||
values: { |
|||
"NameRole": 0, |
|||
"HostRole": 257, |
|||
"PortRole": 258, |
|||
"AddressRole": 259 |
|||
} |
|||
} |
|||
Method { |
|||
name: "setup" |
|||
Parameter { name: "exchangeManager"; type: "QtDataSync::UserExchangeManager"; isPointer: true } |
|||
} |
|||
Method { |
|||
name: "infoAt" |
|||
type: "QtDataSync::UserInfo" |
|||
Parameter { name: "index"; type: "int" } |
|||
} |
|||
} |
|||
Component { |
|||
name: "QtMvvm::NetworkExchangeViewModel" |
|||
prototype: "QtMvvm::ViewModel" |
|||
exports: [ |
|||
"de.skycoder42.QtMvvm.DataSync.Core/NetworkExchangeViewModel 1.0" |
|||
] |
|||
isCreatable: false |
|||
exportMetaObjectRevisions: [0] |
|||
Property { name: "port"; type: "ushort" } |
|||
Property { name: "deviceName"; type: "string" } |
|||
Property { name: "active"; type: "bool" } |
|||
Property { name: "deviceModel"; type: "ExchangeDevicesModel"; isReadonly: true; isPointer: true } |
|||
Signal { name: "ready" } |
|||
Signal { |
|||
name: "portChanged" |
|||
Parameter { name: "port"; type: "ushort" } |
|||
} |
|||
Signal { |
|||
name: "deviceNameChanged" |
|||
Parameter { name: "deviceName"; type: "string" } |
|||
} |
|||
Signal { |
|||
name: "activeChanged" |
|||
Parameter { name: "active"; type: "bool" } |
|||
} |
|||
Method { |
|||
name: "exportTo" |
|||
Parameter { name: "index"; type: "int" } |
|||
} |
|||
Method { |
|||
name: "setPort" |
|||
Parameter { name: "port"; type: "ushort" } |
|||
} |
|||
Method { |
|||
name: "setDeviceName" |
|||
Parameter { name: "deviceName"; type: "string" } |
|||
} |
|||
Method { |
|||
name: "setActive" |
|||
Parameter { name: "active"; type: "bool" } |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,6 @@ |
|||
module de.skycoder42.QtMvvm.DataSync.Core |
|||
plugin declarative_mvvmdatasynccore |
|||
classname QtMvvmDataSyncCoreDeclarativeModule |
|||
typeinfo plugins.qmltypes |
|||
depends QtQml.Models 2.3 |
|||
depends de.skycoder42.QtMvvm.Core 1.0 |
@ -0,0 +1,27 @@ |
|||
#include "qtmvvmdatasynccore_plugin.h" |
|||
|
|||
#include <QtQml> |
|||
|
|||
#include <QtMvvmDataSyncCore/AccountModel> |
|||
#include <QtMvvmDataSyncCore/ExchangeDevicesModel> |
|||
#include <QtMvvmDataSyncCore/DataSyncViewModel> |
|||
#include <QtMvvmDataSyncCore/NetworkExchangeViewModel> |
|||
|
|||
QtMvvmDataSyncCoreDeclarativeModule::QtMvvmDataSyncCoreDeclarativeModule(QObject *parent) : |
|||
QQmlExtensionPlugin(parent) |
|||
{} |
|||
|
|||
void QtMvvmDataSyncCoreDeclarativeModule::registerTypes(const char *uri) |
|||
{ |
|||
Q_ASSERT(qstrcmp(uri, "de.skycoder42.QtMvvm.DataSync.Core") == 0); |
|||
|
|||
//Version 1.0
|
|||
qmlRegisterType<QtMvvm::AccountModel>(uri, 1, 0, "AccountModel"); |
|||
qmlRegisterType<QtMvvm::ExchangeDevicesModel>(uri, 1, 0, "ExchangeDevicesModel"); |
|||
|
|||
qmlRegisterUncreatableType<QtMvvm::DataSyncViewModel>(uri, 1, 0, "DataSyncViewModel", QStringLiteral("ViewModels cannot be created from QML")); |
|||
qmlRegisterUncreatableType<QtMvvm::NetworkExchangeViewModel>(uri, 1, 0, "NetworkExchangeViewModel", QStringLiteral("ViewModels cannot be created from QML")); |
|||
|
|||
// Check to make shure no module update is forgotten
|
|||
static_assert(VERSION_MAJOR == 1 && VERSION_MINOR == 0, "QML module version needs to be updated"); |
|||
} |
@ -0,0 +1,16 @@ |
|||
#ifndef QTMVVMDATASYNCCORE_PLUGIN_H |
|||
#define QTMVVMDATASYNCCORE_PLUGIN_H |
|||
|
|||
#include <QtQml/QQmlExtensionPlugin> |
|||
|
|||
class QtMvvmDataSyncCoreDeclarativeModule : public QQmlExtensionPlugin |
|||
{ |
|||
Q_OBJECT |
|||
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) |
|||
|
|||
public: |
|||
QtMvvmDataSyncCoreDeclarativeModule(QObject *parent = nullptr); |
|||
void registerTypes(const char *uri) override; |
|||
}; |
|||
|
|||
#endif // QTMVVMDATASYNCCORE_PLUGIN_H
|
Loading…
Reference in new issue