Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into 0.9 release branch #405

Merged
merged 6 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions HDPS/src/BackgroundTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ namespace mv {

BackgroundTaskHandler* BackgroundTask::backgroundTaskHandler = nullptr;

BackgroundTask::BackgroundTask(QObject* parent, const QString& name, const Status& status /*= Status::Undefined*/, bool mayKill /*= false*/) :
BackgroundTask::BackgroundTask(QObject* parent, const QString& name, bool parentToOverallBackgroundTask /*= true*/, const Status& status /*= Status::Undefined*/, bool mayKill /*= false*/) :
Task(parent, name, GuiScopes{ GuiScope::Background }, status, mayKill, nullptr)
{
//if (core() != nullptr && core()->isInitialized())
// setParentTask(Application::current()->getTask(Application::TaskType::OverallBackground));
if (parentToOverallBackgroundTask)
setParentTask(&BackgroundTask::backgroundTaskHandler->getOverallBackgroundTask());
}

void BackgroundTask::createHandler(QObject* parent)
Expand All @@ -24,8 +24,6 @@ void BackgroundTask::createHandler(QObject* parent)
return;

BackgroundTask::backgroundTaskHandler = new BackgroundTaskHandler(parent);

//backgroundTaskHandler->getOverallBackgroundTaskAction().setTask(Application::current()->getTask(Application::TaskType::OverallBackground));
}

}
3 changes: 2 additions & 1 deletion HDPS/src/BackgroundTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ class BackgroundTask final : public Task
* Construct task with \p parent object, \p name and initial \p status
* @param parent Pointer to parent object
* @param name Name of the task
* @param parentToOverallBackgroundTask Boolean determining whether the task will be automatically parented to the global overall background task
* @param status Initial status of the task
* @param mayKill Boolean determining whether the task may be killed or not
*/
BackgroundTask(QObject* parent, const QString& name, const Status& status = Status::Undefined, bool mayKill = false);
BackgroundTask(QObject* parent, const QString& name, bool parentToOverallBackgroundTask = true, const Status& status = Status::Undefined, bool mayKill = false);

/**
* Creates singleton background task handler
Expand Down
13 changes: 9 additions & 4 deletions HDPS/src/BackgroundTaskHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ namespace mv {

BackgroundTaskHandler::BackgroundTaskHandler(QObject* parent) :
AbstractTaskHandler(parent, nullptr),
_overallBackgroundTask(this, "Background tasks", false),
_overallBackgroundTaskAction(this, "Overall Background Task"),
_tasksStatusBarAction(*tasks().getListModel(), this, "Background tasks", Application::getIconFont("FontAwesome").getIcon("window-maximize"), TasksStatusBarAction::PopupMode::Hover, Task::GuiScope::Background),
_statusBarAction(this, "Status Bar Group")
{
_overallBackgroundTaskAction.setStretch(1);
_overallBackgroundTaskAction.setTask(&_overallBackgroundTask);

_tasksStatusBarAction.setPopupMode(TasksStatusBarAction::PopupMode::Hover);
_tasksStatusBarAction.setConfigurationFlag(WidgetAction::ConfigurationFlag::NoLabelInGroup);
Expand All @@ -30,10 +32,9 @@ BackgroundTaskHandler::BackgroundTaskHandler(QObject* parent) :

auto& tasksFilterModel = _tasksStatusBarAction.getTasksFilterModel();

/*
tasksFilterModel.getTaskScopeFilterAction().setSelectedOptions({ "Background" });
tasksFilterModel.getTaskStatusFilterAction().setSelectedOptions({ "Running Indeterminate", "Running", "Finished", "Aborting" });
tasksFilterModel.getParentTaskFilterAction().setString(Application::current()->getTask(Application::TaskType::OverallBackground)->getId());
tasksFilterModel.getParentTaskFilterAction().setString(_overallBackgroundTask.getId());

const auto overallBackgroundTaskTextFormatter = [this](Task& task) -> QString {
const auto numberOfChildTasks = task.getChildTasksForGuiScopesAndStatuses(false, true, { Task::GuiScope::Background }, { Task::Status::Running, Task::Status::RunningIndeterminate }).count();
Expand Down Expand Up @@ -63,8 +64,12 @@ BackgroundTaskHandler::BackgroundTaskHandler(QObject* parent) :
return {};
};

Application::current()->getTask(Application::TaskType::OverallBackground)->setProgressTextFormatter(overallBackgroundTaskTextFormatter);
*/
_overallBackgroundTask.setProgressTextFormatter(overallBackgroundTaskTextFormatter);
}

mv::BackgroundTask& BackgroundTaskHandler::getOverallBackgroundTask()
{
return _overallBackgroundTask;
}

}
16 changes: 12 additions & 4 deletions HDPS/src/BackgroundTaskHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "AbstractTaskHandler.h"
#include "TasksStatusBarAction.h"
#include "BackgroundTask.h"

#include "actions/TaskAction.h"
#include "actions/HorizontalGroupAction.h"
Expand All @@ -15,7 +16,7 @@ namespace mv {
/**
* Background task handler class
*
* Interact with tasks in a main window status bar popup window.
* Interact with tasks in a main window status bar pop up window.
*
* @author Thomas Kroes
*/
Expand All @@ -35,15 +36,22 @@ class BackgroundTaskHandler final : public AbstractTaskHandler
*/
gui::WidgetAction* getStatusBarAction() override { return &_statusBarAction; }

/**
* Get overall background task
* @return Aggregate background task to which all other background tasks are (in)directly parented
*/
BackgroundTask& getOverallBackgroundTask();

public: // Action getters

gui::TaskAction& getOverallBackgroundTaskAction() { return _overallBackgroundTaskAction; }
gui::TasksStatusBarAction& getTasksStatusBarAction() { return _tasksStatusBarAction; }

private:
gui::TaskAction _overallBackgroundTaskAction;
gui::TasksStatusBarAction _tasksStatusBarAction;
gui::HorizontalGroupAction _statusBarAction;
BackgroundTask _overallBackgroundTask; /** Aggregate background task to which all other background tasks are (in)directly parented */
gui::TaskAction _overallBackgroundTaskAction; /** For showing a task progress action in the status bar */
gui::TasksStatusBarAction _tasksStatusBarAction; /** Status bar action which show the number of background tasks */
gui::HorizontalGroupAction _statusBarAction; /** Combines the overall background task action and the tasks status bar action */
};

}
1 change: 1 addition & 0 deletions HDPS/src/ForegroundTaskHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ForegroundTaskHandler::ForegroundTaskHandler(QObject* parent) :

tasksFilterModel.getTaskScopeFilterAction().setSelectedOptions({ "Foreground" });
tasksFilterModel.getTaskStatusFilterAction().setSelectedOptions({ "Running Indeterminate", "Running", "Finished", "Aborting" });
tasksFilterModel.getTopLevelTasksOnlyAction().setChecked(true);

const auto hideForegroundTasksPopupChanged = [this]() -> void {
const auto hideForegroundTasksPopup = settings().getTasksSettingsAction().getHideForegroundTasksPopupAction().isChecked();
Expand Down
2 changes: 1 addition & 1 deletion HDPS/src/ForegroundTaskTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void ForegroundTaskTester::testPerformance()

QTimer timer;

timer.setInterval(1);
timer.setInterval(100);

connect(performanceTask.get(), &ModalTask::requestAbort, this, [this, &timer, &performanceTask]() -> void {
timer.stop();
Expand Down
Loading
Loading