コード例 #1
0
void PlaybackDialog::on_playButton_toggled(bool checked)
{
    if (checked) {
         emit newFps(currentTimer);
    } else {
        emit newFps(3600000); // such a long time that it appears paused
    }
}
コード例 #2
0
void PlaybackDialog::on_horizontalSlider_valueChanged(int value)
{
    double newFrameRate=1;
    if (value>10) {
        newFrameRate=value-9;
    } else {
        newFrameRate=value/10.0;
    }
//    qDebug()<<"Converted new value "<<value<<" into new fps "<<newFrameRate;
    QString oldText=ui->fpsEdit->text();
    QString delayTxt;
    int newVal;
    if (oldText.at(0)=='-') {
        delayTxt=QString("-1/%1").arg(newFrameRate);
        newVal=(int)(-1000/newFrameRate);
    } else {
        delayTxt=QString("1/%1").arg(newFrameRate);
        newVal=(int)(1000/newFrameRate);
    }
    ui->fpsEdit->setText(delayTxt);

    currentTimer=newVal;
    emit newFps(currentTimer);
    ui->playButton->setChecked(true);
}
コード例 #3
0
void PlaybackDialog::forwardPlay()
{
    currentTimer=abs(currentTimer);
    QString delayTxt=QString("%1").arg(currentTimer);
    ui->fpsEdit->setText(delayTxt);
    ui->playButton->setChecked(true);
    emit newFps(currentTimer);
}
コード例 #4
0
void PlaybackDialog::finishedFirstTimer() {
    if (recording) {
        if (have2timers) {
            // don't stop recording, just change fps
            ui->fpsEdit->setText(QString::number(secondDelay));
            emit newFps(secondDelay);
        } else {
            ui->recTimedButton->toggle();
            ui->stopButton->click();
        }
    }
}
コード例 #5
0
void PlaybackDialog::on_fpsEdit_returnPressed()
{
    QString valStr=ui->fpsEdit->text();
    if (valStr.contains("/")) {
        QStringList vl=valStr.split("/");
        if (vl.count()==2) {
            int newVal=1000/vl[1].toInt();
            currentTimer=newVal;
        } else {
            qDebug()<<"Could not understand fps setting";
        }
        if (valStr.at(0)=='-') currentTimer=-currentTimer;
    } else {
        currentTimer=valStr.toInt();
    }

    emit newFps(currentTimer);
}
コード例 #6
0
void PlaybackDialog::on_fpsEdit_returnPressed()
{
    QString valStr=ui->fpsEdit->text();
    if (valStr.contains("/")) {
        QStringList vl=valStr.split("/");
        if (vl.count()==2) {
            currentTimer=1000.0/vl[1].toInt();
        } else {
            qDebug()<<"Could not understand fps setting";
        }
        if (valStr.at(0)=='-') currentTimer=-currentTimer;
    } else {
        int tim1;
        double msecs1;
        if (parseInstruct(valStr,tim1,msecs1)) {
            currentTimer=tim1*1000.0;   // shouldn't this be msecs1???
        } else {
            currentTimer=valStr.toDouble();
        }
    }
//  qInfo()<<"delay="<<currentTimer;
    emit newFps(currentTimer);
}
コード例 #7
0
// should ask user how long he wants to record
void PlaybackDialog::on_recTimedButton_toggled(bool checked)
{
    recording=checked;
    QString instruct;
    bool ok=true;
    if (recording) {
        instruct=QInputDialog::getText(NULL,"Shutdown timer instructions","Format ~ '2m10s@30fps/[email protected]' : ");
        // check if format is ok
        QRegExp rx("(.+)/(.+)");
        int pos=0;
        pos=rx.indexIn(instruct);
        if (pos==-1) {
            config1=instruct;
            config2="";
        } else {
            config1=rx.cap(1);
            config2=rx.cap(2);
        }

        have2timers=false;
        int tim1,msecs1;
        if (parseInstruct(config1,tim1,msecs1)) {
//            qDebug()<<"Got here with: "<<tim1<<" - "<<msecs1;
            timer1.setInterval(1000*tim1);
            timer1.setSingleShot(true);
            if (msecs1>1) {
                ui->fpsEdit->setText(QString::number(msecs1));
                emit newFps(msecs1);
            }
        } else {
            ok=false;
        }

        int tim2,msecs2;
        if (parseInstruct(config2,tim2,msecs2)) {
//            qDebug()<<"Got here also with: "<<tim2<<" - "<<msecs2;
            if ((msecs2!=msecs1)&&msecs2>1) {
                have2timers=true;
                timer2.setInterval(1000*(tim1+tim2));
                timer2.setSingleShot(true);
                secondDelay=msecs2;
            } else {
                qDebug()<<"Not a correct use of second timer fps: "<<msecs2<<" vs "<<msecs1;
            }

        }

        //time=instruct.toInt(&ok);

        if (!ok) { //exit gracefully
            ui->recTimedButton->toggle();
            return;
        }

    }

    QString recf=ui->RecFolder->text();
    QString cod=ui->codecBox->currentText();
    emit recordNow(checked,recf,cod);
    if (recording) {
        ui->LeftStatus->setText("Recording");
        timer1.start();
        if (have2timers) timer2.start();
    } else {
        ui->LeftStatus->setText("");
    }
}