Refactored TaskProgressIndicator widget to remain in place and support multiple tasks

This commit is contained in:
Nav
2023-04-11 22:23:48 +01:00
parent fb0a5fef3b
commit 73b31fd22b
4 changed files with 102 additions and 80 deletions

View File

@@ -134,8 +134,8 @@ 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);
this->taskProgressIndicator = new TaskProgressIndicator(this);
this->bottomBarLayout->insertWidget(5, this->taskProgressIndicator);
QObject::connect(
this,
@@ -370,7 +370,7 @@ namespace Bloom::Widgets
);
}
this->setTaskProgressIndicator(readStackPointerTask);
this->taskProgressIndicator->addTask(readStackPointerTask);
InsightWorker::queueTask(readStackPointerTask);
}
}
@@ -415,7 +415,7 @@ namespace Bloom::Widgets
);
}
this->setTaskProgressIndicator(readMemoryTask);
this->taskProgressIndicator->addTask(readMemoryTask);
InsightWorker::queueTask(readMemoryTask);
}
@@ -632,33 +632,7 @@ namespace Bloom::Widgets
}
void TargetMemoryInspectionPane::onSubtaskCreated(const QSharedPointer<InsightWorkerTask>& 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);
this->taskProgressIndicator->addTask(task);
}
void TargetMemoryInspectionPane::setStaleData(bool staleData) {

View File

@@ -81,7 +81,6 @@ namespace Bloom::Widgets
SnapshotManager* snapshotManager = nullptr;
TaskProgressIndicator* taskProgressIndicator = nullptr;
QSpacerItem* bottomBarHorizontalSpacer = nullptr;
QWidget* staleDataLabelContainer = nullptr;
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
@@ -106,7 +105,6 @@ namespace Bloom::Widgets
Targets::TargetMemoryAddressRange addressRange
);
void onSubtaskCreated(const QSharedPointer<InsightWorkerTask>& task);
void setTaskProgressIndicator(const QSharedPointer<InsightWorkerTask>& task);
void setStaleData(bool staleData);
};
}