From dede6d7a29d517cb40028c50a361b7b27eef7878 Mon Sep 17 00:00:00 2001 From: chenlelin Date: Thu, 12 Dec 2019 19:05:54 +0800 Subject: [PATCH] update --- mainwindow.cpp | 8 ++++++-- mainwindow.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 543ca028..11ac53c0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -143,6 +143,7 @@ MainWindow::MainWindow(QWidget *parent) : initTimer(); //初始化定时器 changeTimerState();//初始化定时器 + checkIsWirelessDeviceOn(); //检测无线网卡是否插入 getIface(); //初始化网络 trayIcon->show(); @@ -345,6 +346,11 @@ void MainWindow::changeTimerState() //检测无线网卡与网线是否准备好,以及相应的处理 void MainWindow::checkWirelessDeviceState(/*QDBusObjectPath path*/) +{ + checkIsWirelessDeviceOn(); + on_btnWifi_clicked(); +} +void MainWindow::checkIsWirelessDeviceOn() { QString wlan_card = "iwconfig>/tmp/kylin-nm-iwconfig"; system(wlan_card.toUtf8().data()); @@ -361,8 +367,6 @@ void MainWindow::checkWirelessDeviceState(/*QDBusObjectPath path*/) }else{ is_wireless_adapter_ready = 0; } - - on_btnWifi_clicked(); } // 初始化网络 diff --git a/mainwindow.h b/mainwindow.h index 5f611f09..47227ba8 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -73,6 +73,7 @@ public: void initTimer(); void changeTimerState(); + void checkIsWirelessDeviceOn(); QIcon iconLanOnline, iconLanOffline; QIcon iconWifiFull, iconWifiHigh, iconWifiMedium, iconWifiLow;