summaryrefslogtreecommitdiffstats
path: root/tools/qml/main.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2010-04-23 15:22:16 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2010-05-05 13:29:07 (GMT)
commitd340dc6e4b3f1f4f8737d0d1d34e76ae68e007d6 (patch)
tree26572c3d6e80022da7be812875fdc1a1f0ff3695 /tools/qml/main.cpp
parent39e992988f21553df7e839f36ced75ca5bf8588c (diff)
downloadQt-d340dc6e4b3f1f4f8737d0d1d34e76ae68e007d6.zip
Qt-d340dc6e4b3f1f4f8737d0d1d34e76ae68e007d6.tar.gz
Qt-d340dc6e4b3f1f4f8737d0d1d34e76ae68e007d6.tar.bz2
Add a switch to the menu to hide/show the runtime warnings
Reviewed-by: mae
Diffstat (limited to 'tools/qml/main.cpp')
-rw-r--r--tools/qml/main.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index f2c0530..78f0c87 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -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(" -warnings ................................ show warnings in a separate 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)
@@ -230,7 +232,7 @@ int main(int argc, char ** argv)
bool maximized = false;
bool useNativeFileBrowser = true;
- bool showLogWidget = false;
+ WarningsConfig warningsConfig = DefaultWarnings;
bool sizeToView = true;
#if defined(Q_OS_SYMBIAN)
@@ -292,7 +294,15 @@ int main(int argc, char ** argv)
} else if (arg == "-qmlbrowser") {
useNativeFileBrowser = false;
} else if (arg == "-warnings") {
- showLogWidget = true;
+ 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");
@@ -341,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 =
@@ -390,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);