mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Wi-Fi: Fixes to prevent segfault when only one network is detected and connected
This commit is contained in:
parent
f9a1fe6931
commit
0b4d8138da
3 changed files with 59 additions and 41 deletions
|
@ -36,7 +36,7 @@ localLibraryWidget::localLibraryWidget(QWidget *parent) :
|
|||
}
|
||||
|
||||
if(global::deviceID == "n705\n") {
|
||||
bookTitleTruncateThreshold = 30;
|
||||
bookTitleTruncateThreshold = 27;
|
||||
}
|
||||
else if(global::deviceID == "n873\n") {
|
||||
bookTitleTruncateThreshold = 45;
|
||||
|
@ -57,7 +57,11 @@ localLibraryWidget::localLibraryWidget(QWidget *parent) :
|
|||
sW = QGuiApplication::screens()[0]->size().width();
|
||||
sH = QGuiApplication::screens()[0]->size().height();
|
||||
|
||||
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") {
|
||||
if(global::deviceID == "n705\n") {
|
||||
stdIconWidthDivider = 7.2;
|
||||
stdIconHeightDivider = 7.2;
|
||||
}
|
||||
else if(global::deviceID == "n905\n" or global::deviceID == "kt\n") {
|
||||
stdIconWidthDivider = 9.5;
|
||||
stdIconHeightDivider = 9.5;
|
||||
}
|
||||
|
|
|
@ -191,8 +191,15 @@ libraryWidget::~libraryWidget()
|
|||
void libraryWidget::setupView() {
|
||||
ui->booksStackedWidget->show();
|
||||
|
||||
if(global::deviceID == "n705\n") {
|
||||
stdIconWidth = sW / 7
|
||||
;
|
||||
stdIconHeight = sH / 7;
|
||||
}
|
||||
else {
|
||||
stdIconWidth = sW / 5.5;
|
||||
stdIconHeight = sH / 5.5;
|
||||
}
|
||||
|
||||
ui->book1Label->setText(readFile("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/1/title"));
|
||||
ui->book2Label->setText(readFile("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/2/title"));
|
||||
|
|
|
@ -248,6 +248,8 @@ void wifiDialog::refreshNetworksList() {
|
|||
}
|
||||
}
|
||||
|
||||
log(QString::number(pureNetworkList.count()));
|
||||
if(pureNetworkList.count() >= 1) {
|
||||
// Sort based on signal strength
|
||||
QVector<global::wifi::wifiNetworkData> sortedPureNetworkList;
|
||||
sortedPureNetworkList.append(pureNetworkList.first());
|
||||
|
@ -289,6 +291,7 @@ void wifiDialog::refreshNetworksList() {
|
|||
connect(connectedNetwork, &network::refreshScreenSignal, this, &wifiDialog::refreshScreenSlot);
|
||||
ui->scrollBarLayout->addWidget(connectedNetwork, Qt::AlignTop);
|
||||
}
|
||||
}
|
||||
scannedAtLeastOnce = true;
|
||||
ui->refreshBtn->setEnabled(true);
|
||||
ui->refreshBtn->setStyleSheet(ui->refreshBtn->styleSheet() + "background-color: white;");
|
||||
|
@ -296,7 +299,6 @@ void wifiDialog::refreshNetworksList() {
|
|||
secondScanTry = false;
|
||||
}
|
||||
|
||||
|
||||
void wifiDialog::on_wifiCheckBox_stateChanged(int arg1)
|
||||
{
|
||||
if(ignoreCheckBoxCall == false) {
|
||||
|
@ -394,7 +396,12 @@ void wifiDialog::watcher() {
|
|||
}
|
||||
|
||||
if(changing == true) {
|
||||
if(global::deviceID == "n705\n") {
|
||||
setStatusText("Disconnecting or cleaning up");
|
||||
}
|
||||
else {
|
||||
setStatusText("Disconnecting from a network or cleaning up");
|
||||
}
|
||||
log("prepare_changing_wifi.sh is active", className);
|
||||
QTimer::singleShot(relaunchMs, this, SLOT(watcher()));
|
||||
return void();
|
||||
|
|
Loading…
Reference in a new issue