From 4a4b4bb3adbfb6b34112317366caebbce818dba1 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sat, 2 Apr 2022 14:30:07 -0400 Subject: [PATCH] Various fixes and improvements; add special characters to virtual keyboard --- generaldialog.cpp | 7 +++- mainwindow.cpp | 2 +- reader.ui | 3 ++ searchresultswidget.cpp | 4 +- virtualkeyboard.cpp | 92 ++++++++++++++++++++++++++++++++++++----- wifidialog.cpp | 4 +- 6 files changed, 95 insertions(+), 17 deletions(-) diff --git a/generaldialog.cpp b/generaldialog.cpp index 44ceb0c..ad288bd 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -678,7 +678,8 @@ void generalDialog::waitForGutenbergSearchDone() { while(true) { if(QFile::exists("/inkbox/gutenberg-search/search_done")) { if(checkconfig("/inkbox/gutenberg-search/search_done") == true) { - QStringList searchResults = readFile("/inkbox/gutenberg-search/search_results_titles").split("\n"); + QList searchResults = readFile("/inkbox/gutenberg-search/search_results_titles").split("\n"); + searchResults.takeLast(); global::library::libraryResults = true; for(int i = ui->mainStackedWidget->count(); i >= 0; i--) { @@ -702,12 +703,14 @@ void generalDialog::waitForGutenbergSearchDone() { break; } else { + emit closeIndefiniteToast(); global::toast::delay = 3000; + global::toast::modalToast = true; emit showToast("No results found"); keyboardWidget->clearLineEdit(); global::keyboard::keyboardText = ""; QFile::remove("/inkbox/gutenberg-search/search_done"); - emit closeIndefiniteToast(); + QTimer::singleShot(3000, this, SLOT(close())); break; } } diff --git a/mainwindow.cpp b/mainwindow.cpp index da10e4d..79110c9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -913,7 +913,7 @@ void MainWindow::updateWifiIcon(int mode) { if(mode == 0) { lastWifiState = 0; QTimer *wifiIconTimer = new QTimer(this); - wifiIconTimer->setInterval(10000); + wifiIconTimer->setInterval(1000); connect(wifiIconTimer, SIGNAL(timeout()), this, SLOT(setWifiIcon())); wifiIconTimer->start(); } diff --git a/reader.ui b/reader.ui index 0874cbc..f04d0f6 100644 --- a/reader.ui +++ b/reader.ui @@ -495,6 +495,9 @@ QFrame::Plain + + 2 + Qt::Horizontal diff --git a/searchresultswidget.cpp b/searchresultswidget.cpp index dafb539..6bd9782 100644 --- a/searchresultswidget.cpp +++ b/searchresultswidget.cpp @@ -79,7 +79,7 @@ void searchResultsWidget::on_openBtn_clicked() global::keyboard::keyboardDialog = false; } else { - QMessageBox::critical(this, tr("Invalid argument"), tr("Please select a search result.")); + emit showToast("Please select a search result"); } } else { @@ -92,7 +92,7 @@ void searchResultsWidget::on_openBtn_clicked() searchResultsWidget::close(); } else { - QMessageBox::critical(this, tr("Invalid argument"), tr("Please select a search result.")); + emit showToast("Please select a search result"); } } } diff --git a/virtualkeyboard.cpp b/virtualkeyboard.cpp index a081316..f33c678 100644 --- a/virtualkeyboard.cpp +++ b/virtualkeyboard.cpp @@ -238,70 +238,120 @@ void virtualkeyboard::on_sat_clicked() void virtualkeyboard::on_n1_clicked() { - ui->lineEdit->insert("1"); + if(shift == true) { + ui->lineEdit->insert("!"); + } + else { + ui->lineEdit->insert("1"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } void virtualkeyboard::on_n2_clicked() { - ui->lineEdit->insert("2"); + if(shift == true) { + ui->lineEdit->insert("/"); + } + else { + ui->lineEdit->insert("2"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } void virtualkeyboard::on_n3_clicked() { - ui->lineEdit->insert("3"); + if(shift == true) { + ui->lineEdit->insert("#"); + } + else { + ui->lineEdit->insert("3"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } void virtualkeyboard::on_n4_clicked() { - ui->lineEdit->insert("4"); + if(shift == true) { + ui->lineEdit->insert("$"); + } + else { + ui->lineEdit->insert("4"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } void virtualkeyboard::on_n5_clicked() { - ui->lineEdit->insert("5"); + if(shift == true) { + ui->lineEdit->insert("%"); + } + else { + ui->lineEdit->insert("5"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } void virtualkeyboard::on_n6_clicked() { - ui->lineEdit->insert("6"); + if(shift == true) { + ui->lineEdit->insert("^"); + } + else { + ui->lineEdit->insert("6"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } void virtualkeyboard::on_n7_clicked() { - ui->lineEdit->insert("7"); + if(shift == true) { + ui->lineEdit->insert("&"); + } + else { + ui->lineEdit->insert("7"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } void virtualkeyboard::on_n8_clicked() { - ui->lineEdit->insert("8"); + if(shift == true) { + ui->lineEdit->insert("*"); + } + else { + ui->lineEdit->insert("8"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } void virtualkeyboard::on_n9_clicked() { - ui->lineEdit->insert("9"); + if(shift == true) { + ui->lineEdit->insert("("); + } + else { + ui->lineEdit->insert("9"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } void virtualkeyboard::on_n0_clicked() { - ui->lineEdit->insert("0"); + if(shift == true) { + ui->lineEdit->insert(")"); + } + else { + ui->lineEdit->insert("0"); + } QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; } @@ -633,6 +683,17 @@ void virtualkeyboard::reverseKeys() { if(shift == true) { ui->shiftBtn->setText("⇪"); + ui->n1->setText("!"); + ui->n2->setText("/"); + ui->n3->setText("#"); + ui->n4->setText("$"); + ui->n5->setText("%"); + ui->n6->setText("^"); + ui->n7->setText("&&"); + ui->n8->setText("*"); + ui->n9->setText("("); + ui->n0->setText(")"); + ui->la->setText("A"); ui->lb->setText("B"); ui->lc->setText("C"); @@ -663,6 +724,17 @@ void virtualkeyboard::reverseKeys() { else { ui->shiftBtn->setText("⇧"); + ui->n1->setText("1"); + ui->n2->setText("2"); + ui->n3->setText("3"); + ui->n4->setText("4"); + ui->n5->setText("5"); + ui->n6->setText("6"); + ui->n7->setText("7"); + ui->n8->setText("8"); + ui->n9->setText("9"); + ui->n0->setText("0"); + ui->la->setText("a"); ui->lb->setText("b"); ui->lc->setText("c"); diff --git a/wifidialog.cpp b/wifidialog.cpp index f0c4a8b..5c4d9ff 100644 --- a/wifidialog.cpp +++ b/wifidialog.cpp @@ -104,8 +104,8 @@ void wifiDialog::on_connectBtn_clicked() { index = ui->networksListWidget->currentIndex(); itemText = index.data(Qt::DisplayRole).toString(); - if(itemText == "") { - QMessageBox::critical(this, tr("Invalid argument"), tr("You must select a network.")); + if(itemText.isEmpty()) { + showToast("You must select a network"); } else { this->hide();