2022-07-05 10:13:48 +08:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
|
|
|
* Copyright (C) 2022 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
|
2023-04-21 10:03:57 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2022-07-05 10:13:48 +08:00
|
|
|
* (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, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
2022-06-02 16:27:45 +08:00
|
|
|
#ifndef MOBILEHOTSPOTWIDGET_H
|
|
|
|
#define MOBILEHOTSPOTWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
|
|
|
#include <QTranslator>
|
|
|
|
#include <QApplication>
|
2022-07-04 13:45:35 +08:00
|
|
|
#include <QTimer>
|
2022-06-02 16:27:45 +08:00
|
|
|
|
|
|
|
#include <QDBusMessage>
|
|
|
|
#include <QDBusObjectPath>
|
|
|
|
#include <QDBusInterface>
|
|
|
|
#include <QDBusReply>
|
|
|
|
#include <QDBusMetaType>
|
2022-07-04 13:45:35 +08:00
|
|
|
#include <QScrollArea>
|
2022-06-02 16:27:45 +08:00
|
|
|
|
|
|
|
#include "titlelabel.h"
|
2022-06-17 18:48:59 +08:00
|
|
|
#include "kwidget.h"
|
|
|
|
#include "kswitchbutton.h"
|
|
|
|
#include "kpasswordedit.h"
|
2022-07-04 13:45:35 +08:00
|
|
|
#include "connectdevlistitem.h"
|
|
|
|
#include "blacklistpage.h"
|
|
|
|
#include "connectdevpage.h"
|
2023-05-06 14:53:31 +08:00
|
|
|
#include "fixlabel.h"
|
2023-06-26 16:52:45 +08:00
|
|
|
#include "ukcccommon.h"
|
2022-06-17 18:48:59 +08:00
|
|
|
|
|
|
|
using namespace kdk;
|
2023-06-26 16:52:45 +08:00
|
|
|
using namespace ukcc;
|
2022-06-02 16:27:45 +08:00
|
|
|
|
|
|
|
class MobileHotspotWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit MobileHotspotWidget(QWidget *parent = nullptr);
|
|
|
|
~MobileHotspotWidget();
|
|
|
|
|
|
|
|
private:
|
2022-07-06 09:16:31 +08:00
|
|
|
QFrame *m_hotspotFrame = nullptr;
|
2022-06-02 16:27:45 +08:00
|
|
|
QFrame *m_switchFrame = nullptr; //开关
|
|
|
|
QFrame *m_ApNameFrame = nullptr; //wifi名称
|
|
|
|
QFrame *m_passwordFrame = nullptr; //密码
|
|
|
|
QFrame *m_freqBandFrame = nullptr; //频带
|
|
|
|
QFrame *m_interfaceFrame = nullptr; //网卡
|
|
|
|
|
2022-06-17 18:48:59 +08:00
|
|
|
KSwitchButton *m_switchBtn;
|
2022-06-02 16:27:45 +08:00
|
|
|
|
|
|
|
TitleLabel *m_hotspotTitleLabel;
|
|
|
|
QLabel *m_switchLabel;
|
|
|
|
QLabel *m_apNameLabel;
|
|
|
|
QLabel *m_pwdLabel;
|
2022-06-28 17:28:15 +08:00
|
|
|
QLabel *m_pwdHintLabel;
|
2023-09-08 15:25:04 +08:00
|
|
|
FixLabel *m_freqBandLabel;
|
2022-06-02 16:27:45 +08:00
|
|
|
QLabel *m_interfaceLabel;
|
|
|
|
|
|
|
|
QFrame *switchAndApNameLine;
|
|
|
|
QFrame *apNameAndPwdLine;
|
|
|
|
QFrame *pwdAndfreqBandLine;
|
|
|
|
QFrame *freqBandAndInterfaceLine;
|
|
|
|
|
2022-07-04 13:45:35 +08:00
|
|
|
QVBoxLayout *m_Vlayout;
|
2022-06-02 16:27:45 +08:00
|
|
|
|
|
|
|
QLineEdit *m_apNameLine;
|
2022-06-17 18:48:59 +08:00
|
|
|
KPasswordEdit *m_pwdNameLine;
|
2022-06-02 16:27:45 +08:00
|
|
|
|
|
|
|
QComboBox *m_freqBandComboBox;
|
|
|
|
QComboBox *m_interfaceComboBox;
|
|
|
|
|
2023-05-06 14:53:31 +08:00
|
|
|
FixLabel *m_interfaceWarnLabel;
|
2023-04-21 14:39:22 +08:00
|
|
|
QWidget* m_warnWidget;
|
|
|
|
|
2022-06-02 16:27:45 +08:00
|
|
|
QDBusInterface *m_interface = nullptr;
|
|
|
|
|
|
|
|
QString m_interfaceName = "";
|
|
|
|
|
|
|
|
QGSettings *m_switchGsettings = nullptr;
|
|
|
|
|
|
|
|
QString m_uuid = "";
|
|
|
|
QString m_hostName = "";
|
|
|
|
|
2022-07-07 09:20:34 +08:00
|
|
|
void resetFrameSize();
|
2022-06-02 16:27:45 +08:00
|
|
|
void initUI();
|
|
|
|
void initDbusConnect();
|
|
|
|
void initInterfaceInfo();
|
|
|
|
void getApInfo();
|
|
|
|
bool getApInfoBySsid(QString devName, QString ssid, QStringList &info);
|
|
|
|
void setSwitchFrame();
|
|
|
|
void setApNameFrame();
|
|
|
|
void setPasswordFrame();
|
|
|
|
void setFreqBandFrame();
|
|
|
|
void setInterFaceFrame();
|
|
|
|
|
|
|
|
void setUiEnabled(bool enable);
|
|
|
|
void setWidgetHidden(bool isHidden);
|
|
|
|
|
|
|
|
void showDesktopNotify(const QString &message);
|
|
|
|
|
|
|
|
void updateBandCombox();
|
|
|
|
|
|
|
|
QString getHostName();
|
|
|
|
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event);
|
|
|
|
void paintEvent(QPaintEvent *event);
|
|
|
|
|
|
|
|
QFrame* myLine();
|
|
|
|
|
2022-07-04 13:45:35 +08:00
|
|
|
QDBusInterface *m_activePathInterface = nullptr;
|
|
|
|
QDBusInterface *m_settingPathInterface = nullptr;
|
|
|
|
|
|
|
|
ConnectdevPage * m_connectDevPage = nullptr;
|
|
|
|
BlacklistPage *m_blacklistPage = nullptr;
|
|
|
|
|
|
|
|
QString getActivePathByUuid();
|
|
|
|
QString getSettingPathByUuid();
|
|
|
|
void initNmDbus();
|
|
|
|
void initActivePathInterface(QString path);
|
|
|
|
void deleteActivePathInterface();
|
|
|
|
void initSettingPathInterface(QString path);
|
|
|
|
void deleteSettingPathInterface();
|
|
|
|
void initConnectDevPage();
|
|
|
|
void initBlackListPage();
|
2022-12-08 14:00:51 +08:00
|
|
|
|
2023-07-17 16:56:04 +08:00
|
|
|
bool m_isUserSelect = true; //是否用户操作
|
2022-06-02 16:27:45 +08:00
|
|
|
signals:
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onActivateFailed(QString errorMessage);
|
|
|
|
void onDeactivateFailed(QString errorMessage);
|
|
|
|
//设备插拔
|
|
|
|
void onDeviceStatusChanged();
|
|
|
|
void onDeviceNameChanged(QString oldName, QString newName, int type);
|
|
|
|
//热点断开
|
|
|
|
void onHotspotDeactivated(QString devName, QString ssid);
|
|
|
|
//热点连接
|
2022-07-04 13:45:35 +08:00
|
|
|
void onHotspotActivated(QString devName, QString ssid, QString uuid, QString activePath, QString settingPath);
|
2022-06-02 16:27:45 +08:00
|
|
|
|
2023-04-06 14:09:59 +08:00
|
|
|
void onWirelessBtnChanged(bool state);
|
2022-06-02 16:27:45 +08:00
|
|
|
|
|
|
|
void onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status);
|
|
|
|
|
|
|
|
void onApLineEditTextEdit(QString text);
|
|
|
|
|
2022-06-30 14:58:47 +08:00
|
|
|
void onPwdTextChanged();
|
2023-04-21 14:39:22 +08:00
|
|
|
|
|
|
|
void onInterfaceChanged();
|
2022-06-02 16:27:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MOBILEHOTSPOTWIDGET_H
|