void ControllerManagerPlugin::tree_controllers_widget_ContextMenu(const QPoint& aPoint)
	{
		QTreeWidgetItem* itemSelected = tree_controllers_widget_->itemAt(aPoint);
		QString state = itemSelected->text(1);
		QString name = itemSelected->text(0);
		
		#if TRACE_ControllerManagerPlugin_ACTIVATED
			ROS_INFO("name = %s, state = %s",name.toStdString().c_str(), state.toStdString().c_str());
		#endif
		
		QMenu menu(tree_controllers_widget_);
		QIcon icon_start(QString::fromUtf8(":/icons/media-playback-start.png"));
		QIcon icon_stop(QString::fromUtf8(":/icons/media-playback-stop.png"));
		QAction* action_start;
		QAction* action_stop;
		
		if (state == "running")
		{
			action_stop = menu.addAction(icon_stop,"Stop Controller");
		}
		else
		if (state == "stopped")
		{
			action_start = menu.addAction(icon_start,"Start Controller");
		}
		
		QAction* action_menu_selected = menu.exec(tree_controllers_widget_->mapToGlobal(aPoint));
		
		if (action_menu_selected != NULL)
		{
		
			if (action_menu_selected->text() == action_start->text())
			{
				#if TRACE_ControllerManagerPlugin_ACTIVATED
					ROS_INFO("action_start !");
				#endif
				switchController_(name, ActionController::START);
			}
			else
				if (action_menu_selected->text() == action_stop->text())
				{
					#if TRACE_ControllerManagerPlugin_ACTIVATED
						ROS_INFO("action_stop !");
					#endif
					switchController_(name, ActionController::STOP);
				}
		}
		
	}
Пример #2
0
VDWindow::VDWindow(QWidget *parent) : QWidget(parent)
{
    QHBoxLayout *boxLayout = new QHBoxLayout();

    setLayout(boxLayout);

    toolbar = new QToolBar("Toolbar", this);
    QIcon icon_break(":/icon-break");
    action_break = new QAction(icon_break, "Break main", 0);
    toolbar->addAction(action_break);
    QIcon icon_run(":/icon-run");
    action_run = new QAction(icon_run, "Run", 0);
    toolbar->addAction(action_run);
    QIcon icon_stepin(":/icon-stepin");
    action_stepin = new QAction(icon_stepin, "Step in", 0);
    toolbar->addAction(action_stepin);
    QIcon icon_stepover(":/icon-stepover");
    action_stepover = new QAction(icon_stepover, "Step over", 0);
    toolbar->addAction(action_stepover);
    QIcon icon_stepout(":/icon-stepout");
    action_stepout = new QAction(icon_stepout, "Step out", 0);
    toolbar->addAction(action_stepout);
    QIcon icon_listlocals(":/icon-listlocals");
    action_listlocals = new QAction(icon_listlocals, "List locals", 0);
    toolbar->addAction(action_listlocals);
    QIcon icon_stop(":/icon-stop");
    action_stop = new QAction(icon_stop, "Interrupt", 0);
    toolbar->addAction(action_stop);
    QIcon icon_quit(":/icon-quit");
    action_quit = new QAction(icon_quit, "Quit", 0);
    toolbar->addAction(action_quit);

    toolbar->addSeparator();
    boxLayout->setMenuBar(toolbar);

    splitter = new QSplitter(this);
    boxLayout->addWidget(splitter);

    m_debug_output = new QPlainTextEdit("Text", this);
    m_debug_output->setGeometry(10, 50, 500, 200);
    m_debug_output->appendPlainText("Startup text.");
    splitter->addWidget(m_debug_output);
    view = new QGraphicsView(this);
    splitter->addWidget(view);

    scene = new QGraphicsScene();
    view->setScene(scene);
    QPixmap image;
    item = scene->addPixmap(image);
    view->show();

    //QBrush blueBrush(Qt::blue);
    //QPen outlinePen(Qt::black);
    //QGraphicsRectItem *rect = scene->addRect(10, 10, 100, 100, outlinePen, blueBrush);
    //rect->setFlag(QGraphicsItem::ItemIsMovable);

    program = "gdb testapp -iex \"set auto-load safe-path /\" --interpreter=mi2";
    process = new QProcess();

    process->setProcessChannelMode(QProcess::MergedChannels);
    process->setWorkingDirectory("/home/ilze/Documents");
    process->start(program);
    appExecuting = false;

    parser = new GDBMIParser(m_debug_output, this);
    writer = new GDBMIWriter(process);
    varList = new VDVariableList(parser, writer, this);

    connect(process, SIGNAL (readyReadStandardOutput()), this, SLOT (slotOutputRecieved()));

    connect(action_break, SIGNAL (triggered()), this, SLOT (slotButtonClickedBreakMain()));
    connect(action_run, SIGNAL (triggered()), this, SLOT (slotButtonClickedRun()));
    connect(action_stepin, SIGNAL (triggered()), this, SLOT (slotButtonClickedStepin()));
    connect(action_stepover, SIGNAL (triggered()), this, SLOT (slotButtonClickedStepover()));
    connect(action_stepout, SIGNAL (triggered()), this, SLOT (slotButtonClickedStepout()));
    connect(action_listlocals, SIGNAL (triggered()), this, SLOT (slotButtonClickedListLocals()));
    connect(action_stop, SIGNAL (triggered()), this, SLOT (slotButtonClickedStop()));
    connect(action_quit, SIGNAL (triggered()), this, SLOT (slotButtonClickedQuit()));
    connect(this, SIGNAL(signalImageParced()), this, SLOT(slotImageParced()));
}