예제 #1
0
void ExportDialog::slotStartStop()
{
    if (!d->busy)
    {
        if (d->listView->imageUrls().isEmpty())
        {
            KMessageBox::error(this, i18n("There are no images in the list to process."));
            busy(false);
            slotAborted();
            return;
        }

        MyImageListViewItem* const item = setUpImageItems();

        processAll(item);

        d->progressBar->setMaximum(d->thread->getTotalFrames(item));
        d->progressBar->setValue(0);
        d->progressBar->show();
        d->progressBar->progressScheduled(i18n("Video SlideShow"), true, true);

        busy(true);

        if (!d->thread->isRunning())
            d->thread->start();
    }
    else
    {
        d->thread->cancel();
        busy(false);

        d->listView->cancelProcess();

        QTimer::singleShot(500, this, SLOT(slotAborted()));
    }
}
예제 #2
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();
    }
}
예제 #3
0
/**
 * Class constructor.
 * @param	pParent	The parent widget
 * @param	szName	The widget's name
 */
GraphWidget::GraphWidget(QWidget* pParent, const char* szName) :
	QCanvasView(pParent, szName),
	m_progress(this),
	m_dot(this),
	m_dZoom(1.0),
	m_nMaxNodeDegree(10), // will be overriden by CallTreeDlg
	m_nMultiCallNum(0),
	m_pProgressDlg(NULL)					 
{
	// Automatically delete nodes when they are removed
	m_dictNodes.setAutoDelete(true);
	
	// Create a canvas
	setCanvas(new QCanvas(this));
	canvas()->setBackgroundColor(Config().getColor(KScopeConfig::GraphBack));

	// Create a persistent Cscope process
	m_pCscope = new CscopeFrontend();
	
	// Add records output by the Cscope process
	connect(m_pCscope, SIGNAL(dataReady(FrontendToken*)), this,
		SLOT(slotDataReady(FrontendToken*)));
	
	// Display query progress information
	connect(m_pCscope, SIGNAL(progress(int, int)), this,
		SLOT(slotProgress(int, int)));	
		
	// Draw the graph when the process has finished
	connect(m_pCscope, SIGNAL(finished(uint)), this,
		SLOT(slotFinished(uint)));
	
	// Show a multi-call node when a query results in too many records
	connect(m_pCscope, SIGNAL(aborted()), this,
		SLOT(slotAborted()));
	
	// Redraw the graph when Dot exits
	connect(&m_dot, SIGNAL(finished(uint)), this, SLOT(slotDotFinished()));	
	
	// Create the node popup menu
	m_pNodePopup = new QPopupMenu(this);
	
	m_pNodePopup->insertItem(new MenuLabel(i18n("<b>Called Functions</b>"),
		m_pNodePopup));
	m_pNodePopup->insertItem(i18n("Show"), this,
		SLOT(slotShowCalled()));
	m_pNodePopup->insertItem(i18n("List/Filter..."), this,
		SLOT(slotListCalled()));
	m_pNodePopup->insertItem(i18n("Hide"), this,
		SLOT(slotHideCalled()));
	
	m_pNodePopup->insertItem(new MenuLabel(i18n("<b>Calling Functions</b>"),
		m_pNodePopup));
	m_pNodePopup->insertItem(i18n("Show"), this,
		SLOT(slotShowCalling()));
	m_pNodePopup->insertItem(i18n("List/Filter..."), this,
		SLOT(slotListCalling()));
	m_pNodePopup->insertItem(i18n("Hide"), this,
		SLOT(slotHideCalling()));
	
	m_pNodePopup->insertItem(new MenuLabel(i18n("<b>This Function</b>"),
		m_pNodePopup));
	m_pNodePopup->insertItem(i18n("Find Definition"), this,
		SLOT(slotFindDef()));
	m_pNodePopup->insertItem(i18n("Remove"), this, SLOT(slotRemoveNode()));
		
	// Create the multi-call node popup menu
	m_pMultiCallPopup = new QPopupMenu(this);
	m_pMultiCallPopup->insertItem(i18n("List..."), this,
		SLOT(slotMultiCallDetails()));
	m_pMultiCallPopup->insertSeparator();
	m_pMultiCallPopup->insertItem(i18n("Remove"), this,
		SLOT(slotRemoveNode()));
	
	// Create the edge menu
	m_pEdgePopup = new QPopupMenu(this);
	m_pEdgePopup->insertItem(i18n("Open Call"), this, SLOT(slotOpenCall()));
		
	(void)new GraphTip(this);
}
예제 #4
0
void ExportDialog::slotThreadFinished()
{
    busy(false);
    slotAborted();
}