示例#1
0
文件: shortlocater.cpp 项目: Qmax/PT6
void ShortLocater::on_hold_clicked()
{
    if(runFlag==true){
        runFlag=false;
        ui.hold->setStyleSheet("QPushButton {color:white;border: 1px solid #2D5059;border-radius: 20px;background-color: qlineargradient(x1: 0, y1: 1, x2: 1, y2: 0,stop: 0 #e59244, stop: 0.6 #ffa500 , stop:1 #FFFFFF);font:bold;}");
        startStop();
        IBackPlane->writeBackPlaneRegister(0x0,0x16);
        ui.holdCap->setVisible(true);
    }else{
        runFlag=true;
        ui.hold->setStyleSheet("QPushButton{color:white;border: 1px solid #2D5059;border-radius: 20px;background-color: qlineargradient(x1: 0, y1: 1, x2: 1, y2: 0,stop: 0 #1A74DB, stop: 0.6 #5293DE, stop:1 #FFFFFF);font:bold; }");
        startStop();
        ui.holdCap->setVisible(false);
    }
}
void eaps8000UsbUICharWindow::connectUiElements()
{
    connect( _ui->btn_emergencyStop, SIGNAL( clicked() ), this,
             SLOT( emergencyStop() ) );
    connect( _ui->cob_setValue, SIGNAL( currentTextChanged( QString ) ), this,
             SLOT( setValueSelectionChanged() ) );
    connect( _ui->cob_unit, SIGNAL( currentTextChanged( QString ) ),
             this, SLOT( updateUnitRange() ) );

    connect( _ui->chb_calcValues, SIGNAL( stateChanged( int ) ), this,
             SLOT( fixStepSizeChanged() ) );

    connect( _ui->dsb_fromValue, SIGNAL( valueChanged( double ) ), this,
             SLOT( calculateRemainingTicks() ) );
    connect( _ui->dsb_toValue, SIGNAL( valueChanged( double ) ), this,
             SLOT( calculateRemainingTicks() ) );
    connect( _ui->dsb_stepSize, SIGNAL( valueChanged( double ) ), this,
             SLOT( calculateRemainingTicks() ) );
    connect( _ui->spb_repeat, SIGNAL( valueChanged( int ) ), this,
             SLOT( calculateRemainingTicks() ) );
    connect( _ui->chb_loop, SIGNAL( stateChanged( int ) ), this,
             SLOT( calculateRemainingTicks() ) );

    connect( _ui->btn_connect, SIGNAL( clicked() ), this,
             SLOT( connectivityButtonPressed() ) );
    connect( _ui->btn_startStop, SIGNAL( clicked() ), this,
             SLOT( startStop() ) );
    connect( _ui->btn_resetInfo, SIGNAL( clicked() ), this,
             SLOT( resetInfo() ) );
}
示例#3
0
/**
 * @brief SimLog::setVpz
 *        Set the VPZ package used for the simulation
 */
void SimLog::setVpz(vle::vpz::Vpz *vpz)
{
    mVpz = vpz;
    vle::vpz::Observables curVpzObs;
    vle::vpz::Views       curVpzViews;

    curVpzViews  = mVpz->project().experiment().views();
    curVpzObs    = mVpz->project().experiment().views().observables();


    if ( getWidget() )
    {
        // Update the title (Experiment Name and VPZ file name)
        QString expName = mVpz->project().experiment().name().c_str();
        QString simTitle = QString("%1 (%2)").arg(expName).arg(mVpz->filename().c_str());
        mWidgetTab->setModelName(simTitle);

        QObject::connect(mWidgetTab, SIGNAL(doStartStop()),
                         this,       SLOT  (startStop()));
    }

    if ( getWidgetToolbar() )
    {
        mWidgetToolbar->buildTree(mVpz);

        QObject::connect(mWidgetToolbar, SIGNAL(addSig    (QString, QString)),
                         this,           SLOT  (addPlotSig(QString, QString)));
        QObject::connect(mWidgetToolbar, SIGNAL(delSig    (QString)),
                         this,           SLOT  (delPlotSig(QString)));
    }
}
qrcode_clock::qrcode_clock(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::qrcode_clock)
{
    ui->setupUi(this);

    // go fullscreen
    setWindowState(windowState() ^ Qt::WindowFullScreen);

    // hide cursor
    setCursor(Qt::BlankCursor);

    // quit application at ESC
    QAction *exitAct = new QAction(this);
    exitAct->setShortcut(Qt::Key_Escape);
    connect(exitAct, SIGNAL(triggered()), qApp, SLOT(quit()));
    addAction(exitAct);

#ifdef QT_DEBUG
    // pause resume clock with space.
    // JUST FOR DEBUGGING, DEFEATS THE PURPOSE OF SHOWING ACCURATE TIME!!!
    QAction *startStopAct = new QAction(this);
    startStopAct->setShortcut(Qt::Key_Space);
    connect(startStopAct, SIGNAL(triggered()), this, SLOT(startStop()));
    addAction(startStopAct);
#endif

    m_qrClock = findChild<QRLabel*>("clock");
    if (!m_qrClock) {
        qDebug() << "QLabel named 'clock' not found!";
        qApp->exit();
    }

    m_humanClock = findChild<QLabel*>("time");
    if (!m_humanClock) {
        qDebug() << "QLabel named 'time' not found!";
        qApp->exit();
    }

    // start timer which encodes the time every second
    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(updateTime()));
    m_timer->start(1000);

    // set background color to white
    QPalette pal = palette();
    pal.setColor(QPalette::Window, QColor(Qt::white));
    setPalette(pal);

    // initialize clock
    updateTime();
}
示例#5
0
文件: Animal.cpp 项目: ken4500/zoo
void Animal::startFreeAction()
{
    int rnd = rand() % 2;
    switch (rnd) {
    case 0:
        startWalk();
        break;
    case 1:
        startStop();
    default:
        break;
    }
}
示例#6
0
EditorUI::EditorUI()
	:	mFile(0)
{
	setupUi(this);
	actNew->setIcon(style()->standardIcon(QStyle::SP_FileIcon));
	actOpen->setIcon(style()->standardIcon(QStyle::SP_DirOpenIcon));
	actSave->setIcon(style()->standardIcon(QStyle::SP_DriveFDIcon));

	CommWindow *comm = new CommWindow(CommDock);
	CommDock->setWidget(comm);
	CommDock->setVisible(false);

	mGame = new EditorGame(comm);
	mBp = new EditorBlueprint(mGame, this);
	setCentralWidget(mBp);
	connect(mBp, SIGNAL(zoomChanged(float)), this, SLOT(zoomChanged(float)));
	connect(mBp, SIGNAL(dropEntity(Math::Point)), this, SLOT(dropEntity(Math::Point)));
	connect(mGame, SIGNAL(worldUpdated()), mBp, SLOT(repaint()));

	toolSelect = new QButtonGroup(this);
	toolSelect->addButton((QAbstractButton*)toolBar->widgetForAction(actPanTool), EditorBlueprint::pan);
	toolSelect->addButton((QAbstractButton*)toolBar->widgetForAction(actMoveTool), EditorBlueprint::move);
	toolSelect->addButton((QAbstractButton*)toolBar->widgetForAction(actBuildTool), EditorBlueprint::build);
	connect(actMoveTool, SIGNAL(triggered()), this, SLOT(updateTool()));
	connect(actPanTool, SIGNAL(triggered()), this, SLOT(updateTool()));
	connect(actBuildTool, SIGNAL(triggered()), this, SLOT(updateTool()));

	entityBox = new QComboBox(this);
	entityBox->addItem("");
	entityBox->addItems(FactoryManager::instance()->types());
	toolBar->addSeparator();
	toolBar->addWidget(entityBox);

	zoomLabel = new QLabel;
	statusbar->addPermanentWidget(zoomLabel);
	zoomChanged(mBp->zoom());


	connect(actNew, SIGNAL(triggered()), this, SLOT(New()));
	connect(actOpen, SIGNAL(triggered()), this, SLOT(open()));
	connect(actSave, SIGNAL(triggered()), this, SLOT(save()));
	connect(actSaveAs, SIGNAL(triggered()), this, SLOT(saveAs()));
	connect(actShowNavmesh, SIGNAL(triggered(bool)), mBp, SLOT(setShowNavmesh(bool)));
	connect(actPopulate, SIGNAL(triggered()), this, SLOT(populate()));
	connect(actReset, SIGNAL(triggered()), this, SLOT(reset()));
	connect(actStartStop, SIGNAL(triggered()), this, SLOT(startStop()));
	connect(actGenNavmesh, SIGNAL(triggered()), this, SLOT(generateNavmesh()));

	New();
}
示例#7
0
/**
 * @brief SimPlot::setVpz
 *        Set the VPZ package used for the simulation
 */
void SimPlot::setVpz(vleVpz *vpz)
{
    mVpz = vpz;

    vle::vpz::Vpz   *oldVpz;

    // NOTE - View list is loaded from disk using vle::Vpz
    // only because GVLE2::vleVpz does not support views
    // direct access yet. This must be changed in future.

    QString fileName = vpz->getFilename();
    oldVpz = new vle::vpz::Vpz(fileName.toStdString());

    vle::vpz::Observables curVpzObs;
    vle::vpz::Views       curVpzViews;

    curVpzViews  = oldVpz->project().experiment().views();
    curVpzObs    = oldVpz->project().experiment().views().observables();

    if ( getWidget() )
    {
        // Update the title (Experiment Name and VPZ file name)
        QString expName = oldVpz->project().experiment().name().c_str();
        QString simTitle = QString("%1 (%2)").arg(expName).arg(oldVpz->filename().c_str());
        mWidgetTab->setModelName(simTitle);

        QObject::connect(mWidgetTab, SIGNAL(doStartStop()),
                         this,       SLOT  (startStop()));
    }

    if ( getWidgetToolbar() )
    {
        mWidgetToolbar->buildTree(oldVpz);

        QObject::connect(mWidgetToolbar, SIGNAL(addSig    (plotSignal *)),
                         this,           SLOT  (addPlotSig(plotSignal *)));
        QObject::connect(mWidgetToolbar, SIGNAL(delSig    (plotSignal *)),
                         this,           SLOT  (delPlotSig(plotSignal *)));
        QObject::connect(mWidgetToolbar, SIGNAL(updateSig    (plotSignal *)),
                         this,           SLOT  (updatePlotSig(plotSignal *)));
    }
}
示例#8
0
TimerWidget::TimerWidget(QWidget* parent)
   : QWidget(parent),
     hours(0),
     minutes(0),
     seconds(0),
     start(true),
     timer(new QTimer(this)),
     flashTimer(new QTimer(this)),
     paletteOld(),
     paletteNew(),
     mediaPlayer(new QMediaPlayer(this)),
     playlist(new QMediaPlaylist(mediaPlayer)),
     oldColors(true)
{
   doLayout();

   // One second between timeouts.
   timer->setInterval(1000);
   flashTimer->setInterval(500);

   playlist->setPlaybackMode(QMediaPlaylist::Loop);
   mediaPlayer->setVolume(100);
   mediaPlayer->setPlaylist(playlist);

   paletteOld = lcdNumber->palette();
   paletteNew = QPalette(paletteOld);
   // Swap colors.
   paletteNew.setColor(QPalette::Active, QPalette::WindowText, paletteOld.color(QPalette::Active, QPalette::Window));
   paletteNew.setColor(QPalette::Active, QPalette::Window, paletteOld.color(QPalette::Active, QPalette::WindowText));

   connect( timer, SIGNAL(timeout()), this, SLOT(subtractOneSecond()) );
   connect( flashTimer, SIGNAL(timeout()), this, SLOT(flash()) );
   connect( this, SIGNAL(timerDone()), this, SLOT(endTimer()) );
   connect( pushButton_set, SIGNAL(clicked()), this, SLOT(setTimer()) );
   connect( pushButton_startStop, SIGNAL(clicked()), this, SLOT(startStop()) );
   connect( pushButton_sound, SIGNAL(clicked()), this, SLOT(getSound()) );

   showChanges();
}
示例#9
0
int ShortLocater::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: Measure(); break;
        case 1: Configure((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: on_openShortEnable_clicked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: on_External_clicked(); break;
        case 4: on_Internal_clicked(); break;
        case 5: on_pushButton_2_clicked(); break;
        case 6: on_HAADC_clicked(); break;
        case 7: on_haadcClose_clicked(); break;
        case 8: on_pushButton_clicked(); break;
        case 9: on_hold_clicked(); break;
        case 10: on_microOhms_clicked(); break;
        case 11: on_Null_clicked(); break;
        case 12: on_offset_clicked(); break;
        case 13: on_Auto_clicked(); break;
        case 14: on_buzzer_clicked(); break;
        case 15: on_exit_clicked(); break;
        case 16: on_r200mEBut_clicked(); break;
        case 17: on_r2EBut_clicked(); break;
        case 18: on_r200But_clicked(); break;
        case 19: on_ShortCalib_2_clicked(); break;
        case 20: on_ShortCalib_clicked(); break;
        case 21: on_pushButton_5_clicked(); break;
        case 22: on_pushButton_3_clicked(); break;
        case 23: on_printImage_clicked(); break;
        case 24: startStop(); break;
        case 25: Exit(); break;
        default: ;
        }
        _id -= 26;
    }
    return _id;
}
示例#10
0
void ishara::on_actionStart_triggered() {
  startStop();
}
示例#11
0
void ishara::on_btnStartStop_clicked() {
  startStop();
}
示例#12
0
ishara::ishara(QWidget *parent) : QMainWindow(parent), ui(new Ui::ishara) {

  if (QSystemTrayIcon::isSystemTrayAvailable()) {
      /*
       * init system tray
       */
      maximizeAction = new QAction(tr("&Show"), this);
      connect(maximizeAction, SIGNAL(triggered()), this, SLOT(show()));
      quitAction = new QAction(tr("&Quit"), this);
      connect(quitAction, SIGNAL(triggered()), this, SLOT(on_actionQuit_triggered()));

      startStopAction = new QAction(tr("S&tart"), this);
      connect(startStopAction, SIGNAL(triggered()), this, SLOT(startStop()));

      trayIconMenu = new QMenu(this);
      trayIconMenu->addAction(maximizeAction);
      trayIconMenu->addSeparator();
      trayIconMenu->addAction(startStopAction);
      trayIconMenu->addSeparator();
      trayIconMenu->addAction(quitAction);
      trayIcon = new QSystemTrayIcon(this);
      trayIcon->setContextMenu(trayIconMenu);

      connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
      const QIcon *icon = new QIcon(":/prefix1/res/ishara.ico");
      trayIcon->setIcon(*icon);
      trayIcon->hide();
    }

  /*
   * initializing some variables from the configuration file
   */
  settings.sync();

  hMin1 = settings.value("hMin1", 0).toInt();
  hMax1 = settings.value("hMax1", 179).toInt();
  sMin1 = settings.value("sMin1", 0).toInt();
  sMax1 = settings.value("sMax1", 255).toInt();
  vMin1 = settings.value("vMin1", 0).toInt();
  vMax1 = settings.value("vMax1", 255).toInt();

  hMin2 = settings.value("hMin2", 0).toInt();
  hMax2 = settings.value("hMax2", 179).toInt();
  sMin2 = settings.value("sMin2", 0).toInt();
  sMax2 = settings.value("sMax2", 255).toInt();
  vMin2 = settings.value("vMin2", 0).toInt();
  vMax2 = settings.value("vMax2", 255).toInt();

  pinchR = settings.value("pinchR", 66).toInt();
  rightClickDealy = settings.value("rightClickDealy", 20).toInt();
  smoothFac = settings.value("smoothFac", 8).toInt();

  cfgScroll = settings.value("cfgScroll", 2).toInt();
  cfgLClick = settings.value("cfgLClick", 2).toInt();
  cfgRClick = settings.value("cfgRClick", 2).toInt();

  /*
   * initializing some more variables
   */
  CAM_INDEX = -1;
  mcorInit_X = 0;
  mcorInit_Y = 0;
  msPoint_X = 0;
  msPoint_Y = 0;
  xScreenHeight = 0;
  xScreenWidth = 0;
  startEmulation = 0;
  motionEnable = 0;
  tmpX = 0;
  tmpY = 0;
  waitCountRC = 0;
  pinch = 0;
  ifScrollUp = 0;
  ifScrollDwn = 0;
  btnPress = 1;
  btnRel = 1;
  devSelActive = 0;
  iteration = 0;

  /*
   * setting up the user interface
   */
  ui->setupUi(this);

  /*
   * setting up smoothness factor slider; smoothness factor is the maximum allowable
   * distance the index finger can move without effecting any change in the mouse
   * cursor position; a reasonable value for this would be 6 to 8 depending on the user
   */
  ui->sliderSmoothFac->setRange(2, 12);
  ui->sliderSmoothFac->setValue(smoothFac);

  /*
   * setting up color selection sliders; the HSV range for the two color markers to be
   * detected are set using these sliders
   */
  ui->sliderHMin1->setRange(0, 179);
  ui->sliderHMax1->setRange(0, 179);
  ui->sliderSMin1->setRange(0, 255);
  ui->sliderSMax1->setRange(0, 255);
  ui->sliderVMin1->setRange(0, 255);
  ui->sliderVMax1->setRange(0, 255);

  ui->sliderHMin2->setRange(0, 179);
  ui->sliderHMax2->setRange(0, 179);
  ui->sliderSMin2->setRange(0, 255);
  ui->sliderSMax2->setRange(0, 255);
  ui->sliderVMin2->setRange(0, 255);
  ui->sliderVMax2->setRange(0, 255);

  ui->sliderHMin1->setValue(hMin1);
  ui->sliderHMax1->setValue(hMax1);
  ui->sliderSMin1->setValue(sMin1);
  ui->sliderSMax1->setValue(sMax1);
  ui->sliderVMin1->setValue(vMin1);
  ui->sliderVMax1->setValue(vMax1);

  ui->sliderHMin2->setValue(hMin2);
  ui->sliderHMax2->setValue(hMax2);
  ui->sliderSMin2->setValue(sMin2);
  ui->sliderSMax2->setValue(sMax2);
  ui->sliderVMin2->setValue(vMin2);
  ui->sliderVMax2->setValue(vMax2);

  /*
   * setting up color selection spinboxes; the values determining the HSV range can
   * also be altered using the spin boxes
   */
  ui->spnHMin1->setRange(0, 179);
  ui->spnHMax1->setRange(0, 179);
  ui->spnSMin1->setRange(0, 255);
  ui->spnSMax1->setRange(0, 255);
  ui->spnVMin1->setRange(0, 255);
  ui->spnVMax1->setRange(0, 255);

  ui->spnHMin2->setRange(0, 179);
  ui->spnHMax2->setRange(0, 179);
  ui->spnSMin2->setRange(0, 255);
  ui->spnSMax2->setRange(0, 255);
  ui->spnVMin2->setRange(0, 255);
  ui->spnVMax2->setRange(0, 255);

  ui->spnHMin1->setValue(hMin1);
  ui->spnHMax1->setValue(hMax1);
  ui->spnSMin1->setValue(sMin1);
  ui->spnSMax1->setValue(sMax1);
  ui->spnVMin1->setValue(vMin1);
  ui->spnVMax1->setValue(vMax1);

  ui->spnHMin2->setValue(hMin2);
  ui->spnHMax2->setValue(hMax2);
  ui->spnSMin2->setValue(sMin2);
  ui->spnSMax2->setValue(sMax2);
  ui->spnVMin2->setValue(vMin2);
  ui->spnVMax2->setValue(vMax2);

  /*
   * setting up pinchR slider; the pinchR variable determines the maximum distance
   * between the center co-ordinates of the two color markers when detecting a Pinch
   */
  ui->sliderPinchR->setRange(10, 120);
  ui->sliderPinchR->setValue(pinchR);

  /*
   * setting up pinchR spinbox; the value of pinchR can also be altered using a spinbox
   */
  ui->spnPinchR->setRange(10, 120);
  ui->spnPinchR->setValue(pinchR);

  /*
   * setting up rightClickDealy slider; the variables rightClickDealy
   * determines the loop count while determining a right click
   */
  ui->sliderRCRC->setRange(10, 30);
  ui->sliderRCRC->setValue(rightClickDealy);

  /*
   * setting up rightClickDealy spinbox, the usage is obvious
   */
  ui->spnRCRC->setRange(10, 30);
  ui->spnRCRC->setValue(rightClickDealy);

  /*
   * setting up check boxes to enable/disable functionalities
   */
  if(cfgScroll > 0) {
      ui->chkEnableScroll->setChecked(true);
    }
  else {
      ui->chkEnableScroll->setChecked(false);
    }

  if(cfgLClick > 0) {
      ui->chkEnableLeftClick->setChecked(true);
    }
  else {
      ui->chkEnableLeftClick->setChecked(false);
    }

  if(cfgRClick > 0) {
      ui->chkEnableRightClick->setChecked(true);
    }
  else {
      ui->chkEnableRightClick->setChecked(false);
    }

  /*
   * camera selection in Linux
   */
  for(deviceIndex = 0 ; deviceIndex < 64 ; ++deviceIndex) {
      QString device = "/dev/video" + QString::number(deviceIndex);
      QByteArray array = device.toLocal8Bit();
      char *buffer = array.data();
      if((fd = open(buffer, O_RDONLY)) != -1) {
          if(ioctl(fd, VIDIOC_QUERYCAP, &vidiocap) == -1) {
              ui->comboSelectCam->addItem(device);
            }
          else {
              ui->comboSelectCam->addItem(QString::fromLocal8Bit(reinterpret_cast<const char*>(vidiocap.card)));
            }
          if(CAM_INDEX == -1) {
              CAM_INDEX = deviceIndex;
            }
        }
    }

  /*
   * camera operations
   */
  camOpen();

  capture.read(src);
  if(src.empty() == true) {
      ui->statusBar->showMessage("Read error!");
      return;
    }

  /*
   * get the screen size
   */
  getxScreenSize();

  /*
   * time warp - make it so
   */
  timer = new QTimer(this);
  connect(timer, SIGNAL(timeout()), this, SLOT(processFrameAndUpdateGUI()));
  timer->start(20);

  /*
   * clean up the crap
   */
  src.release();
  frame.release();
  imgHSV.release();
}
示例#13
0
void eaps8000UsbUICharWindow::mLabSignal( char signal, const QString& cmd )
{
    if( signal == SIGNAL_SHUTDOWN )
    {
        emergencyStop();
    }
    else if( signal == SIGNAL_STOP )
    {
        if( _ui->chb_setZeroAtStopSignal->isChecked() )
        {
            uiCharFinished();

            _ui->lbl_info->setText( STOP_RECEIVED );
            _ui->lbl_info->setStyleSheet( STYLE_ERROR );
        }
    }
    else if( signal == 10 )
    {
        if( _ui->btn_startStop->text() == STOP )
        {
            startStop();
        }
    }
    else if( signal == 11 )
    {
        if( _ui->btn_startStop->text() == START )
        {
            startStop();
        }
    }
    else if( signal == 12 )
    {
        if( _ui->btn_connect->text() == CONNECT_PORT )
        {
            connectPort();
        }
    }
    else if( signal == 13 )
    {
        if( _ui->btn_connect->text() == DISCONNECT_PORT )
        {
            disconnectPort();
        }
    }
    else if( signal == 14 )
    {
        if( cmd == "true" )
        {
            _ui->chb_setZeroAtStopSignal->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_setZeroAtStopSignal->setChecked( false );
        }
    }
    else if( signal == 15 )
    {
        if( cmd == "true" )
        {
            _ui->chb_setZeroWhenFinished->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_setZeroWhenFinished->setChecked( false );
        }
    }
    else if( signal == 16 )
    {
        if( cmd == "true" )
        {
            _ui->chb_emitStopSignal->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_emitStopSignal->setChecked( false );
        }
    }
    else if( signal == 18
             || signal == 19 )
    {
        resetInfo();
    }
    else if( signal == 41 )
    {
        int indexType = _ui->cob_setValue->findText( cmd );
        if( indexType == -1 )
        {
            return;
        }
        _ui->cob_setValue->setCurrentIndex( indexType );
    }
    else if( signal == 42 )
    {
        bool conversionSuccessful = false;
        double stepSize = cmd.toDouble( &conversionSuccessful );
        if( conversionSuccessful )
        {
            _ui->dsb_stepSize->setValue( stepSize );
        }
    }
    else if( signal == 43 )
    {
        if( cmd == "true" )
        {
            _ui->chb_calcValues->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_calcValues->setChecked( false );
        }
    }
    else if( signal == 45 )
    {
        bool conversionSuccessful = false;
        double fromValue = cmd.toDouble( &conversionSuccessful );
        if( conversionSuccessful )
        {
            _ui->dsb_fromValue->setValue( fromValue );
        }
    }
    else if( signal == 46 )
    {
        bool conversionSuccessful = false;
        double toValue = cmd.toDouble( &conversionSuccessful );
        if( conversionSuccessful )
        {
            _ui->dsb_toValue->setValue( toValue );
        }
    }
    else if( signal == 47 )
    {
        int unitType = _ui->cob_unit->findText( cmd );
        if( unitType == -1 )
        {
            return;
        }
        _ui->cob_unit->setCurrentIndex( unitType );
    }
    else if( signal == 51 )
    {
        bool conversionSuccessful = false;
        int repeat = cmd.toInt( &conversionSuccessful );
        if( conversionSuccessful )
        {
            _ui->spb_repeat->setValue( repeat );
        }
    }
    else if( signal == 52 )
    {
        if( cmd == "true" )
        {
            _ui->chb_loop->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_loop->setChecked( false );
        }
    }
}
示例#14
0
文件: shortlocater.cpp 项目: Qmax/PT6
void ShortLocater::Initializations(){

	IPsoc->resetRelays();
	IPsoc->srcImpedanceSelection(SRC_IMP_0E);
//	IPsoc->shLocatorDetection();
    m_nADCtimer = new QTimer(this);

    IBackPlane->writeBackPlaneRegister(0x0FFF,0x001E);//clear all interrupts
    IBackPlane->writeBackPlaneRegister(0x0000,0x0020);//disable all interrupts
    IBackPlane->writeBackPlaneRegister(0x0000,0x0024);//disable global interrupt
    IBackPlane->writeBackPlaneRegister(0x0100,0x0020);//enabling psoc INT0embedded key interrupt)

    IPTKeyEvent->InvokeGPIOEvent(this,"/dev/input/event2","pt_kpp",&m_nPTKeyCode);
    IGPIOEvent->InvokeGPIOEvent(this,"/dev/input/event7","gpioevent",&m_nGPIOCode);
    IBackPlane->writeBackPlaneRegister(0x0001,0x0024);

    //        IBackPlane->writeBackPlaneRegister();
    ohms=QChar(0x2126);
    micro=QChar(0x00B5);

    //~~~~~~~~~~~~~Reading Short Values from File~~~~~~~~~~~~~~~~~~~~~~
	QStringList stringList;
	bool ok=true;
	QFile textFile;
   	textFile.setFileName("shortValuesI.txt");

    if (textFile.open(QIODevice::ReadOnly))
    {
        QTextStream textStream(&textFile);
        while (!textStream.atEnd())
        {
            stringList.append(textStream.readLine());
        }
        r200EShortValue=stringList.value(0).toDouble(&ok);
        qDebug()<<"200E Short Value:"<<r200EShortValue;
        r2EShortValue=stringList.value(1).toDouble(&ok);
        qDebug()<<"2E Short Value:"<<r2EShortValue;
       	r200mEShortValue=stringList.value(2).toDouble(&ok);
        qDebug()<<"200mE Short Value:"<<r200mEShortValue;
    }else{
        r200EShortValue=r200mEShortValue=r2EShortValue=0.0;
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //~~~~~~~~Check for debug panel~~~~~~~~~~~~~~~~~~~~~~~~
    QStringList debugPanel;
    QFile textFile2("debugPanel.txt");
    if (textFile2.open(QIODevice::ReadOnly))
    {
        QTextStream textStream(&textFile2);
        while (!textStream.atEnd())
        {
            debugPanel.append(textStream.readLine());
            if(debugPanel.value(0)=="1")
                ToolBox(true);
            else
                ToolBox(false);
        }
    }else{
        ToolBox(false);
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    IDMMLib->ApplyDACOffset(false);

    dis->setValue("OL");
    IBackPlane->writeBackPlaneRegister(0x0,0x16);
    //	Beep(false);

    AutoFlag=false;
    on_Auto_clicked();

    OffsetFlag=false;
    BuzzerFlag=false;
    msgBoxLive=false;

    ui.progressBar_2->setValue(0);
    for(int i=0;i<100;i++)
        avgRetval[i]=0.0;

    retval=retval2=retval3=0.0;
    nullify=0.0;
    nullit=0.0;
    avg=0;

    noOFsamples=1;

    rangePrevValue=33;

    ui.uE->setText(micro+ohms);

    on_r200But_clicked();
    ui.holdCap->setVisible(false);
    runFlag=true;
    startStop();

	ui.openShortEnable->setChecked(true);

	m_nAvgCount=0;
	movingAverage=5;

	ui.splashWidget->setVisible(false);
		usleep(1000);

}
示例#15
0
void MainWindow::on_pushButton_clicked()
{
    startStop();
}