コード例 #1
0
//void ThreadRunnerDlgImpl::onStepChanged(const QString& qstrLabel1, const QString& qstrLabel2 /* = ""*/, const QString& qstrLabel3 /* = ""*/, const QString& qstrLabel4 /* = ""*/)
void ThreadRunnerDlgImpl::onStepChanged(const StrList& v, int nStep)
{
//qDebug("step %s", qstrLabel.toStdString().c_str());
    if (-1 == nStep)
    {
        ++m_nCounter;
    }
    else
    {
        m_nCounter = nStep;
    }

    m_vStepInfo = v;
    if (m_bFirstTime)
    {
        QTimer::singleShot(1, this, SLOT(onUpdateTimer()));
        m_bFirstTime = false;
    }
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: CV-IP/icub-main
MainWindow::MainWindow(ResourceFinder *rf,QWidget *parent) :
    QMainWindow(parent),loadingWidget(this),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->rf = rf;
    prevFreq = 0;
    currentSampleFreq = 5;
    smoothSliderPressed = false;

    connect(&portThread,SIGNAL(portCreated()),
            this,SLOT(onPortCreated()));
    connect(&portThread,SIGNAL(openErrorDialog(QString)),
            this,SLOT(onOpenErrorDialog(QString)));

    portThread.start();

    calibratingTimer.setInterval(100);
    calibratingTimer.setSingleShot(false);
    connect(&calibratingTimer,SIGNAL(timeout()),this,SLOT(onCalibratingTimer()),Qt::QueuedConnection);

    connect(ui->btnCalibrate,SIGNAL(clicked()),this,SLOT(onCalibrate()));
    connect(ui->btnShowTouchThres,SIGNAL(clicked()),this,SLOT(onThreashold()));
    connect(ui->btnBinarization,SIGNAL(toggled(bool)),this,SLOT(onBinarization(bool)));
    connect(ui->btnSmooth,SIGNAL(toggled(bool)),this,SLOT(onSmooth(bool)));
    connect(ui->sliderScaleSmooth,SIGNAL(valueChanged(int)),this,SLOT(onSmoothValueChanged(int)));
    connect(ui->sliderScaleSmooth,SIGNAL(sliderPressed()),this,SLOT(onSmoothValuePressed()));
    connect(ui->sliderScaleSmooth,SIGNAL(sliderReleased()),this,SLOT(onSmoothValueReleased()));

    connect(ui->spinNeighbor,SIGNAL(valueChanged(double)),this,SLOT(onSpinNeighborChanged(double)));
    connect(ui->spinCompContactGain,SIGNAL(valueChanged(double)),this,SLOT(onSpinCompContactGainChanged(double)));
    connect(ui->spinCompGain,SIGNAL(valueChanged(double)),this,SLOT(onSpinCompGainChanged(double)));
    connect(ui->spinThreashold,SIGNAL(valueChanged(int)),this,SLOT(onSpinThresholdChanged(int)));

    connect(ui->spinSampleFreq,SIGNAL(valueChanged(int)),this,SLOT(onSampleFreqChanged(int)));

    updateTimer.setSingleShot(false);
    updateTimer.setInterval(1000/currentSampleFreq);
    connect(&updateTimer,SIGNAL(timeout()),this,SLOT(onUpdateTimer()));


}
コード例 #3
0
ThreadRunnerDlgImpl::ThreadRunnerDlgImpl(QWidget* pParent, Qt::WFlags flags, PausableThread* pThread, bool bShowCounter, TruncatePos eTruncatePos, bool bShowPauseAbort /* = true*/) :
    QDialog(pParent, flags),
    Ui::ThreadRunnerDlg(),

    m_pThread(pThread),
    m_nCounter(0),
    m_bShowCounter(bShowCounter),
    //m_nLastKey(0),

    m_tRealBegin(time(0)),
    m_tRunningBegin(time(0)),
    m_bShowPauseAbort(bShowPauseAbort),
    m_bFirstTime(true),
    m_eTruncatePos(eTruncatePos)
{
    setupUi(this);

    if (!bShowPauseAbort)
    {
        m_pPauseResumeB->hide();
        m_pAbortB->hide();
    }

    pThread->setParent(this);

    connect(m_pThread, SIGNAL(stepChanged(const StrList&, int)), this, SLOT(onStepChanged(const StrList&, int)));
    connect(m_pThread, SIGNAL(completed(bool)), this, SLOT(onThreadCompleted(bool)));
    connect(&m_closeTimer, SIGNAL(timeout()), this, SLOT(onCloseTimer()));
    connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(onUpdateTimer()));

    { QAction* p (new QAction(this)); p->setShortcut(QKeySequence(Qt::Key_Escape)); connect(p, SIGNAL(triggered()), this, SLOT(on_m_pAbortB_clicked())); addAction(p); } // !!! make ESC call on_m_pAbortB_clicked() instead of closing the dialog

    m_pCurrentL->setText("");

    pThread->start();
    m_updateTimer.start(500); // 0.5 sec

    { QAction* p (new QAction(this)); p->setShortcut(QKeySequence("F1")); connect(p, SIGNAL(triggered()), this, SLOT(onHelp())); addAction(p); }
}