xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/wifi/wifiview.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* WIFI 代理和模型显示接口*/
2*4882a593Smuzhiyun #ifndef WIFIITEMDELEGATE_H
3*4882a593Smuzhiyun #define WIFIITEMDELEGATE_H
4*4882a593Smuzhiyun #include <QAbstractItemDelegate>
5*4882a593Smuzhiyun #include <QAbstractListModel>
6*4882a593Smuzhiyun #include "wpaclicmd.h"
7*4882a593Smuzhiyun #include "hostapdcli.h"
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun class WifiItemDelegate : public QAbstractItemDelegate
10*4882a593Smuzhiyun {
11*4882a593Smuzhiyun public:
12*4882a593Smuzhiyun     WifiItemDelegate(QObject *parent = Q_NULLPTR);
13*4882a593Smuzhiyun     virtual void paint(QPainter *painter,
14*4882a593Smuzhiyun                        const QStyleOptionViewItem &option,
15*4882a593Smuzhiyun                        const QModelIndex &index) const ;
16*4882a593Smuzhiyun     virtual QSize sizeHint(const QStyleOptionViewItem &option,
17*4882a593Smuzhiyun                            const QModelIndex &index) const ;
18*4882a593Smuzhiyun     int getLevel(int singalLevel) const;
19*4882a593Smuzhiyun };
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun class WifiModel: public  QAbstractListModel
22*4882a593Smuzhiyun {
23*4882a593Smuzhiyun public:
24*4882a593Smuzhiyun     WifiModel(QObject *parent = Q_NULLPTR);
25*4882a593Smuzhiyun     void setData(const QList<ScanInfo> &list);
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun     void setDataHostap(const QList<ScanInfoAp> &infos);
28*4882a593Smuzhiyun     void lostConnectHoseap(const QString &ssid);
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun protected:
31*4882a593Smuzhiyun     int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
32*4882a593Smuzhiyun     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
33*4882a593Smuzhiyun     bool canFetchMore(const QModelIndex &parent) const;
34*4882a593Smuzhiyun     void fetchMore(const QModelIndex &parent);
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun private:
37*4882a593Smuzhiyun     QList<ScanInfo> m_list;
38*4882a593Smuzhiyun     int m_fixCount;
39*4882a593Smuzhiyun     QString m_connName;
40*4882a593Smuzhiyun };
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun #endif // WIFIITEMDELEGATE_H
43