summaryrefslogtreecommitdiffstats
path: root/network/abstractnetworkmodel.h
blob: 349c109835d2d8ac75c16ba59a09fd5c92ee206c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef ABSTRACT_NETWORK_MODEL_H
#define ABSTRACT_NETWORK_MODEL_H

#include <QAbstractListModel>
#include <QStringList>
#include <QtQml/QQmlContext>

#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(const QString &service, const QVariantMap &properties) = 0;

protected:
        QList<ConnectionProfile *> m_networks;
        QModelIndex indexOf(ConnectionProfile *network);
};

#endif // ABSTRACT_NETWORK_MODEL_H