Esempio n. 1
0
void K3b::Md5Job::start()
{
    cancel();

    jobStarted();
    d->readData = 0;

    if( d->isoFile ) {
        d->imageSize = d->isoFile->size();
    }
    else if( !d->filename.isEmpty() ) {
        if( !QFile::exists( d->filename ) ) {
            emit infoMessage( i18n("Could not find file %1",d->filename), MessageError );
            jobFinished(false);
            return;
        }

        d->file.setName( d->filename );
        if( !d->file.open( QIODevice::ReadOnly ) ) {
            emit infoMessage( i18n("Could not open file %1",d->filename), MessageError );
            jobFinished(false);
            return;
        }

        d->imageSize = K3b::filesize( QUrl::fromLocalFile(d->filename) );
    }
    else
        d->imageSize = 0;

    if( d->device ) {
        //
        // Let the drive determine the optimal reading speed
        //
        d->device->setSpeed( 0xffff, 0xffff );
    }

    d->md5.reset();
    d->finished = false;
    if( d->ioDevice )
        connect( d->ioDevice, SIGNAL(readyRead()), this, SLOT(slotUpdate()) );
    else
        d->timer.start(0);
}
void PlotTableWidget::bagReaderReadingFinished() {
  pausePlots();
  
  for (size_t row = 0; row < plotWidgets_.count(); ++row)
    for (size_t column = 0; column < plotWidgets_[row].count(); ++column)
      plotWidgets_[row][column]->setBroker(registry_);
    
  emit jobFinished("Read bag from [file://"+
    bagReader_->getFileName()+"]");
}
Esempio n. 3
0
void JobScheduler::handleIndexDataMessage(const std::shared_ptr<IndexDataMessage> &message)
{
    auto node = mActiveById.take(message->id());
    if (!node) {
        debug() << "Got IndexDataMessage for unknown job";
        return;
    }
    debug() << "job got index data message" << node->job->id << node->job->source.key() << node->job.get();
    jobFinished(node->job, message);
}
Esempio n. 4
0
void DownloadQueueSet::finishJob( HttpJob * job, const QByteArray& data )
{
    mDebug() << "finishJob: " << job->sourceUrl() << job->destinationFileName();

    deactivateJob( job );
    emit jobRemoved();
    emit jobFinished( data, job->destinationFileName(), job->initiatorId() );
    job->deleteLater();
    activateJobs();
}
Esempio n. 5
0
void K3b::VerificationJob::cancel()
{
    d->canceled = true;
    if( d->dataTrackReader && d->dataTrackReader->active() ) {
        d->dataTrackReader->cancel();
    }
    else if( active() ) {
        emit canceled();
        jobFinished( false );
    }
}
Esempio n. 6
0
void K3b::BlankingJob::slotFinished(bool success)
{
    if ( !m_forceNoEject && k3bcore->globalSettings()->ejectMedia() ) {
        K3b::Device::eject( m_device );
    }

    if( success ) {
        emit percent( 100 );
        jobFinished( true );
    }
    else {
        if( m_canceled ) {
            emit canceled();
        }
        else {
            emit infoMessage( i18n("Blanking error."), K3b::Job::MessageError );
            emit infoMessage( i18n("Sorry, no error handling yet."), K3b::Job::MessageError );
        }
        jobFinished( false );
    }
}
Esempio n. 7
0
void ExportAkregatorJob::start()
{
    Q_EMIT title(i18n("Start export Akregator settings..."));
    createProgressDialog(i18n("Export Akregator settings"));
    if (mTypeSelected & Utils::Config) {
        QTimer::singleShot(0, this, &ExportAkregatorJob::slotCheckBackupConfig);
    } else if (mTypeSelected & Utils::Data) {
        QTimer::singleShot(0, this, &ExportAkregatorJob::slotCheckBackupData);
    } else {
        Q_EMIT jobFinished();
    }
}
/*!
 * This slot handles the current job being finished by clearing out our job
 * member, and by emitting an appropriate signal.
 *
 * \param r The return text from the job (e.g., errors or whatever).
 */
void CSCollectionTypeResolver::doJobFinished(const QString &r)
{ /* SLOT */

	CSAbstractCollection *c =
		dynamic_cast<CSAbstractCollection *>(sender());

	if(c != NULL)
		c->setEnabled(true);

	Q_EMIT jobFinished(r);

}
Esempio n. 9
0
void K3bIsoImager::cancel()
{
  m_canceled = true;

  if( m_process && !m_processExited ) {
    m_process->kill();
  }
  else if( active() ) {
    emit canceled();
    jobFinished(false);
  }
}
Esempio n. 10
0
    void
  AsyncHTTPLookup::slotResult( KJob *job )
  {
    if ( 0 != job->error() )
    {
      result_ = ServerError;
      if ( !block_ )
        emit queryReady();
      return;
    }

    jobFinished();
  }
Esempio n. 11
0
void TransferManagerModel::addJobToList(QXmppTransferJob *job)
{
    beginInsertRows(QModelIndex(), m_jobList.count(), m_jobList.count());
    m_jobList << job;
    m_doneSize << 0;
    connect(job, SIGNAL(finished()),
            this, SLOT(jobFinished()) );
    connect(job, SIGNAL(progress(qint64,qint64)),
            this, SLOT(jobProgress(qint64,qint64)) );
    connect(job, SIGNAL(stateChanged(QXmppTransferJob::State)),
            this, SLOT(jobStateChanged(QXmppTransferJob::State)) );
    endInsertRows();
}
Esempio n. 12
0
void JobManager::onJobFinished(Job *job)
{
	Q_ASSERT(m_jobs.contains(job->id()));
	Q_ASSERT(!m_finishedJobs.contains(job->id()));

	m_finishedJobs.enqueue(job->id());

	emit jobFinished(job);

	QProcess::execute("aplay -q /usr/share/sounds/pop.wav");

	QTimer::singleShot(CLEANUP_TIMEOUT, this, SLOT(cleanup()));
}
Esempio n. 13
0
void K3b::IsoImager::cancel()
{
    qDebug();
    m_canceled = true;

    if( m_process && m_process->isRunning() ) {
        qDebug() << "terminating process";
        m_process->terminate();
    }
    else if( active() ) {
        emit canceled();
        jobFinished(false);
    }
}
bool CheckFileSystemJob::run(Report& parent)
{
	Report* report = jobStarted(parent);

	// if we cannot check, assume everything is fine
	bool rval = true;

	if (partition().fileSystem().supportCheck() == FileSystem::cmdSupportFileSystem)
		rval = partition().fileSystem().check(*report, partition().deviceNode());

	jobFinished(*report, rval);

	return rval;
}
void AfterEffectsBurner::slotProcessOutputLine( const QString & line, QProcess::ProcessChannel channel )
{
	bool com = line.contains( mCompleteRE );
	bool framecom = line.contains( mFrameCompleteRE );
#ifdef Q_OS_MAC
	bool fatalMachError = line.contains(QRegExp("failed to name Mach port"));
	if( fatalMachError ) {
		logMessage(line);
		jobErrored("the Host has fatal Mach Errors until AB restarts.");
		mSlave->setStatus("restart");
	}
#endif

	if( framecom ) {
		if( taskStarted() ) {
			bool frameCheckFailure = false;
			if( !mJob.outputPath().endsWith( ".avi" ) && !mJob.outputPath().endsWith( ".mov" ) ) {
				QString framePath = makeFramePath( mJob.outputPath(), mFrame );
				QFileInfo fi( framePath );
				frameCheckFailure = !(fi.exists() && fi.isFile() && fi.size() > 0);
				if( !frameCheckFailure )
					emit fileGenerated(framePath);
				QString log = QString("Frame %1 %2").arg(framePath).arg(frameCheckFailure ? "missing" : "found");
				logMessage(log);
			}

			if( frameCheckFailure ) {
				jobErrored("AE: Got frame complete message, but frame doesn't exist or is zero bytes");
				return;
			}

			logMessage("AE: Completed frame: " + QString::number(mFrame));
			taskDone( mFrame );
			mFrame++;
			if( !com && mFrame <= mFrameEnd )
				taskStart( mFrame );
		}
	}

	if( com ) {
		if( mJob.outputPath().endsWith( ".avi" ) || mJob.outputPath().endsWith( ".mov" ) )
			emit fileGenerated(mJob.outputPath());
		LOG_3("AEB::slotReadOutput emit'ing jobFinished()");
		jobFinished();
		return;
	}

	JobBurner::slotProcessOutputLine( line, channel );
}
Esempio n. 16
0
void K3b::MovixJob::start()
{
    jobStarted();

    m_canceled = false;
    m_dataJob->setWritingApp( writingApp() );

    if( m_movixDocPreparer->createMovixStructures() ) {
        m_dataJob->start();
    }
    else {
        m_movixDocPreparer->removeMovixStructures();
        jobFinished(false);
    }
}
Esempio n. 17
0
void K3bThreadJob::start()
{
  if( m_thread ) {
    if( !m_running ) {
      m_thread->setProgressInfoEventHandler(this);
      m_running = true;
      m_thread->init();
      m_thread->start();
    }
    else
      kdDebug() << "(K3bThreadJob) thread not finished yet." << endl;
  }
  else {
    kdError() << "(K3bThreadJob) no job set." << endl;
    jobFinished(false);
  }
}
Esempio n. 18
0
void K3b::BlankingJob::slotStartErasing()
{
    m_canceled = false;

    if( m_writerJob )
        delete m_writerJob;

    if( m_writingApp == K3b::WritingAppCdrdao ) {
        K3b::CdrdaoWriter* writer = new K3b::CdrdaoWriter( m_device, this );
        m_writerJob = writer;

        writer->setCommand( K3b::CdrdaoWriter::BLANK );
        writer->setBlankMode( m_mode );
        writer->setForce( m_force );
        writer->setBurnSpeed( m_speed );
    }
    else {
        K3b::CdrecordWriter* writer = new K3b::CdrecordWriter( m_device, this );
        m_writerJob = writer;

        writer->setFormattingMode( m_mode );
        writer->setForce( m_force );
        writer->setBurnSpeed( m_speed );
    }

    connect(m_writerJob, SIGNAL(finished(bool)), this, SLOT(slotFinished(bool)));
    connect(m_writerJob, SIGNAL(infoMessage(QString,int)),
            this,SIGNAL(infoMessage(QString,int)));
    connect( m_writerJob, SIGNAL(debuggingOutput(QString,QString)),
             this, SIGNAL(debuggingOutput(QString,QString)) );

    if( waitForMedium( m_device,
                       K3b::Device::STATE_COMPLETE|K3b::Device::STATE_INCOMPLETE,
                       K3b::Device::MEDIA_CD_RW,
                       0,
                       i18n("Please insert a rewritable CD medium into drive<p><b>%1 %2 (%3)</b>.",
                            m_device->vendor(),
                            m_device->description(),
                            m_device->blockDeviceName()) ) == Device::MEDIA_UNKNOWN ) {
        emit canceled();
        jobFinished(false);
        return;
    }

    m_writerJob->start();
}
Esempio n. 19
0
    Result
  SyncHTTPLookup::fetchURL()
  {
    kDebug(60010) << "About to fetch: " << cgiURL_.url();

    KIO::TransferJob* job = KIO::get( cgiURL_, KIO::NoReload, KIO::HideProgressInfo );

    if ( 0 == job )
      return ServerError;

    if (!KIO::NetAccess::synchronousRun(job, 0, &data_))
      return ServerError;

    jobFinished();

    return Success;
  }
Esempio n. 20
0
void K3bIsoImager::slotDataPreparationDone( bool success )
{
  if( success ) {
    //
    // We always calculate the image size. It does not take long and at least the mixed job needs it
    // anyway
    //
    startSizeCalculation();
  }
  else {
    if( d->dataPreparationJob->hasBeenCanceled() ) {
      m_canceled = true;
      emit canceled();
    }
    jobFinished( false );
  }
}
Esempio n. 21
0
void ExportAkregatorJob::slotCheckBackupData()
{
    if (mTypeSelected & Utils::Data) {
        increaseProgressDialog();
        setProgressDialogLabel(i18n("Backing up data..."));

        const QString akregatorDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/akregator");
        QDir akregatorDirectory(akregatorDir);
        if (akregatorDirectory.exists()) {
            const bool akregatorDirAdded = archive()->addLocalDirectory(akregatorDir, Utils::dataPath() +  QLatin1String("/akregator"));
            if (!akregatorDirAdded) {
                Q_EMIT error(i18n("\"%1\" directory cannot be added to backup file.", akregatorDir));
            }
        }
        Q_EMIT info(i18n("Data backup done."));
    }
    Q_EMIT jobFinished();
}
Esempio n. 22
0
void K3bDvdFormattingJob::slotProcessFinished( KProcess* p )
{
  if( d->canceled ) {
    emit canceled();
    d->success = false;
  }
  else if( p->normalExit() ) {
    if( !d->error && p->exitStatus() == 0 ) {
      emit infoMessage( i18n("Formatting successfully completed"), K3bJob::SUCCESS );

      if( d->lastProgressValue < 100 ) {
	emit infoMessage( i18n("Do not be concerned with the progress stopping before 100%."), INFO );
	emit infoMessage( i18n("The formatting will continue in the background while writing."), INFO );
      }

      d->success = true;
    }
    else {
      emit infoMessage( i18n("%1 returned an unknown error (code %2).").arg(d->dvdFormatBin->name()).arg(p->exitStatus()),
			K3bJob::ERROR );
      emit infoMessage( i18n("Please send me an email with the last output."), K3bJob::ERROR );

      d->success = false;
    }
  }
  else {
    emit infoMessage( i18n("%1 did not exit cleanly.").arg(d->dvdFormatBin->name()),
		      ERROR );
    d->success = false;
  }

  if( d->forceNoEject ||
      !k3bcore->globalSettings()->ejectMedia() ) {
    d->running = false;
    jobFinished(d->success);
  }
  else {
    emit infoMessage( i18n("Ejecting DVD..."), INFO );
    connect( K3bDevice::eject( d->device ),
	     SIGNAL(finished(K3bDevice::DeviceHandler*)),
	     this,
	     SLOT(slotEjectingFinished(K3bDevice::DeviceHandler*)) );
  }
}
Esempio n. 23
0
void K3b::DvdFormattingJob::slotProcessFinished( int exitCode, QProcess::ExitStatus exitStatus )
{
    if( d->canceled ) {
        emit canceled();
        d->success = false;
    }
    else if( exitStatus == QProcess::NormalExit ) {
        if( !d->error && (exitCode == 0) ) {
            emit infoMessage( i18n("Formatting successfully completed"), Job::MessageSuccess );

            if( d->lastProgressValue < 100 ) {
                emit infoMessage( i18n("Do not be concerned with the progress stopping before 100%."), MessageInfo );
                emit infoMessage( i18n("The formatting will continue in the background during writing."), MessageInfo );
            }

            d->success = true;
        }
        else {
            emit infoMessage( i18n("%1 returned an unknown error (code %2).",d->dvdFormatBin->name(), exitCode),
                              Job::MessageError );
            emit infoMessage( i18n("Please send me an email with the last output."), Job::MessageError );

            d->success = false;
        }
    }
    else {
        emit infoMessage( i18n("%1 did not exit cleanly.",d->dvdFormatBin->name()),
                          MessageError );
        d->success = false;
    }

    if( d->forceNoEject ||
        !k3bcore->globalSettings()->ejectMedia() ) {
        d->running = false;
        jobFinished(d->success);
    }
    else {
        emit infoMessage( i18n("Ejecting medium..."), MessageInfo );
        connect( Device::eject( d->device ),
                 SIGNAL(finished(K3b::Device::DeviceHandler*)),
                 this,
                 SLOT(slotEjectingFinished(K3b::Device::DeviceHandler*)) );
    }
}
bool CreatePartitionJob::run(Report& parent)
{
	Q_ASSERT(partition().devicePath() == device().deviceNode());

	bool rval = false;

	Report* report = jobStarted(parent);

	CoreBackendDevice* backendDevice = CoreBackendManager::self()->backend()->openDevice(device().deviceNode());

	if (backendDevice)
	{
		CoreBackendPartitionTable* backendPartitionTable = backendDevice->openPartitionTable();

		if (backendPartitionTable)
		{
			QString partitionPath = backendPartitionTable->createPartition(*report, partition());

			if (partitionPath != QString())
			{
				rval = true;
				partition().setPartitionPath(partitionPath);
				partition().setState(Partition::StateNone);
				backendPartitionTable->commit();
			}
			else
				report->line() << xi18nc("@info/plain", "Failed to add partition <filename>%1</filename> to device <filename>%2</filename>.", partition().deviceNode(), device().deviceNode());

			delete backendPartitionTable;
		}
		else
			report->line() << xi18nc("@info/plain", "Could not open partition table on device <filename>%1</filename> to create new partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());

		delete backendDevice;
	}
	else
		report->line() << xi18nc("@info/plain", "Could not open device <filename>%1</filename> to create new partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());

	jobFinished(*report, rval);

	return rval;
}
Esempio n. 25
0
void ProtocolView::slotJobExited(bool normalExit, int exitStatus)
{
    QString msg;

    if( normalExit )
    {
        if( exitStatus )
            msg = i18n("[Exited with status %1]\n").arg(exitStatus);
        else
            msg = i18n("[Finished]\n");
    }
    else
        msg = i18n("[Aborted]\n");

    buf += '\n';
    buf += msg;
    processOutput();

    emit jobFinished(normalExit, exitStatus);
}
Esempio n. 26
0
OnlineAstrometryParser::OnlineAstrometryParser() : AstrometryParser()
{
    job_retries=0;
    solver_retries=0;

    networkManager = new QNetworkAccessManager(this);

    connect(this, SIGNAL(authenticateFinished()), this, SLOT(uploadFile()));
    connect(this, SIGNAL(uploadFinished()), this, SLOT(getJobID()));
    connect(this, SIGNAL(jobIDFinished()), this, SLOT(checkJobs()));
    connect(this, SIGNAL(jobFinished()), this, SLOT(checkJobCalibration()));

    // Reset parity on solver failure
    connect(this, &OnlineAstrometryParser::solverFailed, this, [&]() { parity = -1;});

    connect(this, SIGNAL(solverFailed()), this, SLOT(resetSolver()));
    connect(this, SIGNAL(solverFinished(double,double,double, double)), this, SLOT(resetSolver()));

    downsample_factor = 0;
    isGenerated = true;

}
Esempio n. 27
0
void FetchJob::start()
{
	if (m_reply)
	{
		return;
	}

	m_reply = NetworkManagerFactory::createRequest(m_url, QNetworkAccessManager::GetOperation, m_isPrivate);

	connect(m_reply, &QNetworkReply::downloadProgress, this, [&](qint64 bytesReceived, qint64 bytesTotal)
	{
		if (m_sizeLimit >= 0 && ((bytesReceived > m_sizeLimit) || (bytesTotal > m_sizeLimit)))
		{
			cancel();
		}

		if (bytesTotal > 0)
		{
			setProgress(Utils::calculatePercent(bytesReceived, bytesTotal));
		}
	});
	connect(m_reply, &QNetworkReply::finished, this, [&]()
	{
		const bool isSuccess(m_reply->error() == QNetworkReply::NoError);

		if (isSuccess && (m_sizeLimit < 0 || m_reply->size() <= m_sizeLimit))
		{
			handleSuccessfulReply(m_reply);
		}

		if (!isSuccess || m_isFinished)
		{
			deleteLater();

			emit jobFinished(isSuccess && m_isSuccess);
		}
	});
}
Esempio n. 28
0
void K3b::Iso9660ImageWritingJob::slotWriterJobFinished( bool success )
{
    if( d->canceled ) {
        d->finished = true;
        emit canceled();
        jobFinished(false);
        return;
    }

    d->checksumPipe.close();

    if( success ) {
        if( !m_simulate && m_verifyData ) {
            emit burning(false);

            // allright
            // the writerJob should have emitted the "simulation/writing successful" signal

            if( !d->verifyJob ) {
                d->verifyJob = new K3b::VerificationJob( this );
                connectSubJob( d->verifyJob,
                               SLOT(slotVerificationFinished(bool)),
                               K3b::Job::DEFAULT_SIGNAL_CONNECTION,
                               K3b::Job::DEFAULT_SIGNAL_CONNECTION,
                               SLOT(slotVerificationProgress(int)),
                               SIGNAL(subPercent(int)) );
            }
            d->verifyJob->setDevice( m_device );
            d->verifyJob->clear();
            d->verifyJob->addTrack( 1, d->checksumPipe.checksum(), K3b::imageFilesize( m_imagePath )/2048 );

            if( m_copies == 1 )
                emit newTask( i18n("Verifying written data") );
            else
                emit newTask( i18n("Verifying written copy %1 of %2", d->currentCopy, m_copies) );

            d->verifyJob->start();
        }
Esempio n. 29
0
void K3b::VcdJob::xmlGen()
{
    delete d->xmlFile;
    d->xmlFile = new QTemporaryFile;

    if( d->xmlFile->open() ) {
        qDebug() << "(K3b::VcdJob) writing XML data to" << d->xmlFile->fileName();

        K3b::VcdXmlView xmlView( m_doc );
        xmlView.write( *d->xmlFile );

        //    emit infoMessage( i18n( "XML-file successfully created" ), K3b::Job::MessageSuccess );
        emit debuggingOutput( "K3b::VcdXml:", xmlView.xmlString() );

        vcdxBuild();
    }
    else {
        qDebug() << "(K3b::VcdJob) could not write xmlfile.";
        emit infoMessage( i18n( "Could not write correct XML file." ), K3b::Job::MessageError );
        cancelAll();
        jobFinished( false );
    }
}
Esempio n. 30
0
void CvsProcessWidget::slotJobExited( bool normalExit, int exitStatus )
{
    kdDebug(9006) << "CvsProcessWidget::slotJobExited(bool, int) here!" << endl;
#ifdef MYDCOPDEBUG
    g_dcopExitCounter++;
    kdDebug(9006) << "MYDCOPDEBUG: dcopExitCounter == " << g_dcopExitCounter << endl;
#endif
    if (m_job)
    {
        disconnectDCOPSignal( m_job->app(), m_job->obj(), "jobExited(bool, int)", "slotJobExited(bool, int)" );
        disconnectDCOPSignal( m_job->app(), m_job->obj(), "receivedStdout(QString)", "slotReceivedOutput(QString)" );
        disconnectDCOPSignal( m_job->app(), m_job->obj(), "receivedStderr(QString)", "slotReceivedErrors(QString)" );
        delete m_job;
        m_job = 0;
    }
    QString exitMsg = i18n("Job finished with exitCode == %1");
    showInfo( exitMsg.arg( exitStatus) );

    m_part->core()->running( m_part, false );
    m_part->mainWindow()->statusBar()->message( i18n("Done CVS command ..."), 2000 );

    emit jobFinished( normalExit, exitStatus );
}