From 35343e5158ca441f8001c0a91685f4e93b53cb03 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Sun, 1 Aug 2021 02:22:57 +0200 Subject: Toast: Add a variety of new toast colors; Session complete rewrite; A lot of bugfixing; New available toast colors/types: ToastType.Standard, ToastType.Info, ToastType.Warning ToastType.Success, ToastType.Error --- src/scenes/add_server_wizard/add_server_wizard.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/scenes/add_server_wizard/add_server_wizard.cpp') diff --git a/src/scenes/add_server_wizard/add_server_wizard.cpp b/src/scenes/add_server_wizard/add_server_wizard.cpp index 9b67ebc..caac344 100644 --- a/src/scenes/add_server_wizard/add_server_wizard.cpp +++ b/src/scenes/add_server_wizard/add_server_wizard.cpp @@ -47,7 +47,7 @@ void Add_Server_wizard::processStep1(QString host_url, QString host_alias) { if(host_alias == "" || host_url == "") { QString reason = tr("Both textfields can't be empty!"); - emit step1Failed(reason); + emit step1Failed(reason, Toast::ToastType::ToastWarning); qDebug().noquote() << reason; return; } @@ -57,7 +57,7 @@ void Add_Server_wizard::processStep1(QString host_url, QString host_alias) { void Add_Server_wizard::processStep2() { qDebug() << "Processing Step 2 with args: No Args."; - emit step2Failed(tr("The features you expected here are not yet implemented.")); + emit step2Failed(tr("The features you expected here are not yet implemented."), Toast::ToastType::ToastWarning); // Just show placeholder scene now. emit step2Success(); } @@ -72,7 +72,9 @@ void Add_Server_wizard::add_web_app_host_response(QJsonDocument *doc) { // Don't use Q_ASSERT(doc != nullptr); instead use: if (doc == nullptr) { _main_gui->setRWAHostSelected(false); - _main_gui->showToast(tr("Can't connect to underlying session service!"), 9800); + _main_gui->showToast(tr("Can't connect to underlying session service!"), + 9800, + Toast::ToastType::ToastError); return; } @@ -90,25 +92,32 @@ void Add_Server_wizard::add_web_app_host_response(QJsonDocument *doc) { } else { qCritical().noquote() << tr("An error occured while adding a new host!"); + uint toast_type = Toast::ToastType::ToastStandard; QString reason = tr("An error occured while adding a new host!"); QString type = mainMap["type"].toString(); + if(type == "connection"){ reason = tr("Couldn't connect to the specified host!"); + toast_type = Toast::ToastType::ToastError; qCritical().noquote() << reason; } else if (type == "duplicate") { reason = tr("The specified host was already added!"); + toast_type = Toast::ToastType::ToastWarning; qCritical().noquote() << reason; } else if (type == "invalid_url") { reason = tr("The specified host address is not valid!"); + toast_type = Toast::ToastType::ToastWarning; qCritical().noquote() << reason; } else if (type == "permission_denied") { reason = tr("The specified host address does not grant access!"); + toast_type = Toast::ToastType::ToastError; qCritical().noquote() << reason; } else if (type == "unsupported_server") { reason = tr("The specified host address is not supported!"); + toast_type = Toast::ToastType::ToastError; qCritical().noquote() << reason; } - emit step1Failed(reason); + emit step1Failed(reason, toast_type); return; } -- cgit v1.2.3