Refactored InsightWindow class to inherit from QMainWindow, as opposed to a standard QObject

Replaced QWidget left panel with new PanelWidget instance
Also introduced a bottom panel (empty ATM)
Removed obsolete widgets
Added panel size adjustment on window resize
This commit is contained in:
Nav
2021-10-06 00:39:40 +01:00
parent 74b8e41e1b
commit 104f09f7c9
15 changed files with 561 additions and 449 deletions

View File

@@ -128,8 +128,6 @@ add_executable(Bloom
src/Insight/UserInterfaces/InsightWindow/Widgets/SvgWidget.cpp src/Insight/UserInterfaces/InsightWindow/Widgets/SvgWidget.cpp
src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp
src/Insight/UserInterfaces/InsightWindow/Widgets/ClickableWidget.cpp src/Insight/UserInterfaces/InsightWindow/Widgets/ClickableWidget.cpp
src/Insight/UserInterfaces/InsightWindow/Widgets/SlidingHandleWidget.cpp
src/Insight/UserInterfaces/InsightWindow/Widgets/ExpandingWidget.hpp
src/Insight/UserInterfaces/InsightWindow/Widgets/ExpandingHeightScrollAreaWidget.hpp src/Insight/UserInterfaces/InsightWindow/Widgets/ExpandingHeightScrollAreaWidget.hpp
# Insight worker tasks # Insight worker tasks

View File

@@ -41,7 +41,7 @@ namespace Bloom
QApplication application; QApplication application;
InsightWorker* insightWorker = new InsightWorker(this->eventManager); InsightWorker* insightWorker = new InsightWorker(this->eventManager);
InsightWindow* mainWindow = new InsightWindow(this->application, *(this->insightWorker)); InsightWindow* mainWindow = new InsightWindow(*(this->insightWorker));
TargetControllerConsole targetControllerConsole = TargetControllerConsole( TargetControllerConsole targetControllerConsole = TargetControllerConsole(
this->eventManager, this->eventManager,

View File

@@ -5,7 +5,6 @@
#include <utility> #include <utility>
#include "UiLoader.hpp" #include "UiLoader.hpp"
#include "Widgets/SlidingHandleWidget.hpp"
#include "Widgets/RotatableLabel.hpp" #include "Widgets/RotatableLabel.hpp"
#include "Widgets/TargetWidgets/DIP/DualInlinePackageWidget.hpp" #include "Widgets/TargetWidgets/DIP/DualInlinePackageWidget.hpp"
@@ -29,10 +28,11 @@ using Bloom::Targets::TargetVariant;
using Bloom::Targets::TargetPackage; using Bloom::Targets::TargetPackage;
using Bloom::Targets::TargetPinDescriptor; using Bloom::Targets::TargetPinDescriptor;
InsightWindow::InsightWindow( InsightWindow::InsightWindow(InsightWorker& insightWorker): QMainWindow(nullptr), insightWorker(insightWorker) {
QApplication& application, this->setObjectName("main-window");
InsightWorker& insightWorker this->setWindowTitle("Bloom Insight");
): QObject(&application), insightWorker(insightWorker) { this->setMinimumSize(1000, 500);
auto mainWindowUiFile = QFile( auto mainWindowUiFile = QFile(
QString::fromStdString(Paths::compiledResourcesPath() QString::fromStdString(Paths::compiledResourcesPath()
+ "/src/Insight/UserInterfaces/InsightWindow/UiFiles/InsightWindow.ui" + "/src/Insight/UserInterfaces/InsightWindow/UiFiles/InsightWindow.ui"
@@ -53,8 +53,8 @@ InsightWindow::InsightWindow(
} }
auto uiLoader = UiLoader(this); auto uiLoader = UiLoader(this);
this->mainWindowWidget = uiLoader.load(&mainWindowUiFile); this->windowContainer = uiLoader.load(&mainWindowUiFile, this);
this->mainWindowWidget->setStyleSheet(mainWindowStylesheet.readAll()); this->windowContainer->setStyleSheet(mainWindowStylesheet.readAll());
mainWindowUiFile.close(); mainWindowUiFile.close();
mainWindowStylesheet.close(); mainWindowStylesheet.close();
@@ -64,11 +64,15 @@ InsightWindow::InsightWindow(
+ "/src/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg" + "/src/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg"
) )
)); ));
this->ioContainerWidget = this->mainWindowWidget->findChild<InsightTargetWidgets::TargetPackageWidgetContainer*>(
this->layoutContainer = this->windowContainer->findChild<QWidget*>("layout-container");
this->mainMenuBar = this->windowContainer->findChild<QMenuBar*>("menu-bar");
this->layoutContainer->layout()->setMenuBar(this->mainMenuBar);
this->container = this->layoutContainer->findChild<QWidget*>("container");
this->ioContainerWidget = this->windowContainer->findChild<InsightTargetWidgets::TargetPackageWidgetContainer*>(
"io-container" "io-container"
); );
this->ioUnavailableWidget = this->mainWindowWidget->findChild<QLabel*>("io-inspection-unavailable"); this->ioUnavailableWidget = this->windowContainer->findChild<QLabel*>("io-inspection-unavailable");
this->mainMenuBar = this->mainWindowWidget->findChild<QMenuBar*>("menu-bar");
auto fileMenu = this->mainMenuBar->findChild<QMenu*>("file-menu"); auto fileMenu = this->mainMenuBar->findChild<QMenu*>("file-menu");
auto helpMenu = this->mainMenuBar->findChild<QMenu*>("help-menu"); auto helpMenu = this->mainMenuBar->findChild<QMenu*>("help-menu");
@@ -82,7 +86,7 @@ InsightWindow::InsightWindow(
connect(openGettingStartedUrlAction, &QAction::triggered, this, &InsightWindow::openGettingStartedUrl); connect(openGettingStartedUrlAction, &QAction::triggered, this, &InsightWindow::openGettingStartedUrl);
connect(openAboutWindowAction, &QAction::triggered, this, &InsightWindow::openAboutWindow); connect(openAboutWindowAction, &QAction::triggered, this, &InsightWindow::openAboutWindow);
this->header = this->mainWindowWidget->findChild<QWidget*>("header"); this->header = this->windowContainer->findChild<QWidget*>("header");
this->refreshIoInspectionButton = this->header->findChild<QToolButton*>("refresh-io-inspection-btn"); this->refreshIoInspectionButton = this->header->findChild<QToolButton*>("refresh-io-inspection-btn");
connect(this->refreshIoInspectionButton, &QToolButton::clicked, this, [this] { connect(this->refreshIoInspectionButton, &QToolButton::clicked, this, [this] {
@@ -110,13 +114,10 @@ InsightWindow::InsightWindow(
} }
}); });
this->leftPanel = this->mainWindowWidget->findChild<QWidget*>("left-panel"); this->leftMenuBar = this->container->findChild<QWidget*>("left-side-menu-bar");
this->leftPanelLayoutContainer = this->leftPanel->findChild<QWidget*>("left-panel-layout-container"); this->leftPanel = this->container->findChild<PanelWidget*>("left-panel");
auto leftPanelSlider = this->mainWindowWidget->findChild<SlidingHandleWidget*>("left-panel-slider"); this->targetRegistersButton = this->container->findChild<QToolButton*>("target-registers-btn");
connect(leftPanelSlider, &SlidingHandleWidget::horizontalSlide, this, &InsightWindow::onLeftPanelHandleSlide);
this->targetRegistersButton = this->mainWindowWidget->findChild<QToolButton*>("target-registers-btn");
auto targetRegisterButtonLayout = this->targetRegistersButton->findChild<QVBoxLayout*>(); auto targetRegisterButtonLayout = this->targetRegistersButton->findChild<QVBoxLayout*>();
auto registersBtnLabel = new RotatableLabel(270, "Registers", this->targetRegistersButton); auto registersBtnLabel = new RotatableLabel(270, "Registers", this->targetRegistersButton);
registersBtnLabel->setObjectName("target-registers-btn-label"); registersBtnLabel->setObjectName("target-registers-btn-label");
@@ -125,9 +126,16 @@ InsightWindow::InsightWindow(
connect(this->targetRegistersButton, &QToolButton::clicked, this, &InsightWindow::toggleTargetRegistersPane); connect(this->targetRegistersButton, &QToolButton::clicked, this, &InsightWindow::toggleTargetRegistersPane);
this->footer = this->mainWindowWidget->findChild<QWidget*>("footer"); this->bottomMenuBar = this->container->findChild<QWidget*>("bottom-menu-bar");
this->bottomPanel = this->container->findChild<PanelWidget*>("bottom-panel");
this->footer = this->windowContainer->findChild<QWidget*>("footer");
this->targetStatusLabel = this->footer->findChild<QLabel*>("target-state"); this->targetStatusLabel = this->footer->findChild<QLabel*>("target-state");
this->programCounterValueLabel = this->footer->findChild<QLabel*>("target-program-counter-value"); this->programCounterValueLabel = this->footer->findChild<QLabel*>("target-program-counter-value");
const auto windowSize = this->size();
this->windowContainer->setFixedSize(windowSize);
this->layoutContainer->setFixedSize(windowSize);
} }
void InsightWindow::init(TargetDescriptor targetDescriptor) { void InsightWindow::init(TargetDescriptor targetDescriptor) {
@@ -135,171 +143,13 @@ void InsightWindow::init(TargetDescriptor targetDescriptor) {
this->activate(); this->activate();
} }
void InsightWindow::activate() { void InsightWindow::toggleUi(bool disable) {
auto targetNameLabel = this->footer->findChild<QLabel*>("target-name"); this->uiDisabled = disable;
auto targetIdLabel = this->footer->findChild<QLabel*>("target-id");
targetNameLabel->setText(QString::fromStdString(this->targetDescriptor.name));
targetIdLabel->setText("0x" + QString::fromStdString(this->targetDescriptor.id).remove("0x").toUpper());
this->variantMenu = this->footer->findChild<QMenu*>("target-variant-menu");
this->ioUnavailableWidget->hide(); if (this->refreshIoInspectionButton != nullptr) {
this->refreshIoInspectionButton->setDisabled(disable);
std::optional<QString> previouslySelectedVariantName; this->refreshIoInspectionButton->repaint();
if (this->selectedVariant != nullptr) {
previouslySelectedVariantName = QString::fromStdString(this->selectedVariant->name).toLower();
this->selectedVariant = nullptr;
} }
this->supportedVariantsByName.clear();
/*
* We don't want to present the user with duplicate target variants.
*
* In the context of Insight, a variant that doesn't differ in package type or pinout configuration is
* considered a duplicate.
*/
auto processedVariants = std::vector<TargetVariant>();
auto isDuplicateVariant = [&processedVariants](const TargetVariant& variantA) {
return std::ranges::any_of(
processedVariants.begin(),
processedVariants.end(),
[&variantA, &processedVariants](const TargetVariant& variantB) {
if (variantA.package != variantB.package) {
return false;
}
if (variantA.pinDescriptorsByNumber.size() != variantB.pinDescriptorsByNumber.size()) {
return false;
}
if (variantA.pinDescriptorsByNumber != variantB.pinDescriptorsByNumber) {
return false;
}
return true;
}
);
};
for (const auto& targetVariant: this->targetDescriptor.variants) {
if (isDuplicateVariant(targetVariant)) {
continue;
}
auto variantAction = new QAction(this->variantMenu);
variantAction->setText(
QString::fromStdString(targetVariant.name + " (" + targetVariant.packageName + ")")
);
if (InsightWindow::isVariantSupported(targetVariant)) {
auto supportedVariantPtr = &(this->supportedVariantsByName.insert(
std::pair(QString::fromStdString(targetVariant.name).toLower(), targetVariant)
).first->second);
connect(
variantAction,
&QAction::triggered,
this,
[this, supportedVariantPtr] {
this->selectVariant(supportedVariantPtr);
}
);
} else {
variantAction->setEnabled(false);
variantAction->setText(variantAction->text() + " (unsupported)");
}
this->variantMenu->addAction(variantAction);
processedVariants.push_back(targetVariant);
}
this->variantMenu->setEnabled(true);
Logger::debug("Number of target variants supported by Insight: " + std::to_string(supportedVariantsByName.size()));
if (!this->supportedVariantsByName.empty()) {
if (previouslySelectedVariantName.has_value()
&& this->supportedVariantsByName.contains(previouslySelectedVariantName.value())
) {
this->selectVariant(&(this->supportedVariantsByName.at(previouslySelectedVariantName.value())));
} else if (this->targetConfig.variantName.has_value()) {
auto selectedVariantName = QString::fromStdString(this->targetConfig.variantName.value());
if (this->supportedVariantsByName.contains(selectedVariantName)) {
// The user has specified a valid variant name in their config file, so use that as the default
this->selectVariant(&(this->supportedVariantsByName.at(selectedVariantName)));
} else {
Logger::error("Invalid target variant name \"" + this->targetConfig.variantName.value()
+ "\" - no such variant with the given name was found.");
}
}
if (this->selectedVariant == nullptr) {
/*
* Given that we haven't been able to select a variant at this point, we will just fallback to the first
* one that is available.
*/
this->selectVariant(&(this->supportedVariantsByName.begin()->second));
}
} else {
if (this->targetDescriptor.variants.empty()) {
this->variantMenu->parentWidget()->hide();
}
this->ioUnavailableWidget->setText(
"GPIO inspection is not available for this target. "
"Please report this to Bloom developers by clicking Help -> Report An Issue"
);
this->ioUnavailableWidget->show();
}
auto leftPanelLayout = this->leftPanelLayoutContainer->findChild<QVBoxLayout*>("left-panel-layout");
this->targetRegistersSidePane = new TargetRegistersPaneWidget(
this->targetDescriptor,
insightWorker,
this->leftPanelLayoutContainer
);
leftPanelLayout->addWidget(this->targetRegistersSidePane);
this->targetRegistersButton->setChecked(false);
this->targetRegistersButton->setDisabled(false);
this->toggleUi(this->targetState != TargetState::STOPPED);
this->activated = true;
}
void InsightWindow::deactivate() {
if (this->targetPackageWidget != nullptr) {
this->targetPackageWidget->hide();
this->targetPackageWidget->deleteLater();
this->targetPackageWidget = nullptr;
}
if (this->targetRegistersSidePane != nullptr) {
this->targetRegistersSidePane->deactivate();
this->targetRegistersSidePane->deleteLater();
this->leftPanel->setVisible(false);
this->targetRegistersButton->setChecked(false);
this->targetRegistersButton->setDisabled(true);
}
this->ioUnavailableWidget->setText(
"Insight deactivated - Bloom has been disconnected from the target.\n\n"
"Bloom will attempt to reconnect upon the start of a new debug session."
);
this->ioUnavailableWidget->show();
this->targetStatusLabel->setText("Unknown");
this->programCounterValueLabel->setText("-");
this->variantMenu->clear();
this->variantMenu->setEnabled(false);
this->toggleUi(true);
this->activated = false;
} }
bool InsightWindow::isVariantSupported(const TargetVariant& variant) { bool InsightWindow::isVariantSupported(const TargetVariant& variant) {
@@ -383,41 +233,219 @@ void InsightWindow::selectVariant(const TargetVariant* variant) {
}); });
} }
this->mainWindowWidget->setMinimumSize( this->setMinimumSize(
this->targetPackageWidget->width() + 500, this->targetPackageWidget->width() + 700,
this->targetPackageWidget->height() + 150 this->targetPackageWidget->height() + 450
); );
this->ioContainerWidget->resize(this->ioContainerWidget->size()); Logger::error("ressss");
this->adjustSize();
this->targetPackageWidget->show(); this->targetPackageWidget->show();
} }
} }
void InsightWindow::show() { void InsightWindow::activate() {
this->mainWindowWidget->activateWindow(); auto targetNameLabel = this->footer->findChild<QLabel*>("target-name");
this->mainWindowWidget->show(); auto targetIdLabel = this->footer->findChild<QLabel*>("target-id");
targetNameLabel->setText(QString::fromStdString(this->targetDescriptor.name));
targetIdLabel->setText("0x" + QString::fromStdString(this->targetDescriptor.id).remove("0x").toUpper());
this->variantMenu = this->footer->findChild<QMenu*>("target-variant-menu");
this->ioUnavailableWidget->hide();
std::optional<QString> previouslySelectedVariantName;
if (this->selectedVariant != nullptr) {
previouslySelectedVariantName = QString::fromStdString(this->selectedVariant->name).toLower();
this->selectedVariant = nullptr;
} }
void InsightWindow::close() { this->supportedVariantsByName.clear();
if (this->mainWindowWidget != nullptr) {
this->mainWindowWidget->close(); /*
* We don't want to present the user with duplicate target variants.
*
* In the context of Insight, a variant that doesn't differ in package type or pinout configuration is
* considered a duplicate.
*/
auto processedVariants = std::vector<TargetVariant>();
auto isDuplicateVariant = [&processedVariants](const TargetVariant& variantA) {
return std::ranges::any_of(
processedVariants.begin(),
processedVariants.end(),
[&variantA, &processedVariants](const TargetVariant& variantB) {
if (variantA.package != variantB.package) {
return false;
}
if (variantA.pinDescriptorsByNumber.size() != variantB.pinDescriptorsByNumber.size()) {
return false;
}
if (variantA.pinDescriptorsByNumber != variantB.pinDescriptorsByNumber) {
return false;
}
return true;
}
);
};
for (const auto& targetVariant: this->targetDescriptor.variants) {
if (isDuplicateVariant(targetVariant)) {
continue;
}
auto variantAction = new QAction(this->variantMenu);
variantAction->setText(
QString::fromStdString(targetVariant.name + " (" + targetVariant.packageName + ")")
);
if (InsightWindow::isVariantSupported(targetVariant)) {
auto supportedVariantPtr = &(this->supportedVariantsByName.insert(
std::pair(QString::fromStdString(targetVariant.name).toLower(), targetVariant)
).first->second);
connect(
variantAction,
&QAction::triggered,
this,
[this, supportedVariantPtr] {
this->selectVariant(supportedVariantPtr);
}
);
} else {
variantAction->setEnabled(false);
variantAction->setText(variantAction->text() + " (unsupported)");
}
this->variantMenu->addAction(variantAction);
processedVariants.push_back(targetVariant);
}
this->variantMenu->setEnabled(true);
Logger::debug("Number of target variants supported by Insight: "
+ std::to_string(supportedVariantsByName.size()));
if (!this->supportedVariantsByName.empty()) {
if (previouslySelectedVariantName.has_value()
&& this->supportedVariantsByName.contains(previouslySelectedVariantName.value())
) {
this->selectVariant(&(this->supportedVariantsByName.at(previouslySelectedVariantName.value())));
} else if (this->targetConfig.variantName.has_value()) {
auto selectedVariantName = QString::fromStdString(this->targetConfig.variantName.value());
if (this->supportedVariantsByName.contains(selectedVariantName)) {
// The user has specified a valid variant name in their config file, so use that as the default
this->selectVariant(&(this->supportedVariantsByName.at(selectedVariantName)));
} else {
Logger::error("Invalid target variant name \"" + this->targetConfig.variantName.value()
+ "\" - no such variant with the given name was found.");
} }
} }
void InsightWindow::toggleUi(bool disable) { if (this->selectedVariant == nullptr) {
this->uiDisabled = disable; /*
* Given that we haven't been able to select a variant at this point, we will just fallback to the first
if (this->refreshIoInspectionButton != nullptr) { * one that is available.
this->refreshIoInspectionButton->setDisabled(disable); */
this->refreshIoInspectionButton->repaint(); this->selectVariant(&(this->supportedVariantsByName.begin()->second));
}
} }
void InsightWindow::onLeftPanelHandleSlide(int horizontalPosition) { } else {
auto width = std::max(this->leftPanelMinWidth, this->leftPanel->width() + horizontalPosition); if (this->targetDescriptor.variants.empty()) {
this->leftPanel->setMaximumWidth(width); this->variantMenu->parentWidget()->hide();
this->leftPanel->setFixedWidth(width); }
this->ioUnavailableWidget->setText(
"GPIO inspection is not available for this target. "
"Please report this to Bloom developers by clicking Help -> Report An Issue"
);
this->ioUnavailableWidget->show();
}
auto leftPanelLayout = this->leftPanel->layout();
this->targetRegistersSidePane = new TargetRegistersPaneWidget(
this->targetDescriptor,
insightWorker,
this->leftPanel
);
leftPanelLayout->addWidget(this->targetRegistersSidePane);
this->targetRegistersButton->setChecked(false);
this->targetRegistersButton->setDisabled(false);
this->toggleUi(this->targetState != TargetState::STOPPED);
this->activated = true;
}
void InsightWindow::deactivate() {
if (this->targetPackageWidget != nullptr) {
this->targetPackageWidget->hide();
this->targetPackageWidget->deleteLater();
this->targetPackageWidget = nullptr;
}
if (this->targetRegistersSidePane != nullptr) {
this->targetRegistersSidePane->deactivate();
this->targetRegistersSidePane->deleteLater();
this->leftPanel->setVisible(false);
this->targetRegistersButton->setChecked(false);
this->targetRegistersButton->setDisabled(true);
}
this->ioUnavailableWidget->setText(
"Insight deactivated - Bloom has been disconnected from the target.\n\n"
"Bloom will attempt to reconnect upon the start of a new debug session."
);
this->ioUnavailableWidget->show();
this->targetStatusLabel->setText("Unknown");
this->programCounterValueLabel->setText("-");
this->variantMenu->clear();
this->variantMenu->setEnabled(false);
this->toggleUi(true);
this->activated = false;
}
void InsightWindow::adjustPanels() {
const auto targetPackageWidgetSize = (this->targetPackageWidget != nullptr)
? this->targetPackageWidget->size() : QSize();
const auto containerSize = this->container->size();
/*
* The purpose of the -20 is to ensure there is some padding between the panel borders and the
* target package widget. Looks nicer with the padding.
*/
this->leftPanel->setMaximumResize(
std::max(
this->leftPanel->getMinimumResize(),
containerSize.width() - targetPackageWidgetSize.width() - this->leftMenuBar->width() - 20
)
);
this->bottomPanel->setMaximumResize(
std::max(
this->bottomPanel->getMinimumResize(),
containerSize.height() - targetPackageWidgetSize.height() - this->bottomMenuBar->height() - 20
)
);
}
void InsightWindow::resizeEvent(QResizeEvent* event) {
const auto windowSize = this->size();
this->windowContainer->setFixedSize(windowSize);
this->layoutContainer->setFixedSize(windowSize);
this->adjustPanels();
}
void InsightWindow::showEvent(QShowEvent* event) {
this->adjustPanels();
} }
void InsightWindow::onTargetControllerSuspended() { void InsightWindow::onTargetControllerSuspended() {
@@ -464,7 +492,7 @@ void InsightWindow::openGettingStartedUrl() {
void InsightWindow::openAboutWindow() { void InsightWindow::openAboutWindow() {
if (this->aboutWindowWidget == nullptr) { if (this->aboutWindowWidget == nullptr) {
this->aboutWindowWidget = new AboutWindow(this->mainWindowWidget); this->aboutWindowWidget = new AboutWindow(this->windowContainer);
} }
this->aboutWindowWidget->show(); this->aboutWindowWidget->show();

View File

@@ -13,6 +13,8 @@
#include "src/Targets/TargetDescriptor.hpp" #include "src/Targets/TargetDescriptor.hpp"
#include "src/Targets/TargetVariant.hpp" #include "src/Targets/TargetVariant.hpp"
#include "Widgets/PanelWidget.hpp"
#include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp" #include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp"
#include "Widgets/TargetWidgets/TargetPackageWidget.hpp" #include "Widgets/TargetWidgets/TargetPackageWidget.hpp"
#include "Widgets/TargetRegistersPane/TargetRegistersPaneWidget.hpp" #include "Widgets/TargetRegistersPane/TargetRegistersPaneWidget.hpp"
@@ -20,7 +22,7 @@
namespace Bloom namespace Bloom
{ {
class InsightWindow: public QObject class InsightWindow: public QMainWindow
{ {
Q_OBJECT Q_OBJECT
private: private:
@@ -35,24 +37,28 @@ namespace Bloom
Targets::TargetDescriptor targetDescriptor; Targets::TargetDescriptor targetDescriptor;
Targets::TargetState targetState = Targets::TargetState::UNKNOWN; Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
QWidget* mainWindowWidget = nullptr; QWidget* windowContainer = nullptr;
AboutWindow* aboutWindowWidget = nullptr;
QMenuBar* mainMenuBar = nullptr; QMenuBar* mainMenuBar = nullptr;
QWidget* layoutContainer = nullptr;
QWidget* container = nullptr;
QMenu* variantMenu = nullptr; QMenu* variantMenu = nullptr;
AboutWindow* aboutWindowWidget = nullptr;
QWidget* header = nullptr; QWidget* header = nullptr;
QToolButton* refreshIoInspectionButton = nullptr; QToolButton* refreshIoInspectionButton = nullptr;
QWidget* leftPanel = nullptr; QWidget* leftMenuBar = nullptr;
int leftPanelMinWidth = 300; Widgets::PanelWidget* leftPanel = nullptr;
QWidget* leftPanelLayoutContainer = nullptr;
Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr; Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr;
QToolButton* targetRegistersButton = nullptr; QToolButton* targetRegistersButton = nullptr;
Widgets::InsightTargetWidgets::TargetPackageWidgetContainer* ioContainerWidget = nullptr; Widgets::InsightTargetWidgets::TargetPackageWidgetContainer* ioContainerWidget = nullptr;
QLabel* ioUnavailableWidget = nullptr; QLabel* ioUnavailableWidget = nullptr;
Widgets::InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr; Widgets::InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
QWidget* bottomMenuBar = nullptr;
Widgets::PanelWidget* bottomPanel = nullptr;
QWidget* footer = nullptr; QWidget* footer = nullptr;
QLabel* targetStatusLabel = nullptr; QLabel* targetStatusLabel = nullptr;
QLabel* programCounterValueLabel = nullptr; QLabel* programCounterValueLabel = nullptr;
@@ -69,8 +75,14 @@ namespace Bloom
void activate(); void activate();
void deactivate(); void deactivate();
void adjustPanels();
protected:
void resizeEvent(QResizeEvent* event) override;
void showEvent(QShowEvent* event) override;
public: public:
InsightWindow(QApplication& application, InsightWorker& insightWorker); InsightWindow(InsightWorker& insightWorker);
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) { void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
this->environmentConfig = environmentConfig; this->environmentConfig = environmentConfig;
@@ -83,15 +95,11 @@ namespace Bloom
void init(Targets::TargetDescriptor targetDescriptor); void init(Targets::TargetDescriptor targetDescriptor);
void show();
public slots: public slots:
void onLeftPanelHandleSlide(int horizontalPosition);
void onTargetControllerSuspended(); void onTargetControllerSuspended();
void onTargetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor); void onTargetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
void onTargetStateUpdate(Targets::TargetState newState); void onTargetStateUpdate(Targets::TargetState newState);
void onTargetProgramCounterUpdate(quint32 programCounter); void onTargetProgramCounterUpdate(quint32 programCounter);
void close();
void openReportIssuesUrl(); void openReportIssuesUrl();
void openGettingStartedUrl(); void openGettingStartedUrl();
void openAboutWindow(); void openAboutWindow();

View File

@@ -4,7 +4,7 @@
font-size: 14px; font-size: 14px;
} }
QMainWindow { #main-window #window-container {
background-color: #373835; background-color: #373835;
} }
@@ -112,15 +112,11 @@ QToolTip {
font-size: 13px; font-size: 13px;
} }
#footer { #footer {
position: relative;
background-color: transparent; background-color: transparent;
padding: 0 3px 0 30px; padding: 0 3px 0 30px;
max-height: 25px; max-height: 25px;
width: auto;
border-top: 1px solid #41423f; border-top: 1px solid #41423f;
} }
#footer QLabel, #footer QLabel,
@@ -165,10 +161,6 @@ QToolTip {
min-height: 25px; min-height: 25px;
} }
#footer QLayoutItem {
max-width: 100px;
}
#target-variant-menu::item { #target-variant-menu::item {
padding: 4px 10px 4px 10px; padding: 4px 10px 4px 10px;
} }
@@ -180,8 +172,8 @@ QToolTip {
QScrollBar:vertical { QScrollBar:vertical {
background-color: transparent; background-color: transparent;
width: 15px; width: 12px;
margin: 1px 1px 1px 5px; margin: 1px;
} }
QScrollBar:handle:vertical { QScrollBar:handle:vertical {
@@ -221,8 +213,13 @@ QScrollBar::sub-line:vertical {
border: none; border: none;
} }
#left-panel-layout-container { #left-panel {
border-right: 1px solid #2F2F2D; border-right: 1px solid #2F2F2D;
background-color: transparent;
}
#left-panel-slider {
background-color: transparent;
} }
/* Target Registers Pane */ /* Target Registers Pane */
@@ -292,3 +289,36 @@ QScrollBar::sub-line:vertical {
#target-registers-side-pane #register-item[selected=true] #value[changed=true] { #target-registers-side-pane #register-item[selected=true] #value[changed=true] {
color: #8a8a8d; color: #8a8a8d;
} }
/* Bottom menu bar & panels */
#bottom-menu-bar {
background-color: transparent;
max-height: 22px;
border-top: 1px solid #2F2F2D;
}
#bottom-menu-bar #ram-inspection-btn {
position: relative;
border: none;
min-width: 90px;
min-height: 22px;
}
#bottom-menu-bar #ram-inspection-btn #ram-inspection-btn-icon {
margin-left: 9px;
}
#bottom-menu-bar #ram-inspection-btn #ram-inspection-btn-label {
margin-left: 2px;
}
#bottom-menu-bar QToolButton:hover,
#bottom-menu-bar QToolButton:checked {
background-color: #2F2F2D;
border: none;
}
#bottom-panel {
border-top: 1px solid #2F2F2D;
background-color: transparent;
}

View File

@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<widget class="QMainWindow" name="main-window"> <widget class="QWidget" name="window-container">
<property name="minimumHeight"><number>500</number></property>
<property name="minimumWidth"><number>1000</number></property>
<property name="windowTitle"><string>Bloom Insight</string></property>
<property name="maximized"><bool>false</bool></property>
<widget class="QMenuBar" name="menu-bar"> <widget class="QMenuBar" name="menu-bar">
<property name="nativeMenuBar"> <property name="nativeMenuBar">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimumHeight"><number>25</number></property>
<property name="maximumHeight"><number>25</number></property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"/>
</property>
<widget class="QMenu" name="file-menu"> <widget class="QMenu" name="file-menu">
<property name="title"><string>File</string></property> <property name="title"><string>File</string></property>
@@ -48,7 +48,7 @@
<addaction name="help-menu"/> <addaction name="help-menu"/>
</widget> </widget>
<widget class="QWidget"> <widget class="QWidget" name="layout-container">
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -67,15 +67,15 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<spacer name="header-tool-bar-padding-spacer"> <spacer name="horizontal-spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint"> <property name="sizeHint">
<size> <size>
<width>3</width> <width>3</width>
</size> </size>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
</spacer> </spacer>
</item> </item>
<item> <item>
@@ -104,6 +104,14 @@
</item> </item>
<item> <item>
<widget class="QWidget" name="container"> <widget class="QWidget" name="container">
<layout class="QVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -172,22 +180,19 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="left-panel"> <widget class="PanelWidget" name="left-panel">
<property name="visible"> <property name="visible">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="maximumWidth"> <property name="maximumWidth">
<number>300</number> <number>300</number>
</property> </property>
<layout class="QHBoxLayout"> <property name="minimumResize">
<property name="spacing"> <number>300</number>
<number>0</number>
</property> </property>
<property name="margin"> <property name="handleSize">
<number>0</number> <number>6</number>
</property> </property>
<item>
<widget class="QWidget" name="left-panel-layout-container">
<layout class="QVBoxLayout" name="left-panel-layout"> <layout class="QVBoxLayout" name="left-panel-layout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -198,18 +203,11 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="SlidingHandleWidget" name="left-panel-slider">
<property name="handleWidth">
<number>6</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="TargetPackageWidgetContainer" name="io-container"> <widget class="TargetPackageWidgetContainer" name="io-container">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored"/>
</property>
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<item alignment="Qt::AlignHCenter"> <item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="io-inspection-unavailable"> <widget class="QLabel" name="io-inspection-unavailable">
@@ -226,22 +224,140 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
<item>
<widget class="PanelWidget" name="bottom-panel">
<property name="visible">
<bool>true</bool>
</property>
<property name="panelType">
<enum>PanelWidgetType::BOTTOM</enum>
</property>
<property name="maximumHeight">
<number>200</number>
</property>
<property name="minimumResize">
<number>200</number>
</property>
<property name="handleSize">
<number>6</number>
</property>
<layout class="QHBoxLayout" name="bottom-panel-layout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="bottom-menu-bar">
<layout class="QHBoxLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer name="horizontal-spacer">
<property name="sizeHint">
<size>
<width>22</width>
</size>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="ram-inspection-btn">
<property name="toolTip">
<string>Inspect RAM</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="disabled">
<bool>false</bool>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item alignment="Qt::AlignLeft">
<widget class="SvgWidget" name="ram-inspection-btn-icon">
<property name="containerHeight">
<number>22</number>
</property>
<property name="containerWidth">
<number>15</number>
</property>
<property name="svgFilePath">
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/target-registers.svg</string>
</property>
<property name="disabledSvgFilePath">
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/Images/target-registers-disabled.svg</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignLeft">
<widget class="QLabel" name="ram-inspection-btn-label">
<property name="text">
<string>Memory</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignLeft">
<spacer name="horizontal-spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontal-spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="footer"> <widget class="QWidget" name="footer">
<layout class="QHBoxLayout" stretch="100,0,0"> <layout class="QHBoxLayout">
<property name="spacing"><number>0</number></property> <property name="spacing"><number>0</number></property>
<property name="margin"><number>0</number></property> <property name="margin"><number>0</number></property>
<item alignment="Qt::AlignLeft">
<item>
<widget class="QLabel" name="target-state"> <widget class="QLabel" name="target-state">
<property name="toolTip"> <property name="toolTip">
<string>Target State</string> <string>Target State</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<item alignment="Qt::AlignRight"> <spacer name="horizontal-spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="target-program-counter-value"> <widget class="QLabel" name="target-program-counter-value">
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
@@ -251,24 +367,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="target-name"> <widget class="QLabel" name="target-name">
<property name="toolTip"> <property name="toolTip">
<string>Target Name</string> <string>Target Name</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="target-id"> <widget class="QLabel" name="target-id">
<property name="toolTip"> <property name="toolTip">
<string>Target ID</string> <string>Target ID</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<item alignment="Qt::AlignRight">
<widget class="QMenuBar" name="target-variant-menu-bar"> <widget class="QMenuBar" name="target-variant-menu-bar">
<property name="nativeMenuBar"> <property name="nativeMenuBar">
<bool>false</bool> <bool>false</bool>
@@ -276,6 +389,9 @@
<property name="defaultUp"> <property name="defaultUp">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"/>
</property>
<widget class="QMenu" name="target-variant-menu"> <widget class="QMenu" name="target-variant-menu">
<property name="title"> <property name="title">

View File

@@ -2,11 +2,10 @@
#include <QtUiTools> #include <QtUiTools>
#include "Widgets/PanelWidget.hpp"
#include "Widgets/RotatableLabel.hpp" #include "Widgets/RotatableLabel.hpp"
#include "Widgets/SlidingHandleWidget.hpp"
#include "Widgets/SvgWidget.hpp" #include "Widgets/SvgWidget.hpp"
#include "Widgets/SvgToolButton.hpp" #include "Widgets/SvgToolButton.hpp"
#include "Widgets/ExpandingWidget.hpp"
#include "Widgets/ExpandingHeightScrollAreaWidget.hpp" #include "Widgets/ExpandingHeightScrollAreaWidget.hpp"
#include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp" #include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp"
@@ -17,6 +16,15 @@ using namespace Bloom::Widgets;
UiLoader::UiLoader(QObject* parent): QUiLoader(parent) { UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
this->customWidgetConstructorsByWidgetName = decltype(this->customWidgetConstructorsByWidgetName) { this->customWidgetConstructorsByWidgetName = decltype(this->customWidgetConstructorsByWidgetName) {
{
"PanelWidget",
[this](QWidget* parent, const QString& name) {
auto widget = new PanelWidget(parent);
widget->setObjectName(name);
widget->setStyleSheet(parent->styleSheet());
return widget;
}
},
{ {
"RotatableLabel", "RotatableLabel",
[this](QWidget* parent, const QString& name) { [this](QWidget* parent, const QString& name) {
@@ -26,24 +34,6 @@ UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
return widget; return widget;
} }
}, },
{
"SlidingHandleWidget",
[this](QWidget* parent, const QString& name) {
auto widget = new SlidingHandleWidget(parent);
widget->setObjectName(name);
widget->setStyleSheet(parent->styleSheet());
return widget;
}
},
{
"ExpandingWidget",
[this](QWidget* parent, const QString& name) {
auto widget = new ExpandingWidget(parent);
widget->setObjectName(name);
widget->setStyleSheet(parent->styleSheet());
return widget;
}
},
{ {
"ExpandingHeightScrollAreaWidget", "ExpandingHeightScrollAreaWidget",
[this](QWidget* parent, const QString& name) { [this](QWidget* parent, const QString& name) {

View File

@@ -1,30 +0,0 @@
#pragma once
#include <QWidget>
#include <QSize>
namespace Bloom::Widgets
{
class Q_WIDGETS_EXPORT ExpandingWidget: public QWidget
{
Q_OBJECT
protected:
[[nodiscard]] QSize minimumSizeHint() const override {
auto parentWidget = this->parentWidget();
if (parentWidget != nullptr) {
return parentWidget->size();
}
return QWidget::size();
};
[[nodiscard]] QSize sizeHint() const override {
return this->minimumSizeHint();
};
public:
explicit ExpandingWidget(QWidget* parent): QWidget(parent) {};
};
}

View File

@@ -1,17 +0,0 @@
#include "SlidingHandleWidget.hpp"
#include <QPainter>
using namespace Bloom::Widgets;
void SlidingHandleWidget::mouseMoveEvent(QMouseEvent* event) {
emit this->horizontalSlide(event->pos().x());
}
void SlidingHandleWidget::enterEvent(QEnterEvent* event) {
this->setCursor(Qt::SplitHCursor);
}
void SlidingHandleWidget::leaveEvent(QEvent* event) {
this->setCursor(Qt::ArrowCursor);
}

View File

@@ -1,47 +0,0 @@
#pragma once
#include <QFrame>
#include <QSize>
#include <QEvent>
#include <QMouseEvent>
#include <QEnterEvent>
namespace Bloom::Widgets
{
class Q_WIDGETS_EXPORT SlidingHandleWidget: public QFrame
{
Q_OBJECT
Q_PROPERTY(int handleWidth READ getHandleWidth WRITE setHandleWidth DESIGNABLE true)
protected:
int handleWidth = 10;
void mouseMoveEvent(QMouseEvent* event) override;
void enterEvent(QEnterEvent* event) override;
void leaveEvent(QEvent* event) override;
public:
explicit SlidingHandleWidget(QWidget* parent): QFrame(parent) {};
QSize minimumSizeHint() const override {
return QSize(this->handleWidth, this->parentWidget()->height());
};
QSize sizeHint() const override {
return QSize(this->handleWidth, this->parentWidget()->height());
};
void setHandleWidth(int handleWidth) {
this->handleWidth = handleWidth;
this->setFixedWidth(handleWidth);
}
int getHandleWidth() {
return this->handleWidth;
}
signals:
void horizontalSlide(int position);
};
}

View File

@@ -32,6 +32,9 @@
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
</spacer> </spacer>
</item> </item>
<item alignment="Qt::AlignLeft"> <item alignment="Qt::AlignLeft">

View File

@@ -1,11 +1,9 @@
#include "TargetRegistersPaneWidget.hpp" #include "TargetRegistersPaneWidget.hpp"
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QScrollArea>
#include <set> #include <set>
#include "../../UiLoader.hpp" #include "../../UiLoader.hpp"
#include "../ExpandingWidget.hpp"
#include "RegisterGroupWidget.hpp" #include "RegisterGroupWidget.hpp"
#include "RegisterWidget.hpp" #include "RegisterWidget.hpp"
@@ -25,7 +23,7 @@ using Bloom::Targets::TargetRegisterType;
TargetRegistersPaneWidget::TargetRegistersPaneWidget( TargetRegistersPaneWidget::TargetRegistersPaneWidget(
const TargetDescriptor& targetDescriptor, const TargetDescriptor& targetDescriptor,
InsightWorker& insightWorker, InsightWorker& insightWorker,
QWidget* parent PanelWidget* parent
): QWidget(parent), parent(parent), targetDescriptor(targetDescriptor), insightWorker(insightWorker) { ): QWidget(parent), parent(parent), targetDescriptor(targetDescriptor), insightWorker(insightWorker) {
this->setObjectName("target-registers-side-pane"); this->setObjectName("target-registers-side-pane");
@@ -65,6 +63,8 @@ TargetRegistersPaneWidget::TargetRegistersPaneWidget(
this->filterRegisters(this->searchInput->text()); this->filterRegisters(this->searchInput->text());
}); });
this->itemScrollArea = this->container->findChild<QScrollArea*>("item-scroll-area");
this->itemContainer = this->container->findChild<QWidget*>("item-container"); this->itemContainer = this->container->findChild<QWidget*>("item-container");
auto itemLayout = this->itemContainer->findChild<QVBoxLayout*>(); auto itemLayout = this->itemContainer->findChild<QVBoxLayout*>();
@@ -124,12 +124,19 @@ TargetRegistersPaneWidget::TargetRegistersPaneWidget(
} }
void TargetRegistersPaneWidget::resizeEvent(QResizeEvent* event) { void TargetRegistersPaneWidget::resizeEvent(QResizeEvent* event) {
auto parentSize = this->parent->size(); const auto parentSize = this->parent->size();
this->container->setFixedSize( const auto width = parentSize.width() - 1;
parentSize.width() - 1, this->container->setFixedSize(width, parentSize.height());
parentSize.height() this->searchInput->setFixedWidth(width - 20);
/*
* In order to avoid the panel resize handle overlapping the scroll bar handle, we reduce the size of
* the scroll area.
*/
this->itemScrollArea->setFixedSize(
width - this->parent->getHandleSize(),
parentSize.height() - this->toolBar->height() - this->searchInput->height() - 5
); );
this->searchInput->setFixedWidth(parentSize.width() - 20);
} }
void TargetRegistersPaneWidget::postActivate() { void TargetRegistersPaneWidget::postActivate() {

View File

@@ -2,6 +2,7 @@
#include <QWidget> #include <QWidget>
#include <QLineEdit> #include <QLineEdit>
#include <QScrollArea>
#include <set> #include <set>
#include <QSize> #include <QSize>
#include <QString> #include <QString>
@@ -9,7 +10,8 @@
#include <optional> #include <optional>
#include "ItemWidget.hpp" #include "ItemWidget.hpp"
#include "../SvgToolButton.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.hpp"
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp"
#include "src/Insight/InsightWorker/InsightWorker.hpp" #include "src/Insight/InsightWorker/InsightWorker.hpp"
#include "src/Targets/TargetState.hpp" #include "src/Targets/TargetState.hpp"
#include "src/Targets/TargetDescriptor.hpp" #include "src/Targets/TargetDescriptor.hpp"
@@ -25,7 +27,7 @@ namespace Bloom::Widgets
const Targets::TargetDescriptor& targetDescriptor; const Targets::TargetDescriptor& targetDescriptor;
InsightWorker& insightWorker; InsightWorker& insightWorker;
QWidget* parent = nullptr; PanelWidget* parent = nullptr;
QWidget* container = nullptr; QWidget* container = nullptr;
QWidget* toolBar = nullptr; QWidget* toolBar = nullptr;
@@ -33,6 +35,7 @@ namespace Bloom::Widgets
SvgToolButton* expandAllButton = nullptr; SvgToolButton* expandAllButton = nullptr;
QLineEdit* searchInput = nullptr; QLineEdit* searchInput = nullptr;
QScrollArea* itemScrollArea = nullptr;
QWidget* itemContainer = nullptr; QWidget* itemContainer = nullptr;
ItemWidget* selectedItemWidget = nullptr; ItemWidget* selectedItemWidget = nullptr;
@@ -58,7 +61,7 @@ namespace Bloom::Widgets
TargetRegistersPaneWidget( TargetRegistersPaneWidget(
const Targets::TargetDescriptor& targetDescriptor, const Targets::TargetDescriptor& targetDescriptor,
InsightWorker& insightWorker, InsightWorker& insightWorker,
QWidget *parent PanelWidget *parent
); );
[[nodiscard]] QSize minimumSizeHint() const override { [[nodiscard]] QSize minimumSizeHint() const override {

View File

@@ -13,6 +13,12 @@
<property name="minimumHeight"> <property name="minimumHeight">
<number>28</number> <number>28</number>
</property> </property>
<property name="maximumHeight">
<number>28</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"/>
</property>
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
@@ -61,6 +67,12 @@
<property name="minimumHeight"> <property name="minimumHeight">
<number>27</number> <number>27</number>
</property> </property>
<property name="maximumHeight">
<number>27</number>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"/>
</property>
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -105,15 +117,13 @@
</widget> </widget>
</item> </item>
<item alignment="Qt::AlignTop"> <item alignment="Qt::AlignTop">
<widget class="ExpandingHeightScrollAreaWidget" name="item-scroll-area"> <widget class="QScrollArea" name="item-scroll-area">
<property name="widgetResizable"><bool>true</bool></property> <property name="widgetResizable"><bool>true</bool></property>
<property name="verticalScrollBarPolicy"><enum>Qt::ScrollBarAsNeeded</enum></property> <property name="verticalScrollBarPolicy"><enum>Qt::ScrollBarAsNeeded</enum></property>
<property name="sizeAdjustPolicy"><enum>QAbstractScrollArea::AdjustToContents</enum></property> <property name="sizeAdjustPolicy"><enum>QAbstractScrollArea::AdjustToContents</enum></property>
<property name="horizontalScrollBarPolicy"><enum>Qt::ScrollBarAlwaysOff</enum></property> <property name="horizontalScrollBarPolicy"><enum>Qt::ScrollBarAlwaysOff</enum></property>
<property name="sizePolicy"><enum>QSizePolicy::SetMinAndMaxSize</enum></property>
<widget class="QWidget" name="item-container"> <widget class="QWidget" name="item-container">
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -129,6 +139,13 @@
</widget> </widget>
</widget> </widget>
</item> </item>
<item alignment="Qt::AlignTop">
<spacer name="vertical-spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</ui> </ui>

View File

@@ -1,5 +1,7 @@
#include "TargetPackageWidgetContainer.hpp" #include "TargetPackageWidgetContainer.hpp"
#include <QLayout>
using namespace Bloom; using namespace Bloom;
using namespace Bloom::Widgets::InsightTargetWidgets; using namespace Bloom::Widgets::InsightTargetWidgets;
@@ -23,4 +25,8 @@ void TargetPackageWidgetContainer::resizeEvent(QResizeEvent* event) {
void TargetPackageWidgetContainer::setPackageWidget(TargetPackageWidget* packageWidget) { void TargetPackageWidgetContainer::setPackageWidget(TargetPackageWidget* packageWidget) {
this->packageWidget = packageWidget; this->packageWidget = packageWidget;
if (packageWidget != nullptr) {
this->layout()->addWidget(packageWidget);
}
} }