42 this->scenario = scenario;
49 this->application = application;
58 this->packageName = name;
60 for (
const auto& appl : applications)
74 const QVector<QVariant> previousData =
m_itemData;
75 const Intent previousIntent = pendingIntent;
84 if (scenario.get() !=
nullptr)
87 m_itemData[4] = QString::fromStdString(scenario->getStatus());
88 pendingIntent = aggregateChildIntents();
90 else if (!packageName.empty())
92 m_itemData[0] = QString::fromStdString(packageName);
97 std::vector<std::string> childStati;
106 childStati.push_back(
child(i)->
data(4).toString().toStdString());
110 pendingIntent = aggregateChildIntents();
114 if (application->getInstanceName().empty())
116 m_itemData[0] = application->getName().c_str();
120 m_itemData[0] = (application->getInstanceName() +
"." + application->getName()).c_str();
123 pendingIntent = application->getPendingIntent();
125 std::string
status = application->getStatus();
126 if (!application->getFound())
156 ARMARX_INFO <<
"Application '" + application->getExecutableAbsPath() +
"' not found!";
162 return m_itemData != previousData || pendingIntent != previousIntent;
168 return pendingIntent;
172ScenarioItem::aggregateChildIntents()
174 Intent shared = Intent::None;
178 if (item ==
nullptr || !item->isEnabled())
184 if (childIntent == Intent::None)
188 if (shared == Intent::None)
190 shared = childIntent;
192 else if (shared != childIntent)
TreeItem representing data contained in a Scenario or an Application.
ScenarioManager::Data_Structure::ScenarioPtr getScenario()
If this item represents a Scenario, it is returned.
ScenarioManager::Data_Structure::ApplicationInstancePtr getApplicationInstance()
If this item represents an Application, it is returned.
std::string getPackageName()
ScenarioManager::Data_Structure::Intent getPendingIntent() const
The operation this row is currently moving towards, or Intent::None when idle.
bool update()
Clears the item_data and parses the Scenario or Application for new data.
ScenarioManager::Data_Structure::ApplicationInstanceVectorPtr getApplicationInstances()
ScenarioItem(QList< QVariant > rootData)
Constructor that sets the data contained in this item.
void appendChild(TreeItem *child)
virtual QVariant data(int column) const
void setEnabled(bool enabled)
TreeItem * child(int row)
QVector< QVariant > m_itemData
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
#define ARMARX_INFO
The normal logging level.
std::shared_ptr< Scenario > ScenarioPtr
Intent
What the ScenarioManager is currently trying to do with an application.
std::shared_ptr< ApplicationInstance > ApplicationInstancePtr
std::shared_ptr< std::vector< ApplicationInstancePtr > > ApplicationInstanceVectorPtr
This file offers overloads of toIce() and fromIce() functions for STL container types.
static const std::string Stopped
static const std::string Missing
static const std::string Unknown
static const std::string Inactive
static const std::string Waiting
static std::string Aggregate(const std::vector< std::string > &stati)
Combines the stati of several applications into the status of their common parent (a scenario or the ...
static const std::string Running