Merge pull request 'Move connection errror to status Bar' (#148) from lucretius/SilentDragonLite:dev into dev

Reviewed-on: https://git.hush.is/hush/SilentDragonLite/pulls/148
This commit is contained in:
duke
2024-02-09 17:18:52 +00:00
3 changed files with 18 additions and 8 deletions

2
lib/Cargo.lock generated
View File

@@ -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",

View File

@@ -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" }

View File

@@ -604,18 +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;
if (!shown && prevCallSucceeded)
{
shown = true;
// Check if the error is a compression flag error
if (err.contains("compression", Qt::CaseInsensitive)) {
QString statusBarMessage = QObject::tr("Compression error: ") + ":\n\n" + err;
ui->statusBar->showMessage(statusBarMessage, 5000);
} else {
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,
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,
errorMessage,
QMessageBox::StandardButton::Ok
);
shown = false;
}
shown = false;
}
prevCallSucceeded = false;
});
}