Mercurial > clickerconvert
changeset 52:263880612637
Set input file and handle windows encoding correctly.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 19 Jul 2016 17:45:10 +0200 (2016-07-19) |
parents | e9cc707838d1 |
children | a43d8cf2fa95 |
files | src/main.cpp |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main.cpp Tue Jul 19 17:44:17 2016 +0200 +++ b/src/main.cpp Tue Jul 19 17:45:10 2016 +0200 @@ -23,6 +23,7 @@ #include <QtPlugin> #include <QDebug> #include <QTranslator> +#include <QTextCodec> #include <QSettings> #include <QTimer> @@ -103,7 +104,7 @@ QApplication::setOrganizationName(QStringLiteral(APPNAME)); QApplication::setApplicationName(QStringLiteral(APPNAME)); QApplication::setApplicationVersion(QStringLiteral(VERSION)); -// QSettings::setDefaultFormat(QSettings::IniFormat); + QSettings::setDefaultFormat(QSettings::IniFormat); /* Setup translations */ QTranslator translator; @@ -119,7 +120,14 @@ QCommandLineParser parser; cconvert_options(parser); +#ifdef Q_OS_WIN + auto oldCodec = QTextCodec::codecForLocale(); + QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); +#endif parser.process(app); +#ifdef Q_OS_WIN + QTextCodec::setCodecForLocale(oldCodec); +#endif g_debug = parser.isSet("debug"); g_default_msg_handler = qInstallMessageHandler(filterDebugOutput); @@ -141,6 +149,7 @@ if (outputs.isEmpty() || title.isEmpty()) { mainWin = new MainWindow(); mainWin->setTitle(title); + mainWin->setInputFile(infile); mainWin->show(); app.exec(); delete mainWin;