Hide saving to ps and eps format if don't installed pdftops.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-23 14:09:19 +03:00
parent af62578652
commit 3e96256b79

View file

@ -33,6 +33,12 @@
#include <QPrinter> #include <QPrinter>
#include "widgets/vapplication.h" #include "widgets/vapplication.h"
#ifdef Q_OS_WIN
# define PDFTOPS "pdftops.exe"
#else
# define PDFTOPS "pdftops"
#endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief TableWindow constructor. * @brief TableWindow constructor.
@ -220,8 +226,18 @@ void TableWindow::saveScene()
extByMessage[ tr("Svg files (*.svg)") ] = ".svg"; extByMessage[ tr("Svg files (*.svg)") ] = ".svg";
extByMessage[ tr("PDF files (*.pdf)") ] = ".pdf"; extByMessage[ tr("PDF files (*.pdf)") ] = ".pdf";
extByMessage[ tr("Images (*.png)") ] = ".png"; extByMessage[ tr("Images (*.png)") ] = ".png";
QProcess proc;
proc.start(PDFTOPS);
if (proc.waitForFinished(15000))
{
extByMessage[ tr("PS files (*.ps)") ] = ".ps"; extByMessage[ tr("PS files (*.ps)") ] = ".ps";
extByMessage[ tr("EPS files (*.eps)") ] = ".eps"; extByMessage[ tr("EPS files (*.eps)") ] = ".eps";
}
else
{
qWarning()<<PDFTOPS<<"error"<<proc.error()<<proc.errorString();
}
QString saveMessage; QString saveMessage;
QMapIterator<QString, QString> i(extByMessage); QMapIterator<QString, QString> i(extByMessage);
@ -282,7 +298,7 @@ void TableWindow::saveScene()
PsFile(name); PsFile(name);
break; break;
default: default:
qDebug() << "Bad file suffix. File name is "<<name<<Q_FUNC_INFO; qDebug() << "Can't recognize file suffix. File file "<<name<<Q_FUNC_INFO;
break; break;
} }
paper->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); paper->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
@ -621,11 +637,7 @@ void TableWindow::PdfToPs(const QStringList &params) const
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
#endif #endif
QProcess proc; QProcess proc;
#ifdef Q_OS_WIN proc.start(PDFTOPS, params);
proc.start("pdftops.exe", params);
#else
proc.start("pdftops", params);
#endif
proc.waitForFinished(15000); proc.waitForFinished(15000);
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();