fixes fixes fixes
11
src/eink.qrc
|
@ -86,9 +86,16 @@
|
||||||
<file>resources/view-highlights.png</file>
|
<file>resources/view-highlights.png</file>
|
||||||
<file>resources/stop.png</file>
|
<file>resources/stop.png</file>
|
||||||
<file>resources/refresh.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/hide.png</file>
|
||||||
<file>resources/show.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>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -756,7 +756,6 @@ void MainWindow::updateWifiIcon() {
|
||||||
* Mode 0 (looping it) is handled in mainwindow()
|
* Mode 0 (looping it) is handled in mainwindow()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
global::wifi::WifiState currentWifiState = checkWifiState();
|
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
|
// 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(lastWifiState != currentWifiState) {
|
||||||
if(currentWifiState == global::wifi::WifiState::Disabled) {
|
if(currentWifiState == global::wifi::WifiState::Disabled) {
|
||||||
if(isConnecting == true) {
|
if(isConnecting == true) {
|
||||||
setDefaultWorkDir();
|
if(checkconfig("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/stopped") == false) {
|
||||||
if(checkconfig(".config/17-wifi_connection_information/stopped") == false) {
|
QString wifiName = readFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid").replace("\n", "");
|
||||||
QString wifiName = readFile(".config/17-wifi_connection_information/essid").replace("\n", "");
|
|
||||||
if(isReconecting == true) {
|
if(isReconecting == true) {
|
||||||
showToast("Failed to reconnect to " + wifiName);
|
showToast("Failed to reconnect to " + wifiName);
|
||||||
isReconecting = false;
|
isReconecting = false;
|
||||||
|
@ -786,11 +787,11 @@ void MainWindow::updateWifiIcon() {
|
||||||
showToast("Failed to connect to " + wifiName);
|
showToast("Failed to connect to " + wifiName);
|
||||||
}
|
}
|
||||||
isConnecting = false;
|
isConnecting = false;
|
||||||
QFile(".config/17-wifi_connection_information/essid").remove();
|
QFile("/mnt/onboard/.adds/inkbox/.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/passphrase").remove();
|
||||||
}
|
}
|
||||||
else {
|
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;
|
lastWifiState = global::wifi::WifiState::Disabled;
|
||||||
|
@ -805,7 +806,7 @@ void MainWindow::updateWifiIcon() {
|
||||||
if(currentWifiState == global::wifi::WifiState::Configured) {
|
if(currentWifiState == global::wifi::WifiState::Configured) {
|
||||||
if(isConnecting == true) {
|
if(isConnecting == true) {
|
||||||
setDefaultWorkDir();
|
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) {
|
if(isReconecting == true) {
|
||||||
showToast("Reconnected successfully to " + wifiName);
|
showToast("Reconnected successfully to " + wifiName);
|
||||||
isReconecting = false;
|
isReconecting = false;
|
||||||
|
@ -814,12 +815,10 @@ void MainWindow::updateWifiIcon() {
|
||||||
showToast("Connected successfully to " + wifiName);
|
showToast("Connected successfully to " + wifiName);
|
||||||
}
|
}
|
||||||
isConnecting = false;
|
isConnecting = false;
|
||||||
QFile(".config/17-wifi_connection_information/essid").remove();
|
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/stopped").remove();
|
||||||
QFile(".config/17-wifi_connection_information/passphrase").remove();
|
|
||||||
QFile(".config/17-wifi_connection_information/stopped").remove();
|
|
||||||
}
|
}
|
||||||
lastWifiState = global::wifi::WifiState::Configured;
|
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));
|
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,21 +60,20 @@ void connectiondialog::applyVariables() {
|
||||||
passwordDatabase.flush();
|
passwordDatabase.flush();
|
||||||
passwordDatabase.close();
|
passwordDatabase.close();
|
||||||
}
|
}
|
||||||
else {
|
QString password = searchDatabase(connectedNetworkData.name);
|
||||||
QString password = searchDatabase(connectedNetworkData.name);
|
if(password.isEmpty() == false) {
|
||||||
if(password.isEmpty() == false) {
|
log("found password: " + password, className);
|
||||||
log("found password: " + password, className);
|
ui->showPasswordBtn->setIcon(QIcon("://resources/show.png"));
|
||||||
ui->showPasswordBtn->setIcon(QIcon("://resources/show.png"));
|
showedPassword = false;
|
||||||
showedPassword = false;
|
savedPassword = password;
|
||||||
savedPassword = password;
|
|
||||||
|
|
||||||
ui->passwordTextEdit->setText("********");
|
ui->passwordTextEdit->setText("********");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log("No password found", className);
|
log("No password found", className);
|
||||||
ui->passwordTextEdit->setText("No password was saved");
|
ui->passwordTextEdit->setText("No password was saved");
|
||||||
ui->showPasswordBtn->hide();
|
showedPassword = true;
|
||||||
}
|
ui->showPasswordBtn->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +91,12 @@ QString connectiondialog::searchDatabase(QString key) {
|
||||||
QString searchedName = jsonMainObject.keys().first().toUtf8();
|
QString searchedName = jsonMainObject.keys().first().toUtf8();
|
||||||
log("Found in database: " + searchedName, className);
|
log("Found in database: " + searchedName, className);
|
||||||
if(searchedName == key) {
|
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();
|
ui->showPasswordBtn->show();
|
||||||
showedPassword = true;
|
showedPassword = true;
|
||||||
savedPassword = global::keyboard::keyboardText;
|
savedPassword = global::keyboard::keyboardText;
|
||||||
|
ui->showPasswordBtn->show();
|
||||||
}
|
}
|
||||||
global::keyboard::keyboardText = "";
|
global::keyboard::keyboardText = "";
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
log("Password is not saved so ignoring text edit call", className);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -256,9 +264,16 @@ void connectiondialog::on_connectBtn_clicked()
|
||||||
finalPassword = "NONE";
|
finalPassword = "NONE";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
finalPassword = savedPassword;
|
if(savedPassword.isEmpty() == false) {
|
||||||
writeToDatabase(connectedNetworkData.name, savedPassword);
|
finalPassword = savedPassword;
|
||||||
|
writeToDatabase(connectedNetworkData.name, savedPassword);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
showToastSlot("Provide a password first");
|
||||||
|
return void();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
passwordForReconnecting = finalPassword;
|
||||||
|
|
||||||
ui->CancelBtn->setEnabled(false);
|
ui->CancelBtn->setEnabled(false);
|
||||||
if(checkWifiState() == global::wifi::WifiState::Configured) {
|
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_essid", connectedNetworkData.name.toStdString());
|
||||||
string_writeconfig("/run/wifi_network_passphrase", finalPassword.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();
|
finalConnectWait();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void connectiondialog::finalConnectWait() {
|
void connectiondialog::finalConnectWait() {
|
||||||
|
@ -293,7 +303,12 @@ void connectiondialog::finalConnectWait() {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string_writeconfig("/opt/ibxd", "connect_to_wifi_network\n");
|
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->deleteLater();
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
@ -302,7 +317,7 @@ void connectiondialog::finalConnectWait() {
|
||||||
bool connectiondialog::checkIfWifiBussy() {
|
bool connectiondialog::checkIfWifiBussy() {
|
||||||
if(checkProcessName("connect_to_network.sh") == true or
|
if(checkProcessName("connect_to_network.sh") == true or
|
||||||
checkProcessName("connection_manager.sh") == true or
|
checkProcessName("connection_manager.sh") == true or
|
||||||
checkProcessName("only_connect_to_network.sh") == true) {
|
checkProcessName("prepare_changing_wifi.sh") == true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -57,6 +57,7 @@ private:
|
||||||
bool showedPassword;
|
bool showedPassword;
|
||||||
QString savedPassword;
|
QString savedPassword;
|
||||||
int waitTry = 0;
|
int waitTry = 0;
|
||||||
|
QString passwordForReconnecting;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONNECTIONDIALOG_H
|
#endif // CONNECTIONDIALOG_H
|
||||||
|
|
|
@ -30,7 +30,11 @@ network::~network()
|
||||||
|
|
||||||
void network::applyVariables() {
|
void network::applyVariables() {
|
||||||
log("Applying variables for network", className);
|
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
|
// Limit name size, maybe device specific
|
||||||
QString cuttedSingleData = mainData.name;
|
QString cuttedSingleData = mainData.name;
|
||||||
|
@ -42,10 +46,10 @@ void network::applyVariables() {
|
||||||
ui->nameLabel->setText(cuttedSingleData);
|
ui->nameLabel->setText(cuttedSingleData);
|
||||||
|
|
||||||
if(mainData.encryption == true) {
|
if(mainData.encryption == true) {
|
||||||
ui->encryptionIcon->setIcon(QIcon("://resources/lock-fill.png"));
|
ui->encryptionIcon->setIcon(QIcon("://resources/lock.png"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->encryptionIcon->setIcon(QIcon("://resources/lock-unlock-fill.png"));
|
ui->encryptionIcon->setIcon(QIcon("://resources/public.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentlyConnectedNetwork == mainData.name) {
|
if(currentlyConnectedNetwork == mainData.name) {
|
||||||
|
|
|
@ -70,7 +70,8 @@ wifiDialog::wifiDialog(QWidget *parent) :
|
||||||
ui->stopBtn->setEnabled(false);
|
ui->stopBtn->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
// To avoid confussion with reconnecting
|
||||||
|
QTimer::singleShot(2000, this, SLOT(theWatcher()));
|
||||||
}
|
}
|
||||||
|
|
||||||
wifiDialog::~wifiDialog()
|
wifiDialog::~wifiDialog()
|
||||||
|
@ -78,102 +79,6 @@ wifiDialog::~wifiDialog()
|
||||||
delete ui;
|
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()
|
void wifiDialog::on_refreshBtn_clicked()
|
||||||
{
|
{
|
||||||
log("Clicked refresh button", className);
|
log("Clicked refresh button", className);
|
||||||
|
@ -271,12 +176,27 @@ void wifiDialog::refreshNetworksList() {
|
||||||
}
|
}
|
||||||
log("found valid networks: " + QString::number(pureNetworkList.count()), className);
|
log("found valid networks: " + QString::number(pureNetworkList.count()), className);
|
||||||
if(pureNetworkList.count() == 0) {
|
if(pureNetworkList.count() == 0) {
|
||||||
log("No networks found, skipping", className);
|
if(secondScanTry == false) {
|
||||||
showToastSlot("No networks found");
|
secondScanTry = true;
|
||||||
ui->refreshBtn->setEnabled(true);
|
if(checkWifiState() != global::wifi::WifiState::Disabled) {
|
||||||
ui->refreshBtn->setStyleSheet("background-color:white;");
|
scanInProgress = false;
|
||||||
scanInProgress = false;
|
QTimer::singleShot(0, this, SLOT(launchRefresh()));
|
||||||
return void();
|
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);
|
||||||
|
ui->refreshBtn->setStyleSheet("background-color:white;");
|
||||||
|
scanInProgress = false;
|
||||||
|
return void();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
QFile currentWifiNameFile = QFile("/external_root/run/current_wifi_name");
|
QFile currentWifiNameFile = QFile("/external_root/run/current_wifi_name");
|
||||||
currentWifiNameFile.remove();
|
currentWifiNameFile.remove();
|
||||||
|
@ -295,21 +215,16 @@ void wifiDialog::refreshNetworksList() {
|
||||||
log("Found current network in vector", className);
|
log("Found current network in vector", className);
|
||||||
vectorNetworkLocation = countVec;
|
vectorNetworkLocation = countVec;
|
||||||
currentNetwork = wifiNetwork.name;
|
currentNetwork = wifiNetwork.name;
|
||||||
log("Test", className);
|
|
||||||
network* connectedNetwork = new network;
|
network* connectedNetwork = new network;
|
||||||
connectedNetwork->mainData = wifiNetwork;
|
connectedNetwork->mainData = wifiNetwork;
|
||||||
log("Test", className);
|
|
||||||
// To be really sure that the the info is put there
|
// To be really sure that the the info is put there
|
||||||
connectedNetwork->currentlyConnectedNetwork = currentNetwork;
|
connectedNetwork->currentlyConnectedNetwork = currentNetwork;
|
||||||
log("Test", className);
|
|
||||||
connectedNetworkDataParent = wifiNetwork;
|
connectedNetworkDataParent = wifiNetwork;
|
||||||
connectedNetworkDataParentSetted = true;
|
connectedNetworkDataParentSetted = true;
|
||||||
log("Test", className);
|
|
||||||
|
|
||||||
// This doesnt work so a layout is needed
|
// This doesnt work so a layout is needed
|
||||||
// ui->scrollArea->addScrollBarWidget(connectedNetwork, Qt::AlignTop);
|
// ui->scrollArea->addScrollBarWidget(connectedNetwork, Qt::AlignTop);
|
||||||
connectedNetwork->applyVariables();
|
connectedNetwork->applyVariables();
|
||||||
log("Test", className);
|
|
||||||
connect(this, &wifiDialog::killNetworkWidgets, connectedNetwork, &network::closeWrapper);
|
connect(this, &wifiDialog::killNetworkWidgets, connectedNetwork, &network::closeWrapper);
|
||||||
connect(connectedNetwork, &network::showToastSignal, this, &wifiDialog::showToastSlot);
|
connect(connectedNetwork, &network::showToastSignal, this, &wifiDialog::showToastSlot);
|
||||||
connect(connectedNetwork, &network::refreshScreenSignal, this, &wifiDialog::refreshScreenSlot);
|
connect(connectedNetwork, &network::refreshScreenSignal, this, &wifiDialog::refreshScreenSlot);
|
||||||
|
@ -372,6 +287,7 @@ void wifiDialog::refreshNetworksList() {
|
||||||
ui->refreshBtn->setEnabled(true);
|
ui->refreshBtn->setEnabled(true);
|
||||||
ui->refreshBtn->setStyleSheet("background-color:white;");
|
ui->refreshBtn->setStyleSheet("background-color:white;");
|
||||||
scanInProgress = false;
|
scanInProgress = false;
|
||||||
|
secondScanTry = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -384,7 +300,6 @@ void wifiDialog::on_Wificheckbox_stateChanged(int arg1)
|
||||||
if(arg1 == 2) {
|
if(arg1 == 2) {
|
||||||
log("turning wifi on", className);
|
log("turning wifi on", className);
|
||||||
// the watcher will scan wifi
|
// the watcher will scan wifi
|
||||||
forceRefresh = true;
|
|
||||||
QTimer::singleShot(0, this, SLOT(turnOnWifi()));
|
QTimer::singleShot(0, this, SLOT(turnOnWifi()));
|
||||||
ui->stopBtn->setStyleSheet("background-color:white;");
|
ui->stopBtn->setStyleSheet("background-color:white;");
|
||||||
ui->stopBtn->setEnabled(true);
|
ui->stopBtn->setEnabled(true);
|
||||||
|
@ -401,7 +316,7 @@ void wifiDialog::on_Wificheckbox_stateChanged(int arg1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ignoreCheckboxCall = true;
|
ignoreCheckboxCall = false;
|
||||||
if(checkWifiState() != global::wifi::WifiState::Disabled) {
|
if(checkWifiState() != global::wifi::WifiState::Disabled) {
|
||||||
emit killNetworkWidgets();
|
emit killNetworkWidgets();
|
||||||
forceRefresh = true;
|
forceRefresh = true;
|
||||||
|
@ -415,6 +330,8 @@ void wifiDialog::on_Wificheckbox_stateChanged(int arg1)
|
||||||
|
|
||||||
void wifiDialog::turnOnWifi() {
|
void wifiDialog::turnOnWifi() {
|
||||||
string_writeconfig("/opt/ibxd", "toggle_wifi_on\n");
|
string_writeconfig("/opt/ibxd", "toggle_wifi_on\n");
|
||||||
|
// No one will notice this freeze :>
|
||||||
|
waitToScan();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wifiDialog::turnOffWifi() {
|
void wifiDialog::turnOffWifi() {
|
||||||
|
@ -464,7 +381,7 @@ void wifiDialog::theWatcher() {
|
||||||
bool changing = checkProcessName("prepare_changing_wifi.sh");
|
bool changing = checkProcessName("prepare_changing_wifi.sh");
|
||||||
if(killing == true) {
|
if(killing == true) {
|
||||||
setStatusText("Changing wifi state");
|
setStatusText("Changing wifi state");
|
||||||
log("toggle.sh is active", className);
|
//log("toggle.sh is active", className);
|
||||||
isToggleRunning = true;
|
isToggleRunning = true;
|
||||||
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
||||||
return void();
|
return void();
|
||||||
|
@ -473,7 +390,6 @@ void wifiDialog::theWatcher() {
|
||||||
if(changing == true) {
|
if(changing == true) {
|
||||||
setStatusText("Disconnecting from a network or cleaning");
|
setStatusText("Disconnecting from a network or cleaning");
|
||||||
log("prepare_changing_wifi.sh is active", className);
|
log("prepare_changing_wifi.sh is active", className);
|
||||||
forceRefresh = true;
|
|
||||||
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
||||||
return void();
|
return void();
|
||||||
}
|
}
|
||||||
|
@ -481,13 +397,13 @@ void wifiDialog::theWatcher() {
|
||||||
bool recconection = checkProcessName("connect_to_network.sh");
|
bool recconection = checkProcessName("connect_to_network.sh");
|
||||||
if(recconection == true) {
|
if(recconection == true) {
|
||||||
forceRefresh = 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) {
|
if(recName.exists() == true) {
|
||||||
setStatusText("Recconecting after suspending to " + readFile(recName.fileName()).replace("\n", ""));
|
setStatusText("Recconecting after suspending to " + readFile(recName.fileName()).replace("\n", ""));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Shouldn't be possible
|
// Shouldn't be possible
|
||||||
setStatusText("Recconecting after sleep, but no network found?");
|
setStatusText("Recconecting after sleep");
|
||||||
}
|
}
|
||||||
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
||||||
return void();
|
return void();
|
||||||
|
@ -538,12 +454,6 @@ void wifiDialog::theWatcher() {
|
||||||
setStatusText("Idling");
|
setStatusText("Idling");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(forceRefresh == true) {
|
|
||||||
forceRefresh = false;
|
|
||||||
refreshFromWatcher = true;
|
|
||||||
ui->refreshBtn->click();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(unlockCheckbox == true) {
|
if(unlockCheckbox == true) {
|
||||||
ui->Wificheckbox->setEnabled(true);
|
ui->Wificheckbox->setEnabled(true);
|
||||||
unlockCheckbox = false;
|
unlockCheckbox = false;
|
||||||
|
@ -553,6 +463,8 @@ void wifiDialog::theWatcher() {
|
||||||
isToggleRunning = false;
|
isToggleRunning = false;
|
||||||
// To make sure the checkbox is in the right state
|
// To make sure the checkbox is in the right state
|
||||||
if(checkWifiState() == global::wifi::WifiState::Disabled) {
|
if(checkWifiState() == global::wifi::WifiState::Disabled) {
|
||||||
|
// In this state, ignore forceRefresh to avoid message
|
||||||
|
forceRefresh = false;
|
||||||
if(ui->Wificheckbox->isChecked() == true) {
|
if(ui->Wificheckbox->isChecked() == true) {
|
||||||
ignoreCheckboxCall = true;
|
ignoreCheckboxCall = true;
|
||||||
ui->Wificheckbox->setChecked(false);
|
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()));
|
QTimer::singleShot(relaunchMs, this, SLOT(theWatcher()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,23 +493,25 @@ void wifiDialog::setStatusText(QString message) {
|
||||||
|
|
||||||
void wifiDialog::on_stopBtn_clicked()
|
void wifiDialog::on_stopBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Stop button was clicked", className);
|
||||||
connectedNetworkDataParentSetted = false;
|
connectedNetworkDataParentSetted = false;
|
||||||
ui->Wificheckbox->setEnabled(false);
|
ui->Wificheckbox->setEnabled(false);
|
||||||
unlockCheckbox = true;
|
unlockCheckbox = true;
|
||||||
|
|
||||||
// To inform the wifi icon GUI to don't show the connected / failed to connect message
|
// 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
|
// Maybe limit this, idk
|
||||||
string_writeconfig("/opt/ibxd", "stop_wifi_operations\n");
|
string_writeconfig("/opt/ibxd", "stop_wifi_operations\n");
|
||||||
|
|
||||||
setDefaultWorkDir();
|
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/essid").remove();
|
||||||
QFile(".config/17-wifi_connection_information/essid").remove();
|
QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passphrase").remove();
|
||||||
QFile(".config/17-wifi_connection_information/passphrase").remove();
|
|
||||||
|
|
||||||
// This variable just avoids showing the toast so i can use it here too...
|
// This variable just avoids showing the toast so i can use it here too...
|
||||||
refreshFromWatcher = true;
|
// Actually refreshing from watcher is smarter so this isin't needed
|
||||||
ui->refreshBtn->click();
|
//refreshFromWatcher = true;
|
||||||
|
//ui->refreshBtn->click();
|
||||||
|
waitToScan();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wifiDialog::on_returnBtn_clicked()
|
void wifiDialog::on_returnBtn_clicked()
|
||||||
|
@ -599,3 +519,12 @@ void wifiDialog::on_returnBtn_clicked()
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
this->close();
|
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 isToggleRunning = false;
|
||||||
bool ignoreCheckboxCall = false;
|
bool ignoreCheckboxCall = false;
|
||||||
|
|
||||||
|
bool secondScanTry = false;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void launchRefresh();
|
void launchRefresh();
|
||||||
void refreshNetworksList();
|
void refreshNetworksList();
|
||||||
|
@ -70,6 +72,7 @@ private slots:
|
||||||
void setStatusText(QString message);
|
void setStatusText(QString message);
|
||||||
void on_stopBtn_clicked();
|
void on_stopBtn_clicked();
|
||||||
void on_returnBtn_clicked();
|
void on_returnBtn_clicked();
|
||||||
|
void waitToScan();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WIFIDIALOG_H
|
#endif // WIFIDIALOG_H
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QScrollBar>
|
||||||
|
|
||||||
#include "wifilogger.h"
|
#include "wifilogger.h"
|
||||||
#include "ui_wifilogger.h"
|
#include "ui_wifilogger.h"
|
||||||
|
@ -17,6 +18,11 @@ wifilogger::wifilogger(QWidget *parent) :
|
||||||
stylesheetFile.close();
|
stylesheetFile.close();
|
||||||
this->setModal(true);
|
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);
|
log("Entered wifilogger", className);
|
||||||
setWifiInfoPage();
|
setWifiInfoPage();
|
||||||
|
|