summaryrefslogtreecommitdiffstats
path: root/network/abstractnetworkmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'network/abstractnetworkmodel.h')
-rw-r--r--network/abstractnetworkmodel.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/network/abstractnetworkmodel.h b/network/abstractnetworkmodel.h
new file mode 100644
index 0000000..1b0db43
--- /dev/null
+++ b/network/abstractnetworkmodel.h
@@ -0,0 +1,32 @@
+#ifndef ABSTRACT_NETWORK_MODEL_H
+#define ABSTRACT_NETWORK_MODEL_H
+
+#include <QAbstractListModel>
+#include <QStringList>
+#include <QtQml/QQmlContext>
+#include <QJsonObject>
+
+#include "connectionprofile.h"
+
+class AbstractNetworkModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+ public:
+ AbstractNetworkModel(QObject *parent = Q_NULLPTR);
+ virtual QString getType() const = 0;
+
+ void addNetwork(ConnectionProfile *network);
+ void removeNetwork(ConnectionProfile *network);
+ void removeAllNetworks();
+ ConnectionProfile *getNetwork(QString service);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0;
+ virtual void updateProperties(QString service, QJsonObject properties) =0;
+
+ protected:
+ QList<ConnectionProfile *> m_networks;
+ QModelIndex indexOf(ConnectionProfile *network);
+};
+#endif // ABSTRACT_NETWORK_MODEL_H