Mercurial > clickerconvert
comparison src/main.cpp @ 23:927794e3cc52
Add HTML output and some pdf support
PDF does not look well as the CSS used for HTML is not supported.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 11 Apr 2016 11:00:40 +0200 |
parents | 03dad1cff5b9 |
children | 5354cbda7188 |
comparison
equal
deleted
inserted
replaced
22:e8320104979d | 23:927794e3cc52 |
---|---|
7 */ | 7 */ |
8 | 8 |
9 /** @file Main entry point for the application. | 9 /** @file Main entry point for the application. |
10 * | 10 * |
11 * This file is the wrapper around the qt application. | 11 * This file is the wrapper around the qt application. |
12 * Does command line parsing and preparation of the QCoreApplication. | 12 * Does command line parsing and preparation of the QApplication. |
13 */ | 13 */ |
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 | 19 |
20 #include <QCoreApplication> | 20 #include <QApplication> |
21 #include <QCommandLineParser> | 21 #include <QCommandLineParser> |
22 #include <QtPlugin> | 22 #include <QtPlugin> |
23 #include <QDebug> | 23 #include <QDebug> |
24 #include <QTranslator> | 24 #include <QTranslator> |
25 #include <QSettings> | 25 #include <QSettings> |
95 * shall be UTF-8 | 95 * shall be UTF-8 |
96 * | 96 * |
97 * @returns 0 on success an error code otherwise. */ | 97 * @returns 0 on success an error code otherwise. */ |
98 int realMain(int argc, char **argv) | 98 int realMain(int argc, char **argv) |
99 { | 99 { |
100 /* QCoreApplication setup */ | 100 /* QApplication setup */ |
101 QCoreApplication app (argc, argv); | 101 QApplication app (argc, argv); |
102 QCoreApplication::setOrganizationName(QStringLiteral(APPNAME)); | 102 QApplication::setOrganizationName(QStringLiteral(APPNAME)); |
103 QCoreApplication::setApplicationName(QStringLiteral(APPNAME)); | 103 QApplication::setApplicationName(QStringLiteral(APPNAME)); |
104 QCoreApplication::setApplicationVersion(QStringLiteral(VERSION)); | 104 QApplication::setApplicationVersion(QStringLiteral(VERSION)); |
105 // QSettings::setDefaultFormat(QSettings::IniFormat); | 105 // QSettings::setDefaultFormat(QSettings::IniFormat); |
106 | 106 |
107 /* Setup translations */ | 107 /* Setup translations */ |
108 QTranslator translator; | 108 QTranslator translator; |
109 if (QLocale::system().name() == "C") { | 109 if (QLocale::system().name() == "C") { |
128 if (args.size() > 1) { | 128 if (args.size() > 1) { |
129 parser.showHelp(1); | 129 parser.showHelp(1); |
130 } | 130 } |
131 | 131 |
132 ConvertFormat fmt = Format_XLSX; | 132 ConvertFormat fmt = Format_XLSX; |
133 /* Initialize the converter. | 133 /* Initialize the converter. */ |
134 if (parser.isSet(QStringLiteral("pdf"))) { | 134 const QString format = parser.value("format").toLower(); |
135 if (format == "xlsx" || format.isEmpty()) { | |
136 fmt = Format_XLSX; | |
137 } else if (format == "html") { | |
138 fmt = Format_HTML; | |
139 } else if (format == "pdf") { | |
135 fmt = Format_PDF; | 140 fmt = Format_PDF; |
136 }*/ | 141 } else { |
142 qCritical() << "Format: " << parser.value("format") << "not supported"; | |
143 exit(1); | |
144 } | |
137 QString infile; | 145 QString infile; |
138 if (args.size()) { | 146 if (args.size()) { |
139 infile = args.first(); | 147 infile = args.first(); |
140 } | 148 } |
141 Converter conv(infile, parser.value("output"), fmt, | 149 Converter conv(infile, parser.value("output"), fmt, |