Merge branch 'dbus-interface' into '0922'

# Conflicts:
#   src/frontend/tab-pages/lanpage.cpp
This commit is contained in:
Zhang Jiaping 2021-09-24 01:54:20 +00:00
commit ad2d2b1e5b
10 changed files with 199 additions and 42 deletions

View File

@ -23,6 +23,7 @@ public:
KyNetworkDeviceResourse *m_deviceResource = nullptr;
QString deviceName = "";
void refreshIcon();
protected:
void setIcon(bool isOn);

View File

@ -270,8 +270,8 @@ void WlanListItem::onNetButtonClicked()
qDebug()<<"Clicked on connected wifi, it will be inactivated. ssid = " << m_data->m_NetSsid << Q_FUNC_INFO << __LINE__;
return;
}
if (m_data->m_isConfigured) {
//有配置或者无密码的wifi直接连接
if (m_data->m_isConfigured || m_hasPwd == false) {
m_connoperation->activeWirelessConnect(m_wlanDevice,m_data->m_connectUuid);
qDebug()<<"Has configuration, will be activated. ssid = " << m_data->m_NetSsid << Q_FUNC_INFO << __LINE__;
return;
@ -399,35 +399,6 @@ void WlanListItem::onWlanStatusChange(QString uuid, NetworkManager::ActiveConnec
m_netButton->stopLoading();
}
}
//TODO 网络状态改变的通知
// if (state == NetworkManager::ActiveConnection::State::Activated) {
//// this->showDesktopNotify(tr("WLAN Connected Successfully"));
// } else if (state == NetworkManager::ActiveConnection::State::Deactivated) {
// switch (reason) {
// case NetworkManager::ActiveConnection::Reason::UserDisconnected:
// this->showDesktopNotify(tr("WLAN Disconnected Successfully"));
// break;
// case NetworkManager::ActiveConnection::Reason::ServiceStopped:
// this->showDesktopNotify(tr("The service providing the VPN connection was stopped"));
// break;
// case NetworkManager::ActiveConnection::Reason::IpConfigInvalid:
// this->showDesktopNotify(tr("The IP config of the active connection was invalid"));
// break;
// case NetworkManager::ActiveConnection::Reason::ConnectTimeout:
// this->showDesktopNotify(tr("The connection attempt to the VPN service timed out"));
// break;
// case NetworkManager::ActiveConnection::Reason::NoSecrets:
// this->showDesktopNotify(tr("Necessary secrets for the connection were not provided"));
// break;
// case NetworkManager::ActiveConnection::Reason::LoginFailed:
// this->showDesktopNotify(tr("Authentication to the server failed"));
// break;
// default:
// qDebug() << "Wlan disconnected with unkown reason." << Q_FUNC_INFO << __LINE__;
// break;
// }
// }
}
void WlanListItem::onMenuTriggered(QAction *action)

View File

@ -146,7 +146,7 @@ void MainWindow::initTrayIcon()
m_trayIconMenu->addAction(m_showMainwindowAction);
m_trayIconMenu->addAction(m_showSettingsAction);
m_trayIcon->setContextMenu(m_trayIconMenu);
m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic"));
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-signal-excellent-symbolic"));
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::onTrayIconActivated);
connect(m_showMainwindowAction, &QAction::triggered, this, &MainWindow::onShowMainwindowActionTriggled);
@ -170,6 +170,7 @@ void MainWindow::initDbusConnnect()
connect(m_lanWidget, &LanPage::lanRemove, this, &MainWindow::lanRemove);
connect(m_lanWidget, &LanPage::lanUpdate, this, &MainWindow::lanUpdate);
connect(m_lanWidget, &LanPage::lanActiveConnectionStateChanged, this, &MainWindow::lanActiveConnectionStateChanged);
connect(m_lanWidget, &LanPage::lanConnectChanged, this, &MainWindow::onRefreshTrayIcon);
connect(m_wlanWidget, &WlanPage::wlanAdd, this, &MainWindow::wlanAdd);
@ -179,6 +180,7 @@ void MainWindow::initDbusConnnect()
connect(m_wlanWidget, &WlanPage::hotspotActivated, this, &MainWindow::hotspotActivated);
connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange);
connect(m_wlanWidget, &WlanPage::signalStrengthChange, this, &MainWindow::signalStrengthChange);
connect(m_wlanWidget, &WlanPage::wlanConnectChanged, this, &MainWindow::onRefreshTrayIcon);
}
/**
@ -301,7 +303,11 @@ void MainWindow::resetWindowTheme()
void MainWindow::showControlCenter()
{
QProcess process;
process.startDetached("ukui-control-center --netconnect");
if (m_lanWidget->m_isLanConnected == false && m_wlanWidget->wlanIsConnected == true){
process.startDetached("ukui-control-center --wlanconnect");
} else {
process.startDetached("ukui-control-center --wiredconnect");
}
}
/**
@ -338,6 +344,18 @@ void MainWindow::onThemeChanged(const QString &key)
}
}
void MainWindow::onRefreshTrayIcon()
{
//更新托盘图标显示
if (m_lanWidget->m_isLanConnected == true){
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-signal-excellent-symbolic"));
} else if (m_wlanWidget->wlanIsConnected == true && m_lanWidget->m_isLanConnected == false){
m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic"));
} else if (m_wlanWidget->wlanIsConnected == false && m_lanWidget->m_isLanConnected == false){
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-signal-excellent-symbolic"));
}
}
/**
* @brief MainWindow::keyPressEvent esc键关闭主界面
* @param event
@ -466,7 +484,6 @@ void MainWindow::activateWired(const QString& devName, const QString& connUuid)
{
m_lanWidget->activateWired(devName, connUuid);
}
void MainWindow::deactivateWired(const QString& devName, const QString& connUuid)
{
m_lanWidget->deactivateWired(devName, connUuid);

View File

@ -117,6 +117,7 @@ private slots:
void onShowMainwindowActionTriggled();
void onShowSettingsActionTriggled();
void onThemeChanged(const QString &key);
void onRefreshTrayIcon();
};
#endif // MAINWINDOW_H

View File

@ -18,7 +18,6 @@ const QString WIRED_SWITCH = "wiredswitch";
LanPage::LanPage(QWidget *parent) : TabPage(parent)
{
m_activeResourse = new KyActiveConnectResourse(this);
m_connectResourse = new KyConnectResourse(this);
m_device = new KyNetworkDeviceResourse(this);
@ -49,6 +48,9 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent)
connect(m_device, &KyNetworkDeviceResourse::deviceAdd, this, &LanPage::onDeviceAdd);
connect(m_device, &KyNetworkDeviceResourse::deviceRemove, this, &LanPage::onDeviceRemove);
connect(m_device, &KyNetworkDeviceResourse::deviceNameUpdate, this, &LanPage::onDeviceNameUpdate);
connect(m_wiredConnectOperation, &KyWiredConnectOperation::activateConnectionError, this, &LanPage::activateFailed);
connect(m_wiredConnectOperation, &KyWiredConnectOperation::deactivateConnectionError, this, &LanPage::deactivateFailed);
}
LanPage::~LanPage()
@ -335,6 +337,7 @@ void LanPage::initUI()
// m_inactivatedLanListWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //用了listwidget的滚动条
inactiveLanListLayout->addWidget(m_inactivatedLanListWidget);
// emit this->lanConnectChanged();
}
void LanPage::addNewItem(KyConnectItem *itemData, QListWidget *listWidget)
@ -363,6 +366,26 @@ void LanPage::initList(QString m_deviceName) //程序拉起,初始化显
m_activedList.clear();
m_deactivedList.clear();
m_activeResourse->getActiveConnectionList(m_deviceName,
NetworkManager::ConnectionSettings::Wired, m_activedList); //激活列表的显示
qDebug() << "[LanPage]init list! Active list:" << m_activedList.size() << "Deactive list:" << m_deactivedList.size();
if (!m_activedList.isEmpty()) {
for (int i = 0; i < m_activedList.size(); i++) {
KyConnectItem *activeItemData = m_activedList.at(i);
addNewItem(activeItemData, m_activatedLanListWidget);
emit this->lanConnectChanged();
m_activeMap.insert(activeItemData, m_listWidgetItem);
}
} else {
m_nullItem = new QListWidgetItem(m_activatedLanListWidget);
m_nullItem->setSizeHint(QSize(m_activatedLanListWidget->width(),ITEM_HEIGHT));
m_activatedLanListWidget->addItem(m_nullItem);
m_nullLanItem = new LanListItem();
m_activatedLanListWidget->setItemWidget(m_nullItem, m_nullLanItem);
}
m_connectResourse->getConnectionList(m_deviceName, NetworkManager::ConnectionSettings::Wired, m_deactivedList); //未激活列表的显示
if (!m_deactivedList.isEmpty()) {
for (int i = 0; i < m_deactivedList.size(); i++) {
@ -400,9 +423,24 @@ void LanPage::initList(QString m_deviceName) //程序拉起,初始化显
void LanPage::updateLanlist(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason)
{
qDebug()<<"[LanPage] State change slot:"<<state;
//lanpage函数内持续监听连接状态的变化并记录供其他函数调用获取状态
QString devName;
NetworkManager::ConnectionSettings::ConnectionType type;
if (m_connectResourse->getInterfaceByUuid(devName, type, uuid)) {
if (type != NetworkManager::ConnectionSettings::ConnectionType::Wired) {
return;
}
}
if (NetworkManager::ActiveConnection::State::Activated == state){
m_isLanConnected = true;
qDebug() << "[lanpage]lanIsConnected status : " << m_isLanConnected << Q_FUNC_INFO << __LINE__ ;
} else {
m_isLanConnected = false;
qDebug() << "=[lanpage]lanIsConnected status : " << m_isLanConnected << Q_FUNC_INFO << __LINE__ ;
}
qDebug()<<"[LanPage] State change slot:"<<state;
// QString devName;
// NetworkManager::ConnectionSettings::ConnectionType type;
if(m_connectResourse->getInterfaceByUuid(devName, type, uuid)) {
if (type != NetworkManager::ConnectionSettings::ConnectionType::Wired) {
@ -439,6 +477,7 @@ void LanPage::updateLanlist(QString uuid, NetworkManager::ActiveConnection::Stat
if (m_item->m_connectUuid == uuid) {
m_activatedLanListWidget->removeItemWidget(i.value());
delete(i.value());
emit this->lanConnectChanged();
break;
}
}

View File

@ -21,6 +21,7 @@ class LanPage : public TabPage
public:
explicit LanPage(QWidget *parent = nullptr);
~LanPage();
bool m_isLanConnected = false;
//for dbus
void getWiredList(QMap<QString, QVector<QStringList> > &map);
@ -33,6 +34,7 @@ signals:
void lanRemove(QString dbusPath);
void lanUpdate(QString devName, QStringList info);
void lanActiveConnectionStateChanged(QString interface, QString uuid, int status);
void lanConnectChanged();
private:
void initDeviceCombox();
void initUI();

View File

@ -109,6 +109,24 @@ QString TabPage::getDefaultDevice()
return m_defaultDevice;
}
void TabPage::showDesktopNotify(const QString &message)
{
QDBusInterface iface("org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
"org.freedesktop.Notifications",
QDBusConnection::sessionBus());
QList<QVariant> args;
args<<(tr("Kylin NM"))
<<((unsigned int) 0)
<<QString("/usr/share/icons/ukui-icon-theme-default/24x24/devices/gnome-dev-ethernet.png")
<<tr("kylin network applet desktop message") //显示的是什么类型的信息
<<message //显示的具体信息
<<QStringList()
<<QVariantMap()
<<(int)-1;
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
}
void setDefaultDevice(KyDeviceType deviceType, QString deviceName)
{
QString key;
@ -174,6 +192,7 @@ void getDeviceEnableState(int type, QMap<QString, bool> &map)
map.clear();
if (!QFile::exists(CONFIG_FILE_PATH)) {
qDebug() << "CONFIG_FILE_PATH not exist";
return;
}
if (type != WIRED && type != WIRELESS) {
qDebug() << "getDeviceEnableState but wrong type";

View File

@ -10,6 +10,9 @@
#include <QListWidget>
#include <QDir>
#include <QComboBox>
#include <QEvent>
#include <QProcess>
#include <QDebug>
#include "kylinnetworkdeviceresource.h"
#define MAIN_LAYOUT_MARGINS 0,0,0,0
@ -50,6 +53,7 @@ public:
void updateDefaultDevice(QString &deviceName);
QString getDefaultDevice();
static void showDesktopNotify(const QString &message);
signals:
void deviceStatusChanged();

View File

@ -17,6 +17,8 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
initDevice();
m_wirelessConnectOpreation = new KyWirelessConnectOperation(this);
m_connectoperation = new KyConnectOperation(this);
m_settingsLabel->installEventFilter(this);
m_connectResource = new KyActiveConnectResourse();
initWlanUI();
//要在initUI之后调用保证UI的信号槽顺利绑定
initConnections();
@ -33,6 +35,8 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::deactivateConnectionError, this, &WlanPage::deactivateFailed);
connect(this, &WlanPage::hiddenWlanClicked, this, &WlanPage::onHiddenWlanClicked);
connect(this, &WlanPage::settingsClicked, this, &WlanPage::showControlCenter);
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::wifinEnabledChanged, this, &WlanPage::onWifiEnabledChanged);
}
//QString WlanPage::getSsidFromUuid(const QString &uuid)
@ -48,6 +52,7 @@ bool WlanPage::eventFilter(QObject *w, QEvent *e)
emit this->hiddenWlanClicked();
} else if (w == m_settingsLabel) {
//ZJP_TODO 打开控制面板
emit this->settingsClicked();
}
}
return QWidget::eventFilter(w,e);
@ -154,6 +159,11 @@ void WlanPage::initDevice()
if (!m_devList.isEmpty()) {
deviceName = m_devList.at(0);
m_settings->setValue(key, deviceName);
} else {
qDebug() << "have no device to use " << Q_FUNC_INFO << __LINE__;
//检测不到无线网卡不再触发click信号
m_netSwitch->setSwitchStatus(false);
m_netSwitch->setEnabled(false);
}
updateDefaultDevice(deviceName);
qDebug() << "[WlanPage] initDevice defaultDevice = " << deviceName;
@ -217,6 +227,7 @@ void WlanPage::getActiveWlan()
QListWidgetItem *wlanItem = new QListWidgetItem(m_activatedNetListWidget);
wlanItem->setSizeHint(QSize(m_activatedNetListWidget->width(), wlanItemWidget->height()));
m_activatedNetListWidget->addItem(wlanItem);
// emit this->wlanConnectChanged();
m_activatedNetListWidget->setItemWidget(wlanItem, wlanItemWidget);
height += wlanItemWidget->height();
}
@ -239,6 +250,8 @@ void WlanPage::appendActiveWlan(const QString &uuid, int &height)
QListWidgetItem *wlanItem = new QListWidgetItem(m_activatedNetListWidget);
wlanItem->setSizeHint(QSize(m_activatedNetListWidget->width(), wlanItemWidget->height()));
m_activatedNetListWidget->addItem(wlanItem);
emit this->wlanConnectChanged();
qDebug() << "[wlanpage]emit wlanConnectChanged()" << Q_FUNC_INFO << __LINE__ ;
m_activatedNetListWidget->setItemWidget(wlanItem, wlanItemWidget);
wlanItemWidget->setActive(true);
@ -253,7 +266,7 @@ void WlanPage::getAllWlan()
if (!m_inactivatedNetListWidget) {
return;
}
qDebug() << "Started loading wlan list! time=" << QDateTime::currentDateTime().toString("hh:mm:ss.zzzz");
qDebug() << "Started loading wlan list!" << QDateTime::currentDateTime().toString("hh:mm:ss.zzzz");
m_inactivatedNetListWidget->clear();
m_itemsMap.clear();
QList<KyWirelessNetItem> wlanList;
@ -293,8 +306,6 @@ void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
QStringList info;
info <<item.m_NetSsid<<QString::number(item.m_signalStrength)<<item.m_secuType;
emit wlanAdd(interface, info);
qDebug() << "A Wlan Added! interface = " << interface << "; ssid = " << item.m_NetSsid << Q_FUNC_INFO <<__LINE__;
if (interface != m_defaultDevice) {
qDebug() << "wlan add interface not equal defaultdevice,ignore";
@ -345,6 +356,8 @@ void WlanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devi
if (deviceType != NetworkManager::Device::Type::Wifi) {
return;
}
m_netSwitch->setEnabled(true);
m_netSwitch->setSwitchStatus(true);
m_devList << deviceName;
if (getDefaultDevice().isEmpty())
{
@ -375,6 +388,9 @@ void WlanPage::onDeviceRemove(QString deviceName)
m_netDeviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, list);
if (!list.isEmpty()) {
newDefaultDevice = list.at(0);
} else {
m_netSwitch->setSwitchStatus(false);
m_netSwitch->setEnabled(false);
}
updateDefaultDevice(newDefaultDevice);
setDefaultDevice(WIRELESS, newDefaultDevice);
@ -419,8 +435,48 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec
{
qDebug()<< "Activated wlan changed, uuid = " << uuid << "; state = " << state << "; reason = " << reason << Q_FUNC_INFO <<__LINE__;
QString ssid,devName;
//wlanpage函数内持续监听连接状态的变化并记录供其他函数调用获取状态
QString devName,ssid;
NetworkManager::ConnectionSettings::ConnectionType type;
if(m_apConnectResource->getInterfaceByUuid(devName, type, uuid)) {
if (type != NetworkManager::ConnectionSettings::ConnectionType::Wireless) {
return;
}
}
if(NetworkManager::ActiveConnection::State::Activated == state){
wlanIsConnected = true;
qDebug() << "[wlanpage] wlanIsConnected status : " << wlanIsConnected << Q_FUNC_INFO << __LINE__ ;
} else {
wlanIsConnected = false;
qDebug() << "[wlanpage] wlanIsConnected status : " << wlanIsConnected << Q_FUNC_INFO << __LINE__ ;
}
//弹窗显示wifi连接状况
qDebug() << "[WlanPage] State changed to :" << state << reason << Q_FUNC_INFO <<__LINE__;
//QString ssid;
m_resource->getSsidByUuid(uuid, ssid, m_defaultDevice);
if (m_activatedWlanSSid == ssid && state == NetworkManager::ActiveConnection::State::Activated) {
if(m_activedssid != m_activatedWlanSSid){
m_activedssid = m_activatedWlanSSid;
qDebug() << "[WlanPage] State changed to :" << state << ssid << reason << Q_FUNC_INFO <<__LINE__;
this->showDesktopNotify(tr("WLAN Connected Successfully"));
}
}
if (state == NetworkManager::ActiveConnection::State::Deactivating){
m_disconnectuuid = uuid;
m_disconnectingflag = true;
}
if (state == NetworkManager::ActiveConnection::State::Deactivated && m_disconnectuuid == uuid){
if(m_disconnectingflag){
m_disconnectingflag = false;
this->showDesktopNotify(tr("WLAN Disconnected Successfully"));
qDebug() << "clear the activessid" << Q_FUNC_INFO <<__LINE__;
m_activedssid = "";
}
}
//QString ssid,devName;
//NetworkManager::ConnectionSettings::ConnectionType type;
if(m_apConnectResource->getInterfaceByUuid(devName, type, uuid)) {
if (type != NetworkManager::ConnectionSettings::ConnectionType::Wireless) {
@ -469,6 +525,7 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec
m_activatedNetListWidget->clear();
int height = 0;
appendActiveWlan(uuid, height);
// emit this->wlanConnectChanged();
onWlanRemoved(m_defaultDevice, ssid);
// this->showDesktopNotify(tr("Connect WLAN succeed"));
} else if (state == NetworkManager::ActiveConnection::State::Deactivated && (uuid.isEmpty() || (!uuid.isEmpty() && uuid == m_activatedWlanUuid))) {
@ -525,12 +582,20 @@ void WlanPage::onConnectButtonClicked(KyWirelessConnectSetting &connSettingInfo,
void WlanPage::onWlanSwitchClicked()
{
qDebug() << "On wlan switch button clicked! old state = " << !m_netSwitch->getSwitchStatus() << Q_FUNC_INFO << __LINE__;
m_wirelessConnectOpreation->setWirelessEnabled(m_netSwitch->getSwitchStatus());
//应该先检测是否有无线网卡可用,才改变开关状态
m_netDeviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, m_devList);
if (m_devList.isEmpty()) {
qDebug() << "have no device to use " << Q_FUNC_INFO << __LINE__;
//检测不到无线网卡不再触发click信号
m_netSwitch->setSwitchStatus(false);
m_netSwitch->setEnabled(false);
}else{
m_wirelessConnectOpreation->setWirelessEnabled(m_netSwitch->getSwitchStatus());
}
}
void WlanPage::onWlanSwitchStatusChanged(const bool &checked)
{
m_netSwitch->setSwitchStatus(checked);
qDebug() << "On wlan switch status changed! new state = " << m_netSwitch->getSwitchStatus() << Q_FUNC_INFO << __LINE__;
onWlanUpdated();
}
@ -553,6 +618,7 @@ void WlanPage::requestScan()
{
if (!m_wirelessConnectOpreation) {
qWarning() << "Scan failed! m_wirelessConnectOpreation is nullptr!" << Q_FUNC_INFO << __LINE__;
return;
}
m_wirelessConnectOpreation->requestWirelessScan();
}
@ -564,6 +630,29 @@ void WlanPage::onHiddenWlanClicked()
netDetail->show();
}
void WlanPage::showControlCenter()
{
QProcess process;
process.startDetached("ukui-control-center --wlanconnect");
}
void WlanPage::onWifiEnabledChanged(bool isWifiOn)
{
//监听外部命令导致wifi状态变化更新界面
//应该先检测是否有无线网卡可用,才改变开关状态
m_netDeviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, m_devList);
if (m_devList.isEmpty()) {
qDebug() << "have no device to use " << Q_FUNC_INFO << __LINE__;
return;
}
if(m_netSwitch->getSwitchStatus() == isWifiOn){
return;
}else{
//m_wirelessConnectOpreation->setWirelessEnabled(isWifiOn);
m_netSwitch->setSwitchStatus(isWifiOn);
//外部命令导致连接状态发生变化,通知主界面刷新图标
emit this->wlanConnectChanged();
}
}
//for dbus
void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
@ -714,6 +803,7 @@ void WlanPage::onMainWindowVisibleChanged(const bool &visible)
m_scanTimer->stop();
}
}
void WlanPage::showDetailPage(QString devName, QString ssid)
{
KyWirelessNetItem data;
@ -733,3 +823,4 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
NetDetail *netDetail = new NetDetail(devName, ssid, data.m_connectUuid, isActive, true, false, this);
netDetail->show();
}

View File

@ -10,6 +10,9 @@
#include "kylinconnectoperation.h"
#include <QGSettings>
#include "netdetails/netdetail.h"
#include <QProcess>
#include "kylinactiveconnectresource.h"
#include "kywirelessnetresource.h"
//#define SCROLLAREA_HEIGHT 150
#define MORE_TEXT_MARGINS 16,0,0,0
@ -21,6 +24,7 @@ class WlanPage : public TabPage
public:
explicit WlanPage(QWidget *parent = nullptr);
~WlanPage() = default;
bool wlanIsConnected = false;
//for dbus
void getWirelessList(QMap<QString, QVector<QStringList> > &map);
@ -44,6 +48,8 @@ signals:
void signalStrengthChange(QString devName, QString ssid, int strength);
void secuTypeChange(QString devName, QString ssid, QString secuType);
void hiddenWlanClicked();
void settingsClicked();
void wlanConnectChanged();
public slots:
void onMainWindowVisibleChanged(const bool &visible);
@ -54,6 +60,10 @@ protected:
private:
void initWlanUI();
void initConnections();
QString m_activedssid;
QString m_disconnectuuid;
int m_disconnecting;
bool m_disconnectingflag = false;
//定时触发扫描的定时器
void initTimer();
@ -106,6 +116,8 @@ private slots:
void onDeviceComboxIndexChanged(int currentIndex);
void requestScan();
void onHiddenWlanClicked();
void showControlCenter();
void onWifiEnabledChanged(bool isWifiOn);
};
#endif // WLANPAGE_H