summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2010-12-31 05:49:48 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2010-12-31 05:53:07 (GMT)
commit59ec08d255b7d7bd8975bdbfd0b0a42c1b6ed2a0 (patch)
tree133670e39189e1f1256bc219385f370fb9950072 /tools
parente8b736c44426fd4ae832e82a9e624c9737a40213 (diff)
downloadQt-59ec08d255b7d7bd8975bdbfd0b0a42c1b6ed2a0.zip
Qt-59ec08d255b7d7bd8975bdbfd0b0a42c1b6ed2a0.tar.gz
Qt-59ec08d255b7d7bd8975bdbfd0b0a42c1b6ed2a0.tar.bz2
Provide qmlviewer warning window also on Symbian
Task-number: QTBUG-10800 Reviewed-by: Christopher Ham
Diffstat (limited to 'tools')
-rw-r--r--tools/qml/loggerwidget.cpp9
-rw-r--r--tools/qml/main.cpp49
-rw-r--r--tools/qml/qmlruntime.cpp8
3 files changed, 35 insertions, 31 deletions
diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp
index 8aa029f..f601d95 100644
--- a/tools/qml/loggerwidget.cpp
+++ b/tools/qml/loggerwidget.cpp
@@ -64,6 +64,14 @@ LoggerWidget::LoggerWidget(QWidget *parent) :
m_plainTextEdit = new QPlainTextEdit();
+#if defined(Q_OS_SYMBIAN)
+ m_plainTextEdit->setReadOnly(true);
+ QAction* backAction = new QAction( tr("Back"), this );
+ backAction->setSoftKeyRole( QAction::NegativeSoftKey );
+ connect(backAction, SIGNAL(triggered()), this, SLOT(hide()));
+ addAction( backAction );
+#endif
+
#ifdef Q_WS_MAEMO_5
new TextEditAutoResizer(m_plainTextEdit);
setAttribute(Qt::WA_Maemo5StackedWindow);
@@ -74,6 +82,7 @@ LoggerWidget::LoggerWidget(QWidget *parent) :
#else
setCentralWidget(m_plainTextEdit);
#endif
+
readSettings();
setupPreferencesMenu();
}
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 2df96c0..b5a4fd0 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -72,36 +72,15 @@ void exitApp(int i)
exit(i);
}
+QWeakPointer<LoggerWidget> logger;
+static QAtomicInt recursiveLock(0);
+
#if defined (Q_OS_SYMBIAN)
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-
-void myMessageOutput(QtMsgType type, const char *msg)
-{
- static int fd = -1;
- if (fd == -1)
- fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT);
-
- ::write(fd, msg, strlen(msg));
- ::write(fd, "\n", 1);
- ::fsync(fd);
-
- if (systemMsgOutput)
- systemMsgOutput(type, msg);
-
- switch (type) {
- case QtFatalMsg:
- abort();
- }
-}
-
-#else // !defined (Q_OS_SYMBIAN)
-
-QWeakPointer<LoggerWidget> logger;
-
-static QAtomicInt recursiveLock(0);
+#endif
void myMessageOutput(QtMsgType type, const char *msg)
{
@@ -118,7 +97,21 @@ void myMessageOutput(QtMsgType type, const char *msg)
warnings += QLatin1Char('\n');
}
}
- if (systemMsgOutput) { // Windows
+#if defined (Q_OS_SYMBIAN)
+ static int fd = -1;
+ if (fd == -1)
+ fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT);
+
+ ::write(fd, msg, strlen(msg));
+ ::write(fd, "\n", 1);
+ ::fsync(fd);
+ switch (type) {
+ case QtFatalMsg:
+ abort();
+ }
+#endif
+
+ if (systemMsgOutput) {
systemMsgOutput(type, msg);
} else { // Unix
fprintf(stderr, "%s\n", msg);
@@ -126,8 +119,6 @@ void myMessageOutput(QtMsgType type, const char *msg)
}
}
-#endif
-
static QDeclarativeViewer* globalViewer = 0;
// The qml file that is shown if the user didn't specify a QML file
@@ -472,7 +463,6 @@ static QDeclarativeViewer *createViewer()
viewer->setScript(opts.script);
}
-#if !defined(Q_OS_SYMBIAN)
logger = viewer->warningsWidget();
if (opts.warningsConfig == ShowWarnings) {
logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings);
@@ -480,7 +470,6 @@ static QDeclarativeViewer *createViewer()
} else if (opts.warningsConfig == HideWarnings){
logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings);
}
-#endif
if (opts.experimentalGestures)
viewer->enableExperimentalGestures();
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index 142e4c5..b829528 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -742,8 +742,10 @@ void QDeclarativeViewer::createMenu()
connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool)));
showWarningsWindow = new QAction(tr("Show Warnings"), this);
+#if !defined(Q_OS_SYMBIAN)
showWarningsWindow->setCheckable((true));
showWarningsWindow->setChecked(loggerWindow->isVisible());
+#endif
connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool)));
QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
@@ -826,11 +828,11 @@ void QDeclarativeViewer::createMenu()
QMenu *recordMenu = menu->addMenu(tr("&Recording"));
recordMenu->addAction(snapshotAction);
recordMenu->addAction(recordAction);
+#endif // ! Q_OS_SYMBIAN
QMenu *debugMenu = menu->addMenu(tr("&Debugging"));
debugMenu->addAction(slowAction);
debugMenu->addAction(showWarningsWindow);
-#endif // ! Q_OS_SYMBIAN
QMenu *settingsMenu = menu->addMenu(tr("&Settings"));
settingsMenu->addAction(proxyAction);
@@ -914,7 +916,11 @@ void QDeclarativeViewer::toggleFullScreen()
void QDeclarativeViewer::showWarnings(bool show)
{
+#if defined(Q_OS_SYMBIAN)
+ loggerWindow->showMaximized();
+#else
loggerWindow->setVisible(show);
+#endif
}
void QDeclarativeViewer::warningsWidgetOpened()