From 26182290f5236db0ad6b2dcf86aeb946a0f927de Mon Sep 17 00:00:00 2001 From: lucretius Date: Tue, 6 Feb 2024 17:15:43 +0100 Subject: [PATCH 1/3] move connection error to status bar, lib update --- lib/Cargo.lock | 2 +- lib/Cargo.toml | 2 +- src/controller.cpp | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/Cargo.lock b/lib/Cargo.lock index fb727b0..621ff9c 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -1849,7 +1849,7 @@ dependencies = [ [[package]] name = "silentdragonlitelib" version = "0.1.0" -source = "git+https://git.hush.is/hush/silentdragonlite-cli?rev=767929a59f30d9c2e540c06359760b49b6986766#767929a59f30d9c2e540c06359760b49b6986766" +source = "git+https://git.hush.is/hush/silentdragonlite-cli?rev=3950c103b15de0f87c45bd01ccba513814ad9ca7#3950c103b15de0f87c45bd01ccba513814ad9ca7" dependencies = [ "base58", "bellman", diff --git a/lib/Cargo.toml b/lib/Cargo.toml index b6489e7..a767d85 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -12,4 +12,4 @@ crate-type = ["staticlib"] libc = "0.2.58" lazy_static = "1.4.0" blake3 = "0.3.4" -silentdragonlitelib = { git = "https://git.hush.is/hush/silentdragonlite-cli", rev = "767929a59f30d9c2e540c06359760b49b6986766" } +silentdragonlitelib = { git = "https://git.hush.is/hush/silentdragonlite-cli", rev = "3950c103b15de0f87c45bd01ccba513814ad9ca7" } diff --git a/src/controller.cpp b/src/controller.cpp index 543a67c..3739b5c 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -607,12 +607,9 @@ void Controller::getInfoThenRefresh(bool force) if (!shown && prevCallSucceeded) // show error only first time { shown = true; - QMessageBox::critical( - main, - QObject::tr("Connection Error"), - QObject::tr("There was an error connecting to the server. Please check your internet connection. The error was") + ": \n\n"+ err, - QMessageBox::StandardButton::Ok - ); + QString errorMessage = QObject::tr("There was an error connecting to the server. Please check your internet connection. The error was") + ": \n\n" + err; + ui->statusBar->showMessage(errorMessage, 5000); + shown = false; } From 068a3935e219a3b323aee6106844edf693445631 Mon Sep 17 00:00:00 2001 From: lucretius Date: Thu, 8 Feb 2024 13:52:41 +0100 Subject: [PATCH 2/3] move connection error to status bar only if there is a compression flag error --- src/controller.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index 3739b5c..9a96bb5 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -604,15 +604,28 @@ void Controller::getInfoThenRefresh(bool force) // Prevent multiple dialog boxes, because these are called async static bool shown = false; - if (!shown && prevCallSucceeded) // show error only first time - { - shown = true; - QString errorMessage = QObject::tr("There was an error connecting to the server. Please check your internet connection. The error was") + ": \n\n" + err; - ui->statusBar->showMessage(errorMessage, 5000); + if (!shown && prevCallSucceeded) + { + shown = true; + + // Check if the error is a compression flag error + if (err.contains("compression")) { + QString statusBarMessage = QObject::tr("Compression error: ") + ":\n\n" + err; + ui->statusBar->showMessage(statusBarMessage, 5000); + } else { - shown = false; + QString errorMessage = QObject::tr("There was an error connecting to the server. Please check your internet connection. The error was") + ": \n\n" + err; + QMessageBox::critical( + main, + QObject::tr("Connection Error"), + errorMessage, + QMessageBox::StandardButton::Ok + ); } + shown = false; + } + prevCallSucceeded = false; }); } From e94df062a89131314e611475fcfc00ba78a57f2d Mon Sep 17 00:00:00 2001 From: lucretius Date: Thu, 8 Feb 2024 15:55:33 +0100 Subject: [PATCH 3/3] add Qt::CaseInsensitive for compression error --- src/controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller.cpp b/src/controller.cpp index 9a96bb5..e1d3348 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -609,7 +609,7 @@ void Controller::getInfoThenRefresh(bool force) shown = true; // Check if the error is a compression flag error - if (err.contains("compression")) { + if (err.contains("compression", Qt::CaseInsensitive)) { QString statusBarMessage = QObject::tr("Compression error: ") + ":\n\n" + err; ui->statusBar->showMessage(statusBarMessage, 5000); } else {