2021-10-27 12:28:16 +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>
|
|
|
|
|
|
|
|
|
|
|
|
#include <QDBusMessage>
|
|
|
|
#include <QDBusObjectPath>
|
|
|
|
#include <QDBusInterface>
|
|
|
|
#include <QDBusReply>
|
|
|
|
#include <QDBusMetaType>
|
|
|
|
|
|
|
|
#include "titlelabel.h"
|
2022-05-27 10:48:16 +08:00
|
|
|
#include "kwidget.h"
|
|
|
|
#include "kswitchbutton.h"
|
2022-06-10 15:06:05 +08:00
|
|
|
#include "kpasswordedit.h"
|
2022-05-27 10:48:16 +08:00
|
|
|
|
|
|
|
using namespace kdk;
|
2021-10-27 12:28:16 +08:00
|
|
|
|
|
|
|
class MobileHotspotWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit MobileHotspotWidget(QWidget *parent = nullptr);
|
|
|
|
~MobileHotspotWidget();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QFrame *m_switchFrame = nullptr; //开关
|
|
|
|
QFrame *m_ApNameFrame = nullptr; //wifi名称
|
|
|
|
QFrame *m_passwordFrame = nullptr; //密码
|
|
|
|
QFrame *m_freqBandFrame = nullptr; //频带
|
|
|
|
QFrame *m_interfaceFrame = nullptr; //网卡
|
|
|
|
|
2022-05-27 10:48:16 +08:00
|
|
|
KSwitchButton *m_switchBtn;
|
2021-10-27 12:28:16 +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;
|
2021-10-27 12:28:16 +08:00
|
|
|
QLabel *m_freqBandLabel;
|
|
|
|
QLabel *m_interfaceLabel;
|
|
|
|
|
|
|
|
QFrame *switchAndApNameLine;
|
|
|
|
QFrame *apNameAndPwdLine;
|
|
|
|
QFrame *pwdAndfreqBandLine;
|
|
|
|
QFrame *freqBandAndInterfaceLine;
|
|
|
|
|
|
|
|
QVBoxLayout *mVlayout;
|
|
|
|
|
|
|
|
QLineEdit *m_apNameLine;
|
2022-06-10 15:06:05 +08:00
|
|
|
KPasswordEdit *m_pwdNameLine;
|
2021-10-27 12:28:16 +08:00
|
|
|
|
|
|
|
QComboBox *m_freqBandComboBox;
|
|
|
|
QComboBox *m_interfaceComboBox;
|
|
|
|
|
|
|
|
QDBusInterface *m_interface = nullptr;
|
|
|
|
|
|
|
|
QString m_interfaceName = "";
|
|
|
|
|
|
|
|
QGSettings *m_switchGsettings = nullptr;
|
|
|
|
|
|
|
|
QString m_uuid = "";
|
|
|
|
QString m_hostName = "";
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
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);
|
|
|
|
//热点连接
|
|
|
|
void onHotspotActivated(QString devName, QString ssid, QString uuid);
|
|
|
|
|
|
|
|
void onGsettingChanged(const QString &key);
|
|
|
|
|
|
|
|
void onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status);
|
|
|
|
|
2021-11-19 11:05:38 +08:00
|
|
|
void onApLineEditTextEdit(QString text);
|
2021-10-27 12:28:16 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MOBILEHOTSPOTWIDGET_H
|