/*! \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()));
}
Example #2
0
void Thread::run()
{
	onBeforeRun();
	if( mRun ) {
		std::unique_lock<std::mutex> lck( mMutex );
		while( mRun ) {
			onRun();
			mEvent.wait_for( lck, std::chrono::milliseconds( delayMS() ) );	// == std::cv_status::timeout
		};
	}
}
Example #3
0
static void doAction(LLDBPlugin* plugin, PDAction action)
{
    switch (action)
    {
        case PDAction_Stop : onStop(plugin); break;
        case PDAction_Break : onBreak(plugin); break;
        case PDAction_Run : onRun(plugin); break;
        case PDAction_Step : onStep(plugin); break;
        case PDAction_StepOut : onStepOver(plugin); break;
        case PDAction_StepOver : onStepOver(plugin); break;
    }
}
Example #4
0
void
Work::run()
{
    if (getState() == WORK_PENDING)
    {
        CLOG(DEBUG, "Work") << "starting " << getUniqueName();
        mApp.getMetrics().NewMeter({"work", "unit", "start"}, "unit").Mark();
        onStart();
    }
    CLOG(DEBUG, "Work") << "running " << getUniqueName();
    mApp.getMetrics().NewMeter({"work", "unit", "run"}, "unit").Mark();
    setState(WORK_RUNNING);
    onRun();
}
Example #5
0
static void doAction(DbgEngPlugin* plugin, PDAction action) {
    printf("DbgEngPlugin: doAction\n");

    switch (action) {
        case PDAction_stop:
            onStop(plugin); break;
        case PDAction_break:
            onBreak(plugin); break;
        case PDAction_run:
            onRun(plugin); break;
        case PDAction_step:
            onStep(plugin); break;
        case PDAction_stepOut:
            onStepOut(plugin); break;
        case PDAction_stepOver:
            onStepOver(plugin); break;
    }
}
Example #6
0
	void GlutApp::run()
	{
		onRun();

		const DWORD SKIP_TICKS = 1000 / fps_;
		game_is_running_ = true;
		
		while(game_is_running_){
			DWORD start_time = GetTickCount();

			glutMainLoopEvent();
			update();
			render();

			// lock FPS
			while((GetTickCount() - start_time) < SKIP_TICKS);
		}

		onStop();
	}
Example #7
0
/*! \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()));
}
Example #8
0
static void setExecutable(LLDBPlugin* plugin, PDReader* reader)
{
    const char* filename = 0;

    PDRead_find_string(reader, &filename, "filename", 0);

    if (!filename)
    {
        printf("Unable to find filename which is required when starting a LLDB debug session\n");
        return;
    }

    printf("found filename \"%s\"\n", filename);

    plugin->target = plugin->debugger.CreateTarget(filename);

    if (!plugin->target.IsValid())
	{
        printf("Unable to create valid target (%s)\n", filename);
	}

	for (Breakpoint& bp : plugin->breakpoints)
	{
		lldb::SBBreakpoint breakpoint = plugin->target.BreakpointCreateByLocation(bp.filename, (uint32_t)bp.line);

		if (!breakpoint.IsValid())
		{
			// TODO: Send message back that this breakpoint could't be set
			printf("Unable to set breakpoint %s:%d\n", bp.filename, bp.line);
		}
	}

    printf("Valid target %s\n", filename);

    onRun(plugin);
}
 void run() { onRun(); }
Example #10
0
/*! \brief Run all modules in the application */
void ApplicationViewWidget::runApplicationSet()
{
    selectAllModule(true);
    onRun();
}
Example #11
0
ToolInstance::ToolInstance(QString filename, ToolInformation information, mcrl2::gui::qt::PersistentFileDialog* fileDialog, QWidget *parent) :
  QWidget(parent),
  m_filename(filename),
  m_info(information),
  m_fileDialog(fileDialog)
{
  m_ui.setupUi(this);

  connect(this, SIGNAL(colorChanged(QColor)), this, SLOT(onColorChanged(QColor)));

  connect(&m_process, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(onStateChange(QProcess::ProcessState)));
  connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(onStandardOutput()));
  connect(&m_process, SIGNAL(readyReadStandardError()), this, SLOT(onStandardError()));
  connect(m_ui.btnRun, SIGNAL(clicked()), this, SLOT(onRun()));
  connect(m_ui.btnAbort, SIGNAL(clicked()), this, SLOT(onAbort()));
  connect(m_ui.btnSave, SIGNAL(clicked()), this, SLOT(onSave()));
  connect(m_ui.btnClear, SIGNAL(clicked()), m_ui.edtOutput, SLOT(clear()));

  QFileInfo fileInfo(filename);

  m_process.setWorkingDirectory(fileInfo.absoluteDir().absolutePath());
  m_ui.lblDirectoryValue->setText(fileInfo.absoluteDir().absolutePath());
  m_ui.lblFileValue->setText(fileInfo.fileName());

  if (m_info.hasOutput())
  {
    QDir dir = fileInfo.absoluteDir();
    QString newfile = fileInfo.baseName().append(".%1").arg(m_info.output);
    int filenr = 0;
    while(dir.exists(newfile))
    {
      filenr++;
      newfile = fileInfo.baseName().append("_%1.%2").arg(filenr).arg(m_info.output);
    }
    m_pckFileOut = new FilePicker(m_fileDialog, m_ui.pckFileOut);
    m_ui.pckFileOut->layout()->addWidget(m_pckFileOut);
    m_pckFileOut->setText(newfile);
  }
  else
  {
    m_pckFileOut = NULL;
    m_ui.lblFileOut->setVisible(false);
    m_ui.pckFileOut->setVisible(false);
  }

  if (m_info.hasSecondInput())
  {
    m_pckFileIn = new FilePicker(m_fileDialog, m_ui.pckFileIn, false);
    m_ui.pckFileIn->layout()->addWidget(m_pckFileIn);
  }
  else
  {
    m_pckFileIn = NULL;
    m_ui.lblFileIn->setVisible(false);
    m_ui.pckFileIn->setVisible(false);
  }

  QFormLayout *formLayout = new QFormLayout();
  formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
  for (int i = 0; i < m_info.options.count(); i++)
  {
    ToolOption option = m_info.options.at(i);
    QWidget *nameOpt = NULL;
    QCheckBox* cbOpt = NULL;
    QVBoxLayout *lytOpt = new QVBoxLayout();

    if (option.argument.type == EnumArgument)
    {
      nameOpt = new QLabel("<b>"+option.nameLong+": </b>");
    }
    else
    {
      cbOpt = new QCheckBox(option.nameLong + ": ", this);
      cbOpt->setChecked(option.standard);
      QFont font(cbOpt->font());
      font.setBold(true);
      cbOpt->setFont(font);
      nameOpt = cbOpt;
    }

    formLayout->addRow(nameOpt, lytOpt);

    QLabel *lblOpt = new QLabel(option.description, this);
    lblOpt->setAlignment(Qt::AlignJustify | Qt::AlignTop);
    lblOpt->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    lblOpt->setWordWrap(true);
    lytOpt->addWidget(lblOpt);

    if (!option.hasArgument())
    {
      m_optionValues.append(new OptionValue(option, cbOpt));
    }
    else
    {
      switch (option.argument.type)
      {
        case StringArgument:
        case LevelArgument:
        case IntegerArgument:
        case RealArgument:
        case BooleanArgument:
          {
            QHBoxLayout *lytArg = new QHBoxLayout();
            lytArg->setSpacing(6);

            QWidget *edtArg = NULL;

            switch (option.argument.type)
            {
              case LevelArgument:
                {
                  QLineEdit *edtLdt = new QLineEdit("verbose", this);
                  m_optionValues.append(new OptionValue(option, cbOpt, edtLdt));
                  edtArg = edtLdt;
                }
                break;
              case IntegerArgument:
                {
                  QSpinBox *edtSpb = new QSpinBox(this);
                  edtSpb->setRange(std::numeric_limits<int>::min(), std::numeric_limits<int>::max());
                  if (option.argument.optional)
                  {
                    QCheckBox *cbOptional = new QCheckBox(this);
                    lytArg->addWidget(cbOptional);
                    m_optionValues.append(new OptionValue(option, cbOpt, edtSpb, cbOptional));
                  }
                  else
                  {
                    m_optionValues.append(new OptionValue(option, cbOpt, edtSpb));
                  }
                  edtArg = edtSpb;
                }
                break;
              case RealArgument:
                {
                  QDoubleSpinBox *edtSpb = new QDoubleSpinBox(this);
                  edtSpb->setRange(std::numeric_limits<double>::min(), std::numeric_limits<double>::max());
                  if (option.argument.optional)
                  {
                    QCheckBox *cbOptional = new QCheckBox(this);
                    lytArg->addWidget(cbOptional);
                    m_optionValues.append(new OptionValue(option, cbOpt, edtSpb, cbOptional));
                  }
                  else
                  {
                    m_optionValues.append(new OptionValue(option, cbOpt, edtSpb));
                  }
                  edtArg = edtSpb;
                }
                break;
              case BooleanArgument:
                {
                  QCheckBox *edtChb = new QCheckBox("Yes", this);
                  m_optionValues.append(new OptionValue(option, cbOpt, edtChb));
                  edtArg = edtChb;
                }
                break;
              case StringArgument:
              default:
                {
                  QLineEdit *edtLdt = new QLineEdit(this);
                  m_optionValues.append(new OptionValue(option, cbOpt, edtLdt));
                  edtArg = edtLdt;
                }
                break;
            }
            edtArg->setMinimumWidth(300);

            lytArg->addWidget(edtArg);

            if (!option.argument.optional && option.argument.type != BooleanArgument)
            {
              QLabel *lblReq = new QLabel("*", this);
              lytArg->addWidget(lblReq);
            }

            QSpacerItem *spacer = new QSpacerItem(100, 20, QSizePolicy::Expanding);
            lytArg->addItem(spacer);
            lytOpt->addLayout(lytArg);
          }
          break;
        case FileArgument:
          {
            QHBoxLayout *lytArg = new QHBoxLayout();
            lytArg->setSpacing(6);

            FilePicker *edtArg = new FilePicker(m_fileDialog, this, false);
            lytArg->addWidget(edtArg);
            m_optionValues.append(new OptionValue(option, cbOpt, edtArg));

            if (!option.argument.optional)
            {
              QLabel *lblReq = new QLabel("*", this);
              lytArg->addWidget(lblReq);
            }

            QSpacerItem *spacer = new QSpacerItem(100, 20, QSizePolicy::Expanding);
            lytArg->addItem(spacer);
            lytOpt->addLayout(lytArg);
          }
          break;
        case EnumArgument:
          {
            QFormLayout *lytValues = new QFormLayout();
            lytValues->setSpacing(6);

            QButtonGroup *grpValues = new QButtonGroup(this);

            for (int j = 0; j < option.argument.values.count(); j++)
            {
              ToolValue val = option.argument.values.at(j);
              QRadioButton *rbVal = new QRadioButton(val.nameLong, this);
              rbVal->setChecked(val.standard);
              grpValues->addButton(rbVal);

              QLabel *lblVal = new QLabel(val.description, this);
              lblVal->setWordWrap(true);

              lytValues->addRow(rbVal, lblVal);
            }
            m_optionValues.append(new OptionValue(option, cbOpt, grpValues));

            lytOpt->addLayout(lytValues);
          }
          break;
        default:
          break;
      }
    }
  }
  m_ui.scrollWidget->setLayout(formLayout);
}