From 0ca5417b10baa67af43e5877811d81c2e3ab9df7 Mon Sep 17 00:00:00 2001 From: mnabywan <mnabywan@asl751.acc.gsi.de> Date: Fri, 21 Oct 2022 12:58:19 +0200 Subject: [PATCH] Set value labels for bool in diagnostic tool --- .../src/silecs-diagnostic/utils.cpp | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/silecs-diagnostic-cpp/src/silecs-diagnostic/utils.cpp b/silecs-diagnostic-cpp/src/silecs-diagnostic/utils.cpp index d796895..45cffc5 100755 --- a/silecs-diagnostic-cpp/src/silecs-diagnostic/utils.cpp +++ b/silecs-diagnostic-cpp/src/silecs-diagnostic/utils.cpp @@ -366,6 +366,32 @@ void Utils::displayRegisterValue(Silecs::Register *reg, QLabel *binValueLabel, Q break; } + case Bool: + { + bool value = reg->getValBool(); + std::string textValue; + std::string numericValue; + + if (value == true) + { + numericValue = "1"; + textValue = "TRUE"; + + } + else + { + numericValue = "0"; + textValue = "FALSE"; + } + + binValueLabel->setText(QString::fromStdString(numericValue)); + hexValueLabel->setText(QString::fromStdString(numericValue)); + decValueLabel->setText(QString::fromStdString(numericValue)); + asciiValueLabel->setText(QString::fromStdString(textValue)); + break; + } + + default: // Float32,Float64,Date { binValueLabel->setText("--Not relevant--"); -- GitLab