Add calligraconverter to convertchecker

This commit is contained in:
Anton Thomasson 2021-03-05 22:22:43 +01:00
parent 22c823563b
commit 9efbb6d6f0
2 changed files with 19 additions and 0 deletions

View file

@ -9,6 +9,12 @@ ConvertChecker::ConvertChecker()
pdftoppm->setProgram("pdftoppm");
pdftoppm->setArguments({"-h"});
pdftoppm->start();
QProcess* calligraconverter = new QProcess(this);
calligraconverter->setProgram("calligraconverter");
calligraconverter->setArguments({"-h"});
calligraconverter->start();
if(pdftoppm->waitForFinished(2000))
{
if(pdftoppm->exitStatus() == QProcess::NormalExit && pdftoppm->exitCode() == 0)
@ -16,6 +22,17 @@ ConvertChecker::ConvertChecker()
_pdf = true;
}
}
if(calligraconverter->waitForFinished(2000))
{
if(calligraconverter->exitStatus() == QProcess::NormalExit && pdftoppm->exitCode() == 0)
{
_calligra = true;
}
}
pdftoppm->deleteLater();
calligraconverter->deleteLater();
}
ConvertChecker::~ConvertChecker() {

View file

@ -9,6 +9,7 @@ class ConvertChecker : public QObject
public:
static ConvertChecker* instance();
Q_PROPERTY(bool pdf MEMBER _pdf)
Q_PROPERTY(bool calligra MEMBER _calligra)
Q_INVOKABLE quint32 pdfPages(QString pdf);
@ -23,6 +24,7 @@ private:
ConvertChecker& operator=(const ConvertChecker &);
bool _pdf;
bool _calligra;
};
#endif // CONVERTCHECKER_H