Exemplo n.º 1
0
SettingsDialog::SettingsDialog(QWidget *parent) :
    QDialog(parent)
{
    contentsWidget = new QListWidget;
    contentsWidget->setViewMode(QListView::IconMode);
    contentsWidget->setIconSize(QSize(96, 84));
    contentsWidget->setMovement(QListView::Static);
    contentsWidget->setMaximumWidth(128);
    contentsWidget->setSpacing(12);

    configurationPage = new ConfigurationPage(this);

    pagesWidget = new QStackedWidget;
    pagesWidget->addWidget(configurationPage);

    /*
    pagesWidget->addWidget(new UpdatePage);
    pagesWidget->addWidget(new QueryPage);
    */

    QPushButton *closeButton = new QPushButton(tr("Close"));
    QPushButton *saveButton = new QPushButton(tr("Save"));

    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(saveButton, SIGNAL(clicked()), this, SLOT(slotSaveSettings()));

    createIcons();
    contentsWidget->setCurrentRow(0);

    QHBoxLayout *horizontalLayout = new QHBoxLayout;
    horizontalLayout->addWidget(contentsWidget);
    horizontalLayout->addWidget(pagesWidget, 1);

    QHBoxLayout *buttonsLayout = new QHBoxLayout;
    buttonsLayout->addStretch(1);
    buttonsLayout->addWidget(saveButton);
    buttonsLayout->addWidget(closeButton);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(horizontalLayout);
    mainLayout->addStretch(1);
    mainLayout->addSpacing(12);
    mainLayout->addLayout(buttonsLayout);
    setLayout(mainLayout);

    setWindowTitle(tr("Settings"));
}
Exemplo n.º 2
0
RenderingDialog::RenderingDialog(Project_sV *project, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::RenderingDialog),
    m_project(project)
{
    ui->setupUi(this);

    // Render section
    m_sectionGroup = new QButtonGroup(this);
    m_sectionGroup->addButton(ui->radioFullProject);
    m_sectionGroup->addButton(ui->radioSection);
    m_sectionGroup->addButton(ui->radioTagSection);
    QString mode(m_project->preferences()->renderSectionMode());
    if (mode == "full") {
        ui->radioFullProject->setChecked(true);
    } else if (mode == "expr") {
        ui->radioSection->setChecked(true);
    } else if (mode == "tags") {
        ui->radioTagSection->setChecked(true);
    } else {
        qDebug() << "Unknown render section mode: " << mode;
        Q_ASSERT(false);
    }

    // Optical flow
    ui->lambda->setValue(m_project->preferences()->flowV3DLambda());

    // Motion blur
    ui->maxSamples->setValue(m_project->motionBlur()->maxSamples());
    ui->slowmoSamples->setValue(m_project->motionBlur()->slowmoSamples());
    m_blurGroup = new QButtonGroup(this);
    m_blurGroup->addButton(ui->radioBlurConvolution);
    m_blurGroup->addButton(ui->radioBlurStacking);
    m_blurGroup->addButton(ui->radioBlurNearest);
    if (m_project->preferences()->renderMotionblurType() == MotionblurType_Convolving) {
        ui->radioBlurConvolution->setChecked(true);
    } else if (m_project->preferences()->renderMotionblurType() == MotionblurType_Stacking) {
        ui->radioBlurStacking->setChecked(true);
    } else {
        ui->radioBlurNearest->setChecked(true);
    }

    fillTagLists();

    // Output target type
    m_targetGroup = new QButtonGroup(this);
    m_targetGroup->addButton(ui->radioImages);
    m_targetGroup->addButton(ui->radioVideo);
    if (m_project->preferences()->renderTarget() == "images") {
        ui->radioImages->setChecked(true);
    } else {
        ui->radioVideo->setChecked(true);
    }

    // Output target files
    ui->imagesOutputDir->setText(m_project->preferences()->imagesOutputDir());
    ui->imagesFilenamePattern->setText(m_project->preferences()->imagesFilenamePattern());
    ui->videoOutputFile->setText(m_project->preferences()->videoFilename());
    ui->vcodec->setText(m_project->preferences()->videoCodec());

    // FPS
    QString fps = QVariant(m_project->preferences()->renderFPS().fps()).toString();
    if (ui->cbFps->findText(fps) < 0 && fps.toFloat() > 0) {
        ui->cbFps->addItem(fps);
    }
    ui->cbFps->setCurrentIndex(ui->cbFps->findText(fps));

    // Output size
    ui->cbSize->addItem("Original size", QVariant(FrameSize_Orig));
    ui->cbSize->addItem("Small", QVariant(FrameSize_Small));
    ui->cbSize->setCurrentIndex(ui->cbSize->findData(QVariant(m_project->preferences()->renderFrameSize())));

    // Interpolation type
    ui->cbInterpolation->addItem(toString(InterpolationType_Forward), QVariant(InterpolationType_Forward));
    ui->cbInterpolation->addItem(toString(InterpolationType_ForwardNew), QVariant(InterpolationType_ForwardNew));
    ui->cbInterpolation->addItem(toString(InterpolationType_Twoway), QVariant(InterpolationType_Twoway));
    ui->cbInterpolation->addItem(toString(InterpolationType_TwowayNew), QVariant(InterpolationType_TwowayNew));
    ui->cbInterpolation->addItem(toString(InterpolationType_Bezier), QVariant(InterpolationType_Bezier));
    if (ui->cbInterpolation->findData(QVariant(m_project->preferences()->renderInterpolationType())) >= 0) {
        ui->cbInterpolation->setCurrentIndex(ui->cbInterpolation->findData(QVariant(m_project->preferences()->renderInterpolationType())));
    }

    bool b = true;
    b &= connect(m_targetGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotUpdateRenderTarget()));
    b &= connect(m_sectionGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotSectionModeChanged()));
    b &= connect(ui->timeStart, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));
    b &= connect(ui->timeEnd, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));

    b &= connect(ui->cbStartTag, SIGNAL(currentIndexChanged(int)), this, SLOT(slotTagIndexChanged()));
    b &= connect(ui->cbEndTag, SIGNAL(currentIndexChanged(int)), this, SLOT(slotTagIndexChanged()));

    b &= connect(ui->bAbort, SIGNAL(clicked()), this, SLOT(reject()));
    b &= connect(ui->bOk, SIGNAL(clicked()), this, SLOT(accept()));
    b &= connect(ui->bSave, SIGNAL(clicked()), this, SLOT(slotSaveSettings()));

    b &= connect(ui->cbFps, SIGNAL(editTextChanged(QString)), this, SLOT(slotValidate()));

    b &= connect(ui->imagesOutputDir, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));
    b &= connect(ui->imagesFilenamePattern, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));
    b &= connect(ui->videoOutputFile, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));
    b &= connect(ui->bImagesBrowseDir, SIGNAL(clicked()), this, SLOT(slotBrowseImagesDir()));
    b &= connect(ui->bBrowseVideoOutputFile, SIGNAL(clicked()), this, SLOT(slotBrowseVideoFile()));
    Q_ASSERT(b);

    // Restore rendering start/end
    int index;
    index = ui->cbStartTag->findText(m_project->preferences()->renderStartTag());
    if (index >= 0) {
        ui->cbStartTag->setCurrentIndex(index);
    }
    index = ui->cbEndTag->findText(m_project->preferences()->renderEndTag());
    if (index >= 0) {
        ui->cbEndTag->setCurrentIndex(index);
    }
    if (m_project->preferences()->renderStartTime().length() > 0) {
        ui->timeStart->setText(m_project->preferences()->renderStartTime());
    }
    if (m_project->preferences()->renderEndTime().length() > 0) {
        ui->timeEnd->setText(m_project->preferences()->renderEndTime());
    }

#if QT_VERSION >= 0x040700
    ui->timeStart->setPlaceholderText(QVariant(m_project->nodes()->startTime()).toString());
    ui->timeEnd->setPlaceholderText(QVariant(m_project->nodes()->endTime()).toString());
#endif

    slotUpdateRenderTarget();
    slotSectionModeChanged();
}
Exemplo n.º 3
0
RenderTask_sV* RenderingDialog::buildTask()
{
    if (slotValidate()) {
        slotSaveSettings();

        ProjectPreferences_sV *prefs = m_project->preferences();

        const QString imagesOutputDir = ui->imagesOutputDir->text();
        const QString imagesFilenamePattern = ui->imagesFilenamePattern->text();

        RenderTask_sV *task = new RenderTask_sV(m_project);
        task->renderPreferences().setFps(prefs->renderFPS());
        task->renderPreferences().size = prefs->renderFrameSize();
        task->renderPreferences().interpolation = prefs->renderInterpolationType();
        task->renderPreferences().motionblur = prefs->renderMotionblurType();


        if (ui->radioImages->isChecked()) {
            ImagesRenderTarget_sV *renderTarget = new ImagesRenderTarget_sV(task);
            renderTarget->setFilenamePattern(imagesFilenamePattern);
            renderTarget->setTargetDir(imagesOutputDir);
            task->setRenderTarget(renderTarget);
        } else if (ui->radioVideo->isChecked()) {
            VideoRenderTarget_sV *renderTarget = new VideoRenderTarget_sV(task);
            renderTarget->setTargetFile(ui->videoOutputFile->text());
            renderTarget->setVcodec(ui->vcodec->text());
            task->setRenderTarget(renderTarget);
        } else {
            qDebug() << "Render target is neither images nor video. Not implemented?";
            Q_ASSERT(false);
        }

        if (ui->radioTagSection->isChecked()) {
            bool b;
            qreal start = ui->cbStartTag->itemData(ui->cbStartTag->currentIndex()).toFloat(&b);
            Q_ASSERT(b);
            qreal end = ui->cbEndTag->itemData(ui->cbEndTag->currentIndex()).toFloat(&b);
            Q_ASSERT(b);
            qDebug() << QString("Rendering tag section from %1 (%2) to %3 (%4)")
                        .arg(ui->cbStartTag->currentText())
                        .arg(start).arg(ui->cbEndTag->currentText()).arg(end);
            Q_ASSERT(start <= end);
            task->setTimeRange(start, end);
        } else if (ui->radioSection->isChecked()) {
            qDebug() << QString("Rendering time section from %1 to %3")
                        .arg(ui->cbStartTag->currentText())
                        .arg(ui->cbEndTag->currentText());
            task->setTimeRange(ui->timeStart->text(), ui->timeEnd->text());
        }

        QString mode;
        if (ui->radioFullProject->isChecked()) {
            mode = "full";
        } else if (ui->radioSection->isChecked()) {
            mode = "time";
            m_project->preferences()->renderStartTime() = ui->timeStart->text();
            m_project->preferences()->renderEndTime() = ui->timeEnd->text();
        } else if (ui->radioTagSection->isChecked()) {
            mode = "tags";
            m_project->preferences()->renderStartTag() = ui->cbStartTag->currentText();
            m_project->preferences()->renderEndTag() = ui->cbEndTag->currentText();
        } else {
            qDebug() << "No section mode selected?";
            Q_ASSERT(false);
        }
        return task;
    } else {
        return NULL;
    }
}
void ImageImporter::slotImport()
{
    //first save all
    slotSaveSettings();

    //then init the regular expression
    QRegExp re(m_txtSourceFilename->text(), !m_chkIgnoreCase->isChecked());

    //first find all possible files
    //listdir is used as a stack containing the directories to parse
    QStringList lstDirs = m_cmbSourceFolder->currentText();

    //the list of files found in the directories
    QFileInfoList lstFiles;
    lstFiles.setAutoDelete(true);

    DlgImageImporterStatus* dlgStatus = new DlgImageImporterStatus(this, "StatusDialog");
    dlgStatus->enableImageArchive(m_groupArchive->isChecked());
    dlgStatus->show();

    dlgStatus->appendStatusMessage(i18n("Starting..."));

    dlgStatus->setCurrentMode( DlgImageImporterStatus::ModeImport,
                               i18n("Scanning for available Images..."));

    //now go thru all folders and collect all files that match the file regexp...
    while (!lstDirs.isEmpty()) {
        QDir d( lstDirs.front() );
        lstDirs.pop_front();

        dlgStatus->addFolder();

        d.setMatchAllDirs(true);

        const QFileInfoList* list = d.entryInfoList();
        if (list) {

            QFileInfoListIterator it( *list );
            QFileInfo* fi;

            for ( ; ( fi = it.current() ) != 0; ++it )
            {
                if ( fi->fileName() == "." || fi->fileName() == ".."  ) {
                    continue;
                } else if ( fi->isDir() && m_chkSrcIncludeSubfolders->isChecked())    {
                    lstDirs.append(fi->absFilePath());
                } else if( fi->isFile() ) {
                    dlgStatus->addFile();
                    if (re.exactMatch(fi->fileName())) {
                        dlgStatus->addMatch();
                        //save a copy of all FileInfos
                        lstFiles.append(new QFileInfo(*fi));
                    }
                }
                // we return here and break all importing!
                if (dlgStatus->wasCanceled()) {
                    return;
                }
            }
        }
        // we return here and break all importing!
        if (dlgStatus->wasCanceled()) {
            return;
        }
    }

    //archive the images, if requested ...
    if (m_groupArchive->isChecked())
    {
        dlgStatus->setCurrentMode(DlgImageImporterStatus::ModeArchive,
                                  i18n("Archiving found images..."));

        importFiles(&lstFiles,
                    m_txtArchiveBaseFolder->text(),
                    m_txtArchiveSubfolders->text(),
                    m_txtArchiveFilename->text(),
                    m_chkArchiveLowercase->isChecked(),
                    false,
                    dlgStatus);

        if (dlgStatus->wasCanceled()) {
            //either canceled by user or error
            return;
        }
    } else {
        dlgStatus->appendStatusMessage(i18n("Archiving found images... skipped"));
    }

    QString msg = i18n("Moving found images...");
    if (!m_chkSrcRemoveFilesFromSrc->isChecked()) {
        msg = i18n("Copying found images...");
    }
    dlgStatus->setCurrentMode(DlgImageImporterStatus::ModeDestination, msg);

    // ... then copy/ move the images to their destinaion
    importFiles(&lstFiles, m_cmbDestBasefolder->currentText(), m_txtDestSubfolders->text(),
                m_txtDestFilename->text(), m_chkDestLowercase->isChecked(),
                m_chkSrcRemoveFilesFromSrc->isChecked(), dlgStatus);

    if (dlgStatus->wasCanceled()) {
        //either canceled by user or error
        return;
    }

    //yes, we are done :)
    dlgStatus->setCurrentMode( DlgImageImporterStatus::ModeFinished, i18n("Done."));

    //now tell, that new images have arrived
    emit newImagesImported(m_cmbDestBasefolder->currentText());
}
void ImageImporter::slotQuit() {
    slotSaveSettings();
    accept();
}
Exemplo n.º 6
0
RenderingDialog::RenderingDialog(Project_sV *project, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::RenderingDialog),
    m_project(project)
{
    ui->setupUi(this);

    // Render section
    m_sectionGroup = new QButtonGroup(this);
    m_sectionGroup->addButton(ui->radioFullProject);
    m_sectionGroup->addButton(ui->radioSection);
    m_sectionGroup->addButton(ui->radioTagSection);
    QString mode(m_project->preferences()->renderSectionMode());
    if (mode == "full") {
        ui->radioFullProject->setChecked(true);
    } else if (mode == "expr") {
        ui->radioSection->setChecked(true);
    } else if (mode == "tags") {
        ui->radioTagSection->setChecked(true);
    } else {
        qDebug() << "Unknown render section mode: " << mode;
        Q_ASSERT(false);
    }

    // Optical flow
    ui->lambda->setValue(m_project->preferences()->flowV3DLambda());

    QSettings settings; //TODO: better define in project ?
    ui->opticalFlowAlgo->clear();
    QString flow_method = settings.value("preferences/flowMethod", "OpenCV-CPU").toString();
    if (flow_method == "V3D") {
        ui->opticalFlowAlgo->addItem(tr("flowBuilder"), QVariant(1));
    } else {
        ui->opticalFlowAlgo->addItem(tr("OpenCV - Farneback"), QVariant(2));
        ui->opticalFlowAlgo->addItem(tr("OpenCV - Dual TVL1"), QVariant(3));
    }

    connect(ui->opticalFlowAlgo, SIGNAL(activated(int)),
            ui->flowStackedWidget, SLOT(setCurrentIndex(int)));

    QWidget *flowbuilder_pane = ui->flowStackedWidget->widget(0);
    QWidget *farneback_pane = ui->flowStackedWidget->widget(1);
    QWidget *tvl1_pane = ui->flowStackedWidget->widget(2);
    if (flow_method == "V3D") {
        ui->opticalFlowAlgo->setCurrentIndex(0);
        ui->flowStackedWidget->setCurrentIndex(0);
        ui->flowStackedWidget->removeWidget(farneback_pane);
        ui->flowStackedWidget->removeWidget(tvl1_pane);
    } else {
        int algo = settings.value("preferences/preferredOpenCVAlgo", 0).toInt();
        ui->opticalFlowAlgo->setCurrentIndex(algo);
        ui->flowStackedWidget->setCurrentIndex(algo+1);
        ui->flowStackedWidget->removeWidget(flowbuilder_pane);
    }
    connect(ui->clearflow, SIGNAL(clicked()), this, SLOT(slotClearFlowCache()));
    // Motion blur
    ui->maxSamples->setValue(m_project->motionBlur()->maxSamples());
    ui->slowmoSamples->setValue(m_project->motionBlur()->slowmoSamples());
    m_blurGroup = new QButtonGroup(this);
    m_blurGroup->addButton(ui->radioBlurConvolution);
    m_blurGroup->addButton(ui->radioBlurStacking);
    m_blurGroup->addButton(ui->radioBlurNearest);
    if (m_project->preferences()->renderMotionblurType() == MotionblurType_Convolving) {
        ui->radioBlurConvolution->setChecked(true);
    } else if (m_project->preferences()->renderMotionblurType() == MotionblurType_Stacking) {
        ui->radioBlurStacking->setChecked(true);
    } else {
        ui->radioBlurNearest->setChecked(true);
    }

    fillTagLists();

    // Output target type
    m_targetGroup = new QButtonGroup(this);
    m_targetGroup->addButton(ui->radioImages);
    m_targetGroup->addButton(ui->radioVideo);
    if (m_project->preferences()->renderTarget() == "images") {
        ui->radioImages->setChecked(true);
    } else {
        ui->radioVideo->setChecked(true);
    }

    // Output target files
    ui->imagesOutputDir->setText(m_project->preferences()->imagesOutputDir());
    ui->imagesFilenamePattern->setText(m_project->preferences()->imagesFilenamePattern());
    ui->videoOutputFile->setText(m_project->preferences()->videoFilename());
    ui->vcodec->setText(m_project->preferences()->videoCodec());

    // FPS
    QString fps = QVariant(m_project->preferences()->renderFPS().fps()).toString();
    if (ui->cbFps->findText(fps) < 0 && fps.toFloat() > 0) {
        ui->cbFps->addItem(fps);
    }
    ui->cbFps->setCurrentIndex(ui->cbFps->findText(fps));

    // Output size
    ui->cbSize->addItem(tr("Original size"), QVariant(FrameSize_Orig));
    ui->cbSize->addItem(tr("Small"), QVariant(FrameSize_Small));
    ui->cbSize->setCurrentIndex(ui->cbSize->findData(QVariant(m_project->preferences()->renderFrameSize())));

    // Interpolation type
    ui->cbInterpolation->addItem(toString(InterpolationType_Forward), QVariant(InterpolationType_Forward));
    ui->cbInterpolation->addItem(toString(InterpolationType_ForwardNew), QVariant(InterpolationType_ForwardNew));
    ui->cbInterpolation->addItem(toString(InterpolationType_Twoway), QVariant(InterpolationType_Twoway));
    ui->cbInterpolation->addItem(toString(InterpolationType_TwowayNew), QVariant(InterpolationType_TwowayNew));
    ui->cbInterpolation->addItem(toString(InterpolationType_Bezier), QVariant(InterpolationType_Bezier));
    ui->cbInterpolation->addItem(toString(InterpolationType_None), QVariant(InterpolationType_None));
    ui->cbInterpolation->addItem(toString(InterpolationType_Nearest), QVariant(InterpolationType_Nearest));
    if (ui->cbInterpolation->findData(QVariant(m_project->preferences()->renderInterpolationType())) >= 0) {
        ui->cbInterpolation->setCurrentIndex(ui->cbInterpolation->findData(QVariant(m_project->preferences()->renderInterpolationType())));
    }

    connect(m_targetGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotUpdateRenderTarget()));
    connect(m_sectionGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotSectionModeChanged()));
    connect(ui->timeStart, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));
    connect(ui->timeEnd, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));

    connect(ui->cbStartTag, SIGNAL(currentIndexChanged(int)), this, SLOT(slotTagIndexChanged()));
    connect(ui->cbEndTag, SIGNAL(currentIndexChanged(int)), this, SLOT(slotTagIndexChanged()));

    connect(ui->bAbort, SIGNAL(clicked()), this, SLOT(reject()));
    connect(ui->bOk, SIGNAL(clicked()), this, SLOT(accept()));
    connect(ui->bSave, SIGNAL(clicked()), this, SLOT(slotSaveSettings()));

    connect(ui->cbFps, SIGNAL(editTextChanged(QString)), this, SLOT(slotValidate()));

    connect(ui->imagesOutputDir, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));
    connect(ui->imagesFilenamePattern, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));
    connect(ui->videoOutputFile, SIGNAL(textChanged(QString)), this, SLOT(slotValidate()));
    connect(ui->bImagesBrowseDir, SIGNAL(clicked()), this, SLOT(slotBrowseImagesDir()));
    connect(ui->bBrowseVideoOutputFile, SIGNAL(clicked()), this, SLOT(slotBrowseVideoFile()));

    // Restore rendering start/end
    int index = ui->cbStartTag->findText(m_project->preferences()->renderStartTag());
    if (index >= 0) {
        ui->cbStartTag->setCurrentIndex(index);
    }
    index = ui->cbEndTag->findText(m_project->preferences()->renderEndTag());
    if (index >= 0) {
        ui->cbEndTag->setCurrentIndex(index);
    }
    if (m_project->preferences()->renderStartTime().length() > 0) {
        ui->timeStart->setText(m_project->preferences()->renderStartTime());
    }
    if (m_project->preferences()->renderEndTime().length() > 0) {
        ui->timeEnd->setText(m_project->preferences()->renderEndTime());
    }

#if QT_VERSION >= 0x040700
    ui->timeStart->setPlaceholderText(QVariant(m_project->nodes()->startTime()).toString());
    ui->timeEnd->setPlaceholderText(QVariant(m_project->nodes()->endTime()).toString());
#endif

#ifndef USE_QTKIT
     ui->use_qt->setChecked(false);
     ui->use_qt->setEnabled(false);
#endif

    slotUpdateRenderTarget();
    slotSectionModeChanged();
}
Exemplo n.º 7
0
RenderTask_sV* RenderingDialog::buildTask()
{
    if (!slotValidate()) {
        return NULL;
    }
    slotSaveSettings();

    ProjectPreferences_sV *prefs = m_project->preferences();

    const QString imagesOutputDir = ui->imagesOutputDir->text();
    const QString imagesFilenamePattern = ui->imagesFilenamePattern->text();

    RenderTask_sV *task = new RenderTask_sV(m_project);
    task->renderPreferences().setFps(prefs->renderFPS());
    task->renderPreferences().size = prefs->renderFrameSize();
    task->renderPreferences().interpolation = prefs->renderInterpolationType();
    task->renderPreferences().motionblur = prefs->renderMotionblurType();


    if (ui->radioImages->isChecked()) {
        ImagesRenderTarget_sV *renderTarget = new ImagesRenderTarget_sV(task);
        renderTarget->setFilenamePattern(imagesFilenamePattern);
        renderTarget->setTargetDir(imagesOutputDir);
        task->setRenderTarget(renderTarget);
    } else if (ui->radioVideo->isChecked()) {
#ifdef USE_FFMPEG
#if 0
        newVideoRenderTarget *renderTarget = new newVideoRenderTarget(task);
#else
        exportVideoRenderTarget *renderTarget = new exportVideoRenderTarget(task);
#endif
        const bool use_qt = ui->use_qt->isChecked();
        if (!use_qt) {
            qDebug() << "using classical FFMPEG";
            renderTarget->setQT(0);
        }
#else
#warning "should not use this"
        VideoRenderTarget_sV *renderTarget = new VideoRenderTarget_sV(task);
#endif
        // check if file exist
        QFile filetest(ui->videoOutputFile->text());
        if (filetest.exists()) {
            int r = QMessageBox::warning(this, tr("slowmoUI"),
                tr("The file already exist.\n"
                "Do you want to overwrite it ?"),
                QMessageBox::Yes | QMessageBox::No);
            if (r == QMessageBox::Yes) {
            filetest.remove();
            } else {
            //TODO:  maybe should delete task ?
            return 0;
            }
        }
        renderTarget->setTargetFile(ui->videoOutputFile->text());
        renderTarget->setVcodec(ui->vcodec->text());
        task->setRenderTarget(renderTarget);
    } else {
        qDebug() << "Render target is neither images nor video. Not implemented?";
        Q_ASSERT(false);
    }

    if (ui->radioTagSection->isChecked()) {
        bool b;
        qreal start = ui->cbStartTag->itemData(ui->cbStartTag->currentIndex()).toFloat(&b);
        Q_ASSERT(b);
        qreal end = ui->cbEndTag->itemData(ui->cbEndTag->currentIndex()).toFloat(&b);
        Q_ASSERT(b);
        qDebug() << QString("Rendering tag section from %1 (%2) to %3 (%4)")
                    .arg(ui->cbStartTag->currentText())
                    .arg(start).arg(ui->cbEndTag->currentText()).arg(end);
        Q_ASSERT(start <= end);
        task->setTimeRange(start, end);
    } else if (ui->radioSection->isChecked()) {
        qDebug() << QString("Rendering time section from %1 to %3")
                    .arg(ui->cbStartTag->currentText())
                    .arg(ui->cbEndTag->currentText());
        task->setTimeRange(ui->timeStart->text(), ui->timeEnd->text());
    }

    QString mode;
    if (ui->radioFullProject->isChecked()) {
        mode = "full";
    } else if (ui->radioSection->isChecked()) {
        mode = "time";
        m_project->preferences()->renderStartTime() = ui->timeStart->text();
        m_project->preferences()->renderEndTime() = ui->timeEnd->text();
    } else if (ui->radioTagSection->isChecked()) {
        mode = "tags";
        m_project->preferences()->renderStartTag() = ui->cbStartTag->currentText();
        m_project->preferences()->renderEndTag() = ui->cbEndTag->currentText();
    } else {
        qDebug() << "No section mode selected?";
        Q_ASSERT(false);
    }

    // set optical flow parameters
    QSettings settings;
    QString flow_method = settings.value("preferences/flowMethod", "OpenCV-CPU").toString();
    if (flow_method == "V3D") {
        AbstractFlowSource_sV *flow_algo = m_project->flowSource();
        flow_algo->setLambda(prefs->flowV3DLambda());
    }
    else if (flow_method == "OpenCV-CPU" || flow_method == "OpenCV-OCL") {
        int algo_index = ui->opticalFlowAlgo->currentIndex();
        qDebug() << "algo index is " << algo_index;
        FlowSourceOpenCV_sV *flow_algo = (FlowSourceOpenCV_sV *)m_project->flowSource();

        switch (algo_index) {
            case 0:
                flow_algo->setupOpticalFlow(
                    ui->FarnLevels->value(),
                    ui->FarnWin->value(),
                    ui->FarnPoly->value(),
                    ui->FarnPyr->value(),
                    ui->FarnPolyN->value()
                );
                break;

            case 1:
                flow_algo->setupTVL1(
                    ui->TVLtau->value(),
                    ui->TVLlambda->value(),
                    ui->TVLnscales->value(),
                    ui->TVLwarps->value(),
                    ui->TVLiterations->value(),
                    ui->TVLepsilon->value()
                );
                break;

            default:
                qDebug() << "no algo defined";
        }
    }
    else {
        throw Error_sV("Unsupported Flow method");
    }
    return task;
}