Wi-Fi: Fixes

This commit is contained in:
Nicolas Mailloux 2022-08-22 23:52:57 -04:00
parent edffb452bd
commit 3116d7d918
4 changed files with 16 additions and 19 deletions

View file

@ -778,13 +778,12 @@ void MainWindow::updateWifiIcon() {
if(currentWifiState == global::wifi::wifiState::disabled) {
if(isConnecting == true) {
if(checkconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/stopped") == false) {
QString wifiName = readFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid").replace("\n", "");
if(isReconnecting == true) {
showToast("Failed to reconnnect to " + wifiName);
showToast("Reconnection failed");
isReconnecting = false;
}
else {
showToast("Failed to connect to " + wifiName);
showToast("Connection failed");
}
isConnecting = false;
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid").remove();
@ -806,13 +805,12 @@ void MainWindow::updateWifiIcon() {
if(currentWifiState == global::wifi::wifiState::configured) {
if(isConnecting == true) {
setDefaultWorkDir();
QString wifiName = readFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid").replace("\n", "");
if(isReconnecting == true) {
showToast("Reconnected successfully to " + wifiName);
showToast("Reconnection successful");
isReconnecting = false;
}
else {
showToast("Connected successfully to " + wifiName);
showToast("Connection successful");
}
isConnecting = false;
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/stopped").remove();

View file

@ -73,13 +73,13 @@ void network::applyVariables() {
if(mainData.signal >= 0 and mainData.signal <= 25) {
ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-0.png"));
}
else if(mainData.signal >= 25 and mainData.signal <= 50) {
else if(mainData.signal >= 25 and mainData.signal < 50) {
ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-25.png"));
}
else if(mainData.signal >= 50 and mainData.signal <= 75) {
else if(mainData.signal >= 50 and mainData.signal < 75) {
ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-50.png"));
}
else if(mainData.signal >= 75 and mainData.signal <= 100) {
else if(mainData.signal >= 75 and mainData.signal < 100) {
ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-75.png"));
}
else if(mainData.signal == 100) {

View file

@ -51,16 +51,16 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>12</number>
<number>16</number>
</property>
<property name="topMargin">
<number>3</number>
<number>10</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
<number>10</number>
</property>
<item>
<widget class="QPushButton" name="signalStrengthIcon">

View file

@ -91,8 +91,7 @@ void wifiDialog::on_refreshBtn_clicked()
if(checkWifiState() == global::wifi::wifiState::disabled) {
if(refreshFromWatcher == true) {
refreshFromWatcher = false;
emit showToast("To scan, turn on wi-fi first");
log("To scan, turn on wi-fi first", className);
emit showToast("To scan, turn Wi-Fi on first");
}
}
else {
@ -159,7 +158,7 @@ void wifiDialog::refreshNetworksList() {
log("Network name is empty", className);
}
else {
log("Network name is: " + singleData, className);
log("Network name is: '" + singleData + "'", className);
}
singleNetwork.name = singleData;
}
@ -287,7 +286,7 @@ void wifiDialog::refreshNetworksList() {
}
scannedAtLeastOnce = true;
ui->refreshBtn->setEnabled(true);
ui->refreshBtn->setStyleSheet("background-color:white;");
ui->refreshBtn->setStyleSheet("background-color: white;");
scanInProgress = false;
secondScanTry = false;
}
@ -297,11 +296,11 @@ void wifiDialog::on_wifiCheckBox_stateChanged(int arg1)
{
if(ignoreCheckBoxCall == false) {
connectedNetworkDataParentSet = false;
log("wifi dialog clicked: " + QString::number(arg1), className);
log("Wi-Fi dialog checkbox clicked: " + QString::number(arg1), className);
if(wifiButtonEnabled == true) {
if(arg1 == 2) {
log("Turning Wi-Fi on", className);
// the watcher will scan wifi
// The watcher will scan Wi-Fi
QTimer::singleShot(0, this, SLOT(turnOnWifi()));
ui->stopBtn->setStyleSheet("background-color: white;");
ui->stopBtn->setEnabled(true);
@ -373,7 +372,7 @@ void wifiDialog::refreshScreenSlot() {
* get_dhcp.sh - Gets dhcp addresses
* prepare_changing_wifi.sh - Kills everything, prepares to changing network
* smarter_time_sync.sh - Syncs time
* toggle.sh - Turns on/off Wi-Fi adapter
* toggle.sh - Turns Wi-Fi adapter on/off
* list_networks - Lists networks
* check_wifi_passphrase.sh - Checks Wi-Fi network passphrase
* watcher() first watches at processes that could kill other ones