summaryrefslogtreecommitdiffstats
path: root/network/wifinetworkmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'network/wifinetworkmodel.h')
-rw-r--r--network/wifinetworkmodel.h50
1 files changed, 6 insertions, 44 deletions
diff --git a/network/wifinetworkmodel.h b/network/wifinetworkmodel.h
index 0df4459..94cc7f5 100644
--- a/network/wifinetworkmodel.h
+++ b/network/wifinetworkmodel.h
@@ -1,40 +1,9 @@
#ifndef WIFI_NETWORK_MODEL_H
#define WIFI_NETWORK_MODEL_H
-#include <QAbstractListModel>
-#include <QStringList>
-#include <QtQml/QQmlContext>
-#include <QJsonObject>
+#include "abstractnetworkmodel.h"
-class WifiNetwork
-{
- public:
- WifiNetwork(const QString &address,
- const QString &security,
- const QString &service,
- const QString &ssid,
- const QString &state,
- const int &strength);
- QString address() const;
- QString service() const;
- QString ssid() const;
- QString security() const;
- QString state() const;
- int strength() const;
- void setAddress(const QString address);
- void setState(const QString state);
- void setStrength(const int strength);
-
- private:
- QString m_address;
- QString m_security;
- QString m_service;
- QString m_ssid;
- QString m_state;
- int m_strength;
-};
-
-class WifiNetworkModel : public QAbstractListModel
+class WifiNetworkModel : public AbstractNetworkModel
{
Q_OBJECT
@@ -43,20 +12,16 @@ class WifiNetworkModel : public QAbstractListModel
AddressRole = Qt::UserRole + 1,
SecurityRole,
ServiceRole,
- SsidRole,
StateRole,
+ SsidRole,
StrengthRole
};
WifiNetworkModel(QObject *parent = Q_NULLPTR);
- void addNetwork(WifiNetwork *network);
- void removeNetwork(WifiNetwork *network);
- void removeAllNetworks();
- WifiNetwork *getNetwork(QString service);
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- void updateProperties(QString service, QJsonObject properties);
+ QString getType() const override { return "wifi"; }
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ void updateProperties(QString service, QJsonObject properties) override;
signals:
void strengthChanged(int strength);
@@ -64,8 +29,5 @@ class WifiNetworkModel : public QAbstractListModel
protected:
QHash<int, QByteArray> roleNames() const;
- private:
- QList<WifiNetwork *> m_networks;
- QModelIndex indexOf(WifiNetwork *network);
};
#endif // WIFI_NETWORK_MODEL_H