Mercurial > clickerconvert > clickerconvert
annotate 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 |
rev | line source |
---|---|
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2016 by ETH Zürich |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 * |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=2) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 * See LICENSE.txt for details. |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 */ |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 /** @file Main entry point for the application. |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 * |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
11 * This file is the wrapper around the qt application. |
23
927794e3cc52
Add HTML output and some pdf support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
15
diff
changeset
|
12 * Does command line parsing and preparation of the QApplication. |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 */ |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 #include "constants.h" |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 #include "strhelp.h" |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 #include "converter.h" |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 #include "cconvert_options.h" |
50 | 19 #include "mainwindow.h" |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
20 |
23
927794e3cc52
Add HTML output and some pdf support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
15
diff
changeset
|
21 #include <QApplication> |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
22 #include <QCommandLineParser> |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
23 #include <QtPlugin> |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 #include <QDebug> |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 #include <QTranslator> |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 #include <QSettings> |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 #include <QTimer> |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 #ifdef Q_OS_WIN |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
30 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 #include <windows.h> |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 #include <shlobj.h> |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 #elif defined(Q_OS_MAC) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 #else |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 /* this is only necessary if we build statically for GNU/Linux */ |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 // Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 #endif |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
42 bool g_debug = false; |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
43 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
44 QtMessageHandler g_default_msg_handler = NULL; |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
45 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
46 void filterDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
47 { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
48 if (!g_debug && type == QtDebugMsg) { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
49 return; |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
50 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
51 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
52 if (g_default_msg_handler) { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
53 (*g_default_msg_handler)(type, context, msg); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
54 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
55 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
56 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
57 int realMain(int argc, char **argv); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
58 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
59 #if defined(WIN32) && defined(UNICODE) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
60 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
61 /** @brief Unicode entry point. |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
62 * |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
63 * Converts arguments to UTF-8 and executes the real |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
64 * entry point realMain. |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
65 */ |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
66 int wmain(int argc, wchar_t **argv, wchar_t **envp) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
67 { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
68 char **utf8args = NULL; |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
69 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
70 utf8args = (char**) xmalloc0 ((argc + 1) * sizeof(char*)); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
71 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
72 for (int i = 0; i < argc; i++) { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
73 utf8args[i] = wchar_to_utf8(argv[i], wcslen(argv[i])); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
74 if (utf8args[i] == NULL) { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
75 printf ("Fatal: could not convert arguments to UTF-8.\n"); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
76 exit(-1); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
77 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
78 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
79 int ret = realMain(argc, utf8args); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
80 strv_free(utf8args); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
81 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
82 return ret; |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
83 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
84 #else |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
85 int main(int argc, char **argv) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
86 { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
87 return realMain(argc, argv); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
88 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
89 #endif |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
90 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
91 /** @brief The real entry point to the application. |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
92 * |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
93 * @param [in] argc the count of the arguments. |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
94 * @param [in] argv On GNU/Linux this function expects argv to be in the |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
95 * native system encoding. On Windows the arguments |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
96 * shall be UTF-8 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
97 * |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
98 * @returns 0 on success an error code otherwise. */ |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
99 int realMain(int argc, char **argv) |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
100 { |
23
927794e3cc52
Add HTML output and some pdf support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
15
diff
changeset
|
101 /* QApplication setup */ |
927794e3cc52
Add HTML output and some pdf support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
15
diff
changeset
|
102 QApplication app (argc, argv); |
927794e3cc52
Add HTML output and some pdf support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
15
diff
changeset
|
103 QApplication::setOrganizationName(QStringLiteral(APPNAME)); |
927794e3cc52
Add HTML output and some pdf support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
15
diff
changeset
|
104 QApplication::setApplicationName(QStringLiteral(APPNAME)); |
927794e3cc52
Add HTML output and some pdf support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
15
diff
changeset
|
105 QApplication::setApplicationVersion(QStringLiteral(VERSION)); |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
106 // QSettings::setDefaultFormat(QSettings::IniFormat); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
107 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
108 /* Setup translations */ |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
109 QTranslator translator; |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
110 if (QLocale::system().name() == "C") { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
111 /* Useful for testing / development as the primary target is german */ |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
112 translator.load(":/l10n/main_de_DE"); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
113 } else { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
114 translator.load(":/l10n/main_" + QLocale::system().name()); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
115 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
116 app.installTranslator(&translator); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
117 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
118 /* Parse the command line */ |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
119 QCommandLineParser parser; |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
120 cconvert_options(parser); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
121 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
122 parser.process(app); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
123 |
4
5c256892042c
Always silence debug output by default
Andre Heinecke <andre.heinecke@intevation.de>
parents:
3
diff
changeset
|
124 g_debug = parser.isSet("debug"); |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
125 g_default_msg_handler = qInstallMessageHandler(filterDebugOutput); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
126 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
127 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
128 const QStringList args = parser.positionalArguments(); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
129 if (args.size() > 1) { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
130 parser.showHelp(1); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
131 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
132 |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
133 QString infile; |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
134 if (args.size()) { |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
135 infile = args.first(); |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
136 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
137 |
50 | 138 MainWindow *mainWin = Q_NULLPTR; |
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; | |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
147 } else { |
50 | 148 Converter conv(infile, parser.values("output"), |
149 parser.value("title")); | |
150 | |
151 conv.start(); | |
152 conv.wait(); | |
153 const QStringList errors = conv.errors(); | |
154 if (!errors.isEmpty()) { | |
155 Q_FOREACH (const QString err, errors) { | |
156 qCritical() << err; | |
157 } | |
158 return 1; | |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
159 } |
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
160 } |
50 | 161 return 0; |
3
8b4c49c92451
Add initial implementation that handles choices
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
162 } |