Esempio n. 1
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);
}
Esempio n. 2
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("");
    }
}