diff options
Diffstat (limited to 'src/scenes')
-rw-r--r-- | src/scenes/add_server_wizard/Scene_step_1.qml | 1 | ||||
-rw-r--r-- | src/scenes/add_server_wizard/add_server_wizard.cpp | 17 | ||||
-rw-r--r-- | src/scenes/add_server_wizard/add_server_wizard.h | 4 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/scenes/add_server_wizard/Scene_step_1.qml b/src/scenes/add_server_wizard/Scene_step_1.qml index e57f8a4..bfbe2ae 100644 --- a/src/scenes/add_server_wizard/Scene_step_1.qml +++ b/src/scenes/add_server_wizard/Scene_step_1.qml @@ -3,6 +3,7 @@ import QtQuick.Window 2.2 import QtQuick.Extras 1.4 import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.3 +import rwa.toast.type 1.0 /*! * This .qml file is a Scene which can be loaded through for 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; } diff --git a/src/scenes/add_server_wizard/add_server_wizard.h b/src/scenes/add_server_wizard/add_server_wizard.h index 03af824..dc205d1 100644 --- a/src/scenes/add_server_wizard/add_server_wizard.h +++ b/src/scenes/add_server_wizard/add_server_wizard.h @@ -47,9 +47,9 @@ private: signals: void step1Success(); - void step1Failed(QString reason); + void step1Failed(QString reason, uint toast_type); void step2Success(); - void step2Failed(QString reason); + void step2Failed(QString reason, uint toast_type); public slots: void processStep1(QString host_url, QString host_alias); |