diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2011-03-01 09:40:06 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-03-01 09:40:06 (GMT) |
commit | 48cd01714e3aa76872983cae820cfc1c7504b065 (patch) | |
tree | 0d7cf0938619e845599fe2eb65f21e7999b66c50 /tools/qml | |
parent | 4d803a3493d15fdf7374689b774d02662dbd43b3 (diff) | |
parent | 54869c8727e5403cea866c99a5f83ae9c8533f82 (diff) | |
download | Qt-48cd01714e3aa76872983cae820cfc1c7504b065.zip Qt-48cd01714e3aa76872983cae820cfc1c7504b065.tar.gz Qt-48cd01714e3aa76872983cae820cfc1c7504b065.tar.bz2 |
Merge remote-tracking branch 'origin/master' into lighthouse-master
Diffstat (limited to 'tools/qml')
-rw-r--r-- | tools/qml/loggerwidget.cpp | 29 | ||||
-rw-r--r-- | tools/qml/loggerwidget.h | 4 | ||||
-rw-r--r-- | tools/qml/main.cpp | 57 | ||||
-rw-r--r-- | tools/qml/qdeclarativetester.cpp | 5 | ||||
-rw-r--r-- | tools/qml/qml.pri | 15 | ||||
-rw-r--r-- | tools/qml/qml.pro | 11 | ||||
-rw-r--r-- | tools/qml/qmlruntime.cpp | 13 |
7 files changed, 87 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 5846ff0..6ca6bfb 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 @@ -469,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); @@ -477,7 +470,6 @@ static QDeclarativeViewer *createViewer() } else if (opts.warningsConfig == HideWarnings){ logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings); } -#endif if (opts.experimentalGestures) viewer->enableExperimentalGestures(); @@ -529,11 +521,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 @@ -562,8 +550,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..2010cc1 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -19,10 +19,16 @@ 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 + SOURCES += $$PWD/deviceorientation_symbian.cpp + } + FORMS = $$PWD/recopts.ui \ + $$PWD/proxysettings.ui } else:maemo5 { QT += dbus HEADERS += $$PWD/texteditautoresizer_maemo5.h @@ -39,3 +45,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..b1d56ea 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/qmltooling/tcpserver$${QT_LIBINFIX}.dll + qmldebuggingplugin.path = c:$$QT_PLUGINS_BASE_DIR/qmltooling + 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() |