fixes fixes fixes
11
src/eink.qrc
|
@ -86,9 +86,16 @@
|
|||
<file>resources/view-highlights.png</file>
|
||||
<file>resources/stop.png</file>
|
||||
<file>resources/refresh.png</file>
|
||||
<file>resources/lock-fill.png</file>
|
||||
<file>resources/lock-unlock-fill.png</file>
|
||||
<file>resources/hide.png</file>
|
||||
<file>resources/show.png</file>
|
||||
<file>resources/christie.jpg</file>
|
||||
<file>resources/encryption-small.png</file>
|
||||
<file>resources/lock.png</file>
|
||||
<file>resources/public.png</file>
|
||||
<file>resources/wifi-0.png</file>
|
||||
<file>resources/wifi-100.png</file>
|
||||
<file>resources/wifi-25.png</file>
|
||||
<file>resources/wifi-50.png</file>
|
||||
<file>resources/wifi-75.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -756,7 +756,6 @@ void MainWindow::updateWifiIcon() {
|
|||
* Mode 0 (looping it) is handled in mainwindow()
|
||||
*/
|
||||
|
||||
|
||||
global::wifi::WifiState currentWifiState = checkWifiState();
|
||||
|
||||
// Its executing only in Enabled mode, which is a mode between connected and disabled so don't worry about performance
|
||||
|
@ -772,12 +771,14 @@ void MainWindow::updateWifiIcon() {
|
|||
}
|
||||
}
|
||||
|
||||
// Ms can make diffrence so:
|
||||
currentWifiState = checkWifiState();
|
||||
|
||||
if(lastWifiState != currentWifiState) {
|
||||
if(currentWifiState == global::wifi::WifiState::Disabled) {
|
||||
if(isConnecting == true) {
|
||||
setDefaultWorkDir();
|
||||
if(checkconfig(".config/17-wifi_connection_information/stopped") == false) {
|
||||
QString wifiName = readFile(".config/17-wifi_connection_information/essid").replace("\n", "");
|
||||
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(isReconecting == true) {
|
||||
showToast("Failed to reconnect to " + wifiName);
|
||||
isReconecting = false;
|
||||
|
@ -786,11 +787,11 @@ void MainWindow::updateWifiIcon() {
|
|||
showToast("Failed to connect to " + wifiName);
|
||||
}
|
||||
isConnecting = false;
|
||||
QFile(".config/17-wifi_connection_information/essid").remove();
|
||||
QFile(".config/17-wifi_connection_information/passphrase").remove();
|
||||
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid").remove();
|
||||
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passphrase").remove();
|
||||
}
|
||||
else {
|
||||
QFile(".config/17-wifi_connection_information/stopped").remove();
|
||||
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/stopped").remove();
|
||||
}
|
||||
}
|
||||
lastWifiState = global::wifi::WifiState::Disabled;
|
||||
|
@ -805,7 +806,7 @@ void MainWindow::updateWifiIcon() {
|
|||
if(currentWifiState == global::wifi::WifiState::Configured) {
|
||||
if(isConnecting == true) {
|
||||
setDefaultWorkDir();
|
||||
QString wifiName = readFile(".config/17-wifi_connection_information/essid").replace("\n", "");
|
||||
QString wifiName = readFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid").replace("\n", "");
|
||||
if(isReconecting == true) {
|
||||
showToast("Reconnected successfully to " + wifiName);
|
||||
isReconecting = false;
|
||||
|
@ -814,12 +815,10 @@ void MainWindow::updateWifiIcon() {
|
|||
showToast("Connected successfully to " + wifiName);
|
||||
}
|
||||
isConnecting = false;
|
||||
QFile(".config/17-wifi_connection_information/essid").remove();
|
||||
QFile(".config/17-wifi_connection_information/passphrase").remove();
|
||||
QFile(".config/17-wifi_connection_information/stopped").remove();
|
||||
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/stopped").remove();
|
||||
}
|
||||
lastWifiState = global::wifi::WifiState::Configured;
|
||||
ui->wifiBtn->setIcon(QIcon(":/resources/wifi-connected.png"));
|
||||
ui->wifiBtn->setIcon(QIcon("://resources/wifi-100.png"));
|
||||
ui->wifiBtn->setIconSize(QSize(wifiIconWidth, wifiIconHeight));
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 291 B |
BIN
src/resources/lock.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
src/resources/public.png
Normal file
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 8.3 KiB |
BIN
src/resources/wifi-0.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
src/resources/wifi-100.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
src/resources/wifi-25.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
src/resources/wifi-50.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
src/resources/wifi-75.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 9.9 KiB |
|
@ -60,7 +60,6 @@ void connectiondialog::applyVariables() {
|
|||
passwordDatabase.flush();
|
||||
passwordDatabase.close();
|
||||
}
|
||||
else {
|
||||
QString password = searchDatabase(connectedNetworkData.name);
|
||||
if(password.isEmpty() == false) {
|
||||
log("found password: " + password, className);
|
||||
|
@ -73,11 +72,11 @@ void connectiondialog::applyVariables() {
|
|||
else {
|
||||
log("No password found", className);
|
||||
ui->passwordTextEdit->setText("No password was saved");
|
||||
showedPassword = true;
|
||||
ui->showPasswordBtn->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString connectiondialog::searchDatabase(QString key) {
|
||||
passwordDatabase.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
|
@ -92,7 +91,12 @@ QString connectiondialog::searchDatabase(QString key) {
|
|||
QString searchedName = jsonMainObject.keys().first().toUtf8();
|
||||
log("Found in database: " + searchedName, className);
|
||||
if(searchedName == key) {
|
||||
return jsonMainObject.take(key).toString();
|
||||
QString returnedPassword = jsonMainObject.value(key).toString();
|
||||
log("Searched name " + searchedName + " matched " + key + " and the password is: " + returnedPassword, className);
|
||||
return returnedPassword;
|
||||
}
|
||||
else {
|
||||
log("Searched name " + searchedName + " Doesn't match " + key, className);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -215,9 +219,13 @@ void connectiondialog::on_passwordTextEdit_cursorPositionChanged(int oldpos, int
|
|||
ui->showPasswordBtn->show();
|
||||
showedPassword = true;
|
||||
savedPassword = global::keyboard::keyboardText;
|
||||
ui->showPasswordBtn->show();
|
||||
}
|
||||
global::keyboard::keyboardText = "";
|
||||
}
|
||||
else {
|
||||
log("Password is not saved so ignoring text edit call", className);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -256,9 +264,16 @@ void connectiondialog::on_connectBtn_clicked()
|
|||
finalPassword = "NONE";
|
||||
}
|
||||
else {
|
||||
if(savedPassword.isEmpty() == false) {
|
||||
finalPassword = savedPassword;
|
||||
writeToDatabase(connectedNetworkData.name, savedPassword);
|
||||
}
|
||||
else {
|
||||
showToastSlot("Provide a password first");
|
||||
return void();
|
||||
}
|
||||
}
|
||||
passwordForReconnecting = finalPassword;
|
||||
|
||||
ui->CancelBtn->setEnabled(false);
|
||||
if(checkWifiState() == global::wifi::WifiState::Configured) {
|
||||
|
@ -266,12 +281,7 @@ void connectiondialog::on_connectBtn_clicked()
|
|||
}
|
||||
string_writeconfig("/run/wifi_network_essid", connectedNetworkData.name.toStdString());
|
||||
string_writeconfig("/run/wifi_network_passphrase", finalPassword.toStdString());
|
||||
setDefaultWorkDir();
|
||||
// This will be deleited later in mainwindow icon updater if it failed
|
||||
string_writeconfig(".config/17-wifi_connection_information/essid", connectedNetworkData.name.toStdString());
|
||||
string_writeconfig(".config/17-wifi_connection_information/passphrase", finalPassword.toStdString());
|
||||
finalConnectWait();
|
||||
|
||||
}
|
||||
|
||||
void connectiondialog::finalConnectWait() {
|
||||
|
@ -293,7 +303,12 @@ void connectiondialog::finalConnectWait() {
|
|||
}
|
||||
else {
|
||||
string_writeconfig("/opt/ibxd", "connect_to_wifi_network\n");
|
||||
ui->CancelBtn->setEnabled(true);
|
||||
|
||||
// This will be deleted later in mainwindow icon updater if it failed. Its also deleted in stop wifi script
|
||||
log("Writing to config dir with connection data", className);
|
||||
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid", connectedNetworkData.name.toStdString());
|
||||
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passphrase", passwordForReconnecting.toStdString());
|
||||
|
||||
this->deleteLater();
|
||||
this->close();
|
||||
}
|
||||
|
@ -302,7 +317,7 @@ void connectiondialog::finalConnectWait() {
|
|||
bool connectiondialog::checkIfWifiBussy() {
|
||||
if(checkProcessName("connect_to_network.sh") == true or
|
||||
checkProcessName("connection_manager.sh") == true or
|
||||
checkProcessName("only_connect_to_network.sh") == true) {
|
||||
checkProcessName("prepare_changing_wifi.sh") == true) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -57,6 +57,7 @@ private:
|
|||
bool showedPassword;
|
||||
QString savedPassword;
|
||||
int waitTry = 0;
|
||||
QString passwordForReconnecting;
|
||||
};
|
||||
|
||||
#endif // CONNECTIONDIALOG_H
|
||||
|
|
|
@ -30,7 +30,11 @@ network::~network()
|
|||
|
||||
void network::applyVariables() {
|
||||
log("Applying variables for network", className);
|
||||
ui->signalStrengthLabel->setText(QString::number(mainData.signal) + "%");
|
||||
QString percent = "%";
|
||||
if(mainData.signal < 100) {
|
||||
percent.append(" ");
|
||||
}
|
||||
ui->signalStrengthLabel->setText(QString::number(mainData.signal) + percent);
|
||||
|
||||
// Limit name size, maybe device specific
|
||||
QString cuttedSingleData = mainData.name;
|
||||
|
@ -42,10 +46,10 @@ void network::applyVariables() {
|
|||
ui->nameLabel->setText(cuttedSingleData);
|
||||
|
||||
if(mainData.encryption == true) {
|
||||
ui->encryptionIcon->setIcon(QIcon("://resources/lock-fill.png"));
|
||||
ui->encryptionIcon->setIcon(QIcon("://resources/lock.png"));
|
||||
}
|
||||
else {
|
||||
ui->encryptionIcon->setIcon(QIcon("://resources/lock-unlock-fill.png"));
|
||||
ui->encryptionIcon->setIcon(QIcon("://resources/public.png"));
|
||||
}
|
||||
|
||||
if(currentlyConnectedNetwork == mainData.name) {
|
||||
|
|
|
@ -70,7 +70,8 @@ wifiDialog::wifiDialog(QWidget *parent) :
|
|||
ui->stopBtn->setEnabled(false);
|
||||
}
|
||||
|
||||
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
||||
// To avoid confussion with reconnecting
|
||||
QTimer::singleShot(2000, this, SLOT(theWatcher()));
|
||||
}
|
||||
|
||||
wifiDialog::~wifiDialog()
|
||||
|
@ -78,102 +79,6 @@ wifiDialog::~wifiDialog()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
this->hide();
|
||||
global::keyboard::keyboardDialog = true;
|
||||
global::keyboard::wifiPassphraseDialog = true;
|
||||
global::keyboard::keyboardText = "";
|
||||
generalDialogWindow = new generalDialog();
|
||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
generalDialogWindow->wifiEssid = itemText;
|
||||
connect(generalDialogWindow, SIGNAL(refreshScreen()), SLOT(refreshScreenNative()));
|
||||
connect(generalDialogWindow, SIGNAL(updateWifiIcon(int)), SLOT(updateWifiIcon(int)));
|
||||
connect(generalDialogWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
|
||||
connect(generalDialogWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative()));
|
||||
connect(generalDialogWindow, SIGNAL(destroyed(QObject*)), SLOT(close()));
|
||||
generalDialogWindow->show();
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
bool connectToNetwork(QString essid, QString passphrase) {
|
||||
log("Connecting to network '" + essid + "'", "functions");
|
||||
std::string essid_str = essid.toStdString();
|
||||
std::string passphrase_str = passphrase.toStdString();
|
||||
string_writeconfig("/run/wifi_network_essid", essid_str);
|
||||
string_writeconfig("/run/wifi_network_passphrase", passphrase_str);
|
||||
string_writeconfig("/opt/ibxd", "connect_to_wifi_network\n");
|
||||
|
||||
int connectionSuccessful = 0;
|
||||
|
||||
while(connectionSuccessful == 0) {
|
||||
if(QFile::exists("/run/wifi_connected_successfully")) {
|
||||
if(checkconfig("/run/wifi_connected_successfully") == true) {
|
||||
QFile::remove("/run/wifi_connected_successfully");
|
||||
connectionSuccessful = 1;
|
||||
global::network::isConnected = true;
|
||||
setDefaultWorkDir();
|
||||
string_writeconfig(".config/17-wifi_connection_information/essid", essid_str);
|
||||
string_writeconfig(".config/17-wifi_connection_information/passphrase", passphrase_str);
|
||||
QString function = __func__; log(function + ": Connection successful", "functions");
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
QFile::remove("/run/wifi_connected_successfully");
|
||||
connectionSuccessful = 0;
|
||||
global::network::isConnected = false;
|
||||
QString function = __func__; log(function + ": Connection failed", "functions");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
QThread::msleep(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
int testPing(bool blocking) {
|
||||
QProcess *pingProcess = new QProcess();
|
||||
if(blocking == true) {
|
||||
QString pingProg = "ping";
|
||||
QStringList pingArgs;
|
||||
pingArgs << "-c" << "1" << "1.1.1.1";
|
||||
pingProcess->start(pingProg, pingArgs);
|
||||
pingProcess->waitForFinished();
|
||||
int exitCode = pingProcess->exitCode();
|
||||
pingProcess->deleteLater();
|
||||
if(exitCode == 0) {
|
||||
global::network::isConnected = true;
|
||||
}
|
||||
else {
|
||||
global::network::isConnected = false;
|
||||
}
|
||||
return exitCode;
|
||||
}
|
||||
// For some reason, implementing a non-blocking version of this functions triggers a "terminate called without an active exception" error with a platform plugin compiled with a newer GCC 11 toolchain. The problem has been solved by transplanting this function into the related area which uses it.
|
||||
pingProcess->deleteLater();
|
||||
}
|
||||
bool getTestPingResults() {
|
||||
// To be used when the testPing() function is used in non-blocking mode.
|
||||
if(QFile::exists("/run/test_ping_status")) {
|
||||
if(checkconfig("/run/test_ping_status") == true) {
|
||||
global::network::isConnected = true;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
global::network::isConnected = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
global::network::isConnected = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void wifiDialog::on_refreshBtn_clicked()
|
||||
{
|
||||
log("Clicked refresh button", className);
|
||||
|
@ -271,6 +176,20 @@ void wifiDialog::refreshNetworksList() {
|
|||
}
|
||||
log("found valid networks: " + QString::number(pureNetworkList.count()), className);
|
||||
if(pureNetworkList.count() == 0) {
|
||||
if(secondScanTry == false) {
|
||||
secondScanTry = true;
|
||||
if(checkWifiState() != global::wifi::WifiState::Disabled) {
|
||||
scanInProgress = false;
|
||||
QTimer::singleShot(0, this, SLOT(launchRefresh()));
|
||||
log("No networks found. Trying one more time");
|
||||
return void();
|
||||
}
|
||||
else {
|
||||
return void();
|
||||
}
|
||||
}
|
||||
else {
|
||||
secondScanTry = false;
|
||||
log("No networks found, skipping", className);
|
||||
showToastSlot("No networks found");
|
||||
ui->refreshBtn->setEnabled(true);
|
||||
|
@ -278,6 +197,7 @@ void wifiDialog::refreshNetworksList() {
|
|||
scanInProgress = false;
|
||||
return void();
|
||||
}
|
||||
}
|
||||
QFile currentWifiNameFile = QFile("/external_root/run/current_wifi_name");
|
||||
currentWifiNameFile.remove();
|
||||
string_writeconfig("/opt/ibxd", "get_current_wifi_name\n");
|
||||
|
@ -295,21 +215,16 @@ void wifiDialog::refreshNetworksList() {
|
|||
log("Found current network in vector", className);
|
||||
vectorNetworkLocation = countVec;
|
||||
currentNetwork = wifiNetwork.name;
|
||||
log("Test", className);
|
||||
network* connectedNetwork = new network;
|
||||
connectedNetwork->mainData = wifiNetwork;
|
||||
log("Test", className);
|
||||
// To be really sure that the the info is put there
|
||||
connectedNetwork->currentlyConnectedNetwork = currentNetwork;
|
||||
log("Test", className);
|
||||
connectedNetworkDataParent = wifiNetwork;
|
||||
connectedNetworkDataParentSetted = true;
|
||||
log("Test", className);
|
||||
|
||||
// This doesnt work so a layout is needed
|
||||
// ui->scrollArea->addScrollBarWidget(connectedNetwork, Qt::AlignTop);
|
||||
connectedNetwork->applyVariables();
|
||||
log("Test", className);
|
||||
connect(this, &wifiDialog::killNetworkWidgets, connectedNetwork, &network::closeWrapper);
|
||||
connect(connectedNetwork, &network::showToastSignal, this, &wifiDialog::showToastSlot);
|
||||
connect(connectedNetwork, &network::refreshScreenSignal, this, &wifiDialog::refreshScreenSlot);
|
||||
|
@ -372,6 +287,7 @@ void wifiDialog::refreshNetworksList() {
|
|||
ui->refreshBtn->setEnabled(true);
|
||||
ui->refreshBtn->setStyleSheet("background-color:white;");
|
||||
scanInProgress = false;
|
||||
secondScanTry = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -384,7 +300,6 @@ void wifiDialog::on_Wificheckbox_stateChanged(int arg1)
|
|||
if(arg1 == 2) {
|
||||
log("turning wifi on", className);
|
||||
// the watcher will scan wifi
|
||||
forceRefresh = true;
|
||||
QTimer::singleShot(0, this, SLOT(turnOnWifi()));
|
||||
ui->stopBtn->setStyleSheet("background-color:white;");
|
||||
ui->stopBtn->setEnabled(true);
|
||||
|
@ -401,7 +316,7 @@ void wifiDialog::on_Wificheckbox_stateChanged(int arg1)
|
|||
}
|
||||
}
|
||||
else {
|
||||
ignoreCheckboxCall = true;
|
||||
ignoreCheckboxCall = false;
|
||||
if(checkWifiState() != global::wifi::WifiState::Disabled) {
|
||||
emit killNetworkWidgets();
|
||||
forceRefresh = true;
|
||||
|
@ -415,6 +330,8 @@ void wifiDialog::on_Wificheckbox_stateChanged(int arg1)
|
|||
|
||||
void wifiDialog::turnOnWifi() {
|
||||
string_writeconfig("/opt/ibxd", "toggle_wifi_on\n");
|
||||
// No one will notice this freeze :>
|
||||
waitToScan();
|
||||
}
|
||||
|
||||
void wifiDialog::turnOffWifi() {
|
||||
|
@ -464,7 +381,7 @@ void wifiDialog::theWatcher() {
|
|||
bool changing = checkProcessName("prepare_changing_wifi.sh");
|
||||
if(killing == true) {
|
||||
setStatusText("Changing wifi state");
|
||||
log("toggle.sh is active", className);
|
||||
//log("toggle.sh is active", className);
|
||||
isToggleRunning = true;
|
||||
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
||||
return void();
|
||||
|
@ -473,7 +390,6 @@ void wifiDialog::theWatcher() {
|
|||
if(changing == true) {
|
||||
setStatusText("Disconnecting from a network or cleaning");
|
||||
log("prepare_changing_wifi.sh is active", className);
|
||||
forceRefresh = true;
|
||||
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
||||
return void();
|
||||
}
|
||||
|
@ -481,13 +397,13 @@ void wifiDialog::theWatcher() {
|
|||
bool recconection = checkProcessName("connect_to_network.sh");
|
||||
if(recconection == true) {
|
||||
forceRefresh = true;
|
||||
QFile recName = QFile(".config/17-wifi_connection_information/essid");
|
||||
QFile recName = QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid");
|
||||
if(recName.exists() == true) {
|
||||
setStatusText("Recconecting after suspending to " + readFile(recName.fileName()).replace("\n", ""));
|
||||
}
|
||||
else {
|
||||
// Shouldn't be possible
|
||||
setStatusText("Recconecting after sleep, but no network found?");
|
||||
setStatusText("Recconecting after sleep");
|
||||
}
|
||||
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
||||
return void();
|
||||
|
@ -538,12 +454,6 @@ void wifiDialog::theWatcher() {
|
|||
setStatusText("Idling");
|
||||
}
|
||||
|
||||
if(forceRefresh == true) {
|
||||
forceRefresh = false;
|
||||
refreshFromWatcher = true;
|
||||
ui->refreshBtn->click();
|
||||
}
|
||||
|
||||
if(unlockCheckbox == true) {
|
||||
ui->Wificheckbox->setEnabled(true);
|
||||
unlockCheckbox = false;
|
||||
|
@ -553,6 +463,8 @@ void wifiDialog::theWatcher() {
|
|||
isToggleRunning = false;
|
||||
// To make sure the checkbox is in the right state
|
||||
if(checkWifiState() == global::wifi::WifiState::Disabled) {
|
||||
// In this state, ignore forceRefresh to avoid message
|
||||
forceRefresh = false;
|
||||
if(ui->Wificheckbox->isChecked() == true) {
|
||||
ignoreCheckboxCall = true;
|
||||
ui->Wificheckbox->setChecked(false);
|
||||
|
@ -566,6 +478,12 @@ void wifiDialog::theWatcher() {
|
|||
}
|
||||
}
|
||||
|
||||
if(forceRefresh == true) {
|
||||
forceRefresh = false;
|
||||
refreshFromWatcher = true;
|
||||
QTimer::singleShot(1500, this, SLOT(waitToScan()));
|
||||
}
|
||||
|
||||
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
||||
}
|
||||
|
||||
|
@ -575,23 +493,25 @@ void wifiDialog::setStatusText(QString message) {
|
|||
|
||||
void wifiDialog::on_stopBtn_clicked()
|
||||
{
|
||||
log("Stop button was clicked", className);
|
||||
connectedNetworkDataParentSetted = false;
|
||||
ui->Wificheckbox->setEnabled(false);
|
||||
unlockCheckbox = true;
|
||||
|
||||
// To inform the wifi icon GUI to don't show the connected / failed to connect message
|
||||
string_writeconfig(".config/17-wifi_connection_information/stopped", "true");
|
||||
string_writeconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/stopped", "true");
|
||||
|
||||
// Maybe limit this, idk
|
||||
string_writeconfig("/opt/ibxd", "stop_wifi_operations\n");
|
||||
|
||||
setDefaultWorkDir();
|
||||
QFile(".config/17-wifi_connection_information/essid").remove();
|
||||
QFile(".config/17-wifi_connection_information/passphrase").remove();
|
||||
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid").remove();
|
||||
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passphrase").remove();
|
||||
|
||||
// This variable just avoids showing the toast so i can use it here too...
|
||||
refreshFromWatcher = true;
|
||||
ui->refreshBtn->click();
|
||||
// Actually refreshing from watcher is smarter so this isin't needed
|
||||
//refreshFromWatcher = true;
|
||||
//ui->refreshBtn->click();
|
||||
waitToScan();
|
||||
}
|
||||
|
||||
void wifiDialog::on_returnBtn_clicked()
|
||||
|
@ -599,3 +519,12 @@ void wifiDialog::on_returnBtn_clicked()
|
|||
this->deleteLater();
|
||||
this->close();
|
||||
}
|
||||
|
||||
void wifiDialog::waitToScan() {
|
||||
if(checkWifiState() != global::wifi::WifiState::Disabled) {
|
||||
ui->refreshBtn->click();
|
||||
}
|
||||
else {
|
||||
QTimer::singleShot(750, this, SLOT(waitToScan()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ private:
|
|||
bool isToggleRunning = false;
|
||||
bool ignoreCheckboxCall = false;
|
||||
|
||||
bool secondScanTry = false;
|
||||
|
||||
public slots:
|
||||
void launchRefresh();
|
||||
void refreshNetworksList();
|
||||
|
@ -70,6 +72,7 @@ private slots:
|
|||
void setStatusText(QString message);
|
||||
void on_stopBtn_clicked();
|
||||
void on_returnBtn_clicked();
|
||||
void waitToScan();
|
||||
};
|
||||
|
||||
#endif // WIFIDIALOG_H
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <QFile>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "wifilogger.h"
|
||||
#include "ui_wifilogger.h"
|
||||
|
@ -17,6 +18,11 @@ wifilogger::wifilogger(QWidget *parent) :
|
|||
stylesheetFile.close();
|
||||
this->setModal(true);
|
||||
|
||||
// Scroll bar
|
||||
// Needed for the nia.
|
||||
ui->allLogsText->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 50px; }");
|
||||
ui->fancyLogsText->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 50px; }");
|
||||
|
||||
|
||||
log("Entered wifilogger", className);
|
||||
setWifiInfoPage();
|
||||
|
|