diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-27 14:22:55 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-27 14:22:55 (GMT) |
commit | 3f626c3e14f2fe5fdecc38d4265d74f8315b3490 (patch) | |
tree | 357b32156e211a33841e44b7a224313c7072ee46 /tools | |
parent | 57ce77e953b618739f6f1aec67f8e0de97e05b08 (diff) | |
parent | 6396e7a15079cb157caef319348a0bcd0b95a6a7 (diff) | |
download | Qt-3f626c3e14f2fe5fdecc38d4265d74f8315b3490.zip Qt-3f626c3e14f2fe5fdecc38d4265d74f8315b3490.tar.gz Qt-3f626c3e14f2fe5fdecc38d4265d74f8315b3490.tar.bz2 |
Merge remote branch 'origin/master' into 4.7
Conflicts:
src/corelib/kernel/qmetatype.cpp
src/declarative/graphicsitems/qdeclarativeevents.cpp
src/declarative/graphicsitems/qdeclarativeflickable.cpp
src/declarative/graphicsitems/qdeclarativegridview.cpp
src/declarative/qml/qdeclarativescript.cpp
src/declarative/util/qdeclarativeanimation.cpp
src/declarative/util/qdeclarativebehavior.cpp
src/declarative/util/qdeclarativeeasefollow.cpp
src/declarative/util/qdeclarativefontloader.cpp
src/declarative/util/qdeclarativelistmodel.cpp
src/declarative/util/qdeclarativespringfollow.cpp
src/declarative/util/qdeclarativestategroup.cpp
src/declarative/util/qdeclarativesystempalette.cpp
src/declarative/util/qdeclarativetimer.cpp
src/declarative/util/qmlstateoperations.cpp
src/multimedia/qml/qdeclarativeaudio.cpp
src/multimedia/qml/qdeclarativevideo.cpp
Diffstat (limited to 'tools')
-rw-r--r-- | tools/assistant/lib/qhelpsearchresultwidget.cpp | 2 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/bookmarkmanager.cpp | 2 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/cmdlineparser.cpp | 16 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpviewer.h | 2 | ||||
-rw-r--r-- | tools/configure/configureapp.cpp | 20 | ||||
-rw-r--r-- | tools/linguist/lupdate/lupdate.pro | 2 | ||||
-rw-r--r-- | tools/linguist/lupdate/qdeclarative.cpp (renamed from tools/linguist/lupdate/qml.cpp) | 14 | ||||
-rw-r--r-- | tools/qml/content/Browser.qml (renamed from tools/qmlviewer/content/Browser.qml) | 0 | ||||
-rw-r--r-- | tools/qml/content/images/folder.png (renamed from tools/qmlviewer/content/images/folder.png) | bin | 1841 -> 1841 bytes | |||
-rw-r--r-- | tools/qml/content/images/titlebar.png (renamed from tools/qmlviewer/content/images/titlebar.png) | bin | 1436 -> 1436 bytes | |||
-rw-r--r-- | tools/qml/content/images/titlebar.sci (renamed from tools/qmlviewer/content/images/titlebar.sci) | 0 | ||||
-rw-r--r-- | tools/qml/content/images/up.png (renamed from tools/qmlviewer/content/images/up.png) | bin | 662 -> 662 bytes | |||
-rw-r--r-- | tools/qml/deviceorientation.cpp (renamed from tools/qmlviewer/deviceorientation.cpp) | 0 | ||||
-rw-r--r-- | tools/qml/deviceorientation.h (renamed from tools/qmlviewer/deviceorientation.h) | 0 | ||||
-rw-r--r-- | tools/qml/deviceorientation_maemo.cpp (renamed from tools/qmlviewer/deviceorientation_maemo.cpp) | 0 | ||||
-rw-r--r-- | tools/qml/main.cpp (renamed from tools/qmlviewer/main.cpp) | 36 | ||||
-rw-r--r-- | tools/qml/proxysettings.cpp (renamed from tools/qmlviewer/proxysettings.cpp) | 0 | ||||
-rw-r--r-- | tools/qml/proxysettings.h (renamed from tools/qmlviewer/proxysettings.h) | 0 | ||||
-rw-r--r-- | tools/qml/proxysettings.ui (renamed from tools/qmlviewer/proxysettings.ui) | 0 | ||||
-rw-r--r-- | tools/qml/qdeclarativefolderlistmodel.cpp (renamed from tools/qmlviewer/qmlfolderlistmodel.cpp) | 86 | ||||
-rw-r--r-- | tools/qml/qdeclarativefolderlistmodel.h (renamed from tools/qmlviewer/qmlfolderlistmodel.h) | 30 | ||||
-rw-r--r-- | tools/qml/qfxtester.cpp (renamed from tools/qmlviewer/qfxtester.cpp) | 89 | ||||
-rw-r--r-- | tools/qml/qfxtester.h (renamed from tools/qmlviewer/qfxtester.h) | 42 | ||||
-rw-r--r-- | tools/qml/qml.pro (renamed from tools/qmlviewer/qmlviewer.pro) | 12 | ||||
-rw-r--r-- | tools/qml/qmlruntime.cpp (renamed from tools/qmlviewer/qmlviewer.cpp) | 171 | ||||
-rw-r--r-- | tools/qml/qmlruntime.h (renamed from tools/qmlviewer/qmlviewer.h) | 32 | ||||
-rw-r--r-- | tools/qml/qmlruntime.qrc (renamed from tools/qmlviewer/qmlviewer.qrc) | 0 | ||||
-rw-r--r-- | tools/qml/recopts.ui (renamed from tools/qmlviewer/recopts.ui) | 0 | ||||
-rw-r--r-- | tools/qtestlib/wince/cetest/cetest.pro | 2 | ||||
-rw-r--r-- | tools/qtestlib/wince/cetest/qmake_include.pri | 4 | ||||
-rw-r--r-- | tools/tools.pro | 2 |
31 files changed, 302 insertions, 262 deletions
diff --git a/tools/assistant/lib/qhelpsearchresultwidget.cpp b/tools/assistant/lib/qhelpsearchresultwidget.cpp index 8e476d5..2f5489b 100644 --- a/tools/assistant/lib/qhelpsearchresultwidget.cpp +++ b/tools/assistant/lib/qhelpsearchresultwidget.cpp @@ -304,7 +304,7 @@ private: last = resultLastToShow > count ? count : resultLastToShow; } } - hitsLabel->setText(QHelpSearchResultWidget::tr("%1 - %2 of %3 Hits").arg(first).arg(last).arg(count)); + hitsLabel->setText(QHelpSearchResultWidget::tr("%1 - %2 of %n Hits", 0, count).arg(first).arg(last)); } private: diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp index 70f562e..b9a1b0e 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.cpp +++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp @@ -148,7 +148,7 @@ void BookmarkManager::takeBookmarksMenu(QMenu* menu) void BookmarkManager::addBookmark(const QString &title, const QString &url) { TRACE_OBJ - showBookmarkDialog(title.isEmpty() ? tr("Untiled") : title, + showBookmarkDialog(title.isEmpty() ? tr("Untitled") : title, url.isEmpty() ? QLatin1String("about:blank") : url); } diff --git a/tools/assistant/tools/assistant/cmdlineparser.cpp b/tools/assistant/tools/assistant/cmdlineparser.cpp index bbc0c37..b6c0beb 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.cpp +++ b/tools/assistant/tools/assistant/cmdlineparser.cpp @@ -167,10 +167,10 @@ void CmdLineParser::handleCollectionFileOption() const QString &fileName = nextArg(); m_collectionFile = getFileName(fileName); if (m_collectionFile.isEmpty()) - m_error = tr("The collection file '%1' does not exist!"). + m_error = tr("The collection file '%1' does not exist."). arg(fileName); } else { - m_error = tr("Missing collection file!"); + m_error = tr("Missing collection file."); } } @@ -183,9 +183,9 @@ void CmdLineParser::handleShowUrlOption() if (url.isValid()) { m_url = url; } else - m_error = tr("Invalid URL '%1'!").arg(urlString); + m_error = tr("Invalid URL '%1'.").arg(urlString); } else { - m_error = tr("Missing URL!"); + m_error = tr("Missing URL."); } } @@ -223,7 +223,7 @@ void CmdLineParser::handleShowOrHideOrActivateOption(ShowState state) else m_error = tr("Unknown widget: %1").arg(widget); } else { - m_error = tr("Missing widget!"); + m_error = tr("Missing widget."); } } @@ -246,11 +246,11 @@ void CmdLineParser::handleRegisterOrUnregisterOption(RegisterState state) const QString &fileName = nextArg(); m_helpFile = getFileName(fileName); if (m_helpFile.isEmpty()) - m_error = tr("The Qt help file '%1' does not exist!").arg(fileName); + m_error = tr("The Qt help file '%1' does not exist.").arg(fileName); else m_register = state; } else { - m_error = tr("Missing help file!"); + m_error = tr("Missing help file."); } } @@ -260,7 +260,7 @@ void CmdLineParser::handleSetCurrentFilterOption() if (hasMoreArgs()) m_currentFilter = nextArg(); else - m_error = tr("Missing filter argument!"); + m_error = tr("Missing filter argument."); } QString CmdLineParser::getFileName(const QString &fileName) diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h index 0bfe904..9e8f5f4 100644 --- a/tools/assistant/tools/assistant/helpviewer.h +++ b/tools/assistant/tools/assistant/helpviewer.h @@ -53,7 +53,7 @@ class AbstractHelpViewer { public: AbstractHelpViewer(); - ~AbstractHelpViewer(); + virtual ~AbstractHelpViewer(); virtual QFont viewerFont() const = 0; virtual void setViewerFont(const QFont &font) = 0; diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 172dcd4..c0a29ca 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1070,6 +1070,12 @@ void Configure::parseCmdLine() dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i); } + else if( configCmdLine.at(i) == "-importdir" ) { + ++i; + if(i==argCount) + break; + dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i); + } else if( configCmdLine.at(i) == "-datadir" ) { ++i; if(i==argCount) @@ -1487,6 +1493,7 @@ void Configure::applySpecSpecifics() dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ]; dictionary[ "QT_INSTALL_PREFIX" ] = ""; dictionary[ "QT_INSTALL_PLUGINS" ] = "\\resource\\qt\\plugins"; + dictionary[ "QT_INSTALL_IMPORTS" ] = "\\resource\\qt\\imports"; dictionary[ "ARM_FPU_TYPE" ] = "softvfp"; dictionary[ "SQL_SQLITE" ] = "yes"; dictionary[ "SQL_SQLITE_LIB" ] = "system"; @@ -1563,7 +1570,7 @@ bool Configure::displayHelp() desc("Usage: configure [-buildkey <key>]\n" // desc("Usage: configure [-prefix dir] [-bindir <dir>] [-libdir <dir>]\n" // "[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir>]\n" -// "[-datadir <dir>] [-translationdir <dir>]\n" +// "[-importdir <dir>] [-datadir <dir>] [-translationdir <dir>]\n" // "[-examplesdir <dir>] [-demosdir <dir>][-buildkey <key>]\n" "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n" "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n" @@ -1603,6 +1610,7 @@ bool Configure::displayHelp() desc( "-docdir <dir>", "Documentation will be installed to dir\n(default PREFIX/doc)"); desc( "-headerdir <dir>", "Headers will be installed to dir\n(default PREFIX/include)"); desc( "-plugindir <dir>", "Plugins will be installed to dir\n(default PREFIX/plugins)"); + desc( "-importdir <dir>", "Imports for QML will be installed to dir\n(default PREFIX/imports)"); desc( "-datadir <dir>", "Data used by Qt programs will be installed to dir\n(default PREFIX)"); desc( "-translationdir <dir>","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n"); desc( "-examplesdir <dir>", "Examples will be installed to dir\n(default PREFIX/examples)"); @@ -2074,7 +2082,7 @@ bool Configure::checkAvailability(const QString &part) } else if (part == "WEBKIT") { available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++"); } else if (part == "DECLARATIVE") { - available = QFile::exists(sourcePath + "/src/declarative/qml/qmlcomponent.h"); + available = QFile::exists(sourcePath + "/src/declarative/qml/qdeclarativecomponent.h"); } else if (part == "AUDIO_BACKEND") { available = true; if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) { @@ -2657,6 +2665,8 @@ void Configure::generateOutputVars() dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/bin" ); if( !dictionary[ "QT_INSTALL_PLUGINS" ].size() ) dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins" ); + if( !dictionary[ "QT_INSTALL_IMPORTS" ].size() ) + dictionary[ "QT_INSTALL_IMPORTS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/imports" ); if( !dictionary[ "QT_INSTALL_DATA" ].size() ) dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] ); if( !dictionary[ "QT_INSTALL_TRANSLATIONS" ].size() ) @@ -3161,6 +3171,7 @@ void Configure::generateConfigfiles() << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << QString(dictionary["QT_INSTALL_LIBS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << QString(dictionary["QT_INSTALL_BINS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << QString(dictionary["QT_INSTALL_PLUGINS"]).replace( "\\", "\\\\" ) << "\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << QString(dictionary["QT_INSTALL_IMPORTS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << QString(dictionary["QT_INSTALL_DATA"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << QString(dictionary["QT_INSTALL_TRANSLATIONS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << QString(dictionary["QT_INSTALL_EXAMPLES"]).replace( "\\", "\\\\" ) << "\";" << endl @@ -3175,6 +3186,7 @@ void Configure::generateConfigfiles() << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins").replace( "\\", "\\\\" ) <<"\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example").replace( "\\", "\\\\" ) <<"\";" << endl @@ -3190,6 +3202,7 @@ void Configure::generateConfigfiles() << "#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;" << endl << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl + << "#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;" << endl << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl << "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl @@ -3336,6 +3349,7 @@ void Configure::displayConfig() cout << "Headers installed to........" << dictionary[ "QT_INSTALL_HEADERS" ] << endl; cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl; cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl; + cout << "Imports installed to........" << dictionary[ "QT_INSTALL_IMPORTS" ] << endl; cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl; cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl; cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl; @@ -3709,7 +3723,7 @@ void Configure::generateMakefiles() QTextStream txt(&file); txt << "all:\n"; txt << "\t" << args.join(" ") << "\n"; - txt << "\t" << dictionary[ "MAKE" ] << " -f " << it->target << "\n"; + txt << "\t\"$(MAKE)\" -$(MAKEFLAGS) -f " << it->target << "\n"; txt << "first: all\n"; txt << "qmake:\n"; txt << "\t" << args.join(" ") << "\n"; diff --git a/tools/linguist/lupdate/lupdate.pro b/tools/linguist/lupdate/lupdate.pro index 283d69f..1f88931 100644 --- a/tools/linguist/lupdate/lupdate.pro +++ b/tools/linguist/lupdate/lupdate.pro @@ -26,7 +26,7 @@ SOURCES += \ cpp.cpp \ java.cpp \ qscript.cpp \ - qml.cpp \ + qdeclarative.cpp \ ui.cpp HEADERS += \ diff --git a/tools/linguist/lupdate/qml.cpp b/tools/linguist/lupdate/qdeclarative.cpp index cb35f47..a734e99 100644 --- a/tools/linguist/lupdate/qml.cpp +++ b/tools/linguist/lupdate/qdeclarative.cpp @@ -47,12 +47,12 @@ #include <QtCore/QFile> #include <QtCore/QString> -#include "parser/qmljsengine_p.h" -#include "parser/qmljsparser_p.h" -#include "parser/qmljslexer_p.h" -#include "parser/qmljsnodepool_p.h" -#include "parser/qmljsastvisitor_p.h" -#include "parser/qmljsast_p.h" +#include "parser/qdeclarativejsengine_p.h" +#include "parser/qdeclarativejsparser_p.h" +#include "parser/qdeclarativejslexer_p.h" +#include "parser/qdeclarativejsnodepool_p.h" +#include "parser/qdeclarativejsastvisitor_p.h" +#include "parser/qdeclarativejsast_p.h" #include <QCoreApplication> #include <QFile> @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE -using namespace QmlJS; +using namespace QDeclarativeJS; class FindTrCalls: protected AST::Visitor { diff --git a/tools/qmlviewer/content/Browser.qml b/tools/qml/content/Browser.qml index 35120bc..35120bc 100644 --- a/tools/qmlviewer/content/Browser.qml +++ b/tools/qml/content/Browser.qml diff --git a/tools/qmlviewer/content/images/folder.png b/tools/qml/content/images/folder.png Binary files differindex e53e2ad..e53e2ad 100644 --- a/tools/qmlviewer/content/images/folder.png +++ b/tools/qml/content/images/folder.png diff --git a/tools/qmlviewer/content/images/titlebar.png b/tools/qml/content/images/titlebar.png Binary files differindex 51c9008..51c9008 100644 --- a/tools/qmlviewer/content/images/titlebar.png +++ b/tools/qml/content/images/titlebar.png diff --git a/tools/qmlviewer/content/images/titlebar.sci b/tools/qml/content/images/titlebar.sci index 0418d94..0418d94 100644 --- a/tools/qmlviewer/content/images/titlebar.sci +++ b/tools/qml/content/images/titlebar.sci diff --git a/tools/qmlviewer/content/images/up.png b/tools/qml/content/images/up.png Binary files differindex b05f802..b05f802 100644 --- a/tools/qmlviewer/content/images/up.png +++ b/tools/qml/content/images/up.png diff --git a/tools/qmlviewer/deviceorientation.cpp b/tools/qml/deviceorientation.cpp index e7c70d5..e7c70d5 100644 --- a/tools/qmlviewer/deviceorientation.cpp +++ b/tools/qml/deviceorientation.cpp diff --git a/tools/qmlviewer/deviceorientation.h b/tools/qml/deviceorientation.h index c8125cd..c8125cd 100644 --- a/tools/qmlviewer/deviceorientation.h +++ b/tools/qml/deviceorientation.h diff --git a/tools/qmlviewer/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp index fa2c6e5..fa2c6e5 100644 --- a/tools/qmlviewer/deviceorientation_maemo.cpp +++ b/tools/qml/deviceorientation_maemo.cpp diff --git a/tools/qmlviewer/main.cpp b/tools/qml/main.cpp index 57c445f..9ef02ac 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qml/main.cpp @@ -39,13 +39,15 @@ ** ****************************************************************************/ -#include "qml.h" -#include "qmlviewer.h" +#include "qdeclarative.h" +#include "qmlruntime.h" #include <QWidget> #include <QDir> #include <QApplication> #include <QTranslator> #include <QDebug> +#include "qfxtester.h" +#include "qdeclarativefolderlistmodel.h" QT_USE_NAMESPACE @@ -59,7 +61,7 @@ void myMessageOutput(QtMsgType type, const char *msg) { static int fd = -1; if (fd == -1) - fd = ::open("E:\\qmlviewer.log", O_WRONLY | O_CREAT); + fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT); ::write(fd, msg, strlen(msg)); ::write(fd, "\n", 1); @@ -74,7 +76,7 @@ void myMessageOutput(QtMsgType type, const char *msg) void usage() { - qWarning("Usage: qmlviewer [options] <filename>"); + qWarning("Usage: qml [options] <filename>"); qWarning(" "); qWarning(" options:"); qWarning(" -v, -version ............................. display version"); @@ -110,7 +112,7 @@ void usage() void scriptOptsUsage() { - qWarning("Usage: qmlviewer -scriptopts <option>[,<option>...] ..."); + qWarning("Usage: qml -scriptopts <option>[,<option>...] ..."); qWarning(" options:"); qWarning(" record ................................... record a new script"); qWarning(" play ..................................... playback an existing script"); @@ -150,6 +152,10 @@ int main(int argc, char ** argv) app.setOrganizationName("Nokia"); app.setOrganizationDomain("nokia.com"); + QDeclarativeViewer::registerTypes(); + QDeclarativeTester::registerTypes(); + QDeclarativeFolderListModel::registerTypes(); + bool frameless = false; bool resizeview = false; QString fileName; @@ -265,30 +271,30 @@ int main(int argc, char ** argv) if (stayOnTop) wflags |= Qt::WindowStaysOnTopHint; - QmlViewer viewer(0, wflags); + QDeclarativeViewer viewer(0, wflags); if (!scriptopts.isEmpty()) { QStringList options = scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts); - QmlViewer::ScriptOptions scriptOptions = 0; + QDeclarativeViewer::ScriptOptions scriptOptions = 0; for (int i = 0; i < options.count(); ++i) { const QString &option = options.at(i); if (option == QLatin1String("help")) { scriptOptsUsage(); } else if (option == QLatin1String("play")) { - scriptOptions |= QmlViewer::Play; + scriptOptions |= QDeclarativeViewer::Play; } else if (option == QLatin1String("record")) { - scriptOptions |= QmlViewer::Record; + scriptOptions |= QDeclarativeViewer::Record; } else if (option == QLatin1String("testimages")) { - scriptOptions |= QmlViewer::TestImages; + scriptOptions |= QDeclarativeViewer::TestImages; } else if (option == QLatin1String("testerror")) { - scriptOptions |= QmlViewer::TestErrorProperty; + scriptOptions |= QDeclarativeViewer::TestErrorProperty; } else if (option == QLatin1String("exitoncomplete")) { - scriptOptions |= QmlViewer::ExitOnComplete; + scriptOptions |= QDeclarativeViewer::ExitOnComplete; } else if (option == QLatin1String("exitonfailure")) { - scriptOptions |= QmlViewer::ExitOnFailure; + scriptOptions |= QDeclarativeViewer::ExitOnFailure; } else if (option == QLatin1String("saveonexit")) { - scriptOptions |= QmlViewer::SaveOnExit; + scriptOptions |= QDeclarativeViewer::SaveOnExit; } else { scriptOptsUsage(); } @@ -297,7 +303,7 @@ int main(int argc, char ** argv) if (script.isEmpty()) usage(); - if (!(scriptOptions & QmlViewer::Record) && !(scriptOptions & QmlViewer::Play)) + if (!(scriptOptions & QDeclarativeViewer::Record) && !(scriptOptions & QDeclarativeViewer::Play)) scriptOptsUsage(); viewer.setScriptOptions(scriptOptions); viewer.setScript(script); diff --git a/tools/qmlviewer/proxysettings.cpp b/tools/qml/proxysettings.cpp index 3255e42..3255e42 100644 --- a/tools/qmlviewer/proxysettings.cpp +++ b/tools/qml/proxysettings.cpp diff --git a/tools/qmlviewer/proxysettings.h b/tools/qml/proxysettings.h index 325929a..325929a 100644 --- a/tools/qmlviewer/proxysettings.h +++ b/tools/qml/proxysettings.h diff --git a/tools/qmlviewer/proxysettings.ui b/tools/qml/proxysettings.ui index 84e39fe..84e39fe 100644 --- a/tools/qmlviewer/proxysettings.ui +++ b/tools/qml/proxysettings.ui diff --git a/tools/qmlviewer/qmlfolderlistmodel.cpp b/tools/qml/qdeclarativefolderlistmodel.cpp index 698df54..58bf59b 100644 --- a/tools/qmlviewer/qmlfolderlistmodel.cpp +++ b/tools/qml/qdeclarativefolderlistmodel.cpp @@ -39,37 +39,37 @@ ** ****************************************************************************/ -#include "qmlfolderlistmodel.h" +#include "qdeclarativefolderlistmodel.h" #include <QDirModel> #include <QDebug> -#include <qmlcontext.h> +#include <qdeclarativecontext.h> QT_BEGIN_NAMESPACE -class QmlFolderListModelPrivate +class QDeclarativeFolderListModelPrivate { public: - QmlFolderListModelPrivate() - : sortField(QmlFolderListModel::Name), sortReversed(false), count(0) { + QDeclarativeFolderListModelPrivate() + : sortField(QDeclarativeFolderListModel::Name), sortReversed(false), count(0) { nameFilters << QLatin1String("*"); } void updateSorting() { QDir::SortFlags flags = 0; switch(sortField) { - case QmlFolderListModel::Unsorted: + case QDeclarativeFolderListModel::Unsorted: flags |= QDir::Unsorted; break; - case QmlFolderListModel::Name: + case QDeclarativeFolderListModel::Name: flags |= QDir::Name; break; - case QmlFolderListModel::Time: + case QDeclarativeFolderListModel::Time: flags |= QDir::Time; break; - case QmlFolderListModel::Size: + case QDeclarativeFolderListModel::Size: flags |= QDir::Size; break; - case QmlFolderListModel::Type: + case QDeclarativeFolderListModel::Type: flags |= QDir::Type; break; } @@ -84,7 +84,7 @@ public: QUrl folder; QStringList nameFilters; QModelIndex folderIndex; - QmlFolderListModel::SortField sortField; + QDeclarativeFolderListModel::SortField sortField; bool sortReversed; int count; }; @@ -111,10 +111,10 @@ public: via the \l isFolder() method. */ -QmlFolderListModel::QmlFolderListModel(QObject *parent) +QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent) : QListModelInterface(parent) { - d = new QmlFolderListModelPrivate; + d = new QDeclarativeFolderListModelPrivate; d->model.setFilter(QDir::AllDirs | QDir::Files | QDir::Drives | QDir::NoDotAndDotDot); connect(&d->model, SIGNAL(rowsInserted(const QModelIndex&,int,int)) , this, SLOT(inserted(const QModelIndex&,int,int))); @@ -126,12 +126,12 @@ QmlFolderListModel::QmlFolderListModel(QObject *parent) connect(&d->model, SIGNAL(layoutChanged()), this, SLOT(refresh())); } -QmlFolderListModel::~QmlFolderListModel() +QDeclarativeFolderListModel::~QDeclarativeFolderListModel() { delete d; } -QHash<int,QVariant> QmlFolderListModel::data(int index, const QList<int> &roles) const +QHash<int,QVariant> QDeclarativeFolderListModel::data(int index, const QList<int> &roles) const { Q_UNUSED(roles); QHash<int,QVariant> folderData; @@ -144,7 +144,7 @@ QHash<int,QVariant> QmlFolderListModel::data(int index, const QList<int> &roles) return folderData; } -QVariant QmlFolderListModel::data(int index, int role) const +QVariant QDeclarativeFolderListModel::data(int index, int role) const { QVariant rv; QModelIndex modelIndex = d->model.index(index, 0, d->folderIndex); @@ -158,12 +158,12 @@ QVariant QmlFolderListModel::data(int index, int role) const return rv; } -int QmlFolderListModel::count() const +int QDeclarativeFolderListModel::count() const { return d->count; } -QList<int> QmlFolderListModel::roles() const +QList<int> QDeclarativeFolderListModel::roles() const { QList<int> r; r << QDirModel::FileNameRole; @@ -171,7 +171,7 @@ QList<int> QmlFolderListModel::roles() const return r; } -QString QmlFolderListModel::toString(int role) const +QString QDeclarativeFolderListModel::toString(int role) const { switch (role) { case QDirModel::FileNameRole: @@ -190,12 +190,12 @@ QString QmlFolderListModel::toString(int role) const It is a URL, but must be a file: or qrc: URL (or relative to such a URL). */ -QUrl QmlFolderListModel::folder() const +QUrl QDeclarativeFolderListModel::folder() const { return d->folder; } -void QmlFolderListModel::setFolder(const QUrl &folder) +void QDeclarativeFolderListModel::setFolder(const QUrl &folder) { if (folder == d->folder) return; @@ -207,7 +207,7 @@ void QmlFolderListModel::setFolder(const QUrl &folder) } } -QUrl QmlFolderListModel::parentFolder() const +QUrl QDeclarativeFolderListModel::parentFolder() const { QUrl r; QString localFile = d->folder.toLocalFile(); @@ -245,18 +245,18 @@ QUrl QmlFolderListModel::parentFolder() const } \endcode */ -QStringList QmlFolderListModel::nameFilters() const +QStringList QDeclarativeFolderListModel::nameFilters() const { return d->nameFilters; } -void QmlFolderListModel::setNameFilters(const QStringList &filters) +void QDeclarativeFolderListModel::setNameFilters(const QStringList &filters) { d->nameFilters = filters; d->model.setNameFilters(d->nameFilters); } -void QmlFolderListModel::componentComplete() +void QDeclarativeFolderListModel::componentComplete() { if (!d->folder.isValid() || !QDir().exists(d->folder.toLocalFile())) setFolder(QUrl(QLatin1String("file://")+QDir::currentPath())); @@ -265,12 +265,12 @@ void QmlFolderListModel::componentComplete() QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection); } -QmlFolderListModel::SortField QmlFolderListModel::sortField() const +QDeclarativeFolderListModel::SortField QDeclarativeFolderListModel::sortField() const { return d->sortField; } -void QmlFolderListModel::setSortField(SortField field) +void QDeclarativeFolderListModel::setSortField(SortField field) { if (field != d->sortField) { d->sortField = field; @@ -278,12 +278,12 @@ void QmlFolderListModel::setSortField(SortField field) } } -bool QmlFolderListModel::sortReversed() const +bool QDeclarativeFolderListModel::sortReversed() const { return d->sortReversed; } -void QmlFolderListModel::setSortReversed(bool rev) +void QDeclarativeFolderListModel::setSortReversed(bool rev) { if (rev != d->sortReversed) { d->sortReversed = rev; @@ -297,7 +297,7 @@ void QmlFolderListModel::setSortReversed(bool rev) Returns true if the entry \a index is a folder; otherwise returns false. */ -bool QmlFolderListModel::isFolder(int index) const +bool QDeclarativeFolderListModel::isFolder(int index) const { if (index != -1) { QModelIndex idx = d->model.index(index, 0, d->folderIndex); @@ -307,7 +307,7 @@ bool QmlFolderListModel::isFolder(int index) const return false; } -void QmlFolderListModel::refresh() +void QDeclarativeFolderListModel::refresh() { d->folderIndex = QModelIndex(); if (d->count) { @@ -322,7 +322,7 @@ void QmlFolderListModel::refresh() } } -void QmlFolderListModel::inserted(const QModelIndex &index, int start, int end) +void QDeclarativeFolderListModel::inserted(const QModelIndex &index, int start, int end) { if (index == d->folderIndex) { d->count = d->model.rowCount(d->folderIndex); @@ -330,7 +330,7 @@ void QmlFolderListModel::inserted(const QModelIndex &index, int start, int end) } } -void QmlFolderListModel::removed(const QModelIndex &index, int start, int end) +void QDeclarativeFolderListModel::removed(const QModelIndex &index, int start, int end) { if (index == d->folderIndex) { d->count = d->model.rowCount(d->folderIndex); @@ -338,7 +338,7 @@ void QmlFolderListModel::removed(const QModelIndex &index, int start, int end) } } -void QmlFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex &end) +void QDeclarativeFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex &end) { qDebug() << "data changed"; if (start.parent() == d->folderIndex) @@ -352,12 +352,12 @@ void QmlFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex Note that the nameFilters are ignored for directories. */ -bool QmlFolderListModel::showDirs() const +bool QDeclarativeFolderListModel::showDirs() const { return d->model.filter() & QDir::AllDirs; } -void QmlFolderListModel::setShowDirs(bool on) +void QDeclarativeFolderListModel::setShowDirs(bool on) { if (!(d->model.filter() & QDir::AllDirs) == !on) return; @@ -374,12 +374,12 @@ void QmlFolderListModel::setShowDirs(bool on) The default is false. */ -bool QmlFolderListModel::showDotAndDotDot() const +bool QDeclarativeFolderListModel::showDotAndDotDot() const { return !(d->model.filter() & QDir::NoDotAndDotDot); } -void QmlFolderListModel::setShowDotAndDotDot(bool on) +void QDeclarativeFolderListModel::setShowDotAndDotDot(bool on) { if (!(d->model.filter() & QDir::NoDotAndDotDot) == on) return; @@ -396,12 +396,12 @@ void QmlFolderListModel::setShowDotAndDotDot(bool on) The default is false. */ -bool QmlFolderListModel::showOnlyReadable() const +bool QDeclarativeFolderListModel::showOnlyReadable() const { return d->model.filter() & QDir::Readable; } -void QmlFolderListModel::setShowOnlyReadable(bool on) +void QDeclarativeFolderListModel::setShowOnlyReadable(bool on) { if (!(d->model.filter() & QDir::Readable) == !on) return; @@ -411,8 +411,10 @@ void QmlFolderListModel::setShowOnlyReadable(bool on) d->model.setFilter(d->model.filter() & ~QDir::Readable); } - -QML_DEFINE_TYPE(Qt,4,6,FolderListModel,QmlFolderListModel) +void QDeclarativeFolderListModel::registerTypes() +{ + QML_REGISTER_TYPE(Qt,4,6,FolderListModel,QDeclarativeFolderListModel); +} QT_END_NAMESPACE diff --git a/tools/qmlviewer/qmlfolderlistmodel.h b/tools/qml/qdeclarativefolderlistmodel.h index c180e97..57b7fe5 100644 --- a/tools/qmlviewer/qmlfolderlistmodel.h +++ b/tools/qml/qdeclarativefolderlistmodel.h @@ -39,22 +39,24 @@ ** ****************************************************************************/ -#ifndef QMLFOLDERLISTMODEL_H -#define QMLFOLDERLISTMODEL_H +#ifndef QDECLARATIVEFOLDERLISTMODEL_H +#define QDECLARATIVEFOLDERLISTMODEL_H -#include <qml.h> +#include <qdeclarative.h> +#include <QStringList> +#include <QUrl> #include "../../src/declarative/3rdparty/qlistmodelinterface_p.h" QT_BEGIN_NAMESPACE -class QmlContext; +class QDeclarativeContext; class QModelIndex; -class QmlFolderListModelPrivate; -class QmlFolderListModel : public QListModelInterface, public QmlParserStatus +class QDeclarativeFolderListModelPrivate; +class QDeclarativeFolderListModel : public QListModelInterface, public QDeclarativeParserStatus { Q_OBJECT - Q_INTERFACES(QmlParserStatus) + Q_INTERFACES(QDeclarativeParserStatus) Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged) Q_PROPERTY(QUrl parentFolder READ parentFolder NOTIFY folderChanged) @@ -66,8 +68,10 @@ class QmlFolderListModel : public QListModelInterface, public QmlParserStatus Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable) public: - QmlFolderListModel(QObject *parent = 0); - ~QmlFolderListModel(); + QDeclarativeFolderListModel(QObject *parent = 0); + ~QDeclarativeFolderListModel(); + + static void registerTypes(); virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const; virtual QVariant data(int index, int role) const; @@ -112,12 +116,12 @@ private Q_SLOTS: void dataChanged(const QModelIndex &start, const QModelIndex &end); private: - Q_DISABLE_COPY(QmlFolderListModel) - QmlFolderListModelPrivate *d; + Q_DISABLE_COPY(QDeclarativeFolderListModel) + QDeclarativeFolderListModelPrivate *d; }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlFolderListModel) +QML_DECLARE_TYPE(QDeclarativeFolderListModel) -#endif // QMLFOLDERLISTMODEL_H +#endif // QDECLARATIVEFOLDERLISTMODEL_H diff --git a/tools/qmlviewer/qfxtester.cpp b/tools/qml/qfxtester.cpp index c3c0124..638a3c9 100644 --- a/tools/qmlviewer/qfxtester.cpp +++ b/tools/qml/qfxtester.cpp @@ -42,62 +42,58 @@ #include <qfxtester.h> #include <QDebug> #include <QApplication> -#include <qmlview.h> +#include <qdeclarativeview.h> #include <QFile> -#include <QmlComponent> +#include <QDeclarativeComponent> #include <QDir> #include <QCryptographicHash> #include <private/qabstractanimation_p.h> -#include <private/qmlgraphicsitem_p.h> +#include <private/qdeclarativeitem_p.h> QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt.VisualTest, 4,6, VisualTest, QmlGraphicsVisualTest); -QML_DEFINE_TYPE(Qt.VisualTest, 4,6, Frame, QmlGraphicsVisualTestFrame); -QML_DEFINE_TYPE(Qt.VisualTest, 4,6, Mouse, QmlGraphicsVisualTestMouse); -QML_DEFINE_TYPE(Qt.VisualTest, 4,6, Key, QmlGraphicsVisualTestKey); -QmlGraphicsTester::QmlGraphicsTester(const QString &script, QmlViewer::ScriptOptions opts, - QmlView *parent) +QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts, + QDeclarativeView *parent) : QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), testscript(0), hasCompleted(false), hasFailed(false) { parent->viewport()->installEventFilter(this); parent->installEventFilter(this); QUnifiedTimer::instance()->setConsistentTiming(true); - if (options & QmlViewer::Play) + if (options & QDeclarativeViewer::Play) this->run(); start(); } -QmlGraphicsTester::~QmlGraphicsTester() +QDeclarativeTester::~QDeclarativeTester() { if (!hasFailed && - options & QmlViewer::Record && - options & QmlViewer::SaveOnExit) + options & QDeclarativeViewer::Record && + options & QDeclarativeViewer::SaveOnExit) save(); } -int QmlGraphicsTester::duration() const +int QDeclarativeTester::duration() const { return -1; } -void QmlGraphicsTester::addMouseEvent(Destination dest, QMouseEvent *me) +void QDeclarativeTester::addMouseEvent(Destination dest, QMouseEvent *me) { MouseEvent e(me); e.destination = dest; m_mouseEvents << e; } -void QmlGraphicsTester::addKeyEvent(Destination dest, QKeyEvent *ke) +void QDeclarativeTester::addKeyEvent(Destination dest, QKeyEvent *ke) { KeyEvent e(ke); e.destination = dest; m_keyEvents << e; } -bool QmlGraphicsTester::eventFilter(QObject *o, QEvent *e) +bool QDeclarativeTester::eventFilter(QObject *o, QEvent *e) { if (!filterEvents) return false; @@ -128,53 +124,53 @@ bool QmlGraphicsTester::eventFilter(QObject *o, QEvent *e) return false; } -void QmlGraphicsTester::executefailure() +void QDeclarativeTester::executefailure() { hasFailed = true; - if (options & QmlViewer::ExitOnFailure) + if (options & QDeclarativeViewer::ExitOnFailure) exit(-1); } -void QmlGraphicsTester::imagefailure() +void QDeclarativeTester::imagefailure() { hasFailed = true; - if (options & QmlViewer::ExitOnFailure) + if (options & QDeclarativeViewer::ExitOnFailure) exit(-1); } -void QmlGraphicsTester::complete() +void QDeclarativeTester::complete() { - if ((options & QmlViewer::TestErrorProperty) && !hasFailed) { + if ((options & QDeclarativeViewer::TestErrorProperty) && !hasFailed) { QString e = m_view->rootObject()->property("error").toString(); if (!e.isEmpty()) { qWarning() << "Test failed:" << e; hasFailed = true; } } - if (options & QmlViewer::ExitOnComplete) + if (options & QDeclarativeViewer::ExitOnComplete) QApplication::exit(hasFailed?-1:0); if (hasCompleted) return; hasCompleted = true; - if (options & QmlViewer::Play) + if (options & QDeclarativeViewer::Play) qWarning("Script playback complete"); } -void QmlGraphicsTester::run() +void QDeclarativeTester::run() { - QmlComponent c(m_view->engine(), m_script + QLatin1String(".qml")); + QDeclarativeComponent c(m_view->engine(), m_script + QLatin1String(".qml")); - testscript = qobject_cast<QmlGraphicsVisualTest *>(c.create()); + testscript = qobject_cast<QDeclarativeVisualTest *>(c.create()); if (testscript) testscript->setParent(this); else { executefailure(); exit(-1); } testscriptidx = 0; } -void QmlGraphicsTester::save() +void QDeclarativeTester::save() { QString filename = m_script + QLatin1String(".qml"); QFileInfo filenameInfo(filename); @@ -241,13 +237,13 @@ void QmlGraphicsTester::save() file.close(); } -void QmlGraphicsTester::updateCurrentTime(int msec) +void QDeclarativeTester::updateCurrentTime(int msec) { - QmlGraphicsItemPrivate::setConsistentTime(msec); + QDeclarativeItemPrivate::setConsistentTime(msec); QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32); - if (options & QmlViewer::TestImages) { + if (options & QDeclarativeViewer::TestImages) { img.fill(qRgb(255,255,255)); QPainter p(&img); m_view->render(&p); @@ -255,7 +251,7 @@ void QmlGraphicsTester::updateCurrentTime(int msec) FrameEvent fe; fe.msec = msec; - if (msec == 0 || !(options & QmlViewer::TestImages)) { + if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) { // Skip first frame, skip if not doing images } else if (0 == (m_savedFrameEvents.count() % 60)) { fe.image = img; @@ -301,22 +297,21 @@ void QmlGraphicsTester::updateCurrentTime(int msec) m_keyEvents.clear(); // Advance test script - static int imgCount = 0; while (testscript && testscript->count() > testscriptidx) { QObject *event = testscript->event(testscriptidx); - if (QmlGraphicsVisualTestFrame *frame = qobject_cast<QmlGraphicsVisualTestFrame *>(event)) { + if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) { if (frame->msec() < msec) { - if (options & QmlViewer::TestImages && !(options & QmlViewer::Record)) { - qWarning() << "QmlGraphicsTester: Extra frame. Seen:" + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { + qWarning() << "QDeclarativeTester: Extra frame. Seen:" << msec << "Expected:" << frame->msec(); imagefailure(); } } else if (frame->msec() == msec) { if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) { - if (options & QmlViewer::TestImages && !(options & QmlViewer::Record)) { - qWarning() << "QmlGraphicsTester: Mismatched frame hash. Seen:" + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { + qWarning() << "QDeclarativeTester: Mismatched frame hash. Seen:" << fe.hash.toHex() << "Expected:" << frame->hash().toUtf8(); imagefailure(); @@ -326,17 +321,17 @@ void QmlGraphicsTester::updateCurrentTime(int msec) break; } - if (options & QmlViewer::TestImages && !(options & QmlViewer::Record) && !frame->image().isEmpty()) { + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) { QImage goodImage(frame->image().toLocalFile()); if (goodImage != img) { QString reject(frame->image().toLocalFile() + ".reject.png"); - qWarning() << "QmlGraphicsTester: Image mismatch. Reject saved to:" + qWarning() << "QDeclarativeTester: Image mismatch. Reject saved to:" << reject; img.save(reject); imagefailure(); } } - } else if (QmlGraphicsVisualTestMouse *mouse = qobject_cast<QmlGraphicsVisualTestMouse *>(event)) { + } else if (QDeclarativeVisualTestMouse *mouse = qobject_cast<QDeclarativeVisualTestMouse *>(event)) { QPoint pos(mouse->x(), mouse->y()); QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos; QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers()); @@ -351,7 +346,7 @@ void QmlGraphicsTester::updateCurrentTime(int msec) me.destination = ViewPort; } m_savedMouseEvents.append(me); - } else if (QmlGraphicsVisualTestKey *key = qobject_cast<QmlGraphicsVisualTestKey *>(event)) { + } else if (QDeclarativeVisualTestKey *key = qobject_cast<QDeclarativeVisualTestKey *>(event)) { QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count()); @@ -375,4 +370,12 @@ void QmlGraphicsTester::updateCurrentTime(int msec) complete(); } +void QDeclarativeTester::registerTypes() +{ + QML_REGISTER_TYPE(Qt.VisualTest, 4,6, VisualTest, QDeclarativeVisualTest); + QML_REGISTER_TYPE(Qt.VisualTest, 4,6, Frame, QDeclarativeVisualTestFrame); + QML_REGISTER_TYPE(Qt.VisualTest, 4,6, Mouse, QDeclarativeVisualTestMouse); + QML_REGISTER_TYPE(Qt.VisualTest, 4,6, Key, QDeclarativeVisualTestKey); +} + QT_END_NAMESPACE diff --git a/tools/qmlviewer/qfxtester.h b/tools/qml/qfxtester.h index 4b8ff9f..1a9f077 100644 --- a/tools/qmlviewer/qfxtester.h +++ b/tools/qml/qfxtester.h @@ -45,17 +45,19 @@ #include <QEvent> #include <QMouseEvent> #include <QKeyEvent> -#include <qmlviewer.h> +#include <QImage> +#include <QUrl> +#include <qmlruntime.h> QT_BEGIN_NAMESPACE -class QmlGraphicsVisualTest : public QObject +class QDeclarativeVisualTest : public QObject { Q_OBJECT Q_PROPERTY(QList<QObject *>* events READ events CONSTANT) Q_CLASSINFO("DefaultProperty", "events") public: - QmlGraphicsVisualTest() {} + QDeclarativeVisualTest() {} QList<QObject *> *events() { return &m_events; } @@ -68,18 +70,18 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsVisualTest) +QML_DECLARE_TYPE(QDeclarativeVisualTest) QT_BEGIN_NAMESPACE -class QmlGraphicsVisualTestFrame : public QObject +class QDeclarativeVisualTestFrame : public QObject { Q_OBJECT Q_PROPERTY(int msec READ msec WRITE setMsec) Q_PROPERTY(QString hash READ hash WRITE setHash) Q_PROPERTY(QUrl image READ image WRITE setImage) public: - QmlGraphicsVisualTestFrame() : m_msec(-1) {} + QDeclarativeVisualTestFrame() : m_msec(-1) {} int msec() const { return m_msec; } void setMsec(int m) { m_msec = m; } @@ -98,11 +100,11 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsVisualTestFrame) +QML_DECLARE_TYPE(QDeclarativeVisualTestFrame) QT_BEGIN_NAMESPACE -class QmlGraphicsVisualTestMouse : public QObject +class QDeclarativeVisualTestMouse : public QObject { Q_OBJECT Q_PROPERTY(int type READ type WRITE setType) @@ -113,7 +115,7 @@ class QmlGraphicsVisualTestMouse : public QObject Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) public: - QmlGraphicsVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} + QDeclarativeVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} int type() const { return m_type; } void setType(int t) { m_type = t; } @@ -147,11 +149,11 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsVisualTestMouse) +QML_DECLARE_TYPE(QDeclarativeVisualTestMouse) QT_BEGIN_NAMESPACE -class QmlGraphicsVisualTestKey : public QObject +class QDeclarativeVisualTestKey : public QObject { Q_OBJECT Q_PROPERTY(int type READ type WRITE setType) @@ -162,7 +164,7 @@ class QmlGraphicsVisualTestKey : public QObject Q_PROPERTY(int count READ count WRITE setCount) Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) public: - QmlGraphicsVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} + QDeclarativeVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} int type() const { return m_type; } void setType(int t) { m_type = t; } @@ -196,15 +198,17 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsVisualTestKey) +QML_DECLARE_TYPE(QDeclarativeVisualTestKey) QT_BEGIN_NAMESPACE -class QmlGraphicsTester : public QAbstractAnimation +class QDeclarativeTester : public QAbstractAnimation { public: - QmlGraphicsTester(const QString &script, QmlViewer::ScriptOptions options, QmlView *parent); - ~QmlGraphicsTester(); + QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions options, QDeclarativeView *parent); + ~QDeclarativeTester(); + + static void registerTypes(); virtual int duration() const; @@ -225,7 +229,7 @@ private: enum Destination { View, ViewPort }; void addKeyEvent(Destination, QKeyEvent *); void addMouseEvent(Destination, QMouseEvent *); - QmlView *m_view; + QDeclarativeView *m_view; struct MouseEvent { MouseEvent(QMouseEvent *e) @@ -268,9 +272,9 @@ private: QList<FrameEvent> m_savedFrameEvents; bool filterEvents; - QmlViewer::ScriptOptions options; + QDeclarativeViewer::ScriptOptions options; int testscriptidx; - QmlGraphicsVisualTest *testscript; + QDeclarativeVisualTest *testscript; bool hasCompleted; bool hasFailed; diff --git a/tools/qmlviewer/qmlviewer.pro b/tools/qml/qml.pro index aba3cf5..9c9c398 100644 --- a/tools/qmlviewer/qmlviewer.pro +++ b/tools/qml/qml.pro @@ -13,17 +13,17 @@ contains(QT_CONFIG, opengl) { } # Input -HEADERS += qmlviewer.h \ +HEADERS += qmlruntime.h \ proxysettings.h \ qfxtester.h \ deviceorientation.h \ - qmlfolderlistmodel.h + qdeclarativefolderlistmodel.h SOURCES += main.cpp \ - qmlviewer.cpp \ + qmlruntime.cpp \ proxysettings.cpp \ qfxtester.cpp \ - qmlfolderlistmodel.cpp -RESOURCES = qmlviewer.qrc + qdeclarativefolderlistmodel.cpp +RESOURCES = qmlruntime.qrc maemo5 { SOURCES += deviceorientation_maemo.cpp } else { @@ -54,5 +54,5 @@ symbian { TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h LIBS += -lesock -lconnmon -linsock - TARGET.CAPABILITY = NetworkServices + TARGET.CAPABILITY = "All -TCB" } diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qml/qmlruntime.cpp index 626e4c4..7da3f5a 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qml/qmlruntime.cpp @@ -39,18 +39,18 @@ ** ****************************************************************************/ -#include <qmlview.h> +#include <qdeclarativeview.h> #ifdef hz #undef hz #endif #include "ui_recopts.h" -#include "qmlviewer.h" -#include <qmlcontext.h> -#include <qmlengine.h> -#include <qmlnetworkaccessmanagerfactory.h> -#include "qml.h" +#include "qmlruntime.h" +#include <qdeclarativecontext.h> +#include <qdeclarativeengine.h> +#include <qdeclarativenetworkaccessmanagerfactory.h> +#include "qdeclarative.h" #include <private/qperformancelog_p_p.h> #include <private/qabstractanimation_p.h> #include <QAbstractAnimation> @@ -58,7 +58,7 @@ #if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 3)) #include <private/qzipreader_p.h> -#define QMLVIEWER_ZIP_SUPPORT +#define QDECLARATIVEVIEWER_ZIP_SUPPORT #endif #include <QSettings> @@ -69,7 +69,7 @@ #include <QNetworkDiskCache> #include <QNetworkAccessManager> #include <QSignalMapper> -#include <QmlComponent> +#include <QDeclarativeComponent> #include <QWidget> #include <QApplication> #include <QDir> @@ -139,8 +139,6 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(Screen) -QML_DEFINE_TYPE(QmlViewer, 1, 0, Screen, Screen) - QT_BEGIN_NAMESPACE class SizedMenuBar : public QMenuBar @@ -350,7 +348,7 @@ private: mutable QMutex mutex; }; -class NetworkAccessManagerFactory : public QmlNetworkAccessManagerFactory +class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory { public: NetworkAccessManagerFactory() : cookieJar(0), cacheSize(0) {} @@ -427,7 +425,7 @@ public: }; -QString QmlViewer::getVideoFileName() +QString QDeclarativeViewer::getVideoFileName() { QString title = convertAvailable || ffmpegAvailable ? tr("Save Video File") : tr("Save PNG Frames"); QStringList types; @@ -439,7 +437,7 @@ QString QmlViewer::getVideoFileName() } -QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) +QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) #if defined(Q_OS_SYMBIAN) : QMainWindow(parent, flags) #else @@ -475,14 +473,14 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) recdlg->warning->hide(); } - canvas = new QmlView(this); + canvas = new QDeclarativeView(this); canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); - canvas->setResizeMode((!skin || !scaleSkin) ? QmlView::SizeRootObjectToView : QmlView::SizeViewToRootObject); + canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); canvas->setFocus(); QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); - QObject::connect(canvas, SIGNAL(statusChanged(QmlView::Status)), this, SLOT(statusChanged())); + QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged())); QObject::connect(canvas->engine(), SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit())); if (!(flags & Qt::FramelessWindowHint)) { @@ -514,13 +512,13 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) recordTimer.setRepeating(true); } -QmlViewer::~QmlViewer() +QDeclarativeViewer::~QDeclarativeViewer() { canvas->engine()->setNetworkAccessManagerFactory(0); delete namFactory; } -QMenuBar *QmlViewer::menuBar() const +QMenuBar *QDeclarativeViewer::menuBar() const { #if !defined(Q_OS_SYMBIAN) if (!mb) @@ -532,7 +530,7 @@ QMenuBar *QmlViewer::menuBar() const return mb; } -void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) +void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) { QObject *parent = flatmenu ? (QObject*)flatmenu : (QObject*)menu; @@ -686,7 +684,7 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) } } -void QmlViewer::showProxySettings() +void QDeclarativeViewer::showProxySettings() { ProxySettings settingsDlg (this); @@ -695,29 +693,29 @@ void QmlViewer::showProxySettings() settingsDlg.exec(); } -void QmlViewer::proxySettingsChanged() +void QDeclarativeViewer::proxySettingsChanged() { reload (); } -void QmlViewer::setPortrait() +void QDeclarativeViewer::setPortrait() { DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait); portraitOrientation->setChecked(true); } -void QmlViewer::setLandscape() +void QDeclarativeViewer::setLandscape() { DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape); landscapeOrientation->setChecked(true); } -void QmlViewer::toggleOrientation() +void QDeclarativeViewer::toggleOrientation() { DeviceOrientation::instance()->setOrientation(DeviceOrientation::instance()->orientation()==DeviceOrientation::Portrait?DeviceOrientation::Landscape:DeviceOrientation::Portrait); } -void QmlViewer::toggleFullScreen() +void QDeclarativeViewer::toggleFullScreen() { if (isFullScreen()) showMaximized(); @@ -725,25 +723,25 @@ void QmlViewer::toggleFullScreen() showFullScreen(); } -void QmlViewer::setScaleSkin() +void QDeclarativeViewer::setScaleSkin() { if (scaleSkin) return; scaleSkin = true; - canvas->setResizeMode((!skin || !scaleSkin) ? QmlView::SizeRootObjectToView : QmlView::SizeViewToRootObject); + canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); if (skin) { canvas->setFixedSize(canvas->sizeHint()); skin->setScreenSize(canvas->sizeHint()); } } -void QmlViewer::setScaleView() +void QDeclarativeViewer::setScaleView() { if (!scaleSkin) return; scaleSkin = false; if (skin) { - canvas->setResizeMode((!skin || !scaleSkin) ? QmlView::SizeRootObjectToView : QmlView::SizeViewToRootObject); + canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); canvas->setMinimumSize(QSize(0,0)); canvas->setMaximumSize(QSize(16777215,16777215)); canvas->resize(skin->standardScreenSize()); @@ -752,7 +750,7 @@ void QmlViewer::setScaleView() } -void QmlViewer::takeSnapShot() +void QDeclarativeViewer::takeSnapShot() { static int snapshotcount = 1; QString snapFileName = QString(QLatin1String("snapshot%1.png")).arg(snapshotcount); @@ -761,14 +759,14 @@ void QmlViewer::takeSnapShot() ++snapshotcount; } -void QmlViewer::pickRecordingFile() +void QDeclarativeViewer::pickRecordingFile() { QString fileName = getVideoFileName(); if (!fileName.isEmpty()) recdlg->file->setText(fileName); } -void QmlViewer::chooseRecordingOptions() +void QDeclarativeViewer::chooseRecordingOptions() { // File recdlg->file->setText(record_file); @@ -827,7 +825,7 @@ void QmlViewer::chooseRecordingOptions() } } -void QmlViewer::toggleRecordingWithSelection() +void QDeclarativeViewer::toggleRecordingWithSelection() { if (!recordTimer.isRunning()) { if (record_file.isEmpty()) { @@ -842,7 +840,7 @@ void QmlViewer::toggleRecordingWithSelection() toggleRecording(); } -void QmlViewer::toggleRecording() +void QDeclarativeViewer::toggleRecording() { if (record_file.isEmpty()) { toggleRecordingWithSelection(); @@ -853,24 +851,24 @@ void QmlViewer::toggleRecording() setRecording(recording); } -void QmlViewer::setSlowMode(bool enable) +void QDeclarativeViewer::setSlowMode(bool enable) { QUnifiedTimer::instance()->setSlowModeEnabled(enable); } -void QmlViewer::addLibraryPath(const QString& lib) +void QDeclarativeViewer::addLibraryPath(const QString& lib) { canvas->engine()->addImportPath(lib); } -void QmlViewer::reload() +void QDeclarativeViewer::reload() { openQml(currentFileOrUrl); } -void QmlViewer::open(const QString& doc) +void QDeclarativeViewer::open(const QString& doc) { -#ifdef QMLVIEWER_ZIP_SUPPORT +#ifdef QDECLARATIVEVIEWER_ZIP_SUPPORT if (doc.endsWith(".wgt",Qt::CaseInsensitive) || doc.endsWith(".wgz",Qt::CaseInsensitive) || doc.endsWith(".zip",Qt::CaseInsensitive)) @@ -880,10 +878,10 @@ void QmlViewer::open(const QString& doc) openQml(doc); } -void QmlViewer::openWgt(const QString& doc) +void QDeclarativeViewer::openWgt(const QString& doc) { -#ifdef QMLVIEWER_ZIP_SUPPORT - // XXX This functionality could be migrated to QmlView once refined +#ifdef QDECLARATIVEVIEWER_ZIP_SUPPORT + // XXX This functionality could be migrated to QDeclarativeView once refined QUrl url(doc); if (url.isRelative()) @@ -896,7 +894,7 @@ void QmlViewer::openWgt(const QString& doc) #endif } -#ifdef QMLVIEWER_ZIP_SUPPORT +#ifdef QDECLARATIVEVIEWER_ZIP_SUPPORT static void removeRecursive(const QString& dirname) { QDir dir(dirname); @@ -910,9 +908,9 @@ static void removeRecursive(const QString& dirname) } #endif -void QmlViewer::unpackWgt() +void QDeclarativeViewer::unpackWgt() { -#ifdef QMLVIEWER_ZIP_SUPPORT +#ifdef QDECLARATIVEVIEWER_ZIP_SUPPORT QByteArray all = wgtreply->readAll(); QBuffer buf(&all); buf.open(QIODevice::ReadOnly); @@ -923,7 +921,7 @@ void QmlViewer::unpackWgt() qDebug() << "zip:" << info.filePath; } */ - wgtdir = QDir::tempPath()+QDir::separator()+QLatin1String("qmlviewer-wgt"); + wgtdir = QDir::tempPath()+QDir::separator()+QLatin1String("qml-wgt"); removeRecursive(wgtdir); QDir().mkpath(wgtdir); zip.extractAll(wgtdir); @@ -969,7 +967,7 @@ void QmlViewer::unpackWgt() #endif } -void QmlViewer::openFile() +void QDeclarativeViewer::openFile() { QString cur = canvas->source().toLocalFile(); if (useQmlFileBrowser) { @@ -983,21 +981,21 @@ void QmlViewer::openFile() } } -void QmlViewer::statusChanged() +void QDeclarativeViewer::statusChanged() { - if (canvas->status() == QmlView::Error && tester) + if (canvas->status() == QDeclarativeView::Error && tester) tester->executefailure(); - if (canvas->status() == QmlView::Ready) + if (canvas->status() == QDeclarativeView::Ready) resize(sizeHint()); } -void QmlViewer::launch(const QString& file_or_url) +void QDeclarativeViewer::launch(const QString& file_or_url) { QMetaObject::invokeMethod(this, "openQml", Qt::QueuedConnection, Q_ARG(QString, file_or_url)); } -void QmlViewer::openQml(const QString& file_or_url) +void QDeclarativeViewer::openQml(const QString& file_or_url) { currentFileOrUrl = file_or_url; @@ -1010,11 +1008,11 @@ void QmlViewer::openQml(const QString& file_or_url) setWindowTitle(tr("%1 - Qt Declarative UI Viewer").arg(file_or_url)); if (!m_script.isEmpty()) - tester = new QmlGraphicsTester(m_script, m_scriptOptions, canvas); + tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas); delete canvas->rootObject(); canvas->engine()->clearComponentCache(); - QmlContext *ctxt = canvas->rootContext(); + QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("qmlViewer", this); #ifdef Q_OS_SYMBIAN ctxt->setContextProperty("qmlViewerFolder", "E:\\"); // Documents on your S60 phone @@ -1027,7 +1025,7 @@ void QmlViewer::openQml(const QString& file_or_url) QFileInfo fi(fileName); if (fi.exists()) { if (fi.suffix().toLower() != QLatin1String("qml")) { - qWarning() << "qmlviewer cannot open non-QML file" << fileName; + qWarning() << "qml cannot open non-QML file" << fileName; return; } @@ -1038,13 +1036,13 @@ void QmlViewer::openQml(const QString& file_or_url) QFile f(dir.filePath(qml)); f.open(QIODevice::ReadOnly); QByteArray data = f.readAll(); - QmlComponent comp(canvas->engine()); + QDeclarativeComponent comp(canvas->engine()); comp.setData(data, QUrl()); QObject *dummyData = comp.create(); if(comp.isError()) { - QList<QmlError> errors = comp.errors(); - foreach (const QmlError &error, errors) { + QList<QDeclarativeError> errors = comp.errors(); + foreach (const QDeclarativeError &error, errors) { qWarning() << error; } if (tester) tester->executefailure(); @@ -1058,16 +1056,16 @@ void QmlViewer::openQml(const QString& file_or_url) } } } else { - qWarning() << "qmlviewer cannot find file:" << fileName; + qWarning() << "qml cannot find file:" << fileName; return; } } - canvas->setSource(url); - QTime t; t.start(); - canvas->execute(); + + canvas->setSource(url); + qWarning() << "Wall startup time:" << t.elapsed(); if (!skin) { @@ -1090,14 +1088,14 @@ void QmlViewer::openQml(const QString& file_or_url) #endif } -void QmlViewer::startNetwork() +void QDeclarativeViewer::startNetwork() { #if defined(SYMBIAN_NETWORK_INIT) qt_SetDefaultIap(); #endif } -QStringList QmlViewer::builtinSkins() const +QStringList QDeclarativeViewer::builtinSkins() const { QDir dir(":/skins/","*.skin"); const QFileInfoList l = dir.entryInfoList(); @@ -1108,7 +1106,7 @@ QStringList QmlViewer::builtinSkins() const return r; } -void QmlViewer::setSkin(const QString& skinDirOrName) +void QDeclarativeViewer::setSkin(const QString& skinDirOrName) { QString skinDirectory = skinDirOrName; @@ -1130,7 +1128,7 @@ void QmlViewer::setSkin(const QString& skinDirOrName) skin->deleteLater(); } - canvas->setResizeMode((!skin || !scaleSkin) ? QmlView::SizeRootObjectToView : QmlView::SizeViewToRootObject); + canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); DeviceSkinParameters parameters; if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { @@ -1170,7 +1168,7 @@ void QmlViewer::setSkin(const QString& skinDirOrName) canvas->show(); } -void QmlViewer::setAutoRecord(int from, int to) +void QDeclarativeViewer::setAutoRecord(int from, int to) { if (from==0) from=1; // ensure resized record_autotime = to-from; @@ -1178,22 +1176,22 @@ void QmlViewer::setAutoRecord(int from, int to) autoStartTimer.setRunning(true); } -void QmlViewer::setRecordArgs(const QStringList& a) +void QDeclarativeViewer::setRecordArgs(const QStringList& a) { record_args = a; } -void QmlViewer::setRecordFile(const QString& f) +void QDeclarativeViewer::setRecordFile(const QString& f) { record_file = f; } -void QmlViewer::setRecordRate(int fps) +void QDeclarativeViewer::setRecordRate(int fps) { record_rate = fps; } -void QmlViewer::sceneResized(QSize size) +void QDeclarativeViewer::sceneResized(QSize size) { if (size.width() > 0 && size.height() > 0) { if (skin && scaleSkin) @@ -1201,7 +1199,7 @@ void QmlViewer::sceneResized(QSize size) } } -void QmlViewer::keyPressEvent(QKeyEvent *event) +void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_0 && devicemode) exit(0); @@ -1242,7 +1240,7 @@ void QmlViewer::keyPressEvent(QKeyEvent *event) QWidget::keyPressEvent(event); } -void QmlViewer::senseImageMagick() +void QDeclarativeViewer::senseImageMagick() { QProcess proc; proc.start("convert", QStringList() << "-h"); @@ -1251,7 +1249,7 @@ void QmlViewer::senseImageMagick() convertAvailable = help.contains("ImageMagick"); } -void QmlViewer::senseFfmpeg() +void QDeclarativeViewer::senseFfmpeg() { QProcess proc; proc.start("ffmpeg", QStringList() << "-h"); @@ -1273,7 +1271,7 @@ void QmlViewer::senseFfmpeg() connect(recdlg->ffmpegHelp,SIGNAL(clicked()), ffmpegHelpWindow, SLOT(show())); } -void QmlViewer::setRecording(bool on) +void QDeclarativeViewer::setRecording(bool on) { if (on == recordTimer.isRunning()) return; @@ -1398,24 +1396,24 @@ void QmlViewer::setRecording(bool on) qDebug() << "Recording: " << (recordTimer.isRunning()?"ON":"OFF"); } -void QmlViewer::ffmpegFinished(int code) +void QDeclarativeViewer::ffmpegFinished(int code) { qDebug() << "ffmpeg returned" << code << frame_stream->readAllStandardError(); } -void QmlViewer::autoStartRecording() +void QDeclarativeViewer::autoStartRecording() { setRecording(true); autoStopTimer.setInterval(record_autotime); autoStopTimer.setRunning(true); } -void QmlViewer::autoStopRecording() +void QDeclarativeViewer::autoStopRecording() { setRecording(false); } -void QmlViewer::recordFrame() +void QDeclarativeViewer::recordFrame() { canvas->QWidget::render(&frame); if (frame_stream) { @@ -1431,17 +1429,17 @@ void QmlViewer::recordFrame() } } -void QmlViewer::setDeviceKeys(bool on) +void QDeclarativeViewer::setDeviceKeys(bool on) { devicemode = on; } -void QmlViewer::setNetworkCacheSize(int size) +void QDeclarativeViewer::setNetworkCacheSize(int size) { namFactory->setCacheSize(size); } -void QmlViewer::setUseGL(bool useGL) +void QDeclarativeViewer::setUseGL(bool useGL) { #ifdef GL_SUPPORTED if (useGL) { @@ -1455,11 +1453,16 @@ void QmlViewer::setUseGL(bool useGL) #endif } -void QmlViewer::setUseNativeFileBrowser(bool use) +void QDeclarativeViewer::setUseNativeFileBrowser(bool use) { useQmlFileBrowser = !use; } +void QDeclarativeViewer::registerTypes() +{ + QML_REGISTER_TYPE(QDeclarativeViewer, 1, 0, Screen, Screen); +} + QT_END_NAMESPACE -#include "qmlviewer.moc" +#include "qmlruntime.moc" diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qml/qmlruntime.h index c7f87ed..01777bd 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qml/qmlruntime.h @@ -39,28 +39,28 @@ ** ****************************************************************************/ -#ifndef QMLVIEWER_H -#define QMLVIEWER_H +#ifndef QDECLARATIVEVIEWER_H +#define QDECLARATIVEVIEWER_H #include <QMainWindow> #include <QMenuBar> -#include <private/qmltimer_p.h> +#include <private/qdeclarativetimer_p.h> #include <QTime> #include <QList> QT_BEGIN_NAMESPACE -class QmlView; +class QDeclarativeView; class PreviewDeviceSkin; -class QmlGraphicsTestEngine; +class QDeclarativeTestEngine; class QProcess; class RecordingDialog; -class QmlGraphicsTester; +class QDeclarativeTester; class QNetworkReply; class QNetworkCookieJar; class NetworkAccessManagerFactory; -class QmlViewer +class QDeclarativeViewer #if defined(Q_OS_SYMBIAN) : public QMainWindow #else @@ -69,8 +69,10 @@ class QmlViewer { Q_OBJECT public: - QmlViewer(QWidget *parent=0, Qt::WindowFlags flags=0); - ~QmlViewer(); + QDeclarativeViewer(QWidget *parent=0, Qt::WindowFlags flags=0); + ~QDeclarativeViewer(); + + static void registerTypes(); enum ScriptOption { Play = 0x00000001, @@ -144,15 +146,15 @@ private: PreviewDeviceSkin *skin; QSize skinscreensize; - QmlView *canvas; + QDeclarativeView *canvas; QString currentFileOrUrl; - QmlTimer recordTimer; + QDeclarativeTimer recordTimer; QString frame_fmt; QImage frame; QList<QImage*> frames; QProcess* frame_stream; - QmlTimer autoStartTimer; - QmlTimer autoStopTimer; + QDeclarativeTimer autoStartTimer; + QDeclarativeTimer autoStopTimer; QString record_dither; QString record_file; QSize record_outsize; @@ -177,7 +179,7 @@ private: QString m_script; ScriptOptions m_scriptOptions; - QmlGraphicsTester *tester; + QDeclarativeTester *tester; QNetworkReply *wgtreply; QString wgtdir; @@ -186,7 +188,7 @@ private: bool useQmlFileBrowser; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QmlViewer::ScriptOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeViewer::ScriptOptions) QT_END_NAMESPACE diff --git a/tools/qmlviewer/qmlviewer.qrc b/tools/qml/qmlruntime.qrc index 3a9e608..3a9e608 100644 --- a/tools/qmlviewer/qmlviewer.qrc +++ b/tools/qml/qmlruntime.qrc diff --git a/tools/qmlviewer/recopts.ui b/tools/qml/recopts.ui index ce2da30..ce2da30 100644 --- a/tools/qmlviewer/recopts.ui +++ b/tools/qml/recopts.ui diff --git a/tools/qtestlib/wince/cetest/cetest.pro b/tools/qtestlib/wince/cetest/cetest.pro index 5cd52cf..6b6b02a 100644 --- a/tools/qtestlib/wince/cetest/cetest.pro +++ b/tools/qtestlib/wince/cetest/cetest.pro @@ -18,7 +18,7 @@ DEFINES += QT_BUILD_QMAKE QT_BOOTSTRAPPED QT_NO_CODECS QT_LITE_UNICODE QT INCLUDEPATH = \ $$QT_SOURCE_TREE/tools/qtestlib/ce/cetest \ $$QT_SOURCE_TREE/qmake \ - $$QT_SOURCE_TREE/qmake/generators/symbian \ + $$QT_SOURCE_TREE/tools/shared \ $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ $$QT_BUILD_TREE/src/corelib/global diff --git a/tools/qtestlib/wince/cetest/qmake_include.pri b/tools/qtestlib/wince/cetest/qmake_include.pri index aa32653..8b415b0 100644 --- a/tools/qtestlib/wince/cetest/qmake_include.pri +++ b/tools/qtestlib/wince/cetest/qmake_include.pri @@ -5,5 +5,7 @@ SOURCES += \ $$QT_SOURCE_TREE/qmake/option.cpp \ $$QT_SOURCE_TREE/qmake/project.cpp \ $$QT_SOURCE_TREE/qmake/property.cpp \ - $$QT_SOURCE_TREE/qmake/generators/symbian/initprojectdeploy_symbian.cpp + $$QT_SOURCE_TREE/qmake/generators/symbian/initprojectdeploy_symbian.cpp \ + $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \ + $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp diff --git a/tools/tools.pro b/tools/tools.pro index d5569b6..3ed07b1 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -26,7 +26,7 @@ mac { embedded:SUBDIRS += kmap2qmap -contains(QT_CONFIG, declarative):SUBDIRS += qmlviewer +contains(QT_CONFIG, declarative):SUBDIRS += qml contains(QT_CONFIG, dbus):SUBDIRS += qdbus !wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator embedded: SUBDIRS += makeqpf |