diff options
39 files changed, 267 insertions, 112 deletions
diff --git a/dist/installer/mac/qmlpuppet_qt.conf b/dist/installer/mac/qmlpuppet_qt.conf index 9298042e36..034fabe6f8 100644 --- a/dist/installer/mac/qmlpuppet_qt.conf +++ b/dist/installer/mac/qmlpuppet_qt.conf @@ -1,3 +1,4 @@ [Paths] -Imports = ../.. +Imports = ../../../Imports/qtquick1 +Qml2Imports = ../../../Imports/qtquick2 Plugins = ../../../PlugIns diff --git a/qtcreator.pro b/qtcreator.pro index 091b693799..9629d1e184 100644 --- a/qtcreator.pro +++ b/qtcreator.pro @@ -52,7 +52,7 @@ macx { APPBUNDLE = "$$OUT_PWD/bin/Qt Creator.app" BINDIST_SOURCE = "$$OUT_PWD/bin/Qt Creator.app" BINDIST_INSTALLER_SOURCE = $$BINDIST_SOURCE - deployqt.commands = $$PWD/scripts/deployqtHelper_mac.sh \"$${APPBUNDLE}\" \"$$[QT_INSTALL_TRANSLATIONS]\" \"$$[QT_INSTALL_PLUGINS]\" + deployqt.commands = $$PWD/scripts/deployqtHelper_mac.sh \"$${APPBUNDLE}\" \"$$[QT_INSTALL_TRANSLATIONS]\" \"$$[QT_INSTALL_PLUGINS]\" \"$$[QT_INSTALL_IMPORTS]\" \"$$[QT_INSTALL_QML]\" codesign.commands = codesign -s \"$(SIGNING_IDENTITY)\" $(SIGNING_FLAGS) \"$${APPBUNDLE}\" dmg.commands = $$PWD/scripts/makedmg.sh $$OUT_PWD/bin qt-creator-$${PATTERN}.dmg dmg.depends = deployqt diff --git a/scripts/deployqtHelper_mac.sh b/scripts/deployqtHelper_mac.sh index 53836b7046..bcb4b36fea 100755 --- a/scripts/deployqtHelper_mac.sh +++ b/scripts/deployqtHelper_mac.sh @@ -1,5 +1,5 @@ #!/bin/bash -[ $# -lt 3 ] && echo "Usage: $(basename $0) <app folder> <qt translations folder> <qt plugin folder>" && exit 2 +[ $# -lt 5 ] && echo "Usage: $(basename $0) <app folder> <qt translations folder> <qt plugin folder> <qt quick imports folder> <qt quick 2 imports folder>" && exit 2 [ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2; # collect designer plugins @@ -7,14 +7,34 @@ designerDestDir="$1/Contents/PlugIns/designer" test -d "$designerDestDir" || mkdir -p "$designerDestDir" for plugin in "$3"/designer/*.dylib; do cp "$plugin" "$designerDestDir"/ || exit 1 - pluginbase=`basename "$plugin"` - designerPluginArguments+="\"-executable=$designerDestDir/$pluginbase\" " done +# copy Qt Quick 1 imports +importsDir="$1/Contents/Imports/qtquick1" +if [ -d "$4" ]; then + test -d "$importsDir" || mkdir -p "$importsDir" + cp -R "$4"/ "$importsDir"/ +fi + +# copy Qt Quick 2 imports +imports2Dir="$1/Contents/Imports/qtquick2" +if [ -d "$5" ]; then + test -d "$imports2Dir" || mkdir -p "$imports2Dir" + cp -R "$5"/ "$imports2Dir"/ +fi + +qml2puppetapp="$1/Contents/MacOS/qml2puppet.app" +if [ -d "$qml2puppetapp" ]; then + qml2puppetArgument="-executable=$qml2puppetapp/Contents/MacOS/qml2puppet" + qml2puppetResources="$1/Contents/MacOS/qml2puppet.app/Contents/Resources" + test -d "$qml2puppetResources" || mkdir -p "$qml2puppetResources" + cp "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qmlpuppet_qt.conf" "$qml2puppetResources/qt.conf" || exit 1 +fi + macdeployqt "$1" \ "-executable=$1/Contents/MacOS/qmlpuppet.app/Contents/MacOS/qmlpuppet" \ "-executable=$1/Contents/Resources/qtpromaker" \ - "-executable=$1/Contents/Resources/sdktool" $designerPluginArguments || exit 1 + "-executable=$1/Contents/Resources/sdktool" "$qml2puppetArgument" || exit 1 qmlpuppetResources="$1/Contents/MacOS/qmlpuppet.app/Contents/Resources" test -d "$qmlpuppetResources" || mkdir -p "$qmlpuppetResources" diff --git a/share/qtcreator/qml/qmldump/main.cpp b/share/qtcreator/qml/qmldump/main.cpp index 41a4ccb468..c4317ffd59 100644 --- a/share/qtcreator/qml/qmldump/main.cpp +++ b/share/qtcreator/qml/qmldump/main.cpp @@ -464,7 +464,7 @@ void sigSegvHandler(int) { void printUsage(const QString &appName) { qWarning() << qPrintable(QString( - "Usage: %1 [-v] [-notrelocatable] module.uri version [module/import/path]\n" + "Usage: %1 [-v] [-[non]relocatable] module.uri version [module/import/path]\n" " %1 [-v] -path path/to/qmldir/directory [version]\n" " %1 [-v] -builtins\n" "Example: %1 Qt.labs.particles 4.7 /home/user/dev/qt-install/imports").arg( @@ -511,8 +511,13 @@ int main(int argc, char *argv[]) } if (arg == QLatin1String("--notrelocatable") - || arg == QLatin1String("-notrelocatable")) { + || arg == QLatin1String("-notrelocatable") + || arg == QLatin1String("--nonrelocatable") + || arg == QLatin1String("-nonrelocatable")) { relocatable = false; + } else if (arg == QLatin1String("--relocatable") + || arg == QLatin1String("-relocatable")) { + relocatable = true; } else if (arg == QLatin1String("--path") || arg == QLatin1String("-path")) { action = Path; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/graphicalnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/graphicalnodeinstance.cpp index 7f5dc9301d..78431c7513 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/graphicalnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/graphicalnodeinstance.cpp @@ -137,9 +137,9 @@ QImage GraphicalNodeInstance::renderImage() const { updateDirtyNodeRecursive(quickItem()); - QRectF boundingRect = boundingRectWithStepChilds(quickItem()); + QRectF renderBoundingRect = boundingRect(); - QImage renderImage = designerSupport()->renderImageForItem(quickItem(), boundingRect, boundingRect.size().toSize()); + QImage renderImage = designerSupport()->renderImageForItem(quickItem(), renderBoundingRect, renderBoundingRect.size().toSize()); renderImage = renderImage.convertToFormat(QImage::Format_ARGB32_Premultiplied); @@ -238,13 +238,13 @@ static inline bool isRectangleSane(const QRectF &rect) return rect.isValid() && (rect.width() < 10000) && (rect.height() < 10000); } -QRectF GraphicalNodeInstance::boundingRectWithStepChilds(QQuickItem *parentItem) const +QRectF GraphicalNodeInstance::boundingRectWithStepChilds(QQuickItem *item) const { - QRectF boundingRect = parentItem->boundingRect(); + QRectF boundingRect = item->boundingRect(); - foreach (QQuickItem *childItem, parentItem->childItems()) { + foreach (QQuickItem *childItem, item->childItems()) { if (!nodeInstanceServer()->hasInstanceForObject(childItem)) { - QRectF transformedRect = childItem->mapRectToItem(parentItem, boundingRectWithStepChilds(childItem)); + QRectF transformedRect = childItem->mapRectToItem(item, boundingRectWithStepChilds(childItem)); if (isRectangleSane(transformedRect)) boundingRect = boundingRect.united(transformedRect); } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index b89231bfbf..756e73493a 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -42,7 +42,7 @@ #include <QFileSystemWatcher> #include <QPixmapCache> #include <QQuickItem> - +#include <QQmlParserStatus> #include <QTextDocument> #include <QLibraryInfo> @@ -1250,7 +1250,9 @@ bool ObjectNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &/ void ObjectNodeInstance::doComponentComplete() { - + QQmlParserStatus *qmlParserStatus = dynamic_cast< QQmlParserStatus*>(object()); + if (qmlParserStatus) + qmlParserStatus->componentComplete(); } bool ObjectNodeInstance::isRootNodeInstance() const diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 0d22f11372..af240f47bf 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -85,6 +85,26 @@ void Qt5InformationNodeInstanceServer::token(const TokenCommand &command) startRenderTimer(); } +bool Qt5InformationNodeInstanceServer::isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const +{ + static DesignerSupport::DirtyType informationsDirty = DesignerSupport::DirtyType(DesignerSupport::TransformUpdateMask + | DesignerSupport::ContentUpdateMask + | DesignerSupport::Visible + | DesignerSupport::ZValue + | DesignerSupport::OpacityValue); + + if (DesignerSupport::isDirty(item, informationsDirty)) + return true; + + foreach (QQuickItem *childItem, item->childItems()) { + if (!hasInstanceForObject(childItem) && DesignerSupport::isDirty(childItem, informationsDirty)) + return true; + } + + return false; + +} + void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands() { static bool inFunction = false; @@ -95,19 +115,13 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands() QSet<ServerNodeInstance> informationChangedInstanceSet; QVector<InstancePropertyPair> propertyChangedList; - bool adjustSceneRect = false; if (quickView()) { foreach (QQuickItem *item, allItems()) { if (item && hasInstanceForObject(item)) { ServerNodeInstance instance = instanceForObject(item); - DesignerSupport::DirtyType informationsDirty = DesignerSupport::DirtyType(DesignerSupport::TransformUpdateMask - | DesignerSupport::ContentUpdateMask - | DesignerSupport::Visible - | DesignerSupport::ZValue - | DesignerSupport::OpacityValue); - if (DesignerSupport::isDirty(item, informationsDirty)) + if (isDirtyRecursiveForNonInstanceItems(item)) informationChangedInstanceSet.insert(instance); @@ -115,11 +129,6 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands() m_parentChangedSet.insert(instance); informationChangedInstanceSet.insert(instance); } -// if (d->geometryChanged) { -// if (instance.isRootNodeInstance()) -// declarativeView()->scene()->setSceneRect(item->boundingRect()); -// } - } } @@ -128,9 +137,6 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands() const QString propertyName = property.second; if (instance.isValid()) { - if (instance.isRootNodeInstance() && (propertyName == "width" || propertyName == "height")) - adjustSceneRect = true; - if (propertyName.contains("anchors")) informationChangedInstanceSet.insert(instance); @@ -154,13 +160,6 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands() m_parentChangedSet.clear(); } -// if (adjustSceneRect) { -// QRectF boundingRect = rootNodeInstance().boundingRect(); -// if (boundingRect.isValid()) { -// declarativeView()->setSceneRect(boundingRect); -// } -// } - if (!m_completedComponentList.isEmpty()) { nodeInstanceClient()->componentCompleted(createComponentCompletedCommand(m_completedComponentList)); m_completedComponentList.clear(); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h index ee6d32e00b..21342ec88b 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h @@ -52,7 +52,7 @@ protected: void collectItemChangesAndSendChangeCommands() Q_DECL_OVERRIDE; void sendChildrenChangedCommand(const QList<ServerNodeInstance> childList); void sendTokenBack(); - + bool isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const; private: QSet<ServerNodeInstance> m_parentChangedSet; diff --git a/share/qtcreator/templates/qtquick2app/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/share/qtcreator/templates/qtquick2app/qtquick2applicationviewer/qtquick2applicationviewer.cpp index 6d7232e260..7f5e1e40d7 100644 --- a/share/qtcreator/templates/qtquick2app/qtquick2applicationviewer/qtquick2applicationviewer.cpp +++ b/share/qtcreator/templates/qtquick2app/qtquick2applicationviewer/qtquick2applicationviewer.cpp @@ -26,7 +26,7 @@ QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) if (!QDir::isAbsolutePath(path)) return QString::fromLatin1("%1/../Resources/%2") .arg(QCoreApplication::applicationDirPath(), path); -#elif defined(Q_OS_QNX) +#elif defined(Q_OS_BLACKBERRY) if (!QDir::isAbsolutePath(path)) return QString::fromLatin1("app/native/%1").arg(path); #elif !defined(Q_OS_ANDROID) diff --git a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp index b15211c254..a052b1d882 100644 --- a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -60,7 +60,7 @@ QString QmlApplicationViewerPrivate::adjustPath(const QString &path) if (!QDir::isAbsolutePath(path)) return QString::fromLatin1("%1/../Resources/%2") .arg(QCoreApplication::applicationDirPath(), path); -#elif defined(Q_OS_QNX) +#elif defined(Q_OS_BLACKBERRY) if (!QDir::isAbsolutePath(path)) return QString::fromLatin1("app/native/%1").arg(path); #elif !defined(Q_OS_ANDROID) diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 83040283d8..91aa73efb9 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1001,6 +1001,8 @@ bool Preprocessor::handleIdentifier(PPToken *tk) bool hasMatchingArgs = false; if (hasArgs) { const int expectedArgCount = macro->formals().size(); + if (macro->isVariadic() && allArgTks.size() == expectedArgCount - 1) + allArgTks.push_back(QVector<PPToken>()); const int actualArgCount = allArgTks.size(); if (expectedArgCount == actualArgCount || (macro->isVariadic() && actualArgCount > expectedArgCount - 1) diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index d5d41e340c..b708c3ca41 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -57,12 +57,12 @@ public: { public: ProjectInfo() - : tryQmlDump(false) + : tryQmlDump(false), qmlDumpHasRelocatableFlag(true) { } ProjectInfo(QPointer<ProjectExplorer::Project> project) : project(project) - , tryQmlDump(false) + , tryQmlDump(false), qmlDumpHasRelocatableFlag(true) { } operator bool() const @@ -83,6 +83,7 @@ public: // whether trying to run qmldump makes sense bool tryQmlDump; + bool qmlDumpHasRelocatableFlag; QString qmlDumpPath; ::Utils::Environment qmlDumpEnvironment; diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index 1faa6b58ba..1b4d3e3fd6 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -180,7 +180,7 @@ void GitEditor::setPlainTextDataFiltered(const QByteArray &a) } case VcsBase::DiffOutput: { const QFileInfo fi(source()); - const QString workingDirectory = fi.absolutePath(); + const QString workingDirectory = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath(); QByteArray precedes, follows; if (array.startsWith("commit ")) { // show int lastHeaderLine = array.indexOf("\n\n") + 1; diff --git a/src/plugins/qmldesigner/components/formeditor/abstractcustomtool.cpp b/src/plugins/qmldesigner/components/formeditor/abstractcustomtool.cpp index d333ef21af..b5d6f390b3 100644 --- a/src/plugins/qmldesigner/components/formeditor/abstractcustomtool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/abstractcustomtool.cpp @@ -9,7 +9,7 @@ AbstractCustomTool::AbstractCustomTool() { } -void AbstractCustomTool::selectedItemsChanged(const QList<FormEditorItem *> &) +void AbstractCustomTool::selectedItemsChanged(const QList<FormEditorItem *> & /*itemList*/) { view()->changeToSelectionTool(); } diff --git a/src/plugins/qmldesigner/componentsplugin/components.metainfo b/src/plugins/qmldesigner/componentsplugin/components.metainfo index 6337597aa7..3c32d94766 100644 --- a/src/plugins/qmldesigner/componentsplugin/components.metainfo +++ b/src/plugins/qmldesigner/componentsplugin/components.metainfo @@ -80,6 +80,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/buttonrow.png" version: "1.0" + requiredImport: "QtQuick.Controls" } } @@ -92,6 +93,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/buttoncolumn.png" version: "1.0" + requiredImport: "QtQuick.Controls" } } @@ -104,6 +106,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/label.png" version: "1.0" + requiredImport: "QtQuick.Controls" Property { name: "text"; type: "QString"; value: "Label"; } } @@ -118,6 +121,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/textfield.png" version: "1.0" + requiredImport: "QtQuick.Controls" Property { name: "placeholderText"; type: "QString"; value: "Text Field"; } } @@ -132,6 +136,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/textarea.png" version: "1.0" + requiredImport: "QtQuick.Controls" } } @@ -144,6 +149,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/progressbar.png" version: "1.0" + requiredImport: "QtQuick.Controls" } } @@ -156,6 +162,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/sliderh.png" version: "1.0" + requiredImport: "QtQuick.Controls" } ItemLibraryEntry { @@ -163,6 +170,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/sliderh.png" version: "1.0" + requiredImport: "QtQuick.Controls" Property { name: "orientation"; type: "int"; value: "0"; } } } @@ -176,6 +184,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/scrollbarh.png" version: "1.0" + requiredImport: "QtQuick.Controls" } ItemLibraryEntry { @@ -183,6 +192,7 @@ MetaInfo { category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/scrollbarv.png" version: "1.0" + requiredImport: "QtQuick.Controls" Property { name: "orientation"; type: "int"; value: "0"; } } } diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp index 9360f4fdfc..473500224b 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp @@ -75,6 +75,8 @@ static inline QStringList importPaths() { .split(Utils::HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); } + paths.append(QmlJS::ModelManagerInterface::instance()->importPaths()); + return paths; } diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 7f4e72962c..5893c972d7 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -124,9 +124,11 @@ ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject( toolChain, preferDebugDump, &projectInfo.qmlDumpPath, &projectInfo.qmlDumpEnvironment); + projectInfo.qmlDumpHasRelocatableFlag = qtVersion->hasQmlDumpWithRelocatableFlag(); } else { projectInfo.qmlDumpPath.clear(); projectInfo.qmlDumpEnvironment.clear(); + projectInfo.qmlDumpHasRelocatableFlag = true; } setupProjectInfoQmlBundles(projectInfo); return projectInfo; diff --git a/src/plugins/qmljstools/qmljsplugindumper.cpp b/src/plugins/qmljstools/qmljsplugindumper.cpp index 0f7efa793e..cfb47d9001 100644 --- a/src/plugins/qmljstools/qmljsplugindumper.cpp +++ b/src/plugins/qmljstools/qmljsplugindumper.cpp @@ -473,6 +473,8 @@ void PluginDumper::dump(const Plugin &plugin) if (ComponentVersion(plugin.importVersion).isValid()) args << plugin.importVersion; } else { + if (info.qmlDumpHasRelocatableFlag) + args << QLatin1String("-relocatable"); args << plugin.importUri; args << plugin.importVersion; args << plugin.importPath; diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index d29e7a0aac..a034e56a7a 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -647,7 +647,6 @@ void Qt4Project::updateQmlJSCodeModel() hasQmlLib = qtLibs.contains(QLatin1String("declarative")) || qtLibs.contains(QLatin1String("qml")) || qtLibs.contains(QLatin1String("quick")); - break; } } diff --git a/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp b/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp index f5bcb49c94..c3a2f32ae0 100644 --- a/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp @@ -225,7 +225,7 @@ QByteArray QtQuickApp::generateFileExtended(int fileType, int QtQuickApp::stubVersionMinor() const { - return m_componentSet == QtQuick20Components ? 4 : 23; + return m_componentSet == QtQuick20Components ? 5 : 24; } QList<AbstractGeneratedFileInfo> QtQuickApp::updateableFiles(const QString &mainProFile) const diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 4f7c9d5b28..093123caa8 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1067,6 +1067,13 @@ bool BaseQtVersion::hasQmlDump() const return m_hasQmlDump; } +bool BaseQtVersion::hasQmlDumpWithRelocatableFlag() const +{ + updateVersionInfo(); + return ((qtVersion() > QtVersionNumber(4, 8, 4) && qtVersion() < QtVersionNumber(5, 0, 0)) + || qtVersion() >= QtVersionNumber(5, 1, 0)); +} + bool BaseQtVersion::needsQmlDump() const { updateVersionInfo(); diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index c95b308f98..4bb8439eb9 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -193,6 +193,7 @@ public: virtual bool hasGdbDebuggingHelper() const; virtual bool hasQmlDump() const; + virtual bool hasQmlDumpWithRelocatableFlag() const; virtual bool needsQmlDump() const; virtual bool hasQmlDebuggingLibrary() const; virtual bool needsQmlDebuggingLibrary() const; diff --git a/src/plugins/qtsupport/qmldumptool.cpp b/src/plugins/qtsupport/qmldumptool.cpp index a9b50ed7cb..78db436fde 100644 --- a/src/plugins/qtsupport/qmldumptool.cpp +++ b/src/plugins/qtsupport/qmldumptool.cpp @@ -134,6 +134,7 @@ private slots: if (projectInfo.qmlDumpPath.isEmpty()) projectInfo.qmlDumpPath = version->qmlDumpTool(!update.preferDebug); projectInfo.qmlDumpEnvironment = version->qmlToolsEnvironment(); + projectInfo.qmlDumpHasRelocatableFlag = version->hasQmlDumpWithRelocatableFlag(); modelManager->updateProjectInfo(projectInfo); } diff --git a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp index f920da1125..92560c4e44 100644 --- a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp +++ b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp @@ -318,6 +318,7 @@ private: private slots: void va_args(); void named_va_args(); + void extra_va_args(); void defined(); void defined_data(); void empty_macro_args(); @@ -414,6 +415,23 @@ void tst_Preprocessor::named_va_args() QCOMPARE(simplified(preprocessed), QString("int f();int f(int a);int f(int a,int b);")); } +void tst_Preprocessor::extra_va_args() +{ + Client *client = 0; // no client. + Environment env; + + Preprocessor preprocess(client, &env); + QByteArray preprocessed = preprocess.run(QLatin1String("<stdin>"), + "#define foo(ret, ...) ret f(__VA_ARGS__);\n" + "\nfoo(int)\n" + "\nfoo(float,int b)\n" + "\nfoo(long,int b,int c)\n", + true, false); + + preprocessed = preprocessed.simplified(); + QCOMPARE(simplified(preprocessed), QString("int f();float f(int b);long f(int b,int c);")); +} + void tst_Preprocessor::empty_macro_args() { Client *client = 0; // no client. diff --git a/tests/system/objects.map b/tests/system/objects.map index fb324704be..b39ba183f6 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -8,6 +8,7 @@ :*Qt Creator.Interrupt_Core::Internal::FancyToolButton {text='Interrupt' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.JavaScript_QDockWidget {name='QmlProfilerV8ProfileViewDockWidget' type='QDockWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='JavaScript'} :*Qt Creator.JavaScript_QTabBar {aboveWidget=':*Qt Creator.JavaScript_QDockWidget' type='QTabBar' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:*Qt Creator.Run_Core::Internal::FancyToolButton {text='Run' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Start Debugging_Core::Internal::FancyToolButton {text='Start Debugging' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.findEdit_Utils::FilterLineEdit {name='findEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator_Core::Internal::FancyToolButton {occurrence='3' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} @@ -91,6 +92,7 @@ :Qt Creator.Go to Help Mode_QToolButton {text='Go to Help Mode' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Help_Search for:_QLineEdit {leftWidget=':Qt Creator.Search for:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'} +:Qt Creator.Project.Menu.File_QMenu {name='Project.Menu.File' type='QMenu' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Project.Menu.Project_QMenu {name='Project.Menu.Project' type='QMenu' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.ReRun_QToolButton {toolTip='Re-run this run-configuration' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} @@ -122,6 +124,7 @@ :Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton {occurrence='2' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_SystemSettings.Details_Utils::DetailsButton {occurrence='4' text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit {container=':Qt Creator_Utils::NavigationTreeView' type='QExpandingLineEdit' unnamed='1' visible='1'} :Qt Gui Application.Form file:_QLabel {name='formLabel' text='Form file:' type='QLabel' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.Header file:_QLabel {name='headerLabel' text='Header file:' type='QLabel' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.Source file:_QLabel {name='sourceLabel' text='Source file:' type='QLabel' visible='1' window=':Qt Gui Application_Qt4ProjectManager::Internal::GuiAppWizardDialog'} diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index 294093314f..ac698353dd 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -64,7 +64,7 @@ def widgetContainsPoint(widget, point): def openContextMenuOnTextCursorPosition(editor): rect = editor.cursorRect(editor.textCursor()) if platform.system() == 'Darwin': - JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, editor) + JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, editor) openContextMenu(editor, rect.x+rect.width/2, rect.y+rect.height/2, 0) menuInList = [None] waitFor("menuVisibleAtEditor(editor, menuInList)", 5000) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index f47920ec1e..832a468792 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -304,7 +304,7 @@ def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None overrideInstallLazySignalHandler() installLazySignalHandler("{type='ProjectExplorer::ApplicationLauncher'}", "processStarted()", "__handleProcessStarted__") installLazySignalHandler("{type='ProjectExplorer::ApplicationLauncher'}", "processExited(int)", "__handleProcessExited__") - runButton = waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}") + runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton") clickButton(runButton) if sType != SubprocessType.QT_QUICK_UI: waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000) @@ -388,8 +388,7 @@ def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefT switchViewTo(ViewConstants.EDIT) global processStarted processStarted = False - runButton = waitForObject("{type='Core::Internal::FancyToolButton' text='Run' " - "visible='1'}") + runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton") clickButton(runButton) if not waitFor("processStarted == True", 10000): test.fatal("Something seems to be really wrong.", "Application output:" diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 3af2ffd5ae..4bb0e36ef8 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -612,3 +612,9 @@ def checkIfObjectExists(name, shouldExist = True, timeout = 3000, verboseOnFail def progressBarWait(): checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", True, 2000) checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", False, 60000) + +def readFile(filename): + f = open(filename, "r") + content = f.read() + f.close() + return content diff --git a/tests/system/shared/workarounds.py b/tests/system/shared/workarounds.py index f0ce4c348c..2726b38112 100644 --- a/tests/system/shared/workarounds.py +++ b/tests/system/shared/workarounds.py @@ -22,7 +22,7 @@ class JIRA: else: JIRA.__instance__._bugType = bugType JIRA.__instance__._number = number - JIRA.__instance__.__fetchStatusAndResolutionFromJira__() + JIRA.__instance__.__fetchResolutionFromJira__() # overriden to make it possible to use JIRA just like the # underlying implementation (__impl) @@ -48,22 +48,14 @@ class JIRA: tmpJIRA = JIRA(number, bugType) return tmpJIRA.isOpen() - # function similar to performWorkaroundForBug - but it will execute the - # workaround (function) only if the bug is still open - # returns True if the workaround function has been executed, False otherwise - @staticmethod - def performWorkaroundIfStillOpen(number, bugType=Bug.CREATOR, *args): - if JIRA.isBugStillOpen(number, bugType): - return JIRA.performWorkaroundForBug(number, bugType, *args) - else: - test.warning("Bug is closed... skipping workaround!", - "You should remove potential code inside performWorkaroundForBug()") - return False - # function that performs the workaround (function) for the given bug # if the function needs additional arguments pass them as 3rd parameter @staticmethod def performWorkaroundForBug(number, bugType=Bug.CREATOR, *args): + if not JIRA.isBugStillOpen(number, bugType): + test.warning("Bug %s-%d is closed for version %s." % + (bugType, number, JIRA(number, bugType)._fix), + "You should probably remove potential code inside workarounds.py") functionToCall = JIRA.getInstance().__bugs__.get("%s-%d" % (bugType, number), None) if functionToCall: test.warning("Using workaround for %s-%d" % (bugType, number)) @@ -82,7 +74,7 @@ class JIRA: self._localOnly = os.getenv("SYSTEST_JIRA_NO_LOOKUP")=="1" self.__initBugDict__() self._fetchResults_ = {} - self.__fetchStatusAndResolutionFromJira__() + self.__fetchResolutionFromJira__() # this function checks the resolution of the given bug # and returns True if the bug can still be assumed as 'Open' and False otherwise @@ -96,16 +88,16 @@ class JIRA: return True return self._resolution != 'Done' - # this function tries to fetch the status and resolution from JIRA for the given bug + # this function tries to fetch the resolution from JIRA for the given bug # if this isn't possible or the lookup is disabled it does only check the internal # dict whether a function for the given bug is deposited or not - def __fetchStatusAndResolutionFromJira__(self): + def __fetchResolutionFromJira__(self): global JIRA_URL bug = "%s-%d" % (self._bugType, self._number) if bug in self._fetchResults_: result = self._fetchResults_[bug] self._resolution = result[0] - self._status = result[1] + self._fix = result[1] return data = None proxy = os.getenv("SYSTEST_PROXY", None) @@ -129,7 +121,6 @@ class JIRA: if bug in self.__bugs__: test.warning("Using internal dict - bug status could have changed already", "Please check manually!") - self._status = None self._resolution = None else: test.fatal("No workaround function deposited for %s" % bug) @@ -137,24 +128,25 @@ class JIRA: else: data = data.replace("\r", "").replace("\n", "") resPattern = re.compile('<span\s+id="resolution-val".*?>(?P<resolution>.*?)</span>') - statPattern = re.compile('<span\s+id="status-val".*?>(.*?<img.*?>)?(?P<status>.*?)</span>') - status = statPattern.search(data) resolution = resPattern.search(data) - if status: - self._status = status.group("status").strip() - else: - test.fatal("FATAL: Cannot get status of bugreport %s" % bug, - "Looks like JIRA has changed.... Please verify!") - self._status = None + fixVersion = 'None' + fixPattern = re.compile('<span.*?id="fixfor-val".*?>(?P<fix>.*?)</span>') + fix = fixPattern.search(data) + titlePattern = re.compile('title="(?P<title>.*?)"') + if fix: + fix = titlePattern.search(fix.group('fix').strip()) + if fix: + fixVersion = fix.group('title').strip() + self._fix = fixVersion if resolution: self._resolution = resolution.group("resolution").strip() else: test.fatal("FATAL: Cannot get resolution of bugreport %s" % bug, "Looks like JIRA has changed.... Please verify!") self._resolution = None - if None in (self._status, self._resolution): + if self._resolution == None: self.__cropAndLog__(data) - self._fetchResults_.update({bug:[self._resolution, self._status]}) + self._fetchResults_.update({bug:[self._resolution, self._fix]}) # simple helper function - used as fallback if python has no ssl support # tries to find curl or wget in PATH and fetches data with it instead of @@ -182,18 +174,11 @@ class JIRA: return fetched = " ".join(fetched.split()) resoInd = fetched.find('resolution-val') - statInd = fetched.find('status-val') - if resoInd == statInd == -1: - test.log("Neither resolution nor status found inside fetched data.", + if resoInd == -1: + test.log("Resolution not found inside fetched data.", "%s[...]" % fetched[:200]) else: - if resoInd == -1: - test.log("Fetched and cropped data: [...]%s[...]" % fetched[statInd-20:statInd+800]) - elif statInd == -1: - test.log("Fetched and cropped data: [...]%s[...]" % fetched[resoInd-720:resoInd+100]) - else: - test.log("Fetched and cropped data (status): [...]%s[...]" % fetched[statInd-20:statInd+300], - "Fetched and cropped data (resolution): [...]%s[...]" % fetched[resoInd-20:resoInd+100]) + test.log("Fetched and cropped data: [...]%s[...]" % fetched[resoInd-20:resoInd+100]) # this function initializes the bug dict for localOnly usage and # for later lookup which function to call for which bug diff --git a/tests/system/suite_debugger/tst_cli_output_console/test.py b/tests/system/suite_debugger/tst_cli_output_console/test.py index cabfa2aebb..ffb782d31d 100644 --- a/tests/system/suite_debugger/tst_cli_output_console/test.py +++ b/tests/system/suite_debugger/tst_cli_output_console/test.py @@ -46,7 +46,7 @@ def main(): test.log("Running application") setRunInTerminal(len(checkedTargets), kit, False) runControlFinished = False - clickButton(waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}")) + clickButton(waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton")) waitFor("runControlFinished==True", 20000) if not runControlFinished: test.warning("Waiting for runControlFinished timed out") @@ -65,7 +65,7 @@ def main(): isMsvc = isMsvcConfig(len(checkedTargets), kit) runControlFinished = False invokeMenuItem("Debug", "Start Debugging", "Start Debugging") - JIRA.performWorkaroundIfStillOpen(6853, JIRA.Bug.CREATOR, config) + JIRA.performWorkaroundForBug(6853, JIRA.Bug.CREATOR, config) handleDebuggerWarnings(config, isMsvc) waitFor("runControlFinished==True", 20000) if not runControlFinished: diff --git a/tests/system/suite_debugger/tst_simple_analyze/test.py b/tests/system/suite_debugger/tst_simple_analyze/test.py index 56ad572dd7..0fa530df76 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/test.py +++ b/tests/system/suite_debugger/tst_simple_analyze/test.py @@ -1,10 +1,9 @@ source("../../shared/qtcreator.py") -workingDir = None - def main(): - global workingDir startApplication("qtcreator" + SettingsPath) + if not startedWithoutPluginError(): + return # using a temporary directory won't mess up a potentially existing workingDir = tempDir() checkedTargets, projectName = createNewQtQuickApplication(workingDir) diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index b5fd5fdc37..1a966a5172 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -1,9 +1,6 @@ source("../../shared/qtcreator.py") -workingDir = None - def main(): - global workingDir startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return diff --git a/tests/system/suite_editors/tst_basic_cpp_support/test.py b/tests/system/suite_editors/tst_basic_cpp_support/test.py index 8837eca8c4..c48332e0e6 100644 --- a/tests/system/suite_editors/tst_basic_cpp_support/test.py +++ b/tests/system/suite_editors/tst_basic_cpp_support/test.py @@ -39,7 +39,7 @@ def main(): # Creator will show you the declaration of the variable. if platform.system() == "Darwin": - JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, cppwindow) + JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, cppwindow) type(cppwindow, "<Ctrl+F>") type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), " xi") diff --git a/tests/system/suite_editors/tst_delete_externally/test.py b/tests/system/suite_editors/tst_delete_externally/test.py index 21bfaf3318..0d82dcaa87 100644 --- a/tests/system/suite_editors/tst_delete_externally/test.py +++ b/tests/system/suite_editors/tst_delete_externally/test.py @@ -3,12 +3,6 @@ source("../../shared/suites_qtta.py") global templateDir -def readFile(filename): - f = open(filename, "r") - content = f.read() - f.close() - return content - def copyToTemplateDir(filepath): global templateDir dst = os.path.join(templateDir, os.path.basename(filepath)) @@ -39,7 +33,7 @@ def main(): continue if platform.system() == 'Darwin': - JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, editor) + JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, editor) contentBefore = readFile(currentFile) popupText = "The file %s was removed. Do you want to save it under a different name, or close the editor?" os.remove(currentFile) diff --git a/tests/system/suite_editors/tst_revert_changes/test.py b/tests/system/suite_editors/tst_revert_changes/test.py index 159396c75c..8656b22416 100644 --- a/tests/system/suite_editors/tst_revert_changes/test.py +++ b/tests/system/suite_editors/tst_revert_changes/test.py @@ -63,7 +63,7 @@ def __modifyProFile__(): def __modifyHeader__(): global cppEditorStr, homeShortCut, endShortCut if platform.system() == "Darwin": - JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, waitForObject(cppEditorStr, 1000)) + JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, waitForObject(cppEditorStr, 1000)) if placeCursorToLine(cppEditorStr, "class.+", True): type(cppEditorStr, homeShortCut) markText(cppEditorStr, "Down", 5) diff --git a/tests/system/suite_editors/tst_select_all/test.py b/tests/system/suite_editors/tst_select_all/test.py index 9bdf546eeb..81f051a59a 100644 --- a/tests/system/suite_editors/tst_select_all/test.py +++ b/tests/system/suite_editors/tst_select_all/test.py @@ -30,7 +30,7 @@ def main(): "Skipping this file for now.") continue if platform.system() == 'Darwin': - JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, editor) + JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, editor) for key in ["<Up>", "<Down>", "<Left>", "<Right>"]: test.log("Selecting everything") invokeMenuItem("Edit", "Select All") diff --git a/tests/system/suite_general/suite.conf b/tests/system/suite_general/suite.conf index 19ee1d31df..3a75d120de 100644 --- a/tests/system/suite_general/suite.conf +++ b/tests/system/suite_general/suite.conf @@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAP=../objects.map -TEST_CASES=tst_build_speedcrunch tst_cmake_speedcrunch tst_create_proj_wizard tst_default_settings tst_installed_languages tst_openqt_creator +TEST_CASES=tst_build_speedcrunch tst_cmake_speedcrunch tst_create_proj_wizard tst_default_settings tst_installed_languages tst_openqt_creator tst_rename_file VERSION=2 WRAPPERS=Qt diff --git a/tests/system/suite_general/tst_rename_file/test.py b/tests/system/suite_general/tst_rename_file/test.py new file mode 100644 index 0000000000..fad2c7e78b --- /dev/null +++ b/tests/system/suite_general/tst_rename_file/test.py @@ -0,0 +1,78 @@ +source("../../shared/qtcreator.py") + +def main(): + # prepare example project + projectName = "declarative-music-browser" + sourceExample = os.path.join(sdkPath, "Examples", "QtMobility", projectName) + proFile = projectName + ".pro" + if not neededFilePresent(os.path.join(sourceExample, proFile)): + return + # copy example project to temp directory + templateDir = prepareTemplate(sourceExample) + + startApplication("qtcreator" + SettingsPath) + if not startedWithoutPluginError(): + return + usedProFile = os.path.join(templateDir, proFile) + openQmakeProject(usedProFile) + for filetype, filename in [["Headers", "utility.h"], + ["Sources", "main.cpp"], + ["Sources", "utility.cpp"], + ["Resources", "musicbrowser.qrc"], + ["QML", "musicbrowser.qml"]]: + filenames = ["ABCD" + filename.upper(), "abcd" + filename.lower(), "test", "TEST", filename] + if platform.system() == 'Darwin': + # avoid QTCREATORBUG-9197 + filtered = [filenames[0]] + for i in range(1, len(filenames)): + if filenames[i].lower() != filtered[-1].lower(): + filtered.append(filenames[i]) + filenames = filtered + for i in range(len(filenames)): + tempFiletype = filetype + if filetype == "QML" and filenames[i - 1][-4:] != ".qml": + tempFiletype = "Other files" + # workaround QTCREATORBUG-9191 + if filenames[i - 1][-4:].lower() == ".qml" and platform.system() in ('Windows', + 'Microsoft'): + tempFiletype = "QML" + renameFile(templateDir, usedProFile, projectName + "." + tempFiletype, + filenames[i - 1], filenames[i]) + invokeMenuItem("File", "Exit") + +def renameFile(projectDir, proFile, branch, oldname, newname): + oldFilePath = os.path.join(projectDir, oldname) + newFilePath = os.path.join(projectDir, newname) + oldFileText = readFile(oldFilePath) + itemText = branch + "." + oldname.replace(".", "\\.") + treeview = waitForObject(":Qt Creator_Utils::NavigationTreeView") + if platform.system() == 'Darwin': + JIRA.performWorkaroundForBug(8735, JIRA.Bug.CREATOR, treeview) + try: + openItemContextMenu(treeview, itemText, 5, 5, 0) + except: + openItemContextMenu(treeview, addBranchWildcardToRoot(itemText), 5, 5, 0) + activateItem(waitForObjectItem(":Qt Creator.Project.Menu.File_QMenu", "Rename...")) + type(waitForObject(":Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit"), newname) + type(waitForObject(":Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit"), "<Return>") + test.verify(waitFor("os.path.exists(newFilePath)", 1000), + "Verify that file with new name exists: %s" % newFilePath) + if not (oldname.lower() == newname.lower() and platform.system() in ('Windows', 'Microsoft')): + test.verify(not os.path.exists(oldFilePath), + "Verify that file with old name does not exist: %s" % oldFilePath) + test.compare(readFile(newFilePath), oldFileText, + "Comparing content of file before and after renaming") + test.verify(waitFor("newname in safeReadFile(proFile)", 2000), + "Verify that new filename '%s' was added to pro-file." % newname) + if not oldname in newname: + test.verify(not oldname in readFile(proFile), + "Verify that old filename '%s' was removed from pro-file." % oldname) + +def safeReadFile(filename): + text = "" + while text == "": + try: + text = readFile(filename) + except: + pass + return text diff --git a/tests/system/tools/findUnusedObjects.py b/tests/system/tools/findUnusedObjects.py index dfa8d28333..811660d526 100755 --- a/tests/system/tools/findUnusedObjects.py +++ b/tests/system/tools/findUnusedObjects.py @@ -8,6 +8,8 @@ from toolfunctions import checkDirectory from toolfunctions import getFileContent objMap = None +lastToken = [None, None] +stopTokens = ('OP', 'NAME', 'NUMBER', 'ENDMARKER') def parseCommandLine(): global directory, onlyRemovable, fileType @@ -44,12 +46,32 @@ def getFileSuffix(): 'Tcl':'.tcl', 'Ruby':'.rb'} return fileSuffixes.get(fileType, None) +def handleStringsWithTrailingBackSlash(origStr): + try: + while True: + index = origStr.index("\\\n") + origStr = origStr[:index] + origStr[index+2:].lstrip() + except: + return origStr + def handle_token(tokenType, token, (startRow, startCol), (endRow, endCol), line): - global useCounts + global useCounts, lastToken, stopTokens + if tokenize.tok_name[tokenType] == 'STRING': - for obj in useCounts: - useCounts[obj] += str(token).count("'%s'" % obj) - useCounts[obj] += str(token).count('"%s"' % obj) + # concatenate strings followed directly by other strings + if lastToken[0] == 'STRING': + token = "'" + lastToken[1][1:-1] + str(token)[1:-1] + "'" + # store the new string as lastToken after removing potential trailing backslashes + # (including their following indentation) + lastToken = ['STRING' , handleStringsWithTrailingBackSlash(str(token))] + # if a stop token occurs check the potential string before it + elif tokenize.tok_name[tokenType] in stopTokens: + if lastToken[0] == 'STRING': + for obj in useCounts: + useCounts[obj] += lastToken[1].count("'%s'" % obj) + useCounts[obj] += lastToken[1].count('"%s"' % obj) + # store the stop token as lastToken + lastToken = [tokenize.tok_name[tokenType], str(token)] def findUsages(): global directory, objMap |