A viewmodel to show a dialog to exchange account data via the QtDataSync::UserExchangeManager. More...
#include <networkexchangeviewmodel.h>
Public Slots | |
void | exportTo (int sortedIndex) |
Start en export of user data to the device with the given index in the sorted model. More... | |
void | setPort (quint16 port) |
WRITE accessor for NetworkExchangeViewModel::port. | |
void | setDeviceName (QString deviceName) |
WRITE accessor for NetworkExchangeViewModel::deviceName. | |
void | setActive (bool active) |
WRITE accessor for NetworkExchangeViewModel::active. | |
Public Slots inherited from QtMvvm::ViewModel |
Signals | |
void | ready (QPrivateSignal) |
Is emitted as soon as all the user exchange manager has been initialized. | |
void | userExchangeManagerChanged (QtDataSync::UserExchangeManager *userExchangeManager, QPrivateSignal) |
NOTIFY accessor for NetworkExchangeViewModel::userExchangeManager. | |
void | portChanged (quint16 port, QPrivateSignal) |
NOTIFY accessor for NetworkExchangeViewModel::port. | |
void | deviceNameChanged (QString deviceName, QPrivateSignal) |
NOTIFY accessor for NetworkExchangeViewModel::deviceName. | |
void | activeChanged (bool active, QPrivateSignal) |
NOTIFY accessor for NetworkExchangeViewModel::active. | |
Signals inherited from QtMvvm::ViewModel | |
void | resultReady (const QVariant &result) |
Should be emitted when the viewmodels result is ready. More... | |
QTMVVM_REVISION_1 void | instanceInvoked (const QVariantHash ¶ms, QPrivateSignal) |
Is emitted on single instance viewmodels when they get shown again. More... | |
Public Member Functions | |
Q_INVOKABLE | NetworkExchangeViewModel (QObject *parent=nullptr) |
Invokable constructor. | |
QtDataSync::UserExchangeManager * | userExchangeManager () const |
READ accessor for NetworkExchangeViewModel::userExchangeManager. | |
quint16 | port () const |
READ accessor for NetworkExchangeViewModel::port. | |
QString | deviceName () const |
READ accessor for NetworkExchangeViewModel::deviceName. | |
bool | isActive () const |
READ accessor for NetworkExchangeViewModel::active. | |
Q_DECL_DEPRECATED bool | active () const |
ExchangeDevicesModel * | deviceModel () const |
READ accessor for NetworkExchangeViewModel::deviceModel. | |
QSortFilterProxyModel * | sortedModel () const |
READ accessor for NetworkExchangeViewModel::sortedModel. | |
Public Member Functions inherited from QtMvvm::ViewModel | |
ViewModel (QObject *parent=nullptr) | |
Default constructor with parent. | |
Public Member Functions inherited from QObject | |
virtual const QMetaObject * | metaObject () const const |
virtual void * | qt_metacast (const char *) |
virtual int | qt_metacall (QMetaObject::Call, int, void **) |
QObject (QObject *parent) | |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
QString | objectName () const const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
bool | signalsBlocked () const const |
bool | blockSignals (bool block) |
QThread * | thread () const const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
const QObjectList & | children () const const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
void | dumpObjectTree () const const |
void | dumpObjectInfo () const const |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const const |
QList< QByteArray > | dynamicPropertyNames () const const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
bool | inherits (const char *className) const const |
void | deleteLater () |
Static Public Member Functions | |
static QVariantHash | showParams (const QString &setup) |
Generates show parameter to show a network exchange viewmodel via ViewModel::show. More... | |
static QVariantHash | showParams (QtDataSync::AccountManager *accountManager) |
Generates show parameter to show a network exchange viewmodel via ViewModel::show. More... | |
Static Public Member Functions inherited from QObject | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
Static Public Attributes | |
static const QString | paramSetup |
The parameter for a setup name for the onInit() method. More... | |
static const QString | paramAccountManager |
The parameter for an QtDataSync::AccountManager for the onInit() method. More... | |
Protected Member Functions | |
void | onInit (const QVariantHash ¶ms) override |
Called by the presenter to initialize the viewmodel. More... | |
void | onResult (quint32 requestCode, const QVariant &result) override |
Called by the presenter when a result of a showed viewmodel is ready. More... | |
Protected Member Functions inherited from QtMvvm::ViewModel | |
template<typename TViewModel > | |
void | show (const QVariantHash ¶ms={}) const |
Show another viewmodel as a child of this one. More... | |
void | show (const char *viewModelName, const QVariantHash ¶ms={}) const |
Show another viewmodel as a child of this one. More... | |
void | show (const QMetaObject *viewMetaObject, const QVariantHash ¶ms={}) const |
Show another viewmodel as a child of this one. More... | |
template<typename TViewModel > | |
void | showForResult (quint32 requestCode, const QVariantHash ¶ms={}) const |
Show another viewmodel as a child of this one and expect its result. More... | |
void | showForResult (quint32 requestCode, const char *viewModelName, const QVariantHash ¶ms={}) const |
Show another viewmodel as a child of this one and expect its result. More... | |
void | showForResult (quint32 requestCode, const QMetaObject *viewMetaObject, const QVariantHash ¶ms={}) const |
Show another viewmodel as a child of this one and expect its result. More... | |
Protected Member Functions inherited from QObject | |
QObject * | sender () const const |
int | senderSignalIndex () const const |
int | receivers (const char *signal) const const |
bool | isSignalConnected (const QMetaMethod &signal) const const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
Properties | |
QtDataSync::UserExchangeManager | userExchangeManager |
The user exchange manager the viewmodel operates on. More... | |
quint16 | port |
The port to run the exchange on. More... | |
QString | deviceName |
The name of your current device. More... | |
bool | active |
Start or stop the network exchange. More... | |
ExchangeDevicesModel | deviceModel |
The devices model to be used to display found exchange devices. More... | |
QSortFilterProxyModel | sortedModel |
A sorted version of the devices model. More... | |
Properties inherited from QObject | |
objectName | |
A viewmodel to show a dialog to exchange account data via the QtDataSync::UserExchangeManager.
The viewmodel provides data to show a ui that allows you to exchange your user data with another device in the same local network.
Definition at line 18 of file networkexchangeviewmodel.h.
|
slot |
Start en export of user data to the device with the given index in the sorted model.
sortedIndex | The index in the sorted model of the device to export to |
|
overrideprotectedvirtual |
Called by the presenter to initialize the viewmodel.
params | The parameters to initialize the viewmodel with |
This method is called by the presenter right after creating the view and reparenting the viewmodel to the view. The parameters are the ones that have been passed to the show method called to show this viewmodel instance. Reimplement this method if you need to perform initializations after beeing assigned to a viewmodel or if you want to support a parametrized viewmodel.
Reimplemented from QtMvvm::ViewModel.
|
overrideprotectedvirtual |
Called by the presenter when a result of a showed viewmodel is ready.
requestCode | The request code of the show request for the viewmodel that triggered the result |
result | The result passed from the viewmodel |
When showing a child viewmodel via showForResult(), then the result of that show request is reported back via this function. The requestCode is the one that was passed to the showForResult() method, and the result what the viewmodel reported back. If the showed viewmodel emitted resultReady() before beeing destroyed, this value passed to that signal is whats reported as result. If the child viewmodel gets destroyed without ever emitting that signal, this method is still called, but with an invalid QVariant as result.
Reimplemented from QtMvvm::ViewModel.
|
static |
Generates show parameter to show a network exchange viewmodel via ViewModel::show.
setup | The name of the QtDataSync::Setup to create the viewmodel for |
It's a shortcut to generate parameters for the show methods to show an exchange viewmodel. Use them as:
|
static |
Generates show parameter to show a network exchange viewmodel via ViewModel::show.
accountManager | The account manager to create the exchange manager of |
It's a shortcut to generate parameters for the show methods to show an exchange viewmodel. Use them as:
|
static |
The parameter for an QtDataSync::AccountManager for the onInit() method.
Value: "accountManager"
Definition at line 40 of file networkexchangeviewmodel.h.
|
static |
The parameter for a setup name for the onInit() method.
Value: "setup"
Definition at line 38 of file networkexchangeviewmodel.h.
|
readwrite |
Start or stop the network exchange.
Default: false
Changing this property will trigger start and stop actions on the underlying manager, using the other information provided from this viewmodel.
Accessors | |
---|---|
READ | isActive() |
WRITE | setActive() |
NOTIFY | activeChanged() |
Definition at line 29 of file networkexchangeviewmodel.h.
|
read |
The devices model to be used to display found exchange devices.
Default: An exchange device model
An unsorted model with all the devices available for exchange. Automatically initialized and managed by the viewmodel.
Accessors | |
---|---|
READ | deviceModel() |
CONSTANT |
Definition at line 32 of file networkexchangeviewmodel.h.
|
readwrite |
The name of your current device.
Default: QtDataSync::AccountManager::deviceName
This property is simply a forwarding of the QtDataSync::AccountManager::deviceName property.
Accessors | |
---|---|
READ | deviceName() |
WRITE | setDeviceName() |
NOTIFY | deviceNameChanged() |
Definition at line 27 of file networkexchangeviewmodel.h.
|
readwrite |
The port to run the exchange on.
Default: QtDataSync::UserExchangeManager::DataExchangePort
This port is passed to the exchange manager when activated to set the port.
Accessors | |
---|---|
READ | port() |
WRITE | setPort() |
NOTIFY | portChanged() |
Definition at line 25 of file networkexchangeviewmodel.h.
|
read |
A sorted version of the devices model.
Default: The deviceModel, sorted
A sorted proxy to the NetworkExchangeViewModel::deviceModel. You should prefer this sorted version when binding views to the viewmodel.
Accessors | |
---|---|
READ | sortedModel() |
CONSTANT |
Definition at line 34 of file networkexchangeviewmodel.h.
|
read |
The user exchange manager the viewmodel operates on.
Default: nullptr
(Is initialized by onInit())
A reference to the user exchange manager the view model internally uses. Is owned by the viewmodel, but can be used to get properties for the ui.
Accessors | |
---|---|
READ | userExchangeManager() |
NOTIFY | userExchangeManagerChanged() |
Definition at line 23 of file networkexchangeviewmodel.h.