summaryrefslogtreecommitdiffstats
path: root/tools/qml/qmlruntime.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/qmlruntime.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/qmlruntime.cpp')
-rw-r--r--tools/qml/qmlruntime.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index da31284..1229df2 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -462,10 +462,13 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
#else
: QWidget(parent, flags)
#endif
+ , loggerWindow(new LoggerWidget())
, frame_stream(0), scaleSkin(true), mb(0)
, portraitOrientation(0), landscapeOrientation(0)
- , m_scriptOptions(0), tester(0), useQmlFileBrowser(true)
- , translator(0)
+ , showWarningsWindow(0)
+ , m_scriptOptions(0)
+ , tester(0)
+ , useQmlFileBrowser(true)
{
QDeclarativeViewer::registerTypes();
setWindowTitle(tr("Qt Qml Runtime"));
@@ -506,6 +509,9 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged()));
QObject::connect(canvas->engine(), SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit()));
+ QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened()));
+ QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed()));
+
if (!(flags & Qt::FramelessWindowHint)) {
createMenu(menuBar(),0);
setPortrait();
@@ -565,6 +571,11 @@ QDeclarativeView *QDeclarativeViewer::view() const
return canvas;
}
+LoggerWidget *QDeclarativeViewer::warningsWidget() const
+{
+ return loggerWindow;
+}
+
void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu)
{
QObject *parent = flatmenu ? (QObject*)flatmenu : (QObject*)menu;
@@ -616,6 +627,15 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu)
connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool)));
debugMenu->addAction(slowAction);
+ showWarningsWindow = new QAction(tr("Show Warnings"), parent);
+ showWarningsWindow->setCheckable((true));
+ showWarningsWindow->setChecked(loggerWindow->isVisible());
+ connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool)));
+
+#if !defined(Q_OS_SYMBIAN)
+ debugMenu->addAction(showWarningsWindow);
+#endif
+
if (flatmenu) flatmenu->addSeparator();
QMenu *skinMenu = flatmenu ? flatmenu->addMenu(tr("&Skin")) : menu->addMenu(tr("&Skin"));
@@ -672,6 +692,8 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu)
#if !defined(Q_OS_SYMBIAN)
if (!flatmenu)
settingsMenu->addAction(recordOptions);
+
+ settingsMenu->addMenu(loggerWindow->preferencesMenu());
#else
QAction *fullscreenAction = new QAction(tr("Full Screen"), parent);
fullscreenAction->setCheckable(true);
@@ -679,7 +701,10 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu)
settingsMenu->addAction(fullscreenAction);
#endif
+ if (flatmenu) flatmenu->addSeparator();
+
QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
+
QActionGroup *orientation = new QActionGroup(parent);
QAction *toggleOrientation = new QAction(tr("&Toggle Orientation"), parent);
@@ -758,6 +783,21 @@ void QDeclarativeViewer::toggleFullScreen()
showFullScreen();
}
+void QDeclarativeViewer::showWarnings(bool show)
+{
+ loggerWindow->setVisible(show);
+}
+
+void QDeclarativeViewer::warningsWidgetOpened()
+{
+ showWarningsWindow->setChecked(true);
+}
+
+void QDeclarativeViewer::warningsWidgetClosed()
+{
+ showWarningsWindow->setChecked(false);
+}
+
void QDeclarativeViewer::setScaleSkin()
{
if (scaleSkin)