Various fixes and improvements; add special characters to virtual keyboard

This commit is contained in:
Nicolas Mailloux 2022-04-02 14:30:07 -04:00
parent dc93feed17
commit 4a4b4bb3ad
6 changed files with 95 additions and 17 deletions

View file

@ -678,7 +678,8 @@ void generalDialog::waitForGutenbergSearchDone() {
while(true) { while(true) {
if(QFile::exists("/inkbox/gutenberg-search/search_done")) { if(QFile::exists("/inkbox/gutenberg-search/search_done")) {
if(checkconfig("/inkbox/gutenberg-search/search_done") == true) { if(checkconfig("/inkbox/gutenberg-search/search_done") == true) {
QStringList searchResults = readFile("/inkbox/gutenberg-search/search_results_titles").split("\n"); QList<QString> searchResults = readFile("/inkbox/gutenberg-search/search_results_titles").split("\n");
searchResults.takeLast();
global::library::libraryResults = true; global::library::libraryResults = true;
for(int i = ui->mainStackedWidget->count(); i >= 0; i--) { for(int i = ui->mainStackedWidget->count(); i >= 0; i--) {
@ -702,12 +703,14 @@ void generalDialog::waitForGutenbergSearchDone() {
break; break;
} }
else { else {
emit closeIndefiniteToast();
global::toast::delay = 3000; global::toast::delay = 3000;
global::toast::modalToast = true;
emit showToast("No results found"); emit showToast("No results found");
keyboardWidget->clearLineEdit(); keyboardWidget->clearLineEdit();
global::keyboard::keyboardText = ""; global::keyboard::keyboardText = "";
QFile::remove("/inkbox/gutenberg-search/search_done"); QFile::remove("/inkbox/gutenberg-search/search_done");
emit closeIndefiniteToast(); QTimer::singleShot(3000, this, SLOT(close()));
break; break;
} }
} }

View file

@ -913,7 +913,7 @@ void MainWindow::updateWifiIcon(int mode) {
if(mode == 0) { if(mode == 0) {
lastWifiState = 0; lastWifiState = 0;
QTimer *wifiIconTimer = new QTimer(this); QTimer *wifiIconTimer = new QTimer(this);
wifiIconTimer->setInterval(10000); wifiIconTimer->setInterval(1000);
connect(wifiIconTimer, SIGNAL(timeout()), this, SLOT(setWifiIcon())); connect(wifiIconTimer, SIGNAL(timeout()), this, SLOT(setWifiIcon()));
wifiIconTimer->start(); wifiIconTimer->start();
} }

View file

@ -495,6 +495,9 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>

View file

@ -79,7 +79,7 @@ void searchResultsWidget::on_openBtn_clicked()
global::keyboard::keyboardDialog = false; global::keyboard::keyboardDialog = false;
} }
else { else {
QMessageBox::critical(this, tr("Invalid argument"), tr("Please select a search result.")); emit showToast("Please select a search result");
} }
} }
else { else {
@ -92,7 +92,7 @@ void searchResultsWidget::on_openBtn_clicked()
searchResultsWidget::close(); searchResultsWidget::close();
} }
else { else {
QMessageBox::critical(this, tr("Invalid argument"), tr("Please select a search result.")); emit showToast("Please select a search result");
} }
} }
} }

View file

@ -238,70 +238,120 @@ void virtualkeyboard::on_sat_clicked()
void virtualkeyboard::on_n1_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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
void virtualkeyboard::on_n2_clicked() 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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
void virtualkeyboard::on_n3_clicked() 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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
void virtualkeyboard::on_n4_clicked() 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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
void virtualkeyboard::on_n5_clicked() 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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
void virtualkeyboard::on_n6_clicked() 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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
void virtualkeyboard::on_n7_clicked() 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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
void virtualkeyboard::on_n8_clicked() 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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
void virtualkeyboard::on_n9_clicked() 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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
void virtualkeyboard::on_n0_clicked() 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(); QString text = ui->lineEdit->text();
global::keyboard::keyboardText = text; global::keyboard::keyboardText = text;
} }
@ -633,6 +683,17 @@ void virtualkeyboard::reverseKeys() {
if(shift == true) { if(shift == true) {
ui->shiftBtn->setText(""); 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->la->setText("A");
ui->lb->setText("B"); ui->lb->setText("B");
ui->lc->setText("C"); ui->lc->setText("C");
@ -663,6 +724,17 @@ void virtualkeyboard::reverseKeys() {
else { else {
ui->shiftBtn->setText(""); 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->la->setText("a");
ui->lb->setText("b"); ui->lb->setText("b");
ui->lc->setText("c"); ui->lc->setText("c");

View file

@ -104,8 +104,8 @@ void wifiDialog::on_connectBtn_clicked()
{ {
index = ui->networksListWidget->currentIndex(); index = ui->networksListWidget->currentIndex();
itemText = index.data(Qt::DisplayRole).toString(); itemText = index.data(Qt::DisplayRole).toString();
if(itemText == "") { if(itemText.isEmpty()) {
QMessageBox::critical(this, tr("Invalid argument"), tr("You must select a network.")); showToast("You must select a network");
} }
else { else {
this->hide(); this->hide();