* allow hiding of indexing dialogs to browse loaded project while indexing * show indexing status in status bar while indexing * use different dialog views for different use cases to avoid state collisions * fixed error label in status bar jittering while indexing * show hand cursors for clickable elements in status bar * indexing is not interrupted on pressing ESC while in hidden * disable error table and error label while indexing * refactored indexing messages * forbid indexing and changing project while indexing * don't show indexing status messages in status bar when indexing in the background * allow tasks to run in the background fortune cookie message = A journey is waiting for you.
54 lines
950 B
C++
54 lines
950 B
C++
#include "utility/scheduling/Task.h"
|
|
|
|
#include "utility/scheduling/TaskScheduler.h"
|
|
|
|
void Task::dispatch(std::shared_ptr<Task> task)
|
|
{
|
|
TaskScheduler::getInstance()->pushTask(task);
|
|
}
|
|
|
|
void Task::dispatchNext(std::shared_ptr<Task> task)
|
|
{
|
|
TaskScheduler::getInstance()->pushNextTask(task);
|
|
}
|
|
|
|
void Task::setIsBackgroundTask(bool background)
|
|
{
|
|
m_isBackgroundTask = background;
|
|
}
|
|
|
|
Task::TaskState Task::update(std::shared_ptr<Blackboard> blackboard)
|
|
{
|
|
if (!m_enterCalled)
|
|
{
|
|
doEnter(blackboard);
|
|
m_enterCalled = true;
|
|
}
|
|
|
|
TaskState state = doUpdate(blackboard);
|
|
|
|
if (m_isBackgroundTask && state == STATE_RUNNING)
|
|
{
|
|
state = STATE_HOLD;
|
|
}
|
|
|
|
if ((state == STATE_SUCCESS || state == STATE_FAILURE) && !m_exitCalled)
|
|
{
|
|
doExit(blackboard);
|
|
m_exitCalled = true;
|
|
}
|
|
|
|
return state;
|
|
}
|
|
|
|
void Task::reset(std::shared_ptr<Blackboard> blackboard)
|
|
{
|
|
doReset(blackboard);
|
|
m_enterCalled = false;
|
|
m_exitCalled = false;
|
|
}
|
|
|
|
void Task::terminate()
|
|
{
|
|
}
|