Commit 73a4d2d1 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove obsolete print/exportAsPdf command line options

(cherry picked from commit 0d5c5fe9)
parent 5d16be8b
......@@ -407,16 +407,12 @@ bool KisApplication::start(const KisApplicationArguments &args)
const bool doNewImage = args.doNewImage();
const bool doTemplate = args.doTemplate();
const bool print = args.print();
const bool exportAs = args.exportAs();
const bool exportAsPdf = args.exportAsPdf();
const QString exportFileName = args.exportFileName();
d->batchRun = (print || exportAs || exportAsPdf || !exportFileName.isEmpty());
// print & exportAsPdf do user interaction ATM
d->batchRun = (exportAs || !exportFileName.isEmpty());
const bool needsMainWindow = !exportAs;
// only show the mainWindow when no command-line mode option is passed
// TODO: fix print & exportAsPdf to work without mainwindow shown
bool showmainWindow = !exportAs; // would be !batchRun;
const bool showSplashScreen = !d->batchRun && qEnvironmentVariableIsEmpty("NOSPLASH");
......@@ -514,7 +510,7 @@ bool KisApplication::start(const KisApplicationArguments &args)
}
short int numberOfOpenDocuments = 0; // number of documents open
// Check for autosave files that can be restored, if we're not running a batchrun (test, print, export to pdf)
// Check for autosave files that can be restored, if we're not running a batchrun (test)
if (!d->batchRun) {
checkAutosaveFiles();
}
......@@ -541,7 +537,6 @@ bool KisApplication::start(const KisApplicationArguments &args)
int argsCount = args.filenames().count();
if (argsCount > 0) {
// Loop through arguments
short int nPrinted = 0;
for (int argNumber = 0; argNumber < argsCount; argNumber++) {
QString fileName = args.filenames().at(argNumber);
// are we just trying to open a template?
......@@ -573,27 +568,13 @@ bool KisApplication::start(const KisApplicationArguments &args)
if (!doc->exportDocumentSync(QUrl::fromLocalFile(exportFileName), outputMimetype.toLatin1())) {
dbgKrita << "Could not export " << fileName << "to" << exportFileName << ":" << doc->errorMessage();
}
nPrinted++;
QTimer::singleShot(0, this, SLOT(quit()));
}
else if (d->mainWindow) {
KisMainWindow::OpenFlags flags = d->batchRun ? KisMainWindow::BatchMode : KisMainWindow::None;
if (d->mainWindow->openDocument(QUrl::fromLocalFile(fileName), flags)) {
if (print) {
d->mainWindow->slotFilePrint();
nPrinted++;
// TODO: trigger closing of app once printing is done
}
else if (exportAsPdf) {
KisPrintJob *job = d->mainWindow->exportToPdf(exportFileName);
if (job)
connect (job, SIGNAL(destroyed(QObject*)), d->mainWindow,
SLOT(slotFileQuit()), Qt::QueuedConnection);
nPrinted++;
} else {
// Normal case, success
numberOfOpenDocuments++;
}
// Normal case, success
numberOfOpenDocuments++;
} else {
// .... if failed
// delete doc; done by openDocument
......@@ -601,10 +582,6 @@ bool KisApplication::start(const KisApplicationArguments &args)
}
}
}
if (d->batchRun) {
return nPrinted > 0;
}
}
// fixes BUG:369308 - Krita crashing on splash screen when loading.
......
......@@ -42,9 +42,7 @@ struct Q_DECL_HIDDEN KisApplicationArguments::Private
int dpiX {72};
int dpiY {72};
bool doTemplate {false};
bool print {false};
bool exportAs {false};
bool exportAsPdf {false};
QString exportFileName;
QString workspace;
QString windowLayout;
......@@ -77,7 +75,6 @@ KisApplicationArguments::KisApplicationArguments(const QApplication &app)
QCommandLineParser parser;
parser.addVersionOption();
parser.addHelpOption();
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("print"), i18n("Only print and exit")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("template"), i18n("Open a new document with a template")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("new-image"), i18n("Create a new image on startup.\n"
"Possible colorspace values are:\n"
......@@ -100,9 +97,8 @@ KisApplicationArguments::KisApplicationArguments(const QApplication &app)
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("nosplash"), i18n("Do not show the splash screen")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("fullscreen"), i18n("Start Krita in full-screen mode")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("dpi"), i18n("Override display DPI"), QLatin1String("dpiX,dpiY")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("export-pdf"), i18n("Only export to PDF and exit")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("export"), i18n("Export to the given filename and exit")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("export-filename"), i18n("Filename for export/export-pdf"), QLatin1String("filename")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("export-filename"), i18n("Filename for export"), QLatin1String("filename")));
parser.addPositionalArgument(QLatin1String("[file(s)]"), i18n("File(s) or URL(s) to open"));
parser.process(app);
......@@ -143,9 +139,7 @@ KisApplicationArguments::KisApplicationArguments(const QApplication &app)
d->windowLayout = parser.value("windowlayout");
d->session = parser.value("load-session");
d->doTemplate = parser.isSet("template");
d->print = parser.isSet("print");
d->exportAs = parser.isSet("export");
d->exportAsPdf = parser.isSet("export-pdf");
d->canvasOnly = parser.isSet("canvasonly");
d->noSplash = parser.isSet("nosplash");
d->fullScreen = parser.isSet("fullscreen");
......@@ -163,9 +157,7 @@ KisApplicationArguments::KisApplicationArguments(const KisApplicationArguments &
d->dpiX = rhs.dpiX();
d->dpiY = rhs.dpiY();
d->doTemplate = rhs.doTemplate();
d->print = rhs.print();
d->exportAs = rhs.exportAs();
d->exportAsPdf = rhs.exportAsPdf();
d->exportFileName = rhs.exportFileName();
d->canvasOnly = rhs.canvasOnly();
d->workspace = rhs.workspace();
......@@ -181,9 +173,7 @@ void KisApplicationArguments::operator=(const KisApplicationArguments &rhs)
d->dpiX = rhs.dpiX();
d->dpiY = rhs.dpiY();
d->doTemplate = rhs.doTemplate();
d->print = rhs.print();
d->exportAs = rhs.exportAs();
d->exportAsPdf = rhs.exportAsPdf();
d->exportFileName = rhs.exportFileName();
d->canvasOnly = rhs.canvasOnly();
d->workspace = rhs.workspace();
......@@ -207,9 +197,7 @@ QByteArray KisApplicationArguments::serialize()
ds << d->dpiX;
ds << d->dpiY;
ds << d->doTemplate;
ds << d->print;
ds << d->exportAs;
ds << d->exportAsPdf;
ds << d->exportFileName;
ds << d->workspace;
ds << d->windowLayout;
......@@ -249,9 +237,7 @@ KisApplicationArguments KisApplicationArguments::deserialize(QByteArray &seriali
ds >> args.d->dpiX;
ds >> args.d->dpiY;
ds >> args.d->doTemplate;
ds >> args.d->print;
ds >> args.d->exportAs;
ds >> args.d->exportAsPdf;
ds >> args.d->exportFileName;
ds >> args.d->workspace;
ds >> args.d->windowLayout;
......@@ -291,21 +277,11 @@ bool KisApplicationArguments::doTemplate() const
return d->doTemplate;
}
bool KisApplicationArguments::print() const
{
return d->print;
}
bool KisApplicationArguments::exportAs() const
{
return d->exportAs;
}
bool KisApplicationArguments::exportAsPdf() const
{
return d->exportAsPdf;
}
QString KisApplicationArguments::exportFileName() const
{
return d->exportFileName;
......
......@@ -45,9 +45,7 @@ public:
int dpiX() const;
int dpiY() const;
bool doTemplate() const;
bool print() const;
bool exportAs() const;
bool exportAsPdf() const;
QString exportFileName() const;
QString workspace() const;
QString windowLayout() const;
......@@ -58,7 +56,6 @@ public:
bool doNewImage() const;
KisDocument *image() const;
private:
KisApplicationArguments();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment