From d3632244d611435f48f5aeb653f9031ace9a3b20 Mon Sep 17 00:00:00 2001 From: Raquel Medina Date: Wed, 5 Jun 2019 12:37:33 +0200 Subject: network: add network model abstraction - AbstractNetworkModel : abstract class which provides common functionality and data to all network models. -ConnectionProfile : super class which aglomerates connection property information, independently of the technology type (e.g. wired or wifi). A network model contains a list of available connection profiles pertinent to the model. Bug-AGL: SPEC-2293 Signed-off-by: Raquel Medina Change-Id: Ic7b9d59802d13067e057948d1fb109852f35c2fd --- network/abstractnetworkmodel.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 network/abstractnetworkmodel.h (limited to 'network/abstractnetworkmodel.h') 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 +#include +#include +#include + +#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 m_networks; + QModelIndex indexOf(ConnectionProfile *network); +}; +#endif // ABSTRACT_NETWORK_MODEL_H -- cgit 1.2.3-korg