Mercurial > clickerconvert
diff src/main.cpp @ 50:36ee5dd46fd3
Add GUI
New Mainwindow that allows to set output formats and input
files through a GUI.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 19 Jul 2016 12:19:45 +0200 |
parents | 5354cbda7188 |
children | 263880612637 |
line wrap: on
line diff
--- a/src/main.cpp Tue Jul 19 12:18:57 2016 +0200 +++ b/src/main.cpp Tue Jul 19 12:19:45 2016 +0200 @@ -16,6 +16,7 @@ #include "strhelp.h" #include "converter.h" #include "cconvert_options.h" +#include "mainwindow.h" #include <QApplication> #include <QCommandLineParser> @@ -133,19 +134,29 @@ if (args.size()) { infile = args.first(); } - Converter conv(infile, parser.values("output"), - parser.value("title")); - - conv.start(); - conv.wait(); - const QStringList errors = conv.errors(); - if (errors.isEmpty()) { - return 0; + MainWindow *mainWin = Q_NULLPTR; + const QStringList outputs = parser.values("output"); + const QString title = parser.value("title"); + if (outputs.isEmpty() || title.isEmpty()) { + mainWin = new MainWindow(); + mainWin->setTitle(title); + mainWin->show(); + app.exec(); + delete mainWin; } else { - Q_FOREACH (const QString err, errors) { - qCritical() << err; + Converter conv(infile, parser.values("output"), + parser.value("title")); + + conv.start(); + conv.wait(); + const QStringList errors = conv.errors(); + if (!errors.isEmpty()) { + Q_FOREACH (const QString err, errors) { + qCritical() << err; + } + return 1; } } - return 1; + return 0; }