From 2c14bab7c0883d9dedc30aa29a82eefd65c65d0f Mon Sep 17 00:00:00 2001 From: Peter Albrecht <albrecpe@gmail.com> Date: Fri, 12 Jan 2024 14:31:21 +0100 Subject: [PATCH] Changed status bar: only the message is displayed, error in tooltip --- .../libraries/skills_gui/StatusLabel.cpp | 4 +++- .../RobotAPI/libraries/skills_gui/StatusLabel.h | 2 +- .../skills_gui/memory/SkillManagerWrapper.cpp | 17 +++++------------ .../skills_gui/memory/SkillManagerWrapper.h | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/source/RobotAPI/libraries/skills_gui/StatusLabel.cpp b/source/RobotAPI/libraries/skills_gui/StatusLabel.cpp index 06425af49..6b65f166a 100644 --- a/source/RobotAPI/libraries/skills_gui/StatusLabel.cpp +++ b/source/RobotAPI/libraries/skills_gui/StatusLabel.cpp @@ -13,10 +13,11 @@ namespace armarx::skills::gui } void - StatusLabel::handleMessage(const std::string& message) + StatusLabel::handleMessage(const std::string& message, std::string const& error) { this->label->setText(QString::fromStdString(message)); this->resetButton->setHidden(false); + label->setToolTip(QString::fromStdString(error)); } void @@ -38,6 +39,7 @@ namespace armarx::skills::gui this->resetButton->setHidden(true); label->setMinimumHeight(35); + label->setMaximumHeight(35); QPixmap pixmap(":/icons/delete.ico"); QIcon ButtonIcon(pixmap); diff --git a/source/RobotAPI/libraries/skills_gui/StatusLabel.h b/source/RobotAPI/libraries/skills_gui/StatusLabel.h index f3693ab0f..b8e0f91e4 100644 --- a/source/RobotAPI/libraries/skills_gui/StatusLabel.h +++ b/source/RobotAPI/libraries/skills_gui/StatusLabel.h @@ -17,7 +17,7 @@ namespace armarx::skills::gui /** * @brief Display a message to indicate an update. */ - void handleMessage(std::string const& message); + void handleMessage(std::string const& message, std::string const& error); private slots: /** diff --git a/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.cpp b/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.cpp index 9f6828966..92277c0eb 100644 --- a/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.cpp +++ b/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.cpp @@ -44,9 +44,7 @@ namespace armarx::skills::gui ARMARX_WARNING << "Unhandled Ice exception encountered while updating executions. Exception was: " << e; - std::stringstream sstream; - sstream << "Could not fetch executions: " << e.what(); - emit connectionUpdate(sstream.str()); + emit connectionUpdate("Could not fetch executions", e.what()); return {}; } catch (...) @@ -122,9 +120,7 @@ namespace armarx::skills::gui ARMARX_WARNING << "Unhandled Ice exception encountered while updating skills. Exception was: " << e; - std::stringstream sstream; - sstream << "Could not fetch skills: " << e.what(); - emit connectionUpdate(sstream.str()); + emit connectionUpdate("Could not fetch skills", e.what()); return {}; } catch (...) @@ -223,10 +219,8 @@ namespace armarx::skills::gui retry = true; ARMARX_ERROR << "Unhandeled Ice exception while aborting skill '" << executionId.skillId.skillName << "'."; - std::stringstream sstream; - sstream << "Could not abort skill " << executionId.skillId.skillName << " : " - << e.what(); - emit connectionUpdate(sstream.str()); + emit connectionUpdate("Could not abort skill " + executionId.skillId.skillName, + e.what()); } catch (...) { @@ -305,8 +299,7 @@ namespace armarx::skills::gui { ARMARX_ERROR << "Unhandeled Ice exception while executing skill '" << skillId.skillName << "'. Aborting..."; - emit connectionUpdate("Could not begin execution of skill " + skillId.skillName + ": " + - e.what()); + emit connectionUpdate("Execution failed of skill " + skillId.skillName, e.what()); } catch (...) { diff --git a/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.h b/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.h index a4f1407e0..22eec04e2 100644 --- a/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.h +++ b/source/RobotAPI/libraries/skills_gui/memory/SkillManagerWrapper.h @@ -68,7 +68,7 @@ namespace armarx::skills::gui SkillID const& skillId); signals: - void connectionUpdate(std::string const& message); + void connectionUpdate(std::string const& message, std::string const& error); public slots: /** -- GitLab