[go: up one dir, main page]

File: oneconnform.h

package info (click to toggle)
kylin-nm 3.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,312 kB
  • sloc: cpp: 15,740; ansic: 901; makefile: 21
file content (178 lines) | stat: -rw-r--r-- 4,723 bytes parent folder | download | duplicates (2)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
 * Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
 *
 */

#ifndef ONECONNFORM_H
#define ONECONNFORM_H

#include <QWidget>
#include <QScreen>
#include <QThread>
#include <QDialog>
#include <QLineEdit>
#include <QShortcut>
#include <QKeyEvent>
#include <QLabel>
#include <QHBoxLayout>

#include "confform.h"
#include "backthread.h"
#include "ksimplenm.h"
#include "wpawifidialog.h"

#define FRAME_SPEED 150
#define LIMIT_TIME 90*1000
#define TOTAL_PAGE 8

#define W_ITEM 424
#define H_ITEM 60
#define H_ITEM_BIG 138
#define H_ITEM_MIDDLE 106
#define H_WIFI_ITEM_BIG_EXTEND 78 //138 - 60
#define H_WIFI_ITEM_SMALL_EXTEND 46 //106 - 60
#define Y_LINE 59
#define X_LINE 2
#define Y_LINE_SMALL_EXTEND 105
#define X_LINE_SMALL_EXTEND 2
#define Y_LINE_BIG_EXTEND 137
#define X_LINE_BIG_EXTEND 2

class MainWindow;

namespace Ui {
class OneConnForm;
}

class OneConnForm : public QWidget
{
    Q_OBJECT

public:
    explicit OneConnForm(QWidget *parent = 0, MainWindow *mw = 0, ConfForm *confForm = 0, KSimpleNM *ksnm = 0);
    ~OneConnForm();

    // category:1->normal protocol 1->wifi 6 2->wifi 6+
    void setSignal(QString lv, QString secu, QString category = "0", bool hasSignalStrength = true);
    int getSignal();
    void setWifiName(QString name, QString bssid, QString uuid, QString isname, bool isHW, bool is9006C);
    QString getName();
    void setRate(QString rate);
    void setLine(bool isShow);
    void setWifiInfo(QString str1, QString str2, QString str3, int freq);

    void setSelected(bool isSelected, bool isCurrName);
    void setHideItem(bool isHideItem, bool isShowHideBtn);
    void setTopItem(bool isSelected);
    void setAct(bool isAct);

    void setConnedString(bool showLable, QString str, QString str1);

    void setLePassword();

    bool isWifiConfExist(QString netName);
    bool isInputtingPwd();
    void setlbPwdTipVisble(const bool&);

    QString wifiName;
    QString wifiBSsid;
    QString wifiUuid;
    QString wifiIfName;
    QString connType;
    QString wifiSecu;
    QLabel * lbFreq = nullptr;
    QLabel * lbPwdTip = nullptr;
    bool isHuaweiPC;
    bool isHuaWei9006C;
    bool isSelected;\
    bool isActive;
    bool isConnected;
    bool isTopItem;
    int signalLv;
    int m_signal;

public slots:
    void waitAnimStep();
    void startWifiWaiting(bool isToConnect);
    void stopWifiWaiting(bool isUpdateTrayIcon);
    void onBtnPropertyClicked();

protected:
    void mousePressEvent(QMouseEvent *event);
    bool eventFilter(QObject *obj, QEvent *event);

private:
    bool getWifiConfig(WifiConfig &wc, QString netName);
    bool checkIsSaved();

private slots:
    void on_btnConn_clicked();
    void on_btnConnSub_clicked();
    void on_btnDisConn_clicked();
    void toConnectWirelessNetwork();

    void slotConnWifi();
    void slotConnWifiPWD();
    void slotConnWifiResult(int connFlag);

    void on_btnConnPWD_clicked();

    void on_btnHideConn_clicked();

    void on_lePassword_textEdited(const QString &arg1);

    void on_btnInfo_clicked();

    void on_btnCancel_clicked();

    void on_checkBoxPwd_clicked();

    bool onMenuTriggered(QAction *);

private:
    QTimer *waitTimer = nullptr;
    int waitPage;
    int countCurrentTime;
    bool isWaiting = false;
    int psk_flag = 0; //密码存储策略
    int getPskFlag();
    bool m_connWithPwd = true; //是否使用密码连接

    Ui::OneConnForm *ui = nullptr;
    MainWindow *mw = nullptr;
    ConfForm *cf = nullptr;
    KSimpleNM *ks = nullptr;
    bool hasPwd;

    QString leQssLow, leQssHigh;
    QLabel * lbNameText = nullptr;
    QHBoxLayout * lbNameLyt = nullptr;
    QString key_mgmt, funcBtnQss;
    QPushButton *btnProperty = nullptr;
    QMenu * m_menu = nullptr;

signals:
    void selectedOneWifiForm(QString wifiName, int extendLength);
    void connDone(int connFlag);
    void requestHandleWifiDisconn();
    void requestRefreshWifiList();

    void sigConnWifi(QString, QString);
    void sigConnWifiPWD(QString, QString, QString, QString, QString);
    void sigConnWifiPsk(QString);
};

#endif // ONECONNFORM_H