summaryrefslogtreecommitdiffstats
path: root/tools/qml/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qml/main.cpp')
-rw-r--r--tools/qml/main.cpp38
1 files changed, 26 insertions, 12 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 9ccc3d2..fb687ac 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -54,7 +54,7 @@
QT_USE_NAMESPACE
-QtMsgHandler systemMsgOutput;
+QtMsgHandler systemMsgOutput = 0;
#if defined (Q_OS_SYMBIAN)
#include <unistd.h>
@@ -125,7 +125,7 @@ void usage()
qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content");
qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view");
qWarning(" -qmlbrowser .............................. use a QML-based file browser");
- qWarning(" -nolog ................................... do not show log window");
+ qWarning(" -warnings [show|hide]..................... show warnings in a separate log window");
qWarning(" -recordfile <output> ..................... set video recording file");
qWarning(" - ImageMagick 'convert' for GIF)");
qWarning(" - png file for raw frames");
@@ -168,6 +168,8 @@ void scriptOptsUsage()
exit(1);
}
+enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings };
+
int main(int argc, char ** argv)
{
#if defined (Q_OS_SYMBIAN)
@@ -229,7 +231,8 @@ int main(int argc, char ** argv)
bool stayOnTop = false;
bool maximized = false;
bool useNativeFileBrowser = true;
- bool showLogWidget = true;
+
+ WarningsConfig warningsConfig = DefaultWarnings;
bool sizeToView = true;
#if defined(Q_OS_SYMBIAN)
@@ -290,8 +293,16 @@ int main(int argc, char ** argv)
useGL = true;
} else if (arg == "-qmlbrowser") {
useNativeFileBrowser = false;
- } else if (arg == "-nolog") {
- showLogWidget = false;
+ } else if (arg == "-warnings") {
+ if (lastArg) usage();
+ QString warningsStr = QString(argv[++i]);
+ if (warningsStr == QLatin1String("show")) {
+ warningsConfig = ShowWarnings;
+ } else if (warningsStr == QLatin1String("hide")) {
+ warningsConfig = HideWarnings;
+ } else {
+ usage();
+ }
} else if (arg == "-I" || arg == "-L") {
if (arg == "-L")
qWarning("-L option provided for compatibility only, use -I instead");
@@ -340,13 +351,6 @@ int main(int argc, char ** argv)
if (stayOnTop)
wflags |= Qt::WindowStaysOnTopHint;
-#if !defined(Q_OS_SYMBIAN)
- LoggerWidget loggerWidget(0);
- if (showLogWidget) {
- logger = &loggerWidget;
- }
-#endif
-
QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags);
if (!scriptopts.isEmpty()) {
QStringList options =
@@ -389,6 +393,16 @@ int main(int argc, char ** argv)
usage();
}
+#if !defined(Q_OS_SYMBIAN)
+ logger = viewer->warningsWidget();
+ if (warningsConfig == ShowWarnings) {
+ logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings);
+ logger.data()->show();
+ } else if (warningsConfig == HideWarnings){
+ logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings);
+ }
+#endif
+
foreach (QString lib, imports)
viewer->addLibraryPath(lib);