ui: Added custom tooltipping to code and graph (issue #195)
* Tooltips show node type with access specifier, reference count and fully qualified name * Fields and global variables include the type name * Methods and functinos show whole signature. Gets broken into multiple lines if too long. Included changes: * Upgraded to C++14 * fixed clang warnings * Pass location of .srctrlprj file to build.sh script to load on launch * Split off QtCodeField for showing highlighted and annotated code fom QtCodeArea * removed TokenComponentSignature * added TaskDecoratorDelay bug id = 195
This commit is contained in:
@@ -11,6 +11,7 @@ public:
|
||||
enum TaskState
|
||||
{
|
||||
STATE_RUNNING,
|
||||
STATE_HOLD,
|
||||
STATE_SUCCESS,
|
||||
STATE_FAILURE
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "utility/scheduling/TaskDecorator.h"
|
||||
|
||||
#include "utility/scheduling/TaskRunner.h"
|
||||
|
||||
TaskDecorator::TaskDecorator()
|
||||
{
|
||||
}
|
||||
@@ -14,7 +16,20 @@ std::shared_ptr<TaskDecorator> TaskDecorator::addChildTask(std::shared_ptr<Task>
|
||||
return shared_from_this();
|
||||
}
|
||||
|
||||
void TaskDecorator::setTask(std::shared_ptr<Task> task)
|
||||
{
|
||||
if (task)
|
||||
{
|
||||
m_taskRunner = std::make_shared<TaskRunner>(task);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskDecorator::terminate()
|
||||
{
|
||||
doTerminate();
|
||||
}
|
||||
|
||||
void TaskDecorator::doTerminate()
|
||||
{
|
||||
m_taskRunner->terminate();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "utility/scheduling/Task.h"
|
||||
|
||||
class TaskRunner;
|
||||
|
||||
class TaskDecorator
|
||||
: public Task
|
||||
, public std::enable_shared_from_this<TaskDecorator>
|
||||
@@ -14,11 +16,14 @@ public:
|
||||
virtual ~TaskDecorator();
|
||||
std::shared_ptr<TaskDecorator> addChildTask(std::shared_ptr<Task> child);
|
||||
|
||||
virtual void setTask(std::shared_ptr<Task> task) = 0;
|
||||
virtual void setTask(std::shared_ptr<Task> task);
|
||||
virtual void terminate();
|
||||
|
||||
protected:
|
||||
std::shared_ptr<TaskRunner> m_taskRunner;
|
||||
|
||||
private:
|
||||
virtual void doTerminate() = 0;
|
||||
virtual void doTerminate();
|
||||
};
|
||||
|
||||
#endif // TASK_DECORATOR_H
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#include "utility/scheduling/TaskDecoratorDelay.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
TaskDecoratorDelay::TaskDecoratorDelay(size_t delayMS)
|
||||
: m_delayMS(delayMS)
|
||||
, m_delayComplete(delayMS == 0)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskDecoratorDelay::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
m_start = TimePoint::now();
|
||||
}
|
||||
|
||||
Task::TaskState TaskDecoratorDelay::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
if (m_delayComplete)
|
||||
{
|
||||
return m_taskRunner->update(blackboard);
|
||||
}
|
||||
|
||||
const int SLEEP_TIME_MS = 25;
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(SLEEP_TIME_MS));
|
||||
|
||||
m_delayComplete = (TimePoint::now().deltaMS(m_start) >= m_delayMS);
|
||||
|
||||
return Task::STATE_HOLD;
|
||||
}
|
||||
|
||||
void TaskDecoratorDelay::doExit(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskDecoratorDelay::doReset(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
if (m_delayComplete)
|
||||
{
|
||||
m_taskRunner->reset();
|
||||
}
|
||||
}
|
||||
|
||||
void TaskDecoratorDelay::doTerminate()
|
||||
{
|
||||
if (m_delayComplete)
|
||||
{
|
||||
m_taskRunner->terminate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef TASK_DECORATOR_DELAY_H
|
||||
#define TASK_DECORATOR_DELAY_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "utility/scheduling/TaskDecorator.h"
|
||||
#include "utility/scheduling/TaskRunner.h"
|
||||
#include "utility/TimePoint.h"
|
||||
|
||||
class TaskDecoratorDelay
|
||||
: public TaskDecorator
|
||||
{
|
||||
public:
|
||||
TaskDecoratorDelay(size_t delayMS);
|
||||
|
||||
private:
|
||||
virtual void doEnter(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual TaskState doUpdate(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doExit(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doReset(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doTerminate();
|
||||
|
||||
const size_t m_delayMS;
|
||||
|
||||
TimePoint m_start;
|
||||
bool m_delayComplete;
|
||||
};
|
||||
|
||||
#endif // TASK_DECORATOR_DELAY_H
|
||||
@@ -6,14 +6,6 @@ TaskDecoratorRepeat::TaskDecoratorRepeat(ConditionType condition, TaskState exit
|
||||
{
|
||||
}
|
||||
|
||||
void TaskDecoratorRepeat::setTask(std::shared_ptr<Task> task)
|
||||
{
|
||||
if (task)
|
||||
{
|
||||
m_taskRunner = std::make_shared<TaskRunner>(task);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskDecoratorRepeat::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
@@ -48,8 +40,3 @@ void TaskDecoratorRepeat::doReset(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
m_taskRunner->reset();
|
||||
}
|
||||
|
||||
void TaskDecoratorRepeat::doTerminate()
|
||||
{
|
||||
m_taskRunner->terminate();
|
||||
}
|
||||
|
||||
@@ -17,16 +17,12 @@ public:
|
||||
|
||||
TaskDecoratorRepeat(ConditionType condition, TaskState exitState);
|
||||
|
||||
virtual void setTask(std::shared_ptr<Task> task);
|
||||
|
||||
private:
|
||||
virtual void doEnter(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual TaskState doUpdate(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doExit(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doReset(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doTerminate();
|
||||
|
||||
std::shared_ptr<TaskRunner> m_taskRunner;
|
||||
const ConditionType m_condition;
|
||||
const TaskState m_exitState;
|
||||
};
|
||||
|
||||
@@ -105,7 +105,7 @@ void TaskGroupParallel::processTaskThreaded(
|
||||
{
|
||||
TaskState state = taskInfo->taskRunner->update(blackboard);
|
||||
|
||||
if (state != STATE_RUNNING)
|
||||
if (state == STATE_SUCCESS || state == STATE_FAILURE)
|
||||
{
|
||||
if (state == STATE_FAILURE)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,10 @@ Task::TaskState TaskGroupSelector::doUpdate(std::shared_ptr<Blackboard> blackboa
|
||||
{
|
||||
m_taskIndex = -1;
|
||||
}
|
||||
else if (state == STATE_HOLD)
|
||||
{
|
||||
return STATE_HOLD;
|
||||
}
|
||||
|
||||
return STATE_RUNNING;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,10 @@ Task::TaskState TaskGroupSequence::doUpdate(std::shared_ptr<Blackboard> blackboa
|
||||
{
|
||||
m_taskIndex = -1;
|
||||
}
|
||||
else if (state == STATE_HOLD)
|
||||
{
|
||||
return STATE_HOLD;
|
||||
}
|
||||
|
||||
return STATE_RUNNING;
|
||||
}
|
||||
|
||||
@@ -146,6 +146,7 @@ void TaskScheduler::processTasks()
|
||||
while (m_taskRunners.size())
|
||||
{
|
||||
std::shared_ptr<TaskRunner> runner = m_taskRunners.front();
|
||||
Task::TaskState state = Task::STATE_RUNNING;
|
||||
|
||||
{
|
||||
m_tasksMutex.unlock();
|
||||
@@ -166,7 +167,8 @@ void TaskScheduler::processTasks()
|
||||
}
|
||||
}
|
||||
|
||||
if (runner->update(blackboard) != Task::STATE_RUNNING)
|
||||
state = runner->update(blackboard);
|
||||
if (state != Task::STATE_RUNNING)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -174,6 +176,11 @@ void TaskScheduler::processTasks()
|
||||
}
|
||||
|
||||
m_taskRunners.pop_front();
|
||||
|
||||
if (state == Task::STATE_HOLD)
|
||||
{
|
||||
m_taskRunners.push_back(runner);
|
||||
}
|
||||
}
|
||||
|
||||
m_terminateRunningTasks = false;
|
||||
|
||||
Reference in New Issue
Block a user