New TaskProgressIndicator widget for the memory inspection pane
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/ErrorDialogue.hpp"
|
||||
|
||||
#include "src/Insight/InsightWorker/Tasks/RetrieveMemorySnapshots.hpp"
|
||||
#include "src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.hpp"
|
||||
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||
|
||||
#include "src/Services/PathService.hpp"
|
||||
@@ -161,6 +160,8 @@ namespace Bloom::Widgets
|
||||
}
|
||||
);
|
||||
|
||||
emit this->captureTaskCreated(captureTask);
|
||||
|
||||
InsightWorker::queueTask(captureTask);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.hpp"
|
||||
|
||||
#include "src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.hpp"
|
||||
|
||||
#include "./CreateSnapshotWindow/CreateSnapshotWindow.hpp"
|
||||
#include "MemorySnapshotItem.hpp"
|
||||
|
||||
@@ -35,6 +37,9 @@ namespace Bloom::Widgets
|
||||
PanelWidget* parent = nullptr
|
||||
);
|
||||
|
||||
signals:
|
||||
void captureTaskCreated(const QSharedPointer<CaptureMemorySnapshot>& task);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
@@ -69,16 +69,13 @@ namespace Bloom::Widgets
|
||||
this->container->setStyleSheet(stylesheetFile.readAll());
|
||||
this->container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
|
||||
this->subContainerLayout = this->container->findChild<QHBoxLayout*>("container-sub-layout");
|
||||
|
||||
this->titleBar = this->container->findChild<QWidget*>("title-bar");
|
||||
|
||||
this->titleBar->layout()->setContentsMargins(7, 0, 7, 0);
|
||||
auto* titleLabel = this->titleBar->findChild<Label*>("title");
|
||||
titleLabel->setText(memoryName);
|
||||
this->bottomBar = this->container->findChild<QWidget*>("bottom-bar");
|
||||
this->bottomBarLayout = this->bottomBar->findChild<QHBoxLayout*>();
|
||||
|
||||
// Quick sanity check to ensure the validity of persisted settings.
|
||||
this->sanitiseSettings();
|
||||
|
||||
this->subContainerLayout = this->container->findChild<QHBoxLayout*>("container-sub-layout");
|
||||
this->manageMemoryRegionsButton = this->container->findChild<SvgToolButton*>("manage-memory-regions-btn");
|
||||
this->manageMemorySnapshotsButton = this->container->findChild<QToolButton*>("manage-memory-snapshots-btn");
|
||||
|
||||
@@ -91,10 +88,17 @@ namespace Bloom::Widgets
|
||||
|
||||
this->manageMemorySnapshotsButton->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
this->staleDataLabelContainer = this->container->findChild<QWidget*>("stale-data-label");
|
||||
|
||||
this->titleBar->layout()->setContentsMargins(7, 0, 7, 0);
|
||||
auto* titleLabel = this->titleBar->findChild<Label*>("title");
|
||||
titleLabel->setText(memoryName);
|
||||
|
||||
auto* memoryCapacityLabel = this->container->findChild<Label*>("memory-capacity-label");
|
||||
memoryCapacityLabel->setText(QLocale(QLocale::English).toString(this->targetMemoryDescriptor.size()) + " Bytes");
|
||||
|
||||
this->staleDataLabelContainer = this->container->findChild<QWidget*>("stale-data-label");
|
||||
// Quick sanity check to ensure the validity of persisted settings.
|
||||
this->sanitiseSettings();
|
||||
|
||||
this->hexViewerWidget = new HexViewerWidget(
|
||||
this->targetMemoryDescriptor,
|
||||
@@ -128,6 +132,9 @@ namespace Bloom::Widgets
|
||||
this->setRefreshOnTargetStopEnabled(this->settings.refreshOnTargetStop);
|
||||
this->setRefreshOnActivationEnabled(this->settings.refreshOnActivation);
|
||||
|
||||
this->bottomBarHorizontalSpacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
this->bottomBarLayout->insertItem(5, this->bottomBarHorizontalSpacer);
|
||||
|
||||
QObject::connect(
|
||||
this,
|
||||
&PaneWidget::paneActivated,
|
||||
@@ -188,6 +195,13 @@ namespace Bloom::Widgets
|
||||
}
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
this->snapshotManager,
|
||||
&SnapshotManager::captureTaskCreated,
|
||||
this,
|
||||
&TargetMemoryInspectionPane::onCaptureMemoryTaskCreated
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
this->refreshButton,
|
||||
&QToolButton::clicked,
|
||||
@@ -397,6 +411,7 @@ namespace Bloom::Widgets
|
||||
);
|
||||
}
|
||||
|
||||
this->setTaskProgressIndicator(readMemoryTask);
|
||||
InsightWorker::queueTask(readMemoryTask);
|
||||
}
|
||||
|
||||
@@ -612,6 +627,36 @@ namespace Bloom::Widgets
|
||||
}
|
||||
}
|
||||
|
||||
void TargetMemoryInspectionPane::onCaptureMemoryTaskCreated(const QSharedPointer<CaptureMemorySnapshot>& task) {
|
||||
this->setTaskProgressIndicator(task);
|
||||
}
|
||||
|
||||
void TargetMemoryInspectionPane::setTaskProgressIndicator(const QSharedPointer<InsightWorkerTask>& task) {
|
||||
if (this->taskProgressIndicator != nullptr) {
|
||||
this->bottomBarLayout->removeWidget(this->taskProgressIndicator);
|
||||
this->taskProgressIndicator->deleteLater();
|
||||
this->taskProgressIndicator = nullptr;
|
||||
}
|
||||
|
||||
this->taskProgressIndicator = new TaskProgressIndicator(task, this);
|
||||
|
||||
QObject::connect(
|
||||
this->taskProgressIndicator,
|
||||
&TaskProgressIndicator::taskComplete,
|
||||
this,
|
||||
[this] {
|
||||
this->bottomBarLayout->removeWidget(this->taskProgressIndicator);
|
||||
this->taskProgressIndicator->deleteLater();
|
||||
this->taskProgressIndicator = nullptr;
|
||||
|
||||
this->bottomBarLayout->insertItem(5, this->bottomBarHorizontalSpacer);
|
||||
}
|
||||
);
|
||||
|
||||
this->bottomBarLayout->removeItem(this->bottomBarHorizontalSpacer);
|
||||
this->bottomBarLayout->insertWidget(5, this->taskProgressIndicator);
|
||||
}
|
||||
|
||||
void TargetMemoryInspectionPane::setStaleData(bool staleData) {
|
||||
this->staleData = staleData;
|
||||
this->staleDataLabelContainer->setVisible(this->staleData);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QResizeEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QToolButton>
|
||||
#include <QSpacerItem>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/PaneWidget.hpp"
|
||||
@@ -16,6 +17,9 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TaskProgressIndicator/TaskProgressIndicator.hpp"
|
||||
|
||||
#include "src/Insight/InsightWorker/Tasks/CaptureMemorySnapshot.hpp"
|
||||
|
||||
#include "HexViewerWidget/HexViewerWidget.hpp"
|
||||
#include "MemoryRegionManager/MemoryRegionManagerWindow.hpp"
|
||||
@@ -59,6 +63,9 @@ namespace Bloom::Widgets
|
||||
QHBoxLayout* subContainerLayout = nullptr;
|
||||
|
||||
QWidget* titleBar = nullptr;
|
||||
QWidget* bottomBar = nullptr;
|
||||
QHBoxLayout* bottomBarLayout = nullptr;
|
||||
|
||||
SvgToolButton* manageMemoryRegionsButton = nullptr;
|
||||
QToolButton* manageMemorySnapshotsButton = nullptr;
|
||||
|
||||
@@ -73,6 +80,8 @@ namespace Bloom::Widgets
|
||||
PanelWidget* rightPanel = nullptr;
|
||||
SnapshotManager* snapshotManager = nullptr;
|
||||
|
||||
TaskProgressIndicator* taskProgressIndicator = nullptr;
|
||||
QSpacerItem* bottomBarHorizontalSpacer = nullptr;
|
||||
QWidget* staleDataLabelContainer = nullptr;
|
||||
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
@@ -96,6 +105,8 @@ namespace Bloom::Widgets
|
||||
Bloom::Targets::TargetMemoryType memoryType,
|
||||
Targets::TargetMemoryAddressRange addressRange
|
||||
);
|
||||
void onCaptureMemoryTaskCreated(const QSharedPointer<CaptureMemorySnapshot>& task);
|
||||
void setTaskProgressIndicator(const QSharedPointer<InsightWorkerTask>& task);
|
||||
void setStaleData(bool staleData);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -366,6 +366,9 @@
|
||||
<property name="toolTip">
|
||||
<string>Memory Capacity</string>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -385,8 +388,25 @@
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontal-spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>5</width>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontal-spacer">
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>15</width>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
@@ -395,6 +415,9 @@
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
|
||||
Reference in New Issue
Block a user