Moved global insight refresh into member function. Also enabled spinning animation on the refresh button
This commit is contained in:
@@ -88,32 +88,9 @@ InsightWindow::InsightWindow(InsightWorker& insightWorker): QMainWindow(nullptr)
|
||||
connect(openAboutWindowAction, &QAction::triggered, this, &InsightWindow::openAboutWindow);
|
||||
|
||||
this->header = this->windowContainer->findChild<QWidget*>("header");
|
||||
this->refreshIoInspectionButton = this->header->findChild<QToolButton*>("refresh-io-inspection-btn");
|
||||
this->refreshIoInspectionButton = this->header->findChild<SvgToolButton*>("refresh-io-inspection-btn");
|
||||
|
||||
connect(this->refreshIoInspectionButton, &QToolButton::clicked, this, [this] {
|
||||
// TODO: Move this into a member function - getting too big for a lambda
|
||||
if (this->targetState == TargetState::STOPPED && this->selectedVariant != nullptr) {
|
||||
this->toggleUi(true);
|
||||
if (this->targetPackageWidget != nullptr) {
|
||||
this->targetPackageWidget->setDisabled(true);
|
||||
this->targetPackageWidget->refreshPinStates([this] {
|
||||
if (this->targetState == TargetState::STOPPED) {
|
||||
this->targetPackageWidget->setDisabled(false);
|
||||
|
||||
if (this->targetRegistersSidePane == nullptr || !this->targetRegistersSidePane->activated) {
|
||||
this->toggleUi(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this->targetRegistersSidePane != nullptr && this->targetRegistersSidePane->activated) {
|
||||
this->targetRegistersSidePane->refreshRegisterValues([this] {
|
||||
this->toggleUi(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(this->refreshIoInspectionButton, &QToolButton::clicked, this, &InsightWindow::refresh);
|
||||
|
||||
this->leftMenuBar = this->container->findChild<QWidget*>("left-side-menu-bar");
|
||||
this->leftPanel = this->container->findChild<PanelWidget*>("left-panel");
|
||||
@@ -186,6 +163,36 @@ void InsightWindow::onTargetProgramCounterUpdate(quint32 programCounter) {
|
||||
);
|
||||
}
|
||||
|
||||
void InsightWindow::refresh() {
|
||||
if (this->targetState != TargetState::STOPPED || this->selectedVariant == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->toggleUi(true);
|
||||
this->refreshIoInspectionButton->startSpin();
|
||||
|
||||
if (this->targetPackageWidget != nullptr) {
|
||||
this->targetPackageWidget->setDisabled(true);
|
||||
this->targetPackageWidget->refreshPinStates([this] {
|
||||
if (this->targetState == TargetState::STOPPED) {
|
||||
this->targetPackageWidget->setDisabled(false);
|
||||
|
||||
if (this->targetRegistersSidePane == nullptr || !this->targetRegistersSidePane->activated) {
|
||||
this->refreshIoInspectionButton->stopSpin();
|
||||
this->toggleUi(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this->targetRegistersSidePane != nullptr && this->targetRegistersSidePane->activated) {
|
||||
this->targetRegistersSidePane->refreshRegisterValues([this] {
|
||||
this->refreshIoInspectionButton->stopSpin();
|
||||
this->toggleUi(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void InsightWindow::openReportIssuesUrl() {
|
||||
auto url = QUrl(QString::fromStdString(Paths::homeDomainName() + "/report-issue"));
|
||||
/*
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "Widgets/PanelWidget.hpp"
|
||||
|
||||
#include "Widgets/SvgToolButton.hpp"
|
||||
#include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp"
|
||||
#include "Widgets/TargetWidgets/TargetPackageWidget.hpp"
|
||||
#include "Widgets/TargetRegistersPane/TargetRegistersPaneWidget.hpp"
|
||||
@@ -46,6 +47,7 @@ namespace Bloom
|
||||
void onTargetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
|
||||
void onTargetStateUpdate(Targets::TargetState newState);
|
||||
void onTargetProgramCounterUpdate(quint32 programCounter);
|
||||
void refresh();
|
||||
void openReportIssuesUrl();
|
||||
void openGettingStartedUrl();
|
||||
void openAboutWindow();
|
||||
@@ -80,7 +82,7 @@ namespace Bloom
|
||||
AboutWindow* aboutWindowWidget = nullptr;
|
||||
|
||||
QWidget* header = nullptr;
|
||||
QToolButton* refreshIoInspectionButton = nullptr;
|
||||
Widgets::SvgToolButton* refreshIoInspectionButton = nullptr;
|
||||
|
||||
QWidget* leftMenuBar = nullptr;
|
||||
Widgets::PanelWidget* leftPanel = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user