comparison 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
comparison
equal deleted inserted replaced
49:a849b1de248f 50:36ee5dd46fd3
14 #include "constants.h" 14 #include "constants.h"
15 15
16 #include "strhelp.h" 16 #include "strhelp.h"
17 #include "converter.h" 17 #include "converter.h"
18 #include "cconvert_options.h" 18 #include "cconvert_options.h"
19 #include "mainwindow.h"
19 20
20 #include <QApplication> 21 #include <QApplication>
21 #include <QCommandLineParser> 22 #include <QCommandLineParser>
22 #include <QtPlugin> 23 #include <QtPlugin>
23 #include <QDebug> 24 #include <QDebug>
131 132
132 QString infile; 133 QString infile;
133 if (args.size()) { 134 if (args.size()) {
134 infile = args.first(); 135 infile = args.first();
135 } 136 }
136 Converter conv(infile, parser.values("output"),
137 parser.value("title"));
138 137
139 conv.start(); 138 MainWindow *mainWin = Q_NULLPTR;
140 conv.wait(); 139 const QStringList outputs = parser.values("output");
140 const QString title = parser.value("title");
141 if (outputs.isEmpty() || title.isEmpty()) {
142 mainWin = new MainWindow();
143 mainWin->setTitle(title);
144 mainWin->show();
145 app.exec();
146 delete mainWin;
147 } else {
148 Converter conv(infile, parser.values("output"),
149 parser.value("title"));
141 150
142 const QStringList errors = conv.errors(); 151 conv.start();
143 if (errors.isEmpty()) { 152 conv.wait();
144 return 0; 153 const QStringList errors = conv.errors();
145 } else { 154 if (!errors.isEmpty()) {
146 Q_FOREACH (const QString err, errors) { 155 Q_FOREACH (const QString err, errors) {
147 qCritical() << err; 156 qCritical() << err;
157 }
158 return 1;
148 } 159 }
149 } 160 }
150 return 1; 161 return 0;
151 } 162 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)