diff --git a/dist/changes-2.0.1 b/dist/changes-2.0.1 index ba610a70a11..d3363619179 100644 --- a/dist/changes-2.0.1 +++ b/dist/changes-2.0.1 @@ -5,24 +5,67 @@ within the logs of Qt Creator's sources. Simply check it out from the public git repository e.g., git clone git://gitorious.org/qt-creator/qt-creator.git -git log --cherry-pick --pretty=oneline v2.0.0...v2.0.1 +git log --cherry-pick --pretty=oneline origin/2.0.0...origin/2.0.1 -General +General: * Fix the suggested path in the new dialog in case of sub projects * Search dialog now opens the completion box for the search term on cursor down - * Fix Mercurial plugin (QTCREATORBUG-1503) + * The .bin postfix was removed from the qtcreator executable -Editing +Editing: + * Fixed disabled "Open with" context menu in project tree + * CodePaster: Do not show popup about modified files on Windows * FakeVim: Fix issues with non-letter keys on non-US keyboards * FakeVim: Fix performance of find/replace - * Fixed disabled "Open with" context menu in project tree. + * Fakevim: Fix mark interpretion for d'a etc + * Fakevim: clear opcount and mvcount on escape + * Fakevim: fix Delete key in command mode + * Fakevim: fix backspace in the presence of physical tabs + * Fakevim: fix insert of Tabs and up/down movement in the presence of real tabs + * Fakevim: fix mark positions after + * Fakevim: make Ctrl-V and Ctrl-V work in Insert and Ex mode + * BinEditor: Add "jump to address" functionality + * BinEditor: Add a bit of value interpretation + * BinEditor: Fix cursor position label + * BinEditor: Fix file name not being displayed + * BinEditor: Implement "Jump to start/end of file" for lazy data + * QmlDesigner: Fix crash when typing keywords as Ids + * QmlDesigner: Fix import handling in rewriter + * QmlDesigner: Prevent freezing while doing drag&drop on some Windows systems + * QML snippet: property has a name and a value, not two names + * QmlJS: Avoid infinite recursion when encountering property loops + * QmlJS: Make variables in imported JS documents show up in completion + * QmlJS: Remove spurious spaces from default import path in qmlproject + * Qt Designer integration: Fix Help button in stylesheet editor + * QuickDesigner: Make metainfo system robust for different version numbers + * QuickDesigner: Reduce numbers of redraws / state switching in States Editor -C++ Support +C++ Support: + * Added C-style comment folding + * Fix crash while renaming symbol when a symbol is being renamed -Project support +VCS Support: + * Diff editors: Set readonly attributes correctly + * Mercurial: Working directory not set for asynchronous commands + * Subversion: Remove LANG=C setting + * git: Adapt to 1.7.0, handling of renamed files. Reviewed-by: con + +Project support: * Fix auto-scrolling in application and compile output + * Cmake: Don't delete run configurations on switching buildconfigurations + * Ask to save all editors before running qmake + * Allow the user to set the version number used for the build deb package + * Don't crash if the session node is the current node in context menu + * Fix DESTDIR=. case + * Don't reset build directory for clone cmake buildconfigurations + * Don't show the full file name in the reload prompt by default + * Fix crash for newly added project nodes + * Improve task parsing + * Fixes: New Project action didn't respect the default project location -Debugging +Debugging: + * Fix 2.0 regression: QObject property display + * Speed up cdb debugging helper initialization * Fix display of certain structures within containers * Fix display of typedefs of typedefs of simple types such as qulonglong * Fix behaviour of 'step' and 'next' when a lower frame was selected @@ -30,17 +73,70 @@ Debugging * Improve gdb version string parsing * Fix that the newest version of compiled debugging helper was not used if there was an older version still was around in a different search path + * Windows[gdb]: Fix Attach to running (gui) process + * Fix 2.0 regression: allow assignment to structure members + * Always switch to frame 0 before trying to leave frame + * Cache results of gdb.lookup_type to increase performance + * Finish "Launching" bar even if we don't hit a "^running" + * Fix 2.0 regression: 'jump to line' and 'run to line' with older versions of gdb + * Fix decoding of %04x encoded 16 bit big endian data + * Fix 2.0 regression: display of typedefs-of-typedefs, such as qulonglong + * Fix 2.0 regression: list of members in case gdb reports '_class_ SomeClass' + * Handle gdb 7.1.50's thread-group-started 'pid' field + * Fix python dumper for std::vector + * Improve robustness in the presence of outdated debug information + * Make ctrl-click to navigate between input and output pane (much) faster + * Switch off reverse debugging tool button if not useful + * Fix reporting of loaded libraries on Symbian devices + * Fix late crash when closing Creator while building debugging helper (QTCREATORBUG-1576) -Platform Specific +QML/JS Support: + * New QmlDesigner + * Allows visual manipulation of .qml files + * Supports changing top-level states + * Integrates tighly with text editor, e.g. shared history, navigation facilities .. -Mac +Documentation: + * Add description of the Use debug versions of Frameworks option + * Add descriptions for new Maemo packaging options + * Add info about layouts to the example + * Add information about unlocking views in Debug mode + * Add qtquick to defines to display Qt Quick information + * Add tips and tricks + * Edit the introduction -Linux (GNOME and KDE) +Translations: + * Update Japanese translation + * Update Russian translation + * Update Slovenian translation + * Update German translation + * Add Simplified Chinese translation + * Add French translation, done by the developpez.com team -Windows +Mac specific: + * Save maemo device configuration on MacOS + +Linux specific: + +Windows specific: * Fixed that some menu items got disabled during keyboard navigation + * Fix wildcard expansion, etc. under windows * Detect Microsoft Visual Studio 2010 * Fixed handling of usernames with Cyrillic characters (QTCREATORBUG-1643) -Additional credits go to: +Maemo specific: + * Fix Qemu start on Mac + * Fix building projects if MADDE is on a different drive then the project + * Fix access rights for remote .ssh directory + * Fix end-of-process detection + * Fix incorrect assumption about build directory + * Make device configuration id type consistent + * Make packaging step optional +Symbian specific: + * Symbian support is no longer experimental + * Symbian/trk: Don't try to dereference references + * Symbian/trk: Fix handling of partial frames + * Small improvements to the abld parser + * Use outputparsers when creating S60 packages + * Improve detection of simulator Qts diff --git a/dist/changes-2.1.0 b/dist/changes-2.1.0 index 41d204e81d8..dc29b74f4b1 100644 --- a/dist/changes-2.1.0 +++ b/dist/changes-2.1.0 @@ -5,11 +5,10 @@ within the logs of Qt Creator sources. Simply check it out from the public git repository. For example: git clone git://gitorious.org/qt-creator/qt-creator.git -git log --cherry-pick --pretty=oneline v2.0.0...v2.0.1 +git log --cherry-pick --pretty=oneline v2.1.0...v2.0.1 General - * - * + * Made search result panel searchable Editing @@ -17,21 +16,67 @@ C++ Support * Added semantic highlighting of types, virtual methods, locals, statics and member variables (only enabled when running against Qt 4.7.1 and up, for performance reasons) + * Add new indenter along with a new option to control alignment indents * Add new %FILENAME%, %CLASS% placeholders to license template + * Added searching for symbols that match a pattern to advanced find + * Made 'Follow symbol' for classes skip forward declarations Project Support - * Add option for adding subprojects to projects in the New wizard - * Add context-menu command for removing subprojects in the Edit mode, + * Added option for adding subprojects to projects in the New wizard + * Added context-menu command for removing subprojects in the Edit mode, Projects view - * Add a wizard for adding other than Qt libraries to project files + * Added a wizard for adding other than Qt libraries to project files Debugging - * Fix console debugging with MinGW/gdb - * Symbian: Add basic thread support, improve logging + * Fixed splitter inconsistency of debugger tool bar + * Fixed console debugging with MinGW/gdb + * Symbian: Added basic thread support, improve logging + * New dumpers for QDate, QTime, QHostAddress, QRegion, boost::optional, + QSharedData and QSharedDataPointer + * Improved/fixed dumpers for QObject (include user defined properties), QList, + C-style arrays, QSize, QSizeF, QImage/QPixmap, std::vector, + QVariant(QString), qulonglong, std::size_t, std::ptrdiff_t, + QScopedPointer, QStandardItem + * Performance improvements due to use of dwarf index data to reduce gdb + startup time, use of new gdb.read_memory for QByteArray and QString display + * Debugger framework handles multiple debugging sessions in parallel + * Allow per item and/or type selection of display method in Locals&Watchers + * Implement data watchpoints + * Implement a debugger engine to debug Python scripts + * Direct remote debugging using -debug binary@host:port[@arch] on the command line + * Make alphabetic sorting of struct members optional + * New Add/Edit breakpoint dialog + * Show QThread object names in threads view + * Support for per-thread breakpoints + * Show dynamic type of objects for gdb versions newer than Aug 31, 2010 + * [etc] Help QML/JS Support + * Added 'Find usages' action that works on ids, properties, functions and + variables + * Improved 'Follow symbol' to also work on file imports and JS functions + * Completion: Sort completion items by relevance + * Completion: Automatically complete trailing : or . + * Added new indenter + * Added code folding for multiline comments + * Improved performance of the code model significantly + * Added Qt Quick ToolBar + +FakeVim: + * Fix indentation of first line after >iB and >ib, undo after cjaaa, ~ etc + * Implement :mak, :nohlsearch, :only, :reg[isters], Ctrl-J, Ctrl-N, Ctrl-P, + * Implement [(, ]), [{, ]}, some of the :bn/bp commands + * Implement {}/[]/<>-block text objects + * Make :q after :sp more vim-ish, make etc work in mappings + * Make Searching a 'sub-sub-mode' to allow d/ + * Make recognition of ex command names similar to vi's + * Move "status line" to the main statusbar + * Refactor searching for less random jumps and more speed + * Rework line ranges and support for marks + * Use basetext cursor handling and indentation support for better integration + * [etc] Platform Specific @@ -44,27 +89,35 @@ Windows Symbian Target Maemo Target + * Improved support for Debian packaging: + - Automatic creation of Debian files in project directory + - Debian files adaptable by users + * Deployment information is taken from .pro file's INSTALLS variable + * Support for "subdirs" and library project types + * Projects created by mobile wizards are now usable for Maemo development + * Automatic creation and deployment of Desktop files for application projects + * Fremantle: Support for exporting host directories to the device (also employed for zero-copy deployment) Designer - * Add switching between code and forms using Shift-F4 - * Various improvements to mode switching + * Added switching between code and forms using Shift-F4 + * Made various improvements to mode switching Version control plugins * Support git version 1.7.x - * Add support for git --amend - * Make it possible to run gitk from Qt Creator - * Improve commit window, show number of files to be committed, add context + * Added support for git --amend + * Made it possible to run gitk from Qt Creator + * Improved commit window, show number of files to be committed, add context menu for quickly checking and unchecking all files - * Add branch selector to the git checkout wizard - * Add support for the CVS 'edit' functionality, make Qt Creator prompt to + * Added branch selector to the git checkout wizard + * Added support for the CVS 'edit' functionality, make Qt Creator prompt to request a read-only file using 'cvs edit' (cvsnt only). - * Perforce: Add setting to automatically open read-only files + * Perforce: Added setting to automatically open read-only files Wizards - * Custom wizard: Enhance template processing of wizards to be able to include + * Custom wizard: Enhanced template processing of wizards to be able to include sections of files conditionally, extend functionality of combo control to be able to handle user-displayable strings and keywords - * Custom wizard: Add ability to have files generated by scripts + * Custom wizard: Added ability to have files generated by scripts Additional credits go to: diff --git a/doc/examples/batteryindicator/BatteryIndicator.desktop b/doc/examples/batteryindicator/BatteryIndicator.desktop new file mode 100644 index 00000000000..84e6ad1429f --- /dev/null +++ b/doc/examples/batteryindicator/BatteryIndicator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=BatteryIndicator +Exec=/opt/usr/bin/BatteryIndicator +Icon=BatteryIndicator +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/doc/examples/batteryindicator/BatteryIndicator.png b/doc/examples/batteryindicator/BatteryIndicator.png new file mode 100644 index 00000000000..707d5c4e85d Binary files /dev/null and b/doc/examples/batteryindicator/BatteryIndicator.png differ diff --git a/doc/examples/batteryindicator/BatteryIndicator.pro b/doc/examples/batteryindicator/BatteryIndicator.pro index da30a71a4b6..dd26e70344f 100644 --- a/doc/examples/batteryindicator/BatteryIndicator.pro +++ b/doc/examples/batteryindicator/BatteryIndicator.pro @@ -1,28 +1,32 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2010-05-26T16:46:58 -# -#------------------------------------------------- +# Add files and directories to ship with the application +# by adapting the examples below. +# file1.source = myfile +# dir1.source = mydir +DEPLOYMENTFOLDERS = # file1 dir1 -QT += core gui +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK -TARGET = BatteryIndicator -TEMPLATE = app +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS - -SOURCES += main.cpp\ - batteryindicator.cpp - -HEADERS += batteryindicator.h - -FORMS += batteryindicator.ui +symbian:TARGET.UID3 = 0xE5123A52 CONFIG += mobility MOBILITY = systeminfo -symbian { - TARGET.UID3 = 0xecbd72d7 - # TARGET.CAPABILITY += - TARGET.EPOCSTACKSIZE = 0x14000 - TARGET.EPOCHEAPSIZE = 0x020000 0x800000 -} +SOURCES += main.cpp mainwindow.cpp +HEADERS += mainwindow.h +FORMS += mainwindow.ui + +# Please do not modify the following two lines. Required for deployment. +include(deployment.pri) +qtcAddDeployment() + +OTHER_FILES += \ + debian/changelog \ + debian/compat \ + debian/control \ + debian/copyright \ + debian/README \ + debian/rules diff --git a/doc/examples/batteryindicator/BatteryIndicator.svg b/doc/examples/batteryindicator/BatteryIndicator.svg new file mode 100644 index 00000000000..566acfada01 --- /dev/null +++ b/doc/examples/batteryindicator/BatteryIndicator.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/batteryindicator/batteryindicator.cpp b/doc/examples/batteryindicator/batteryindicator.cpp deleted file mode 100644 index 8ddb69590a6..00000000000 --- a/doc/examples/batteryindicator/batteryindicator.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "batteryindicator.h" -#include "ui_batteryindicator.h" - -//! [2] -BatteryIndicator::BatteryIndicator(QWidget *parent) : - QDialog(parent), - ui(new Ui::BatteryIndicator), - deviceInfo(NULL) -{ - ui->setupUi(this); - setupGeneral(); -} -//! [2] - -BatteryIndicator::~BatteryIndicator() -{ - delete ui; -} - -//! [1] -void BatteryIndicator::setupGeneral() -{ - deviceInfo = new QSystemDeviceInfo(this); - - ui->batteryLevelBar->setValue(deviceInfo->batteryLevel()); - - connect(deviceInfo, SIGNAL(batteryLevelChanged(int)), - ui->batteryLevelBar, SLOT(setValue(int))); -} -//! [1] diff --git a/doc/examples/batteryindicator/batteryindicator.h b/doc/examples/batteryindicator/batteryindicator.h deleted file mode 100644 index 50a1b93bd62..00000000000 --- a/doc/examples/batteryindicator/batteryindicator.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef BATTERYINDICATOR_H -#define BATTERYINDICATOR_H - -#include - -//! [1] -#include -//! [1] - -//! [2] -QTM_USE_NAMESPACE -//! [2] - -namespace Ui { - class BatteryIndicator; -} - -class BatteryIndicator : public QDialog -{ - Q_OBJECT - -public: - explicit BatteryIndicator(QWidget *parent = 0); - ~BatteryIndicator(); - -//! [3] -private: - Ui::BatteryIndicator *ui; - void setupGeneral(); - - QSystemDeviceInfo *deviceInfo; -//! [3] -}; - -#endif // BATTERYINDICATOR_H diff --git a/doc/examples/batteryindicator/batteryindicator.ui b/doc/examples/batteryindicator/batteryindicator.ui deleted file mode 100644 index 3e62af26ae1..00000000000 --- a/doc/examples/batteryindicator/batteryindicator.ui +++ /dev/null @@ -1,33 +0,0 @@ - - - BatteryIndicator - - - - 0 - 0 - 800 - 480 - - - - BatteryIndicator - - - - - 10 - 10 - 118 - 23 - - - - 24 - - - - - - - diff --git a/doc/examples/batteryindicator/debian/README b/doc/examples/batteryindicator/debian/README new file mode 100644 index 00000000000..69fa63a59c5 --- /dev/null +++ b/doc/examples/batteryindicator/debian/README @@ -0,0 +1,6 @@ +The Debian Package batteryindicator +---------------------------- + +Comments regarding the Package + + -- unknown <> Tue, 05 Oct 2010 12:01:24 +0200 diff --git a/doc/examples/batteryindicator/debian/changelog b/doc/examples/batteryindicator/debian/changelog new file mode 100644 index 00000000000..ff9ebf3ec70 --- /dev/null +++ b/doc/examples/batteryindicator/debian/changelog @@ -0,0 +1,5 @@ +batteryindicator (0.0.1) unstable; urgency=low + + * Initial Release. + + -- unknown <> Tue, 05 Oct 2010 12:01:24 +0200 diff --git a/doc/examples/batteryindicator/debian/compat b/doc/examples/batteryindicator/debian/compat new file mode 100644 index 00000000000..7f8f011eb73 --- /dev/null +++ b/doc/examples/batteryindicator/debian/compat @@ -0,0 +1 @@ +7 diff --git a/doc/examples/batteryindicator/debian/control b/doc/examples/batteryindicator/debian/control new file mode 100644 index 00000000000..a414f056825 --- /dev/null +++ b/doc/examples/batteryindicator/debian/control @@ -0,0 +1,13 @@ +Source: batteryindicator +Section: user/hidden +Priority: optional +Maintainer: unknown <> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: + +Package: batteryindicator +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: + diff --git a/doc/examples/batteryindicator/debian/copyright b/doc/examples/batteryindicator/debian/copyright new file mode 100644 index 00000000000..3656176d071 --- /dev/null +++ b/doc/examples/batteryindicator/debian/copyright @@ -0,0 +1,40 @@ +This package was debianized by unknown <> on +Tue, 05 Oct 2010 12:01:24 +0200. + +It was downloaded from + +Upstream Author(s): + + + + +Copyright: + + + + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, unknown <> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/doc/examples/batteryindicator/debian/rules b/doc/examples/batteryindicator/debian/rules new file mode 100644 index 00000000000..69d5d226dd5 --- /dev/null +++ b/doc/examples/batteryindicator/debian/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/batteryindicator.sgml > batteryindicator.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/batteryindicator. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/batteryindicator install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/doc/examples/batteryindicator/deployment.pri b/doc/examples/batteryindicator/deployment.pri new file mode 100644 index 00000000000..7b7f7280fad --- /dev/null +++ b/doc/examples/batteryindicator/deployment.pri @@ -0,0 +1,93 @@ +# checksum 0x2bb3 version 0x10001 +# This file should not be edited. +# Future versions of Qt Creator might offer updated versions of this file. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -leiksrv -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/doc/examples/batteryindicator/main.cpp b/doc/examples/batteryindicator/main.cpp index 4d85d5cdc76..4476d2fdc91 100644 --- a/doc/examples/batteryindicator/main.cpp +++ b/doc/examples/batteryindicator/main.cpp @@ -1,18 +1,23 @@ +#include "mainwindow.h" + #include -#include "batteryindicator.h" int main(int argc, char *argv[]) { - QApplication a(argc, argv); - BatteryIndicator w; + QApplication app(argc, argv); + + MainWindow mainWindow; + mainWindow.setOrientation(MainWindow::Auto); //! [0] -#if defined(Q_WS_S60) - w.showMaximized(); +#ifdef Q_OS_SYMBIAN + mainWindow.showFullScreen(); +#elif defined(Q_WS_MAEMO_5) + mainWindow.showMaximized(); #else - w.show(); + mainWindow.show(); #endif //! [0] - return a.exec(); + return app.exec(); } diff --git a/doc/examples/batteryindicator/mainwindow.cpp b/doc/examples/batteryindicator/mainwindow.cpp new file mode 100644 index 00000000000..82263cf9be2 --- /dev/null +++ b/doc/examples/batteryindicator/mainwindow.cpp @@ -0,0 +1,77 @@ +// checksum 0xd429 version 0x10001 +#include "mainwindow.h" +#include "ui_mainwindow.h" + +#include + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include +#include +#include +#include +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +//! [2] +MainWindow::MainWindow(QWidget *parent): + QMainWindow(parent), + ui(new Ui::MainWindow), + deviceInfo(NULL) +{ + ui->setupUi(this); + setupGeneral(); +} +//! [2] + +MainWindow::~MainWindow() +{ + delete ui; +} + +//! [1] +void MainWindow::setupGeneral() +{ + deviceInfo = new QSystemDeviceInfo(this); + + ui->batteryLevelBar->setValue(deviceInfo->batteryLevel()); + + connect(deviceInfo, SIGNAL(batteryLevelChanged(int)), + ui->batteryLevelBar, SLOT(setValue(int))); +} +//! [1] + +void MainWindow::setOrientation(Orientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != Auto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == LockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case LockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case LockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case Auto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} diff --git a/doc/examples/batteryindicator/mainwindow.h b/doc/examples/batteryindicator/mainwindow.h new file mode 100644 index 00000000000..fe219713c2f --- /dev/null +++ b/doc/examples/batteryindicator/mainwindow.h @@ -0,0 +1,42 @@ +// checksum 0xa940 version 0x10001 +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +//! [1] +#include +//! [1] + +//! [2] +QTM_USE_NAMESPACE +//! [2] + +namespace Ui { + class MainWindow; +} + +class MainWindow : public QMainWindow +{ +public: + enum Orientation { + LockPortrait, + LockLandscape, + Auto + }; + + MainWindow(QWidget *parent = 0); + ~MainWindow(); + + void setOrientation(Orientation orientation); + +//! [3] +private: + Ui::MainWindow *ui; + void setupGeneral(); + + QSystemDeviceInfo *deviceInfo; +//! [3] +}; + +#endif // MAINWINDOW_H diff --git a/doc/examples/batteryindicator/mainwindow.ui b/doc/examples/batteryindicator/mainwindow.ui new file mode 100644 index 00000000000..5b9ccdbf099 --- /dev/null +++ b/doc/examples/batteryindicator/mainwindow.ui @@ -0,0 +1,50 @@ + + + MainWindow + + + + 0 + 0 + 200 + 320 + + + + MainWindow + + + + + + + 24 + + + + + + + + + 0 + 0 + 200 + 21 + + + + + + TopToolBarArea + + + false + + + + + + + + diff --git a/doc/images/completion/element.png b/doc/images/completion/element.png new file mode 100644 index 00000000000..2b7b6a9ed86 Binary files /dev/null and b/doc/images/completion/element.png differ diff --git a/doc/images/completion/qmlsnippet.png b/doc/images/completion/qmlsnippet.png new file mode 100644 index 00000000000..dc1cb870fba Binary files /dev/null and b/doc/images/completion/qmlsnippet.png differ diff --git a/doc/images/completion/snippet.png b/doc/images/completion/snippet.png new file mode 100644 index 00000000000..929ac6b9229 Binary files /dev/null and b/doc/images/completion/snippet.png differ diff --git a/doc/images/qmldesigner-helloworld-edited.png b/doc/images/qmldesigner-helloworld-edited.png index 1af779dbb0b..177efac1866 100644 Binary files a/doc/images/qmldesigner-helloworld-edited.png and b/doc/images/qmldesigner-helloworld-edited.png differ diff --git a/doc/images/qmldesigner-helloworld.png b/doc/images/qmldesigner-helloworld.png index 7cd4a607ac7..db8f23aaa4e 100644 Binary files a/doc/images/qmldesigner-helloworld.png and b/doc/images/qmldesigner-helloworld.png differ diff --git a/doc/images/qmldesigner-import-project.png b/doc/images/qmldesigner-import-project.png new file mode 100644 index 00000000000..54163e67220 Binary files /dev/null and b/doc/images/qmldesigner-import-project.png differ diff --git a/doc/images/qmldesigner-new-project-contents.png b/doc/images/qmldesigner-new-project-contents.png index d2bd3cc6f1c..c52cdd6b486 100644 Binary files a/doc/images/qmldesigner-new-project-contents.png and b/doc/images/qmldesigner-new-project-contents.png differ diff --git a/doc/images/qmldesigner-new-project-location.png b/doc/images/qmldesigner-new-project-location.png index 9ebf56d5afc..f4214b54134 100644 Binary files a/doc/images/qmldesigner-new-project-location.png and b/doc/images/qmldesigner-new-project-location.png differ diff --git a/doc/images/qmldesigner-new-project-qml-sources.png b/doc/images/qmldesigner-new-project-qml-sources.png new file mode 100644 index 00000000000..86064f203b3 Binary files /dev/null and b/doc/images/qmldesigner-new-project-qml-sources.png differ diff --git a/doc/images/qmldesigner-new-project-qt-versions.png b/doc/images/qmldesigner-new-project-qt-versions.png new file mode 100644 index 00000000000..6b12dd6911d Binary files /dev/null and b/doc/images/qmldesigner-new-project-qt-versions.png differ diff --git a/doc/images/qmldesigner-new-project-summary.png b/doc/images/qmldesigner-new-project-summary.png index 958ce937fcb..2cfe09dd168 100644 Binary files a/doc/images/qmldesigner-new-project-summary.png and b/doc/images/qmldesigner-new-project-summary.png differ diff --git a/doc/images/qmldesigner-new-project.png b/doc/images/qmldesigner-new-project.png index f74bd4310cc..9acad09c20b 100644 Binary files a/doc/images/qmldesigner-new-project.png and b/doc/images/qmldesigner-new-project.png differ diff --git a/doc/images/qmldesigner-new-ui-project-summary.png b/doc/images/qmldesigner-new-ui-project-summary.png new file mode 100644 index 00000000000..aee3e556f5d Binary files /dev/null and b/doc/images/qmldesigner-new-ui-project-summary.png differ diff --git a/doc/images/qtcreator-add-resource-wizard.png b/doc/images/qtcreator-add-resource-wizard.png index 5109123f16e..db76501c0b9 100644 Binary files a/doc/images/qtcreator-add-resource-wizard.png and b/doc/images/qtcreator-add-resource-wizard.png differ diff --git a/doc/images/qtcreator-add-resource-wizard3.png b/doc/images/qtcreator-add-resource-wizard3.png index 8f4208b708c..ffad73d367a 100644 Binary files a/doc/images/qtcreator-add-resource-wizard3.png and b/doc/images/qtcreator-add-resource-wizard3.png differ diff --git a/doc/images/qtcreator-batteryindicator-screenshot.png b/doc/images/qtcreator-batteryindicator-screenshot.png index 8447e2be7db..d312bd9b8ee 100644 Binary files a/doc/images/qtcreator-batteryindicator-screenshot.png and b/doc/images/qtcreator-batteryindicator-screenshot.png differ diff --git a/doc/images/qtcreator-intro-and-location.png b/doc/images/qtcreator-intro-and-location.png index 014bba77083..346e855c744 100644 Binary files a/doc/images/qtcreator-intro-and-location.png and b/doc/images/qtcreator-intro-and-location.png differ diff --git a/doc/images/qtcreator-mobile-intro-and-location.png b/doc/images/qtcreator-mobile-intro-and-location.png index 5ca057b2e1c..dc78f7b8870 100644 Binary files a/doc/images/qtcreator-mobile-intro-and-location.png and b/doc/images/qtcreator-mobile-intro-and-location.png differ diff --git a/doc/images/qtcreator-mobile-project-app-options.png b/doc/images/qtcreator-mobile-project-app-options.png new file mode 100644 index 00000000000..3b48732648d Binary files /dev/null and b/doc/images/qtcreator-mobile-project-app-options.png differ diff --git a/doc/images/qtcreator-mobile-project-contents.png b/doc/images/qtcreator-mobile-project-contents.png index a41ef63dc37..da21d4b927f 100644 Binary files a/doc/images/qtcreator-mobile-project-contents.png and b/doc/images/qtcreator-mobile-project-contents.png differ diff --git a/doc/images/qtcreator-mobile-project-qt-versions.png b/doc/images/qtcreator-mobile-project-qt-versions.png index d7593b2f2a9..5e8e23a5b69 100644 Binary files a/doc/images/qtcreator-mobile-project-qt-versions.png and b/doc/images/qtcreator-mobile-project-qt-versions.png differ diff --git a/doc/images/qtcreator-mobile-project-summary.png b/doc/images/qtcreator-mobile-project-summary.png index c1f2a1b5a89..744f35c47b9 100644 Binary files a/doc/images/qtcreator-mobile-project-summary.png and b/doc/images/qtcreator-mobile-project-summary.png differ diff --git a/doc/images/qtcreator-mobile-project-widgets.png b/doc/images/qtcreator-mobile-project-widgets.png index cdd61eb0f04..ee6f3791dc4 100644 Binary files a/doc/images/qtcreator-mobile-project-widgets.png and b/doc/images/qtcreator-mobile-project-widgets.png differ diff --git a/doc/images/qtcreator-mobile-simulated.png b/doc/images/qtcreator-mobile-simulated.png index a498fdc9375..3769f24ba00 100644 Binary files a/doc/images/qtcreator-mobile-simulated.png and b/doc/images/qtcreator-mobile-simulated.png differ diff --git a/doc/images/qtcreator-new-mobile-project.png b/doc/images/qtcreator-new-mobile-project.png index b47951da162..fc9408c1657 100644 Binary files a/doc/images/qtcreator-new-mobile-project.png and b/doc/images/qtcreator-new-mobile-project.png differ diff --git a/doc/images/qtcreator-new-project-qt-versions.png b/doc/images/qtcreator-new-project-qt-versions.png index 48ef70b91d2..16a2fb8033f 100644 Binary files a/doc/images/qtcreator-new-project-qt-versions.png and b/doc/images/qtcreator-new-project-qt-versions.png differ diff --git a/doc/images/qtcreator-new-project-summary.png b/doc/images/qtcreator-new-project-summary.png index 2b99727ebb8..94b8c151c67 100644 Binary files a/doc/images/qtcreator-new-project-summary.png and b/doc/images/qtcreator-new-project-summary.png differ diff --git a/doc/images/qtcreator-new-project.png b/doc/images/qtcreator-new-project.png index fed25bfdbd0..f6996fa9754 100644 Binary files a/doc/images/qtcreator-new-project.png and b/doc/images/qtcreator-new-project.png differ diff --git a/doc/images/qtcreator-search-allprojects.png b/doc/images/qtcreator-search-allprojects.png index 84693d1151d..f34b2f2c4a3 100644 Binary files a/doc/images/qtcreator-search-allprojects.png and b/doc/images/qtcreator-search-allprojects.png differ diff --git a/doc/images/qtcreator-search-cpp-symbols.png b/doc/images/qtcreator-search-cpp-symbols.png new file mode 100644 index 00000000000..b9cdbef6614 Binary files /dev/null and b/doc/images/qtcreator-search-cpp-symbols.png differ diff --git a/share/qtcreator/examplebrowser b/share/qtcreator/examplebrowser new file mode 160000 index 00000000000..bf3bd5f8e6a --- /dev/null +++ b/share/qtcreator/examplebrowser @@ -0,0 +1 @@ +Subproject commit bf3bd5f8e6a5a311b922069f508f96d846c0b742 diff --git a/share/qtcreator/gdbmacros/dumper.py b/share/qtcreator/gdbmacros/dumper.py index b60b5df341b..a52da81d20d 100644 --- a/share/qtcreator/gdbmacros/dumper.py +++ b/share/qtcreator/gdbmacros/dumper.py @@ -1700,7 +1700,7 @@ class Dumper: iname = "%s.%s" % (item.iname, name) child = Item(item.value, iname, None, name) with SubItem(self): - self.put('name="%s",', name) + self.put('name="%s",' % name) self.putValue(" ") if str(field.type).endswith(""): self.putType("") diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index 0250be1741c..d1bf4126336 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -1299,6 +1299,7 @@ static void qDumpQDateTime(QDumper &d) d.putItem("value", "(null)"); d.putItem("type", NS"QDateTime"); d.putItem("numchild", "0"); + d.disarm(); return; } d.putItem("value", date.toString()); @@ -3037,7 +3038,7 @@ static void qDumpQVector(QDumper &d) if (const void *p = addOffset(v, i * innersize + typeddatasize)) qCheckPointer(deref(p)); - d.putItemCount("value", n); + d.putItemCount("value", nn); d.putItem("valueeditable", "false"); d.putItem("numchild", nn); if (d.dumpChildren) { @@ -3457,7 +3458,11 @@ static void qDumpStdVector(QDumper &d) #ifdef Q_CC_MSVC // Pointers are at end of the structure const char * vcp = static_cast(d.data); +# if _MSC_VER >= 1600 // VS2010 onwards: Beginning of structure + base class containing pointer + const VectorImpl *v = reinterpret_cast(vcp + sizeof(void*)); +# else // pre VS2010: End of structure const VectorImpl *v = reinterpret_cast(vcp + sizeof(std::vector) - sizeof(VectorImpl)); +# endif // _MSC_VER #else const VectorImpl *v = static_cast(d.data); #endif diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py index 0a0bcec04dc..63b7c17c142 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.py +++ b/share/qtcreator/gdbmacros/gdbmacros.py @@ -321,6 +321,12 @@ def qdump__QFileInfo(d, item): d.putCallItem("lastRead", item, "lastRead()") +def qdump__QFixed(d, item): + v = int(item.value["val"]) + d.putValue("%s/64 = %s" % (v, v/64.0)) + d.putNumChild(0) + + def qdump__QFlags(d, item): #warn("QFLAGS: %s" % item.value) i = item.value["i"] @@ -2048,6 +2054,11 @@ def qdump__std__set(d, item): node = node["_M_left"] +def qdump__std__stack(d, item): + data = item.value["c"] + qdump__std__deque(d, Item(data, item.iname)) + + def qdump__std__string(d, item): data = item.value["_M_dataplus"]["_M_p"] baseType = item.value.type.unqualified().strip_typedefs() diff --git a/share/qtcreator/qml/qmldump/qmldump.pro b/share/qtcreator/qml/qmldump/qmldump.pro index 1b86e6a2ebf..ea1fb42c0fe 100644 --- a/share/qtcreator/qml/qmldump/qmldump.pro +++ b/share/qtcreator/qml/qmldump/qmldump.pro @@ -8,10 +8,6 @@ TARGET = qmldump QT += declarative CONFIG += console -### FIXME: only debug plugins are now supported. -CONFIG -= release -CONFIG += debug - TEMPLATE = app SOURCES += main.cpp diff --git a/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h b/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h index 6aba5be4262..2ba7d0892b9 100644 --- a/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h @@ -34,10 +34,13 @@ # if defined(BUILD_QMLJSDEBUGGER_LIB) # define QMLJSDEBUGGER_EXPORT Q_DECL_EXPORT +# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT # elif defined(BUILD_QMLJSDEBUGGER_STATIC_LIB) # define QMLJSDEBUGGER_EXPORT +# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT # else # define QMLJSDEBUGGER_EXPORT Q_DECL_IMPORT +# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT #endif #endif // QMLJSDEBUGGER_GLOBAL_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h index c9cb8391212..d676ebce4d1 100644 --- a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h @@ -42,6 +42,7 @@ #ifndef QDECLARATIVEDEBUGHELPER_P_H #define QDECLARATIVEDEBUGHELPER_P_H +#include "../qmljsdebugger_global.h" #include QT_BEGIN_HEADER @@ -53,7 +54,7 @@ class QDeclarativeEngine; // Helper methods to access private API through a stable interface // This is used in the qmljsdebugger library of QtCreator. -class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper +class QMLJSDEBUGGER_EXTERN QDeclarativeDebugHelper { public: static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); diff --git a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h index 0cadbe5b585..e6e7ffe7391 100644 --- a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h @@ -42,6 +42,7 @@ #ifndef QDECLARATIVEDEBUGSERVICE_H #define QDECLARATIVEDEBUGSERVICE_H +#include "../qmljsdebugger_global.h" #include QT_BEGIN_HEADER @@ -51,7 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeDebugServicePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeDebugService : public QObject +class QMLJSDEBUGGER_EXTERN QDeclarativeDebugService : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeDebugService) diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri index ec99cd06cc5..6abc94f3aca 100644 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri @@ -11,9 +11,7 @@ contains(CONFIG, dll) { ## Input HEADERS += \ include/jsdebuggeragent.h \ - include/qmljsdebugger_global.h \ - include/qt_private/qdeclarativedebughelper_p.h \ - include/qt_private/qdeclarativedebugservice_p.h + include/qmljsdebugger_global.h SOURCES += \ jsdebuggeragent.cpp diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro index 5f3eb509580..1fc040262e9 100644 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro @@ -6,5 +6,5 @@ DEFINES += QMLOBSERVER unix:QMAKE_CXXFLAGS_DEBUG += -O3 -include(../../../src/qtcreatorlibrary.pri) +include(../../../../src/qtcreatorlibrary.pri) include(qmljsdebugger-lib.pri) diff --git a/share/qtcreator/qml/qmlobserver/crumblepath.cpp b/share/qtcreator/qml/qmlobserver/crumblepath.cpp index f773d37bb47..47f471f3c11 100644 --- a/share/qtcreator/qml/qmlobserver/crumblepath.cpp +++ b/share/qtcreator/qml/qmlobserver/crumblepath.cpp @@ -150,12 +150,12 @@ CrumblePathButton::CrumblePathButton(const QString &title, QWidget *parent) m_textPos.setY(height()); m_baseColor = QColor(0x666666); - m_segment = QImage(":/utils/images/crumblepath-segment.png"); - m_segmentSelected = QImage(":/utils/images/crumblepath-segment-selected.png"); - m_segmentHover = QImage(":/utils/images/crumblepath-segment-hover.png"); - m_segmentEnd = QImage(":/utils/images/crumblepath-segment-end.png"); - m_segmentSelectedEnd = QImage(":/utils/images/crumblepath-segment-selected-end.png"); - m_segmentHoverEnd = QImage(":/utils/images/crumblepath-segment-hover-end.png"); + m_segment = QImage(":/crumblepath/images/crumblepath-segment.png"); + m_segmentSelected = QImage(":/crumblepath/images/crumblepath-segment-selected.png"); + m_segmentHover = QImage(":/crumblepath/images/crumblepath-segment-hover.png"); + m_segmentEnd = QImage(":/crumblepath/images/crumblepath-segment-end.png"); + m_segmentSelectedEnd = QImage(":/crumblepath/images/crumblepath-segment-selected-end.png"); + m_segmentHoverEnd = QImage(":/crumblepath/images/crumblepath-segment-hover-end.png"); tintImages(); } diff --git a/share/qtcreator/qml/qmlobserver/crumblepath.qrc b/share/qtcreator/qml/qmlobserver/crumblepath.qrc new file mode 100644 index 00000000000..1c0897973c1 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/crumblepath.qrc @@ -0,0 +1,10 @@ + + + images/crumblepath-segment-end.png + images/crumblepath-segment-hover-end.png + images/crumblepath-segment-hover.png + images/crumblepath-segment-selected-end.png + images/crumblepath-segment-selected.png + images/crumblepath-segment.png + + diff --git a/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-end.png b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-end.png new file mode 100644 index 00000000000..1fc371cfec1 Binary files /dev/null and b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-end.png differ diff --git a/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-hover-end.png b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-hover-end.png new file mode 100644 index 00000000000..5663d29ee67 Binary files /dev/null and b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-hover-end.png differ diff --git a/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-hover.png b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-hover.png new file mode 100644 index 00000000000..741f0575dd7 Binary files /dev/null and b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-hover.png differ diff --git a/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-selected-end.png b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-selected-end.png new file mode 100644 index 00000000000..6ef4e05b45f Binary files /dev/null and b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-selected-end.png differ diff --git a/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-selected.png b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-selected.png new file mode 100644 index 00000000000..c674099b5a1 Binary files /dev/null and b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment-selected.png differ diff --git a/share/qtcreator/qml/qmlobserver/images/crumblepath-segment.png b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment.png new file mode 100644 index 00000000000..ad6e7165f6c Binary files /dev/null and b/share/qtcreator/qml/qmlobserver/images/crumblepath-segment.png differ diff --git a/share/qtcreator/qml/qmlobserver/main.cpp b/share/qtcreator/qml/qmlobserver/main.cpp index f04640d970e..6733265b2fe 100644 --- a/share/qtcreator/qml/qmlobserver/main.cpp +++ b/share/qtcreator/qml/qmlobserver/main.cpp @@ -113,7 +113,7 @@ void myMessageOutput(QtMsgType type, const char *msg) void usage() { - qWarning("Usage: qmlviewer [options] "); + qWarning("Usage: qmlobserver [options] "); qWarning(" "); qWarning(" options:"); qWarning(" -v, -version ............................. display version"); @@ -125,6 +125,7 @@ void usage() qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view (default)"); qWarning(" -qmlbrowser .............................. use a QML-based file browser"); qWarning(" -warnings [show|hide]..................... show warnings in a separate log window"); +#ifndef NO_PRIVATE_HEADERS qWarning(" -recordfile ..................... set video recording file"); qWarning(" - ImageMagick 'convert' for GIF)"); qWarning(" - png file for raw frames"); @@ -133,6 +134,7 @@ void usage() qWarning(" -recordrate ........................ set recording frame rate"); qWarning(" -record arg .............................. add a recording process argument"); qWarning(" -autorecord [from-] ...... set recording to start and stop"); +#endif qWarning(" -devicekeys .............................. use numeric keys (see F1)"); qWarning(" -dragthreshold .................... set mouse drag threshold size"); qWarning(" -netcache ......................... set disk cache to size bytes"); @@ -141,8 +143,10 @@ void usage() qWarning(" display path if is empty"); qWarning(" -P ........................... prepend to the plugin search path"); qWarning(" -opengl .................................. use a QGLWidget for the viewport"); +#ifndef NO_PRIVATE_HEADERS qWarning(" -script ........................... set the script to use"); qWarning(" -scriptopts |help ............... set the script options to use"); +#endif qWarning(" "); qWarning(" Press F1 for interactive help"); @@ -151,7 +155,7 @@ void usage() void scriptOptsUsage() { - qWarning("Usage: qmlviewer -scriptopts - Image + - Text + true @@ -489,7 +489,7 @@ border-bottom: 1px solid "#C9C9C9"; - Link + diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index bb8c97a36c5..eab7c3a7646 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -106,9 +106,9 @@ QStringList QMakeStep::allArguments() Qt4BuildConfiguration *bc = qt4BuildConfiguration(); QStringList arguments; if (bc->subNodeBuild()) - arguments << bc->subNodeBuild()->path(); + arguments << QDir::toNativeSeparators(bc->subNodeBuild()->path()); else - arguments << buildConfiguration()->target()->project()->file()->fileName(); + arguments << QDir::toNativeSeparators(buildConfiguration()->target()->project()->file()->fileName()); arguments << "-r"; if (!additonalArguments.contains("-spec")) @@ -153,6 +153,7 @@ QStringList QMakeStep::moreArguments() << QLatin1String("RCC_DIR=rcc"); } + // Do not turn debugger path into native path separators: Qmake does not like that! arguments << QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH) + QLatin1Char('=') + Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger"); return arguments; @@ -209,10 +210,13 @@ bool QMakeStep::init() setOutputParser(new QMakeParser); - Qt4Project *pro = qt4BuildConfiguration()->qt4Target()->qt4Project(); - QString proFile = pro->file()->fileName(); + Qt4ProFileNode *node = qt4bc->qt4Target()->qt4Project()->rootProjectNode(); + if (qt4bc->subNodeBuild()) + node = qt4bc->subNodeBuild(); + QString proFile = node->path(); + m_tasks = qt4BuildConfiguration()->qtVersion()->reportIssues(proFile, workingDirectory); - m_scriptTemplate = pro->rootProjectNode()->projectType() == ScriptTemplate; + m_scriptTemplate = node->projectType() == ScriptTemplate; return AbstractProcessStep::init(); } diff --git a/src/plugins/qt4projectmanager/qmldumptool.cpp b/src/plugins/qt4projectmanager/qmldumptool.cpp index cc675ce6b0f..7ca17122823 100644 --- a/src/plugins/qt4projectmanager/qmldumptool.cpp +++ b/src/plugins/qt4projectmanager/qmldumptool.cpp @@ -36,8 +36,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -50,7 +52,7 @@ using namespace Qt4ProjectManager; class QmlDumpBuildTask; typedef QHash QmlDumpByVersion; -Q_GLOBAL_STATIC(QmlDumpByVersion, runningQmlDumpBuilds); +Q_GLOBAL_STATIC(QmlDumpByVersion, qmlDumpBuilds); // A task suitable to be run by QtConcurrent to build qmldump. class QmlDumpBuildTask : public QObject { @@ -59,25 +61,32 @@ class QmlDumpBuildTask : public QObject { public: explicit QmlDumpBuildTask(QtVersion *version) : m_version(*version) + , m_failed(false) { - runningQmlDumpBuilds()->insert(m_version.uniqueId(), this); + qmlDumpBuilds()->insert(m_version.uniqueId(), this); } void run(QFutureInterface &future) { future.setProgressRange(0, 5); future.setProgressValue(1); - const QString output = m_version.buildDebuggingHelperLibrary(future, true); - - const QString qtInstallData = m_version.versionInfo().value("QT_INSTALL_DATA"); - QString path = QmlDumpTool::toolByInstallData(qtInstallData); - if (path.isEmpty()) { - qWarning() << "Could not build QML plugin dumping helper for " << m_version.displayName() - << "\nOutput:\n" << output; + QString output; + QString errorMessage; + QString path; + if (m_version.buildDebuggingHelperLibrary(future, true, &output, &errorMessage)) { + const QString qtInstallData = m_version.versionInfo().value("QT_INSTALL_DATA"); + path = QmlDumpTool::toolByInstallData(qtInstallData); + if (path.isEmpty()) + errorMessage = QString::fromLatin1("Could not build QML plugin dumping helper for %1\nOutput:\n%2"). + arg(m_version.displayName(), output); + } + m_failed = path.isEmpty(); + if (m_failed) { + qWarning("%s", qPrintable(errorMessage)); + } else { + // proceed in gui thread + metaObject()->invokeMethod(this, "finish", Qt::QueuedConnection, Q_ARG(QString, path)); } - - // proceed in gui thread - metaObject()->invokeMethod(this, "finish", Qt::QueuedConnection, Q_ARG(QString, path)); } void updateProjectWhenDone(ProjectExplorer::Project *project) @@ -85,14 +94,16 @@ public: m_projectsToUpdate.insert(project); } + bool hasFailed() const + { + return m_failed; + } + public slots: void finish(QString qmldumpPath) { deleteLater(); - runningQmlDumpBuilds()->remove(m_version.uniqueId()); - - if (qmldumpPath.isEmpty()) - return; + qmlDumpBuilds()->remove(m_version.uniqueId()); // update qmldump path for all the project QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance(); @@ -111,6 +122,7 @@ public slots: private: QSet m_projectsToUpdate; QtVersion m_version; + bool m_failed; }; } // end of anonymous namespace @@ -131,7 +143,7 @@ bool QmlDumpTool::canBuild(const QtVersion *qtVersion) const QString installHeaders = qtVersion->versionInfo().value("QT_INSTALL_HEADERS"); const QString header = installHeaders + QLatin1String("/QtDeclarative/private/qdeclarativemetatype_p.h"); return qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID) - && (checkMinimumQtVersion(qtVersion->qtVersionString(), 4, 7, 1) || QFile::exists(header)); + && QFile::exists(header); } static QtVersion *qtVersionForProject(ProjectExplorer::Project *project) @@ -147,6 +159,17 @@ static QtVersion *qtVersionForProject(ProjectExplorer::Project *project) return 0; } + if (project && project->id() == QLatin1String("QmlProjectManager.QmlProject")) { + // We cannot access the QmlProject interfaces here, therefore use the metatype system + QTC_ASSERT(project->activeTarget() && project->activeTarget()->activeRunConfiguration(), return 0); + QVariant variant = project->activeTarget()->activeRunConfiguration()->property("qtVersionId"); + QTC_ASSERT(variant.isValid() && variant.canConvert(QVariant::Int), return 0); + QtVersion *version = QtVersionManager::instance()->version(variant.toInt()); + if (version && version->isValid()) + return version; + return 0; + } + // else, find any desktop Qt version that has qmldump, or - if there isn't any - // one that could build it QtVersion *desktopQt = 0; @@ -204,12 +227,14 @@ QStringList QmlDumpTool::locationsByInstallData(const QString &qtInstallData) return result; } -QString QmlDumpTool::build(const QString &directory, const QString &makeCommand, - const QString &qmakeCommand, const QString &mkspec, - const Utils::Environment &env, const QString &targetMode) +bool QmlDumpTool::build(const QString &directory, const QString &makeCommand, + const QString &qmakeCommand, const QString &mkspec, + const Utils::Environment &env, const QString &targetMode, + QString *output, QString *errorMessage) { - return buildHelper(QCoreApplication::tr("qmldump"), QLatin1String("qmldump.pro"), - directory, makeCommand, qmakeCommand, mkspec, env, targetMode); + return buildHelper(QCoreApplication::translate("Qt4ProjectManager::QmlDumpTool", "qmldump"), QLatin1String("qmldump.pro"), + directory, makeCommand, qmakeCommand, mkspec, env, targetMode, + output, errorMessage); } QString QmlDumpTool::copy(const QString &qtInstallData, QString *errorMessage) @@ -218,7 +243,8 @@ QString QmlDumpTool::copy(const QString &qtInstallData, QString *errorMessage) QStringList files; files << QLatin1String("main.cpp") << QLatin1String("qmldump.pro") - << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT"); + << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT") + << QLatin1String("Info.plist"); QString sourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmldump/"); @@ -254,8 +280,10 @@ QString QmlDumpTool::qmlDumpPath(ProjectExplorer::Project *project) QtVersion *version = qtVersionForProject(project); if (version && path.isEmpty()) { - if (runningQmlDumpBuilds()->contains(version->uniqueId())) { - runningQmlDumpBuilds()->value(version->uniqueId())->updateProjectWhenDone(project); + QmlDumpBuildTask *qmlDumpBuildTask = qmlDumpBuilds()->value(version->uniqueId()); + if (qmlDumpBuildTask) { + if (!qmlDumpBuildTask->hasFailed()) + qmlDumpBuildTask->updateProjectWhenDone(project); } else { QmlDumpBuildTask *buildTask = new QmlDumpBuildTask(version); buildTask->updateProjectWhenDone(project); diff --git a/src/plugins/qt4projectmanager/qmldumptool.h b/src/plugins/qt4projectmanager/qmldumptool.h index 6924690865b..13fbe483d35 100644 --- a/src/plugins/qt4projectmanager/qmldumptool.h +++ b/src/plugins/qt4projectmanager/qmldumptool.h @@ -53,9 +53,10 @@ public: static QStringList locationsByInstallData(const QString &qtInstallData); // Build the helpers and return the output log/errormessage. - static QString build(const QString &directory, const QString &makeCommand, - const QString &qmakeCommand, const QString &mkspec, - const Utils::Environment &env, const QString &targetMode); + static bool build(const QString &directory, const QString &makeCommand, + const QString &qmakeCommand, const QString &mkspec, + const Utils::Environment &env, const QString &targetMode, + QString *output, QString *errorMessage); // Copy the source files to a target location and return the chosen target location. static QString copy(const QString &qtInstallData, QString *errorMessage); diff --git a/src/plugins/qt4projectmanager/qmlobservertool.cpp b/src/plugins/qt4projectmanager/qmlobservertool.cpp index f2b55cbac65..623e527d190 100644 --- a/src/plugins/qt4projectmanager/qmlobservertool.cpp +++ b/src/plugins/qt4projectmanager/qmlobservertool.cpp @@ -99,12 +99,15 @@ QStringList QmlObserverTool::locationsByInstallData(const QString &qtInstallData return result; } -QString QmlObserverTool::build(const QString &directory, const QString &makeCommand, - const QString &qmakeCommand, const QString &mkspec, - const Utils::Environment &env, const QString &targetMode) +bool QmlObserverTool::build(const QString &directory, const QString &makeCommand, + const QString &qmakeCommand, const QString &mkspec, + const Utils::Environment &env, const QString &targetMode, + QString *output, QString *errorMessage) { - return buildHelper(QCoreApplication::tr("QMLObserver"), QLatin1String("qmlobserver.pro"), - directory, makeCommand, qmakeCommand, mkspec, env, targetMode); + return buildHelper(QCoreApplication::translate("Qt4ProjectManager::QmlObserverTool", "QMLObserver"), + QLatin1String("qmlobserver.pro"), + directory, makeCommand, qmakeCommand, mkspec, env, targetMode, + output, errorMessage); } static inline bool mkpath(const QString &targetDirectory, QString *errorMessage) @@ -137,7 +140,11 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag << QLatin1String("content/Browser.qml") << QLatin1String("content/images/folder.png") << QLatin1String("content/images/titlebar.png") << QLatin1String("content/images/titlebar.sci") << QLatin1String("content/images/up.png") - << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT"); + << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT") + << QLatin1String("crumblepath.qrc") << QLatin1String("images/crumblepath-segment-end.png") + << QLatin1String("images/crumblepath-segment-hover-end.png") << QLatin1String("images/crumblepath-segment-hover.png") + << QLatin1String("images/crumblepath-segment-selected-end.png") << QLatin1String("images/crumblepath-segment-selected.png") + << QLatin1String("images/crumblepath-segment.png"); QStringList debuggerLibFiles; debuggerLibFiles << QLatin1String("jsdebuggeragent.cpp") @@ -185,6 +192,7 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag // Try to find a writeable directory. foreach(const QString &directory, directories) { if (!mkpath(directory + QLatin1String("/content/images"), errorMessage) + || !mkpath(directory + QLatin1String("/images"), errorMessage) || !mkpath(directory + QLatin1String("/qmljsdebugger/editor/images"), errorMessage) || !mkpath(directory + QLatin1String("/qmljsdebugger/include"), errorMessage) || !mkpath(directory + QLatin1String("/qmljsdebugger/include/qt_private"), errorMessage)) diff --git a/src/plugins/qt4projectmanager/qmlobservertool.h b/src/plugins/qt4projectmanager/qmlobservertool.h index 78c8ffc5ae9..f787171bdbd 100644 --- a/src/plugins/qt4projectmanager/qmlobservertool.h +++ b/src/plugins/qt4projectmanager/qmlobservertool.h @@ -54,9 +54,10 @@ public: static QStringList locationsByInstallData(const QString &qtInstallData); // Build the helpers and return the output log/errormessage. - static QString build(const QString &directory, const QString &makeCommand, - const QString &qmakeCommand, const QString &mkspec, - const Utils::Environment &env, const QString &targetMode); + static bool build(const QString &directory, const QString &makeCommand, + const QString &qmakeCommand, const QString &mkspec, + const Utils::Environment &env, const QString &targetMode, + QString *output, QString *errorMessage); // Copy the source files to a target location and return the chosen target location. static QString copy(const QString &qtInstallData, QString *errorMessage); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp index bc3938f8838..d67de573fdc 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp @@ -63,11 +63,13 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC DebuggerStartParameters params; const MaemoDeviceConfig &devConf = runConfig->deviceConfig(); - if (runConfig->useQmlDebugger()) { + const MaemoRunConfiguration::DebuggingType debuggingType + = runConfig->debuggingType(); + if (debuggingType != MaemoRunConfiguration::DebugCppOnly) { params.qmlServerAddress = runConfig->deviceConfig().server.host; params.qmlServerPort = qmlServerPort(runConfig); } - if (runConfig->useCppDebugger()) { + if (debuggingType != MaemoRunConfiguration::DebugQmlOnly) { params.processArgs = runConfig->arguments(); params.sysRoot = runConfig->sysRoot(); params.toolChainType = ToolChain::GCC_MAEMO; @@ -113,7 +115,7 @@ MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig, : QObject(runControl), m_runControl(runControl), m_runConfig(runConfig), m_deviceConfig(m_runConfig->deviceConfig()), m_runner(new MaemoSshRunner(this, m_runConfig, true)), - m_qmlOnlyDebugging(m_runConfig->useQmlDebugger() && !m_runConfig->useCppDebugger()) + m_qmlOnlyDebugging(m_runConfig->debuggingType() == MaemoRunConfiguration::DebugQmlOnly) { connect(m_runControl, SIGNAL(engineRequestSetup()), this, SLOT(handleAdapterSetupRequested())); @@ -305,7 +307,7 @@ int MaemoDebugSupport::gdbServerPort(const MaemoRunConfiguration *rc) int MaemoDebugSupport::qmlServerPort(const MaemoRunConfiguration *rc) { MaemoPortList portList = rc->freePorts(); - if (rc->useCppDebugger()) + if (rc->debuggingType() != MaemoRunConfiguration::DebugQmlOnly) portList.getNext(); return portList.getNext(); } @@ -314,7 +316,7 @@ QString MaemoDebugSupport::environment(const MaemoRunConfiguration *rc) { QList env = rc->userEnvironmentChanges(); // FIXME: this must use command line argument instead: -qmljsdebugger=port:1234. - if (rc->useQmlDebugger()) { + if (rc->debuggingType() != MaemoRunConfiguration::DebugCppOnly) { // env << Utils::EnvironmentItem(QLatin1String(Debugger::Constants::E_QML_DEBUG_SERVER_PORT), // QString::number(qmlServerPort(rc))); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp index 272e1c2211d..c5740cb0c77 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp @@ -218,7 +218,7 @@ QString MaemoDeployableListModel::localExecutableFilePath() const fileName += ti.target; if (isLib) fileName += QLatin1String(isStatic ? ".a" : ".so"); - return QDir::cleanPath(ti.buildDir + '/' + fileName); + return QDir::cleanPath(ti.workingDir + '/' + fileName); } QString MaemoDeployableListModel::remoteExecutableFilePath() const diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp index 804f7e4d880..d9e2b70259f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp @@ -567,7 +567,7 @@ void MaemoDeployStep::connectToDevice() m_connection = SshConnection::create(); connect(m_connection.data(), SIGNAL(connected()), this, SLOT(handleConnected())); - connect(m_connection.data(), SIGNAL(error(SshError)), this, + connect(m_connection.data(), SIGNAL(error(Core::SshError)), this, SLOT(handleConnectionFailure())); if (canReUse) { unmountOldDirs(); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp index 0ea53fa3696..1442ee7ac25 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp @@ -47,7 +47,10 @@ MaemoDeviceEnvReader::MaemoDeviceEnvReader(QObject *parent, MaemoRunConfiguratio : QObject(parent) , m_stop(false) , m_devConfig(config->deviceConfig()) + , m_runConfig(config) { + connect(config, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), + this, SLOT(handleCurrentDeviceConfigChanged())); } MaemoDeviceEnvReader::~MaemoDeviceEnvReader() @@ -59,11 +62,11 @@ void MaemoDeviceEnvReader::start() m_stop = false; if (m_connection) disconnect(m_connection.data(), 0, this, 0); - + const bool reuse = m_connection && m_connection->state() == Core::SshConnection::Connected && m_connection->connectionParameters() == m_devConfig.server; - + if (!reuse) m_connection = Core::SshConnection::create(); @@ -71,7 +74,7 @@ void MaemoDeviceEnvReader::start() SLOT(executeRemoteCall())); connect(m_connection.data(), SIGNAL(error(SshError)), this, SLOT(handleConnectionFailure())); - + if (reuse) executeRemoteCall(); else @@ -89,20 +92,13 @@ void MaemoDeviceEnvReader::stop() } } -void MaemoDeviceEnvReader::setEnvironment() -{ - if (m_remoteOutput.isEmpty()) - return; - m_env = Utils::Environment(m_remoteOutput.split(QLatin1Char('\n'), - QString::SkipEmptyParts)); -} - void MaemoDeviceEnvReader::executeRemoteCall() { if (m_stop) return; - const QByteArray remoteCall = MaemoGlobal::remoteSourceProfilesCommand().toUtf8() + "; env"; + const QByteArray remoteCall = MaemoGlobal::remoteSourceProfilesCommand() + .toUtf8() + "; env"; m_remoteProcess = m_connection->createRemoteProcess(remoteCall); connect(m_remoteProcess.data(), SIGNAL(closed(int)), this, @@ -123,6 +119,14 @@ void MaemoDeviceEnvReader::handleConnectionFailure() emit finished(); } +void MaemoDeviceEnvReader::handleCurrentDeviceConfigChanged() +{ + m_devConfig = m_runConfig->deviceConfig(); + + m_env.clear(); + emit finished(); +} + void MaemoDeviceEnvReader::remoteProcessFinished(int exitCode) { Q_ASSERT(exitCode == Core::SshRemoteProcess::FailedToStart @@ -132,8 +136,12 @@ void MaemoDeviceEnvReader::remoteProcessFinished(int exitCode) if (m_stop) return; + m_env.clear(); if (exitCode == Core::SshRemoteProcess::ExitedNormally) { - setEnvironment(); + if (!m_remoteOutput.isEmpty()) { + m_env = Utils::Environment(m_remoteOutput.split(QLatin1Char('\n'), + QString::SkipEmptyParts)); + } } else { emit error(tr("Error running remote process: %1") .arg(m_remoteProcess->errorString())); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h index 3d53e93ba0f..e5ad89e4635 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h @@ -67,12 +67,10 @@ signals: void finished(); void error(const QString &error); -private: - void setEnvironment(); - private slots: void executeRemoteCall(); void handleConnectionFailure(); + void handleCurrentDeviceConfigChanged(); void remoteProcessFinished(int exitCode); void remoteOutput(const QByteArray &data); @@ -83,6 +81,7 @@ private: QString m_remoteOutput; Utils::Environment m_env; MaemoDeviceConfig m_devConfig; + MaemoRunConfiguration *m_runConfig; QSharedPointer m_connection; QSharedPointer m_remoteProcess; }; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp index 5641225f1b7..d782e508182 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp @@ -72,7 +72,6 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent) , m_qemuAction(0) , m_qemuProcess(new QProcess(this)) , m_runningQtId(-1) - , m_needsSetup(true) , m_userTerminated(false) { m_qemuStarterIcon.addFile(":/qt-maemo/images/qemu-run.png", iconSize); @@ -149,9 +148,6 @@ bool MaemoQemuManager::runtimeForQtVersion(int uniqueId, Runtime *rt) const void MaemoQemuManager::qtVersionsChanged(const QList &uniqueIds) { - if (m_needsSetup) - setupRuntimes(); - QtVersionManager *manager = QtVersionManager::instance(); foreach (int uniqueId, uniqueIds) { if (manager->isValidId(uniqueId)) { @@ -199,7 +195,6 @@ void MaemoQemuManager::projectAdded(ProjectExplorer::Project *project) foreach (Target *target, project->targets()) targetAdded(target); - m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget()); } void MaemoQemuManager::projectRemoved(ProjectExplorer::Project *project) @@ -255,7 +250,7 @@ void MaemoQemuManager::targetAdded(ProjectExplorer::Target *target) foreach (RunConfiguration *rc, target->runConfigurations()) toggleDeviceConnections(qobject_cast (rc), true); - m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget()); + toggleStarterButton(target); } void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target) @@ -522,19 +517,6 @@ void MaemoQemuManager::runtimeFolderChanged(const QString &directory) // -- private -void MaemoQemuManager::setupRuntimes() -{ - m_needsSetup = false; - - const QList &versions = QtVersionManager::instance() - ->versionsForTargetId(Constants::MAEMO_DEVICE_TARGET_ID); - - QList uniqueIds; - foreach (QtVersion *version, versions) - uniqueIds.append(version->uniqueId()); - qtVersionsChanged(uniqueIds); -} - void MaemoQemuManager::updateStarterIcon(bool running) { QIcon::State state; @@ -554,9 +536,6 @@ void MaemoQemuManager::updateStarterIcon(bool running) void MaemoQemuManager::toggleStarterButton(Target *target) { - if (m_needsSetup) - setupRuntimes(); - int uniqueId = -1; if (target) { if (Qt4Target *qt4Target = qobject_cast(target)) { @@ -567,12 +546,16 @@ void MaemoQemuManager::toggleStarterButton(Target *target) } } + if (m_runtimes.isEmpty() || !m_runtimes.contains(uniqueId)) + qtVersionsChanged(QList() << uniqueId); + bool isRunning = m_qemuProcess->state() != QProcess::NotRunning; if (m_runningQtId == uniqueId) isRunning = false; m_qemuAction->setEnabled(m_runtimes.value(uniqueId, Runtime()).isValid() && targetUsesMatchingRuntimeConfig(target) && !isRunning); + m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget()); } bool MaemoQemuManager::sessionHasMaemoTarget() const @@ -739,7 +722,12 @@ QString MaemoQemuManager::runtimeForQtVersion(const QString &qmakeCommand) const && infoReader.name() == QLatin1String("installed")) { if (infoReader.readNext() == QXmlStreamReader::Characters && infoReader.text() == QLatin1String("true")) - installedRuntimes << attrs.value(QLatin1String("runtime_id")).toString(); + if (attrs.hasAttribute(QLatin1String(QLatin1String("runtime_id")))) + installedRuntimes << attrs.value(QLatin1String("runtime_id")).toString(); + else if (attrs.hasAttribute(QLatin1String(QLatin1String("id")))) { + // older MADDE seems to use only id + installedRuntimes << attrs.value(QLatin1String("id")).toString(); + } break; } } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h index 09e47997c7f..6222ea972c1 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h @@ -123,7 +123,6 @@ private: MaemoQemuManager(QObject *parent); ~MaemoQemuManager(); - void setupRuntimes(); bool sessionHasMaemoTarget() const; void updateStarterIcon(bool running); @@ -146,7 +145,6 @@ private: QProcess *m_qemuProcess; int m_runningQtId; - bool m_needsSetup; bool m_userTerminated; QIcon m_qemuStarterIcon; QMap m_runtimes; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp index 3aca439313d..84fdd1cb614 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp @@ -47,7 +47,7 @@ namespace Qt4ProjectManager { namespace Internal { MaemoRemoteMounter::MaemoRemoteMounter(QObject *parent) - : QObject(parent), m_utfsServerTimer(new QTimer(this)), + : QObject(parent), m_toolChain(0), m_utfsServerTimer(new QTimer(this)), m_uploadJobId(SftpInvalidJob), m_state(Inactive) { connect(m_utfsServerTimer, SIGNAL(timeout()), this, @@ -69,9 +69,10 @@ void MaemoRemoteMounter::setConnection(const Core::SshConnection::Ptr &connectio bool MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec, bool mountAsRoot) { + Q_ASSERT(m_toolChain); ASSERT_STATE(Inactive); - if (mountSpec.isValid()) { + if (m_toolChain->allowsRemoteMounts() && mountSpec.isValid()) { if (!m_portList.hasMore()) return false; else @@ -80,14 +81,17 @@ bool MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mo return true; } +bool MaemoRemoteMounter::hasValidMountSpecifications() const +{ + return !m_mountSpecs.isEmpty(); +} + void MaemoRemoteMounter::mount() { ASSERT_STATE(Inactive); Q_ASSERT(m_utfsServers.isEmpty()); Q_ASSERT(m_connection); - if (!m_toolChain->allowsRemoteMounts()) - m_mountSpecs.clear(); if (m_mountSpecs.isEmpty()) { setState(Inactive); emit reportProgress(tr("No directories to mount")); @@ -114,7 +118,6 @@ void MaemoRemoteMounter::unmount() m_mountSpecs.at(i).mountSpec.remoteMountPoint); } - emit reportProgress(tr("Unmounting remote mount points...")); m_umountStderr.clear(); m_unmountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8()); connect(m_unmountProcess.data(), SIGNAL(closed(int)), this, @@ -240,9 +243,8 @@ void MaemoRemoteMounter::handleUploadFinished(Core::SftpJobId jobId, m_uploadJobId = SftpInvalidJob; if (!errorMsg.isEmpty()) { - emit error(tr("Could not upload UTFS client: %1").arg(errorMsg)); - setState(Inactive); - return; + emit reportProgress(tr("Could not upload UTFS client (%1), continuing anyway.") + .arg(errorMsg)); } startUtfsClients(); @@ -459,6 +461,8 @@ void MaemoRemoteMounter::setState(State newState) m_state = newState; } +// TODO: Perhaps remove this one again, since it might interfere with +// an unrelated application void MaemoRemoteMounter::killUtfsClients() { const SshRemoteProcess::Ptr utfsClientKiller diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.h b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.h index 9445d3d050d..8e297be80df 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.h @@ -63,6 +63,7 @@ public: void setPortList(const MaemoPortList &portList) { m_portList = portList; } bool addMountSpecification(const MaemoMountSpecification &mountSpec, bool mountAsRoot); + bool hasValidMountSpecifications() const; void resetMountSpecifications() { m_mountSpecs.clear(); } void mount(); void unmount(); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp index 724d2d191e0..18e734f2656 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp @@ -304,6 +304,30 @@ void MaemoRunConfiguration::setArguments(const QStringList &args) m_arguments = args; } +MaemoRunConfiguration::DebuggingType MaemoRunConfiguration::debuggingType() const +{ + if (!toolchain() || !toolchain()->allowsQmlDebugging()) + return DebugCppOnly; + if (useCppDebugger()) { + if (useQmlDebugger()) + return DebugCppAndQml; + return DebugCppOnly; + } + return DebugQmlOnly; +} + +int MaemoRunConfiguration::portsUsedByDebuggers() const +{ + switch (debuggingType()) { + case DebugCppOnly: + case DebugQmlOnly: + return 1; + case DebugCppAndQml: + default: + return 2; + } +} + void MaemoRunConfiguration::updateDeviceConfigurations() { emit deviceConfigurationChanged(target()); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h index b25848b92a4..42e32835944 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h @@ -71,6 +71,8 @@ public: SystemEnvironmentBase = 1 }; + enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml }; + MaemoRunConfiguration(Qt4Target *parent, const QString &proFilePath); virtual ~MaemoRunConfiguration(); @@ -96,6 +98,7 @@ public: bool useRemoteGdb() const; void setUseRemoteGdb(bool useRemoteGdb) { m_useRemoteGdb = useRemoteGdb; } void updateFactoryState() { emit isEnabledChanged(true); } + DebuggingType debuggingType() const; const QString gdbCmd() const; const QString dumperLib() const; @@ -116,7 +119,7 @@ public: Utils::Environment systemEnvironment() const; void setSystemEnvironment(const Utils::Environment &environment); - int portsUsedByDebuggers() const { return useCppDebugger() + useQmlDebugger(); } + int portsUsedByDebuggers() const; signals: void deviceConfigurationChanged(ProjectExplorer::Target *target); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp index 8d2279bf9ce..ddc20d8ce50 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp @@ -126,10 +126,11 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout) m_debugCppOnlyButton = new QRadioButton(tr("C++ only")); m_debugQmlOnlyButton = new QRadioButton(tr("QML only")); m_debugCppAndQmlButton = new QRadioButton(tr("C++ and QML")); + m_debuggingLanguagesLabel = new QLabel(tr("Debugging type:")); debugButtonsLayout->addWidget(m_debugCppOnlyButton); debugButtonsLayout->addWidget(m_debugQmlOnlyButton); debugButtonsLayout->addWidget(m_debugCppAndQmlButton); - formLayout->addRow(tr("Debugging type:"), debugButtonsLayout); + formLayout->addRow(m_debuggingLanguagesLabel, debugButtonsLayout); if (m_runConfiguration->useCppDebugger()) { if (m_runConfiguration->useQmlDebugger()) m_debugCppAndQmlButton->setChecked(true); @@ -283,6 +284,7 @@ void MaemoRunConfigurationWidget::updateTargetInformation() void MaemoRunConfigurationWidget::handleDeploySpecsChanged() { m_remoteExecutableLabel->setText(m_runConfiguration->remoteExecutableFilePath()); + m_runConfiguration->updateFactoryState(); } void MaemoRunConfigurationWidget::handleBuildConfigChanged() @@ -304,6 +306,11 @@ void MaemoRunConfigurationWidget::handleToolchainChanged() const bool remoteMountsAvailable = toolChain->allowsRemoteMounts(); m_debugDetailsContainer->setVisible(remoteMountsAvailable); m_mountDetailsContainer->setVisible(remoteMountsAvailable); + const bool qmlDebuggingAvailable = toolChain->allowsQmlDebugging(); + m_debuggingLanguagesLabel->setVisible(qmlDebuggingAvailable); + m_debugCppOnlyButton->setVisible(qmlDebuggingAvailable); + m_debugQmlOnlyButton->setVisible(qmlDebuggingAvailable); + m_debugCppAndQmlButton->setVisible(qmlDebuggingAvailable); } m_runConfiguration->updateFactoryState(); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h index 2fb92edefde..be686ac0000 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h @@ -107,6 +107,7 @@ private: QLabel *m_localExecutableLabel; QLabel *m_remoteExecutableLabel; QLabel *m_devConfLabel; + QLabel *m_debuggingLanguagesLabel; QRadioButton *m_debugCppOnlyButton; QRadioButton *m_debugQmlOnlyButton; QRadioButton *m_debugCppAndQmlButton; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp index 597fb387a19..a71277ee177 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp @@ -85,8 +85,8 @@ void MaemoRunControl::start() SLOT(handleRemoteOutput(QByteArray))); connect(m_runner, SIGNAL(remoteProcessStarted()), this, SLOT(handleRemoteProcessStarted())); - connect(m_runner, SIGNAL(remoteProcessFinished(int)), this, - SLOT(handleRemoteProcessFinished(int))); + connect(m_runner, SIGNAL(remoteProcessFinished(qint64)), this, + SLOT(handleRemoteProcessFinished(qint64))); connect(m_runner, SIGNAL(reportProgress(QString)), this, SLOT(handleProgressReport(QString))); connect(m_runner, SIGNAL(mountDebugOutput(QString)), this, @@ -118,11 +118,13 @@ void MaemoRunControl::startExecution() .arg(m_runConfig->arguments().join(QLatin1String(" "))).toUtf8()); } -void MaemoRunControl::handleRemoteProcessFinished(int exitCode) +void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode) { - emit appendMessage(this, - tr("Finished running remote process. Exit code was %1.").arg(exitCode), - false); + if (exitCode != MaemoSshRunner::InvalidExitCode) { + emit appendMessage(this, + tr("Finished running remote process. Exit code was %1.") + .arg(exitCode), false); + } setFinished(); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h index ffde0f70189..4f8edb6da98 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h @@ -61,7 +61,7 @@ private slots: void startExecution(); void handleSshError(const QString &error); void handleRemoteProcessStarted() {} - void handleRemoteProcessFinished(int exitCode); + void handleRemoteProcessFinished(qint64 exitCode); void handleRemoteOutput(const QByteArray &output); void handleRemoteErrorOutput(const QByteArray &output); void handleProgressReport(const QString &progressString); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp index b39da25f22d..16db4f43869 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp @@ -46,6 +46,10 @@ #include +#include + +#define ASSERT_STATE(state) assertState(state, Q_FUNC_INFO) + using namespace Core; namespace Qt4ProjectManager { @@ -55,8 +59,8 @@ MaemoSshRunner::MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig, bool debugging) : QObject(parent), m_runConfig(runConfig), m_mounter(new MaemoRemoteMounter(this)), - m_devConfig(runConfig->deviceConfig()), m_shuttingDown(false), - m_debugging(debugging) + m_devConfig(runConfig->deviceConfig()), + m_debugging(debugging), m_state(Inactive) { m_procsToKill << QFileInfo(m_runConfig->localExecutableFilePath()).fileName() @@ -77,27 +81,21 @@ MaemoSshRunner::~MaemoSshRunner() {} void MaemoSshRunner::start() { - // Should not happen. - if (m_shuttingDown) { - emit error(tr("Cannot start deployment, as the clean-up from the last time has not finished yet.")); - return; - } + ASSERT_STATE(QList() << Inactive << StopRequested); - m_stop = false; + setState(Connecting); m_exitStatus = -1; if (m_connection) disconnect(m_connection.data(), 0, this, 0); - bool reUse = isConnectionUsable(); - if (!reUse) - m_connection = m_runConfig->deployStep()->sshConnection(); - reUse = isConnectionUsable(); + m_connection = m_runConfig->deployStep()->sshConnection(); + const bool reUse = isConnectionUsable(); if (!reUse) m_connection = SshConnection::create(); connect(m_connection.data(), SIGNAL(connected()), this, SLOT(handleConnected())); - connect(m_connection.data(), SIGNAL(error(SshError)), this, + connect(m_connection.data(), SIGNAL(error(Core::SshError)), this, SLOT(handleConnectionFailure())); - if (reUse) { + if (reUse) { handleConnected(); } else { emit reportProgress(tr("Connecting to device...")); @@ -107,41 +105,44 @@ void MaemoSshRunner::start() void MaemoSshRunner::stop() { - if (m_shuttingDown) + if (m_state == PostRunCleaning || m_state == StopRequested + || m_state == Inactive) return; - m_stop = true; - m_mounter->stop(); - if (m_cleaner) - disconnect(m_cleaner.data(), 0, this, 0); - cleanup(false); + setState(StopRequested); + cleanup(); } void MaemoSshRunner::handleConnected() { - if (m_stop) - return; - - cleanup(true); + ASSERT_STATE(QList() << Connecting << StopRequested); + if (m_state == StopRequested) { + setState(Inactive); + } else { + setState(PreRunCleaning); + cleanup(); + } } void MaemoSshRunner::handleConnectionFailure() { - emit error(tr("Could not connect to host: %1") - .arg(m_connection->errorString())); + if (m_state == Inactive) + qWarning("Unexpected state %d in %s.", m_state, Q_FUNC_INFO); + + const QString errorTemplate = m_state == Connecting + ? tr("Could not connect to host: %1") : tr("Connection failed: %1"); + emitError(errorTemplate.arg(m_connection->errorString())); } -void MaemoSshRunner::cleanup(bool initialCleanup) +void MaemoSshRunner::cleanup() { - if (!isConnectionUsable()) - return; + ASSERT_STATE(QList() << PreRunCleaning << PostRunCleaning + << StopRequested); emit reportProgress(tr("Killing remote process(es)...")); - m_shuttingDown = !initialCleanup; // pkill behaves differently on Fremantle and Harmattan. const char *const killTemplate = "pkill -%2 '^%1$'; pkill -%2 '/%1$';"; - QString niceKill; QString brutalKill; foreach (const QString &proc, m_procsToKill) { @@ -163,37 +164,41 @@ void MaemoSshRunner::handleCleanupFinished(int exitStatus) || exitStatus == SshRemoteProcess::KilledBySignal || exitStatus == SshRemoteProcess::ExitedNormally); - if (m_shuttingDown) { - m_unmountState = ShutdownUnmount; - m_mounter->unmount(); + ASSERT_STATE(QList() << PreRunCleaning << PostRunCleaning + << StopRequested << Inactive); + + if (m_state == Inactive) + return; + if (m_state == StopRequested || m_state == PostRunCleaning) { + unmount(); return; } - if (m_stop) - return; - if (exitStatus != SshRemoteProcess::ExitedNormally) { - emit error(tr("Initial cleanup failed: %1") + emitError(tr("Initial cleanup failed: %1") .arg(m_cleaner->errorString())); } else { m_mounter->setConnection(m_connection); - m_unmountState = InitialUnmount; - m_mounter->unmount(); + unmount(); } } void MaemoSshRunner::handleUnmounted() { - switch (m_unmountState) { - case InitialUnmount: { - if (m_stop) - return; + ASSERT_STATE(QList() << PreRunCleaning << PreMountUnmounting + << PostRunCleaning << StopRequested); + + switch (m_state) { + case PreRunCleaning: { m_mounter->resetMountSpecifications(); MaemoPortList portList = m_devConfig.freePorts(); if (m_debugging) { // gdbserver and QML inspector need one port each. - if (m_runConfig->useCppDebugger() && !m_runConfig->useRemoteGdb()) + MaemoRunConfiguration::DebuggingType debuggingType + = m_runConfig->debuggingType(); + if (debuggingType != MaemoRunConfiguration::DebugQmlOnly + && !m_runConfig->useRemoteGdb()) portList.getNext(); - if (m_runConfig->useQmlDebugger()) + if (debuggingType != MaemoRunConfiguration::DebugCppOnly) portList.getNext(); } m_mounter->setToolchain(m_runConfig->toolchain()); @@ -210,49 +215,54 @@ void MaemoSshRunner::handleUnmounted() MaemoGlobal::remoteProjectSourcesMountPoint()))) return; } - m_unmountState = PreMountUnmount; - m_mounter->unmount(); + setState(PreMountUnmounting); + unmount(); break; } - case PreMountUnmount: - if (m_stop) - return; - m_mounter->mount(); + case PreMountUnmounting: + mount(); break; - case ShutdownUnmount: - Q_ASSERT(m_shuttingDown); + case PostRunCleaning: + case StopRequested: m_mounter->resetMountSpecifications(); - m_shuttingDown = false; - if (m_exitStatus == SshRemoteProcess::ExitedNormally) { + if (m_state == StopRequested) { + emit remoteProcessFinished(InvalidExitCode); + } else if (m_exitStatus == SshRemoteProcess::ExitedNormally) { emit remoteProcessFinished(m_runner->exitCode()); - } else if (m_exitStatus == -1) { - emit remoteProcessFinished(-1); } else { emit error(tr("Error running remote process: %1") .arg(m_runner->errorString())); } - m_exitStatus = -1; + setState(Inactive); break; + default: ; } } void MaemoSshRunner::handleMounted() { - if (!m_stop) + ASSERT_STATE(QList() << Mounting << StopRequested); + + if (m_state == Mounting) { + setState(ReadyForExecution); emit readyForExecution(); + } } void MaemoSshRunner::handleMounterError(const QString &errorMsg) { - if (m_shuttingDown) - m_shuttingDown = false; - emit error(errorMsg); + ASSERT_STATE(QList() << PreRunCleaning << PostRunCleaning + << PreMountUnmounting << Mounting << StopRequested << Inactive); + + emitError(errorMsg); } void MaemoSshRunner::startExecution(const QByteArray &remoteCall) { + ASSERT_STATE(ReadyForExecution); + if (m_runConfig->remoteExecutableFilePath().isEmpty()) { - emit error(tr("Cannot run: No remote executable set.")); + emitError(tr("Cannot run: No remote executable set.")); return; } @@ -265,6 +275,7 @@ void MaemoSshRunner::startExecution(const QByteArray &remoteCall) SIGNAL(remoteOutput(QByteArray))); connect(m_runner.data(), SIGNAL(errorOutputAvailable(QByteArray)), this, SIGNAL(remoteErrorOutput(QByteArray))); + setState(ProcessStarting); m_runner->start(); } @@ -273,15 +284,19 @@ void MaemoSshRunner::handleRemoteProcessFinished(int exitStatus) Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart || exitStatus == SshRemoteProcess::KilledBySignal || exitStatus == SshRemoteProcess::ExitedNormally); + ASSERT_STATE(QList() << ProcessStarting << StopRequested << Inactive); m_exitStatus = exitStatus; - cleanup(false); + if (m_state != StopRequested && m_state != Inactive) { + setState(PostRunCleaning); + cleanup(); + } } bool MaemoSshRunner::addMountSpecification(const MaemoMountSpecification &mountSpec) { if (!m_mounter->addMountSpecification(mountSpec, false)) { - emit error(tr("The device does not have enough free ports " + emitError(tr("The device does not have enough free ports " "for this run configuration.")); return false; } @@ -294,6 +309,80 @@ bool MaemoSshRunner::isConnectionUsable() const && m_connection->connectionParameters() == m_devConfig.server; } +void MaemoSshRunner::assertState(State expectedState, const char *func) +{ + assertState(QList() << expectedState, func); +} + +void MaemoSshRunner::assertState(const QList &expectedStates, + const char *func) +{ + if (!expectedStates.contains(m_state)) + qWarning("Unexpected state %d at %s.", m_state, func); +} + +void MaemoSshRunner::setState(State newState) +{ + if (newState == Inactive) { + m_mounter->setConnection(SshConnection::Ptr()); + if (m_connection) { + disconnect(m_connection.data(), 0, this, 0); + m_connection = SshConnection::Ptr(); + } + if (m_cleaner) + disconnect(m_cleaner.data(), 0, this, 0); + } + m_state = newState; +} + +void MaemoSshRunner::emitError(const QString &errorMsg) +{ + if (m_state != Inactive) { + emit error(errorMsg); + setState(Inactive); + } +} + +void MaemoSshRunner::mount() +{ + setState(Mounting); + if (m_mounter->hasValidMountSpecifications()) { + emit reportProgress(tr("Mounting host directories...")); + m_mounter->mount(); + } else { + handleMounted(); + } +} + +void MaemoSshRunner::unmount() +{ + ASSERT_STATE(QList() << PreRunCleaning << PreMountUnmounting + << PostRunCleaning << StopRequested); + if (m_mounter->hasValidMountSpecifications()) { + QString message; + switch (m_state) { + case PreRunCleaning: + message = tr("Unmounting left-over host directory mounts..."); + break; + case PreMountUnmounting: + message = tr("Potentially unmounting left-over host directory mounts..."); + case StopRequested: case PostRunCleaning: + message = tr("Unmounting host directories..."); + break; + default: + break; + } + emit reportProgress(message); + m_mounter->unmount(); + } else { + handleUnmounted(); + } +} + + +const qint64 MaemoSshRunner::InvalidExitCode + = std::numeric_limits::min(); + } // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h index 96447e0c4ec..2c756a2382b 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h @@ -67,6 +67,8 @@ public: QSharedPointer connection() const { return m_connection; } + static const qint64 InvalidExitCode; + signals: void error(const QString &error); void mountDebugOutput(const QString &output); @@ -75,7 +77,7 @@ signals: void remoteErrorOutput(const QByteArray &output); void reportProgress(const QString &progressOutput); void remoteProcessStarted(); - void remoteProcessFinished(int exitCode); + void remoteProcessFinished(qint64 exitCode); private slots: void handleConnected(); @@ -87,9 +89,21 @@ private slots: void handleMounterError(const QString &errorMsg); private: - void cleanup(bool initialCleanup); + enum State { Inactive, Connecting, PreRunCleaning, PostRunCleaning, + PreMountUnmounting, Mounting, ReadyForExecution, + ProcessStarting, StopRequested + }; + + void assertState(State expectedState, const char *func); + void assertState(const QList &expectedStates, const char *func); + void setState(State newState); + void emitError(const QString &errorMsg); + + void cleanup(); bool addMountSpecification(const MaemoMountSpecification &mountSpec); bool isConnectionUsable() const; + void mount(); + void unmount(); MaemoRunConfiguration * const m_runConfig; // TODO this pointer can be invalid MaemoRemoteMounter * const m_mounter; @@ -100,13 +114,9 @@ private: QSharedPointer m_cleaner; QStringList m_procsToKill; - bool m_stop; int m_exitStatus; - bool m_shuttingDown; const bool m_debugging; - - enum UnmountState { InitialUnmount, PreMountUnmount, ShutdownUnmount }; - UnmountState m_unmountState; + State m_state; }; } // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp index 2bac839dc9e..c64c35e6237 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp @@ -81,6 +81,8 @@ MaemoTemplatesManager::MaemoTemplatesManager(QObject *parent) : QObject(parent) = ProjectExplorerPlugin::instance()->session(); connect(session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), this, SLOT(handleActiveProjectChanged(ProjectExplorer::Project*))); + connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)), this, + SLOT(handleActiveProjectChanged(ProjectExplorer::Project*))); connect(session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)), this, SLOT(handleProjectToBeRemoved(ProjectExplorer::Project*))); handleActiveProjectChanged(session->startupProject()); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h b/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h index 7589b1e2425..edda2c25d71 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h @@ -56,6 +56,7 @@ public: MaemoVersion version() const; bool allowsRemoteMounts() const { return version() == Maemo5; } bool allowsPackagingDisabling() const { return version() == Maemo5; } + bool allowsQmlDebugging() const { return version() == Maemo6; } protected: bool equals(const ToolChain *other) const; diff --git a/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp b/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp index 5702d3611b5..cde0deeee40 100644 --- a/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp @@ -36,65 +36,217 @@ using namespace ProjectExplorer::Constants; using namespace Qt4ProjectManager; RvctParser::RvctParser() : - m_additionalInfo(false), - m_lastLine(0) + m_task(0) { setObjectName(QLatin1String("RvctParser")); // Start of a error or warning: - m_warningOrError.setPattern("^\"([^\\(\\)]+[^\\d])\", line (\\d+):(\\s(Warning|Error):)\\s(.+)$"); + m_warningOrError.setPattern("^\"([^\\(\\)]+[^\\d])\", line (\\d+):(\\s(Warning|Error):)\\s+([^\\s].*)$"); m_warningOrError.setMinimal(true); // Last message for any file with warnings/errors. - m_doneWithFile.setPattern("^([^\\(\\)]+[^\\d]):\\s(\\d+) warnings?,\\s(\\d+) errors?$"); - m_doneWithFile.setMinimal(true); + m_wrapUpTask.setPattern("^([^\\(\\)]+[^\\d]):\\s(\\d+) warnings?,\\s(\\d+) errors?$"); + m_wrapUpTask.setMinimal(true); // linker problems: - m_linkerProblem.setPattern("^(\\S*)\\(\\S+\\):\\s(.+)$"); - m_linkerProblem.setMinimal(true); + m_genericProblem.setPattern("^(Error|Warning): (.*)$"); + m_genericProblem.setMinimal(true); +} + +RvctParser::~RvctParser() +{ + sendTask(); } void RvctParser::stdError(const QString &line) { QString lne = line.trimmed(); - if (m_linkerProblem.indexIn(lne) > -1) { - emit addTask(Task(Task::Error, - m_linkerProblem.cap(2) /* description */, - m_linkerProblem.cap(1) /* filename */, - -1 /* linenumber */, - TASK_CATEGORY_COMPILE)); - return; - } + if (m_genericProblem.indexIn(lne) > -1) { + sendTask(); + m_task = new Task(Task::Error, + m_genericProblem.cap(2) /* description */, + QString(), + -1 /* linenumber */, + TASK_CATEGORY_COMPILE); + if (m_warningOrError.cap(4) == "Warning") + m_task->type = Task::Warning; + else if (m_warningOrError.cap(4) == "Error") + m_task->type = Task::Error; + + return; + } if (m_warningOrError.indexIn(lne) > -1) { - m_lastFile = m_warningOrError.cap(1); - m_lastLine = m_warningOrError.cap(2).toInt(); + sendTask(); - Task task(Task::Unknown, - m_warningOrError.cap(5) /* description */, - m_lastFile, m_lastLine, - TASK_CATEGORY_COMPILE); + m_task = new Task(Task::Unknown, + m_warningOrError.cap(5) /* description */, + m_warningOrError.cap(1) /* file */, m_warningOrError.cap(2).toInt() /* line */, + TASK_CATEGORY_COMPILE); if (m_warningOrError.cap(4) == "Warning") - task.type = Task::Warning; + m_task->type = Task::Warning; else if (m_warningOrError.cap(4) == "Error") - task.type = Task::Error; - - m_additionalInfo = true; - - emit addTask(task); + m_task->type = Task::Error; return; } - if (m_doneWithFile.indexIn(lne) > -1) { - m_additionalInfo = false; + if (m_wrapUpTask.indexIn(lne) > -1) { + sendTask(); return; } - if (m_additionalInfo) { - // Report any lines after a error/warning message as these contain - // additional information on the problem. - emit addTask(Task(Task::Unknown, lne, - m_lastFile, m_lastLine, - TASK_CATEGORY_COMPILE)); + if (m_task) { + QString description = line; + if (description.startsWith(QLatin1String(" "))) + description = description.mid(2); + if (description.endsWith('\n')) + description.chop(1); + if (m_task->formats.isEmpty()) { + QTextLayout::FormatRange fr; + fr.start = m_task->description.count(); // incl. '\n' we are about to add! + fr.length = description.count() - 1; + fr.format.setFontItalic(true); + m_task->formats.append(fr); + } else { + m_task->formats[0].length += description.count() - 2 + 1; + } + m_task->description += QLatin1Char('\n') + description; + + // Wrap up license error: + if (description.endsWith(QLatin1String("at \"www.macrovision.com\"."))) + sendTask(); + return; } IOutputParser::stdError(line); } + +void RvctParser::sendTask() +{ + if (!m_task) + return; + emit addTask(*m_task); + delete m_task; + m_task = 0; +} + +// Unit tests: + +#ifdef WITH_TESTS +# include + +# include "qt4projectmanagerplugin.h" +# include +# include + +using namespace Qt4ProjectManager::Internal; + +void Qt4ProjectManagerPlugin::testRvctOutputParser_data() +{ + QTest::addColumn("input"); + QTest::addColumn("inputChannel"); + QTest::addColumn("childStdOutLines"); + QTest::addColumn("childStdErrLines"); + QTest::addColumn >("tasks"); + QTest::addColumn("outputLines"); + + + QTest::newRow("pass-through stdout") + << QString::fromLatin1("Sometext") << OutputParserTester::STDOUT + << QString::fromLatin1("Sometext") << QString() + << QList() + << QString(); + QTest::newRow("pass-through stderr") + << QString::fromLatin1("Sometext") << OutputParserTester::STDERR + << QString() << QString::fromLatin1("Sometext") + << QList() + << QString(); + + QTest::newRow("Rvct warning") + << QString::fromLatin1("\"../../../../s60-sdk/epoc32/include/stdapis/stlport/stl/_limits.h\", line 256: Warning: #68-D: integer conversion resulted in a change of sign\n" + " : public _Integer_limits\n" + " ^") + << OutputParserTester::STDERR + << QString() << QString() + << (QList() + << Task(Task::Warning, + QLatin1String("#68-D: integer conversion resulted in a change of sign\n" + " : public _Integer_limits\n" + " ^"), + QLatin1String("../../../../s60-sdk/epoc32/include/stdapis/stlport/stl/_limits.h"), 256, + Constants::TASK_CATEGORY_COMPILE) + ) + << QString(); + QTest::newRow("Rvct error") + << QString::fromLatin1("\"mainwindow.cpp\", line 22: Error: #20: identifier \"e\" is undefined\n" + " delete ui;e\n" + " ^") + << OutputParserTester::STDERR + << QString() << QString() + << (QList() + << Task(Task::Error, + QLatin1String("#20: identifier \"e\" is undefined\n" + " delete ui;e\n" + " ^"), + QLatin1String("mainwindow.cpp"), 22, + Constants::TASK_CATEGORY_COMPILE) + ) + << QString(); + QTest::newRow("Rvct linking error") + << QString::fromLatin1("Error: L6218E: Undefined symbol MainWindow::sth() (referred from mainwindow.o)") + << OutputParserTester::STDERR + << QString() << QString() + << (QList() + << Task(Task::Error, + QLatin1String("L6218E: Undefined symbol MainWindow::sth() (referred from mainwindow.o)"), + QString(), -1, + Constants::TASK_CATEGORY_COMPILE) + ) + << QString(); + QTest::newRow("Rvct license error") + << QString::fromLatin1("Error: C3397E: Cannot obtain license for Compiler (feature compiler) with license version >= 2.2:\n" + "Cannot find license file.\n" + " The license files (or license server system network addresses) attempted are \n" + "listed below. Use LM_LICENSE_FILE to use a different license file,\n" + " or contact your software provider for a license file.\n" + "Feature: compiler\n" + "Filename: /usr/local/flexlm/licenses/license.dat\n" + "License path: /usr/local/flexlm/licenses/license.dat\n" + "FLEXnet Licensing error:-1,359. System Error: 2 \"No such file or directory\"\n" + "For further information, refer to the FLEXnet Licensing End User Guide,\n" + "available at \"www.macrovision.com\".") + << OutputParserTester::STDERR + << QString() << QString() + << (QList() + << Task(Task::Error, + QLatin1String("C3397E: Cannot obtain license for Compiler (feature compiler) with license version >= 2.2:\n" + "Cannot find license file.\n" + " The license files (or license server system network addresses) attempted are \n" + "listed below. Use LM_LICENSE_FILE to use a different license file,\n" + " or contact your software provider for a license file.\n" + "Feature: compiler\n" + "Filename: /usr/local/flexlm/licenses/license.dat\n" + "License path: /usr/local/flexlm/licenses/license.dat\n" + "FLEXnet Licensing error:-1,359. System Error: 2 \"No such file or directory\"\n" + "For further information, refer to the FLEXnet Licensing End User Guide,\n" + "available at \"www.macrovision.com\"."), + QString(), -1, + Constants::TASK_CATEGORY_COMPILE) + ) + << QString(); +} + +void Qt4ProjectManagerPlugin::testRvctOutputParser() +{ + OutputParserTester testbench; + testbench.appendOutputParser(new RvctParser); + QFETCH(QString, input); + QFETCH(OutputParserTester::Channel, inputChannel); + QFETCH(QList, tasks); + QFETCH(QString, childStdOutLines); + QFETCH(QString, childStdErrLines); + QFETCH(QString, outputLines); + + testbench.testParsing(input, inputChannel, + tasks, childStdOutLines, childStdErrLines, + outputLines); +} +#endif diff --git a/src/plugins/qt4projectmanager/qt-s60/rvctparser.h b/src/plugins/qt4projectmanager/qt-s60/rvctparser.h index 8c29c26617f..7f588902b9e 100644 --- a/src/plugins/qt4projectmanager/qt-s60/rvctparser.h +++ b/src/plugins/qt4projectmanager/qt-s60/rvctparser.h @@ -42,16 +42,17 @@ class RvctParser : public ProjectExplorer::IOutputParser public: RvctParser(); + ~RvctParser(); virtual void stdError(const QString & line); private: - QRegExp m_warningOrError; - QRegExp m_doneWithFile; - QRegExp m_linkerProblem; + void sendTask(); - bool m_additionalInfo; - QString m_lastFile; - int m_lastLine; + QRegExp m_warningOrError; + QRegExp m_wrapUpTask; + QRegExp m_genericProblem; + + ProjectExplorer::Task * m_task; }; } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp index 3631c3bf577..ec646942b04 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp @@ -517,72 +517,41 @@ bool S60ToolChainMixin::equals(const S60ToolChainMixin &rhs) const && m_device.name == rhs.m_device.name; } +static const char *epocHeaderPathsC[] = { + "include", "mkspecs/common/symbian", "epoc32/include", + "epoc32/include/osextensions/stdapis", "epoc32/include/osextensions/stdapis/sys", + "epoc32/include/stdapis", "epoc32/include/stdapis/sys", + "epoc32/include/osextensions/stdapis/stlport", "epoc32/include/stdapis/stlport", + "epoc32/include/oem", "epoc32/include/middleware", "epoc32/include/domain/middleware", + "epoc32/include/osextensions", "epoc32/include/domain/osextensions", + "epoc32/include/domain/osextensions/loc", "epoc32/include/domain/middleware/loc", + "epoc32/include/domain/osextensions/loc/sc", "epoc32/include/domain/middleware/loc/sc" +}; + QList S60ToolChainMixin::epocHeaderPaths() const { QList rc; - const QString epocRootPath(S60Devices::cleanedRootPath(m_device.epocRoot)); - - rc << ProjectExplorer::HeaderPath(epocRootPath, - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("include"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("mkspecs/common/symbian"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/osextensions/stdapis"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/osextensions/stdapis/sys"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/stdapis"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/stdapis/sys"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/osextensions/stdapis/stlport"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/stdapis/stlport"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/oem"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/middleware"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/domain/middleware"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/osextensions"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/domain/osextensions"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/domain/osextensions/loc"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/domain/middleware/loc"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/domain/osextensions/loc/sc"), - ProjectExplorer::HeaderPath::GlobalHeaderPath) - << ProjectExplorer::HeaderPath(epocRootPath + QLatin1String("epoc32/include/domain/middleware/loc/sc"), - ProjectExplorer::HeaderPath::GlobalHeaderPath); + QString root = m_device.epocRoot + QLatin1Char('/'); + const int count = sizeof(epocHeaderPathsC) / sizeof(const char *); + for (int i = 0; i < count; ++i) + rc << ProjectExplorer::HeaderPath(root + QLatin1String(epocHeaderPathsC[i]), + ProjectExplorer::HeaderPath::GlobalHeaderPath); return rc; } void S60ToolChainMixin::addEpocToEnvironment(Utils::Environment *env) const { - QString epocRootPath(m_device.epocRoot); - if (!epocRootPath.endsWith(QChar('/'))) - epocRootPath.append(QChar('/')); + QDir epocDir(m_device.epocRoot); + env->prependOrSetPath(epocDir.filePath(QLatin1String("epoc32/tools"))); // e.g. make.exe + env->prependOrSetPath(epocDir.filePath(QLatin1String("epoc32/gcc/bin"))); // e.g. gcc.exe + env->prependOrSetPath(epocDir.filePath(QLatin1String("perl/bin"))); // e.g. perl.exe (special SDK version) - env->prependOrSetPath(QDir::toNativeSeparators(epocRootPath + QLatin1String("epoc32/tools"))); // e.g. make.exe - env->prependOrSetPath(QDir::toNativeSeparators(epocRootPath + QLatin1String("epoc32/gcc/bin"))); // e.g. gcc.exe - env->prependOrSetPath(QDir::toNativeSeparators(epocRootPath + QLatin1String("perl/bin"))); // e.g. perl.exe (special SDK version) - - QString sbsHome(env->value(QLatin1String("SBS_HOME"))); // Do we use Raptor/SBSv2? - if (!sbsHome.isEmpty()) - env->prependOrSetPath(sbsHome + QDir::separator() + QLatin1String("bin")); - // No longer set EPOCDEVICE as it conflicts with packaging - env->set(QLatin1String("EPOCROOT"), QDir::toNativeSeparators(S60Devices::cleanedRootPath(epocRootPath))); + addBaseToEnvironment(env); } static const char *gnuPocHeaderPathsC[] = { - "epoc32/include", "epoc32/include/variant", "epoc32/include/stdapis", + "epoc32/include", "epoc32/include/variant", "epoc32/include/stdapis", "epoc32/include/stdapis/stlport" }; QList S60ToolChainMixin::gnuPocHeaderPaths() const @@ -619,11 +588,19 @@ QList S60ToolChainMixin::gnuPocRvctHeaderPaths(int void S60ToolChainMixin::addGnuPocToEnvironment(Utils::Environment *env) const { env->prependOrSetPath(QDir::toNativeSeparators(m_device.toolsRoot + QLatin1String("/epoc32/tools"))); - const QString epocRootVar = QLatin1String("EPOCROOT"); - // No trailing slash is required here, so, do not perform path cleaning. - // The variable also should be set since it is currently used for autodetection. - if (env->find(epocRootVar) == env->constEnd()) - env->set(epocRootVar, m_device.epocRoot); + addBaseToEnvironment(env); +} + +void S60ToolChainMixin::addBaseToEnvironment(Utils::Environment *env) const +{ + QString sbsHome(env->value(QLatin1String("SBS_HOME"))); // Do we use Raptor/SBSv2? + if (!sbsHome.isEmpty()) + env->prependOrSetPath(sbsHome + QDir::separator() + QLatin1String("bin")); + + QString epocRootPath(m_device.epocRoot); + if (!epocRootPath.endsWith(QChar('/'))) + epocRootPath.append(QChar('/')); + env->set(QLatin1String("EPOCROOT"), QDir::toNativeSeparators(S60Devices::cleanedRootPath(epocRootPath))); } QDebug operator<<(QDebug db, const S60Devices::Device &d) diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devices.h b/src/plugins/qt4projectmanager/qt-s60/s60devices.h index 69d2a1a5e1e..8d60998754f 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devices.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devices.h @@ -184,6 +184,8 @@ public: QStringList gnuPocRvctLibPaths(int armver, bool debug) const; void addGnuPocToEnvironment(Utils::Environment *env) const; + void addBaseToEnvironment(Utils::Environment *env) const; + bool equals(const S60ToolChainMixin &rhs) const; private: diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp index 00f4f752051..ae1033c42d7 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -658,8 +658,12 @@ void Qt4BuildConfigurationFactory::update() m_versions.clear(); QtVersionManager *vm = QtVersionManager::instance(); foreach (const QtVersion *version, vm->versions()) { - m_versions.insert(QString::fromLatin1(QT4_BC_ID_PREFIX) + QString::fromLatin1("Qt%1").arg(version->uniqueId()), - VersionInfo(tr("Using Qt Version \"%1\"").arg(version->displayName()), version->uniqueId())); + if (version->isValid()) { + QString key = QString::fromLatin1(QT4_BC_ID_PREFIX) + + QString::fromLatin1("Qt%1").arg(version->uniqueId()); + VersionInfo info(tr("Using Qt Version \"%1\"").arg(version->displayName()), version->uniqueId()); + m_versions.insert(key, info); + } } emit availableCreationIdsChanged(); } @@ -718,6 +722,7 @@ BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target QLineEdit::Normal, version->displayName(), &ok); + buildConfigurationName = buildConfigurationName.trimmed(); if (!ok || buildConfigurationName.isEmpty()) return 0; diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h index 3fcfc8eb40c..f05803e11db 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h @@ -85,6 +85,8 @@ private slots: void testQtOutputParser(); void testSbsV2OutputParsers_data(); void testSbsV2OutputParsers(); + void testRvctOutputParser_data(); + void testRvctOutputParser(); #endif private: diff --git a/src/plugins/qt4projectmanager/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp index 9c3d23dcd77..41c5ab1b65a 100644 --- a/src/plugins/qt4projectmanager/qtoptionspage.cpp +++ b/src/plugins/qt4projectmanager/qtoptionspage.cpp @@ -54,6 +54,8 @@ #include #include +enum ModelRoles { BuildLogRole = Qt::UserRole, BuildRunningRole = Qt::UserRole + 1 }; + using namespace Qt4ProjectManager; using namespace Qt4ProjectManager::Internal; @@ -74,8 +76,14 @@ void DebuggingHelperBuildTask::run(QFutureInterface &future) { future.setProgressRange(0, 5); future.setProgressValue(1); - const QString output = m_version->buildDebuggingHelperLibrary(future); - emit finished(m_version->displayName(), output); + QString output; + QString errorMessage; + if (m_version->buildDebuggingHelperLibrary(future, false, &output, &errorMessage)) { + emit finished(m_version->displayName(), output); + } else { + qWarning("%s", qPrintable(errorMessage)); + emit finished(m_version->displayName(), errorMessage); + } deleteLater(); } @@ -232,7 +240,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList ver connect(m_ui->rebuildButton, SIGNAL(clicked()), this, SLOT(buildDebuggingHelper())); connect(m_ui->showLogButton, SIGNAL(clicked()), - this, SLOT(showDebuggingBuildLog())); + this, SLOT(slotShowDebuggingBuildLog())); showEnvironmentPage(0); updateState(); @@ -315,7 +323,9 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(const QString &name, cons // Update item view QTreeWidgetItem *item = treeItemForIndex(index); QTC_ASSERT(item, return) - item->setData(2, Qt::UserRole, output); + item->setData(2, BuildRunningRole, QVariant(false)); + item->setData(2, BuildLogRole, output); + QSharedPointerQtVersion qtVersion = m_versions.at(index); const bool success = qtVersion->hasDebuggingHelper() && (!QmlDumpTool::canBuild(qtVersion.data()) || qtVersion->hasQmlDump()) @@ -325,10 +335,11 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(const QString &name, cons // Update bottom control if the selection is still the same if (index == currentIndex()) { m_ui->showLogButton->setEnabled(true); + m_ui->rebuildButton->setEnabled(true); updateDebuggingHelperStateLabel(m_versions.at(index).data()); - if (!success) - showDebuggingBuildLog(); } + if (!success) + showDebuggingBuildLog(item); } void QtOptionsPageWidget::buildDebuggingHelper() @@ -337,7 +348,12 @@ void QtOptionsPageWidget::buildDebuggingHelper() if (index < 0) return; + QTreeWidgetItem *item = treeItemForIndex(index); + QTC_ASSERT(item, return); m_ui->showLogButton->setEnabled(false); + m_ui->rebuildButton->setEnabled(false); + item->setData(2, BuildRunningRole, QVariant(true)); + // Run a debugging helper build task in the background. DebuggingHelperBuildTask *buildTask = new DebuggingHelperBuildTask(m_versions.at(index)); connect(buildTask, SIGNAL(finished(QString,QString)), this, SLOT(debuggingHelperBuildFinished(QString,QString)), @@ -348,21 +364,44 @@ void QtOptionsPageWidget::buildDebuggingHelper() QLatin1String("Qt4ProjectManager::BuildHelpers")); } -void QtOptionsPageWidget::showDebuggingBuildLog() -{ - QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); +// Non-modal dialog +class BuildLogDialog : public QDialog { +public: + explicit BuildLogDialog(QWidget *parent = 0); + void setText(const QString &text); - int currentItemIndex = indexForTreeItem(currentItem); +private: + Ui_ShowBuildLog m_ui; +}; + +BuildLogDialog::BuildLogDialog(QWidget *parent) : QDialog(parent) +{ + m_ui.setupUi(this); + setAttribute(Qt::WA_DeleteOnClose, true); +} + +void BuildLogDialog::setText(const QString &text) +{ + m_ui.log->setPlainText(text); // Show and scroll to bottom + m_ui.log->moveCursor(QTextCursor::End); + m_ui.log->ensureCursorVisible(); +} + +void QtOptionsPageWidget::slotShowDebuggingBuildLog() +{ + if (const QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem()) + showDebuggingBuildLog(currentItem); +} + +void QtOptionsPageWidget::showDebuggingBuildLog(const QTreeWidgetItem *currentItem) +{ + const int currentItemIndex = indexForTreeItem(currentItem); if (currentItemIndex < 0) return; - // Show and scroll to bottom - QDialog dlg(this); - Ui_ShowBuildLog ui; - ui.setupUi(&dlg); - ui.log->setPlainText(currentItem->data(2, Qt::UserRole).toString()); - ui.log->moveCursor(QTextCursor::End); - ui.log->ensureCursorVisible(); - dlg.exec(); + BuildLogDialog *dialog = new BuildLogDialog(this); + dialog->setWindowTitle(tr("Debugging Helper Build Log for '%1'").arg(currentItem->text(0))); + dialog->setText(currentItem->data(2, BuildLogRole).toString()); + dialog->show(); } QtOptionsPageWidget::~QtOptionsPageWidget() @@ -472,10 +511,11 @@ void QtOptionsPageWidget::updateState() m_ui->s60SDKPath->setEnabled(s60SDKPathEnabled); m_ui->gccePath->setEnabled(enabled); - const bool hasLog = enabled && !m_ui->qtdirList->currentItem()->data(2, Qt::UserRole).toString().isEmpty(); + const QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); + const bool buildRunning = currentItem && currentItem->data(2, BuildRunningRole).toBool(); + const bool hasLog = enabled && currentItem && !currentItem->data(2, Qt::UserRole).toString().isEmpty(); m_ui->showLogButton->setEnabled(hasLog); - - m_ui->rebuildButton->setEnabled(version && version->isValid()); + m_ui->rebuildButton->setEnabled(version && version->isValid() && !buildRunning); updateDebuggingHelperStateLabel(version); } @@ -638,6 +678,7 @@ void QtOptionsPageWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem } else { m_ui->nameEdit->clear(); m_ui->qmakePath->setPath(QString()); // clear() + } showEnvironmentPage(item); updateState(); diff --git a/src/plugins/qt4projectmanager/qtoptionspage.h b/src/plugins/qt4projectmanager/qtoptionspage.h index 293dd323066..d13f6d0c42f 100644 --- a/src/plugins/qt4projectmanager/qtoptionspage.h +++ b/src/plugins/qt4projectmanager/qtoptionspage.h @@ -125,8 +125,11 @@ private slots: void updateCurrentGcceDirectory(); void msvcVersionChanged(); void buildDebuggingHelper(); - void showDebuggingBuildLog(); + void slotShowDebuggingBuildLog(); void debuggingHelperBuildFinished(const QString &versionName, const QString &output); + +private: + void showDebuggingBuildLog(const QTreeWidgetItem *currentItem); }; class QtOptionsPage : public Core::IOptionsPage diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index bbaa22eb97c..0e596a0bc0b 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -1670,15 +1670,26 @@ QStringList QtVersion::debuggingHelperLibraryLocations() const bool QtVersion::supportsBinaryDebuggingHelper() const { - QList types = possibleToolChainTypes(); - if (types.contains(ProjectExplorer::ToolChain::GCC) - || types.contains(ProjectExplorer::ToolChain::LINUX_ICC) - || types.contains(ProjectExplorer::ToolChain::MSVC) - || types.contains(ProjectExplorer::ToolChain::WINCE) - || types.contains(ProjectExplorer::ToolChain::GCC_MAEMO) - || types.contains(ProjectExplorer::ToolChain::OTHER) - || types.contains(ProjectExplorer::ToolChain::UNKNOWN)) - return true; + foreach (ProjectExplorer::ToolChain::ToolChainType type, possibleToolChainTypes()) + switch (type) { + case ProjectExplorer::ToolChain::GCC: + case ProjectExplorer::ToolChain::LINUX_ICC: + case ProjectExplorer::ToolChain::MinGW: + case ProjectExplorer::ToolChain::MSVC: + case ProjectExplorer::ToolChain::WINCE: + case ProjectExplorer::ToolChain::GCC_MAEMO: + case ProjectExplorer::ToolChain::OTHER: + case ProjectExplorer::ToolChain::UNKNOWN: + return true; + case ProjectExplorer::ToolChain::WINSCW: + case ProjectExplorer::ToolChain::GCCE : + case ProjectExplorer::ToolChain::RVCT_ARMV5: + case ProjectExplorer::ToolChain::RVCT_ARMV6: + case ProjectExplorer::ToolChain::GCCE_GNUPOC: + case ProjectExplorer::ToolChain::RVCT_ARMV5_GNUPOC: + case ProjectExplorer::ToolChain::INVALID: + break; + } return false; } @@ -1745,66 +1756,70 @@ bool QtVersion::isQt64Bit() const #endif } -QString QtVersion::buildDebuggingHelperLibrary(QFutureInterface &future, bool onlyQmlDump) +bool QtVersion::buildDebuggingHelperLibrary(QFutureInterface &future, + bool onlyQmlDump, + QString *output, QString *errorMessage) { - QString qtInstallHeaders = versionInfo().value("QT_INSTALL_HEADERS"); - QString qtInstallData = versionInfo().value("QT_INSTALL_DATA"); - if (qtInstallData.isEmpty()) - return QString(); + const QString qtInstallData = versionInfo().value("QT_INSTALL_DATA"); + if (qtInstallData.isEmpty()) { + *errorMessage = + QCoreApplication::translate("QtVersion", + "Cannot determine the installation path for Qt version '%1'."). + arg(displayName()); + return false; + } Utils::Environment env = Utils::Environment::systemEnvironment(); addToEnvironment(env); // TODO: the debugging helper doesn't comply to actual tool chain yet QList > alltc = toolChains(); ProjectExplorer::ToolChain *tc = alltc.isEmpty() ? 0 : alltc.first().data(); - if (!tc) - return QCoreApplication::translate("QtVersion", "The Qt Version has no toolchain."); + if (!tc) { + *errorMessage = QCoreApplication::translate("QtVersion", "The Qt Version has no toolchain."); + return false; + } tc->addToEnvironment(env); - QString output; + const QString target = (tc->type() == ToolChain::GCC_MAEMO ? QLatin1String("-unix") : QLatin1String("")); + + // invalidate cache + m_versionInfoUpToDate = false; if (!onlyQmlDump) { - QString gdbHelperDirectory = DebuggingHelperLibrary::copy(qtInstallData, &output); - if (!gdbHelperDirectory.isEmpty()) { - output += DebuggingHelperLibrary::build(gdbHelperDirectory, tc->makeCommand(), - qmakeCommand(), mkspec(), env, - (tc->type() == ToolChain::GCC_MAEMO ? QLatin1String("-unix") : QLatin1String(""))); - } + const QString gdbHelperDirectory = DebuggingHelperLibrary::copy(qtInstallData, errorMessage); + if (gdbHelperDirectory.isEmpty()) + return false; + if (!DebuggingHelperLibrary::build(gdbHelperDirectory, tc->makeCommand(), + qmakeCommand(), mkspec(), env, + target, output, errorMessage)) + return false; + future.setProgressValue(2); if (QmlObserverTool::canBuild(this)) { - QString toolDirectory = QmlObserverTool::copy(qtInstallData, &output); - if (!toolDirectory.isEmpty()) { - output += QmlObserverTool::build(toolDirectory, tc->makeCommand(), - qmakeCommand(), mkspec(), env, - (tc->type() == ToolChain::GCC_MAEMO ? QLatin1String("-unix") : QLatin1String(""))); - } + const QString toolDirectory = QmlObserverTool::copy(qtInstallData, errorMessage); + if (toolDirectory.isEmpty()) + return false; + if (!QmlObserverTool::build(toolDirectory, tc->makeCommand(), + qmakeCommand(), mkspec(), env, target, output, errorMessage)) + return false; } else { - output += QCoreApplication::tr("Cannot build QMLObserver; Qt version must be 4.7.1 or higher."); + output->append(QCoreApplication::translate("Qt4ProjectManager::QtVersion", "Warning: Cannot build QMLObserver; Qt version must be 4.7.1 or higher.")); } future.setProgressValue(3); } if (QmlDumpTool::canBuild(this)) { - QString toolDirectory = QmlDumpTool::copy(qtInstallData, &output); - if (!toolDirectory.isEmpty()) { - output += QmlDumpTool::build(toolDirectory, tc->makeCommand(), - qmakeCommand(), mkspec(), env, - (tc->type() == ToolChain::GCC_MAEMO ? QLatin1String("-unix") : QLatin1String(""))); - } + const QString qmlDumpToolDirectory = QmlDumpTool::copy(qtInstallData, errorMessage); + if (qmlDumpToolDirectory.isEmpty()) + return false; + if (!QmlDumpTool::build(qmlDumpToolDirectory, tc->makeCommand(), + qmakeCommand(), mkspec(), env, target, output, errorMessage)) + return false; + } else { - output += QCoreApplication::tr("Cannot build qmldump; Qt version must be 4.7.1 or higher."); + output->append(QCoreApplication::translate("Qt4ProjectManager::QtVersion", "Warning: Cannot build qmldump; Qt version must be 4.7.1 or higher.")); } future.setProgressValue(4); - // invalidate version before updating version info - m_versionInfoUpToDate = false; - updateVersionInfo(); - - if (!onlyQmlDump) { - m_hasDebuggingHelper = !debuggingHelperLibrary().isEmpty(); - m_hasQmlObserver = !qmlObserverTool().isEmpty(); - } - m_hasQmlDump = !qmlDumpTool().isEmpty(); - - return output; + return true; } diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h index b1bb046bcb2..ba6dbabab43 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -122,7 +122,8 @@ public: // Builds a debugging library // returns the output of the commands - QString buildDebuggingHelperLibrary(QFutureInterface &future, bool onlyQmlDump = false); + bool buildDebuggingHelperLibrary(QFutureInterface &future, bool onlyQmlDump, + QString *output, QString *errorMessage); bool hasExamples() const; QString examplesPath() const; diff --git a/src/plugins/qt4projectmanager/showbuildlog.ui b/src/plugins/qt4projectmanager/showbuildlog.ui index 5b31a76861c..e29e89494db 100644 --- a/src/plugins/qt4projectmanager/showbuildlog.ui +++ b/src/plugins/qt4projectmanager/showbuildlog.ui @@ -30,7 +30,7 @@ Qt::Horizontal - QDialogButtonBox::Ok + QDialogButtonBox::Close diff --git a/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp b/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp index b15b995dd49..87fac8e1612 100644 --- a/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp @@ -98,7 +98,12 @@ Core::BaseFileWizardParameters QmlStandaloneAppWizard::parameters() parameters.setIcon(QIcon(QLatin1String(Constants::ICON_QML_STANDALONE))); parameters.setDisplayName(tr("Qt Quick Application")); parameters.setId(QLatin1String("QA.QMLA Application")); - parameters.setDescription(tr("Creates a Qt Quick application that you can deploy to mobile devices.")); + parameters.setDescription(tr("Creates a Qt Quick application project that can contain " + "both QML and C++ code and includes a QDeclarativeView.\n\n" + "You can build the application and deploy it on desktop and " + "mobile target platforms. For example, you can create signed " + "Symbian Installation System (SIS) packages for this type of " + "projects.")); parameters.setCategory(QLatin1String(Constants::QML_WIZARD_CATEGORY)); parameters.setDisplayCategory(QCoreApplication::translate(Constants::QML_WIZARD_TR_SCOPE, Constants::QML_WIZARD_TR_CATEGORY)); diff --git a/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizardsourcespage.ui b/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizardsourcespage.ui index ffe258e3863..136b85b91d5 100644 --- a/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizardsourcespage.ui +++ b/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizardsourcespage.ui @@ -23,7 +23,7 @@ - New 'main.qml' file, generated by this wizard. + Generate a main.qml file @@ -65,7 +65,7 @@ - Note: All files and directories which reside in the same directory as the Main QML File will be deployed. You can anytime modify the contents of that directory before deploying. + Note: All files and directories that reside in the same directory as the main QML file are deployed. You can modify the contents of the directory any time before deploying. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 5e47b9d07a7..05841df1124 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -632,7 +632,7 @@ void SubversionPlugin::revertAll() const VCSBase::VCSBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return) const QString title = tr("Revert repository"); - if (QMessageBox::warning(0, title, tr("Would you like to revert all changes to the repository?"), + if (QMessageBox::warning(0, title, tr("Revert all pending changes to the repository?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) return; // NoteL: Svn "revert ." doesn not work. diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp index 3cc51184413..303424dfac1 100644 --- a/src/plugins/texteditor/refactoringchanges.cpp +++ b/src/plugins/texteditor/refactoringchanges.cpp @@ -202,7 +202,7 @@ RefactoringFile::RefactoringFile(const RefactoringFile &other) RefactoringFile::~RefactoringFile() { - if (m_refactoringChanges && m_openEditor) + if (m_refactoringChanges && m_openEditor && !m_fileName.isEmpty()) m_editor = m_refactoringChanges->openEditor(m_fileName, -1); // apply changes, if any @@ -227,14 +227,15 @@ RefactoringFile::~RefactoringFile() } // if this document doesn't have an editor, write the result to a file - if (!m_editor) { + if (!m_editor && !m_fileName.isEmpty()) { const QByteArray &newContents = doc->toPlainText().toUtf8(); QFile file(m_fileName); file.open(QFile::WriteOnly); file.write(newContents); } - m_refactoringChanges->fileChanged(m_fileName); + if (!m_fileName.isEmpty()) + m_refactoringChanges->fileChanged(m_fileName); } delete m_document; @@ -254,9 +255,9 @@ QTextDocument *RefactoringFile::mutableDocument() const { if (m_editor) return m_editor->document(); - else if (!m_document && !m_fileName.isEmpty()) { + else if (!m_document) { QString fileContents; - { + if (!m_fileName.isEmpty()) { QFile file(m_fileName); if (file.open(QIODevice::ReadOnly)) fileContents = file.readAll(); diff --git a/src/plugins/texteditor/tooltip/tips.cpp b/src/plugins/texteditor/tooltip/tips.cpp index 26b1d8ac3bc..7673413923f 100644 --- a/src/plugins/texteditor/tooltip/tips.cpp +++ b/src/plugins/texteditor/tooltip/tips.cpp @@ -109,6 +109,8 @@ bool ColorTip::handleContentReplacement(const TipContent &content) const void ColorTip::paintEvent(QPaintEvent *event) { + QTipLabel::paintEvent(event); + const QColor &color = static_cast(content()).color(); QPen pen; @@ -124,8 +126,6 @@ void ColorTip::paintEvent(QPaintEvent *event) QRect r(1, 1, rect().width() - 2, rect().height() - 2); painter.drawTiledPixmap(r, m_tilePixMap); painter.drawRect(r); - - QLabel::paintEvent(event); } TextTip::TextTip(QWidget *parent) : QTipLabel(parent) diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.cpp b/src/plugins/vcsbase/basecheckoutwizardpage.cpp index 111d069fb5c..b575e839492 100644 --- a/src/plugins/vcsbase/basecheckoutwizardpage.cpp +++ b/src/plugins/vcsbase/basecheckoutwizardpage.cpp @@ -53,6 +53,8 @@ BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) : connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(validChanged()), this, SLOT(slotChanged())); connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(textEdited(QString)), this, SLOT(slotDirectoryEdited())); + connect(d->ui.branchComboBox, SIGNAL(currentIndexChanged(int)), + this, SLOT(slotChanged())); d->ui.pathChooser->setExpectedKind(Utils::PathChooser::Directory); connect(d->ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged())); @@ -67,14 +69,31 @@ BaseCheckoutWizardPage::~BaseCheckoutWizardPage() delete d; } -void BaseCheckoutWizardPage::addControl(QWidget *w) +void BaseCheckoutWizardPage::addLocalControl(QWidget *w) { - d->ui.formLayout->addRow(w); + d->ui.localLayout->addRow(w); } -void BaseCheckoutWizardPage::addControl(QString &description, QWidget *w) +void BaseCheckoutWizardPage::addLocalControl(QString &description, QWidget *w) { - d->ui.formLayout->addRow(description, w); + d->ui.localLayout->addRow(description, w); +} + +void BaseCheckoutWizardPage::addRepositoryControl(QWidget *w) +{ + d->ui.repositoryLayout->addRow(w); +} + +bool BaseCheckoutWizardPage::checkIsValid() const +{ + return d->ui.pathChooser->isValid() + && d->ui.checkoutDirectoryLineEdit->isValid() + && !d->ui.repositoryLineEdit->text().isEmpty(); +} + +void BaseCheckoutWizardPage::addRepositoryControl(QString &description, QWidget *w) +{ + d->ui.repositoryLayout->addRow(description, w); } bool BaseCheckoutWizardPage::isBranchSelectorVisible() const @@ -167,6 +186,7 @@ void BaseCheckoutWizardPage::slotRefreshBranches() if (current >= 0 && current < branchList.size()) d->ui.branchComboBox->setCurrentIndex(current); } + slotChanged(); } void BaseCheckoutWizardPage::slotRepositoryChanged(const QString &repo) @@ -212,9 +232,7 @@ bool BaseCheckoutWizardPage::isComplete() const void BaseCheckoutWizardPage::slotChanged() { - const bool valid = d->ui.pathChooser->isValid() - && d->ui.checkoutDirectoryLineEdit->isValid() - && !d->ui.repositoryLineEdit->text().isEmpty(); + const bool valid = checkIsValid(); if (valid != d->m_valid) { d->m_valid = valid; diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.h b/src/plugins/vcsbase/basecheckoutwizardpage.h index f4471298a77..9d5cbcc5194 100644 --- a/src/plugins/vcsbase/basecheckoutwizardpage.h +++ b/src/plugins/vcsbase/basecheckoutwizardpage.h @@ -71,7 +71,7 @@ public: virtual bool isComplete() const; - bool isBranchSelectorVisible() const ; + bool isBranchSelectorVisible() const; protected: void changeEvent(QEvent *e); @@ -88,8 +88,14 @@ protected: virtual QStringList branches(const QString &repository, int *current); /* Add additional controls */ - void addControl(QWidget *w); - void addControl(QString &description, QWidget *w); + void addLocalControl(QWidget *w); + void addLocalControl(QString &description, QWidget *w); + + void addRepositoryControl(QWidget *w); + void addRepositoryControl(QString &description, QWidget *w); + + /* Override validity information */ + virtual bool checkIsValid() const; private slots: void slotRepositoryChanged(const QString &url); diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.ui b/src/plugins/vcsbase/basecheckoutwizardpage.ui index eb48ba9b467..f94995ccdf2 100644 --- a/src/plugins/vcsbase/basecheckoutwizardpage.ui +++ b/src/plugins/vcsbase/basecheckoutwizardpage.ui @@ -13,64 +13,129 @@ WizardPage - + - - - - - - - - - - - Checkout Directory: - - - - - - - - - - Path: - - - - - - - - - - Branch: - - - - - - - - - - 0 - 0 - - - - - - - - ... - - - - - - + + + Repository + + + true + + + false + + + + + + + + + The remote repository to check out. + + + + + + + + + + Branch: + + + + + + + + + + 0 + 0 + + + + The development branch in the remote repository to check out. + + + + + + + + + + Retrieve list of branches in repository. + + + ... + + + + + + + + + + + + Working Copy + + + true + + + + + + The path in which the directory containing the checkout will be created. + + + Checkout Path: + + + + + + + + + + The local directory that will contain the code after the checkout. + + + Checkout Directory: + + + + + + + The local directory that will contain the code after the checkout. + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + @@ -82,9 +147,8 @@ Utils::PathChooser - QWidget -
utils/pathchooser.h
- 1 + QLineEdit +
utils/pathchooser.h
diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 333452b70e0..cfc10e88b88 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -466,6 +466,8 @@ VCSBaseSubmitEditor::PromptSubmitResult bool *promptSetting, bool forcePrompt) const { + raiseSubmitEditor(); + QString errorMessage; QMessageBox::StandardButton answer = QMessageBox::Yes; @@ -482,7 +484,8 @@ VCSBaseSubmitEditor::PromptSubmitResult const QDialogButtonBox::StandardButton danswer = Utils::CheckableMessageBox::question(parent, title, question, tr("Prompt to submit"), promptSetting, - QDialogButtonBox::Yes|QDialogButtonBox::No|QDialogButtonBox::Cancel, + QDialogButtonBox::Yes|QDialogButtonBox::No| + QDialogButtonBox::Cancel, QDialogButtonBox::Yes); answer = Utils::CheckableMessageBox::dialogButtonBoxToMessageBoxButton(danswer); } else { @@ -501,14 +504,14 @@ VCSBaseSubmitEditor::PromptSubmitResult answer = static_cast(msgBox.exec()); } switch (answer) { - case QMessageBox::Cancel: - return SubmitCanceled; case QMessageBox::No: return SubmitDiscarded; + case QMessageBox::Yes: + return SubmitConfirmed; default: break; } - return SubmitConfirmed; + return SubmitCanceled; } QString VCSBaseSubmitEditor::promptForNickName() diff --git a/src/plugins/welcome/images/background_center_frame.png b/src/plugins/welcome/images/background_center_frame.png index 76c166333ad..d8f03519961 100644 Binary files a/src/plugins/welcome/images/background_center_frame.png and b/src/plugins/welcome/images/background_center_frame.png differ diff --git a/src/plugins/welcome/images/center_frame_header.png b/src/plugins/welcome/images/center_frame_header.png index f59cc41a48b..4d840b48f96 100644 Binary files a/src/plugins/welcome/images/center_frame_header.png and b/src/plugins/welcome/images/center_frame_header.png differ diff --git a/src/plugins/welcome/welcomemode.ui b/src/plugins/welcome/welcomemode.ui index d91c4d02d79..c8f6dbf6840 100644 --- a/src/plugins/welcome/welcomemode.ui +++ b/src/plugins/welcome/welcomemode.ui @@ -95,13 +95,13 @@ QToolButton:pressed, QPushButton:pressed{ - 662 + 700 550 - 662 + 750 550 @@ -153,13 +153,13 @@ QToolButton:pressed, QPushButton:pressed{ 649 - 74 + 50 649 - 89 + 50 diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index eb1b7f74637..414b27fbbd4 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -4041,12 +4041,12 @@ bool Parser::parseObjCSelectorExpression(ExpressionAST *&node) last->value->name_token = identifier_token; last->value->colon_token = consumeToken(); - while (LA() != T_RPAREN) { + while (LA(1) == T_IDENTIFIER && LA(2) == T_COLON) { last->next = new (_pool) ObjCSelectorArgumentListAST; last = last->next; last->value = new (_pool) ObjCSelectorArgumentAST; - match(T_IDENTIFIER, &last->value->name_token); - match(T_COLON, &last->value->colon_token); + last->value->name_token = consumeToken(); + last->value->colon_token = consumeToken(); } } else { ObjCSelectorAST *args = new (_pool) ObjCSelectorAST; @@ -4056,7 +4056,13 @@ bool Parser::parseObjCSelectorExpression(ExpressionAST *&node) args->selector_argument_list->value->name_token = identifier_token; } + if (LA(1) == T_IDENTIFIER && LA(2) == T_RPAREN) { + const char *txt = tok(1).spell(); + consumeToken(); + error(cursor(), "missing ':' after '%s'", txt); + } match(T_RPAREN, &ast->rparen_token); + node = ast; return true; } diff --git a/src/shared/help/indexwindow.cpp b/src/shared/help/indexwindow.cpp index d58188b3f13..03795f65ecd 100644 --- a/src/shared/help/indexwindow.cpp +++ b/src/shared/help/indexwindow.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include diff --git a/tests/auto/cplusplus/ast/tst_ast.cpp b/tests/auto/cplusplus/ast/tst_ast.cpp index af819e871f9..4578de13d6f 100644 --- a/tests/auto/cplusplus/ast/tst_ast.cpp +++ b/tests/auto/cplusplus/ast/tst_ast.cpp @@ -83,6 +83,8 @@ private slots: void objc_protocol_forward_declaration_1(); void objc_protocol_definition_1(); void objc_method_attributes_1(); + void objc_selector_error_recovery_1(); + void objc_selector_error_recovery_2(); // expressions with (square) brackets void normal_array_access(); @@ -832,6 +834,35 @@ void tst_AST::objc_method_attributes_1() QCOMPARE(unit->spell(unavailableAttr->identifier_token), "unavailable"); } +/* + @selector(foo) + @selector(foo:) + @selector(foo:bar:) + ... + */ +void tst_AST::objc_selector_error_recovery_1() +{ + QSharedPointer unit(parseDeclaration("\n" + "void tst() {\n" + " @selector(foo:\n" + " int i = 1;\n" + "}\n" + )); + AST *ast = unit->ast(); + QVERIFY(ast); +} + +void tst_AST::objc_selector_error_recovery_2() +{ + QSharedPointer unit(parseDeclaration("\n" + "void tst() {\n" + " @selector(foo:bar);\n" + "}\n" + )); + AST *ast = unit->ast(); + QVERIFY(ast); +} + void tst_AST::normal_array_access() { QSharedPointer unit(parseDeclaration("\n" diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index ae8d351a478..7252902ebfc 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -196,7 +196,6 @@ private slots: private: void dumpQAbstractItemHelper(QModelIndex &index); void dumpQAbstractItemModelHelper(QAbstractItemModel &m); - void dumpQDateTimeHelper(const QDateTime &d, bool isNull); template void dumpQHashNodeHelper(QHash &hash); void dumpQImageHelper(const QImage &img); void dumpQImageDataHelper(QImage &img); @@ -949,41 +948,30 @@ void tst_Dumpers::dumpQChar() &c, NS"QChar", false); } -void tst_Dumpers::dumpQDateTimeHelper(const QDateTime &d, bool isNull) +void tst_Dumpers::dumpQDateTime() { - QByteArray value; - if (d.isNull()) - value = "value='(null)'"; - else - value = QByteArray("value='%',valueencoded='2'") - << utfToBase64(d.toString()); + // Case 1: Null object. + QDateTime d; + testDumper("value='(null)',type='$T',numchild='0'", + &d, NS"QDateTime", true); - QByteArray expected = QByteArray("%,type='$T',numchild='3',children=[" - "{name='isNull',%}," + // Case 2: Non-null object. + d = QDateTime::currentDateTime(); + testDumper(QByteArray("value='%',valueencoded='2'," + "type='$T',numchild='1',children=[" "{name='toTime_t',%}," "{name='toString',%}," "{name='toString_(ISO)',%}," "{name='toString_(SystemLocale)',%}," "{name='toString_(Locale)',%}]") - << value - << generateBoolSpec(d.isNull()) + << utfToBase64(d.toString()) << generateLongSpec((d.toTime_t())) - << generateQStringSpec(d.toString(), isNull) - << generateQStringSpec(d.toString(Qt::ISODate), isNull) - << generateQStringSpec(d.toString(Qt::SystemLocaleDate), isNull) - << generateQStringSpec(d.toString(Qt::LocaleDate), isNull); - testDumper(expected, &d, NS"QDateTime", true); -} + << generateQStringSpec(d.toString()) + << generateQStringSpec(d.toString(Qt::ISODate)) + << generateQStringSpec(d.toString(Qt::SystemLocaleDate)) + << generateQStringSpec(d.toString(Qt::LocaleDate)), + &d, NS"QDateTime", true); -void tst_Dumpers::dumpQDateTime() -{ - // Case 1: Null object. - QDateTime d; - dumpQDateTimeHelper(d, true); - - // Case 2: Non-null object. - d = QDateTime::currentDateTime(); - dumpQDateTimeHelper(d, false); } void tst_Dumpers::dumpQDir() @@ -1196,11 +1184,9 @@ void tst_Dumpers::dumpQHashNode() void tst_Dumpers::dumpQImageHelper(const QImage &img) { - QByteArray expected = "value='(%x%)',type='"NS"QImage',numchild='1'," - "children=[{name='data',type='"NS"QImageData',addr='%'}]" + QByteArray expected = "value='(%x%)',type='"NS"QImage',numchild='0'" << N(img.width()) - << N(img.height()) - << ptrToBa(&img); + << N(img.height()); testDumper(expected, &img, NS"QImage", true); } diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index cec7f02433b..7ffb98ff6d3 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp @@ -121,7 +121,7 @@ void tst_TestCore::cleanupTestCase() void tst_TestCore::testModelCreateCoreModel() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer testView(new TestView(model.data())); @@ -140,17 +140,17 @@ void tst_TestCore::loadEmptyCoreModel() textEdit1.setPlainText(file.readAll()); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item")); + QScopedPointer model1(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); model1->attachView(testRewriterView1.data()); QPlainTextEdit textEdit2; - textEdit2.setPlainText("import QtQuick 1.0; Item{}"); + textEdit2.setPlainText("import Qt 4.7; Item{}"); NotIndentingTextEditModifier modifier2(&textEdit2); - QScopedPointer model2(Model::create("QtQuick/item")); + QScopedPointer model2(Model::create("Qt/item")); QScopedPointer testRewriterView2(new TestRewriterView()); testRewriterView2->setTextModifier(&modifier2); @@ -163,10 +163,10 @@ void tst_TestCore::testRewriterView() { try { QPlainTextEdit textEdit; - textEdit.setPlainText("import QtQuick 1.0;\n\nItem {\n}\n"); + textEdit.setPlainText("import Qt 4.7;\n\nItem {\n}\n"); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -179,15 +179,15 @@ void tst_TestCore::testRewriterView() testRewriterView->setTextModifier(&textModifier); model->attachView(testRewriterView.data()); - ModelNode childNode(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data")); + ModelNode childNode(addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data")); QVERIFY(childNode.isValid()); childNode.setId("childNode"); - ModelNode childNode2(addNodeListChild(childNode, "QtQuick/Rectangle", 1, 0, "data")); + ModelNode childNode2(addNodeListChild(childNode, "Qt/Rectangle", 4, 7, "data")); childNode2.setId("childNode2"); - ModelNode childNode3(addNodeListChild(childNode2, "QtQuick/Rectangle", 1, 0, "data")); + ModelNode childNode3(addNodeListChild(childNode2, "Qt/Rectangle", 4, 7, "data")); childNode3.setId("childNode3"); - ModelNode childNode4(addNodeListChild(childNode3, "QtQuick/Rectangle", 1, 0, "data")); + ModelNode childNode4(addNodeListChild(childNode3, "Qt/Rectangle", 4, 7, "data")); childNode4.setId("childNode4"); QVERIFY(childNode.isValid()); @@ -213,7 +213,7 @@ void tst_TestCore::testRewriterView() testRewriterView->modelToTextMerger()->applyChanges(); - childNode = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + childNode = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(testRewriterView->modelToTextMerger()->isNodeScheduledForAddition(childNode)); testRewriterView->modelToTextMerger()->applyChanges(); @@ -233,10 +233,10 @@ void tst_TestCore::testRewriterView() void tst_TestCore::testRewriterErrors() { QPlainTextEdit textEdit; - textEdit.setPlainText("import QtQuick 1.0;\n\nItem {\n}\n"); + textEdit.setPlainText("import Qt 4.7;\n\nItem {\n}\n"); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -250,10 +250,10 @@ void tst_TestCore::testRewriterErrors() model->attachView(testRewriterView.data()); QVERIFY(testRewriterView->errors().isEmpty()); - textEdit.setPlainText("import QtQuick 1.0;\n\nError {\n}\n"); + textEdit.setPlainText("import Qt 4.7;\n\nError {\n}\n"); QVERIFY(!testRewriterView->errors().isEmpty()); - textEdit.setPlainText("import QtQuick 1.0;\n\nItem {\n}\n"); + textEdit.setPlainText("import Qt 4.7;\n\nItem {\n}\n"); QVERIFY(testRewriterView->errors().isEmpty()); } @@ -267,7 +267,7 @@ void tst_TestCore::saveEmptyCoreModel() textEdit1.setPlainText(file.readAll()); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item")); + QScopedPointer model1(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -279,10 +279,10 @@ void tst_TestCore::saveEmptyCoreModel() modifier1.save(&buffer); QPlainTextEdit textEdit2; - textEdit2.setPlainText("import QtQuick 1.0; Item{}"); + textEdit2.setPlainText("import Qt 4.7; Item{}"); NotIndentingTextEditModifier modifier2(&textEdit2); - QScopedPointer model2(Model::create("QtQuick/item")); + QScopedPointer model2(Model::create("Qt/item")); QScopedPointer testRewriterView2(new TestRewriterView()); testRewriterView2->setTextModifier(&modifier2); @@ -302,17 +302,17 @@ void tst_TestCore::loadAttributesInCoreModel() textEdit1.setPlainText(file.readAll()); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item")); + QScopedPointer model1(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); model1->attachView(testRewriterView1.data()); QPlainTextEdit textEdit2; - textEdit2.setPlainText("import QtQuick 1.0; Item{}"); + textEdit2.setPlainText("import Qt 4.7; Item{}"); NotIndentingTextEditModifier modifier2(&textEdit2); - QScopedPointer model2(Model::create("QtQuick/item")); + QScopedPointer model2(Model::create("Qt/item")); QScopedPointer testRewriterView2(new TestRewriterView()); testRewriterView2->setTextModifier(&modifier2); @@ -337,7 +337,7 @@ void tst_TestCore::saveAttributesInCoreModel() textEdit1.setPlainText(file.readAll()); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item")); + QScopedPointer model1(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -353,7 +353,7 @@ void tst_TestCore::saveAttributesInCoreModel() textEdit2.setPlainText(buffer.data()); NotIndentingTextEditModifier modifier2(&textEdit2); - QScopedPointer model2(Model::create("QtQuick/Item")); + QScopedPointer model2(Model::create("Qt/Item")); QScopedPointer testRewriterView2(new TestRewriterView()); testRewriterView2->setTextModifier(&modifier2); @@ -368,7 +368,7 @@ void tst_TestCore::testModelCreateRect() { try { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -376,7 +376,7 @@ void tst_TestCore::testModelCreateRect() model->attachView(view.data()); QVERIFY(view->rootModelNode().isValid()); - ModelNode childNode = addNodeListChild(view->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(view->rootModelNode(), "Qt/Rectangle", 4, 7, "data"); QVERIFY(childNode.isValid()); QVERIFY(view->rootModelNode().allDirectSubModelNodes().contains(childNode)); QVERIFY(childNode.parentProperty().parentModelNode() == view->rootModelNode()); @@ -404,7 +404,7 @@ void tst_TestCore::testModelCreateRect() void tst_TestCore::testRewriterDynamicProperties() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " property int i\n" @@ -431,7 +431,7 @@ void tst_TestCore::testRewriterDynamicProperties() textEdit1.setPlainText(qmlString); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item")); + QScopedPointer model1(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -521,10 +521,10 @@ void tst_TestCore::testRewriterDynamicProperties() // test model2text // QPlainTextEdit textEdit2; -// textEdit2.setPlainText("import QtQuick 1.0; Item{}"); +// textEdit2.setPlainText("import Qt 4.7; Item{}"); // NotIndentingTextEditModifier modifier2(&textEdit2); // -// QScopedPointer model2(Model::create("QtQuick/Item")); +// QScopedPointer model2(Model::create("Qt/Item")); // // QScopedPointer testRewriterView2(new TestRewriterView()); // testRewriterView2->setTextModifier(&modifier2); @@ -538,7 +538,7 @@ void tst_TestCore::testRewriterDynamicProperties() void tst_TestCore::testRewriterGroupedProperties() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Text {\n" " font {\n" @@ -551,7 +551,7 @@ void tst_TestCore::testRewriterGroupedProperties() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier modifier1(&textEdit); - QScopedPointer model1(Model::create("QtQuick/Text")); + QScopedPointer model1(Model::create("Qt/Text")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -575,7 +575,7 @@ void tst_TestCore::testRewriterGroupedProperties() rootModelNode.removeProperty(QLatin1String("font.pointSize")); const QLatin1String expected("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Text {\n" "}\n"); @@ -586,7 +586,7 @@ void tst_TestCore::testRewriterGroupedProperties() void tst_TestCore::testRewriterPreserveOrder() { const QLatin1String qmlString1("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "width: 640\n" @@ -607,7 +607,7 @@ void tst_TestCore::testRewriterPreserveOrder() "}\n" "}\n"); const QLatin1String qmlString2("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "width: 640\n" @@ -633,7 +633,7 @@ void tst_TestCore::testRewriterPreserveOrder() textEdit.setPlainText(qmlString2); NotIndentingTextEditModifier modifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Text")); + QScopedPointer model(Model::create("Qt/Text")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&modifier); @@ -646,7 +646,7 @@ void tst_TestCore::testRewriterPreserveOrder() RewriterTransaction transaction = testRewriterView->beginRewriterTransaction(); - ModelNode newModelNode = testRewriterView->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode newModelNode = testRewriterView->createModelNode("Qt/Rectangle", 4, 7); newModelNode.setParentProperty(rootModelNode.nodeAbstractProperty("data")); @@ -668,7 +668,7 @@ void tst_TestCore::testRewriterPreserveOrder() textEdit.setPlainText(qmlString1); NotIndentingTextEditModifier modifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Text")); + QScopedPointer model(Model::create("Qt/Text")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&modifier); @@ -681,7 +681,7 @@ void tst_TestCore::testRewriterPreserveOrder() RewriterTransaction transaction = testRewriterView->beginRewriterTransaction(); - ModelNode newModelNode = testRewriterView->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode newModelNode = testRewriterView->createModelNode("Qt/Rectangle", 4, 7); newModelNode.setParentProperty(rootModelNode.nodeAbstractProperty("data")); @@ -702,7 +702,7 @@ void tst_TestCore::testRewriterPreserveOrder() void tst_TestCore::testRewriterActionCompression() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " id: root\n" @@ -722,7 +722,7 @@ void tst_TestCore::testRewriterActionCompression() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier modifier1(&textEdit); - QScopedPointer model1(Model::create("QtQuick/Rectangle")); + QScopedPointer model1(Model::create("Qt/Rectangle")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&modifier1); @@ -748,7 +748,7 @@ void tst_TestCore::testRewriterActionCompression() transaction.commit(); const QLatin1String expected("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " id: root\n" @@ -776,7 +776,7 @@ void tst_TestCore::testRewriterImports() textEdit.setPlainText(file.readAll()); NotIndentingTextEditModifier modifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); model->setFileUrl(QUrl::fromLocalFile(fileName)); QScopedPointer testRewriterView(new TestRewriterView()); @@ -787,7 +787,7 @@ void tst_TestCore::testRewriterImports() QVERIFY(model->imports().size() == 3); - // import QtQuick 1.0 + // import Qt 4.7 Import import = model->imports().at(0); QVERIFY(import.isLibraryImport()); QCOMPARE(import.url(), QString("Qt")); @@ -815,7 +815,7 @@ void tst_TestCore::testRewriterImports() void tst_TestCore::testRewriterChangeImports() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {}\n"); @@ -823,7 +823,7 @@ void tst_TestCore::testRewriterChangeImports() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier modifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Rectangle")); + QScopedPointer model(Model::create("Qt/Rectangle")); QScopedPointer testRewriterView(new TestRewriterView(0, RewriterView::Amend)); testRewriterView->setTextModifier(&modifier); @@ -838,7 +838,7 @@ void tst_TestCore::testRewriterChangeImports() model->addImport(webkitImport); const QLatin1String qmlWithImport("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "import QtWebKit 1.0\n" "\n" "Rectangle {}\n"); @@ -847,7 +847,7 @@ void tst_TestCore::testRewriterChangeImports() model->removeImport(webkitImport); QCOMPARE(model->imports().size(), 1); - QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.0")); + QCOMPARE(model->imports().first(), Import::createLibraryImport("Qt", "4.7")); QCOMPARE(textEdit.toPlainText(), qmlString); @@ -859,7 +859,7 @@ void tst_TestCore::testRewriterChangeImports() model->addImport(webkitImport); const QLatin1String qmlWithAliasImport("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "import QtWebKit 1.0 as Web\n" "\n" "Rectangle {}\n"); @@ -868,7 +868,7 @@ void tst_TestCore::testRewriterChangeImports() model->removeImport(webkitImport); QCOMPARE(model->imports().size(), 1); - QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.0")); + QCOMPARE(model->imports().first(), Import::createLibraryImport("Qt", "4.7")); QCOMPARE(textEdit.toPlainText(), qmlString); @@ -878,23 +878,23 @@ void tst_TestCore::testRewriterChangeImports() // textEdit.setPlainText(qmlWithImport); QCOMPARE(model->imports().size(), 2); - QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.0")); + QCOMPARE(model->imports().first(), Import::createLibraryImport("Qt", "4.7")); QCOMPARE(model->imports().last(), Import::createLibraryImport("QtWebKit", "1.0")); textEdit.setPlainText(qmlWithAliasImport); QCOMPARE(model->imports().size(), 2); - QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.0")); + QCOMPARE(model->imports().first(), Import::createLibraryImport("Qt", "4.7")); QCOMPARE(model->imports().last(), Import::createLibraryImport("QtWebKit", "1.0", "Web")); textEdit.setPlainText(qmlString); QCOMPARE(model->imports().size(), 1); - QCOMPARE(model->imports().first(), Import::createLibraryImport("QtQuick", "1.0")); + QCOMPARE(model->imports().first(), Import::createLibraryImport("Qt", "4.7")); } void tst_TestCore::testRewriterForGradientMagic() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " id: root\n" @@ -932,7 +932,7 @@ void tst_TestCore::testRewriterForGradientMagic() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier modifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Text")); + QScopedPointer model(Model::create("Qt/Text")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&modifier); @@ -948,7 +948,7 @@ void tst_TestCore::testRewriterForGradientMagic() myRect.variantProperty("rotation") = QVariant(45); QVERIFY(myRect.isValid()); - QScopedPointer model1(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model1(Model::create("Qt/Item", 4, 7)); QVERIFY(model1.data()); QScopedPointer view1(new TestView(model1.data())); @@ -956,7 +956,7 @@ void tst_TestCore::testRewriterForGradientMagic() QScopedPointer testRewriterView1(new TestRewriterView()); QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Item {}"); + textEdit1.setPlainText("import Qt 4.7; Item {}"); NotIndentingTextEditModifier modifier1(&textEdit1); testRewriterView1->setTextModifier(&modifier1); @@ -982,7 +982,7 @@ void tst_TestCore::loadSubItems() textEdit1.setPlainText(file.readAll()); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item")); + QScopedPointer model1(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -1000,7 +1000,7 @@ void tst_TestCore::createInvalidCoreModel() void tst_TestCore::testModelCreateSubNode() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1012,7 +1012,7 @@ void tst_TestCore::testModelCreateSubNode() QCOMPARE(view->methodCalls(), expectedCalls); QVERIFY(view->rootModelNode().isValid()); - ModelNode childNode = addNodeListChild(view->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(view->rootModelNode(), "Qt/Rectangle", 4, 7, "data"); QVERIFY(childNode.isValid()); QVERIFY(view->rootModelNode().allDirectSubModelNodes().contains(childNode)); QVERIFY(childNode.parentProperty().parentModelNode() == view->rootModelNode()); @@ -1046,7 +1046,7 @@ void tst_TestCore::testModelCreateSubNode() void tst_TestCore::testTypicalRewriterOperations() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1075,7 +1075,7 @@ void tst_TestCore::testTypicalRewriterOperations() QCOMPARE(rootModelNode.bindingProperty("test").expression(), QString("parent.x")); - ModelNode childNode(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 4 ,6, "data")); + ModelNode childNode(addNodeListChild(rootModelNode, "Qt/Rectangle", 4 ,6, "data")); rootModelNode.nodeListProperty("test").reparentHere(childNode); QCOMPARE(childNode.parentProperty(), rootModelNode.nodeAbstractProperty("test")); QVERIFY(rootModelNode.property("test").isNodeAbstractProperty()); @@ -1095,7 +1095,7 @@ void tst_TestCore::testTypicalRewriterOperations() void tst_TestCore::testBasicStates() { - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" "id: root;\n" "Rectangle {\n" @@ -1134,7 +1134,7 @@ void tst_TestCore::testBasicStates() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1143,13 +1143,13 @@ void tst_TestCore::testBasicStates() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&textModifier); model->attachView(testRewriterView.data()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootModelNode.type(), QString("Qt/Rectangle")); QVERIFY(rootModelNode.hasProperty("data")); @@ -1246,7 +1246,7 @@ void tst_TestCore::testBasicStates() void tst_TestCore::testModelBasicOperations() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1267,8 +1267,8 @@ void tst_TestCore::testModelBasicOperations() QVERIFY(!rootModelNode.hasProperty("width")); QVERIFY(!rootModelNode.hasProperty("children")); - ModelNode childNode1(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "children")); - ModelNode childNode2(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data")); + ModelNode childNode1(addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "children")); + ModelNode childNode2(addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data")); QVERIFY(childNode1.isValid()); QVERIFY(childNode2.isValid()); @@ -1306,7 +1306,7 @@ void tst_TestCore::testModelBasicOperations() void tst_TestCore::testModelResolveIds() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1316,9 +1316,9 @@ void tst_TestCore::testModelResolveIds() ModelNode rootNode = view->rootModelNode(); rootNode.setId("rootNode"); - ModelNode childNode1(addNodeListChild(rootNode, "QtQuick/Rectangle", 1, 0, "children")); + ModelNode childNode1(addNodeListChild(rootNode, "Qt/Rectangle", 4, 7, "children")); - ModelNode childNode2(addNodeListChild(childNode1, "QtQuick/Rectangle", 1, 0, "children")); + ModelNode childNode2(addNodeListChild(childNode1, "Qt/Rectangle", 4, 7, "children")); childNode2.setId("childNode2"); childNode2.bindingProperty("test").setExpression("parent.parent"); @@ -1329,7 +1329,7 @@ void tst_TestCore::testModelResolveIds() childNode2.bindingProperty("test").setExpression("rootNode"); QCOMPARE(childNode2.bindingProperty("test").resolveToModelNode(), rootNode); - ModelNode childNode3(addNodeListChild(childNode2, "QtQuick/Rectangle", 1, 0, "children")); + ModelNode childNode3(addNodeListChild(childNode2, "Qt/Rectangle", 4, 7, "children")); childNode3.setId("childNode3"); childNode2.nodeProperty("front").setModelNode(childNode3); childNode2.bindingProperty("test").setExpression("childNode3.parent"); @@ -1364,7 +1364,7 @@ void tst_TestCore::testModelNodeListProperty() // // Test NodeListProperty API // - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1382,7 +1382,7 @@ void tst_TestCore::testModelNodeListProperty() QVERIFY(!rootChildren.isNodeListProperty()); QVERIFY(rootChildren.isEmpty()); - ModelNode rectNode = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode rectNode = view->createModelNode("Qt/Rectangle", 4, 7); rootChildren.reparentHere(rectNode); // @@ -1393,7 +1393,7 @@ void tst_TestCore::testModelNodeListProperty() QVERIFY(rootChildren.isNodeListProperty()); QVERIFY(!rootChildren.isEmpty()); - ModelNode mouseAreaNode = view->createModelNode("QtQuick/Item", 1, 0); + ModelNode mouseAreaNode = view->createModelNode("Qt/Item", 4, 7); NodeListProperty rectChildren = rectNode.nodeListProperty("children"); rectChildren.reparentHere(mouseAreaNode); @@ -1421,7 +1421,7 @@ void tst_TestCore::testModelNodeListProperty() void tst_TestCore::testBasicOperationsWithView() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1453,8 +1453,8 @@ void tst_TestCore::testBasicOperationsWithView() QCOMPARE(rootInstance.size().width(), 10.0); QCOMPARE(rootInstance.size().height(), 10.0); - ModelNode childNode(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data")); - ModelNode childNode2(addNodeListChild(childNode, "QtQuick/Rectangle", 1, 0, "data")); + ModelNode childNode(addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data")); + ModelNode childNode2(addNodeListChild(childNode, "Qt/Rectangle", 4, 7, "data")); QVERIFY(childNode2.parentProperty().parentModelNode() == childNode); QVERIFY(childNode.isValid()); @@ -1489,10 +1489,10 @@ void tst_TestCore::testBasicOperationsWithView() QVERIFY(!childInstance2.isValid()); } - childNode = addNodeListChild(rootModelNode, "QtQuick/Image", 1, 0, "data"); + childNode = addNodeListChild(rootModelNode, "Qt/Image", 4, 7, "data"); QVERIFY(childNode.isValid()); - QCOMPARE(childNode.type(), QString("QtQuick/Image")); - childNode2 = addNodeListChild(childNode, "QtQuick/Rectangle", 1, 0, "data"); + QCOMPARE(childNode.type(), QString("Qt/Image")); + childNode2 = addNodeListChild(childNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(childNode2.isValid()); childNode2.setParentProperty(rootModelNode, "data"); QVERIFY(childNode2.isValid()); @@ -1531,7 +1531,7 @@ void tst_TestCore::testBasicOperationsWithView() void tst_TestCore::testQmlModelView() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QmlModelView *view = new TestView(model.data()); @@ -1549,7 +1549,7 @@ void tst_TestCore::testQmlModelView() propertyList.append(qMakePair(QString("width"), QVariant(20))); propertyList.append(qMakePair(QString("height"), QVariant(20))); - QmlObjectNode node1 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); + QmlObjectNode node1 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); QVERIFY(node1.isValid()); QVERIFY(!node1.hasNodeParent()); @@ -1565,7 +1565,7 @@ void tst_TestCore::testQmlModelView() QVERIFY(node1.instanceParent() == view->rootQmlObjectNode()); - QmlObjectNode node2 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); + QmlObjectNode node2 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); QVERIFY(node2.isValid()); QVERIFY(!node2.hasNodeParent()); @@ -1593,12 +1593,12 @@ void tst_TestCore::testQmlModelView() QCOMPARE(node1.instanceValue("x").toInt(), 2); - QmlObjectNode node3 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); - QmlObjectNode node4 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); - QmlObjectNode node5 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); - QmlObjectNode node6 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); - QmlObjectNode node7 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); - QmlObjectNode node8 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); + QmlObjectNode node3 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); + QmlObjectNode node4 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); + QmlObjectNode node5 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); + QmlObjectNode node6 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); + QmlObjectNode node7 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); + QmlObjectNode node8 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); node3.setParentProperty(node2.nodeAbstractProperty("children")); node4.setParentProperty(node3.nodeAbstractProperty("children")); @@ -1626,12 +1626,12 @@ void tst_TestCore::testQmlModelView() QCOMPARE(node2.instanceValue("x").toInt(), 10); // is this right? or should it be a invalid qvariant? - node1 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); + node1 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); node1.setId("node1"); QCOMPARE(node2.instanceValue("x").toInt(), 20); - node3 = view->createQmlObjectNode("QtQuick/Rectangle", 1, 0, propertyList); + node3 = view->createQmlObjectNode("Qt/Rectangle", 4, 7, propertyList); node3.setParentProperty(node2.nodeAbstractProperty("children")); QCOMPARE(node3.instanceValue("width").toInt(), 20); node3.setVariantProperty("width", 0); @@ -1653,7 +1653,7 @@ void tst_TestCore::testQmlModelView() void tst_TestCore::testModelRemoveNode() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1666,7 +1666,7 @@ void tst_TestCore::testModelRemoveNode() QCOMPARE(view->rootModelNode().allDirectSubModelNodes().count(), 0); - ModelNode childNode = addNodeListChild(view->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(view->rootModelNode(), "Qt/Rectangle", 4, 7, "data"); QVERIFY(childNode.isValid()); QCOMPARE(view->rootModelNode().allDirectSubModelNodes().count(), 1); QVERIFY(view->rootModelNode().allDirectSubModelNodes().contains(childNode)); @@ -1678,7 +1678,7 @@ void tst_TestCore::testModelRemoveNode() QVERIFY(childInstance.parent() == nodeInstanceView->instanceForNode(view->rootModelNode())); } - ModelNode subChildNode = addNodeListChild(childNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode subChildNode = addNodeListChild(childNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(subChildNode.isValid()); QCOMPARE(childNode.allDirectSubModelNodes().count(), 1); QVERIFY(childNode.allDirectSubModelNodes().contains(subChildNode)); @@ -1709,7 +1709,7 @@ void tst_TestCore::testModelRemoveNode() QVERIFY(view->rootModelNode().isValid()); // delete node not in hierarchy - childNode = view->createModelNode("QtQuick/Item", 1, 0); + childNode = view->createModelNode("Qt/Item", 4, 7); childNode.destroy(); model->detachView(nodeInstanceView); @@ -1717,7 +1717,7 @@ void tst_TestCore::testModelRemoveNode() void tst_TestCore::reparentingNode() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); @@ -1734,7 +1734,7 @@ void tst_TestCore::reparentingNode() NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data()); model->attachView(nodeInstanceView); - ModelNode childNode = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); QCOMPARE(childNode.parentProperty().parentModelNode(), rootModelNode); QVERIFY(rootModelNode.allDirectSubModelNodes().contains(childNode)); @@ -1744,7 +1744,7 @@ void tst_TestCore::reparentingNode() QVERIFY(childInstance.parent() == nodeInstanceView->instanceForNode(view->rootModelNode())); } - ModelNode childNode2 = addNodeListChild(rootModelNode, "QtQuick/Item", 1, 0, "data"); + ModelNode childNode2 = addNodeListChild(rootModelNode, "Qt/Item", 4, 7, "data"); QCOMPARE(childNode2.parentProperty().parentModelNode(), rootModelNode); QVERIFY(rootModelNode.allDirectSubModelNodes().contains(childNode2)); @@ -1785,10 +1785,10 @@ void tst_TestCore::reparentingNode() void tst_TestCore::reparentingNodeLikeDragAndDrop() { QPlainTextEdit textEdit; - textEdit.setPlainText("import QtQuick 1.0;\n\nItem {\n}\n"); + textEdit.setPlainText("import Qt 4.7;\n\nItem {\n}\n"); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer testRewriterView(new TestRewriterView()); @@ -1804,7 +1804,7 @@ void tst_TestCore::reparentingNodeLikeDragAndDrop() view->rootModelNode().setId("rootModelNode"); QCOMPARE(view->rootModelNode().id(), QString("rootModelNode")); - ModelNode rectNode = addNodeListChild(view->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data"); + ModelNode rectNode = addNodeListChild(view->rootModelNode(), "Qt/Rectangle", 4, 7, "data"); rectNode.setId("rect_1"); rectNode.variantProperty("x").setValue(20); rectNode.variantProperty("y").setValue(30); @@ -1813,7 +1813,7 @@ void tst_TestCore::reparentingNodeLikeDragAndDrop() RewriterTransaction transaction(view->beginRewriterTransaction()); - ModelNode textNode = addNodeListChild(view->rootModelNode(), "QtQuick/Text", 1, 0, "data"); + ModelNode textNode = addNodeListChild(view->rootModelNode(), "Qt/Text", 4, 7, "data"); QCOMPARE(textNode.parentProperty().parentModelNode(), view->rootModelNode()); QVERIFY(view->rootModelNode().allDirectSubModelNodes().contains(textNode)); @@ -1901,7 +1901,7 @@ void tst_TestCore::reparentingNodeLikeDragAndDrop() void tst_TestCore::testModelReorderSiblings() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1914,11 +1914,11 @@ void tst_TestCore::testModelReorderSiblings() ModelNode rootModelNode = view->rootModelNode(); QVERIFY(rootModelNode.isValid()); - ModelNode a = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode a = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(a.isValid()); - ModelNode b = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode b = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(b.isValid()); - ModelNode c = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode c = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(c.isValid()); { @@ -1952,7 +1952,7 @@ void tst_TestCore::testModelReorderSiblings() void tst_TestCore::testModelRootNode() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -1963,10 +1963,10 @@ void tst_TestCore::testModelRootNode() ModelNode rootModelNode = view->rootModelNode(); QVERIFY(rootModelNode.isValid()); QVERIFY(rootModelNode.isRootNode()); - ModelNode topChildNode = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode topChildNode = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(topChildNode.isValid()); QVERIFY(rootModelNode.isRootNode()); - ModelNode childNode = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(childNode.isValid()); QVERIFY(rootModelNode.isValid()); QVERIFY(rootModelNode.isRootNode()); @@ -1983,15 +1983,15 @@ void tst_TestCore::testModelRootNode() void tst_TestCore::reparentingNodeInModificationGroup() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); model->attachView(view.data()); - ModelNode childNode = addNodeListChild(view->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode2 = addNodeListChild(view->rootModelNode(), "QtQuick/Item", 1, 0, "data"); + ModelNode childNode = addNodeListChild(view->rootModelNode(), "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode2 = addNodeListChild(view->rootModelNode(), "Qt/Item", 4, 7, "data"); childNode.variantProperty("x").setValue(10); childNode.variantProperty("y").setValue(10); @@ -2033,7 +2033,7 @@ void tst_TestCore::reparentingNodeInModificationGroup() void tst_TestCore::testModelAddAndRemoveProperty() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2074,7 +2074,7 @@ void tst_TestCore::testModelAddAndRemoveProperty() void tst_TestCore::testModelViewNotification() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view1(new TestView(model.data())); @@ -2096,7 +2096,7 @@ void tst_TestCore::testModelViewNotification() QCOMPARE(view1->methodCalls(), expectedCalls); QCOMPARE(view2->methodCalls(), expectedCalls); - ModelNode childNode = addNodeListChild(view2->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(view2->rootModelNode(), "Qt/Rectangle", 4, 7, "data"); expectedCalls << TestView::MethodCall("nodeCreated", QStringList() << ""); expectedCalls << TestView::MethodCall("nodeReparented", QStringList() << "" << "data" << "" << "PropertiesAdded"); QCOMPARE(view1->methodCalls(), expectedCalls); @@ -2146,7 +2146,7 @@ void tst_TestCore::testModelViewNotification() void tst_TestCore::testRewriterTransaction() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2156,7 +2156,7 @@ void tst_TestCore::testRewriterTransaction() RewriterTransaction transaction = view->beginRewriterTransaction(); QVERIFY(transaction.isValid()); - ModelNode childNode = addNodeListChild(view->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(view->rootModelNode(), "Qt/Rectangle", 4, 7, "data"); QVERIFY(childNode.isValid()); childNode.destroy(); @@ -2166,7 +2166,7 @@ void tst_TestCore::testRewriterTransaction() RewriterTransaction transaction2 = view->beginRewriterTransaction(); QVERIFY(transaction2.isValid()); - ModelNode childNode = addNodeListChild(view->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(view->rootModelNode(), "Qt/Rectangle", 4, 7, "data"); QVERIFY(childNode.isValid()); childNode.destroy(); @@ -2193,7 +2193,7 @@ void tst_TestCore::testRewriterTransaction() void tst_TestCore::testRewriterId() { - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" "}\n"; @@ -2201,7 +2201,7 @@ void tst_TestCore::testRewriterId() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2216,16 +2216,16 @@ void tst_TestCore::testRewriterId() model->attachView(testRewriterView.data()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootModelNode.type(), QString("Qt/Rectangle")); QVERIFY(rootModelNode.isValid()); - ModelNode newNode(view->createModelNode("QtQuick/Rectangle", 1, 0)); + ModelNode newNode(view->createModelNode("Qt/Rectangle", 4, 7)); newNode.setId("testId"); rootModelNode.nodeListProperty("data").reparentHere(newNode); - const QLatin1String expected("import QtQuick 1.0\n" + const QLatin1String expected("import Qt 4.7\n" "Rectangle {\n" "Rectangle {\n" " id: testId\n" @@ -2237,7 +2237,7 @@ void tst_TestCore::testRewriterId() void tst_TestCore::testRewriterNodeReparentingTransaction1() { - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" "}\n"; @@ -2245,7 +2245,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction1() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2254,7 +2254,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction1() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&textModifier); @@ -2262,12 +2262,12 @@ void tst_TestCore::testRewriterNodeReparentingTransaction1() QVERIFY(rootModelNode.isValid()); - ModelNode childNode1 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode2 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode3 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode4 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode1 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode2 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode3 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode4 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); - ModelNode reparentNode = addNodeListChild(childNode1, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode reparentNode = addNodeListChild(childNode1, "Qt/Rectangle", 4, 7, "data"); RewriterTransaction rewriterTransaction = view->beginRewriterTransaction(); @@ -2282,7 +2282,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction1() void tst_TestCore::testRewriterNodeReparentingTransaction2() { - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" "}\n"; @@ -2290,7 +2290,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction2() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2299,7 +2299,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction2() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&textModifier); @@ -2307,8 +2307,8 @@ void tst_TestCore::testRewriterNodeReparentingTransaction2() QVERIFY(rootModelNode.isValid()); - ModelNode childNode1 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode2 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode1 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode2 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); childNode2.variantProperty("x") = 200; childNode2.variantProperty("y") = 50; @@ -2348,7 +2348,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction2() void tst_TestCore::testRewriterNodeReparentingTransaction3() { - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" "}\n"; @@ -2356,7 +2356,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction3() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2365,7 +2365,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction3() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&textModifier); @@ -2373,10 +2373,10 @@ void tst_TestCore::testRewriterNodeReparentingTransaction3() QVERIFY(rootModelNode.isValid()); - ModelNode childNode1 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode2 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode3 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode4 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode1 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode2 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode3 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode4 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); RewriterTransaction rewriterTransaction = view->beginRewriterTransaction(); @@ -2398,7 +2398,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction3() void tst_TestCore::testRewriterNodeReparentingTransaction4() { - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" "}\n"; @@ -2406,7 +2406,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction4() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2415,7 +2415,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction4() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&textModifier); @@ -2423,11 +2423,11 @@ void tst_TestCore::testRewriterNodeReparentingTransaction4() QVERIFY(rootModelNode.isValid()); - ModelNode childNode1 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode2 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode3 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode4 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); - ModelNode childNode5 = addNodeListChild(childNode2, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode1 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode2 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode3 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode4 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); + ModelNode childNode5 = addNodeListChild(childNode2, "Qt/Rectangle", 4, 7, "data"); RewriterTransaction rewriterTransaction = view->beginRewriterTransaction(); @@ -2449,7 +2449,7 @@ void tst_TestCore::testRewriterNodeReparentingTransaction4() void tst_TestCore::testRewriterAddNodeTransaction() { - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" "}\n"; @@ -2457,7 +2457,7 @@ void tst_TestCore::testRewriterAddNodeTransaction() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2466,7 +2466,7 @@ void tst_TestCore::testRewriterAddNodeTransaction() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&textModifier); @@ -2475,11 +2475,11 @@ void tst_TestCore::testRewriterAddNodeTransaction() QVERIFY(rootModelNode.isValid()); - ModelNode childNode = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); RewriterTransaction rewriterTransaction = view->beginRewriterTransaction(); - ModelNode newNode = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode newNode = view->createModelNode("Qt/Rectangle", 4, 7); newNode.variantProperty("x") = 100; newNode.variantProperty("y") = 100; @@ -2491,7 +2491,7 @@ void tst_TestCore::testRewriterAddNodeTransaction() void tst_TestCore::testRewriterComponentId() { - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" " Component {\n" " id: testComponent\n" @@ -2504,7 +2504,7 @@ void tst_TestCore::testRewriterComponentId() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2517,17 +2517,17 @@ void tst_TestCore::testRewriterComponentId() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootModelNode.type(), QString("Qt/Rectangle")); ModelNode component(rootModelNode.allDirectSubModelNodes().first()); QVERIFY(component.isValid()); - QCOMPARE(component.type(), QString("QtQuick/Component")); + QCOMPARE(component.type(), QString("Qt/Component")); QCOMPARE(component.id(), QString("testComponent")); } void tst_TestCore::testRewriterTransactionRewriter() { - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" "}\n"; @@ -2535,7 +2535,7 @@ void tst_TestCore::testRewriterTransactionRewriter() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2544,7 +2544,7 @@ void tst_TestCore::testRewriterTransactionRewriter() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&textModifier); @@ -2557,7 +2557,7 @@ void tst_TestCore::testRewriterTransactionRewriter() { RewriterTransaction transaction = view->beginRewriterTransaction(); - childNode1 = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + childNode1 = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); childNode1.variantProperty("x") = 10; childNode1.variantProperty("y") = 10; } @@ -2569,7 +2569,7 @@ void tst_TestCore::testRewriterTransactionRewriter() { RewriterTransaction transaction = view->beginRewriterTransaction(); - childNode2 = addNodeListChild(childNode1, "QtQuick/Rectangle", 1, 0, "data"); + childNode2 = addNodeListChild(childNode1, "Qt/Rectangle", 4, 7, "data"); childNode2.destroy(); } @@ -2594,7 +2594,7 @@ void tst_TestCore::testRewriterPropertyDeclarations() // property variant myArray: [ Rectangle {} ] // property variant someGradient: Gradient {} - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Item {\n" " property int intProperty\n" " property bool boolProperty: true\n" @@ -2607,7 +2607,7 @@ void tst_TestCore::testRewriterPropertyDeclarations() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2625,7 +2625,7 @@ void tst_TestCore::testRewriterPropertyDeclarations() // ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QCOMPARE(rootModelNode.properties().size(), 4); @@ -2658,7 +2658,7 @@ void tst_TestCore::testRewriterPropertyAliases() // where type is (int | bool | double | real | string | url | color | date | variant) // - char qmlString[] = "import QtQuick 1.0\n" + char qmlString[] = "import Qt 4.7\n" "Item {\n" " property alias theText: t.text\n" " default alias property yPos: t.y\n" @@ -2669,7 +2669,7 @@ void tst_TestCore::testRewriterPropertyAliases() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2682,7 +2682,7 @@ void tst_TestCore::testRewriterPropertyAliases() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QList properties = rootModelNode.properties(); QCOMPARE(properties.size(), 0); // TODO: How to represent alias properties? As Bindings? @@ -2691,7 +2691,7 @@ void tst_TestCore::testRewriterPropertyAliases() void tst_TestCore::testRewriterPositionAndOffset() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " id: root\n" @@ -2729,7 +2729,7 @@ void tst_TestCore::testRewriterPositionAndOffset() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2742,7 +2742,7 @@ void tst_TestCore::testRewriterPositionAndOffset() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle")); QString string = QString(qmlString).mid(testRewriterView->nodeOffset(rootNode), testRewriterView->nodeLength(rootNode)); const QString qmlExpected0("Rectangle {\n" @@ -2808,7 +2808,7 @@ void tst_TestCore::testRewriterPositionAndOffset() void tst_TestCore::testRewriterComponentTextModifier() { - const QString qmlString("import QtQuick 1.0\n" + const QString qmlString("import Qt 4.7\n" "Rectangle {\n" " id: root\n" " x: 10;\n" @@ -2831,7 +2831,7 @@ void tst_TestCore::testRewriterComponentTextModifier() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2844,7 +2844,7 @@ void tst_TestCore::testRewriterComponentTextModifier() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle")); ModelNode componentNode = rootNode.allDirectSubModelNodes().last(); @@ -2855,7 +2855,7 @@ void tst_TestCore::testRewriterComponentTextModifier() ComponentTextModifier componentTextModifier(&textModifier, componentStartOffset, componentEndOffset, rootStartOffset); - const QString qmlExpected("import QtQuick 1.0\n" + const QString qmlExpected("import Qt 4.7\n" " " " " " " @@ -2876,19 +2876,19 @@ void tst_TestCore::testRewriterComponentTextModifier() QCOMPARE(componentTextModifier.text(), qmlExpected); - QScopedPointer componentModel(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer componentModel(Model::create("Qt/Item", 4, 7)); QScopedPointer testRewriterViewComponent(new TestRewriterView()); testRewriterViewComponent->setTextModifier(&componentTextModifier); componentModel->attachView(testRewriterViewComponent.data()); ModelNode componentrootNode = testRewriterViewComponent->rootModelNode(); QVERIFY(componentrootNode.isValid()); - QCOMPARE(componentrootNode.type(), QLatin1String("QtQuick/Component")); + QCOMPARE(componentrootNode.type(), QLatin1String("Qt/Component")); } void tst_TestCore::testRewriterPreserveType() { - const QString qmlString("import QtQuick 1.0\n" + const QString qmlString("import Qt 4.7\n" "Rectangle {\n" " id: root\n" " Text {\n" @@ -2901,7 +2901,7 @@ void tst_TestCore::testRewriterPreserveType() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2914,7 +2914,7 @@ void tst_TestCore::testRewriterPreserveType() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle")); ModelNode textNode = rootNode.allDirectSubModelNodes().first(); QCOMPARE(QVariant::Bool, textNode.variantProperty("font.bold").value().type()); @@ -2923,7 +2923,7 @@ void tst_TestCore::testRewriterPreserveType() textNode.variantProperty("font.bold") = QVariant(true); textNode.variantProperty("font.pointSize") = QVariant(13.0); - ModelNode newTextNode = addNodeListChild(rootNode, "QtQuick/Text", 1, 0, "data"); + ModelNode newTextNode = addNodeListChild(rootNode, "Qt/Text", 4, 7, "data"); newTextNode.variantProperty("font.bold") = QVariant(true); newTextNode.variantProperty("font.pointSize") = QVariant(13.0); @@ -2935,7 +2935,7 @@ void tst_TestCore::testRewriterPreserveType() void tst_TestCore::testRewriterForArrayMagic() { try { - const QLatin1String qmlString("import QtQuick 1.0\n" + const QLatin1String qmlString("import Qt 4.7\n" "\n" "Rectangle {\n" " states: State {\n" @@ -2946,7 +2946,7 @@ void tst_TestCore::testRewriterForArrayMagic() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -2959,16 +2959,16 @@ void tst_TestCore::testRewriterForArrayMagic() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); QVERIFY(rootNode.property(QLatin1String("states")).isNodeListProperty()); QmlItemNode rootItem(rootNode); QVERIFY(rootItem.isValid()); QmlModelState state1(rootItem.states().addState("s2")); - QCOMPARE(state1.modelNode().type(), QString("QtQuick/State")); + QCOMPARE(state1.modelNode().type(), QString("Qt/State")); - const QLatin1String expected("import QtQuick 1.0\n" + const QLatin1String expected("import Qt 4.7\n" "\n" "Rectangle {\n" " states: [\n" @@ -2989,7 +2989,7 @@ void tst_TestCore::testRewriterForArrayMagic() void tst_TestCore::testRewriterWithSignals() { - const QLatin1String qmlString("import QtQuick 1.0\n" + const QLatin1String qmlString("import Qt 4.7\n" "\n" "TextEdit {\n" " onTextChanged: { print(\"foo\"); }\n" @@ -2998,7 +2998,7 @@ void tst_TestCore::testRewriterWithSignals() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -3011,7 +3011,7 @@ void tst_TestCore::testRewriterWithSignals() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/TextEdit")); + QCOMPARE(rootNode.type(), QString("Qt/TextEdit")); QmlItemNode rootItem(rootNode); QVERIFY(rootItem.isValid()); @@ -3021,7 +3021,7 @@ void tst_TestCore::testRewriterWithSignals() void tst_TestCore::testRewriterNodeSliding() { - const QLatin1String qmlString("import QtQuick 1.0\n" + const QLatin1String qmlString("import Qt 4.7\n" "Rectangle {\n" " id: root\n" " Rectangle {\n" @@ -3041,7 +3041,7 @@ void tst_TestCore::testRewriterNodeSliding() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -3054,7 +3054,7 @@ void tst_TestCore::testRewriterNodeSliding() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle")); QCOMPARE(rootNode.id(), QLatin1String("root")); QCOMPARE(rootNode.nodeListProperty(QLatin1String("data")).toModelNodeList().at(0).id(), QLatin1String("rectangle1")); @@ -3073,7 +3073,7 @@ void tst_TestCore::testRewriterNodeSliding() void tst_TestCore::testRewriterExceptionHandling() { - const QLatin1String qmlString("import QtQuick 1.0\n" + const QLatin1String qmlString("import Qt 4.7\n" "Text {\n" "}"); @@ -3081,7 +3081,7 @@ void tst_TestCore::testRewriterExceptionHandling() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Text", 1, 0)); + QScopedPointer model(Model::create("Qt/Text", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -3094,7 +3094,7 @@ void tst_TestCore::testRewriterExceptionHandling() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Text")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Text")); try { @@ -3105,7 +3105,7 @@ void tst_TestCore::testRewriterExceptionHandling() QFAIL("RewritingException should be thrown"); } catch (RewritingException &e) { QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Text")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Text")); QVERIFY(!rootNode.hasProperty("bla")); QVERIFY(!rootNode.hasProperty("text")); } @@ -3113,7 +3113,7 @@ void tst_TestCore::testRewriterExceptionHandling() void tst_TestCore::testRewriterFirstDefinitionInside() { - const QString qmlString("import QtQuick 1.0\n" + const QString qmlString("import Qt 4.7\n" "Rectangle {\n" " id: root\n" " x: 10;\n" @@ -3137,7 +3137,7 @@ void tst_TestCore::testRewriterFirstDefinitionInside() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -3150,7 +3150,7 @@ void tst_TestCore::testRewriterFirstDefinitionInside() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle")); ModelNode componentNode = rootNode.allDirectSubModelNodes().last(); @@ -3169,7 +3169,7 @@ void tst_TestCore::testRewriterFirstDefinitionInside() void tst_TestCore::testCopyModelRewriter1() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " id: root\n" @@ -3207,7 +3207,7 @@ void tst_TestCore::testCopyModelRewriter1() textEdit1.setPlainText(qmlString); NotIndentingTextEditModifier textModifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model1(Model::create("Qt/Item", 4, 7)); QVERIFY(model1.data()); QScopedPointer view1(new TestView(model1.data())); @@ -3220,13 +3220,13 @@ void tst_TestCore::testCopyModelRewriter1() ModelNode rootNode1 = view1->rootModelNode(); QVERIFY(rootNode1.isValid()); - QCOMPARE(rootNode1.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode1.type(), QLatin1String("Qt/Rectangle")); QPlainTextEdit textEdit2; textEdit2.setPlainText(qmlString); NotIndentingTextEditModifier textModifier2(&textEdit2); - QScopedPointer model2(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model2(Model::create("Qt/Item", 4, 7)); QVERIFY(model2.data()); QScopedPointer view2(new TestView(model2.data())); @@ -3239,7 +3239,7 @@ void tst_TestCore::testCopyModelRewriter1() ModelNode rootNode2 = view2->rootModelNode(); QVERIFY(rootNode2.isValid()); - QCOMPARE(rootNode2.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode2.type(), QLatin1String("Qt/Rectangle")); // @@ -3264,7 +3264,7 @@ void tst_TestCore::testCopyModelRewriter1() const QLatin1String expected( "\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " id: root\n" @@ -3339,7 +3339,7 @@ void tst_TestCore::testCopyModelRewriter1() void tst_TestCore::testCopyModelRewriter2() { const QLatin1String qmlString1("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "id: root\n" @@ -3379,7 +3379,7 @@ void tst_TestCore::testCopyModelRewriter2() const QLatin1String qmlString2("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "}"); @@ -3388,7 +3388,7 @@ void tst_TestCore::testCopyModelRewriter2() textEdit1.setPlainText(qmlString1); NotIndentingTextEditModifier textModifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model1(Model::create("Qt/Item", 4, 7)); QVERIFY(model1.data()); QScopedPointer view1(new TestView(model1.data())); @@ -3401,7 +3401,7 @@ void tst_TestCore::testCopyModelRewriter2() ModelNode rootNode1 = view1->rootModelNode(); QVERIFY(rootNode1.isValid()); - QCOMPARE(rootNode1.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode1.type(), QLatin1String("Qt/Rectangle")); // read in 2 @@ -3410,7 +3410,7 @@ void tst_TestCore::testCopyModelRewriter2() textEdit2.setPlainText(qmlString2); NotIndentingTextEditModifier textModifier2(&textEdit2); - QScopedPointer model2(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model2(Model::create("Qt/Item", 4, 7)); QVERIFY(model2.data()); QScopedPointer view2(new TestView(model2.data())); @@ -3422,7 +3422,7 @@ void tst_TestCore::testCopyModelRewriter2() ModelNode rootNode2 = view2->rootModelNode(); QVERIFY(rootNode2.isValid()); - QCOMPARE(rootNode2.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode2.type(), QLatin1String("Qt/Rectangle")); // @@ -3431,7 +3431,7 @@ void tst_TestCore::testCopyModelRewriter2() merger.replaceModel(rootNode1); QVERIFY(rootNode2.isValid()); - QCOMPARE(rootNode2.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode2.type(), QLatin1String("Qt/Rectangle")); QCOMPARE(textEdit2.toPlainText(), qmlString1); } @@ -3446,7 +3446,7 @@ void tst_TestCore::testSubComponentManager() textEdit.setPlainText(file.readAll()); NotIndentingTextEditModifier modifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); model->setFileUrl(QUrl::fromLocalFile(fileName)); QScopedPointer subComponentManager(new SubComponentManager(model->metaInfo(), 0)); subComponentManager->update(QUrl::fromLocalFile(fileName), modifier.text().toUtf8()); @@ -3460,9 +3460,9 @@ void tst_TestCore::testSubComponentManager() QVERIFY(testRewriterView->rootModelNode().isValid()); - QVERIFY(model->metaInfo().nodeMetaInfo("QtQuick/Rectangle").properties(true).keys().contains("border.width")); + QVERIFY(model->metaInfo().nodeMetaInfo("Qt/Rectangle").properties(true).keys().contains("border.width")); - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/Pen")); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/Pen")); NodeMetaInfo myButtonMetaInfo = model->metaInfo().nodeMetaInfo("MyButton"); QVERIFY(myButtonMetaInfo.isValid()); QVERIFY(myButtonMetaInfo.properties(true).keys().contains("border.width")); @@ -3471,7 +3471,7 @@ void tst_TestCore::testSubComponentManager() void tst_TestCore::testAnchorsAndRewriting() { - const QString qmlString("import QtQuick 1.0\n" + const QString qmlString("import Qt 4.7\n" "Rectangle {\n" " id: root\n" " x: 10;\n" @@ -3494,7 +3494,7 @@ void tst_TestCore::testAnchorsAndRewriting() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -3507,7 +3507,7 @@ void tst_TestCore::testAnchorsAndRewriting() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle")); QmlItemNode rootItemNode = view->rootQmlItemNode(); QVERIFY(rootItemNode.isValid()); @@ -3532,7 +3532,7 @@ void tst_TestCore::testAnchorsAndRewriting() void tst_TestCore::testAnchorsAndRewritingCenter() { - const QString qmlString("import QtQuick 1.0\n" + const QString qmlString("import Qt 4.7\n" "Rectangle {\n" " id: root\n" " x: 10;\n" @@ -3555,7 +3555,7 @@ void tst_TestCore::testAnchorsAndRewritingCenter() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -3568,7 +3568,7 @@ void tst_TestCore::testAnchorsAndRewritingCenter() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle")); QmlItemNode rootItemNode = view->rootQmlItemNode(); QVERIFY(rootItemNode.isValid()); @@ -3582,7 +3582,7 @@ void tst_TestCore::testAnchorsAndRewritingCenter() void tst_TestCore::loadQml() { -char qmlString[] = "import QtQuick 1.0\n" +char qmlString[] = "import Qt 4.7\n" "Rectangle {\n" "id: root;\n" "width: 200;\n" @@ -3623,7 +3623,7 @@ char qmlString[] = "import QtQuick 1.0\n" textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -3632,14 +3632,14 @@ char qmlString[] = "import QtQuick 1.0\n" ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QString("Qt/Item")); QScopedPointer testRewriterView(new TestRewriterView()); testRewriterView->setTextModifier(&textModifier); model->attachView(testRewriterView.data()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootModelNode.type(), QString("Qt/Rectangle")); QCOMPARE(rootModelNode.id(), QString("root")); QCOMPARE(rootModelNode.variantProperty("width").value().toInt(), 200); QCOMPARE(rootModelNode.variantProperty("height").value().toInt(), 200); @@ -3649,7 +3649,7 @@ char qmlString[] = "import QtQuick 1.0\n" QCOMPARE(rootModelNode.nodeListProperty("data").toModelNodeList().count(), 3); ModelNode textNode1 = rootModelNode.nodeListProperty("data").toModelNodeList().first(); QVERIFY(textNode1.isValid()); - QCOMPARE(textNode1.type(), QString("QtQuick/Text")); + QCOMPARE(textNode1.type(), QString("Qt/Text")); QCOMPARE(textNode1.id(), QString("text1")); QCOMPARE(textNode1.variantProperty("text").value().toString(), QString("Hello World")); QVERIFY(textNode1.hasProperty("anchors.centerIn")); @@ -3665,13 +3665,13 @@ char qmlString[] = "import QtQuick 1.0\n" ModelNode rectNode = rootModelNode.nodeListProperty("data").toModelNodeList().at(1); QVERIFY(rectNode.isValid()); - QCOMPARE(rectNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rectNode.type(), QString("Qt/Rectangle")); QCOMPARE(rectNode.id(), QString("rectangle")); QVERIFY(rectNode.hasProperty("gradient")); QVERIFY(rectNode.property("gradient").isNodeProperty()); ModelNode gradientNode = rectNode.nodeProperty("gradient").modelNode(); QVERIFY(gradientNode.isValid()); - QCOMPARE(gradientNode.type(), QString("QtQuick/Gradient")); + QCOMPARE(gradientNode.type(), QString("Qt/Gradient")); QVERIFY(gradientNode.hasProperty("stops")); QVERIFY(gradientNode.property("stops").isNodeListProperty()); QCOMPARE(gradientNode.nodeListProperty("stops").toModelNodeList().count(), 2); @@ -3682,15 +3682,15 @@ char qmlString[] = "import QtQuick 1.0\n" QVERIFY(stop1.isValid()); QVERIFY(stop2.isValid()); - QCOMPARE(stop1.type(), QString("QtQuick/GradientStop")); - QCOMPARE(stop2.type(), QString("QtQuick/GradientStop")); + QCOMPARE(stop1.type(), QString("Qt/GradientStop")); + QCOMPARE(stop2.type(), QString("Qt/GradientStop")); QCOMPARE(stop1.variantProperty("position").value().toInt(), 0); QCOMPARE(stop2.variantProperty("position").value().toInt(), 1); ModelNode textNode2 = rootModelNode.nodeListProperty("data").toModelNodeList().last(); QVERIFY(textNode2.isValid()); - QCOMPARE(textNode2.type(), QString("QtQuick/Text")); + QCOMPARE(textNode2.type(), QString("Qt/Text")); QCOMPARE(textNode2.id(), QString("text2")); QCOMPARE(textNode2.variantProperty("width").value().toInt(), 80); QCOMPARE(textNode2.variantProperty("height").value().toInt(), 20); @@ -3701,17 +3701,17 @@ char qmlString[] = "import QtQuick 1.0\n" void tst_TestCore::testMetaInfo() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); // test whether default type is registered - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/Item", 1, 0)); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/Item", 4, 7)); // test whether types from plugins are registered QVERIFY(model->metaInfo().hasNodeMetaInfo("QtWebKit/WebView", 1, 0)); // test whether non-qml type is registered - QVERIFY(model->metaInfo().hasNodeMetaInfo("QGraphicsObject", 1, 0)); // Qt 4.7 namespace + QVERIFY(model->metaInfo().hasNodeMetaInfo("QGraphicsObject", 4, 7)); // Qt 4.7 namespace QVERIFY(model->metaInfo().hasNodeMetaInfo("QGraphicsObject", 1, 0)); // webkit 1.0 namespace } @@ -3723,20 +3723,20 @@ void tst_TestCore::testMetaInfoSimpleType() // qmlRegisterType("Qt",4,7,"Item") // - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/Item", 1, 0)); - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/Item", 1, 0)); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/Item", 4, 7)); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/Item", 4, 7)); - NodeMetaInfo itemMetaInfo = model->metaInfo().nodeMetaInfo("QtQuick/Item", 1, 0); - NodeMetaInfo itemMetaInfo2 = model->metaInfo().nodeMetaInfo("QtQuick/Item", 1, 0); + NodeMetaInfo itemMetaInfo = model->metaInfo().nodeMetaInfo("Qt/Item", 4, 7); + NodeMetaInfo itemMetaInfo2 = model->metaInfo().nodeMetaInfo("Qt/Item", 4, 7); QCOMPARE(itemMetaInfo, itemMetaInfo2); QVERIFY(itemMetaInfo.isValid()); - QCOMPARE(itemMetaInfo.typeName(), QLatin1String("QtQuick/Item")); - QCOMPARE(itemMetaInfo.majorVersion(), 1); - QCOMPARE(itemMetaInfo.minorVersion(), 0); + QCOMPARE(itemMetaInfo.typeName(), QLatin1String("Qt/Item")); + QCOMPARE(itemMetaInfo.majorVersion(), 4); + QCOMPARE(itemMetaInfo.minorVersion(), 7); // super classes NodeMetaInfo graphicsObjectInfo = itemMetaInfo.directSuperClass(); @@ -3745,15 +3745,17 @@ void tst_TestCore::testMetaInfoSimpleType() QCOMPARE(graphicsObjectInfo.majorVersion(), -1); QCOMPARE(graphicsObjectInfo.minorVersion(), -1); - QCOMPARE(itemMetaInfo.superClasses().size(), 2); // QGraphicsObject, QtQuick/QtObject - QVERIFY(itemMetaInfo.isSubclassOf("QGraphicsObject", 1, 0)); - QVERIFY(itemMetaInfo.isSubclassOf("QtQuick/QtObject", 1, 0)); + QCOMPARE(itemMetaInfo.superClasses().size(), 2); // QGraphicsObject, Qt/QtObject + QVERIFY(itemMetaInfo.isSubclassOf("QGraphicsObject", 4, 7)); + QVERIFY(itemMetaInfo.isSubclassOf("Qt/QtObject", 4, 7)); // availableInVersion - QVERIFY(itemMetaInfo.availableInVersion(1, 0)); + QVERIFY(itemMetaInfo.availableInVersion(4, 7)); + QVERIFY(itemMetaInfo.availableInVersion(4, 8)); + QVERIFY(itemMetaInfo.availableInVersion(5, 0)); QVERIFY(itemMetaInfo.availableInVersion(-1, -1)); - QVERIFY(!itemMetaInfo.availableInVersion(0, 8)); - QVERIFY(!itemMetaInfo.availableInVersion(0, 9)); + QVERIFY(!itemMetaInfo.availableInVersion(4, 6)); + QVERIFY(!itemMetaInfo.availableInVersion(3, 7)); } void tst_TestCore::testMetaInfoUncreatableType() @@ -3763,23 +3765,23 @@ void tst_TestCore::testMetaInfoUncreatableType() // qmlRegisterUncreatableType("Qt",4,7,"Animation",QDeclarativeAbstractAnimation::tr("Animation is an abstract class")); // - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/Animation")); - NodeMetaInfo animationTypeInfo = model->metaInfo().nodeMetaInfo("QtQuick/Animation", 1, 0); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/Animation")); + NodeMetaInfo animationTypeInfo = model->metaInfo().nodeMetaInfo("Qt/Animation", 4, 7); QVERIFY(animationTypeInfo.isValid()); QVERIFY(animationTypeInfo.isValid()); - QCOMPARE(animationTypeInfo.typeName(), QLatin1String("QtQuick/Animation")); - QCOMPARE(animationTypeInfo.majorVersion(), 1); - QCOMPARE(animationTypeInfo.minorVersion(), 0); + QCOMPARE(animationTypeInfo.typeName(), QLatin1String("Qt/Animation")); + QCOMPARE(animationTypeInfo.majorVersion(), 4); + QCOMPARE(animationTypeInfo.minorVersion(), 7); NodeMetaInfo qObjectTypeInfo = animationTypeInfo.directSuperClass(); QVERIFY(qObjectTypeInfo.isValid()); - QCOMPARE(qObjectTypeInfo.typeName(), QLatin1String("QtQuick/QtObject")); - QCOMPARE(qObjectTypeInfo.majorVersion(), 1); - QCOMPARE(qObjectTypeInfo.minorVersion(), 0); + QCOMPARE(qObjectTypeInfo.typeName(), QLatin1String("Qt/QtObject")); + QCOMPARE(qObjectTypeInfo.majorVersion(), 4); + QCOMPARE(qObjectTypeInfo.minorVersion(), 7); QCOMPARE(animationTypeInfo.superClasses().size(), 1); } @@ -3790,11 +3792,11 @@ void tst_TestCore::testMetaInfoExtendedType() // qmlRegisterExtendedType("Qt",4,7,"QGraphicsWidget"); // - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/QGraphicsWidget")); - NodeMetaInfo graphicsWidgetTypeInfo = model->metaInfo().nodeMetaInfo("QtQuick/QGraphicsWidget", 1, 0); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/QGraphicsWidget")); + NodeMetaInfo graphicsWidgetTypeInfo = model->metaInfo().nodeMetaInfo("Qt/QGraphicsWidget", 4, 7); QVERIFY(graphicsWidgetTypeInfo.isValid()); QVERIFY(graphicsWidgetTypeInfo.hasProperty("layout")); // from QGraphicsWidgetDeclarativeUI QVERIFY(graphicsWidgetTypeInfo.hasProperty("font")); // from QGraphicsWidget @@ -3820,13 +3822,13 @@ void tst_TestCore::testMetaInfoCustomType() { // Test type registered with qmlRegisterCustomType: // - // qmlRegisterCustomType("Qt", 1, 0, "PropertyChanges", new QDeclarativePropertyChangesParser); + // qmlRegisterCustomType("Qt", 4, 7, "PropertyChanges", new QDeclarativePropertyChangesParser); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/PropertyChanges")); - NodeMetaInfo propertyChangesInfo = model->metaInfo().nodeMetaInfo("QtQuick/PropertyChanges", 1, 0); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/PropertyChanges")); + NodeMetaInfo propertyChangesInfo = model->metaInfo().nodeMetaInfo("Qt/PropertyChanges", 4, 7); QVERIFY(propertyChangesInfo.isValid()); QVERIFY(propertyChangesInfo.hasProperty("target")); // from QDeclarativePropertyChanges QVERIFY(propertyChangesInfo.hasProperty("restoreEntryValues")); // from QDeclarativePropertyChanges @@ -3845,14 +3847,14 @@ void tst_TestCore::testMetaInfoCustomType() void tst_TestCore::testMetaInfoEnums() { - QScopedPointer model(Model::create("QtQuick/Text")); + QScopedPointer model(Model::create("Qt/Text")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); model->attachView(view.data()); - QCOMPARE(view->rootModelNode().metaInfo().typeName(), QString("QtQuick/Text")); + QCOMPARE(view->rootModelNode().metaInfo().typeName(), QString("Qt/Text")); QVERIFY(view->rootModelNode().metaInfo().hasProperty("transformOrigin")); @@ -3869,14 +3871,14 @@ void tst_TestCore::testMetaInfoEnums() void tst_TestCore::testMetaInfoProperties() { - QScopedPointer model(Model::create("QtQuick/Text")); + QScopedPointer model(Model::create("Qt/Text")); QVERIFY(model.data()); - NodeMetaInfo textNodeMetaInfo = model->metaInfo().nodeMetaInfo("QtQuick/TextEdit", 1, 0); + NodeMetaInfo textNodeMetaInfo = model->metaInfo().nodeMetaInfo("Qt/TextEdit", 4, 7); QVERIFY(textNodeMetaInfo.hasProperty("text")); // QDeclarativeTextEdit QVERIFY(textNodeMetaInfo.hasProperty("parent")); // QDeclarativeItem QVERIFY(textNodeMetaInfo.hasProperty("x")); // QGraphicsObject - QVERIFY(textNodeMetaInfo.hasProperty("objectName")); // QtQuick/QObject + QVERIFY(textNodeMetaInfo.hasProperty("objectName")); // Qt/QObject QVERIFY(!textNodeMetaInfo.hasProperty("bla")); QVERIFY(textNodeMetaInfo.property("text").isValid()); @@ -3889,18 +3891,18 @@ void tst_TestCore::testMetaInfoProperties() void tst_TestCore::testMetaInfoDotProperties() { - QScopedPointer model(Model::create("QtQuick/Text")); + QScopedPointer model(Model::create("Qt/Text")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); model->attachView(view.data()); - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/Text")); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/Text")); - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/Pen")); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/Pen")); - QCOMPARE(view->rootModelNode().metaInfo().typeName(), QString("QtQuick/Text")); + QCOMPARE(view->rootModelNode().metaInfo().typeName(), QString("Qt/Text")); QVERIFY(!view->rootModelNode().metaInfo().property("text").isValueType()); QVERIFY(view->rootModelNode().metaInfo().hasProperty("font")); QVERIFY(view->rootModelNode().metaInfo().property("font").isValueType()); @@ -3912,7 +3914,7 @@ void tst_TestCore::testMetaInfoDotProperties() QVERIFY(view->rootModelNode().metaInfo().hasProperty("font.pointSize", true)); QVERIFY(view->rootModelNode().metaInfo().property("font.pointSize", true).isValid()); - ModelNode rectNode(addNodeListChild(view->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data")); + ModelNode rectNode(addNodeListChild(view->rootModelNode(), "Qt/Rectangle", 4, 7, "data")); QVERIFY(rectNode.metaInfo().properties(true).keys().contains("pos.x")); @@ -3931,15 +3933,15 @@ void tst_TestCore::testMetaInfoDotProperties() void tst_TestCore::testMetaInfoListProperties() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); model->attachView(view.data()); - QVERIFY(model->metaInfo().hasNodeMetaInfo("QtQuick/Item")); - QCOMPARE(view->rootModelNode().metaInfo().typeName(), QString("QtQuick/Item")); + QVERIFY(model->metaInfo().hasNodeMetaInfo("Qt/Item")); + QCOMPARE(view->rootModelNode().metaInfo().typeName(), QString("Qt/Item")); QVERIFY(view->rootModelNode().metaInfo().hasProperty("states")); QVERIFY(view->rootModelNode().metaInfo().property("states").isListProperty()); @@ -3963,10 +3965,10 @@ void tst_TestCore::testMetaInfoListProperties() void tst_TestCore::testStatesRewriter() { QPlainTextEdit textEdit; - textEdit.setPlainText("import QtQuick 1.0; Item {}\n"); + textEdit.setPlainText("import Qt 4.7; Item {}\n"); NotIndentingTextEditModifier modifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); @@ -4010,10 +4012,10 @@ void tst_TestCore::testStatesRewriter() void tst_TestCore::testGradientsRewriter() { QPlainTextEdit textEdit; - textEdit.setPlainText("\nimport QtQuick 1.0\n\nItem {\n}\n"); + textEdit.setPlainText("\nimport Qt 4.7\n\nItem {\n}\n"); NotIndentingTextEditModifier modifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); @@ -4029,9 +4031,9 @@ void tst_TestCore::testGradientsRewriter() QVERIFY(rootModelNode.isValid()); - ModelNode rectNode(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data")); + ModelNode rectNode(addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data")); - const QLatin1String expected1("\nimport QtQuick 1.0\n" + const QLatin1String expected1("\nimport Qt 4.7\n" "\n" "Item {\n" "Rectangle {\n" @@ -4039,11 +4041,11 @@ void tst_TestCore::testGradientsRewriter() "}\n"); QCOMPARE(textEdit.toPlainText(), expected1); - ModelNode gradientNode(addNodeChild(rectNode, "QtQuick/Gradient", 1, 0, "gradient")); + ModelNode gradientNode(addNodeChild(rectNode, "Qt/Gradient", 4, 7, "gradient")); QVERIFY(rectNode.hasNodeProperty("gradient")); - const QLatin1String expected2("\nimport QtQuick 1.0\n" + const QLatin1String expected2("\nimport Qt 4.7\n" "\n" "Item {\n" "Rectangle {\n" @@ -4060,11 +4062,11 @@ void tst_TestCore::testGradientsRewriter() propertyList.append(qMakePair(QString("position"), QVariant::fromValue(0))); propertyList.append(qMakePair(QString("color"), QVariant::fromValue(QColor(Qt::red)))); - ModelNode gradientStop1(gradientNode.view()->createModelNode("QtQuick/GradientStop", 1, 0, propertyList)); + ModelNode gradientStop1(gradientNode.view()->createModelNode("Qt/GradientStop", 4, 7, propertyList)); QVERIFY(gradientStop1.isValid()); stops.reparentHere(gradientStop1); - const QLatin1String expected3("\nimport QtQuick 1.0\n" + const QLatin1String expected3("\nimport Qt 4.7\n" "\n" "Item {\n" "Rectangle {\n" @@ -4083,11 +4085,11 @@ void tst_TestCore::testGradientsRewriter() propertyList.append(qMakePair(QString("position"), QVariant::fromValue(0.5))); propertyList.append(qMakePair(QString("color"), QVariant::fromValue(QColor(Qt::blue)))); - ModelNode gradientStop2(gradientNode.view()->createModelNode("QtQuick/GradientStop", 1, 0, propertyList)); + ModelNode gradientStop2(gradientNode.view()->createModelNode("Qt/GradientStop", 4, 7, propertyList)); QVERIFY(gradientStop2.isValid()); stops.reparentHere(gradientStop2); - const QLatin1String expected4("\nimport QtQuick 1.0\n" + const QLatin1String expected4("\nimport Qt 4.7\n" "\n" "Item {\n" "Rectangle {\n" @@ -4111,11 +4113,11 @@ void tst_TestCore::testGradientsRewriter() propertyList.append(qMakePair(QString("position"), QVariant::fromValue(0.8))); propertyList.append(qMakePair(QString("color"), QVariant::fromValue(QColor(Qt::yellow)))); - ModelNode gradientStop3(gradientNode.view()->createModelNode("QtQuick/GradientStop", 1, 0, propertyList)); + ModelNode gradientStop3(gradientNode.view()->createModelNode("Qt/GradientStop", 4, 7, propertyList)); QVERIFY(gradientStop3.isValid()); stops.reparentHere(gradientStop3); - const QLatin1String expected5("\nimport QtQuick 1.0\n" + const QLatin1String expected5("\nimport Qt 4.7\n" "\n" "Item {\n" "Rectangle {\n" @@ -4142,7 +4144,7 @@ void tst_TestCore::testGradientsRewriter() gradientNode.removeProperty("stops"); - const QLatin1String expected6("\nimport QtQuick 1.0\n" + const QLatin1String expected6("\nimport Qt 4.7\n" "\n" "Item {\n" "Rectangle {\n" @@ -4159,7 +4161,7 @@ void tst_TestCore::testGradientsRewriter() propertyList.append(qMakePair(QString("position"), QVariant::fromValue(0))); propertyList.append(qMakePair(QString("color"), QVariant::fromValue(QColor(Qt::blue)))); - gradientStop1 = gradientNode.view()->createModelNode("QtQuick/GradientStop", 1, 0, propertyList); + gradientStop1 = gradientNode.view()->createModelNode("Qt/GradientStop", 4, 7, propertyList); QVERIFY(gradientStop1.isValid()); stops.reparentHere(gradientStop1); @@ -4167,7 +4169,7 @@ void tst_TestCore::testGradientsRewriter() void tst_TestCore::testQmlModelStates() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); @@ -4200,7 +4202,7 @@ void tst_TestCore::testQmlModelStates() void tst_TestCore::testInstancesStates() { // -// import QtQuick 1.0 +// import Qt 4.7 // // Rectangle { // Text { @@ -4228,7 +4230,7 @@ void tst_TestCore::testInstancesStates() // } // - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); @@ -4239,28 +4241,28 @@ void tst_TestCore::testInstancesStates() // ModelNode rootNode = view->rootModelNode(); - ModelNode textNode = view->createModelNode("QtQuick/Text", 1, 0); + ModelNode textNode = view->createModelNode("Qt/Text", 4, 7); textNode.setId("targetObject"); textNode.variantProperty("text").setValue("base state"); rootNode.nodeListProperty("data").reparentHere(textNode); - ModelNode propertyChanges1Node = view->createModelNode("QtQuick/PropertyChanges", 1, 0); + ModelNode propertyChanges1Node = view->createModelNode("Qt/PropertyChanges", 4, 7); propertyChanges1Node.bindingProperty("target").setExpression("targetObject"); propertyChanges1Node.variantProperty("x").setValue(10); propertyChanges1Node.variantProperty("text").setValue("state1"); - ModelNode state1Node = view->createModelNode("QtQuick/State", 1, 0); + ModelNode state1Node = view->createModelNode("Qt/State", 4, 7); state1Node.variantProperty("name").setValue("state1"); state1Node.nodeListProperty("changes").reparentHere(propertyChanges1Node); rootNode.nodeListProperty("states").reparentHere(state1Node); - ModelNode propertyChanges2Node = view->createModelNode("QtQuick/PropertyChanges", 1, 0); + ModelNode propertyChanges2Node = view->createModelNode("Qt/PropertyChanges", 4, 7); propertyChanges2Node.bindingProperty("target").setExpression("targetObject"); propertyChanges2Node.variantProperty("text").setValue("state2"); - ModelNode state2Node = view->createModelNode("QtQuick/State", 1, 0); + ModelNode state2Node = view->createModelNode("Qt/State", 4, 7); state2Node.variantProperty("name").setValue("state2"); state2Node.nodeListProperty("changes").reparentHere(propertyChanges2Node); @@ -4357,7 +4359,7 @@ void tst_TestCore::testInstancesStates() // // move property changes of current state out of state - ModelNode state3Node = view->createModelNode("QtQuick/State", 1, 0); + ModelNode state3Node = view->createModelNode("Qt/State", 4, 7); QDeclarativeListReference changes(state1, "changes"); QCOMPARE(changes.count(), 1); state3Node.nodeListProperty("changes").reparentHere(propertyChanges1Node); @@ -4380,7 +4382,7 @@ void tst_TestCore::testInstancesStates() textNode.variantProperty("text").setValue("base state"); // expressions - ModelNode textNode2 = view->createModelNode("QtQuick/Text", 1, 0); + ModelNode textNode2 = view->createModelNode("Qt/Text", 4, 7); textNode2.setId("targetObject2"); textNode2.variantProperty("text").setValue("textNode2"); @@ -4440,7 +4442,7 @@ void tst_TestCore::testInstancesStates() void tst_TestCore::testStates() { // -// import QtQuick 1.0 +// import Qt 4.7 // // Rectangle { // Text { @@ -4459,7 +4461,7 @@ void tst_TestCore::testStates() // } // - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); @@ -4468,7 +4470,7 @@ void tst_TestCore::testStates() // build up model ModelNode rootNode = view->rootModelNode(); - ModelNode textNode = view->createModelNode("QtQuick/Text", 1, 0); + ModelNode textNode = view->createModelNode("Qt/Text", 4, 7); textNode.setId("targetObject"); textNode.variantProperty("text").setValue("base state"); @@ -4484,7 +4486,7 @@ void tst_TestCore::testStates() QVERIFY(textItem.isValid()); QmlModelState state1(rootItem.states().addState("state 1")); //add state "state 1" - QCOMPARE(state1.modelNode().type(), QString("QtQuick/State")); + QCOMPARE(state1.modelNode().type(), QString("Qt/State")); QVERIFY(view->currentState().isBaseState()); @@ -4517,7 +4519,7 @@ void tst_TestCore::testStates() QCOMPARE(changes.modelNode().variantProperty("text").value(), QVariant("state 1")); QCOMPARE(changes.modelNode().bindingProperty("target").expression(), QString("targetObject")); QCOMPARE(changes.target(), textNode); - QCOMPARE(changes.modelNode().type(), QString("QtQuick/PropertyChanges")); + QCOMPARE(changes.modelNode().type(), QString("Qt/PropertyChanges")); QCOMPARE(changes.modelNode().parentProperty().name(), QString("changes")); QCOMPARE(changes.modelNode().parentProperty().parentModelNode(), state1.modelNode()); @@ -4536,7 +4538,7 @@ void tst_TestCore::testStates() void tst_TestCore::testStatesBaseState() { // -// import QtQuick 1.0 +// import Qt 4.7 // // Rectangle { // Text { @@ -4555,7 +4557,7 @@ void tst_TestCore::testStatesBaseState() // } // - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); @@ -4564,7 +4566,7 @@ void tst_TestCore::testStatesBaseState() // build up model ModelNode rootNode = view->rootModelNode(); - ModelNode textNode = view->createModelNode("QtQuick/Text", 1, 0); + ModelNode textNode = view->createModelNode("Qt/Text", 4, 7); textNode.setId("targetObject"); textNode.variantProperty("text").setValue("base state"); @@ -4580,7 +4582,7 @@ void tst_TestCore::testStatesBaseState() QVERIFY(textItem.isValid()); QmlModelState state1(rootItem.states().addState("state 1")); //add state "state 1" - QCOMPARE(state1.modelNode().type(), QString("QtQuick/State")); + QCOMPARE(state1.modelNode().type(), QString("Qt/State")); QVERIFY(view->currentState().isBaseState()); @@ -4590,7 +4592,7 @@ void tst_TestCore::testStatesBaseState() QVERIFY(textItem.propertyAffectedByCurrentState("text")); QCOMPARE(textItem.instanceValue("text"), QVariant("state 1")); - ModelNode newNode = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode newNode = view->createModelNode("Qt/Rectangle", 4, 7); QVERIFY(!QmlObjectNode(newNode).currentState().isBaseState()); view->setCurrentState(view->baseState()); //set currentState base state @@ -4612,13 +4614,13 @@ void tst_TestCore::testStatesBaseState() void tst_TestCore::testInstancesIdResolution() { - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); model->attachView(view.data()); - // import QtQuick 1.0 + // import Qt 4.7 // // Rectangle { // id: root @@ -4636,7 +4638,7 @@ void tst_TestCore::testInstancesIdResolution() rootNode.variantProperty("width").setValue(100); rootNode.variantProperty("height").setValue(100); - ModelNode item1Node = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode item1Node = view->createModelNode("Qt/Rectangle", 4, 7); item1Node.setId("item1"); item1Node.bindingProperty("width").setExpression("root.width"); item1Node.bindingProperty("height").setExpression("item2.height"); @@ -4656,7 +4658,7 @@ void tst_TestCore::testInstancesIdResolution() // height: root.height // } - ModelNode item2Node = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode item2Node = view->createModelNode("Qt/Rectangle", 4, 7); item2Node.setId("item2"); item2Node.bindingProperty("width").setExpression("root.width / 2"); item2Node.bindingProperty("height").setExpression("root.height"); @@ -4681,7 +4683,7 @@ void tst_TestCore::testInstancesIdResolution() // height: 80 // } - ModelNode item3Node = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode item3Node = view->createModelNode("Qt/Rectangle", 4, 7); item3Node.setId("item3"); item3Node.variantProperty("height").setValue(80); rootNode.nodeListProperty("data").reparentHere(item3Node); @@ -4699,16 +4701,16 @@ void tst_TestCore::testInstancesNotInScene() // test whether deleting an instance which is not in the scene crashes // - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); model->attachView(view.data()); - ModelNode node1 = view->createModelNode("QtQuick/Item", 1, 0); + ModelNode node1 = view->createModelNode("Qt/Item", 4, 7); node1.setId("node1"); - ModelNode node2 = view->createModelNode("QtQuick/Item", 1, 0); + ModelNode node2 = view->createModelNode("Qt/Item", 4, 7); node2.setId("node2"); node1.nodeListProperty("children").reparentHere(node2); @@ -4720,21 +4722,21 @@ void tst_TestCore::testInstancesBindingsInStatesStress() { //This is a stress test to provoke a crash for (int j=0;j<20;j++) { - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); model->attachView(view.data()); - ModelNode node1 = view->createModelNode("QtQuick/Item", 1, 0); + ModelNode node1 = view->createModelNode("Qt/Item", 4, 7); node1.setId("node1"); view->rootModelNode().nodeListProperty("children").reparentHere(node1); - ModelNode node2 = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode node2 = view->createModelNode("Qt/Rectangle", 4, 7); node2.setId("node2"); - ModelNode node3 = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode node3 = view->createModelNode("Qt/Rectangle", 4, 7); node3.setId("node3"); node1.nodeListProperty("children").reparentHere(node2); @@ -4825,21 +4827,21 @@ void tst_TestCore::testInstancesPropertyChangeTargets() //this tests checks if a change of the target of a CropertyChange //node is handled correctly - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); model->attachView(view.data()); - ModelNode node1 = view->createModelNode("QtQuick/Item", 1, 0); + ModelNode node1 = view->createModelNode("Qt/Item", 4, 7); node1.setId("node1"); view->rootModelNode().nodeListProperty("children").reparentHere(node1); - ModelNode node2 = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode node2 = view->createModelNode("Qt/Rectangle", 4, 7); node2.setId("node2"); - ModelNode node3 = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode node3 = view->createModelNode("Qt/Rectangle", 4, 7); node3.setId("node3"); node1.nodeListProperty("children").reparentHere(node2); @@ -4931,21 +4933,21 @@ void tst_TestCore::testInstancesPropertyChangeTargets() void tst_TestCore::testInstancesDeletePropertyChanges() { - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); model->attachView(view.data()); - ModelNode node1 = view->createModelNode("QtQuick/Item", 1, 0); + ModelNode node1 = view->createModelNode("Qt/Item", 4, 7); node1.setId("node1"); view->rootModelNode().nodeListProperty("children").reparentHere(node1); - ModelNode node2 = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode node2 = view->createModelNode("Qt/Rectangle", 4, 7); node2.setId("node2"); - ModelNode node3 = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode node3 = view->createModelNode("Qt/Rectangle", 4, 7); node3.setId("node3"); node1.nodeListProperty("children").reparentHere(node2); @@ -5020,7 +5022,7 @@ void tst_TestCore::testInstancesDeletePropertyChanges() void tst_TestCore::testInstancesChildrenLowLevel() { - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new NodeInstanceView); @@ -5032,11 +5034,11 @@ void tst_TestCore::testInstancesChildrenLowLevel() rootModelNode.setId("rootModelNode"); - ModelNode childNode1 = addNodeListChild(rootModelNode, "QtQuick/Text", 1, 0, "data"); + ModelNode childNode1 = addNodeListChild(rootModelNode, "Qt/Text", 4, 7, "data"); QVERIFY(childNode1.isValid()); childNode1.setId("childNode1"); - ModelNode childNode2 = addNodeListChild(rootModelNode, "QtQuick/TextEdit", 1, 0, "data"); + ModelNode childNode2 = addNodeListChild(rootModelNode, "Qt/TextEdit", 4, 7, "data"); QVERIFY(childNode2.isValid()); childNode2.setId("childNode2"); @@ -5110,7 +5112,7 @@ void tst_TestCore::testInstancesChildrenLowLevel() void tst_TestCore::testInstancesResourcesLowLevel() { - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new NodeInstanceView); @@ -5122,15 +5124,15 @@ void tst_TestCore::testInstancesResourcesLowLevel() rootModelNode.setId("rootModelNode"); - ModelNode childNode1 = addNodeListChild(rootModelNode, "QtQuick/Text", 1, 0, "data"); + ModelNode childNode1 = addNodeListChild(rootModelNode, "Qt/Text", 4, 7, "data"); QVERIFY(childNode1.isValid()); childNode1.setId("childNode1"); - ModelNode childNode2 = addNodeListChild(rootModelNode, "QtQuick/TextEdit", 1, 0, "data"); + ModelNode childNode2 = addNodeListChild(rootModelNode, "Qt/TextEdit", 4, 7, "data"); QVERIFY(childNode2.isValid()); childNode2.setId("childNode2"); - ModelNode listModel = addNodeListChild(rootModelNode, "QtQuick/ListModel", 1, 0, "data"); + ModelNode listModel = addNodeListChild(rootModelNode, "Qt/ListModel", 4, 7, "data"); QVERIFY(listModel.isValid()); listModel.setId("listModel"); @@ -5169,6 +5171,8 @@ void tst_TestCore::testInstancesResourcesLowLevel() QCOMPARE(listReferenceResources.at(0), listModelObject); QCOMPARE(listReferenceData.at(0), listModelObject); + QSKIP("This crashes", SkipAll); //### todo might be critical in the future + listReferenceResources.clear(); QCOMPARE(listReferenceData.count(), 2); @@ -5186,8 +5190,6 @@ void tst_TestCore::testInstancesResourcesLowLevel() QCOMPARE(listReferenceData.at(1), child1Item); QCOMPARE(listReferenceData.at(2), child2Item); - QSKIP("This crashes", SkipAll); //### todo might be critical in the future - listReferenceChildren.clear(); QCOMPARE(listReferenceData.count(), 1); @@ -5209,7 +5211,7 @@ void tst_TestCore::testInstancesResourcesLowLevel() QCOMPARE(listReferenceData.at(1), child1Item); QCOMPARE(listReferenceData.at(2), child2Item); - ModelNode listModel2 = addNodeListChild(rootModelNode, "QtQuick/ListModel", 1, 0, "data"); + ModelNode listModel2 = addNodeListChild(rootModelNode, "Qt/ListModel", 4, 7, "data"); QVERIFY(listModel2.isValid()); listModel2.setId("listModel2"); @@ -5257,7 +5259,7 @@ void tst_TestCore::testInstancesResourcesLowLevel() void tst_TestCore::testInstancesFlickableLowLevel() { - QScopedPointer model(Model::create("QtQuick/Flickable", 1, 0)); + QScopedPointer model(Model::create("Qt/Flickable", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new NodeInstanceView); @@ -5269,15 +5271,15 @@ void tst_TestCore::testInstancesFlickableLowLevel() rootModelNode.setId("rootModelNode"); - ModelNode childNode1 = addNodeListChild(rootModelNode, "QtQuick/Text", 1, 0, "flickableData"); + ModelNode childNode1 = addNodeListChild(rootModelNode, "Qt/Text", 4, 7, "flickableData"); QVERIFY(childNode1.isValid()); childNode1.setId("childNode1"); - ModelNode childNode2 = addNodeListChild(rootModelNode, "QtQuick/TextEdit", 1, 0, "flickableData"); + ModelNode childNode2 = addNodeListChild(rootModelNode, "Qt/TextEdit", 4, 7, "flickableData"); QVERIFY(childNode2.isValid()); childNode2.setId("childNode2"); - ModelNode listModel = addNodeListChild(rootModelNode, "QtQuick/ListModel", 1, 0, "flickableData"); + ModelNode listModel = addNodeListChild(rootModelNode, "Qt/ListModel", 4, 7, "flickableData"); QVERIFY(listModel.isValid()); listModel.setId("listModel"); @@ -5345,7 +5347,7 @@ void tst_TestCore::testInstancesFlickableLowLevel() void tst_TestCore::testInstancesReorderChildrenLowLevel() { - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new NodeInstanceView); @@ -5357,23 +5359,23 @@ void tst_TestCore::testInstancesReorderChildrenLowLevel() rootModelNode.setId("rootModelNode"); - ModelNode childNode1 = addNodeListChild(rootModelNode, "QtQuick/Text", 1, 0, "data"); + ModelNode childNode1 = addNodeListChild(rootModelNode, "Qt/Text", 4, 7, "data"); QVERIFY(childNode1.isValid()); childNode1.setId("childNode1"); - ModelNode childNode2 = addNodeListChild(rootModelNode, "QtQuick/TextEdit", 1, 0, "data"); + ModelNode childNode2 = addNodeListChild(rootModelNode, "Qt/TextEdit", 4, 7, "data"); QVERIFY(childNode2.isValid()); childNode2.setId("childNode2"); - ModelNode listModel = addNodeListChild(rootModelNode, "QtQuick/ListModel", 1, 0, "data"); + ModelNode listModel = addNodeListChild(rootModelNode, "Qt/ListModel", 4, 7, "data"); QVERIFY(listModel.isValid()); listModel.setId("listModel"); - ModelNode childNode3 = addNodeListChild(rootModelNode, "QtQuick/TextEdit", 1, 0, "data"); + ModelNode childNode3 = addNodeListChild(rootModelNode, "Qt/TextEdit", 4, 7, "data"); QVERIFY(childNode3.isValid()); childNode3.setId("childNode3"); - ModelNode childNode4 = addNodeListChild(rootModelNode, "QtQuick/TextEdit", 1, 0, "data"); + ModelNode childNode4 = addNodeListChild(rootModelNode, "Qt/TextEdit", 4, 7, "data"); QVERIFY(childNode4.isValid()); childNode4.setId("childNode4"); @@ -5444,7 +5446,7 @@ void tst_TestCore::testInstancesReorderChildrenLowLevel() void tst_TestCore::testQmlModelStatesInvalidForRemovedNodes() { - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -5461,11 +5463,11 @@ void tst_TestCore::testQmlModelStatesInvalidForRemovedNodes() QVERIFY(state1.isValid()); QCOMPARE(state1.name(), QString("state1")); - ModelNode childNode = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(childNode.isValid()); childNode.setId("childNode"); - ModelNode subChildNode = addNodeListChild(childNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode subChildNode = addNodeListChild(childNode, "Qt/Rectangle", 4, 7, "data"); QVERIFY(subChildNode.isValid()); subChildNode.setId("subChildNode"); @@ -5485,7 +5487,7 @@ void tst_TestCore::testInstancesAttachToExistingModel() // Test attaching nodeinstanceview to an existing model // - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -5493,7 +5495,7 @@ void tst_TestCore::testInstancesAttachToExistingModel() model->attachView(view.data()); ModelNode rootNode = view->rootModelNode(); - ModelNode rectangleNode = addNodeListChild(rootNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode rectangleNode = addNodeListChild(rootNode, "Qt/Rectangle", 4, 7, "data"); rectangleNode.variantProperty("width").setValue(100); @@ -5518,7 +5520,7 @@ void tst_TestCore::testInstancesAttachToExistingModel() void tst_TestCore::testQmlModelAddMultipleStates() { - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -5549,7 +5551,7 @@ void tst_TestCore::testQmlModelAddMultipleStates() void tst_TestCore::testQmlModelRemoveStates() { - QScopedPointer model(Model::create("QtQuick/Rectangle", 1, 0)); + QScopedPointer model(Model::create("Qt/Rectangle", 4, 7)); QScopedPointer view(new TestView(model.data())); QVERIFY(view.data()); @@ -5579,10 +5581,10 @@ void tst_TestCore::testQmlModelRemoveStates() void tst_TestCore::testQmlModelStateWithName() { QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Rectangle { id: theRect; width: 100; states: [ State { name: \"a\"; PropertyChanges { target: theRect; width: 200; } } ] }\n"); + textEdit1.setPlainText("import Qt 4.7; Rectangle { id: theRect; width: 100; states: [ State { name: \"a\"; PropertyChanges { target: theRect; width: 200; } } ] }\n"); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item")); + QScopedPointer model1(Model::create("Qt/Item")); TestRewriterView *testRewriterView1 = new TestRewriterView(model1.data()); testRewriterView1->setTextModifier(&modifier1); @@ -5604,7 +5606,7 @@ void tst_TestCore::testQmlModelStateWithName() view->setCurrentState(rootNode.states().allStates().at(0)); rootNode.setVariantProperty("width", 112); - const QLatin1String expected1("import QtQuick 1.0; Rectangle { id: theRect; width: 100; states: [ State { name: \"a\"; PropertyChanges { target: theRect; width: 112 } } ] }\n"); + const QLatin1String expected1("import Qt 4.7; Rectangle { id: theRect; width: 100; states: [ State { name: \"a\"; PropertyChanges { target: theRect; width: 112 } } ] }\n"); QCOMPARE(textEdit1.toPlainText(), expected1); QVERIFY(!rootNode.isInBaseState()); @@ -5624,10 +5626,10 @@ void tst_TestCore::testQmlModelStateWithName() void tst_TestCore::testRewriterAutomaticSemicolonAfterChangedProperty() { QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Rectangle {\n width: 640\n height: 480\n}\n"); + textEdit1.setPlainText("import Qt 4.7; Rectangle {\n width: 640\n height: 480\n}\n"); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item")); + QScopedPointer model1(Model::create("Qt/Item")); TestRewriterView *testRewriterView1 = new TestRewriterView(model1.data()); testRewriterView1->setTextModifier(&modifier1); @@ -5644,7 +5646,7 @@ void tst_TestCore::testRewriterAutomaticSemicolonAfterChangedProperty() void tst_TestCore::defaultPropertyValues() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -5654,12 +5656,12 @@ void tst_TestCore::defaultPropertyValues() QCOMPARE(view->rootModelNode().variantProperty("x").value().toDouble(), 0.0); QCOMPARE(view->rootModelNode().variantProperty("width").value().toDouble(), 0.0); - ModelNode rectNode(addNodeListChild(view->rootModelNode(), "QtQuick/Rectangle", 1, 0, "data")); + ModelNode rectNode(addNodeListChild(view->rootModelNode(), "Qt/Rectangle", 4, 7, "data")); QCOMPARE(rectNode.variantProperty("y").value().toDouble(), 0.0); QCOMPARE(rectNode.variantProperty("width").value().toDouble(), 0.0); - ModelNode imageNode(addNodeListChild(view->rootModelNode(), "QtQuick/Image", 1, 0, "data")); + ModelNode imageNode(addNodeListChild(view->rootModelNode(), "Qt/Image", 4, 7, "data")); QCOMPARE(imageNode.variantProperty("y").value().toDouble(), 0.0); QCOMPARE(imageNode.variantProperty("width").value().toDouble(), 0.0); @@ -5668,10 +5670,10 @@ void tst_TestCore::defaultPropertyValues() void tst_TestCore::testModelPropertyValueTypes() { QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Rectangle { width: 100; radius: 1.5; color: \"red\"; }"); + textEdit1.setPlainText("import Qt 4.7; Rectangle { width: 100; radius: 1.5; color: \"red\"; }"); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model1(Model::create("QtQuick/Item")); + QScopedPointer model1(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -5689,7 +5691,7 @@ void tst_TestCore::testModelPropertyValueTypes() void tst_TestCore::testModelNodeInHierarchy() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -5697,9 +5699,9 @@ void tst_TestCore::testModelNodeInHierarchy() model->attachView(view.data()); QVERIFY(view->rootModelNode().isInHierarchy()); - ModelNode node1 = addNodeListChild(view->rootModelNode(), "QtQuick/Item", 1, 0, "data"); + ModelNode node1 = addNodeListChild(view->rootModelNode(), "Qt/Item", 4, 7, "data"); QVERIFY(node1.isInHierarchy()); - ModelNode node2 = view->createModelNode("QtQuick/Item", 1, 0); + ModelNode node2 = view->createModelNode("Qt/Item", 4, 7); QVERIFY(!node2.isInHierarchy()); node2.nodeListProperty("data").reparentHere(node1); QVERIFY(!node2.isInHierarchy()); @@ -5710,11 +5712,11 @@ void tst_TestCore::testModelNodeInHierarchy() void tst_TestCore::testModelNodeIsAncestorOf() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); // - // import QtQuick 1.0 + // import Qt 4.7 // Item { // Item { // id: item2 @@ -5732,11 +5734,11 @@ void tst_TestCore::testModelNodeIsAncestorOf() model->attachView(view.data()); view->rootModelNode().setId("item1"); - ModelNode item2 = addNodeListChild(view->rootModelNode(), "QtQuick/Item", 1, 0, "data"); + ModelNode item2 = addNodeListChild(view->rootModelNode(), "Qt/Item", 4, 7, "data"); item2.setId("item2"); - ModelNode item3 = addNodeListChild(view->rootModelNode(), "QtQuick/Item", 1, 0, "data"); + ModelNode item3 = addNodeListChild(view->rootModelNode(), "Qt/Item", 4, 7, "data"); item3.setId("item3"); - ModelNode item4 = addNodeListChild(item3, "QtQuick/Item", 1, 0, "data"); + ModelNode item4 = addNodeListChild(item3, "Qt/Item", 4, 7, "data"); item4.setId("item4"); QVERIFY(view->rootModelNode().isAncestorOf(item2)); @@ -5749,7 +5751,7 @@ void tst_TestCore::testModelNodeIsAncestorOf() void tst_TestCore::testModelDefaultProperties() { - QScopedPointer model(Model::create("QtQuick/Rectangle")); + QScopedPointer model(Model::create("Qt/Rectangle")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -5765,10 +5767,10 @@ void tst_TestCore::testModelDefaultProperties() void tst_TestCore::loadAnchors() { QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Item { width: 100; height: 100; Rectangle { anchors.left: parent.left; anchors.horizontalCenter: parent.horizontalCenter; anchors.rightMargin: 20; }}"); + textEdit1.setPlainText("import Qt 4.7; Item { width: 100; height: 100; Rectangle { anchors.left: parent.left; anchors.horizontalCenter: parent.horizontalCenter; anchors.rightMargin: 20; }}"); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -5804,10 +5806,10 @@ void tst_TestCore::loadAnchors() void tst_TestCore::changeAnchors() { QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Item { width: 100; height: 100; Rectangle { anchors.left: parent.left; anchors.horizontalCenter: parent.horizontalCenter; anchors.rightMargin: 20; }}"); + textEdit1.setPlainText("import Qt 4.7; Item { width: 100; height: 100; Rectangle { anchors.left: parent.left; anchors.horizontalCenter: parent.horizontalCenter; anchors.rightMargin: 20; }}"); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -5865,10 +5867,10 @@ void tst_TestCore::changeAnchors() void tst_TestCore::anchorToSibling() { QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Item { Rectangle {} Rectangle { id: secondChild } }"); + textEdit1.setPlainText("import Qt 4.7; Item { Rectangle {} Rectangle { id: secondChild } }"); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -5909,10 +5911,10 @@ void tst_TestCore::anchorToSibling() void tst_TestCore::removeFillAnchorByDetaching() { QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Item { width: 100; height: 100; Rectangle { id: child; anchors.fill: parent } }"); + textEdit1.setPlainText("import Qt 4.7; Item { width: 100; height: 100; Rectangle { id: child; anchors.fill: parent } }"); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -5989,10 +5991,10 @@ void tst_TestCore::removeFillAnchorByDetaching() void tst_TestCore::removeFillAnchorByChanging() { QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Item { width: 100; height: 100; Rectangle { id: child; anchors.fill: parent } }"); + textEdit1.setPlainText("import Qt 4.7; Item { width: 100; height: 100; Rectangle { id: child; anchors.fill: parent } }"); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -6069,7 +6071,7 @@ void tst_TestCore::removeFillAnchorByChanging() void tst_TestCore::testModelBindings() { - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data()); @@ -6089,7 +6091,7 @@ void tst_TestCore::testModelBindings() QCOMPARE(rootInstance.size().width(), 200.0); QCOMPARE(rootInstance.size().height(), 100.0); - ModelNode childNode = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode childNode = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); childNode.variantProperty("width") = 100; childNode.variantProperty("height") = 100; @@ -6127,7 +6129,7 @@ void tst_TestCore::testModelBindings() void tst_TestCore::testModelDynamicProperties() { - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); TestView *testView = new TestView(model.data()); @@ -6171,7 +6173,7 @@ void tst_TestCore::testModelDynamicProperties() void tst_TestCore::testModelSliding() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6180,10 +6182,10 @@ void tst_TestCore::testModelSliding() ModelNode rootModelNode(view->rootModelNode()); - ModelNode rect00(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data")); - ModelNode rect01(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data")); - ModelNode rect02(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data")); - ModelNode rect03(addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data")); + ModelNode rect00(addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data")); + ModelNode rect01(addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data")); + ModelNode rect02(addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data")); + ModelNode rect03(addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data")); QVERIFY(rect00.isValid()); QVERIFY(rect01.isValid()); @@ -6239,13 +6241,13 @@ void tst_TestCore::testModelSliding() void tst_TestCore::testRewriterChangeId() { - const char* qmlString = "import QtQuick 1.0\nRectangle { }"; + const char* qmlString = "import Qt 4.7\nRectangle { }"; QPlainTextEdit textEdit; textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6264,25 +6266,25 @@ void tst_TestCore::testRewriterChangeId() QCOMPARE(rootModelNode.id(), QString("rectId")); - QString expected = "import QtQuick 1.0\n" + QString expected = "import Qt 4.7\n" "Rectangle { id: rectId }"; QCOMPARE(textEdit.toPlainText(), expected); // change id for node outside of hierarchy - ModelNode node = view->createModelNode("QtQuick/Item", 1, 0); + ModelNode node = view->createModelNode("Qt/Item", 4, 7); node.setId("myId"); } void tst_TestCore::testRewriterRemoveId() { - const char* qmlString = "import QtQuick 1.0\nRectangle { id: rect }"; + const char* qmlString = "import Qt 4.7\nRectangle { id: rect }"; QPlainTextEdit textEdit; textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6300,7 +6302,7 @@ void tst_TestCore::testRewriterRemoveId() // // remove id in text // - const char* qmlString2 = "import QtQuick 1.0\nRectangle { }"; + const char* qmlString2 = "import Qt 4.7\nRectangle { }"; textEdit.setPlainText(qmlString2); QCOMPARE(rootModelNode.id(), QString()); @@ -6308,13 +6310,13 @@ void tst_TestCore::testRewriterRemoveId() void tst_TestCore::testRewriterChangeValueProperty() { - const char* qmlString = "import QtQuick 1.0\nRectangle { x: 10; y: 10 }"; + const char* qmlString = "import Qt 4.7\nRectangle { x: 10; y: 10 }"; QPlainTextEdit textEdit; textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6337,14 +6339,14 @@ void tst_TestCore::testRewriterChangeValueProperty() // change property for node outside of hierarchy PropertyListType properties; properties.append(QPair("x", 10)); - ModelNode node = view->createModelNode("QtQuick/Item", 1, 0, properties); + ModelNode node = view->createModelNode("Qt/Item", 4, 7, properties); node.variantProperty("x").setValue(20); } void tst_TestCore::testRewriterRemoveValueProperty() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "Rectangle {\n" " x: 10\n" " y: 10;\n" @@ -6354,7 +6356,7 @@ void tst_TestCore::testRewriterRemoveValueProperty() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6375,7 +6377,7 @@ void tst_TestCore::testRewriterRemoveValueProperty() rootModelNode.removeProperty("x"); const QLatin1String expected("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "Rectangle {\n" " y: 10;\n" "}\n"); @@ -6384,19 +6386,19 @@ void tst_TestCore::testRewriterRemoveValueProperty() // remove property for node outside of hierarchy PropertyListType properties; properties.append(QPair("x", 10)); - ModelNode node = view->createModelNode("QtQuick/Item", 1, 0, properties); + ModelNode node = view->createModelNode("Qt/Item", 4, 7, properties); node.removeProperty("x"); } void tst_TestCore::testRewriterSignalProperty() { - const char* qmlString = "import QtQuick 1.0\nRectangle { onColorChanged: {} }"; + const char* qmlString = "import Qt 4.7\nRectangle { onColorChanged: {} }"; QPlainTextEdit textEdit; textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6416,13 +6418,13 @@ void tst_TestCore::testRewriterSignalProperty() void tst_TestCore::testRewriterObjectTypeProperty() { - const char* qmlString = "import QtQuick 1.0\nRectangle { x: 10; y: 10 }"; + const char* qmlString = "import Qt 4.7\nRectangle { x: 10; y: 10 }"; QPlainTextEdit textEdit; textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6436,11 +6438,11 @@ void tst_TestCore::testRewriterObjectTypeProperty() ModelNode rootModelNode(view->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootModelNode.type(), QLatin1String("Qt/Rectangle")); - view->changeRootNodeType(QLatin1String("QtQuick/Text"), 1, 0); + view->changeRootNodeType(QLatin1String("Qt/Text"), 4, 7); - QCOMPARE(rootModelNode.type(), QLatin1String("QtQuick/Text")); + QCOMPARE(rootModelNode.type(), QLatin1String("Qt/Text")); } void tst_TestCore::testRewriterPropertyChanges() @@ -6450,7 +6452,7 @@ void tst_TestCore::testRewriterPropertyChanges() // Use a slightly more complicated example so that target properties are not resolved in default scope const char* qmlString - = "import QtQuick 1.0\n" + = "import Qt 4.7\n" "Rectangle {\n" " Text {\n" " id: targetObj\n" @@ -6470,7 +6472,7 @@ void tst_TestCore::testRewriterPropertyChanges() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6483,7 +6485,7 @@ void tst_TestCore::testRewriterPropertyChanges() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); QVERIFY(rootNode.propertyNames().contains(QLatin1String("data"))); QVERIFY(rootNode.propertyNames().contains(QLatin1String("states"))); QCOMPARE(rootNode.propertyNames().count(), 2); @@ -6494,7 +6496,7 @@ void tst_TestCore::testRewriterPropertyChanges() ModelNode stateNode = statesProperty.toModelNodeList().first(); QVERIFY(stateNode.isValid()); - QCOMPARE(stateNode.type(), QString("QtQuick/State")); + QCOMPARE(stateNode.type(), QString("Qt/State")); QCOMPARE(stateNode.propertyNames(), QStringList("changes")); NodeListProperty stateChangesProperty = stateNode.property("changes").toNodeListProperty(); @@ -6521,13 +6523,13 @@ void tst_TestCore::testRewriterListModel() try { // ListModel uses a custom parser - const char* qmlString = "import QtQuick 1.0; ListModel {\n ListElement {\n age: 12\n} \n}"; + const char* qmlString = "import Qt 4.7; ListModel {\n ListElement {\n age: 12\n} \n}"; QPlainTextEdit textEdit; textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer testRewriterView(new TestRewriterView()); @@ -6556,7 +6558,7 @@ void tst_TestCore::testRewriterListModel() void tst_TestCore::testRewriterAddProperty() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "}"); @@ -6564,7 +6566,7 @@ void tst_TestCore::testRewriterAddProperty() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6577,7 +6579,7 @@ void tst_TestCore::testRewriterAddProperty() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); rootNode.variantProperty(QLatin1String("x")).setValue(123); @@ -6586,7 +6588,7 @@ void tst_TestCore::testRewriterAddProperty() QCOMPARE(rootNode.variantProperty(QLatin1String("x")).value(), QVariant(123)); const QLatin1String expected("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "x: 123\n" @@ -6597,7 +6599,7 @@ void tst_TestCore::testRewriterAddProperty() void tst_TestCore::testRewriterAddPropertyInNestedObject() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Rectangle {\n" @@ -6608,7 +6610,7 @@ void tst_TestCore::testRewriterAddPropertyInNestedObject() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6621,18 +6623,18 @@ void tst_TestCore::testRewriterAddPropertyInNestedObject() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle")); ModelNode childNode = rootNode.nodeListProperty(QLatin1String("data")).toModelNodeList().at(0); QVERIFY(childNode.isValid()); - QCOMPARE(childNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(childNode.type(), QLatin1String("Qt/Rectangle")); QCOMPARE(childNode.id(), QLatin1String("rectangle1")); childNode.variantProperty(QLatin1String("x")).setValue(10); childNode.variantProperty(QLatin1String("y")).setValue(10); const QLatin1String expected("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Rectangle {\n" @@ -6646,7 +6648,7 @@ void tst_TestCore::testRewriterAddPropertyInNestedObject() void tst_TestCore::testRewriterAddObjectDefinition() { - const QLatin1String qmlString("import QtQuick 1.0\n" + const QLatin1String qmlString("import Qt 4.7\n" "\n" "Rectangle {\n" "}"); @@ -6654,7 +6656,7 @@ void tst_TestCore::testRewriterAddObjectDefinition() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6667,20 +6669,20 @@ void tst_TestCore::testRewriterAddObjectDefinition() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); - ModelNode childNode = view->createModelNode("QtQuick/MouseArea", 1, 0); + ModelNode childNode = view->createModelNode("Qt/MouseArea", 4, 7); rootNode.nodeAbstractProperty(QLatin1String("data")).reparentHere(childNode); QCOMPARE(rootNode.nodeProperty(QLatin1String("data")).toNodeListProperty().toModelNodeList().size(), 1); childNode = rootNode.nodeProperty(QLatin1String("data")).toNodeListProperty().toModelNodeList().at(0); - QCOMPARE(childNode.type(), QString(QLatin1String("QtQuick/MouseArea"))); + QCOMPARE(childNode.type(), QString(QLatin1String("Qt/MouseArea"))); } void tst_TestCore::testRewriterAddStatesArray() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "}"); @@ -6688,7 +6690,7 @@ void tst_TestCore::testRewriterAddStatesArray() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6700,13 +6702,13 @@ void tst_TestCore::testRewriterAddStatesArray() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); - ModelNode stateNode = view->createModelNode("QtQuick/State", 1, 0); + ModelNode stateNode = view->createModelNode("Qt/State", 4, 7); rootNode.nodeListProperty(QLatin1String("states")).reparentHere(stateNode); const QString expected1 = QLatin1String("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "states: [\n" @@ -6716,11 +6718,11 @@ void tst_TestCore::testRewriterAddStatesArray() "}"); QCOMPARE(textEdit.toPlainText(), expected1); - ModelNode stateNode2 = view->createModelNode("QtQuick/State", 1, 0); + ModelNode stateNode2 = view->createModelNode("Qt/State", 4, 7); rootNode.nodeListProperty(QLatin1String("states")).reparentHere(stateNode2); const QString expected2 = QLatin1String("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "states: [\n" @@ -6736,7 +6738,7 @@ void tst_TestCore::testRewriterAddStatesArray() void tst_TestCore::testRewriterRemoveStates() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " states: [\n" @@ -6750,7 +6752,7 @@ void tst_TestCore::testRewriterRemoveStates() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6762,7 +6764,7 @@ void tst_TestCore::testRewriterRemoveStates() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); NodeListProperty statesProperty = rootNode.nodeListProperty(QLatin1String("states")); QVERIFY(statesProperty.isValid()); @@ -6772,7 +6774,7 @@ void tst_TestCore::testRewriterRemoveStates() state.destroy(); const QLatin1String expected1("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " states: [\n" @@ -6786,7 +6788,7 @@ void tst_TestCore::testRewriterRemoveStates() state.destroy(); const QLatin1String expected2("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "}"); @@ -6796,7 +6798,7 @@ void tst_TestCore::testRewriterRemoveStates() void tst_TestCore::testRewriterRemoveObjectDefinition() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " MouseArea {\n" @@ -6808,7 +6810,7 @@ void tst_TestCore::testRewriterRemoveObjectDefinition() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6821,24 +6823,24 @@ void tst_TestCore::testRewriterRemoveObjectDefinition() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); QCOMPARE(rootNode.nodeProperty(QLatin1String("data")).toNodeListProperty().toModelNodeList().size(), 2); ModelNode childNode = rootNode.nodeProperty(QLatin1String("data")).toNodeListProperty().toModelNodeList().at(1); - QCOMPARE(childNode.type(), QString(QLatin1String("QtQuick/MouseArea"))); + QCOMPARE(childNode.type(), QString(QLatin1String("Qt/MouseArea"))); childNode.destroy(); QCOMPARE(rootNode.nodeProperty(QLatin1String("data")).toNodeListProperty().toModelNodeList().size(), 1); childNode = rootNode.nodeProperty(QLatin1String("data")).toNodeListProperty().toModelNodeList().at(0); - QCOMPARE(childNode.type(), QString(QLatin1String("QtQuick/MouseArea"))); + QCOMPARE(childNode.type(), QString(QLatin1String("Qt/MouseArea"))); childNode.destroy(); QVERIFY(!rootNode.hasProperty(QLatin1String("data"))); const QString expected = QLatin1String("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " // some comment here\n" @@ -6846,9 +6848,9 @@ void tst_TestCore::testRewriterRemoveObjectDefinition() QCOMPARE(textEdit.toPlainText(), expected); // don't crash when deleting nodes not in any hierarchy - ModelNode node1 = view->createModelNode("QtQuick/Rectangle", 1, 0); - ModelNode node2 = addNodeListChild(node1, "QtQuick/Item", 1, 0, "data"); - ModelNode node3 = addNodeListChild(node2, "QtQuick/Item", 1, 0, "data"); + ModelNode node1 = view->createModelNode("Qt/Rectangle", 4, 7); + ModelNode node2 = addNodeListChild(node1, "Qt/Item", 4, 7, "data"); + ModelNode node3 = addNodeListChild(node2, "Qt/Item", 4, 7, "data"); node3.destroy(); node1.destroy(); @@ -6857,7 +6859,7 @@ void tst_TestCore::testRewriterRemoveObjectDefinition() void tst_TestCore::testRewriterRemoveScriptBinding() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " x: 10; // some comment\n" @@ -6867,7 +6869,7 @@ void tst_TestCore::testRewriterRemoveScriptBinding() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6880,7 +6882,7 @@ void tst_TestCore::testRewriterRemoveScriptBinding() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); QCOMPARE(rootNode.properties().size(), 2); QVERIFY(rootNode.hasProperty(QLatin1String("x"))); @@ -6897,7 +6899,7 @@ void tst_TestCore::testRewriterRemoveScriptBinding() QCOMPARE(rootNode.properties().size(), 0); const QString expected = QLatin1String("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " // some comment\n" @@ -6908,7 +6910,7 @@ void tst_TestCore::testRewriterRemoveScriptBinding() void tst_TestCore::testRewriterNodeReparenting() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Item {\n" @@ -6920,7 +6922,7 @@ void tst_TestCore::testRewriterNodeReparenting() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -6933,15 +6935,15 @@ void tst_TestCore::testRewriterNodeReparenting() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); ModelNode itemNode = rootNode.nodeListProperty("data").toModelNodeList().at(0); QVERIFY(itemNode.isValid()); - QCOMPARE(itemNode.type(), QLatin1String("QtQuick/Item")); + QCOMPARE(itemNode.type(), QLatin1String("Qt/Item")); ModelNode mouseArea = itemNode.nodeListProperty("data").toModelNodeList().at(0); QVERIFY(mouseArea.isValid()); - QCOMPARE(mouseArea.type(), QLatin1String("QtQuick/MouseArea")); + QCOMPARE(mouseArea.type(), QLatin1String("Qt/MouseArea")); rootNode.nodeListProperty("data").reparentHere(mouseArea); @@ -6949,7 +6951,7 @@ void tst_TestCore::testRewriterNodeReparenting() QCOMPARE(rootNode.nodeListProperty("data").toModelNodeList().size(), 2); QString expected = "\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Item {\n" @@ -6961,9 +6963,9 @@ void tst_TestCore::testRewriterNodeReparenting() QCOMPARE(textEdit.toPlainText(), expected); // reparenting outside of the hierarchy - ModelNode node1 = view->createModelNode("QtQuick/Rectangle", 1, 0); - ModelNode node2 = view->createModelNode("QtQuick/Item", 1, 0); - ModelNode node3 = view->createModelNode("QtQuick/Item", 1, 0); + ModelNode node1 = view->createModelNode("Qt/Rectangle", 4, 7); + ModelNode node2 = view->createModelNode("Qt/Item", 4, 7); + ModelNode node3 = view->createModelNode("Qt/Item", 4, 7); node2.nodeListProperty("data").reparentHere(node3); node1.nodeListProperty("data").reparentHere(node2); @@ -6971,7 +6973,7 @@ void tst_TestCore::testRewriterNodeReparenting() rootNode.nodeListProperty("data").reparentHere(node1); expected = "\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Item {\n" @@ -6991,11 +6993,11 @@ void tst_TestCore::testRewriterNodeReparenting() QCOMPARE(textEdit.toPlainText(), expected); // reparent out of the hierarchy - ModelNode node4 = view->createModelNode("QtQuick/Rectangle", 1, 0); + ModelNode node4 = view->createModelNode("Qt/Rectangle", 4, 7); node4.nodeListProperty("data").reparentHere(node1); expected = "\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Item {\n" @@ -7011,7 +7013,7 @@ void tst_TestCore::testRewriterNodeReparenting() void tst_TestCore::testRewriterNodeReparentingWithTransaction() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " id: rootItem\n" @@ -7028,7 +7030,7 @@ void tst_TestCore::testRewriterNodeReparentingWithTransaction() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -7041,17 +7043,17 @@ void tst_TestCore::testRewriterNodeReparentingWithTransaction() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle")); QCOMPARE(rootNode.id(), QLatin1String("rootItem")); ModelNode item1Node = rootNode.nodeListProperty("data").toModelNodeList().at(0); QVERIFY(item1Node.isValid()); - QCOMPARE(item1Node.type(), QLatin1String("QtQuick/Item")); + QCOMPARE(item1Node.type(), QLatin1String("Qt/Item")); QCOMPARE(item1Node.id(), QLatin1String("firstItem")); ModelNode item2Node = rootNode.nodeListProperty("data").toModelNodeList().at(1); QVERIFY(item2Node.isValid()); - QCOMPARE(item2Node.type(), QLatin1String("QtQuick/Item")); + QCOMPARE(item2Node.type(), QLatin1String("Qt/Item")); QCOMPARE(item2Node.id(), QLatin1String("secondItem")); RewriterTransaction transaction = testRewriterView->beginRewriterTransaction(); @@ -7062,7 +7064,7 @@ void tst_TestCore::testRewriterNodeReparentingWithTransaction() transaction.commit(); const QLatin1String expected("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " id: rootItem\n" @@ -7081,7 +7083,7 @@ void tst_TestCore::testRewriterNodeReparentingWithTransaction() void tst_TestCore::testRewriterMovingInOut() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "}"); @@ -7089,7 +7091,7 @@ void tst_TestCore::testRewriterMovingInOut() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -7102,13 +7104,13 @@ void tst_TestCore::testRewriterMovingInOut() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); - ModelNode newNode = view->createModelNode("QtQuick/MouseArea", 1, 0); + ModelNode newNode = view->createModelNode("Qt/MouseArea", 4, 7); rootNode.nodeListProperty(QLatin1String("data")).reparentHere(newNode); const QLatin1String expected1("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "MouseArea {\n" @@ -7127,7 +7129,7 @@ void tst_TestCore::testRewriterMovingInOut() newNode.destroy(); const QLatin1String expected2("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "}"); @@ -7137,7 +7139,7 @@ void tst_TestCore::testRewriterMovingInOut() void tst_TestCore::testRewriterMovingInOutWithTransaction() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "}"); @@ -7145,7 +7147,7 @@ void tst_TestCore::testRewriterMovingInOutWithTransaction() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -7158,11 +7160,11 @@ void tst_TestCore::testRewriterMovingInOutWithTransaction() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); RewriterTransaction transaction = view->beginRewriterTransaction(); - ModelNode newNode = view->createModelNode("QtQuick/MouseArea", 1, 0); + ModelNode newNode = view->createModelNode("Qt/MouseArea", 4, 7); rootNode.nodeListProperty(QLatin1String("data")).reparentHere(newNode); #define move(node, x, y) {\ @@ -7178,7 +7180,7 @@ void tst_TestCore::testRewriterMovingInOutWithTransaction() transaction.commit(); const QLatin1String expected2("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" "}"); @@ -7188,7 +7190,7 @@ void tst_TestCore::testRewriterMovingInOutWithTransaction() void tst_TestCore::testRewriterComplexMovingInOut() { const QLatin1String qmlString("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Item {\n" @@ -7198,7 +7200,7 @@ void tst_TestCore::testRewriterComplexMovingInOut() textEdit.setPlainText(qmlString); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -7211,14 +7213,14 @@ void tst_TestCore::testRewriterComplexMovingInOut() ModelNode rootNode = view->rootModelNode(); QVERIFY(rootNode.isValid()); - QCOMPARE(rootNode.type(), QString("QtQuick/Rectangle")); + QCOMPARE(rootNode.type(), QString("Qt/Rectangle")); ModelNode itemNode = rootNode.nodeListProperty(QLatin1String("data")).toModelNodeList().at(0); - ModelNode newNode = view->createModelNode("QtQuick/MouseArea", 1, 0); + ModelNode newNode = view->createModelNode("Qt/MouseArea", 4, 7); rootNode.nodeListProperty(QLatin1String("data")).reparentHere(newNode); const QLatin1String expected1("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Item {\n" @@ -7238,7 +7240,7 @@ void tst_TestCore::testRewriterComplexMovingInOut() move(newNode, 3, 3); const QLatin1String expected2("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Item {\n" @@ -7254,7 +7256,7 @@ void tst_TestCore::testRewriterComplexMovingInOut() itemNode.nodeListProperty(QLatin1String("data")).reparentHere(newNode); const QLatin1String expected3("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Item {\n" @@ -7274,7 +7276,7 @@ void tst_TestCore::testRewriterComplexMovingInOut() newNode.destroy(); const QLatin1String expected4("\n" - "import QtQuick 1.0\n" + "import Qt 4.7\n" "\n" "Rectangle {\n" " Item {\n" @@ -7286,10 +7288,10 @@ void tst_TestCore::testRewriterComplexMovingInOut() void tst_TestCore::removeCenteredInAnchorByDetaching() { QPlainTextEdit textEdit1; - textEdit1.setPlainText("import QtQuick 1.0; Item { Rectangle { id: child; anchors.centerIn: parent } }"); + textEdit1.setPlainText("import Qt 4.7; Item { Rectangle { id: child; anchors.centerIn: parent } }"); NotIndentingTextEditModifier modifier1(&textEdit1); - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QScopedPointer testRewriterView1(new TestRewriterView()); testRewriterView1->setTextModifier(&modifier1); @@ -7340,7 +7342,7 @@ void tst_TestCore::removeCenteredInAnchorByDetaching() void tst_TestCore::changePropertyBinding() { - QScopedPointer model(Model::create("QtQuick/Item")); + QScopedPointer model(Model::create("Qt/Item")); QVERIFY(model.data()); QScopedPointer view(new TestView(model.data())); @@ -7349,7 +7351,7 @@ void tst_TestCore::changePropertyBinding() ModelNode rootModelNode(view->rootModelNode()); rootModelNode.variantProperty("width") = 20; - ModelNode firstChild = addNodeListChild(rootModelNode, "QtQuick/Rectangle", 1, 0, "data"); + ModelNode firstChild = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data"); firstChild.bindingProperty("width").setExpression(QString("parent.width")); firstChild.variantProperty("height")= 10; QVERIFY(firstChild.isValid()); @@ -7389,7 +7391,7 @@ void tst_TestCore::loadTestFiles() textEdit.setPlainText(QString(file.readAll())); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer testRewriterView(new TestRewriterView()); @@ -7400,7 +7402,7 @@ void tst_TestCore::loadTestFiles() QVERIFY(model.data()); ModelNode rootModelNode(testRewriterView->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QLatin1String("QtQuick/Item")); + QCOMPARE(rootModelNode.type(), QLatin1String("Qt/Item")); QVERIFY(rootModelNode.allDirectSubModelNodes().isEmpty()); } @@ -7412,7 +7414,7 @@ void tst_TestCore::loadTestFiles() textEdit.setPlainText(QString(file.readAll())); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer testRewriterView(new TestRewriterView()); @@ -7423,14 +7425,14 @@ void tst_TestCore::loadTestFiles() QVERIFY(model.data()); ModelNode rootModelNode(testRewriterView->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootModelNode.type(), QLatin1String("Qt/Rectangle")); QCOMPARE(rootModelNode.allDirectSubModelNodes().count(), 1); QCOMPARE(rootModelNode.variantProperty("width").value().toInt(), 200); QCOMPARE(rootModelNode.variantProperty("height").value().toInt(), 200); ModelNode textNode(rootModelNode.allDirectSubModelNodes().first()); QVERIFY(textNode.isValid()); - QCOMPARE(textNode.type(), QLatin1String("QtQuick/Text")); + QCOMPARE(textNode.type(), QLatin1String("Qt/Text")); QCOMPARE(textNode.variantProperty("x").value().toInt(), 66); QCOMPARE(textNode.variantProperty("y").value().toInt(), 93); } @@ -7442,7 +7444,7 @@ void tst_TestCore::loadTestFiles() textEdit.setPlainText(QString(file.readAll())); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer testRewriterView(new TestRewriterView()); @@ -7453,7 +7455,7 @@ void tst_TestCore::loadTestFiles() QVERIFY(model.data()); ModelNode rootModelNode(testRewriterView->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootModelNode.type(), QLatin1String("Qt/Rectangle")); QCOMPARE(rootModelNode.allDirectSubModelNodes().count(), 4); QCOMPARE(rootModelNode.variantProperty("width").value().toInt(), 200); QCOMPARE(rootModelNode.variantProperty("height").value().toInt(), 200); @@ -7464,14 +7466,14 @@ void tst_TestCore::loadTestFiles() ModelNode textNode(rootModelNode.nodeListProperty("data").toModelNodeList().first()); QVERIFY(textNode.isValid()); QCOMPARE(textNode.id(), QLatin1String("text")); - QCOMPARE(textNode.type(), QLatin1String("QtQuick/Text")); + QCOMPARE(textNode.type(), QLatin1String("Qt/Text")); QCOMPARE(textNode.variantProperty("x").value().toInt(), 66); QCOMPARE(textNode.variantProperty("y").value().toInt(), 93); ModelNode imageNode(rootModelNode.nodeListProperty("data").toModelNodeList().last()); QVERIFY(imageNode.isValid()); QCOMPARE(imageNode.id(), QLatin1String("image1")); - QCOMPARE(imageNode.type(), QLatin1String("QtQuick/Image")); + QCOMPARE(imageNode.type(), QLatin1String("Qt/Image")); QCOMPARE(imageNode.variantProperty("x").value().toInt(), 41); QCOMPARE(imageNode.variantProperty("y").value().toInt(), 46); QCOMPARE(imageNode.variantProperty("source").value().toUrl(), QUrl("images/qtcreator.png")); @@ -7491,7 +7493,7 @@ void tst_TestCore::loadTestFiles() textEdit.setPlainText(QString(file.readAll())); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer testRewriterView(new TestRewriterView()); @@ -7503,12 +7505,12 @@ void tst_TestCore::loadTestFiles() QVERIFY(model.data()); ModelNode rootModelNode(testRewriterView->rootModelNode()); QVERIFY(rootModelNode.isValid()); - QCOMPARE(rootModelNode.type(), QLatin1String("QtQuick/Rectangle")); + QCOMPARE(rootModelNode.type(), QLatin1String("Qt/Rectangle")); QVERIFY(!rootModelNode.allDirectSubModelNodes().isEmpty()); } } -static QString rectWithGradient = "import QtQuick 1.0\n" +static QString rectWithGradient = "import Qt 4.7\n" "Rectangle {\n" " gradient: Gradient {\n" " id: pGradient\n" @@ -7528,7 +7530,7 @@ void tst_TestCore::loadGradient() textEdit.setPlainText(rectWithGradient); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer testRewriterView(new TestRewriterView()); @@ -7547,7 +7549,7 @@ void tst_TestCore::loadGradient() QVERIFY(gradientProperty.isNodeProperty()); ModelNode gradientPropertyModelNode = gradientProperty.toNodeProperty().modelNode(); QVERIFY(gradientPropertyModelNode.isValid()); - QCOMPARE(gradientPropertyModelNode.type(), QString("QtQuick/Gradient")); + QCOMPARE(gradientPropertyModelNode.type(), QString("Qt/Gradient")); QCOMPARE(gradientPropertyModelNode.allDirectSubModelNodes().size(), 2); AbstractProperty stopsProperty = gradientPropertyModelNode.property("stops"); @@ -7560,7 +7562,7 @@ void tst_TestCore::loadGradient() ModelNode pOne = stops.first(); ModelNode pTwo = stops.last(); - QCOMPARE(pOne.type(), QString("QtQuick/GradientStop")); + QCOMPARE(pOne.type(), QString("Qt/GradientStop")); QCOMPARE(pOne.id(), QString("pOne")); QCOMPARE(pOne.allDirectSubModelNodes().size(), 0); QCOMPARE(pOne.propertyNames().size(), 2); @@ -7569,7 +7571,7 @@ void tst_TestCore::loadGradient() QCOMPARE(pOne.variantProperty("color").value().type(), QVariant::Color); QCOMPARE(pOne.variantProperty("color").value().value(), QColor("lightsteelblue")); - QCOMPARE(pTwo.type(), QString("QtQuick/GradientStop")); + QCOMPARE(pTwo.type(), QString("Qt/GradientStop")); QCOMPARE(pTwo.id(), QString("pTwo")); QCOMPARE(pTwo.allDirectSubModelNodes().size(), 0); QCOMPARE(pTwo.propertyNames().size(), 2); @@ -7582,8 +7584,8 @@ void tst_TestCore::loadGradient() { ModelNode gradientNode = rootModelNode.allDirectSubModelNodes().last(); QVERIFY(gradientNode.isValid()); - QVERIFY(!gradientNode.metaInfo().isSubclassOf("QtQuick/Item", -1, -1)); - QCOMPARE(gradientNode.type(), QString("QtQuick/Gradient")); + QVERIFY(!gradientNode.metaInfo().isSubclassOf("Qt/Item", -1, -1)); + QCOMPARE(gradientNode.type(), QString("Qt/Gradient")); QCOMPARE(gradientNode.id(), QString("secondGradient")); QCOMPARE(gradientNode.allDirectSubModelNodes().size(), 2); @@ -7597,7 +7599,7 @@ void tst_TestCore::loadGradient() ModelNode nOne = stops.first(); ModelNode nTwo = stops.last(); - QCOMPARE(nOne.type(), QString("QtQuick/GradientStop")); + QCOMPARE(nOne.type(), QString("Qt/GradientStop")); QCOMPARE(nOne.id(), QString("nOne")); QCOMPARE(nOne.allDirectSubModelNodes().size(), 0); QCOMPARE(nOne.propertyNames().size(), 2); @@ -7606,7 +7608,7 @@ void tst_TestCore::loadGradient() QCOMPARE(nOne.variantProperty("color").value().type(), QVariant::Color); QCOMPARE(nOne.variantProperty("color").value().value(), QColor("blue")); - QCOMPARE(nTwo.type(), QString("QtQuick/GradientStop")); + QCOMPARE(nTwo.type(), QString("Qt/GradientStop")); QCOMPARE(nTwo.id(), QString("nTwo")); QCOMPARE(nTwo.allDirectSubModelNodes().size(), 0); QCOMPARE(nTwo.propertyNames().size(), 2); @@ -7624,7 +7626,7 @@ void tst_TestCore::changeGradientId() textEdit.setPlainText(rectWithGradient); NotIndentingTextEditModifier textModifier(&textEdit); - QScopedPointer model(Model::create("QtQuick/Item", 1, 0)); + QScopedPointer model(Model::create("Qt/Item", 4, 7)); QVERIFY(model.data()); QScopedPointer testRewriterView(new TestRewriterView()); @@ -7657,7 +7659,7 @@ void tst_TestCore::changeGradientId() firstStop.destroy(); QVERIFY(!firstStop.isValid()); - ModelNode gradientStop = addNodeListChild(gradientNode, "QtQuick/GradientStop", 1, 0, "stops"); + ModelNode gradientStop = addNodeListChild(gradientNode, "Qt/GradientStop", 4, 7, "stops"); gradientStop.variantProperty("position") = 0.5; gradientStop.variantProperty("color") = QColor("yellow"); diff --git a/tests/auto/qml/qmldesigner/data/fx/attributes.qml b/tests/auto/qml/qmldesigner/data/fx/attributes.qml index d58d77908b5..e2d4ed37c41 100644 --- a/tests/auto/qml/qmldesigner/data/fx/attributes.qml +++ b/tests/auto/qml/qmldesigner/data/fx/attributes.qml @@ -1,4 +1,4 @@ -import QtQuick 1.0 +import Qt 4.7 Item { id: id; diff --git a/tests/auto/qml/qmldesigner/data/fx/empty.qml b/tests/auto/qml/qmldesigner/data/fx/empty.qml index f6760b6a9fa..dd9e9ea1930 100644 --- a/tests/auto/qml/qmldesigner/data/fx/empty.qml +++ b/tests/auto/qml/qmldesigner/data/fx/empty.qml @@ -1,4 +1,4 @@ -import QtQuick 1.0 +import Qt 4.7 Item { } diff --git a/tests/auto/qml/qmldesigner/data/fx/helloworld.qml b/tests/auto/qml/qmldesigner/data/fx/helloworld.qml index d225c436306..bc17ab1b27d 100644 --- a/tests/auto/qml/qmldesigner/data/fx/helloworld.qml +++ b/tests/auto/qml/qmldesigner/data/fx/helloworld.qml @@ -1,4 +1,4 @@ -import QtQuick 1.0 +import Qt 4.7 Rectangle { width: 200 diff --git a/tests/auto/qml/qmldesigner/data/fx/properties.qml b/tests/auto/qml/qmldesigner/data/fx/properties.qml index e9078ff8e76..12b79f63f80 100644 --- a/tests/auto/qml/qmldesigner/data/fx/properties.qml +++ b/tests/auto/qml/qmldesigner/data/fx/properties.qml @@ -1,4 +1,4 @@ -import QtQuick 1.0 +import Qt 4.7 Item { property bool pushed diff --git a/tests/auto/qml/qmldesigner/data/fx/states.qml b/tests/auto/qml/qmldesigner/data/fx/states.qml index 836e0ca0173..2e50ca9b7be 100644 --- a/tests/auto/qml/qmldesigner/data/fx/states.qml +++ b/tests/auto/qml/qmldesigner/data/fx/states.qml @@ -1,4 +1,4 @@ -import QtQuick 1.0 +import Qt 4.7 Rectangle { id: rect diff --git a/tests/auto/qml/qmldesigner/data/fx/topitem.qml b/tests/auto/qml/qmldesigner/data/fx/topitem.qml index 84ef3c829c8..244a7ac6f3e 100644 --- a/tests/auto/qml/qmldesigner/data/fx/topitem.qml +++ b/tests/auto/qml/qmldesigner/data/fx/topitem.qml @@ -1,5 +1,5 @@ -import QtQuick 1.0 -import QtQuick 1.0 as Qt46 +import Qt 4.7 +import Qt 4.7 as Qt46 import "subitems" import "subitems" as Subdir diff --git a/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp b/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp index 9e2bc9ec9e9..bd0c2358555 100644 --- a/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp +++ b/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp @@ -57,6 +57,7 @@ #include #include #include +//#include #include #include #include @@ -454,7 +455,21 @@ QFileInfo testQFileInfo() s = fi.bundleName(); s = fi.bundleName(); s = fi.bundleName(); - return fi; + + QFileInfo result("/tmp/t"); + return result; +} + +void testQFixed() +{ +/* + QFixed f = QFixed::fromReal(4.2); + f += 1; + f += 1; + f *= -1; + f += 1; + f += 1; +*/ } QHash testQHash() @@ -509,7 +524,8 @@ QHash testQHash() hash.insert("Welt", QPointer(&ob)); hash.insert(".", QPointer(&ob)); #endif - return hgg0; + QHash result; + return result; } void testQImage() @@ -1118,7 +1134,8 @@ std::list testStdList() vec.push_back(true); vec.push_back(false); #endif - return big; + std::list result; + return result; } void testStdMap() @@ -1193,7 +1210,8 @@ std::set testStdSet() std::set > hash; QPointer ptr(&ob); #endif - return hgg0; + std::set result; + return result; } std::stack testStdStack() @@ -1219,7 +1237,8 @@ std::stack testStdStack() flist.push(1); flist.push(2); - return flist2; + std::stack result; + return result; } std::string testStdString() @@ -1259,7 +1278,8 @@ std::string testStdString() v.push_back(str); v.push_back(str); - return str; + std::string result = "hi"; + return result; } void testStdVector() @@ -1343,7 +1363,8 @@ QStack testQStack() QStack vec; vec.append(true); vec.append(false); - return big; + QStack result; + return result; } void testQString() @@ -1386,7 +1407,8 @@ QStringList testQStringList() l << " fat "; l.takeFirst(); l << " World "; - return l; + QStringList result; + return result; } Foo testStruct() @@ -1504,7 +1526,8 @@ QVariant testQVariant2() var.setValue(my); var.setValue(my); #endif - return QVariant("sss"); + QVariant result("sss"); + return result; } QVariant testQVariant3() @@ -1522,7 +1545,9 @@ QVariant testQVariant3() QVariant variant = qVariantFromValue(list); list.clear(); list = qVariantValue >(variant); - return QVariant("xxx"); + + QVariant result("xxx"); + return result; } void testQVector() @@ -2019,6 +2044,7 @@ int main(int argc, char *argv[]) testQDateTime(); testQTime(); testQFileInfo(); + testQFixed(); testObject1(); testVector1(); testQHash1(); diff --git a/tests/manual/ssh/errorhandling/errorhandling.pro b/tests/manual/ssh/errorhandling/errorhandling.pro new file mode 100644 index 00000000000..1161d4642da --- /dev/null +++ b/tests/manual/ssh/errorhandling/errorhandling.pro @@ -0,0 +1,4 @@ +include(../ssh.pri) + +TARGET=errorhandling +SOURCES=main.cpp diff --git a/tests/manual/ssh/main.cpp b/tests/manual/ssh/errorhandling/main.cpp similarity index 100% rename from tests/manual/ssh/main.cpp rename to tests/manual/ssh/errorhandling/main.cpp diff --git a/tests/manual/ssh/sftp/argumentscollector.cpp b/tests/manual/ssh/sftp/argumentscollector.cpp new file mode 100644 index 00000000000..4ed54ef320a --- /dev/null +++ b/tests/manual/ssh/sftp/argumentscollector.cpp @@ -0,0 +1,138 @@ +#include "argumentscollector.h" + +#include + +using namespace std; +using namespace Core; + +ArgumentsCollector::ArgumentsCollector(const QStringList &args) + : m_arguments(args) +{ +} + +Parameters ArgumentsCollector::collect(bool &success) const +{ + Parameters parameters; + try { + bool authTypeGiven = false; + bool portGiven = false; + bool timeoutGiven = false; + bool smallFileCountGiven = false; + bool bigFileSizeGiven = false; + bool proxySettingGiven = false; + int pos; + int port; + for (pos = 1; pos < m_arguments.count() - 1; ++pos) { + if (checkAndSetStringArg(pos, parameters.sshParams.host, "-h") + || checkAndSetStringArg(pos, parameters.sshParams.uname, "-u")) + continue; + if (checkAndSetIntArg(pos, port, portGiven, "-p") + || checkAndSetIntArg(pos, parameters.sshParams.timeout, timeoutGiven, "-t") + || checkAndSetIntArg(pos, parameters.smallFileCount, smallFileCountGiven, "-c") + || checkAndSetIntArg(pos, parameters.bigFileSize, bigFileSizeGiven, "-s")) + continue; + if (checkAndSetStringArg(pos, parameters.sshParams.pwd, "-pwd")) { + if (!parameters.sshParams.privateKeyFile.isEmpty()) + throw ArgumentErrorException(QLatin1String("-pwd and -k are mutually exclusive.")); + parameters.sshParams.authType + = SshConnectionParameters::AuthByPwd; + authTypeGiven = true; + continue; + } + if (checkAndSetStringArg(pos, parameters.sshParams.privateKeyFile, "-k")) { + if (!parameters.sshParams.pwd.isEmpty()) + throw ArgumentErrorException(QLatin1String("-pwd and -k are mutually exclusive.")); + parameters.sshParams.authType + = SshConnectionParameters::AuthByKey; + authTypeGiven = true; + continue; + } + if (!checkForNoProxy(pos, parameters.sshParams.proxyType, proxySettingGiven)) + throw ArgumentErrorException(QLatin1String("unknown option ") + m_arguments.at(pos)); + } + + Q_ASSERT(pos <= m_arguments.count()); + if (pos == m_arguments.count() - 1) { + if (!checkForNoProxy(pos, parameters.sshParams.proxyType, proxySettingGiven)) + throw ArgumentErrorException(QLatin1String("unknown option ") + m_arguments.at(pos)); + } + + if (!authTypeGiven) + throw ArgumentErrorException(QLatin1String("No authentication argument given.")); + if (parameters.sshParams.host.isEmpty()) + throw ArgumentErrorException(QLatin1String("No host given.")); + if (parameters.sshParams.uname.isEmpty()) + throw ArgumentErrorException(QLatin1String("No user name given.")); + + parameters.sshParams.port = portGiven ? port : 22; + if (!timeoutGiven) + parameters.sshParams.timeout = 30; + if (!smallFileCountGiven) + parameters.smallFileCount = 1000; + if (!bigFileSizeGiven) + parameters.bigFileSize = 1024; + success = true; + } catch (ArgumentErrorException &ex) { + cerr << "Error: " << qPrintable(ex.error) << endl; + printUsage(); + success = false; + } + return parameters; +} + +void ArgumentsCollector::printUsage() const +{ + cerr << "Usage: " << qPrintable(m_arguments.first()) + << " -h -u " + << "-pwd | -k [ -p ] " + << "[ -t ] [ -c ] " + << "[ -s ] [ -no-proxy ]" << endl; +} + +bool ArgumentsCollector::checkAndSetStringArg(int &pos, QString &arg, const char *opt) const +{ + if (m_arguments.at(pos) == QLatin1String(opt)) { + if (!arg.isEmpty()) { + throw ArgumentErrorException(QLatin1String("option ") + opt + + QLatin1String(" was given twice.")); + } + arg = m_arguments.at(++pos); + if (arg.isEmpty() && QLatin1String(opt) != QLatin1String("-pwd")) + throw ArgumentErrorException(QLatin1String("empty argument not allowed here.")); + return true; + } + return false; +} + +bool ArgumentsCollector::checkAndSetIntArg(int &pos, int &val, + bool &alreadyGiven, const char *opt) const +{ + if (m_arguments.at(pos) == QLatin1String(opt)) { + if (alreadyGiven) { + throw ArgumentErrorException(QLatin1String("option ") + opt + + QLatin1String(" was given twice.")); + } + bool isNumber; + val = m_arguments.at(++pos).toInt(&isNumber); + if (!isNumber) { + throw ArgumentErrorException(QLatin1String("option ") + opt + + QLatin1String(" needs integer argument")); + } + alreadyGiven = true; + return true; + } + return false; +} + +bool ArgumentsCollector::checkForNoProxy(int &pos, + SshConnectionParameters::ProxyType &type, bool &alreadyGiven) const +{ + if (m_arguments.at(pos) == QLatin1String("-no-proxy")) { + if (alreadyGiven) + throw ArgumentErrorException(QLatin1String("proxy setting given twice.")); + type = SshConnectionParameters::NoProxy; + alreadyGiven = true; + return true; + } + return false; +} diff --git a/tests/manual/ssh/sftp/argumentscollector.h b/tests/manual/ssh/sftp/argumentscollector.h new file mode 100644 index 00000000000..9eb776714a3 --- /dev/null +++ b/tests/manual/ssh/sftp/argumentscollector.h @@ -0,0 +1,31 @@ +#ifndef ARGUMENTSCOLLECTOR_H +#define ARGUMENTSCOLLECTOR_H + +#include "parameters.h" + +#include + +class ArgumentsCollector +{ +public: + ArgumentsCollector(const QStringList &args); + Parameters collect(bool &success) const; +private: + struct ArgumentErrorException + { + ArgumentErrorException(const QString &error) : error(error) {} + const QString error; + }; + + void printUsage() const; + bool checkAndSetStringArg(int &pos, QString &arg, const char *opt) const; + bool checkAndSetIntArg(int &pos, int &val, bool &alreadyGiven, + const char *opt) const; + bool checkForNoProxy(int &pos, + Core::SshConnectionParameters::ProxyType &type, + bool &alreadyGiven) const; + + const QStringList m_arguments; +}; + +#endif // ARGUMENTSCOLLECTOR_H diff --git a/tests/manual/ssh/sftp/main.cpp b/tests/manual/ssh/sftp/main.cpp new file mode 100644 index 00000000000..0b182917f1d --- /dev/null +++ b/tests/manual/ssh/sftp/main.cpp @@ -0,0 +1,27 @@ +#include "argumentscollector.h" +#include "sftptest.h" + +#include +#include + +#include +#include +#include + +#include +#include + +using namespace Core; + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + bool parseSuccess; + const Parameters parameters + = ArgumentsCollector(app.arguments()).collect(parseSuccess); + if (!parseSuccess) + return EXIT_FAILURE; + SftpTest sftpTest(parameters); + sftpTest.run(); + return app.exec(); +} diff --git a/tests/manual/ssh/sftp/parameters.h b/tests/manual/ssh/sftp/parameters.h new file mode 100644 index 00000000000..540103525ae --- /dev/null +++ b/tests/manual/ssh/sftp/parameters.h @@ -0,0 +1,14 @@ +#ifndef PARAMETERS_H +#define PARAMETERS_H + +#include + +struct Parameters { + Parameters() : sshParams(Core::SshConnectionParameters::DefaultProxy) {} + + Core::SshConnectionParameters sshParams; + int smallFileCount; + int bigFileSize; +}; + +#endif // PARAMETERS_H diff --git a/tests/manual/ssh/sftp/sftp.pro b/tests/manual/ssh/sftp/sftp.pro new file mode 100644 index 00000000000..eb5b7d8e3b8 --- /dev/null +++ b/tests/manual/ssh/sftp/sftp.pro @@ -0,0 +1,6 @@ +include(../ssh.pri) + +TARGET=sftp +SOURCES=main.cpp sftptest.cpp argumentscollector.cpp +HEADERS=sftptest.h argumentscollector.h parameters.h + diff --git a/tests/manual/ssh/sftp/sftptest.cpp b/tests/manual/ssh/sftp/sftptest.cpp new file mode 100644 index 00000000000..f80e6298294 --- /dev/null +++ b/tests/manual/ssh/sftp/sftptest.cpp @@ -0,0 +1,480 @@ +#include "sftptest.h" + +#include +#include +#include +#include +#include + +#include + +using namespace Core; + +SftpTest::SftpTest(const Parameters ¶ms) + : m_parameters(params), m_state(Inactive), m_error(false), + m_bigFileUploadJob(SftpInvalidJob), + m_bigFileDownloadJob(SftpInvalidJob), + m_bigFileRemovalJob(SftpInvalidJob) +{ +} + +SftpTest::~SftpTest() +{ + removeFiles(true); +} + +void SftpTest::run() +{ + m_connection = SshConnection::create(); + connect(m_connection.data(), SIGNAL(connected()), this, + SLOT(handleConnected())); + connect(m_connection.data(), SIGNAL(error(Core::SshError)), this, + SLOT(handleError())); + connect(m_connection.data(), SIGNAL(disconnected()), this, + SLOT(handleDisconnected())); + std::cout << "Connecting to host '" + << qPrintable(m_parameters.sshParams.host) << "'..." << std::endl; + m_state = Connecting; + m_connection->connectToHost(m_parameters.sshParams); +} + +void SftpTest::handleConnected() +{ + if (m_state != Connecting) { + std::cerr << "Unexpected state " << m_state << " in function " + << Q_FUNC_INFO << "." << std::endl; + earlyDisconnectFromHost(); + } else { + std::cout << "Connected. Initializing SFTP channel..." << std::endl; + m_channel = m_connection->createSftpChannel(); + connect(m_channel.data(), SIGNAL(initialized()), this, + SLOT(handleChannelInitialized())); + connect(m_channel.data(), SIGNAL(initializationFailed(QString)), this, + SLOT(handleChannelInitializationFailure(QString))); + connect(m_channel.data(), SIGNAL(finished(Core::SftpJobId, QString)), + this, SLOT(handleJobFinished(Core::SftpJobId, QString))); + connect(m_channel.data(), SIGNAL(closed()), this, + SLOT(handleChannelClosed())); + m_state = InitializingChannel; + m_channel->initialize(); + } +} + +void SftpTest::handleDisconnected() +{ + if (m_state != Disconnecting) { + std::cerr << "Unexpected state " << m_state << " in function " + << Q_FUNC_INFO << std::endl; + m_error = true; + } else { + std::cout << "Connection closed." << std::endl; + } + std::cout << "Test finished. "; + if (m_error) + std::cout << "There were errors."; + else + std::cout << "No errors encountered."; + std::cout << std::endl; + qApp->quit(); +} + +void SftpTest::handleError() +{ + std::cerr << "Encountered SSH error: " + << qPrintable(m_connection->errorString()) << "." << std::endl; + qApp->quit(); +} + +void SftpTest::handleChannelInitialized() +{ + if (m_state != InitializingChannel) { + std::cerr << "Unexpected state " << m_state << "in function " + << Q_FUNC_INFO << "." << std::endl; + earlyDisconnectFromHost(); + return; + } + + std::cout << "Creating " << m_parameters.smallFileCount + << " files of 1 KB each ..." << std::endl; + qsrand(QDateTime::currentDateTime().toTime_t()); + for (int i = 0; i < m_parameters.smallFileCount; ++i) { + const QString fileName + = QLatin1String("sftptestfile") + QString::number(i + 1); + const FilePtr file(new QFile(QDir::tempPath() + QLatin1Char('/') + + fileName)); + bool success = true; + if (!file->open(QIODevice::WriteOnly | QIODevice::Truncate)) + success = false; + if (success) { + int content[1024/sizeof(int)]; + for (size_t j = 0; j < sizeof content / sizeof content[0]; ++j) + content[j] = qrand(); + file->write(reinterpret_cast(content), sizeof content); + file->close(); + } + success = success && file->error() == QFile::NoError; + if (!success) { + std::cerr << "Error creating local file " + << qPrintable(file->fileName()) << "." << std::endl; + earlyDisconnectFromHost(); + return; + } + m_localSmallFiles << file; + } + std::cout << "Files created. Now uploading..." << std::endl; + foreach (const FilePtr &file, m_localSmallFiles) { + const QString localFilePath = file->fileName(); + const QString remoteFp + = remoteFilePath(QFileInfo(localFilePath).fileName()); + const SftpJobId uploadJob = m_channel->uploadFile(file->fileName(), + remoteFp, SftpOverwriteExisting); + if (uploadJob == SftpInvalidJob) { + std::cerr << "Error uploading local file " + << qPrintable(localFilePath) << " to remote file " + << qPrintable(remoteFp) << "." << std::endl; + earlyDisconnectFromHost(); + return; + } + m_smallFilesUploadJobs.insert(uploadJob, remoteFp); + } + m_state = UploadingSmall; +} + +void SftpTest::handleChannelInitializationFailure(const QString &reason) +{ + std::cerr << "Could not initialize SFTP channel: " << qPrintable(reason) + << "." << std::endl; + earlyDisconnectFromHost(); +} + +void SftpTest::handleChannelClosed() +{ + if (m_state != ChannelClosing) { + std::cerr << "Unexpected state " << m_state << " in function " + << Q_FUNC_INFO << "." << std::endl; + } else { + std::cout << "SFTP channel closed. Now disconnecting..." << std::endl; + } + m_state = Disconnecting; + m_connection->disconnectFromHost(); +} + +void SftpTest::handleJobFinished(Core::SftpJobId job, const QString &error) +{ + switch (m_state) { + case UploadingSmall: + if (!handleJobFinished(job, m_smallFilesUploadJobs, error, "uploading")) + return; + if (m_smallFilesUploadJobs.isEmpty()) { + std::cout << "Uploading finished, now downloading for comparison..." + << std::endl; + foreach (const FilePtr &file, m_localSmallFiles) { + const QString localFilePath = file->fileName(); + const QString remoteFp + = remoteFilePath(QFileInfo(localFilePath).fileName()); + const QString downloadFilePath = cmpFileName(localFilePath); + const SftpJobId downloadJob = m_channel->downloadFile(remoteFp, + downloadFilePath, SftpOverwriteExisting); + if (downloadJob == SftpInvalidJob) { + std::cerr << "Error downloading remote file " + << qPrintable(remoteFp) << " to local file " + << qPrintable(downloadFilePath) << "." << std::endl; + earlyDisconnectFromHost(); + return; + } + m_smallFilesDownloadJobs.insert(downloadJob, remoteFp); + } + m_state = DownloadingSmall; + } + break; + case DownloadingSmall: + if (!handleJobFinished(job, m_smallFilesDownloadJobs, error, "downloading")) + return; + if (m_smallFilesDownloadJobs.isEmpty()) { + std::cout << "Downloading finished, now comparing..." << std::endl; + foreach (const FilePtr &ptr, m_localSmallFiles) { + if (!ptr->open(QIODevice::ReadOnly)) { + std::cerr << "Error opening local file " + << qPrintable(ptr->fileName()) << "." << std::endl; + earlyDisconnectFromHost(); + return; + } + const QString downloadedFilePath = cmpFileName(ptr->fileName()); + QFile downloadedFile(downloadedFilePath); + if (!downloadedFile.open(QIODevice::ReadOnly)) { + std::cerr << "Error opening downloaded file " + << qPrintable(downloadedFilePath) << "." << std::endl; + earlyDisconnectFromHost(); + return; + } + if (!compareFiles(ptr.data(), &downloadedFile)) + return; + } + + std::cout << "Comparisons successful, now removing files..." + << std::endl; + QList remoteFilePaths; + foreach (const FilePtr &ptr, m_localSmallFiles) { + const QString downloadedFilePath = cmpFileName(ptr->fileName()); + remoteFilePaths + << remoteFilePath(QFileInfo(ptr->fileName()).fileName()); + if (!ptr->remove()) { + std::cerr << "Error: Failed to remove local file '" + << qPrintable(ptr->fileName()) << "'." << std::endl; + earlyDisconnectFromHost(); + } + if (!QFile::remove(downloadedFilePath)) { + std::cerr << "Error: Failed to remove downloaded file '" + << qPrintable(downloadedFilePath) << "'." << std::endl; + earlyDisconnectFromHost(); + } + } + m_localSmallFiles.clear(); + foreach (const QString &remoteFp, remoteFilePaths) { + m_smallFilesRemovalJobs.insert(m_channel->removeFile(remoteFp), + remoteFp); + } + m_state = RemovingSmall; + } + break; + case RemovingSmall: + if (!handleJobFinished(job, m_smallFilesRemovalJobs, error, "removing")) + return; + if (m_smallFilesRemovalJobs.isEmpty()) { + std::cout << "Small files successfully removed. " + << "Now creating big file..." << std::endl; + const QLatin1String bigFileName("sftpbigfile"); + m_localBigFile = FilePtr(new QFile(QDir::tempPath() + + QLatin1Char('/') + bigFileName)); + bool success = m_localBigFile->open(QIODevice::WriteOnly); + const int blockSize = 8192; + const int blockCount = m_parameters.bigFileSize*1024*1024/blockSize; + for (int block = 0; block < blockCount; ++block) { + int content[blockSize/sizeof(int)]; + for (size_t j = 0; j < sizeof content / sizeof content[0]; ++j) + content[j] = qrand(); + m_localBigFile->write(reinterpret_cast(content), + sizeof content); + } + m_localBigFile->close(); + success = success && m_localBigFile->error() == QFile::NoError; + if (!success) { + std::cerr << "Error trying to create big file '" + << qPrintable(m_localBigFile->fileName()) << "'." + << std::endl; + earlyDisconnectFromHost(); + return; + } + + std::cout << "Big file created. Now uploading ..." << std::endl; + m_bigJobTimer.start(); + m_bigFileUploadJob + = m_channel->uploadFile(m_localBigFile->fileName(), + remoteFilePath(bigFileName), SftpOverwriteExisting); + if (m_bigFileUploadJob == SftpInvalidJob) { + std::cerr << "Error uploading file '" << bigFileName.latin1() + << "'." << std::endl; + earlyDisconnectFromHost(); + return; + } + m_state = UploadingBig; + } + break; + case UploadingBig: { + if (!handleBigJobFinished(job, m_bigFileUploadJob, error, "uploading")) + return; + const qint64 msecs = m_bigJobTimer.elapsed(); + std::cout << "Successfully uploaded big file. Took " << (msecs/1000) + << " seconds for " << m_parameters.bigFileSize << " MB." + << std::endl; + const QString localFilePath = m_localBigFile->fileName(); + const QString downloadedFilePath = cmpFileName(localFilePath); + const QString remoteFp + = remoteFilePath(QFileInfo(localFilePath).fileName()); + std::cout << "Now downloading big file for comparison..." << std::endl; + m_bigJobTimer.start(); + m_bigFileDownloadJob = m_channel->downloadFile(remoteFp, + downloadedFilePath, SftpOverwriteExisting); + if (m_bigFileDownloadJob == SftpInvalidJob) { + std::cerr << "Error downloading remote file '" + << qPrintable(remoteFp) << "' to local file '" + << qPrintable(downloadedFilePath) << "'." << std::endl; + earlyDisconnectFromHost(); + return; + } + m_state = DownloadingBig; + break; + } + case DownloadingBig: { + if (!handleBigJobFinished(job, m_bigFileDownloadJob, error, "downloading")) + return; + const qint64 msecs = m_bigJobTimer.elapsed(); + std::cout << "Successfully downloaded big file. Took " << (msecs/1000) + << " seconds for " << m_parameters.bigFileSize << " MB." + << std::endl; + std::cout << "Now comparing big files..." << std::endl; + QFile downloadedFile(cmpFileName(m_localBigFile->fileName())); + if (!downloadedFile.open(QIODevice::ReadOnly)) { + std::cerr << "Error opening downloaded file '" + << qPrintable(downloadedFile.fileName()) << "': " + << qPrintable(downloadedFile.errorString()) << "." << std::endl; + earlyDisconnectFromHost(); + return; + } + if (!m_localBigFile->open(QIODevice::ReadOnly)) { + std::cerr << "Error opening big file '" + << qPrintable(m_localBigFile->fileName()) << "': " + << qPrintable(m_localBigFile->errorString()) << "." + << std::endl; + earlyDisconnectFromHost(); + return; + } + if (!compareFiles(m_localBigFile.data(), &downloadedFile)) + return; + std::cout << "Comparison successful. Now removing big files..." + << std::endl; + if (!m_localBigFile->remove()) { + std::cerr << "Error: Could not remove file '" + << qPrintable(m_localBigFile->fileName()) << "'." << std::endl; + earlyDisconnectFromHost(); + return; + } + if (!downloadedFile.remove()) { + std::cerr << "Error: Could not remove file '" + << qPrintable(downloadedFile.fileName()) << "'." << std::endl; + earlyDisconnectFromHost(); + return; + } + const QString remoteFp + = remoteFilePath(QFileInfo(m_localBigFile->fileName()).fileName()); + m_bigFileRemovalJob = m_channel->removeFile(remoteFp); + m_state = RemovingBig; + break; + } + case RemovingBig: { + if (!handleBigJobFinished(job, m_bigFileRemovalJob, error, "removing")) + return; + const QString remoteFp + = remoteFilePath(QFileInfo(m_localBigFile->fileName()).fileName()); + std::cout << "Big files successfully removed. " + << "Now closing the SFTP channel..." << std::endl; + m_state = ChannelClosing; + m_channel->closeChannel(); + break; + } + case Disconnecting: + break; + default: + if (!m_error) { + std::cerr << "Unexpected state " << m_state << " in function " + << Q_FUNC_INFO << "." << std::endl; + earlyDisconnectFromHost(); + } + } +} + +void SftpTest::removeFile(const FilePtr &file, bool remoteToo) +{ + if (!file) + return; + const QString localFilePath = file->fileName(); + file->remove(); + QFile::remove(cmpFileName(localFilePath)); + if (remoteToo && m_channel + && m_channel->state() == SftpChannel::Initialized) + m_channel->removeFile(remoteFilePath(QFileInfo(localFilePath).fileName())); +} + +QString SftpTest::cmpFileName(const QString &fileName) const +{ + return fileName + QLatin1String(".cmp"); +} + +QString SftpTest::remoteFilePath(const QString &localFileName) const +{ + return QLatin1String("/tmp/") + localFileName + QLatin1String(".upload"); +} + +void SftpTest::earlyDisconnectFromHost() +{ + m_error = true; + removeFiles(true); + if (m_channel) + disconnect(m_channel.data(), 0, this, 0); + m_state = Disconnecting; + removeFiles(true); + m_connection->disconnectFromHost(); +} + +void SftpTest::removeFiles(bool remoteToo) +{ + foreach (const FilePtr &file, m_localSmallFiles) + removeFile(file, remoteToo); + removeFile(m_localBigFile, remoteToo); +} + +bool SftpTest::handleJobFinished(SftpJobId job, JobMap &jobMap, + const QString &error, const char *activity) +{ + JobMap::Iterator it = jobMap.find(job); + if (it == jobMap.end()) { + std::cerr << "Error: Unknown job " << job << "finished." + << std::endl; + earlyDisconnectFromHost(); + return false; + } + if (!error.isEmpty()) { + std::cerr << "Error " << activity << " file " << qPrintable(it.value()) + << ": " << qPrintable(error) << "." << std::endl; + earlyDisconnectFromHost(); + return false; + } + jobMap.erase(it); + return true; +} + +bool SftpTest::handleBigJobFinished(SftpJobId job, SftpJobId expectedJob, + const QString &error, const char *activity) +{ + if (job != expectedJob) { + std::cerr << "Error " << activity << " file '" + << qPrintable(m_localBigFile->fileName()) + << "': Expected job id " << expectedJob + << ", got job id " << job << '.' << std::endl; + earlyDisconnectFromHost(); + return false; + } + if (!error.isEmpty()) { + std::cerr << "Error " << activity << " file '" + << qPrintable(m_localBigFile->fileName()) << "': " + << qPrintable(error) << std::endl; + earlyDisconnectFromHost(); + return false; + } + return true; +} + +bool SftpTest::compareFiles(QFile *orig, QFile *copy) +{ + bool success = orig->size() == copy->size(); + qint64 bytesLeft = orig->size(); + orig->seek(0); + while (success && bytesLeft > 0) { + const qint64 bytesToRead = qMin(bytesLeft, Q_INT64_C(1024*1024)); + const QByteArray origBlock = orig->read(bytesToRead); + const QByteArray copyBlock = copy->read(bytesToRead); + if (origBlock.size() != bytesToRead || origBlock != copyBlock) + success = false; + bytesLeft -= bytesToRead; + } + orig->close(); + success = success && orig->error() == QFile::NoError + && copy->error() == QFile::NoError; + if (!success) { + std::cerr << "Error: Original file '" << qPrintable(orig->fileName()) + << "'' differs from downloaded file '" + << qPrintable(copy->fileName()) << "'." << std::endl; + earlyDisconnectFromHost(); + } + return success; +} diff --git a/tests/manual/ssh/sftp/sftptest.h b/tests/manual/ssh/sftp/sftptest.h new file mode 100644 index 00000000000..10d4e5b373d --- /dev/null +++ b/tests/manual/ssh/sftp/sftptest.h @@ -0,0 +1,70 @@ +#ifndef SFTPTEST_H +#define SFTPTEST_H + +#include "parameters.h" + +#include +#include + +#include +#include +#include +#include +#include + +QT_FORWARD_DECLARE_CLASS(QFile); + +class SftpTest : public QObject +{ + Q_OBJECT +public: + SftpTest(const Parameters ¶ms); + ~SftpTest(); + void run(); + +private slots: + void handleConnected(); + void handleError(); + void handleDisconnected(); + void handleChannelInitialized(); + void handleChannelInitializationFailure(const QString &reason); + void handleJobFinished(Core::SftpJobId job, const QString &error); + void handleChannelClosed(); + +private: + typedef QHash JobMap; + typedef QSharedPointer FilePtr; + enum State { Inactive, Connecting, InitializingChannel, UploadingSmall, + DownloadingSmall, RemovingSmall, UploadingBig, DownloadingBig, + RemovingBig, ChannelClosing, Disconnecting + }; + + void removeFile(const FilePtr &filePtr, bool remoteToo); + void removeFiles(bool remoteToo); + QString cmpFileName(const QString &localFileName) const; + QString remoteFilePath(const QString &localFileName) const; + void earlyDisconnectFromHost(); + bool handleJobFinished(Core::SftpJobId job, JobMap &jobMap, + const QString &error, const char *activity); + bool handleBigJobFinished(Core::SftpJobId job, Core::SftpJobId expectedJob, + const QString &error, const char *activity); + bool compareFiles(QFile *orig, QFile *copy); + + const Parameters m_parameters; + State m_state; + bool m_error; + Core::SshConnection::Ptr m_connection; + Core::SftpChannel::Ptr m_channel; + QList m_localSmallFiles; + JobMap m_smallFilesUploadJobs; + JobMap m_smallFilesDownloadJobs; + JobMap m_smallFilesRemovalJobs; + FilePtr m_localBigFile; + Core::SftpJobId m_bigFileUploadJob; + Core::SftpJobId m_bigFileDownloadJob; + Core::SftpJobId m_bigFileRemovalJob; + QElapsedTimer m_bigJobTimer; +}; + + +#endif // SFTPTEST_H diff --git a/tests/manual/ssh/ssh.pri b/tests/manual/ssh/ssh.pri new file mode 100644 index 00000000000..cdbe6778b47 --- /dev/null +++ b/tests/manual/ssh/ssh.pri @@ -0,0 +1,14 @@ +INCLUDEPATH += ../../../../src/plugins +CREATORLIBPATH = ../../../../lib/qtcreator +PLUGINPATH=$$CREATORLIBPATH/plugins/Nokia +LIBS *= -L$$PLUGINPATH -lCore +LIBS *= -L$$CREATORLIBPATH +include (../../../qtcreator.pri) +include (../../../src/plugins/coreplugin/coreplugin_dependencies.pri) +QT += core +QT -= gui +CONFIG += console +CONFIG -= app_bundle +TEMPLATE = app +DEPENDPATH+=. +INCLUDEPATH+=. \ No newline at end of file diff --git a/tests/manual/ssh/ssh.pro b/tests/manual/ssh/ssh.pro index 772ff2a39cb..432f8f192b5 100644 --- a/tests/manual/ssh/ssh.pro +++ b/tests/manual/ssh/ssh.pro @@ -4,23 +4,5 @@ # #------------------------------------------------- -INCLUDEPATH += ../../../src/plugins -CREATORLIBPATH = ../../../lib/qtcreator -PLUGINPATH=$$CREATORLIBPATH/plugins/Nokia -LIBS *= -L$$PLUGINPATH -lCore -LIBS *= -L$$CREATORLIBPATH -include (../../../qtcreator.pri) -include (../../../src/plugins/coreplugin/coreplugin_dependencies.pri) - -QT += core - -QT -= gui - -TARGET = ssh -CONFIG += console -CONFIG -= app_bundle - -TEMPLATE = app - - -SOURCES += main.cpp +TEMPLATE = subdirs +SUBDIRS = errorhandling sftp