diff --git a/src/frontend/mainwindow.cpp b/src/frontend/mainwindow.cpp index 73b95a21..87f19188 100644 --- a/src/frontend/mainwindow.cpp +++ b/src/frontend/mainwindow.cpp @@ -508,11 +508,27 @@ void MainWindow::showByWaylandHelper() } +void MainWindow::setCentralWidgetType(IconActiveType iconStatus) +{ + if (iconStatus == WLAN_CONNECTED) { + m_centralWidget->setCurrentIndex(WLAN_PAGE_INDEX); + } else if (iconStatus == ACTIVATING) { + if (m_wlanWidget->checkWlanStatus(NetworkManager::ActiveConnection::State::Activating)) { + m_centralWidget->setCurrentIndex(WLAN_PAGE_INDEX); + } else { + m_centralWidget->setCurrentIndex(LAN_PAGE_INDEX); + } + } else { + m_centralWidget->setCurrentIndex(LAN_PAGE_INDEX); + } +} + /** * @brief MainWindow::onTrayIconActivated 点击托盘图标的槽函数 */ void MainWindow::onTrayIconActivated(QSystemTrayIcon::ActivationReason reason) { + setCentralWidgetType(iconStatus); if (reason == QSystemTrayIcon::ActivationReason::Context) { m_trayIconMenu->popup(QCursor::pos()); } else { diff --git a/src/frontend/mainwindow.h b/src/frontend/mainwindow.h index df5c9e62..0a5fd198 100644 --- a/src/frontend/mainwindow.h +++ b/src/frontend/mainwindow.h @@ -155,6 +155,7 @@ private: void resetWindowTheme(); void showControlCenter(); void showByWaylandHelper(); + void setCentralWidgetType(IconActiveType iconStatus); double m_transparency=1.0; //透明度 QGSettings * m_transGsettings; //透明度配置文件 int currentIconIndex=0;