diff --git a/src/Insight/CMakeLists.txt b/src/Insight/CMakeLists.txt index f9a6c1f0..da37f587 100755 --- a/src/Insight/CMakeLists.txt +++ b/src/Insight/CMakeLists.txt @@ -18,6 +18,7 @@ target_sources( ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/SvgToolButton.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/ClickableWidget.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/ExpandingHeightScrollAreaWidget.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/PushButton.cpp # Insight worker tasks ${CMAKE_CURRENT_SOURCE_DIR}/InsightWorker/Tasks/InsightWorkerTask.cpp diff --git a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss index 62a16c9d..281ae8c6 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss @@ -199,3 +199,8 @@ Bloom--Widgets--SvgToolButton QMenu::item { padding-left: 10px; min-width: 250px; } + +Bloom--Widgets--PushButton[styleName="primary"] { + background-color: #353C41; + border: 1px solid #454C52; +} diff --git a/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp b/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp index 93348ce7..a15eb530 100644 --- a/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp @@ -7,6 +7,7 @@ #include "Widgets/RotatableLabel.hpp" #include "Widgets/LabeledSeparator.hpp" #include "Widgets/TextInput.hpp" +#include "Widgets/PushButton.hpp" #include "Widgets/SvgWidget.hpp" #include "Widgets/SvgToolButton.hpp" #include "Widgets/ExpandingHeightScrollAreaWidget.hpp" @@ -54,6 +55,15 @@ namespace Bloom return widget; } }, + { + "PushButton", + [this] (QWidget* parent, const QString& name) { + auto* widget = new PushButton(parent); + widget->setObjectName(name); + widget->setStyleSheet(parent->styleSheet()); + return widget; + } + }, { "ExpandingHeightScrollAreaWidget", [this] (QWidget* parent, const QString& name) { diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.cpp new file mode 100644 index 00000000..2a90720d --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.cpp @@ -0,0 +1,8 @@ +#include "PushButton.hpp" + +namespace Bloom::Widgets +{ + PushButton::PushButton(QWidget* parent) + : QPushButton(parent) + {} +} diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.hpp new file mode 100644 index 00000000..9b0ab138 --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include +#include + +namespace Bloom::Widgets +{ + class PushButton: public QPushButton + { + Q_OBJECT + Q_PROPERTY(QString styleName READ getStyleName WRITE setStyleName DESIGNABLE true) + + public: + explicit PushButton(QWidget* parent = nullptr); + + void setStyleName(const QString& styleName) { + this->styleName = styleName; + } + + [[nodiscard]] QString getStyleName() const { + return this->styleName; + } + + protected: + QString styleName; + }; +} diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.cpp index 880dafe9..ec9d8b51 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.cpp @@ -77,9 +77,9 @@ namespace Bloom::Widgets this->stackedFormLayout = this->container->findChild("stacked-form-layout"); - this->applyButton = this->container->findChild("apply-btn"); - this->helpButton = this->container->findChild("help-btn"); - this->closeButton = this->container->findChild("close-btn"); + this->applyButton = this->container->findChild("apply-btn"); + this->helpButton = this->container->findChild("help-btn"); + this->closeButton = this->container->findChild("close-btn"); regionSelectorToolBar->setContentsMargins(0, 0, 0, 0); this->regionItemScrollArea->setContentsMargins(0, 0, 0, 0); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.hpp index fdde01f5..78bc484e 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/MemoryRegionManagerWindow.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include #include @@ -17,6 +16,7 @@ #include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/ExcludedMemoryRegion.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp" +#include "src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.hpp" #include "RegionItem.hpp" #include "FocusedRegionItem.hpp" #include "ExcludedRegionItem.hpp" @@ -51,9 +51,9 @@ namespace Bloom::Widgets QWidget* container = nullptr; QWidget* regionSelector = nullptr; - QPushButton* applyButton = nullptr; - QPushButton* helpButton = nullptr; - QPushButton* closeButton = nullptr; + PushButton* applyButton = nullptr; + PushButton* helpButton = nullptr; + PushButton* closeButton = nullptr; SvgToolButton* addRegionButton = nullptr; QAction* addFocusedRegionMenuAction = nullptr; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss index 626b1606..f86f8f20 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/Stylesheets/MemoryRegionManagerWindow.qss @@ -130,8 +130,3 @@ border-top: 1px solid #2F2F2D; min-height: 50px; } - -#apply-btn { - background-color: #353C41; - border: 1px solid #454C52; -} diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/UiFiles/MemoryRegionManagerWindow.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/UiFiles/MemoryRegionManagerWindow.ui index 15f8edd3..3ff5ec14 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/UiFiles/MemoryRegionManagerWindow.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegionManager/UiFiles/MemoryRegionManagerWindow.ui @@ -200,7 +200,7 @@ - + Help @@ -214,14 +214,17 @@ - + Close - + + + primary + OK diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/TargetRegisterInspectorWindow.qss b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/TargetRegisterInspectorWindow.qss index 89870ccb..9cdb42af 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/TargetRegisterInspectorWindow.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/Stylesheets/TargetRegisterInspectorWindow.qss @@ -28,11 +28,6 @@ max-width: 500px; } -#apply-btn { - background-color: #353C41; - border: 1px solid #454C52; -} - /* BitsetWidget */ #bitset-widget { font-size: 12px; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp index 8be4ecff..d3ad13ed 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp @@ -81,10 +81,10 @@ namespace Bloom::Widgets this->registerValueBitsetWidgetContainer = this->registerValueContainer->findChild( "register-value-bitset-widget-container" ); - this->refreshValueButton = this->container->findChild("refresh-value-btn"); - this->applyButton = this->container->findChild("apply-btn"); - this->helpButton = this->container->findChild("help-btn"); - this->closeButton = this->container->findChild("close-btn"); + this->refreshValueButton = this->container->findChild("refresh-value-btn"); + this->applyButton = this->container->findChild("apply-btn"); + this->helpButton = this->container->findChild("help-btn"); + this->closeButton = this->container->findChild("close-btn"); this->registerHistoryWidget = new RegisterHistoryWidget( this->registerDescriptor, diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.hpp index b513f55b..25a8088e 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.hpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -14,6 +13,7 @@ #include "src/Targets/TargetState.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp" +#include "src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.hpp" #include "BitsetWidget/BitsetWidget.hpp" #include "RegisterHistoryWidget/RegisterHistoryWidget.hpp" @@ -54,10 +54,10 @@ namespace Bloom::Widgets QWidget* registerValueBitsetWidgetContainer = nullptr; std::vector bitsetWidgets; - QPushButton* refreshValueButton = nullptr; - QPushButton* applyButton = nullptr; - QPushButton* helpButton = nullptr; - QPushButton* closeButton = nullptr; + PushButton* refreshValueButton = nullptr; + PushButton* applyButton = nullptr; + PushButton* helpButton = nullptr; + PushButton* closeButton = nullptr; Targets::TargetState targetState = Targets::TargetState::UNKNOWN; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui index 97c361e4..c10a66c8 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui @@ -330,7 +330,7 @@ 15 - + Refresh Value @@ -344,7 +344,10 @@ - + + + primary + Write Value @@ -414,7 +417,7 @@ - + Help @@ -428,7 +431,7 @@ - + Close