Wi-Fi icon improvements

Don't update it if it isn't necessary.
This commit is contained in:
Nicolas Mailloux 2022-04-02 10:27:44 -04:00
parent cfdace7dab
commit e4a21f5c85
2 changed files with 17 additions and 6 deletions

View file

@ -66,6 +66,7 @@ MainWindow::MainWindow(QWidget *parent)
global::mainwindow::tabSwitcher::repaint = true;
resetFullWindowException = false;
wifiIconClickedWhileReconnecting = false;
lastWifiState = 0;
// Getting the screen's size
sW = QGuiApplication::screens()[0]->size().width();
@ -954,19 +955,28 @@ void MainWindow::setWifiIcon() {
global::device::isWifiAble = true;
if(checkWifiState() == true) {
if(testPing() == 0) {
if(lastWifiState != 3) {
lastWifiState = 3;
ui->wifiBtn->setIcon(QIcon(":/resources/wifi-connected.png"));
ui->wifiBtn->setIconSize(QSize(wifiIconWidth, wifiIconHeight));
}
}
else {
if(lastWifiState != 2) {
lastWifiState = 2;
ui->wifiBtn->setIcon(QIcon(":/resources/wifi-standby.png"));
ui->wifiBtn->setIconSize(QSize(wifiIconWidth, wifiIconHeight));
}
}
}
else {
if(lastWifiState != 1) {
lastWifiState = 1;
ui->wifiBtn->setIcon(QIcon(":/resources/wifi-off.png"));
ui->wifiBtn->setIconSize(QSize(wifiIconWidth, wifiIconHeight));
}
}
}
else {
global::device::isWifiAble = false;
ui->wifiBtn->hide();

View file

@ -49,6 +49,7 @@ public:
bool reboot_after_update = false;
bool resetFullWindowException;
bool wifiIconClickedWhileReconnecting;
int lastWifiState;
int timerTime = 0;
QString relative_path;
QString usbmsStatus;