Simplify image->raster conversion

This commit is contained in:
Anton Thomasson 2020-11-24 18:15:31 +01:00
parent bbddca04b3
commit 3f50416972

View file

@ -393,13 +393,6 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
} }
else else
{ // We are converting to a raster format { // We are converting to a raster format
QTemporaryFile tmpImage;
tmpImage.open();
qDebug() << "Raw image: " << tmpImage.fileName();
outImage.save(tmpImage.fileName(), Colors == 1 ? "pgm" : "ppm");
tmpImage.close();
QProcess* ppm2pwg = new QProcess(this); QProcess* ppm2pwg = new QProcess(this);
// Yo dawg, I heard you like programs... // Yo dawg, I heard you like programs...
ppm2pwg->setProgram("harbour-seaprint"); ppm2pwg->setProgram("harbour-seaprint");
@ -410,7 +403,6 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
qDebug() << "ppm2pwg env is " << env; qDebug() << "ppm2pwg env is " << env;
ppm2pwg->setEnvironment(env); ppm2pwg->setEnvironment(env);
ppm2pwg->setStandardInputFile(tmpImage.fileName());
ppm2pwg->setStandardOutputFile(tempfile->fileName(), QIODevice::Append); ppm2pwg->setStandardOutputFile(tempfile->fileName(), QIODevice::Append);
connect(ppm2pwg, SIGNAL(finished(int, QProcess::ExitStatus)), ppm2pwg, SLOT(deleteLater())); connect(ppm2pwg, SIGNAL(finished(int, QProcess::ExitStatus)), ppm2pwg, SLOT(deleteLater()));
@ -418,6 +410,8 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
qDebug() << "All connected"; qDebug() << "All connected";
ppm2pwg->start(); ppm2pwg->start();
outImage.save(ppm2pwg, Colors == 1 ? "pgm" : "ppm");
qDebug() << "Starting"; qDebug() << "Starting";
if(!ppm2pwg->waitForStarted()) if(!ppm2pwg->waitForStarted())