#ifndef QTMVVM_ACCOUNTMODEL_H #define QTMVVM_ACCOUNTMODEL_H #include #include #include #include #include "QtMvvmDataSyncCore/qtmvvmdatasynccore_global.h" namespace QtMvvm { class AccountModelPrivate; class Q_MVVMDATASYNCCORE_EXPORT AccountModel : public QAbstractListModel { Q_OBJECT public: enum Roles { NameRole = Qt::DisplayRole, FingerPrintRole = Qt::UserRole + 1 }; Q_ENUM(Roles) explicit AccountModel(QObject *parent = nullptr); ~AccountModel(); Q_INVOKABLE void setup(QtDataSync::AccountManager *accountManager, QtDataSync::SyncManager *syncManager); QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; Q_INVOKABLE bool removeDevice(const QModelIndex &index); Q_INVOKABLE inline bool removeDevice(int row) { return removeDevice(index(row)); } public Q_SLOTS: void reload(); private Q_SLOTS: void accountDevices(const QList &devices); void update(QtDataSync::SyncManager::SyncState state); private: QScopedPointer d; }; } #endif // QTMVVM_ACCOUNTMODEL_H