summaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-02-17 02:58:30 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-02-17 02:58:30 (GMT)
commit712fc0b65d19d03125b79fe5385ecd0e3a314f7e (patch)
tree217f515737a0081b27bf6772d6c4ab66ca64f530 /tools/qml
parentb82332fec19ee977eceaf2d533ee027020a474e0 (diff)
parentdee5662e0218e754d425c8960edb1e8ffd27fde6 (diff)
downloadQt-712fc0b65d19d03125b79fe5385ecd0e3a314f7e.zip
Qt-712fc0b65d19d03125b79fe5385ecd0e3a314f7e.tar.gz
Qt-712fc0b65d19d03125b79fe5385ecd0e3a314f7e.tar.bz2
Merge branch 'master' of ../qt-qml-staging
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/loggerwidget.cpp29
-rw-r--r--tools/qml/loggerwidget.h4
-rw-r--r--tools/qml/main.cpp57
-rw-r--r--tools/qml/qdeclarativetester.cpp5
-rw-r--r--tools/qml/qml.pri17
-rw-r--r--tools/qml/qml.pro11
-rw-r--r--tools/qml/qmlruntime.cpp13
7 files changed, 89 insertions, 47 deletions
diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp
index 4c21b34..3f2337a 100644
--- a/tools/qml/loggerwidget.cpp
+++ b/tools/qml/loggerwidget.cpp
@@ -45,6 +45,8 @@
#include <QActionGroup>
#include <QMenu>
#include <QPlainTextEdit>
+#include <QLabel>
+#include <QVBoxLayout>
#ifdef Q_WS_MAEMO_5
# include <QScrollArea>
# include <QVBoxLayout>
@@ -64,6 +66,19 @@ LoggerWidget::LoggerWidget(QWidget *parent) :
m_plainTextEdit = new QPlainTextEdit();
+#if defined(Q_OS_SYMBIAN)
+ QAction* clearAction = new QAction(tr("Clear"), this);
+ clearAction->setSoftKeyRole(QAction::PositiveSoftKey);
+ connect(clearAction, SIGNAL(triggered()), m_plainTextEdit, SLOT(clear()));
+ addAction(clearAction);
+
+ 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 +89,15 @@ LoggerWidget::LoggerWidget(QWidget *parent) :
#else
setCentralWidget(m_plainTextEdit);
#endif
+
+ m_noWarningsLabel = new QLabel(m_plainTextEdit);
+ m_noWarningsLabel->setText(tr("(No warnings)"));
+ m_noWarningsLabel->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(m_noWarningsLabel);
+ m_plainTextEdit->setLayout(layout);
+ connect(m_plainTextEdit, SIGNAL(textChanged()), this, SLOT(updateNoWarningsLabel()));
+
readSettings();
setupPreferencesMenu();
}
@@ -198,4 +222,9 @@ void LoggerWidget::setupPreferencesMenu()
}
}
+void LoggerWidget::updateNoWarningsLabel()
+{
+ m_noWarningsLabel->setVisible(m_plainTextEdit->toPlainText().length() == 0);
+}
+
QT_END_NAMESPACE
diff --git a/tools/qml/loggerwidget.h b/tools/qml/loggerwidget.h
index c677d11..a3e8871 100644
--- a/tools/qml/loggerwidget.h
+++ b/tools/qml/loggerwidget.h
@@ -48,6 +48,7 @@
QT_BEGIN_NAMESPACE
class QPlainTextEdit;
+class QLabel;
class QMenu;
class QAction;
@@ -66,6 +67,7 @@ public:
public slots:
void append(const QString &msg);
+ void updateNoWarningsLabel();
private slots:
void warningsPreferenceChanged(QAction *action);
@@ -86,7 +88,7 @@ private:
QMenu *m_preferencesMenu;
QAction *m_showWidgetAction;
QPlainTextEdit *m_plainTextEdit;
-
+ QLabel *m_noWarningsLabel;
enum ConfigOrigin { CommandLineOrigin, SettingsOrigin };
ConfigOrigin m_visibilityOrigin;
Visibility m_visibility;
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 67154dd..ce0a1bd 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -72,33 +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);
-
- 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)
{
@@ -115,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);
@@ -123,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
@@ -468,7 +462,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);
@@ -476,7 +469,6 @@ static QDeclarativeViewer *createViewer()
} else if (opts.warningsConfig == HideWarnings){
logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings);
}
-#endif
if (opts.experimentalGestures)
viewer->enableExperimentalGestures();
@@ -528,11 +520,7 @@ QDeclarativeViewer *openFile(const QString &fileName)
int main(int argc, char ** argv)
{
-#if defined (Q_OS_SYMBIAN)
- qInstallMsgHandler(myMessageOutput);
-#else
systemMsgOutput = qInstallMsgHandler(myMessageOutput);
-#endif
#if defined (Q_WS_X11) || defined (Q_WS_MAC)
//### default to using raster graphics backend for now
@@ -561,8 +549,11 @@ int main(int argc, char ** argv)
QTranslator qmlTranslator;
if (!opts.translationFile.isEmpty()) {
- qmlTranslator.load(opts.translationFile);
- app.installTranslator(&qmlTranslator);
+ if (qmlTranslator.load(opts.translationFile)) {
+ app.installTranslator(&qmlTranslator);
+ } else {
+ qWarning() << "Could not load the translation file" << opts.translationFile;
+ }
}
if (opts.fullScreen && opts.maximized)
diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp
index 3f4be57..11f81fc 100644
--- a/tools/qml/qdeclarativetester.cpp
+++ b/tools/qml/qdeclarativetester.cpp
@@ -48,7 +48,10 @@
#include <QDir>
#include <QCryptographicHash>
#include <private/qabstractanimation_p.h>
+#include <QGraphicsObject>
+#ifndef Q_OS_SYMBIAN
#include <private/qdeclarativeitem_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -266,7 +269,9 @@ void QDeclarativeTester::save()
void QDeclarativeTester::updateCurrentTime(int msec)
{
+#ifndef Q_OS_SYMBIAN
QDeclarativeItemPrivate::setConsistentTime(msec);
+#endif
if (!testscript && msec > 16 && options & QDeclarativeViewer::Snapshot)
return;
diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri
index 5db7678..08cd506 100644
--- a/tools/qml/qml.pri
+++ b/tools/qml/qml.pri
@@ -19,10 +19,18 @@ SOURCES += $$PWD/qmlruntime.cpp \
RESOURCES = $$PWD/browser/browser.qrc \
$$PWD/startup/startup.qrc
-symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
- SOURCES += $$PWD/deviceorientation_symbian.cpp
- FORMS = $$PWD/recopts.ui \
- $$PWD/proxysettings.ui
+symbian: {
+ contains(QT_CONFIG, s60): {
+ LIBS += -lavkon -lcone
+ }
+ !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
+ LIBS += -lsensrvclient -lsensrvutil
+ }
+ !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2): {
+ SOURCES += $$PWD/deviceorientation_symbian.cpp
+ FORMS = $$PWD/recopts.ui \
+ $$PWD/proxysettings.ui
+ }
} else:maemo5 {
QT += dbus
HEADERS += $$PWD/texteditautoresizer_maemo5.h
@@ -39,3 +47,4 @@ symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
FORMS = $$PWD/recopts.ui \
$$PWD/proxysettings.ui
}
+
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index bdac6e3..5d6192d 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -37,12 +37,11 @@ symbian {
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
TARGET.EPOCHEAPSIZE = 0x20000 0x4000000
TARGET.CAPABILITY = NetworkServices ReadUserData
- !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
- LIBS += -lsensrvclient -lsensrvutil
- }
- contains(QT_CONFIG, s60): {
- LIBS += -lavkon -lcone
- }
+
+ # Deploy plugin for remote debugging
+ qmldebuggingplugin.sources = $$QT_BUILD_TREE/plugins/qmldebugging/tcpserver$${QT_LIBINFIX}.dll
+ qmldebuggingplugin.path = c:$$QT_PLUGINS_BASE_DIR/qmldebugging
+ DEPLOYMENT += qmldebuggingplugin
}
mac {
QMAKE_INFO_PLIST=Info_mac.plist
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index 99c5b7a..36915d1 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -586,7 +586,6 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
}
connect(manager, SIGNAL(destroyed(QObject*)), this, SLOT(managerDestroyed(QObject*)));
namList.append(manager);
- qDebug() << "created new network access manager for" << parent;
return manager;
}
@@ -742,8 +741,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);
@@ -780,9 +781,11 @@ void QDeclarativeViewer::createMenu()
aboutAction->setMenuRole(QAction::AboutQtRole);
connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+#if !defined(Q_OS_SYMBIAN)
QAction *closeAction = new QAction(tr("&Close"), this);
closeAction->setShortcuts(QKeySequence::Close);
connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
+#endif
QAction *quitAction = new QAction(tr("&Quit"), this);
quitAction->setMenuRole(QAction::QuitRole);
@@ -818,19 +821,19 @@ void QDeclarativeViewer::createMenu()
fileMenu->addAction(openAction);
fileMenu->addAction(openUrlAction);
fileMenu->addAction(reloadAction);
+#if !defined(Q_OS_SYMBIAN)
fileMenu->addSeparator();
fileMenu->addAction(closeAction);
-#if !defined(Q_OS_SYMBIAN)
fileMenu->addAction(quitAction);
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 +917,11 @@ void QDeclarativeViewer::toggleFullScreen()
void QDeclarativeViewer::showWarnings(bool show)
{
+#if defined(Q_OS_SYMBIAN)
+ loggerWindow->showMaximized();
+#else
loggerWindow->setVisible(show);
+#endif
}
void QDeclarativeViewer::warningsWidgetOpened()