From 0f456310c814bc3fa9e505d5aa82fb92f8e07ed7 Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 25 Mar 2023 00:58:59 +0000 Subject: [PATCH] Moved hex viewer styles to separate QSS file --- src/Insight/CMakeLists.txt | 1 + .../HexViewerWidget/HexViewerWidget.cpp | 12 ++ .../Stylesheets/HexViewerWidget.qss | 119 +++++++++++++++++ .../TargetMemoryInspectionPane.qss | 120 ------------------ 4 files changed, 132 insertions(+), 120 deletions(-) create mode 100644 src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Stylesheets/HexViewerWidget.qss diff --git a/src/Insight/CMakeLists.txt b/src/Insight/CMakeLists.txt index a5f01485..37612ccc 100755 --- a/src/Insight/CMakeLists.txt +++ b/src/Insight/CMakeLists.txt @@ -177,6 +177,7 @@ qt_add_resources( # Hex viewer widget "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui" + "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Stylesheets/HexViewerWidget.qss" # Memory snapshots "./UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/UiFiles/SnapshotManager.ui" diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp index 9a376787..c22d43b1 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp @@ -41,12 +41,24 @@ namespace Bloom::Widgets ) ); + auto stylesheetFile = QFile( + QString::fromStdString(Services::PathService::compiledResourcesPath() + + "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget" + + "/Stylesheets/HexViewerWidget.qss" + ) + ); + if (!widgetUiFile.open(QFile::ReadOnly)) { throw Exception("Failed to open HexViewerWidget UI file"); } + if (!stylesheetFile.open(QFile::ReadOnly)) { + throw Exception("Failed to open HexViewerWidget stylesheet file"); + } + auto uiLoader = UiLoader(this); this->container = uiLoader.load(&widgetUiFile, this); + this->container->setStyleSheet(stylesheetFile.readAll()); this->container->setFixedSize(this->size()); this->container->setContentsMargins(0, 0, 0, 0); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Stylesheets/HexViewerWidget.qss b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Stylesheets/HexViewerWidget.qss new file mode 100644 index 00000000..f50e24c5 --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/Stylesheets/HexViewerWidget.qss @@ -0,0 +1,119 @@ +#hex-viewer-container { + background-color: transparent; + border: none; +} + +#hex-viewer-container #tool-bar, +#hex-viewer-container #search-bar { + background-color: transparent; + border-bottom: 1px solid #41423f; +} + +#hex-viewer-container #bottom-bar { + border-top: 1px solid #41423f; +} + +#hex-viewer-container #bottom-bar QLabel { + font-size: 13px; + color: rgba(175, 177, 179, 0.72); +} + +#hex-viewer-container #bottom-bar QLabel:disabled { + color: rgba(175, 177, 179, 0.3); +} + +#hex-viewer-container #tool-bar QToolButton { + background-color: transparent; + border: none; + padding: 0; + qproperty-buttonWidth: 24; + qproperty-buttonHeight: 20; +} + +#hex-viewer-container #tool-bar QToolButton:hover { + background-color: #41413b; + border: none; + padding: 0; +} + +#hex-viewer-container #tool-bar QToolButton:checked { + background-color: #43433d; + border: none; +} + +#hex-viewer-container #tool-bar QToolButton:checked:disabled { + background-color: #3d3d39; + border: none; +} + +#hex-viewer-container #tool-bar #separator { + background-color: transparent; + border-right: 1px solid #41423f; + padding: 0; + min-width: 1px; + max-width: 1px; +} + +#hex-viewer-container #tool-bar #highlight-stack-memory-btn, +#hex-viewer-container #tool-bar #highlight-focused-memory-btn, +#hex-viewer-container #tool-bar #highlight-hovered-rows-columns-btn, +#hex-viewer-container #tool-bar #display-annotations-btn, +#hex-viewer-container #tool-bar #display-ascii-btn { + qproperty-buttonWidth: 25; + qproperty-buttonHeight: 21; +} + +#hex-viewer-container #tool-bar #go-to-address-input { + min-width: 100px; + max-width: 100px; + min-height: 15px; + max-height: 15px; + border: none; + background-color: transparent; + font-size: 13px; + color: #848486; +} + +#hex-viewer-container #tool-bar #go-to-address-input:focus { + color: #afb1b3; +} + +#hex-viewer-container #tool-bar #go-to-address-input:disabled { + color: #686767; +} + +#hex-viewer-container QScrollArea, +#hex-viewer-container #graphics-view { + background-color: #323330; + border: none; + font-size: 11px; +} + +#hex-viewer-container #loading-hex-viewer-label { + color: #838386; + font-size: 14px; +} + +#hex-viewer-container #bottom-bar #selection-count-label { + border: none; + border-left: 1px solid #41423f; + padding-left: 4px; + min-width: 140px; +} + +#hex-viewer-container QScrollBar:vertical { + background-color: transparent; + width: 12px; + margin: 1px 3px 1px 0px; +} + +#hex-viewer-container #byte-item-address-container-context-menu.QMenu, +#hex-viewer-container #byte-item-address-container-context-menu QMenu { + min-width: 0; +} + +#hex-viewer-container #byte-item-address-container-context-menu.QMenu::item, +#hex-viewer-container #byte-item-address-container-context-menu QMenu::item { + padding-left: 10px; + min-width: 150px; +} diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Stylesheets/TargetMemoryInspectionPane.qss b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Stylesheets/TargetMemoryInspectionPane.qss index 2f6cdbf0..8bf348db 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Stylesheets/TargetMemoryInspectionPane.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Stylesheets/TargetMemoryInspectionPane.qss @@ -78,126 +78,6 @@ margin-top: 2px; } -#hex-viewer-container { - background-color: transparent; - border: none; -} - -#hex-viewer-container #tool-bar, -#hex-viewer-container #search-bar { - background-color: transparent; - border-bottom: 1px solid #41423f; -} - -#hex-viewer-container #bottom-bar { - border-top: 1px solid #41423f; -} - -#hex-viewer-container #bottom-bar QLabel { - font-size: 13px; - color: rgba(175, 177, 179, 0.72); -} - -#hex-viewer-container #bottom-bar QLabel:disabled { - color: rgba(175, 177, 179, 0.3); -} - -#hex-viewer-container #tool-bar QToolButton { - background-color: transparent; - border: none; - padding: 0; - qproperty-buttonWidth: 24; - qproperty-buttonHeight: 20; -} - -#hex-viewer-container #tool-bar QToolButton:hover { - background-color: #41413b; - border: none; - padding: 0; -} - -#hex-viewer-container #tool-bar QToolButton:checked { - background-color: #43433d; - border: none; -} - -#hex-viewer-container #tool-bar QToolButton:checked:disabled { - background-color: #3d3d39; - border: none; -} - -#hex-viewer-container #tool-bar #separator { - background-color: transparent; - border-right: 1px solid #41423f; - padding: 0; - min-width: 1px; - max-width: 1px; -} - -#hex-viewer-container #tool-bar #highlight-stack-memory-btn, -#hex-viewer-container #tool-bar #highlight-focused-memory-btn, -#hex-viewer-container #tool-bar #highlight-hovered-rows-columns-btn, -#hex-viewer-container #tool-bar #display-annotations-btn, -#hex-viewer-container #tool-bar #display-ascii-btn { - qproperty-buttonWidth: 25; - qproperty-buttonHeight: 21; -} - -#hex-viewer-container #tool-bar #go-to-address-input { - min-width: 100px; - max-width: 100px; - min-height: 15px; - max-height: 15px; - border: none; - background-color: transparent; - font-size: 13px; - color: #848486; -} - -#hex-viewer-container #tool-bar #go-to-address-input:focus { - color: #afb1b3; -} - -#hex-viewer-container #tool-bar #go-to-address-input:disabled { - color: #686767; -} - -#hex-viewer-container QScrollArea, -#hex-viewer-container #graphics-view { - background-color: #323330; - border: none; - font-size: 11px; -} - -#hex-viewer-container #loading-hex-viewer-label { - color: #838386; - font-size: 14px; -} - -#hex-viewer-container #bottom-bar #selection-count-label { - border: none; - border-left: 1px solid #41423f; - padding-left: 4px; - min-width: 140px; -} - -#hex-viewer-container QScrollBar:vertical { - background-color: transparent; - width: 12px; - margin: 1px 3px 1px 0px; -} - -#hex-viewer-container #byte-item-address-container-context-menu.QMenu, -#hex-viewer-container #byte-item-address-container-context-menu QMenu { - min-width: 0; -} - -#hex-viewer-container #byte-item-address-container-context-menu.QMenu::item, -#hex-viewer-container #byte-item-address-container-context-menu QMenu::item { - padding-left: 10px; - min-width: 150px; -} - /* Snapshot Manager */ #target-memory-inspection-pane #rh-side-bar #manage-memory-snapshots-btn { border: none;