Пример #1
0
void MainWindow::slotShowRenderDialog()
{
    if (m_project->renderTask() != NULL) {
        disconnect(SIGNAL(signalRendererContinue()), m_project->renderTask());
    }
    
    RenderingDialog renderingDialog(m_project, this);
    if (renderingDialog.exec() == QDialog::Accepted) {
        
        RenderTask_sV *task = renderingDialog.buildTask();
        if (task != 0) {
            task->moveToThread(&m_rendererThread);
            
            if (m_project->renderTask() != NULL) {
                disconnect(SIGNAL(signalRendererContinue()), m_project->renderTask());
            }
            //m_project->replaceRenderTask(task);
            
            if (m_renderProgressDialog == NULL) {
                m_renderProgressDialog = new ProgressDialog(this);
                m_renderProgressDialog->setWindowTitle(tr("Rendering progress"));
            } else {
                m_renderProgressDialog->disconnect();
            }
            
            connect(task, SIGNAL(signalNewTask(QString,int)), m_renderProgressDialog, SLOT(slotNextTask(QString,int)));
            connect(task, SIGNAL(signalItemDesc(QString)), m_renderProgressDialog, SLOT(slotTaskItemDescription(QString)));
            connect(task, SIGNAL(signalTaskProgress(int)), m_renderProgressDialog, SLOT(slotTaskProgress(int)));
            connect(task, SIGNAL(signalRenderingFinished(QString)), m_renderProgressDialog, SLOT(slotAllTasksFinished(QString)));
            connect(task, SIGNAL(signalRenderingAborted(QString)), this, SLOT(slotRenderingAborted(QString)));
            connect(task, SIGNAL(signalRenderingAborted(QString)), m_renderProgressDialog, SLOT(close()));
            connect(task, SIGNAL(signalRenderingStopped(QString)), m_renderProgressDialog, SLOT(slotAborted(QString)));
            connect(m_renderProgressDialog, SIGNAL(signalAbortTask()), task, SLOT(slotStopRendering()));
            //connect(this, SIGNAL(signalRendererContinue()), task, SLOT(slotContinueRendering()), Qt::UniqueConnection);
            
            connect(task, SIGNAL(workFlowRequested()), &m_rendererThread, SLOT(start()));
            connect(&m_rendererThread, SIGNAL(started()), task, SLOT(slotContinueRendering()));
 
            connect(task, SIGNAL(signalRenderingFinished(QString)), &m_rendererThread, SLOT(quit()));
            // done another way ?!
            connect(task, SIGNAL(signalRenderingFinished(QString)), task, SLOT(deleteLater()));
             
            //connect(&m_rendererThread, &QThread::finished, task, &QObject::deleteLater);
            // let's start
            m_rendererThread.wait(); // If the thread is not running, this will immediately return.
            
            m_renderProgressDialog->show();
            
            //emit signalRendererContinue();
            //m_rendererThread.exec ();
            m_rendererThread.start();
            task->requestWork();
        }
    } else {
    	QMessageBox(QMessageBox::Warning, tr("Aborted"), tr("Aborted by user"), QMessageBox::Ok).exec();
    }
}
Пример #2
0
void MainWindow::slotNewFrameSourceTask(const QString taskDescription, int taskSize)
{
    if (m_progressDialog == NULL) {
        m_progressDialog = new ProgressDialog(this);
        m_progressDialog->setWindowTitle(tr("Frame extraction progress"));
        connect(m_project->frameSource(), SIGNAL(signalNextTask(QString,int)), m_progressDialog, SLOT(slotNextTask(QString,int)));
        connect(m_project->frameSource(), SIGNAL(signalTaskProgress(int)), m_progressDialog, SLOT(slotTaskProgress(int)));
        connect(m_project->frameSource(), SIGNAL(signalTaskItemDescription(QString)), m_progressDialog, SLOT(slotTaskItemDescription(QString)));
        connect(m_project->frameSource(), SIGNAL(signalAllTasksFinished()), m_progressDialog, SLOT(slotAllTasksFinished()));
        connect(m_progressDialog, SIGNAL(signalAbortTask()), m_project->frameSource(), SLOT(slotAbortInitialization()));
    }
Пример #3
0
void ProgressDialog::slotAbortPressed()
{
    emit signalAbortTask();
}