Ejemplo n.º 1
1
void Dialog::on_syncButton_clicked() {
    time.restart();
    ui->traceTextEdit->clear();

    // Checking
    QString src = ui->srcLineEdit->text();
    QString dst = ui->dstLineEdit->text();
    if (src.isEmpty()) {
        QMessageBox msgBox;
        msgBox.setText("You have to choose a folder to synchronize");
        msgBox.exec();
        return;
    }
    if (dst.isEmpty()) {
        QMessageBox msgBox;
        msgBox.setText("You have to choose a destination folder");
        msgBox.exec();
        return;
    }

    // Starting synchronizing (long asynchrone operation)
    enableProcess(true);
    QCoreApplication::processEvents();

    Worker* worker = new Worker(this);

    connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater()));
    connect(worker, SIGNAL(finished()), this, SLOT(finishedProcess()));
    connect(worker, SIGNAL(print(const char*)), this, SLOT(print(const char*)));

    qRegisterMetaType<int64>("int64");
    connect(worker, SIGNAL(progressBar(int64,int64)), this, SLOT(progressBar(int64, int64)));

    QtConcurrent::run(worker, &Worker::process);
}
bool MgrStereoHand::init(){
	initWindows();

	drawingModule = new DrawingModule;

	fs = new FrameStorage;
	fs->initFrames();

	calibModule = new CalibrationModule;

	process = new ProcessingThread;
	process->init(fs, calibModule, calibDialog, statisticsDialog);

	calibDialog->init(calibModule);

	realProcessingThead = new QThread();
	process->moveToThread(realProcessingThead);

	connect(realProcessingThead, SIGNAL(started()), process, SLOT(process()));
	connect(process, SIGNAL(finished()), realProcessingThead, SLOT(quit()));
	connect(process, SIGNAL(finished()), process, SLOT(deleteLater()));
	connect(realProcessingThead, SIGNAL(finished()), realProcessingThead, SLOT(deleteLater()));
	
	connect(realProcessingThead, SIGNAL(finished()), this, SLOT(realExit()));
	
	connect(process, SIGNAL(showImages()), this, SLOT(showImages()));
	connect(process, SIGNAL(messageError(QString, QString)), this, SLOT(errorMessage(QString, QString)));
	connect(process, SIGNAL(startedProcess()), this, SLOT(startedProcess()));
	connect(process, SIGNAL(finishedProcess()), this, SLOT(finishedProcess()));
	connect(process, SIGNAL(calibrationNotSet()), this, SLOT(calibrationNotSet()));
	connect(process, SIGNAL(showOverlay(QString,int)), this, SLOT(showOverlay(QString,int)));
	connect(process, SIGNAL(getFilmFileName()), this, SLOT(getFilmFileName()));
	//connect(this, SIGNAL(showOverlay(QString,int)), this, SLOT(showOverlay(QString,int)));
	
	realProcessingThead->start();

	return true;
}
void ReplayGainProcessor::remove( ReplayGainProcessorItem *item, ReplayGainFileListItem::ReturnCode returnCode )
{
    QString exitMessage;

    if( returnCode == ReplayGainFileListItem::Succeeded && item->take > 0 )
        returnCode = ReplayGainFileListItem::SucceededWithProblems;

    switch( returnCode )
    {
        case ReplayGainFileListItem::Succeeded:
            exitMessage = i18nc("Conversion exit status","Normal exit");
            break;
        case ReplayGainFileListItem::SucceededWithProblems:
            exitMessage = i18nc("Conversion exit status","Succeeded but problems occured");
            break;
        case ReplayGainFileListItem::StoppedByUser:
            exitMessage = i18nc("Conversion exit status","Aborted by the user");
            break;
        case ReplayGainFileListItem::BackendNeedsConfiguration:
            exitMessage = i18nc("Conversion exit status","Backend needs configuration");
            break;
        case ReplayGainFileListItem::Skipped:
            exitMessage = i18nc("Conversion exit status","Skipped");
            break;
        case ReplayGainFileListItem::Failed:
            exitMessage = i18nc("Conversion exit status","An error occurred");
            break;
    }

    logger->log( item->logID, "<br>" +  i18n("Removing file from conversion list. Exit code %1 (%2)",returnCode,exitMessage) );

    emit timeFinished( (float)item->time );

    emit finished( item->fileListItem, returnCode ); // send signal to FileList
    emit finishedProcess( item->logID, returnCode == ReplayGainFileListItem::Succeeded ); // send signal to Logger

    items.removeAll( item );
    delete item;

    if( items.size() == 0 )
        updateTimer.stop();
}