App: centralize conversion from local8Bit

Change-Id: I8def56fa3b613ba32dad69a2997b190fa76cab3c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2018-06-06 10:38:06 +02:00
parent 93d35399b5
commit af59639826

View File

@@ -354,16 +354,17 @@ Options parseCommandLine(int argc, char *argv[])
while (it != end) { while (it != end) {
const auto arg = QString::fromLocal8Bit(*it); const auto arg = QString::fromLocal8Bit(*it);
const bool hasNext = it + 1 != end; const bool hasNext = it + 1 != end;
const auto nextArg = hasNext ? QString::fromLocal8Bit(*(it + 1)) : QString();
if (arg == SETTINGS_OPTION && hasNext) { if (arg == SETTINGS_OPTION && hasNext) {
++it; ++it;
options.settingsPath = QDir::fromNativeSeparators(QString::fromLocal8Bit(*it)); options.settingsPath = QDir::fromNativeSeparators(nextArg);
} else if (arg == INSTALL_SETTINGS_OPTION && hasNext) { } else if (arg == INSTALL_SETTINGS_OPTION && hasNext) {
++it; ++it;
options.installSettingsPath = QDir::fromNativeSeparators(QString::fromLocal8Bit(*it)); options.installSettingsPath = QDir::fromNativeSeparators(nextArg);
} else if (arg == PLUGINPATH_OPTION && hasNext) { } else if (arg == PLUGINPATH_OPTION && hasNext) {
++it; ++it;
options.customPluginPaths += QDir::fromNativeSeparators(QString::fromLocal8Bit(*it)); options.customPluginPaths += QDir::fromNativeSeparators(nextArg);
} else { // arguments that are still passed on to the application } else { // arguments that are still passed on to the application
if (arg == TEST_OPTION) if (arg == TEST_OPTION)
options.hasTestOption = true; options.hasTestOption = true;