Mercurial > clickerconvert
diff 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 |
line wrap: on
line diff
--- a/src/main.cpp Mon Apr 11 10:59:08 2016 +0200 +++ b/src/main.cpp Mon Apr 11 11:00:40 2016 +0200 @@ -9,7 +9,7 @@ /** @file Main entry point for the application. * * This file is the wrapper around the qt application. - * Does command line parsing and preparation of the QCoreApplication. + * Does command line parsing and preparation of the QApplication. */ #include "constants.h" @@ -17,7 +17,7 @@ #include "converter.h" #include "cconvert_options.h" -#include <QCoreApplication> +#include <QApplication> #include <QCommandLineParser> #include <QtPlugin> #include <QDebug> @@ -97,11 +97,11 @@ * @returns 0 on success an error code otherwise. */ int realMain(int argc, char **argv) { - /* QCoreApplication setup */ - QCoreApplication app (argc, argv); - QCoreApplication::setOrganizationName(QStringLiteral(APPNAME)); - QCoreApplication::setApplicationName(QStringLiteral(APPNAME)); - QCoreApplication::setApplicationVersion(QStringLiteral(VERSION)); + /* QApplication setup */ + QApplication app (argc, argv); + QApplication::setOrganizationName(QStringLiteral(APPNAME)); + QApplication::setApplicationName(QStringLiteral(APPNAME)); + QApplication::setApplicationVersion(QStringLiteral(VERSION)); // QSettings::setDefaultFormat(QSettings::IniFormat); /* Setup translations */ @@ -130,10 +130,18 @@ } ConvertFormat fmt = Format_XLSX; - /* Initialize the converter. - if (parser.isSet(QStringLiteral("pdf"))) { + /* Initialize the converter. */ + const QString format = parser.value("format").toLower(); + if (format == "xlsx" || format.isEmpty()) { + fmt = Format_XLSX; + } else if (format == "html") { + fmt = Format_HTML; + } else if (format == "pdf") { fmt = Format_PDF; - }*/ + } else { + qCritical() << "Format: " << parser.value("format") << "not supported"; + exit(1); + } QString infile; if (args.size()) { infile = args.first();