/*! \brief Create the context menu for the modules tree. */ void ApplicationViewWidget::createModulesViewContextMenu() { modRunAction = new QAction("Run",this); modStopAction = new QAction("Stop",this); modkillAction = new QAction("Kill",this); modSeparator = new QAction(this); modSeparator->setSeparator(true); modRefreshAction = new QAction("Refresh Status",this); modSelectAllAction = new QAction("Select All Modules",this); modAttachAction = new QAction("Attach to stdout",this); modAssignAction = new QAction("Assign Hosts",this); modRunAction->setIcon(QIcon(":/images/run_ico.png")); modStopAction->setIcon(QIcon(":/images/stop_ico.png")); modkillAction->setIcon(QIcon(":/images/kill_ico.png")); modRefreshAction->setIcon(QIcon(":/images/progress_ico.png")); modSelectAllAction->setIcon(QIcon(":/images/selectall_ico.png")); modAssignAction->setIcon(QIcon(":/images/yesres_ico.png")); ui->moduleList->addAction(modRunAction); ui->moduleList->addAction(modStopAction); ui->moduleList->addAction(modkillAction); ui->moduleList->addAction(modSeparator); ui->moduleList->addAction(modRefreshAction); ui->moduleList->addAction(modSelectAllAction); ui->moduleList->addAction(modAttachAction); ui->moduleList->addAction(modAssignAction); connect(modRunAction,SIGNAL(triggered()),this,SLOT(onRun())); connect(modStopAction,SIGNAL(triggered()),this,SLOT(onStop())); connect(modkillAction,SIGNAL(triggered()),this,SLOT(onKill())); connect(modRefreshAction,SIGNAL(triggered()),this,SLOT(onRefresh())); connect(modSelectAllAction,SIGNAL(triggered()),this,SLOT(selectAllModule())); }
/*! \brief Called when the Stop button has been pressed */ bool ApplicationViewWidget::onStop() { if(manager.busy()){ return false; } std::vector<int> MIDs; for(int i=0;i<ui->moduleList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->moduleList->topLevelItem(i); if(it->isSelected()){ //moduluesIDs.append(it->text(1).toInt()); MIDs.push_back(it->text(1).toInt()); manager.updateExecutable(it->text(1).toInt(), it->text(4).toLatin1().data(), it->text(3).toLatin1().data(), it->text(5).toLatin1().data(), it->text(6).toLatin1().data(), it->text(7).toLatin1().data()); it->setText(2,"waiting"); it->setIcon(0,QIcon(":/images/progress_ico.png")); it->setTextColor(2,QColor("#000000")); } } manager.safeStop(MIDs); yarp::os::Time::delay(0.1); selectAllModule(false); return true; }
/*! \brief Refresh all*/ void ApplicationViewWidget::refresh() { selectAllConnections(true); selectAllModule(true); selectAllResources(true); onRefresh(); }
/*! \brief Called when the Refresh button has been pressed */ bool ApplicationViewWidget::onRefresh() { if(manager.busy()){ return false; } std::vector<int> modulesIDs; std::vector<int> connectionsIDs; std::vector<int> resourcesIDs; for(int i=0;i<ui->moduleList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->moduleList->topLevelItem(i); if(it->isSelected()){ modulesIDs.push_back(it->text(1).toInt()); it->setText(2,"waiting"); it->setIcon(0,QIcon(":/images/progress_ico.png")); it->setTextColor(2,QColor("#000000")); } } for(int i=0;i<ui->connectionList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->connectionList->topLevelItem(i); if(it->isSelected()){ connectionsIDs.push_back(it->text(1).toInt()); it->setText(2,"waiting"); it->setIcon(0,QIcon(":/images/progress_ico.png")); it->setTextColor(2,QColor("#000000")); } } for(int i=0;i<ui->resourcesList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->resourcesList->topLevelItem(i); if(it->isSelected()){ resourcesIDs.push_back(it->text(1).toInt()); it->setText(3,"waiting"); it->setIcon(0,QIcon(":/images/progress_ico.png")); it->setTextColor(3,QColor("#000000")); } } manager.safeRefresh(modulesIDs, connectionsIDs, resourcesIDs); yarp::os::Time::delay(0.1); selectAllConnections(false); selectAllModule(false); selectAllResources(false); }
/*! \brief Create the context menu for the modules tree. */ void ApplicationViewWidget::createModulesViewContextMenu() { modRunAction = new QAction("Run",this); modStopAction = new QAction("Stop",this); modkillAction = new QAction("Kill",this); modSeparator = new QAction(this); modSeparator->setSeparator(true); modRefreshAction = new QAction("Refresh Status",this); modSelectAllAction = new QAction("Select All Modules",this); modAttachAction = new QAction("Attach to stdout",this); modAssignAction = new QAction("Assign Hosts",this); modRunAction->setIcon(QIcon(":/play22.svg")); modStopAction->setIcon(QIcon(":/stop22.svg")); modkillAction->setIcon(QIcon(":/kill22.svg")); modRefreshAction->setIcon(QIcon(":/refresh22.svg")); modSelectAllAction->setIcon(QIcon(":/select-all22.svg")); modAssignAction->setIcon(QIcon(":/computer-available22.svg")); ui->moduleList->addAction(modRunAction); ui->moduleList->addAction(modStopAction); ui->moduleList->addAction(modkillAction); ui->moduleList->addAction(modSeparator); ui->moduleList->addAction(modRefreshAction); ui->moduleList->addAction(modSelectAllAction); ui->moduleList->addAction(modAttachAction); ui->moduleList->addAction(modAssignAction); connect(modRunAction,SIGNAL(triggered()),this,SLOT(onRun())); connect(modStopAction,SIGNAL(triggered()),this,SLOT(onStop())); connect(modkillAction,SIGNAL(triggered()),this,SLOT(onKill())); connect(modRefreshAction,SIGNAL(triggered()),this,SLOT(onRefresh())); connect(modSelectAllAction,SIGNAL(triggered()),this,SLOT(selectAllModule())); connect(modAttachAction,SIGNAL(triggered()),this,SLOT(onAttachStdout())); connect(modAssignAction,SIGNAL(triggered()),this,SLOT(onAssignHost())); }
/*! \brief Kill all running modules in the application */ void ApplicationViewWidget::killApplicationSet() { selectAllModule(true); onKill(); }
/*! \brief Stop all modules in the application */ void ApplicationViewWidget::stopApplicationSet() { selectAllModule(true); onStop(); }
/*! \brief Run all modules in the application */ void ApplicationViewWidget::runApplicationSet() { selectAllModule(true); onRun(); }
/*! \brief Select all element in the widget (modules, connections, resources) */ void ApplicationViewWidget::selectAll() { selectAllConnections(true); selectAllModule(true); selectAllResources(true); }
/*! \brief Select all modules */ void ApplicationViewWidget::selectAllModule() { selectAllModule(true); }