summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sdk/constants.h10
-rw-r--r--src/sdk/main.cpp16
2 files changed, 19 insertions, 7 deletions
diff --git a/src/sdk/constants.h b/src/sdk/constants.h
index f1b1ba14c..1966983a0 100644
--- a/src/sdk/constants.h
+++ b/src/sdk/constants.h
@@ -29,6 +29,8 @@
#ifndef CONSTANTS_H
#define CONSTANTS_H
+#include <QtCore/QStringList>
+
namespace CommandLineOptions {
const char HelpShort[] = "h";
@@ -63,6 +65,14 @@ const char TargetDir[] = "targetDir";
const char Platform[] = "platform";
const char SquishPort[] = "squish-port";
+static const QStringList scCommandLineInterfaceOptions = {
+ QLatin1String(ListInstalledPackages),
+ QLatin1String(ListPackages),
+ QLatin1String(UpdatePackages),
+ QLatin1String(InstallPackages),
+ QLatin1String(InstallDefault)
+};
+
} // namespace CommandLineOptions
#endif // CONSTANTS_H
diff --git a/src/sdk/main.cpp b/src/sdk/main.cpp
index 26794c7ea..1edfc1233 100644
--- a/src/sdk/main.cpp
+++ b/src/sdk/main.cpp
@@ -185,16 +185,18 @@ int main(int argc, char *argv[])
try {
QScopedPointer<Console> console;
+
// Check if any options requiring verbose output is set
- if (parser.isSet(QLatin1String(CommandLineOptions::VerboseShort))
- || parser.isSet(QLatin1String(CommandLineOptions::VerboseLong))
- || parser.isSet(QLatin1String(CommandLineOptions::ListInstalledPackages))
- || parser.isSet(QLatin1String(CommandLineOptions::ListPackages))
- || parser.isSet(QLatin1String(CommandLineOptions::UpdatePackages))
- || parser.isSet(QLatin1String(CommandLineOptions::InstallPackages))
- || parser.isSet(QLatin1String(CommandLineOptions::InstallDefault))) {
+ bool setVerbose = parser.isSet(QLatin1String(CommandLineOptions::VerboseShort))
+ || parser.isSet(QLatin1String(CommandLineOptions::VerboseLong));
+
+ foreach (const QString &option, CommandLineOptions::scCommandLineInterfaceOptions) {
+ if (setVerbose) {
console.reset(new Console);
QInstaller::setVerbose(true);
+ break;
+ }
+ setVerbose = parser.isSet(option);
}
// On Windows we need the console window from above, we are a GUI application.