[go: up one dir, main page]

File: confform.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 (127 lines) | stat: -rw-r--r-- 3,318 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
/*
 * 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 CONFFORM_H
#define CONFFORM_H

#include <QWidget>
#include <QMouseEvent>
#include <QDebug>
#include <QPoint>
#include <QPainter>
#include <QPainterPath>
#include <QDialog>
#include <QListView>
#include "kylin-dbus-interface.h"

namespace Ui {
class ConfForm;
}

struct ConnProperties
{
    QString connName;
    QString uuidName;
    QString v4method;
    QString v4addr;
    QString v6method;
    QString v6addr;
    QString mask;
    QString gateway;
    QString dns;
    bool isActConf;
    QString type;
};

class ConfForm : public QDialog
{
    Q_OBJECT

public:
    explicit ConfForm(QWidget *parent = 0);
    ~ConfForm();

    void setProp(ConnProperties connection);
    QString actLanIpv6Addr;
    QString actWifiIpv6Addr;
    QString lcard, wcard;

public slots:
    void cbTypeChanged(int index);
    void cbMaskChanged(int index);
    void changeEnableCheckIp();

protected:
    void paintEvent(QPaintEvent *event);

private slots:
    void on_btnSave_clicked();

    void on_btnCancel_clicked();

    void on_btnCreate_clicked();

    void on_leName_textEdited(const QString &arg1);

    void on_leAddr_textEdited(const QString &arg1);

    void on_leGateway_textEdited(const QString &arg1);

    void on_leDns_textEdited(const QString &arg1);

    void on_leDns2_textEdited(const QString &arg1);

    void setEnableOfBtn();
    bool getTextEditState(QString text);
    bool getIpv6EditState(QString text);
    void setBtnEnableFalse();
    void saveNetworkConfiguration();

    void on_leAddr_ipv6_textChanged(const QString &arg1);

private:
    Ui::ConfForm *ui;

//    void mousePressEvent(QMouseEvent *event);
//    void mouseReleaseEvent(QMouseEvent *event);
//    void mouseMoveEvent(QMouseEvent *event);

    void showNotify(QString message);
    bool check_ip_conflict(QString ifname);
    void onConfformHide();
    bool isEditingAlready();    //连接按钮是否可被按

    bool isPress;
    QPoint winPos;
    QPoint dragPos;
    bool isActConf; //是否对已经连接的网络进行的更改
    bool isCreateNewNet = false; //是否是创建的新网络
    bool isShowSaveBtn = true; //是否显示保存按钮,即是否是编辑网络界面
    QString lastConnName, lastIpv4, netUuid, newUuid, lastIpv6;
    int lastTypeIndex;
    bool isActWifi; //是否是wifi网络
    bool canCheckIpConflict = true; //当前是否可以执行IP冲突的检测
    bool isIpv6Conflict = false; //ipv6地址是否冲突

    QString labelQss, cbxQss, leQss, lineQss, btnOnQss, btnOffQss;

signals:
    void requestRefreshLanList(int updateType);
};

#endif // CONFFORM_H