From d88e54549692d1d783d1fe6eaa489e7e5c3a81d0 Mon Sep 17 00:00:00 2001 From: Nav Date: Mon, 14 Feb 2022 18:00:04 +0000 Subject: [PATCH] Updated register inspection window appearance to be consistent with the Manage Memory Regions window --- .../RegisterHistoryWidget/CurrentItem.cpp | 2 +- .../TargetRegisterInspectorWindow.qss | 35 +- .../TargetRegisterInspectorWindow.cpp | 49 +- .../TargetRegisterInspectorWindow.hpp | 3 +- .../UiFiles/TargetRegisterInspectorWindow.ui | 638 ++++++++++++------ 5 files changed, 467 insertions(+), 260 deletions(-) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/RegisterHistoryWidget/CurrentItem.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/RegisterHistoryWidget/CurrentItem.cpp index 0682742b..4cced871 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/RegisterHistoryWidget/CurrentItem.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/RegisterHistoryWidget/CurrentItem.cpp @@ -11,7 +11,7 @@ namespace Bloom::Widgets ): Item(registerValue, parent) { this->setObjectName("current-item"); this->setFixedHeight(30); - this->titleLabel->setText("Current value"); + this->titleLabel->setText("Current Value"); this->layout->addWidget(titleLabel, 0, Qt::AlignmentFlag::AlignLeft); this->layout->setContentsMargins(5, 0, 5, 0); } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/TargetRegisterInspectorWindow.qss b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/TargetRegisterInspectorWindow.qss index c7d1dd3d..d3ad9ea4 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/TargetRegisterInspectorWindow.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/TargetRegisterInspectorWindow.qss @@ -2,17 +2,30 @@ background-color: #373835; } -#register-name { - font-size: 15px; +#register-details-container QPlainTextEdit { + min-height: 100px; + max-height: 100px; } -#register-value-container, -#register-details-container { - border: 1px solid #2F2F2D; +#read-only-indicator-label, +#register-details-label { + color: #8a8a8d; } -#register-value-text-input-container { - border-top: 1px solid #41423f; +#register-details-name-label { + min-width: 60px; + max-width: 60px; +} + +#register-details-start-address-label, +#register-details-size-label, +#register-details-description-label { + min-width: 130px; + max-width: 130px; +} + +#register-details-name-input { + max-width: 500px; } #apply-btn { @@ -35,9 +48,15 @@ font-size: 12px; } +/* Actions */ +#actions { + border-top: 1px solid #2F2F2D; + min-height: 50px; +} + /* RegisterHistoryWidget */ #target-register-history-widget #container { - border: 1px solid #2F2F2D; + border-right: 1px solid #2F2F2D; } #target-register-history-widget #title-bar { diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp index 8e55699f..7c82e678 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/ErrorDialogue.hpp" @@ -68,14 +69,17 @@ namespace Bloom::Widgets this->container = uiLoader.load(&windowUiFile, this); this->container->setMinimumSize(this->size()); - this->container->setContentsMargins(containerMargins); + this->container->setContentsMargins(QMargins(0, 0, 0, 0)); - this->registerNameLabel = this->container->findChild("register-name"); - this->registerDescriptionLabel = this->container->findChild("register-description"); - this->contentContainer = this->container->findChild("content-container"); - this->registerValueContainer = this->container->findChild("register-value-container"); - this->registerValueTextInput = this->container->findChild("register-value-text-input"); - this->registerValueBitsetWidgetContainer = this->container->findChild( + this->contentContainer = this->container->findChild("content-container"); + auto* contentContainerViewport = this->contentContainer->widget(); + this->contentContainer->setContentsMargins(0, 0, 0, 0); + contentContainerViewport->setContentsMargins(0, 0, 0, 0); + contentContainerViewport->layout()->setContentsMargins(0, 0, 10, 0); + + this->registerValueContainer = this->contentContainer->findChild("register-value-container"); + this->registerValueTextInput = this->contentContainer->findChild("register-value-text-input"); + this->registerValueBitsetWidgetContainer = this->registerValueContainer->findChild( "register-value-bitset-widget-container" ); this->refreshValueButton = this->container->findChild("refresh-value-btn"); @@ -83,15 +87,6 @@ namespace Bloom::Widgets this->helpButton = this->container->findChild("help-btn"); this->closeButton = this->container->findChild("close-btn"); - this->registerNameLabel->setText(registerName); - - if (this->registerDescriptor.description.has_value()) { - this->registerDescriptionLabel->setText( - QString::fromStdString(this->registerDescriptor.description.value()) - ); - this->registerDescriptionLabel->setVisible(true); - } - this->registerHistoryWidget = new RegisterHistoryWidget( this->registerDescriptor, this->registerValue, @@ -100,27 +95,30 @@ namespace Bloom::Widgets ); auto* contentLayout = this->container->findChild("content-layout"); - contentLayout->insertWidget(0, this->registerHistoryWidget, 0, Qt::AlignmentFlag::AlignTop); + contentLayout->insertWidget(0, this->registerHistoryWidget, 0); - auto* registerDetailsContainer = this->container->findChild("register-details-container"); - auto* registerValueContainer = this->container->findChild("register-value-container"); - registerValueContainer->setContentsMargins(15, 15, 15, 15); - registerDetailsContainer->setContentsMargins(15, 15, 15, 15); + auto* registerDetailsContainer = this->contentContainer->findChild("register-details-container"); auto* registerDetailsNameInput = registerDetailsContainer->findChild( "register-details-name-input" ); - auto* registerDetailsSizeInput = registerDetailsContainer->findChild( - "register-details-size-input" - ); auto* registerDetailsStartAddressInput = registerDetailsContainer->findChild( "register-details-start-address-input" ); + auto* registerDetailsSizeInput = registerDetailsContainer->findChild( + "register-details-size-input" + ); + auto* registerDetailsDescriptionInput = registerDetailsContainer->findChild( + "register-details-description-input" + ); registerDetailsNameInput->setText(registerName); - registerDetailsSizeInput->setText(QString::number(this->registerDescriptor.size)); registerDetailsStartAddressInput->setText( "0x" + QString::number(this->registerDescriptor.startAddress.value(), 16).toUpper() ); + registerDetailsSizeInput->setText(QString::number(this->registerDescriptor.size)); + registerDetailsDescriptionInput->setPlainText( + QString::fromStdString(this->registerDescriptor.description.value_or("")) + ); if (!this->registerDescriptor.writable) { this->registerValueTextInput->setDisabled(true); @@ -224,6 +222,7 @@ namespace Bloom::Widgets this->height() ); } + bool TargetRegisterInspectorWindow::registerSupported(const Targets::TargetRegisterDescriptor& descriptor) { return (descriptor.size > 0 && descriptor.size <= 8); } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.hpp index 4013adfc..3b39c268 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "src/Targets/TargetRegister.hpp" @@ -49,7 +50,7 @@ namespace Bloom::Widgets QLabel* registerNameLabel = nullptr; QLabel* registerDescriptionLabel = nullptr; - QWidget* contentContainer = nullptr; + QScrollArea* contentContainer = nullptr; RegisterHistoryWidget* registerHistoryWidget = nullptr; QWidget* registerValueContainer = nullptr; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui index 7bc23484..b87a84f9 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui @@ -1,254 +1,442 @@ + + + - - - - :/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Images/icon.svg - - - 46 - - - 57 - - - - - - - - - - false - - - + + 0 + - - - - 20 - - - - QSizePolicy::Fixed - - - - - 20 + 0 - - - - - 20 + + + + 10 + + + + QSizePolicy::Fixed + + + + + + true + Qt::ScrollBarAsNeeded + QAbstractScrollArea::AdjustToContents + Qt::ScrollBarAlwaysOff + + + + + + - - - - - - 10 + + + 0 + + + + + - - - - 20 - - - - - Name: - - - - - - - false - - - 350 - - - - - - - - - 20 - - - - - Size (bytes): - - - - - - - false - - - 350 - - - - - - - - - 20 - - - - - Start Address: - - - - - - - false - - - 350 - - - - - - - - - - - - - - 20 + + + 0 + + + + + + 10 + + + + QSizePolicy::Fixed + + + + + + + 20 + + + + + + + + Name: + + + + + + + + + + false + + + + + + + Qt::Horizontal + + + + + + + + + + 15 + + + + QSizePolicy::Fixed + + + + + + + Register Details + + + + + + + + 15 + + + + QSizePolicy::Fixed + + + + + + + true + + + Qt::AlignLeft + + + Register details reside in Bloom's source code and cannot be manipulated via Insight. To report any inaccuracies, report an issue via Help -> Report An Issue. + + + + + + + + 15 + + + + QSizePolicy::Fixed + + + + + + + 20 + + + + + + + + Start address: + + + + + + + false + + + + + + + + + + 10 + + + + QSizePolicy::Fixed + + + + + + + 20 + + + + + + + + Size (bytes): + + + + + + + false + + + + + + + + + + 10 + + + + QSizePolicy::Fixed + + + + + + + 20 + + + + + + + + Description: + + + + + + + false + + + + + + + + + + + + + 20 + - - - - false - - - false - - - Qt::AlignLeft - - - This register is configured as read-only - it cannot be manipulated via -Insight. - - - - - - - - - - 60 - - + + QSizePolicy::Fixed + + + + + + + Register Value + + + + + + + + 15 + + + + QSizePolicy::Fixed + + + + + + + + 20 + + + 0 + + + + + false + + + false + + + Qt::AlignLeft + + + This register is configured as read-only - its value cannot be manipulated via Insight. + + + + + + + + + + 60 + + + + 15 + + + + + + 15 + + + + Refresh Value + + + + + + + Qt::Horizontal + + + + + + + Write Value + + + - - - - - - 15 - - - - - Refresh Value - - - - - - - Qt::Horizontal - - - - - - - Write Value - - - - - - - - - - - - Qt::Vertical - - - - - - - - - - - - Qt::Vertical - - - - - - - 15 - - - - - Help - + + + + + + + + Qt::Vertical + + + + + - - Qt::Horizontal + + + 5 + + + + QSizePolicy::Fixed - - - - Close - - - + + + + + + + + 15 + + + + + + 10 + + + + QSizePolicy::Fixed + + + + + + + Help + + + + + + + Qt::Horizontal + + + + + + + Close + + + + + + + + 10 + + + + QSizePolicy::Fixed + + + + + +