diff options
author | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-02-18 16:35:40 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-02-18 16:35:46 +0100 |
commit | f4a3b4ca5fa312df82f0067e9139fc18bc4fd57f (patch) | |
tree | c722824e246e427661ee66e38e4d3ef09ec8c88d | |
parent | 0763f44504c88f87efb620f8a10d31d43c2fc7a7 (diff) | |
parent | db8b2e85128f9dc695d64b4a07d6da44a0ba1e1e (diff) |
Merge remote-tracking branch 'origin/3.4'
Change-Id: Ib5ce531102eeef86a34ee78e6990791cf4c910c4
116 files changed, 1151 insertions, 1243 deletions
diff --git a/qtcreator.qbs b/qtcreator.qbs index baefc38f4bb..f1297be6ee6 100644 --- a/qtcreator.qbs +++ b/qtcreator.qbs @@ -18,6 +18,7 @@ Project { property pathList additionalLibs: [] property pathList additionalTools: [] property pathList additionalAutotests: [] + property string sharedSourcesDir: path + "/src/shared" property string libDirName: "lib" property string ide_library_path: { if (qbs.targetOS.contains("osx")) diff --git a/share/qtcreator/qml/qmlpuppet/commands/debugoutputcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/debugoutputcommand.cpp index 64af8919de5..ec262c5cac3 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/debugoutputcommand.cpp +++ b/share/qtcreator/qml/qmlpuppet/commands/debugoutputcommand.cpp @@ -39,9 +39,10 @@ DebugOutputCommand::DebugOutputCommand() { } -DebugOutputCommand::DebugOutputCommand(const QString &text, DebugOutputCommand::Type type) - : m_text(text), - m_type(type) +DebugOutputCommand::DebugOutputCommand(const QString &text, DebugOutputCommand::Type type, const QVector<qint32> &instanceIds) + : m_instanceIds(instanceIds) + , m_text(text) + , m_type(type) { } @@ -55,10 +56,16 @@ QString DebugOutputCommand::text() const return m_text; } +QVector<qint32> DebugOutputCommand::instanceIds() const +{ + return m_instanceIds; +} + QDataStream &operator<<(QDataStream &out, const DebugOutputCommand &command) { out << command.type(); out << command.text(); + out << command.instanceIds(); return out; } @@ -67,6 +74,7 @@ QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command) { in >> command.m_type; in >> command.m_text; + in >> command.m_instanceIds; return in; } diff --git a/share/qtcreator/qml/qmlpuppet/commands/debugoutputcommand.h b/share/qtcreator/qml/qmlpuppet/commands/debugoutputcommand.h index acd32ffcab2..4d0d4cd8e5d 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/debugoutputcommand.h +++ b/share/qtcreator/qml/qmlpuppet/commands/debugoutputcommand.h @@ -34,6 +34,7 @@ #include <QMetaType> #include <QString> #include <QDataStream> +#include <QVector> namespace QmlDesigner { @@ -51,12 +52,14 @@ public: }; DebugOutputCommand(); - explicit DebugOutputCommand(const QString &text, Type type); + explicit DebugOutputCommand(const QString &text, Type type, const QVector<qint32> &instanceIds); qint32 type() const; QString text() const; + QVector<qint32> instanceIds() const; private: + QVector<qint32> m_instanceIds; QString m_text; quint32 m_type; }; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp index e9c15537e33..2c36c696fb8 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -81,7 +81,7 @@ #include "dummycontextobject.h" namespace { - bool testImportStatements(const QStringList &importStatementList, const QUrl &url, bool enableErrorOutput = false) { + bool testImportStatements(const QStringList &importStatementList, const QUrl &url, QString *errorMessage = 0) { QQmlEngine engine; QQmlComponent testImportComponent(&engine); @@ -93,8 +93,10 @@ namespace { if (testImportComponent.errors().isEmpty()) { return true; } else { - if (enableErrorOutput) - qWarning() << "found not working imports: " << testImportComponent.errorString(); + if (errorMessage) { + errorMessage->append("found not working imports: "); + errorMessage->append(testImportComponent.errorString()); + } return false; } } @@ -367,7 +369,7 @@ void NodeInstanceServer::removeSharedMemory(const RemoveSharedMemoryCommand &/*c { } -void NodeInstanceServer::setupImports(const QVector<AddImportContainer> &containerVector) +void NodeInstanceServer::setupImports(const QVector<AddImportContainer> &containerVector, const QVector<IdContainer> &idContainerVector) { Q_ASSERT(quickView()); QSet<QString> importStatementSet; @@ -394,8 +396,7 @@ void NodeInstanceServer::setupImports(const QVector<AddImportContainer> &contain QStringList workingImportStatementList; // check possible import statements combinations - bool enableErrorOutput(true); - + QString errorMessage; // maybe it just works if (testImportStatements(importStatementList, fileUrl())) { workingImportStatementList = importStatementList; @@ -412,13 +413,18 @@ void NodeInstanceServer::setupImports(const QVector<AddImportContainer> &contain // find the bad imports from otherImportStatements foreach (const QString &importStatement, otherImportStatements) { if (testImportStatements(QStringList(firstWorkingImportStatement) << - importStatement, fileUrl(), enableErrorOutput)) { + importStatement, fileUrl(), &errorMessage)) { workingImportStatementList.append(importStatement); } } workingImportStatementList.prepend(firstWorkingImportStatement); } + QVector<qint32> instanceIds; + foreach (const IdContainer &idContainer, idContainerVector) + instanceIds.append(idContainer.instanceId()); + if (!errorMessage.isEmpty()) + sendDebugOutput(DebugOutputCommand::WarningType, errorMessage, instanceIds); setupOnlyWorkingImports(workingImportStatementList); } @@ -1198,9 +1204,16 @@ void NodeInstanceServer::loadDummyDataContext(const QString& directory) } } -void NodeInstanceServer::sendDebugOutput(DebugOutputCommand::Type type, const QString &message) +void NodeInstanceServer::sendDebugOutput(DebugOutputCommand::Type type, const QString &message, qint32 instanceId) +{ + QVector<qint32> ids; + ids.append(instanceId); + sendDebugOutput(type, message, ids); +} + +void NodeInstanceServer::sendDebugOutput(DebugOutputCommand::Type type, const QString &message, const QVector<qint32> &instanceIds) { - DebugOutputCommand command(message, type); + DebugOutputCommand command(message, type, instanceIds); nodeInstanceClient()->debugOutput(command); } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h index d3b71596ff3..99edfdb9ac3 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h @@ -60,6 +60,7 @@ class ChildrenChangedCommand; class ReparentContainer; class ComponentCompletedCommand; class AddImportContainer; +class IdContainer; namespace Internal { class ChildrenChangeEventFilter; @@ -127,7 +128,8 @@ public: virtual QQmlView *declarativeView() const = 0; virtual QQuickView *quickView() const = 0; - void sendDebugOutput(DebugOutputCommand::Type type, const QString &message); + void sendDebugOutput(DebugOutputCommand::Type type, const QString &message, qint32 instanceId); + void sendDebugOutput(DebugOutputCommand::Type type, const QString &message, const QVector<qint32> &instanceIds); public slots: void refreshLocalFileProperty(const QString &path); @@ -192,7 +194,7 @@ protected: void setupDummysForContext(QQmlContext *context); void setupFileUrl(const QUrl &fileUrl); - void setupImports(const QVector<AddImportContainer> &container); + void setupImports(const QVector<AddImportContainer> &container, const QVector<IdContainer> &idContainerVector); void setupDummyData(const QUrl &fileUrl); void setupDefaultDummyData(); QList<ServerNodeInstance> setupInstances(const CreateSceneCommand &command); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp index 20bc738a3d0..6fd9dfca600 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp @@ -91,7 +91,7 @@ void Qt5NodeInstanceServer::resetAllItems() void Qt5NodeInstanceServer::setupScene(const CreateSceneCommand &command) { setupFileUrl(command.fileUrl()); - setupImports(command.imports()); + setupImports(command.imports(), command.ids()); setupDummyData(command.fileUrl()); setupInstances(command); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp index acf045c19d0..b67abc8d1cb 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp @@ -218,15 +218,15 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe } else if (!instanceContainer.nodeSource().isEmpty()) { object = Internal::ObjectNodeInstance::createCustomParserObject(instanceContainer.nodeSource(), nodeInstanceServer->importCode(), nodeInstanceServer->context()); if (object == 0) - nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Custom parser object could not be created.")); + nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Custom parser object could not be created."), instanceContainer.instanceId()); } else if (!instanceContainer.componentPath().isEmpty()) { object = Internal::ObjectNodeInstance::createComponent(instanceContainer.componentPath(), nodeInstanceServer->context()); if (object == 0) - nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QString("Component with path %1 could not be created.").arg(instanceContainer.componentPath())); + nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QString("Component with path %1 could not be created.").arg(instanceContainer.componentPath()), instanceContainer.instanceId()); } else { object = Internal::ObjectNodeInstance::createPrimitive(instanceContainer.type(), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context()); if (object == 0) - nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Item could not be created.")); + nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Item could not be created."), instanceContainer.instanceId()); } if (object == 0) { diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.cpp index 9390e60709e..951b669fe46 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.cpp @@ -1071,9 +1071,11 @@ QObject *NodeInstanceServer::dummyContextObject() const return m_dummyContextObject.data(); } -void NodeInstanceServer::sendDebugOutput(DebugOutputCommand::Type type, const QString &message) +void NodeInstanceServer::sendDebugOutput(DebugOutputCommand::Type type, const QString &message, qint32 instanceId) { - DebugOutputCommand command(message, type); + QVector<qint32> instanceIds; + instanceIds.append(instanceId); + DebugOutputCommand command(message, type, instanceIds); nodeInstanceClient()->debugOutput(command); } diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.h index a0da2646310..6246475fe7a 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/nodeinstanceserver.h @@ -128,7 +128,7 @@ public: virtual QDeclarativeView *declarativeView() const = 0; virtual QSGView *sgView() const = 0; - void sendDebugOutput(DebugOutputCommand::Type type, const QString &message); + void sendDebugOutput(DebugOutputCommand::Type type, const QString &message, qint32 instanceId); public slots: void refreshLocalFileProperty(const QString &path); diff --git a/src/app/app.qbs b/src/app/app.qbs index d02e79aac80..c47fde658c0 100644 --- a/src/app/app.qbs +++ b/src/app/app.qbs @@ -8,8 +8,8 @@ QtcProduct { cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/.."] : ["$ORIGIN/../" + project.libDirName + "/qtcreator"] cpp.includePaths: [ - "../shared/qtsingleapplication", - "../shared/qtlockedfile", + project.sharedSourcesDir + "/qtsingleapplication", + project.sharedSourcesDir + "/qtlockedfile", ] Depends { name: "app_version_header" } diff --git a/src/libs/qmldebug/qmlprofilertraceclient.cpp b/src/libs/qmldebug/qmlprofilertraceclient.cpp index c67e0ad8867..daecd97fc96 100644 --- a/src/libs/qmldebug/qmlprofilertraceclient.cpp +++ b/src/libs/qmldebug/qmlprofilertraceclient.cpp @@ -211,7 +211,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data) threadId = 0; emit rangedEvent(Event, MaximumRangeType, AnimationFrame, time, 0, QString(), - QmlDebug::QmlEventLocation(), frameRate, animationCount, threadId, + QmlEventLocation(), frameRate, animationCount, threadId, 0, 0); d->maximumTime = qMax(time, d->maximumTime); break; @@ -222,7 +222,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data) break; emit this->rangedEvent(Event, MaximumRangeType, subtype, time, 0, QString(), - QmlDebug::QmlEventLocation(), 0, 0, 0, 0, 0); + QmlEventLocation(), 0, 0, 0, 0, 0); d->maximumTime = qMax(time, d->maximumTime); break; } @@ -244,8 +244,8 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data) } while (count<5) params[count++] = 0; - emit rangedEvent(SceneGraphFrame, QmlDebug::MaximumRangeType, subtype,time, 0, - QString(), QmlDebug::QmlEventLocation(), params[0], params[1], + emit rangedEvent(SceneGraphFrame, MaximumRangeType, subtype,time, 0, + QString(), QmlEventLocation(), params[0], params[1], params[2], params[3], params[4]); break; } @@ -261,8 +261,8 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data) stream >> width >> height; refcount = 1; } - emit rangedEvent(QmlDebug::PixmapCacheEvent, QmlDebug::MaximumRangeType, subtype, time, 0, - QString(), QmlDebug::QmlEventLocation(pixUrl,0,0), width, height, + emit rangedEvent(PixmapCacheEvent, MaximumRangeType, subtype, time, 0, + QString(), QmlEventLocation(pixUrl,0,0), width, height, refcount, 0, 0); d->maximumTime = qMax(time, d->maximumTime); break; @@ -273,8 +273,8 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data) qint64 delta; stream >> delta; - emit rangedEvent(QmlDebug::MemoryAllocation, QmlDebug::MaximumRangeType, subtype, time, 0, - QString(), QmlDebug::QmlEventLocation(), delta, 0, 0, 0, 0); + emit rangedEvent(MemoryAllocation, MaximumRangeType, subtype, time, 0, + QString(), QmlEventLocation(), delta, 0, 0, 0, 0); d->maximumTime = qMax(time, d->maximumTime); break; } diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index e885a6114e0..83f82f81546 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -41,9 +41,10 @@ #include <QDir> using namespace LanguageUtils; -using namespace QmlJS; using namespace QmlJS::AST; +namespace QmlJS { + namespace { class ImportCacheKey { @@ -76,8 +77,7 @@ bool operator==(const ImportCacheKey &i1, const ImportCacheKey &i2) } } - -class QmlJS::LinkPrivate +class LinkPrivate { public: Snapshot snapshot; @@ -602,3 +602,5 @@ void LinkPrivate::loadImplicitDefaultImports(Imports *imports) imports->append(import); } } + +} // namespace QmlJS diff --git a/src/libs/qmljs/qmljsvalueowner.cpp b/src/libs/qmljs/qmljsvalueowner.cpp index 57aeb7629ee..7db6ad15a8b 100644 --- a/src/libs/qmljs/qmljsvalueowner.cpp +++ b/src/libs/qmljs/qmljsvalueowner.cpp @@ -65,12 +65,10 @@ private: } }; -} // end of Internal namespace -} // end of QmlJS namespace - +} // namespace Internal // globally shared data -class QmlJS::SharedValueOwner : public ValueOwner +class SharedValueOwner : public ValueOwner { public: enum SharedValueOwnerKind{ @@ -969,3 +967,5 @@ const Value *ValueOwner::defaultValueForBuiltinType(const QString &name) const } return undefinedValue(); } + +} // namespace QmlJS diff --git a/src/libs/utils/mimetypes/mimedatabase.cpp b/src/libs/utils/mimetypes/mimedatabase.cpp index 32629a74edb..47146553512 100644 --- a/src/libs/utils/mimetypes/mimedatabase.cpp +++ b/src/libs/utils/mimetypes/mimedatabase.cpp @@ -135,10 +135,10 @@ static inline bool isTextFile(const QByteArray &data) MimeType MimeDatabasePrivate::findByData(const QByteArray &data, int *accuracyPtr) { - if (data.isEmpty()) { - *accuracyPtr = 100; - return mimeTypeForName(QLatin1String("application/x-zerosize")); - } +// if (data.isEmpty()) { +// *accuracyPtr = 100; +// return mimeTypeForName(QLatin1String("application/x-zerosize")); +// } *accuracyPtr = 0; MimeType candidate = provider()->findByMagic(data, accuracyPtr); diff --git a/src/libs/utils/mimetypes/mimeprovider.cpp b/src/libs/utils/mimetypes/mimeprovider.cpp index 79fc0c07489..8aad4fae07a 100644 --- a/src/libs/utils/mimetypes/mimeprovider.cpp +++ b/src/libs/utils/mimetypes/mimeprovider.cpp @@ -833,7 +833,8 @@ void MimeXMLProvider::ensureLoaded() { if (!m_loaded /*|| shouldCheck()*/) { // bool fdoXmlFound = false; - QStringList allFiles; + // add custom mime types first, which overrides any default from freedesktop.org.xml + QStringList allFiles = m_additionalFiles; // const QStringList packageDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/packages"), QStandardPaths::LocateDirectory); // //qDebug() << "packageDirs=" << packageDirs; @@ -851,11 +852,9 @@ void MimeXMLProvider::ensureLoaded() // if (!fdoXmlFound) { // // We could instead install the file as part of installing Qt? - allFiles.prepend(QLatin1String(":/qt-project.org/qmime/freedesktop.org.xml")); + allFiles.append(QLatin1String(":/qt-project.org/qmime/freedesktop.org.xml")); // } - allFiles.append(m_additionalFiles); - if (m_allFiles == allFiles) return; m_allFiles = allFiles; diff --git a/src/libs/utils/mimetypes/mimetypeparser.cpp b/src/libs/utils/mimetypes/mimetypeparser.cpp index b7fc1e51953..2b953a9168f 100644 --- a/src/libs/utils/mimetypes/mimetypeparser.cpp +++ b/src/libs/utils/mimetypes/mimetypeparser.cpp @@ -210,9 +210,12 @@ bool MimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString QXmlStreamReader reader(dev); ParseState ps = ParseBeginning; QXmlStreamAttributes atts; + bool ignoreCurrentMimeType = false; while (!reader.atEnd()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement: + if (ignoreCurrentMimeType) + continue; ps = nextState(ps, reader.name()); atts = reader.attributes(); switch (ps) { @@ -221,7 +224,10 @@ bool MimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString if (name.isEmpty()) { reader.raiseError(QString::fromLatin1("Missing '%1'-attribute").arg(QString::fromLatin1(mimeTypeAttributeC))); } else { - data.name = name; + if (mimeTypeExists(name)) + ignoreCurrentMimeType = true; + else + data.name = name; } } break; @@ -307,20 +313,25 @@ bool MimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString { const QStringRef elementName = reader.name(); if (elementName == QLatin1String(mimeTypeTagC)) { - if (!process(MimeType(data), errorMessage)) - return false; + if (!ignoreCurrentMimeType) { + if (!process(MimeType(data), errorMessage)) + return false; + } + ignoreCurrentMimeType = false; data.clear(); - } else if (elementName == QLatin1String(matchTagC)) { - // Closing a <match> tag, pop stack - currentRules.pop(); - //qDebug() << " MATCH closed. Stack size is now" << currentRules.size(); - } else if (elementName == QLatin1String(magicTagC)) { - //qDebug() << "MAGIC ended, we got" << rules.count() << "rules, with prio" << priority; - // Finished a <magic> sequence - MimeMagicRuleMatcher ruleMatcher(data.name, priority); - ruleMatcher.addRules(rules); - processMagicMatcher(ruleMatcher); - rules.clear(); + } else if (!ignoreCurrentMimeType) { + if (elementName == QLatin1String(matchTagC)) { + // Closing a <match> tag, pop stack + currentRules.pop(); + //qDebug() << " MATCH closed. Stack size is now" << currentRules.size(); + } else if (elementName == QLatin1String(magicTagC)) { + //qDebug() << "MAGIC ended, we got" << rules.count() << "rules, with prio" << priority; + // Finished a <magic> sequence + MimeMagicRuleMatcher ruleMatcher(data.name, priority); + ruleMatcher.addRules(rules); + processMagicMatcher(ruleMatcher); + rules.clear(); + } } break; } diff --git a/src/libs/utils/mimetypes/mimetypeparser_p.h b/src/libs/utils/mimetypes/mimetypeparser_p.h index 65af372a3db..02d5198b4d4 100644 --- a/src/libs/utils/mimetypes/mimetypeparser_p.h +++ b/src/libs/utils/mimetypes/mimetypeparser_p.h @@ -67,6 +67,7 @@ public: bool parse(QIODevice *dev, const QString &fileName, QString *errorMessage); protected: + virtual bool mimeTypeExists(const QString &mimeTypeName) = 0; virtual bool process(const MimeType &t, QString *errorMessage) = 0; virtual bool process(const MimeGlobPattern &t, QString *errorMessage) = 0; virtual void processParent(const QString &child, const QString &parent) = 0; @@ -100,6 +101,9 @@ public: explicit MimeTypeParser(MimeXMLProvider &provider) : m_provider(provider) {} protected: + inline bool mimeTypeExists(const QString &mimeTypeName) + { return m_provider.mimeTypeForName(mimeTypeName).isValid(); } + inline bool process(const MimeType &t, QString *) { m_provider.addMimeType(t); return true; } diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 80e0397e507..ee3d7a96d72 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -151,8 +151,8 @@ public: void selectAction(AnalyzerAction *action); void handleToolStarted(); void handleToolFinished(); - void saveToolSettings(AnalyzerAction *action); - void loadToolSettings(AnalyzerAction *action); + void saveToolSettings(Id toolId); + void loadToolSettings(Id toolId); // Convenience. bool isActionRunnable(AnalyzerAction *action) const; @@ -178,9 +178,9 @@ public: QComboBox *m_toolBox; QStackedWidget *m_controlsStackWidget; StatusLabel *m_statusLabel; - typedef QMap<IAnalyzerTool *, FancyMainWindowSettings> MainWindowSettingsMap; - QHash<IAnalyzerTool *, QList<QDockWidget *> > m_toolWidgets; - QHash<IAnalyzerTool *, QWidget *> m_controlsWidgetFromTool; + typedef QMap<Id, FancyMainWindowSettings> MainWindowSettingsMap; + QHash<Id, QList<QDockWidget *> > m_toolWidgets; + QHash<Id, QWidget *> m_controlsWidgetFromTool; MainWindowSettingsMap m_defaultSettings; // list of dock widgets to prevent memory leak @@ -431,13 +431,13 @@ bool AnalyzerManagerPrivate::isActionRunnable(AnalyzerAction *action) const if (action->startMode() == StartRemote) return true; - return ProjectExplorerPlugin::canRun(SessionManager::startupProject(), action->tool()->runMode(), 0); + return ProjectExplorerPlugin::canRun(SessionManager::startupProject(), action->runMode(), 0); } void AnalyzerManagerPrivate::startTool() { QTC_ASSERT(m_currentAction, return); - m_currentAction->tool()->startTool(m_currentAction->startMode()); + m_currentAction->toolStarter()(m_currentAction->startMode()); } void AnalyzerManagerPrivate::modeChanged(IMode *mode) @@ -461,7 +461,7 @@ void AnalyzerManagerPrivate::selectSavedTool() if (settings->contains(QLatin1String(LAST_ACTIVE_TOOL))) { const Id lastAction = Id::fromSetting(settings->value(QLatin1String(LAST_ACTIVE_TOOL))); foreach (AnalyzerAction *action, m_actions) { - if (action->id() == lastAction) { + if (action->toolId() == lastAction) { selectAction(action); return; } @@ -496,30 +496,30 @@ void AnalyzerManagerPrivate::selectAction(AnalyzerAction *action) // Clean up old tool. if (m_currentAction) { - saveToolSettings(m_currentAction); - foreach (QDockWidget *widget, m_toolWidgets.value(m_currentAction->tool())) + saveToolSettings(m_currentAction->toolId()); + foreach (QDockWidget *widget, m_toolWidgets.value(m_currentAction->toolId())) deactivateDock(widget); } // Now change the tool. m_currentAction = action; - IAnalyzerTool *tool = action->tool(); - if (!m_defaultSettings.contains(tool)) { - QWidget *widget = tool->createWidgets(); + Id toolId = action->toolId(); + if (!m_defaultSettings.contains(toolId)) { + QWidget *widget = action->createWidget(); QTC_CHECK(widget); - m_defaultSettings.insert(tool, m_mainWindow->saveSettings()); - QTC_CHECK(!m_controlsWidgetFromTool.contains(tool)); - m_controlsWidgetFromTool[tool] = widget; + m_defaultSettings.insert(toolId, m_mainWindow->saveSettings()); + QTC_CHECK(!m_controlsWidgetFromTool.contains(toolId)); + m_controlsWidgetFromTool[toolId] = widget; m_controlsStackWidget->addWidget(widget); } - foreach (QDockWidget *widget, m_toolWidgets.value(tool)) + foreach (QDockWidget *widget, m_toolWidgets.value(toolId)) activateDock(Qt::DockWidgetArea(widget->property(INITIAL_DOCK_AREA).toInt()), widget); - loadToolSettings(action); + loadToolSettings(action->toolId()); - QTC_CHECK(m_controlsWidgetFromTool.contains(tool)); - m_controlsStackWidget->setCurrentWidget(m_controlsWidgetFromTool.value(tool)); + QTC_CHECK(m_controlsWidgetFromTool.contains(toolId)); + m_controlsStackWidget->setCurrentWidget(m_controlsWidgetFromTool.value(toolId)); m_toolBox->setCurrentIndex(actionIndex); updateRunActions(); @@ -533,7 +533,7 @@ void AnalyzerManagerPrivate::addAction(AnalyzerAction *action) Id menuGroup = action->menuGroup(); if (menuGroup.isValid()) { - Command *command = ActionManager::registerAction(action, action->id(), Context(C_GLOBAL)); + Command *command = ActionManager::registerAction(action, action->actionId(), Context(C_GLOBAL)); m_menu->addAction(command, menuGroup); } @@ -556,29 +556,28 @@ void AnalyzerManagerPrivate::handleToolFinished() updateRunActions(); } -void AnalyzerManagerPrivate::loadToolSettings(AnalyzerAction *action) +void AnalyzerManagerPrivate::loadToolSettings(Id toolId) { QTC_ASSERT(m_mainWindow, return); QSettings *settings = ICore::settings(); - settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + action->id().toString()); + settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + toolId.toString()); if (settings->value(QLatin1String("ToolSettingsSaved"), false).toBool()) m_mainWindow->restoreSettings(settings); else - m_mainWindow->restoreSettings(m_defaultSettings.value(action->tool())); + m_mainWindow->restoreSettings(m_defaultSettings.value(toolId)); settings->endGroup(); } -void AnalyzerManagerPrivate::saveToolSettings(AnalyzerAction *action) +void AnalyzerManagerPrivate::saveToolSettings(Id toolId) { - QTC_ASSERT(action, return); QTC_ASSERT(m_mainWindow, return); QSettings *settings = ICore::settings(); - settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + action->id().toString()); + settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + toolId.toString()); m_mainWindow->saveSettings(settings); settings->setValue(QLatin1String("ToolSettingsSaved"), true); settings->endGroup(); - settings->setValue(QLatin1String(LAST_ACTIVE_TOOL), action->id().toString()); + settings->setValue(QLatin1String(LAST_ACTIVE_TOOL), toolId.toString()); } void AnalyzerManagerPrivate::updateRunActions() @@ -590,7 +589,7 @@ void AnalyzerManagerPrivate::updateRunActions() disabledReason = tr("No analyzer tool selected."); else ProjectExplorerPlugin::canRun(SessionManager::startupProject(), - m_currentAction->tool()->runMode(), &disabledReason); + m_currentAction->runMode(), &disabledReason); m_startAction->setEnabled(isActionRunnable(m_currentAction)); m_startAction->setToolTip(disabledReason); @@ -625,7 +624,7 @@ AnalyzerManager::~AnalyzerManager() void AnalyzerManager::shutdown() { if (d->m_currentAction) - d->saveToolSettings(d->m_currentAction); + d->saveToolSettings(d->m_currentAction->toolId()); } void AnalyzerManager::addAction(AnalyzerAction *action) @@ -633,21 +632,21 @@ void AnalyzerManager::addAction(AnalyzerAction *action) d->addAction(action); } -QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, +QDockWidget *AnalyzerManager::createDockWidget(Core::Id toolId, QWidget *widget, Qt::DockWidgetArea area) { QTC_ASSERT(!widget->objectName().isEmpty(), return 0); QDockWidget *dockWidget = d->m_mainWindow->addDockForWidget(widget); dockWidget->setProperty(INITIAL_DOCK_AREA, int(area)); d->m_dockWidgets.append(AnalyzerManagerPrivate::DockPtr(dockWidget)); - d->m_toolWidgets[tool].push_back(dockWidget); + d->m_toolWidgets[toolId].push_back(dockWidget); return dockWidget; } -void AnalyzerManager::selectTool(IAnalyzerTool *tool, StartMode mode) +void AnalyzerManager::selectTool(Id toolId, StartMode mode) { foreach (AnalyzerAction *action, d->m_actions) - if (action->tool() == tool && action->startMode() == mode) + if (action->toolId() == toolId && action->startMode() == mode) d->selectAction(action); } @@ -664,7 +663,7 @@ FancyMainWindow *AnalyzerManager::mainWindow() void AnalyzerManagerPrivate::resetLayout() { QTC_ASSERT(m_currentAction, return); - m_mainWindow->restoreSettings(m_defaultSettings.value(m_currentAction->tool())); + m_mainWindow->restoreSettings(m_defaultSettings.value(m_currentAction->toolId())); } void AnalyzerManager::showStatusMessage(const QString &message, int timeoutMS) @@ -707,9 +706,8 @@ AnalyzerRunControl *AnalyzerManager::createRunControl( const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) { foreach (AnalyzerAction *action, d->m_actions) { - IAnalyzerTool *tool = action->tool(); - if (tool->runMode() == sp.runMode && action->startMode() == sp.startMode) - return tool->createRunControl(sp, runConfiguration); + if (action->runMode() == sp.runMode && action->startMode() == sp.startMode) + return action->createRunControl(sp, runConfiguration); } QTC_CHECK(false); return 0; diff --git a/src/plugins/analyzerbase/analyzermanager.h b/src/plugins/analyzerbase/analyzermanager.h index c80a76e0e34..8a5e44ede6c 100644 --- a/src/plugins/analyzerbase/analyzermanager.h +++ b/src/plugins/analyzerbase/analyzermanager.h @@ -35,6 +35,7 @@ #include "analyzerbase_global.h" #include "analyzerconstants.h" +#include <coreplugin/id.h> #include <projectexplorer/projectexplorerconstants.h> #include <QObject> @@ -49,7 +50,6 @@ namespace ProjectExplorer { class RunConfiguration; } namespace Analyzer { -class IAnalyzerTool; class AnalyzerAction; class AnalyzerRunControl; class AnalyzerStartParameters; @@ -70,13 +70,13 @@ public: static void addAction(AnalyzerAction *action); // Dockwidgets are registered to the main window. - static QDockWidget *createDockWidget(IAnalyzerTool *tool, + static QDockWidget *createDockWidget(Core::Id toolId, QWidget *widget, Qt::DockWidgetArea area = Qt::BottomDockWidgetArea); static Utils::FancyMainWindow *mainWindow(); static void showMode(); - static void selectTool(IAnalyzerTool *tool, StartMode mode); + static void selectTool(Core::Id toolId, StartMode mode); static void startTool(); static void stopTool(); diff --git a/src/plugins/analyzerbase/analyzerruncontrol.cpp b/src/plugins/analyzerbase/analyzerruncontrol.cpp index 7d05b1efdc2..6748220743e 100644 --- a/src/plugins/analyzerbase/analyzerruncontrol.cpp +++ b/src/plugins/analyzerbase/analyzerruncontrol.cpp @@ -58,7 +58,8 @@ AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp, connect(this, &AnalyzerRunControl::finished, this, &AnalyzerRunControl::runControlFinished); - connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), SLOT(stopIt())); + connect(AnalyzerManager::stopAction(), &QAction::triggered, + this, &AnalyzerRunControl::stopIt); } void AnalyzerRunControl::stopIt() diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp index a0eedd7df3d..48866525df6 100644 --- a/src/plugins/analyzerbase/ianalyzertool.cpp +++ b/src/plugins/analyzerbase/ianalyzertool.cpp @@ -31,35 +31,118 @@ #include "ianalyzertool.h" +#include "analyzermanager.h" +#include "analyzerruncontrol.h" +#include "startremotedialog.h" + +#include <coreplugin/icore.h> +#include <coreplugin/imode.h> +#include <coreplugin/modemanager.h> + +#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/project.h> +#include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/session.h> +#include <projectexplorer/target.h> + +#include <utils/qtcassert.h> +#include <utils/checkablemessagebox.h> + +#include <QAction> +#include <QDialog> +#include <QDialogButtonBox> +#include <QSettings> + +using namespace Core; +using namespace ProjectExplorer; + namespace Analyzer { -IAnalyzerTool::IAnalyzerTool(QObject *parent) - : QObject(parent) +AnalyzerAction::AnalyzerAction(QObject *parent) + : QAction(parent) {} - /// Returns the run mode for this tool. -ProjectExplorer::RunMode IAnalyzerTool::runMode() const +static bool buildTypeAccepted(ToolMode toolMode, BuildConfiguration::BuildType buildType) { - return m_runMode; + if (toolMode == AnyMode) + return true; + if (buildType == BuildConfiguration::Unknown) + return true; + if (buildType == BuildConfiguration::Debug && toolMode == DebugMode) + return true; + if (buildType == BuildConfiguration::Release && toolMode == ReleaseMode) + return true; + return false; } -void IAnalyzerTool::setRunMode(ProjectExplorer::RunMode mode) +bool checkForLocalStart(ToolMode toolMode) { - m_runMode = mode; -} + // Make sure mode is shown. + AnalyzerManager::showMode(); -IAnalyzerTool::ToolMode IAnalyzerTool::toolMode() const -{ - return m_toolMode; + // ### not sure if we're supposed to check if the RunConFiguration isEnabled + Project *pro = SessionManager::startupProject(); + BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown; + if (pro) { + if (const Target *target = pro->activeTarget()) { + // Build configuration is 0 for QML projects. + if (const BuildConfiguration *buildConfig = target->activeBuildConfiguration()) + buildType = buildConfig->buildType(); + } + } + + // Check the project for whether the build config is in the correct mode + // if not, notify the user and urge him to use the correct mode. + if (!buildTypeAccepted(toolMode, buildType)) { + const QString currentMode = buildType == BuildConfiguration::Debug + ? AnalyzerManager::tr("Debug") + : AnalyzerManager::tr("Release"); + + QString toolModeString; + switch (toolMode) { + case DebugMode: + toolModeString = AnalyzerManager::tr("Debug"); + break; + case ReleaseMode: + toolModeString = AnalyzerManager::tr("Release"); + break; + default: + QTC_CHECK(false); + } + //const QString toolName = displayName(); + const QString toolName = AnalyzerManager::tr("Tool"); // FIXME + const QString title = AnalyzerManager::tr("Run %1 in %2 Mode?").arg(toolName).arg(currentMode); + const QString message = AnalyzerManager::tr("<html><head/><body><p>You are trying " + "to run the tool \"%1\" on an application in %2 mode. " + "The tool is designed to be used in %3 mode.</p><p>" + "Debug and Release mode run-time characteristics differ " + "significantly, analytical findings for one mode may or " + "may not be relevant for the other.</p><p>" + "Do you want to continue and run the tool in %2 mode?</p></body></html>") + .arg(toolName).arg(currentMode).arg(toolModeString); + if (Utils::CheckableMessageBox::doNotAskAgainQuestion(ICore::mainWindow(), + title, message, ICore::settings(), QLatin1String("AnalyzerCorrectModeWarning")) + != QDialogButtonBox::Yes) + return false; + } + + return true; } -void IAnalyzerTool::setToolMode(IAnalyzerTool::ToolMode mode) +bool checkForRemoteStart(AnalyzerStartParameters *sp) { - m_toolMode = mode; -} + StartRemoteDialog dlg; + if (dlg.exec() != QDialog::Accepted) + return false; -AnalyzerAction::AnalyzerAction(QObject *parent) - : QAction(parent) -{} + sp->startMode = StartRemote; + sp->connParams = dlg.sshParams(); + sp->debuggee = dlg.executable(); + sp->debuggeeArgs = dlg.arguments(); + sp->displayName = dlg.executable(); + sp->workingDirectory = dlg.workingDirectory(); + + return true; +} } // namespace Analyzer diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h index d0d78ea5c69..eb052724264 100644 --- a/src/plugins/analyzerbase/ianalyzertool.h +++ b/src/plugins/analyzerbase/ianalyzertool.h @@ -41,67 +41,30 @@ #include <QObject> #include <QAction> +#include <functional> + namespace ProjectExplorer { class RunConfiguration; } namespace Analyzer { class AnalyzerRunControl; - /** - * This class represents an analyzation tool, e.g. "Valgrind Memcheck". + * The mode in which this tool should preferably be run * - * Each tool can run in different run modes. The modes are specific to the mode. - * - * @code - * bool YourPlugin::initialize(const QStringList &arguments, QString *errorString) - * { - * AnalyzerManager::addTool(new MemcheckTool(this)); - * return true; - * } - * @endcode + * The memcheck tool, for example, requires debug symbols, hence DebugMode + * is preferred. On the other hand, callgrind should look at optimized code, + * hence ReleaseMode. */ -class ANALYZER_EXPORT IAnalyzerTool : public QObject -{ - Q_OBJECT - -public: - explicit IAnalyzerTool(QObject *parent = 0); - - ProjectExplorer::RunMode runMode() const; - void setRunMode(ProjectExplorer::RunMode mode); - - /** - * The mode in which this tool should preferably be run - * - * The memcheck tool, for example, requires debug symbols, hence DebugMode - * is preferred. On the other hand, callgrind should look at optimized code, - * hence ReleaseMode. - */ - enum ToolMode { - DebugMode, - ReleaseMode, - AnyMode - }; - ToolMode toolMode() const; - void setToolMode(ToolMode mode); - - /// Creates all widgets used by the tool. - /// Returns a control widget which will be shown in the status bar when - /// this tool is selected. Must be non-zero. - virtual QWidget *createWidgets() = 0; - - /// Returns a new engine for the given start parameters. - /// Called each time the tool is launched. - virtual AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) = 0; +enum ToolMode { + DebugMode, + ReleaseMode, + AnyMode +}; - virtual void startTool(StartMode mode) = 0; +ANALYZER_EXPORT bool checkForLocalStart(ToolMode toolMode); +ANALYZER_EXPORT bool checkForRemoteStart(AnalyzerStartParameters *sp); -private: - ProjectExplorer::RunMode m_runMode; - ToolMode m_toolMode; -}; /** * This class represents an analyzation action, i.e. a tool that runs in a specific mode. @@ -116,26 +79,52 @@ public: explicit AnalyzerAction(QObject *parent = 0); public: - IAnalyzerTool *tool() const { return m_tool; } - void setTool(IAnalyzerTool *tool) { m_tool = tool; } - StartMode startMode() const { return m_startMode; } void setStartMode(StartMode startMode) { m_startMode = startMode; } Core::Id menuGroup() const { return m_menuGroup; } void setMenuGroup(Core::Id menuGroup) { m_menuGroup = menuGroup; } - Core::Id id() const { return m_id; } - void setId(Core::Id id) { m_id = id; } + Core::Id actionId() const { return m_actionId; } + void setActionId(Core::Id id) { m_actionId = id; } + + Core::Id toolId() const { return m_toolId; } + void setToolId(Core::Id id) { m_toolId = id; } + + ProjectExplorer::RunMode runMode() const { return m_runMode; } + void setRunMode(ProjectExplorer::RunMode mode) { m_runMode = mode; } + + /// Creates all widgets used by the tool. + /// Returns a control widget which will be shown in the status bar when + /// this tool is selected. + typedef std::function<QWidget *()> WidgetCreator; + QWidget *createWidget() const { return m_widgetCreator(); } + void setWidgetCreator(const WidgetCreator &creator) { m_widgetCreator = creator; } + + /// Returns a new engine for the given start parameters. + /// Called each time the tool is launched. + typedef std::function<AnalyzerRunControl *(const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration)> RunControlCreator; + AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) const + { return m_runControlCreator(sp, runConfiguration); } + void setRunControlCreator(const RunControlCreator &creator) { m_runControlCreator = creator; } + + typedef std::function<void(StartMode)> ToolStarter; + ToolStarter toolStarter() const { return m_toolStarter; } + void setToolStarter(const ToolStarter &toolStarter) { m_toolStarter = toolStarter; } protected: - IAnalyzerTool *m_tool; StartMode m_startMode; Core::Id m_menuGroup; - Core::Id m_id; + Core::Id m_actionId; + Core::Id m_toolId; + ProjectExplorer::RunMode m_runMode; + WidgetCreator m_widgetCreator; + RunControlCreator m_runControlCreator; + ToolStarter m_toolStarter; }; - } // namespace Analyzer #endif // IANALYZERTOOL_H diff --git a/src/plugins/cpaster/cpaster.qbs b/src/plugins/cpaster/cpaster.qbs index 033b570b8ee..4b3cb99a84f 100644 --- a/src/plugins/cpaster/cpaster.qbs +++ b/src/plugins/cpaster/cpaster.qbs @@ -9,7 +9,7 @@ QtcPlugin { Depends { name: "Core" } Depends { name: "TextEditor" } - cpp.includePaths: base.concat("../../shared/cpaster") + cpp.includePaths: base.concat([project.sharedSourcesDir + "/cpaster"]) files: [ "columnindicatortextedit.cpp", diff --git a/src/plugins/cppeditor/CppEditor.mimetypes.xml b/src/plugins/cppeditor/CppEditor.mimetypes.xml index cf31f0e315c..253f5d126ff 100644 --- a/src/plugins/cppeditor/CppEditor.mimetypes.xml +++ b/src/plugins/cppeditor/CppEditor.mimetypes.xml @@ -64,7 +64,7 @@ <comment>Objective-C++ source code</comment> <sub-class-of type="text/x-c++src"/> <sub-class-of type="text/x-objcsrc"/> - <glob pattern="*.mm"/> + <glob pattern="*.mm" weight="70"/> </mime-type> </mime-info> diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp index f1a7ff62b16..dfae9a21501 100644 --- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp +++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp @@ -295,6 +295,7 @@ F2TestCase::F2TestCase(CppEditorAction action, // that is the function bodies are processed. forever { const Document::Ptr document = waitForFileInGlobalSnapshot(testFile->filePath()); + QVERIFY(document); if (document->checkMode() == Document::FullCheck) { QVERIFY(document->diagnosticMessages().isEmpty()); break; diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index 625132f99be..e901021513f 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -88,8 +88,7 @@ public: m_textDocument = m_editorWidget->document(); // Get Document - waitForFileInGlobalSnapshot(fileName); - const Document::Ptr document = globalSnapshot().document(fileName); + const Document::Ptr document = waitForFileInGlobalSnapshot(fileName); QVERIFY(document); QVERIFY(document->diagnosticMessages().isEmpty()); diff --git a/src/plugins/cpptools/cpplocatorfilter_test.cpp b/src/plugins/cpptools/cpplocatorfilter_test.cpp index 42c67664bcc..9b51ccc1ccd 100644 --- a/src/plugins/cpptools/cpplocatorfilter_test.cpp +++ b/src/plugins/cpptools/cpplocatorfilter_test.cpp @@ -128,7 +128,7 @@ private: m_editor = EditorManager::openEditor(m_fileName); QVERIFY(m_editor); - waitForFileInGlobalSnapshot(m_fileName); + QVERIFY(waitForFileInGlobalSnapshot(m_fileName)); } void doAfterLocatorRun() diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp index d7a96300fc3..f1839b2493c 100644 --- a/src/plugins/cpptools/cpptoolstestcase.cpp +++ b/src/plugins/cpptools/cpptoolstestcase.cpp @@ -170,14 +170,19 @@ bool TestCase::closeEditorWithoutGarbageCollectorInvocation(Core::IEditor *edito return closeEditorsWithoutGarbageCollectorInvocation(QList<Core::IEditor *>() << editor); } -CPlusPlus::Document::Ptr TestCase::waitForFileInGlobalSnapshot(const QString &filePath) +CPlusPlus::Document::Ptr TestCase::waitForFileInGlobalSnapshot(const QString &filePath, + int timeOutInMs) { - return waitForFilesInGlobalSnapshot(QStringList(filePath)).first(); + const auto documents = waitForFilesInGlobalSnapshot(QStringList(filePath), timeOutInMs); + return documents.isEmpty() ? CPlusPlus::Document::Ptr() : documents.first(); } -QList<CPlusPlus::Document::Ptr> TestCase::waitForFilesInGlobalSnapshot( - const QStringList &filePaths) +QList<CPlusPlus::Document::Ptr> TestCase::waitForFilesInGlobalSnapshot(const QStringList &filePaths, + int timeOutInMs) { + QTime t; + t.start(); + QList<CPlusPlus::Document::Ptr> result; foreach (const QString &filePath, filePaths) { forever { @@ -185,13 +190,15 @@ QList<CPlusPlus::Document::Ptr> TestCase::waitForFilesInGlobalSnapshot( result.append(document); break; } + if (t.elapsed() > timeOutInMs) + return QList<CPlusPlus::Document::Ptr>(); QCoreApplication::processEvents(); } } return result; } -bool TestCase::waitUntilCppModelManagerIsAwareOf(Project *project, int timeOut) +bool TestCase::waitUntilCppModelManagerIsAwareOf(Project *project, int timeOutInMs) { if (!project) return false; @@ -203,7 +210,7 @@ bool TestCase::waitUntilCppModelManagerIsAwareOf(Project *project, int timeOut) forever { if (modelManager->projectInfo(project).isValid()) return true; - if (t.elapsed() > timeOut) + if (t.elapsed() > timeOutInMs) return false; QCoreApplication::processEvents(); } diff --git a/src/plugins/cpptools/cpptoolstestcase.h b/src/plugins/cpptools/cpptoolstestcase.h index f96bd85dc1e..a614911d9ff 100644 --- a/src/plugins/cpptools/cpptoolstestcase.h +++ b/src/plugins/cpptools/cpptoolstestcase.h @@ -93,11 +93,16 @@ public: static CPlusPlus::Snapshot globalSnapshot(); static bool garbageCollectGlobalSnapshot(); - static bool waitUntilCppModelManagerIsAwareOf(ProjectExplorer::Project *project, - int timeOut = 30 * 1000 /*= 30 secs*/); - static CPlusPlus::Document::Ptr waitForFileInGlobalSnapshot(const QString &filePath); + enum { defaultTimeOutInMs = 30 * 1000 /*= 30 secs*/ }; + static bool waitUntilCppModelManagerIsAwareOf( + ProjectExplorer::Project *project, + int timeOutInMs = defaultTimeOutInMs); + static CPlusPlus::Document::Ptr waitForFileInGlobalSnapshot( + const QString &filePath, + int timeOutInMs = defaultTimeOutInMs); static QList<CPlusPlus::Document::Ptr> waitForFilesInGlobalSnapshot( - const QStringList &filePaths); + const QStringList &filePaths, + int timeOutInMs = defaultTimeOutInMs); static bool writeFile(const QString &filePath, const QByteArray &contents); diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index a23fc804d72..486977d1579 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -87,6 +87,8 @@ enum { debugBreakpoints = 0 }; enum { LocalsUpdateForNewFrame = 0x1 }; +#define CB(callback) [this](const CdbCommandPtr &r) { callback(r); } + #if 0 # define STATE_DEBUG(state, func, line, notifyFunc) qDebug("%s in %s at %s:%d", notifyFunc, stateName(state), func, line); #else @@ -202,84 +204,48 @@ static inline bool isCreatorConsole(const DebuggerStartParameters &sp) } // Base data structure for command queue entries with callback -struct CdbCommandBase +struct CdbCommand { - typedef CdbEngine::BuiltinCommandHandler CommandHandler; + CdbCommand() + : token(0), flags(0), commandSequence(0), isBuiltin(true), success(false) + {} + + CdbCommand(bool builtin, const QByteArray &cmd, int token, unsigned flags, + CdbEngine::CommandHandler h, unsigned nc) + : token(token), flags(flags), command(cmd), commandSequence(nc), + isBuiltin(builtin), handler(h), success(false) + {} - CdbCommandBase(); - CdbCommandBase(const QByteArray &cmd, int token, unsigned flags, - unsigned nc, const QVariant &cookie); + QByteArray joinedReply() const; int token; unsigned flags; QByteArray command; - QVariant cookie; - // Continue with another commands as specified in CommandSequenceFlags + // Continue with other commands as specified in CommandSequenceFlags unsigned commandSequence; -}; -CdbCommandBase::CdbCommandBase() : - token(0), flags(0), commandSequence(0) -{ -} - -CdbCommandBase::CdbCommandBase(const QByteArray &cmd, int t, unsigned f, - unsigned nc, const QVariant &c) : - token(t), flags(f), command(cmd), cookie(c), commandSequence(nc) -{ -} + bool isBuiltin; + CdbEngine::CommandHandler handler; + QList<QByteArray> builtinReply; -// Queue entry for builtin commands producing free-format -// line-by-line output. -struct CdbBuiltinCommand : public CdbCommandBase -{ - typedef CdbEngine::BuiltinCommandHandler CommandHandler; - - CdbBuiltinCommand() {} - CdbBuiltinCommand(const QByteArray &cmd, int token, unsigned flags, - CommandHandler h, - unsigned nc, const QVariant &cookie) : - CdbCommandBase(cmd, token, flags, nc, cookie), handler(h) - {} - - - QByteArray joinedReply() const; - - CommandHandler handler; - QList<QByteArray> reply; + QByteArray extensionReply; + QByteArray errorMessage; + bool success; }; -QByteArray CdbBuiltinCommand::joinedReply() const +QByteArray CdbCommand::joinedReply() const { - if (reply.isEmpty()) + if (builtinReply.isEmpty()) return QByteArray(); QByteArray answer; - answer.reserve(120 * reply.size()); - foreach (const QByteArray &l, reply) { + answer.reserve(120 * builtinReply.size()); + foreach (const QByteArray &l, builtinReply) { answer += l; answer += '\n'; } return answer; } -// Queue entry for Qt Creator extension commands producing one-line -// output with success flag and error message. -struct CdbExtensionCommand : public CdbCommandBase -{ - typedef CdbEngine::ExtensionCommandHandler CommandHandler; - - CdbExtensionCommand() : success(false) {} - CdbExtensionCommand(const QByteArray &cmd, int token, unsigned flags, - CommandHandler h, - unsigned nc, const QVariant &cookie) : - CdbCommandBase(cmd, token, flags, nc, cookie), handler(h),success(false) {} - - CommandHandler handler; - QByteArray reply; - QByteArray errorMessage; - bool success; -}; - template <class CommandPtrType> int indexOfCommand(const QList<CommandPtrType> &l, int token) { @@ -569,10 +535,10 @@ void CdbEngine::consoleStubExited() void CdbEngine::createFullBacktrace() { - postBuiltinCommand("~*kp", 0, &CdbEngine::handleCreateFullBackTrace); + postBuiltinCommand("~*kp", 0, CB(handleCreateFullBackTrace)); } -void CdbEngine::handleCreateFullBackTrace(const CdbEngine::CdbBuiltinCommandPtr &cmd) +void CdbEngine::handleCreateFullBackTrace(const CdbEngine::CdbCommandPtr &cmd) { Internal::openTextEditor(QLatin1String("Backtrace $"), QLatin1String(cmd->joinedReply())); } @@ -765,7 +731,7 @@ void CdbEngine::setupInferior() const BreakpointParameters bp(BreakpointAtMain); postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(quint16(-1)), true), 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); } postCommand("sxn 0x4000001f", 0); // Do not break on WowX86 exceptions. postCommand("sxn ibp", 0); // Do not break on initial breakpoints. @@ -775,7 +741,7 @@ void CdbEngine::setupInferior() + " maxStackDepth=" + action(MaximalStackDepth)->value().toByteArray() , 0); - postExtensionCommand("pid", QByteArray(), 0, &CdbEngine::handlePid); + postExtensionCommand("pid", QByteArray(), 0, CB(handlePid)); } static QByteArray msvcRunTime(const Abi::OSFlavor flavour) @@ -824,25 +790,25 @@ void CdbEngine::runEngine() const QByteArray debugModule = module + 'D'; const QByteArray wideFunc = QByteArray(CdbOptionsPage::crtDbgReport).append('W'); postBuiltinCommand(breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, module), 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); postBuiltinCommand(breakAtFunctionCommand(wideFunc, module), 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); postBuiltinCommand(breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, debugModule), 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); postBuiltinCommand(breakAtFunctionCommand(wideFunc, debugModule), 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); } if (boolSetting(BreakOnWarning)) { postBuiltinCommand("bm /( QtCored4!qWarning", 0, - &CdbEngine::handleBreakInsert); // 'bm': All overloads. + CB(handleBreakInsert)); // 'bm': All overloads. postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::warning", 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); } if (boolSetting(BreakOnFatal)) { postBuiltinCommand("bm /( QtCored4!qFatal", 0, - &CdbEngine::handleBreakInsert); // 'bm': All overloads. + CB(handleBreakInsert)); // 'bm': All overloads. postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::fatal", 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); } if (startParameters().startMode == AttachCore) { QTC_ASSERT(!m_coreStopReason.isNull(), return; ); @@ -1028,8 +994,7 @@ void CdbEngine::updateWatchData(const WatchData &dataIn, if (!dataIn.name.isEmpty() && dataIn.name != QLatin1String(dataIn.exp)) m_watchInameToName.insert(dataIn.iname, dataIn.name); postExtensionCommand("addwatch", args, 0, - &CdbEngine::handleAddWatch, 0, - qVariantFromValue(dataIn)); + [this, dataIn](const CdbCommandPtr &r) { handleAddWatch(r, dataIn); }); return; } @@ -1042,9 +1007,8 @@ void CdbEngine::updateWatchData(const WatchData &dataIn, updateLocalVariable(dataIn.iname); } -void CdbEngine::handleAddWatch(const CdbExtensionCommandPtr &reply) +void CdbEngine::handleAddWatch(const CdbCommandPtr &reply, WatchData item) { - WatchData item = qvariant_cast<WatchData>(reply->cookie); if (debugWatches) qDebug() << "handleAddWatch ok=" << reply->success << item.iname; if (reply->success) { @@ -1089,8 +1053,8 @@ void CdbEngine::updateLocalVariable(const QByteArray &iname) str << blankSeparator << stackFrame; } str << blankSeparator << iname; - postExtensionCommand(isWatch ? "watches" : "locals", - localsArguments, 0, &CdbEngine::handleLocals); + postExtensionCommand(isWatch ? "watches" : "locals", localsArguments, 0, + [this](const CdbCommandPtr &r) { handleLocals(r, 0); }); } bool CdbEngine::hasCapability(unsigned cap) const @@ -1225,7 +1189,7 @@ void CdbEngine::executeRunToLine(const ContextData &data) bp.lineNumber = data.lineNumber; } postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true), - 0, &CdbEngine::handleBreakInsert); + 0, CB(handleBreakInsert)); continueInferior(); } @@ -1236,7 +1200,7 @@ void CdbEngine::executeRunToFunction(const QString &functionName) bp.functionName = functionName; postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true), - 0, &CdbEngine::handleBreakInsert); + 0, CB(handleBreakInsert)); continueInferior(); } @@ -1261,8 +1225,7 @@ void CdbEngine::executeJumpToLine(const ContextData &data) QByteArray cmd; ByteArrayInputStream str(cmd); str << "? `" << QDir::toNativeSeparators(data.fileName) << ':' << data.lineNumber << '`'; - const QVariant cookie = qVariantFromValue(data); - postBuiltinCommand(cmd, 0, &CdbEngine::handleJumpToLineAddressResolution, 0, cookie); + postBuiltinCommand(cmd, 0, [this, data](const CdbCommandPtr &r) { handleJumpToLineAddressResolution(r, data); }); } } @@ -1279,13 +1242,13 @@ void CdbEngine::jumpToAddress(quint64 address) postCommand(registerCmd, 0); } -void CdbEngine::handleJumpToLineAddressResolution(const CdbBuiltinCommandPtr &cmd) +void CdbEngine::handleJumpToLineAddressResolution(const CdbCommandPtr &cmd, const ContextData &context) { - if (cmd->reply.isEmpty()) + if (cmd->builtinReply.isEmpty()) return; // Evaluate expression: 5365511549 = 00000001`3fcf357d // Set register 'rip' to hex address and goto lcoation - QByteArray answer = cmd->reply.front().trimmed(); + QByteArray answer = cmd->builtinReply.front().trimmed(); const int equalPos = answer.indexOf(" = "); if (equalPos == -1) return; @@ -1296,10 +1259,8 @@ void CdbEngine::handleJumpToLineAddressResolution(const CdbBuiltinCommandPtr &cm bool ok; const quint64 address = answer.toLongLong(&ok, 16); if (ok && address) { - QTC_ASSERT(cmd->cookie.canConvert<ContextData>(), return); - const ContextData cookie = qvariant_cast<ContextData>(cmd->cookie); jumpToAddress(address); - gotoLocation(Location(cookie.fileName, cookie.lineNumber)); + gotoLocation(Location(context.fileName, context.lineNumber)); } } @@ -1349,13 +1310,13 @@ void CdbEngine::assignValueInDebugger(const WatchData *w, const QString &expr, c updateLocals(); } -void CdbEngine::handleThreads(const CdbExtensionCommandPtr &reply) +void CdbEngine::handleThreads(const CdbCommandPtr &reply) { if (debug) qDebug("CdbEngine::handleThreads success=%d", reply->success); if (reply->success) { GdbMi data; - data.fromString(reply->reply); + data.fromString(reply->extensionReply); threadsHandler()->updateThreads(data); // Continue sequence postCommandSequence(reply->commandSequence); @@ -1385,9 +1346,8 @@ void CdbEngine::postCommand(const QByteArray &cmd, unsigned flags) // In order to catch the output, it is enclosed in 'echo' commands // printing a specially formatted token to be identifiable in the output. void CdbEngine::postBuiltinCommand(const QByteArray &cmd, unsigned flags, - BuiltinCommandHandler handler, - unsigned nextCommandFlag, - const QVariant &cookie) + CommandHandler handler, + unsigned nextCommandFlag) { if (!m_accessible) { const QString msg = QString::fromLatin1("Attempt to issue builtin command \"%1\" to non-accessible session (%2)") @@ -1399,7 +1359,7 @@ void CdbEngine::postBuiltinCommand(const QByteArray &cmd, unsigned flags, showMessage(QString::fromLocal8Bit(cmd), LogInput); const int token = m_nextCommandToken++; - CdbBuiltinCommandPtr pendingCommand(new CdbBuiltinCommand(cmd, token, flags, handler, nextCommandFlag, cookie)); + CdbCommandPtr pendingCommand(new CdbCommand(true, cmd, token, flags, handler, nextCommandFlag)); m_builtinCommandQueue.push_back(pendingCommand); // Enclose command in echo-commands for token @@ -1408,8 +1368,8 @@ void CdbEngine::postBuiltinCommand(const QByteArray &cmd, unsigned flags, str << ".echo \"" << m_tokenPrefix << token << "<\"\n" << cmd << "\n.echo \"" << m_tokenPrefix << token << ">\"\n"; if (debug) - qDebug("CdbEngine::postBuiltinCommand %dms '%s' flags=%u token=%d %s next=%u, cookie='%s', pending=%d, sequence=0x%x", - elapsedLogTime(), cmd.constData(), flags, token, stateName(state()), nextCommandFlag, qPrintable(cookie.toString()), + qDebug("CdbEngine::postBuiltinCommand %dms '%s' flags=%u token=%d %s next=%u, pending=%d, sequence=0x%x", + elapsedLogTime(), cmd.constData(), flags, token, stateName(state()), nextCommandFlag, m_builtinCommandQueue.size(), nextCommandFlag); if (debug > 1) qDebug("CdbEngine::postBuiltinCommand: resulting command '%s'\n", @@ -1422,9 +1382,8 @@ void CdbEngine::postBuiltinCommand(const QByteArray &cmd, unsigned flags, void CdbEngine::postExtensionCommand(const QByteArray &cmd, const QByteArray &arguments, unsigned flags, - ExtensionCommandHandler handler, - unsigned nextCommandFlag, - const QVariant &cookie) + CommandHandler handler, + unsigned nextCommandFlag) { if (!m_accessible) { const QString msg = QString::fromLatin1("Attempt to issue extension command \"%1\" to non-accessible session (%2)") @@ -1445,13 +1404,13 @@ void CdbEngine::postExtensionCommand(const QByteArray &cmd, if (!(flags & QuietCommand)) showMessage(QString::fromLocal8Bit(fullCmd), LogInput); - CdbExtensionCommandPtr pendingCommand(new CdbExtensionCommand(fullCmd, token, flags, handler, nextCommandFlag, cookie)); + CdbCommandPtr pendingCommand(new CdbCommand(false, fullCmd, token, flags, handler, nextCommandFlag)); m_extensionCommandQueue.push_back(pendingCommand); // Enclose command in echo-commands for token if (debug) - qDebug("CdbEngine::postExtensionCommand %dms '%s' flags=%u token=%d %s next=%u, cookie='%s', pending=%d, sequence=0x%x", - elapsedLogTime(), fullCmd.constData(), flags, token, stateName(state()), nextCommandFlag, qPrintable(cookie.toString()), + qDebug("CdbEngine::postExtensionCommand %dms '%s' flags=%u token=%d %s next=%u, pending=%d, sequence=0x%x", + elapsedLogTime(), fullCmd.constData(), flags, token, stateName(state()), nextCommandFlag, m_extensionCommandQueue.size(), nextCommandFlag); m_process.write(fullCmd + '\n'); } @@ -1547,8 +1506,7 @@ void CdbEngine::updateLocals(bool forNewStackFrame) const int flags = forNewStackFrame ? LocalsUpdateForNewFrame : 0; str << blankSeparator << frameIndex; postExtensionCommand("locals", arguments, 0, - &CdbEngine::handleLocals, 0, - QVariant(flags)); + [this, flags](const CdbCommandPtr &r) { handleLocals(r, flags); }); } void CdbEngine::selectThread(ThreadId threadId) @@ -1559,7 +1517,7 @@ void CdbEngine::selectThread(ThreadId threadId) threadsHandler()->setCurrentThread(threadId); const QByteArray cmd = '~' + QByteArray::number(threadId.raw()) + " s"; - postBuiltinCommand(cmd, 0, &CdbEngine::dummyHandler, CommandListStack); + postBuiltinCommand(cmd, 0, CB(dummyHandler), CommandListStack); } // Default address range for showing disassembly. @@ -1576,7 +1534,6 @@ enum { DisassemblerRange = 512 }; void CdbEngine::fetchDisassembler(DisassemblerAgent *agent) { QTC_ASSERT(m_accessible, return); - const QVariant cookie = qVariantFromValue<DisassemblerAgent*>(agent); const Location location = agent->location(); if (debug) qDebug() << "CdbEngine::fetchDisassembler 0x" @@ -1585,48 +1542,46 @@ void CdbEngine::fetchDisassembler(DisassemblerAgent *agent) if (!location.functionName().isEmpty()) { // Resolve function (from stack frame with function and address // or just function from editor). - postResolveSymbol(location.from(), location.functionName(), cookie); + postResolveSymbol(location.from(), location.functionName(), agent); } else if (location.address()) { // No function, display a default range. - postDisassemblerCommand(location.address(), cookie); + postDisassemblerCommand(location.address(), agent); } else { QTC_ASSERT(false, return); } } -void CdbEngine::postDisassemblerCommand(quint64 address, const QVariant &cookie) +void CdbEngine::postDisassemblerCommand(quint64 address, DisassemblerAgent *agent) { postDisassemblerCommand(address - DisassemblerRange / 2, - address + DisassemblerRange / 2, cookie); + address + DisassemblerRange / 2, agent); } void CdbEngine::postDisassemblerCommand(quint64 address, quint64 endAddress, - const QVariant &cookie) + DisassemblerAgent *agent) { QByteArray cmd; ByteArrayInputStream str(cmd); str << "u " << hex <<hexPrefixOn << address << ' ' << endAddress; - postBuiltinCommand(cmd, 0, &CdbEngine::handleDisassembler, 0, cookie); + postBuiltinCommand(cmd, 0, + [this, agent](const CdbCommandPtr &r) { handleDisassembler(r, agent); }); } void CdbEngine::postResolveSymbol(const QString &module, const QString &function, - const QVariant &cookie) + DisassemblerAgent *agent) { QString symbol = module.isEmpty() ? QString(QLatin1Char('*')) : module; symbol += QLatin1Char('!'); symbol += function; const QList<quint64> addresses = m_symbolAddressCache.values(symbol); if (addresses.isEmpty()) { - QVariantList cookieList; - cookieList << QVariant(symbol) << cookie; showMessage(QLatin1String("Resolving symbol: ") + symbol + QLatin1String("..."), LogMisc); postBuiltinCommand(QByteArray("x ") + symbol.toLatin1(), 0, - &CdbEngine::handleResolveSymbol, 0, - QVariant(cookieList)); + [this, symbol, agent](const CdbCommandPtr &r) { handleResolveSymbol(r, symbol, agent); }); } else { showMessage(QString::fromLatin1("Using cached addresses for %1."). arg(symbol), LogMisc); - handleResolveSymbol(addresses, cookie); + handleResolveSymbolHelper(addresses, agent); } } @@ -1647,15 +1602,13 @@ static inline quint64 resolvedAddress(const QByteArray &line) return 0; } -void CdbEngine::handleResolveSymbol(const CdbBuiltinCommandPtr &command) +void CdbEngine::handleResolveSymbol(const CdbCommandPtr &command, const QString &symbol, + DisassemblerAgent *agent) { - QTC_ASSERT(command->cookie.type() == QVariant::List, return; ); - const QVariantList cookieList = command->cookie.toList(); - const QString symbol = cookieList.front().toString(); // Insert all matches of (potentially) ambiguous symbols - if (const int size = command->reply.size()) { + if (const int size = command->builtinReply.size()) { for (int i = 0; i < size; i++) { - if (const quint64 address = resolvedAddress(command->reply.at(i))) { + if (const quint64 address = resolvedAddress(command->builtinReply.at(i))) { m_symbolAddressCache.insert(symbol, address); showMessage(QString::fromLatin1("Obtained 0x%1 for %2 (#%3)"). arg(address, 0, 16).arg(symbol).arg(i + 1), LogMisc); @@ -1666,7 +1619,7 @@ void CdbEngine::handleResolveSymbol(const CdbBuiltinCommandPtr &command) + QString::fromLatin1(command->joinedReply()), LogError); } - handleResolveSymbol(m_symbolAddressCache.values(symbol), cookieList.back()); + handleResolveSymbolHelper(m_symbolAddressCache.values(symbol), agent); } // Find the function address matching needle in a list of function @@ -1714,52 +1667,46 @@ static inline QString msgAmbiguousFunction(const QString &functionName, return result; } -void CdbEngine::handleResolveSymbol(const QList<quint64> &addresses, const QVariant &cookie) +void CdbEngine::handleResolveSymbolHelper(const QList<quint64> &addresses, DisassemblerAgent *agent) { // Disassembly mode: Determine suitable range containing the // agent's address within the function to display. - if (cookie.canConvert<DisassemblerAgent*>()) { - DisassemblerAgent *agent = cookie.value<DisassemblerAgent *>(); - const quint64 agentAddress = agent->address(); - quint64 functionAddress = 0; - quint64 endAddress = 0; - if (agentAddress) { - // We have an address from the agent, find closest. - if (const quint64 closest = findClosestFunctionAddress(addresses, agentAddress)) { - if (closest <= agentAddress) { - functionAddress = closest; - endAddress = agentAddress + DisassemblerRange / 2; - } - } - } else { - // No agent address, disassembly was started with a function name only. - if (!addresses.isEmpty()) { - functionAddress = addresses.first(); - endAddress = functionAddress + DisassemblerRange / 2; - if (addresses.size() > 1) - showMessage(msgAmbiguousFunction(agent->location().functionName(), functionAddress, addresses), LogMisc); + const quint64 agentAddress = agent->address(); + quint64 functionAddress = 0; + quint64 endAddress = 0; + if (agentAddress) { + // We have an address from the agent, find closest. + if (const quint64 closest = findClosestFunctionAddress(addresses, agentAddress)) { + if (closest <= agentAddress) { + functionAddress = closest; + endAddress = agentAddress + DisassemblerRange / 2; } } - // Disassemble a function, else use default range around agent address - if (functionAddress) { - if (const quint64 remainder = endAddress % 8) - endAddress += 8 - remainder; - postDisassemblerCommand(functionAddress, endAddress, cookie); - } else if (agentAddress) { - postDisassemblerCommand(agentAddress, cookie); - } else { - QTC_ASSERT(false, return); + } else { + // No agent address, disassembly was started with a function name only. + if (!addresses.isEmpty()) { + functionAddress = addresses.first(); + endAddress = functionAddress + DisassemblerRange / 2; + if (addresses.size() > 1) + showMessage(msgAmbiguousFunction(agent->location().functionName(), functionAddress, addresses), LogMisc); } - return; - } // DisassemblerAgent + } + // Disassemble a function, else use default range around agent address + if (functionAddress) { + if (const quint64 remainder = endAddress % 8) + endAddress += 8 - remainder; + postDisassemblerCommand(functionAddress, endAddress, agent); + } else if (agentAddress) { + postDisassemblerCommand(agentAddress, agent); + } else { + QTC_CHECK(false); + } } // Parse: "00000000`77606060 cc int 3" -void CdbEngine::handleDisassembler(const CdbBuiltinCommandPtr &command) +void CdbEngine::handleDisassembler(const CdbCommandPtr &command, DisassemblerAgent *agent) { - QTC_ASSERT(command->cookie.canConvert<DisassemblerAgent*>(), return); - DisassemblerAgent *agent = qvariant_cast<DisassemblerAgent*>(command->cookie); - agent->setContents(parseCdbDisassembler(command->reply)); + agent->setContents(parseCdbDisassembler(command->builtinReply)); } void CdbEngine::fetchMemory(MemoryAgent *agent, QObject *editor, quint64 addr, quint64 length) @@ -1778,8 +1725,8 @@ void CdbEngine::postFetchMemory(const MemoryViewCookie &cookie) QByteArray args; ByteArrayInputStream str(args); str << cookie.address << ' ' << cookie.length; - postExtensionCommand("memory", args, 0, &CdbEngine::handleMemory, 0, - qVariantFromValue(cookie)); + postExtensionCommand("memory", args, 0, + [this, cookie](const CdbCommandPtr &r) { handleMemory(r, cookie); }); } void CdbEngine::changeMemory(Internal::MemoryAgent *, QObject *, quint64 addr, const QByteArray &data) @@ -1793,12 +1740,10 @@ void CdbEngine::changeMemory(Internal::MemoryAgent *, QObject *, quint64 addr, c } } -void CdbEngine::handleMemory(const CdbExtensionCommandPtr &command) +void CdbEngine::handleMemory(const CdbCommandPtr &command, const MemoryViewCookie &memViewCookie) { - QTC_ASSERT(command->cookie.canConvert<MemoryViewCookie>(), return); - const MemoryViewCookie memViewCookie = qvariant_cast<MemoryViewCookie>(command->cookie); if (command->success && memViewCookie.agent) { - const QByteArray data = QByteArray::fromBase64(command->reply); + const QByteArray data = QByteArray::fromBase64(command->extensionReply); if (unsigned(data.size()) == memViewCookie.length) memViewCookie.agent->addLazyData(memViewCookie.editorToken, memViewCookie.address, data); @@ -1841,11 +1786,11 @@ void CdbEngine::reloadFullStack() postCommandSequence(CommandListStack); } -void CdbEngine::handlePid(const CdbExtensionCommandPtr &reply) +void CdbEngine::handlePid(const CdbCommandPtr &reply) { // Fails for core dumps. if (reply->success) - notifyInferiorPid(reply->reply.toULongLong()); + notifyInferiorPid(reply->extensionReply.toULongLong()); if (reply->success || startParameters().startMode == AttachCore) { STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSetupOk") notifyInferiorSetupOk(); @@ -1857,11 +1802,11 @@ void CdbEngine::handlePid(const CdbExtensionCommandPtr &reply) } } -void CdbEngine::handleModules(const CdbExtensionCommandPtr &reply) +void CdbEngine::handleModules(const CdbCommandPtr &reply) { if (reply->success) { GdbMi value; - value.fromString(reply->reply); + value.fromString(reply->extensionReply); if (value.type() == GdbMi::List) { ModulesHandler *handler = modulesHandler(); handler->beginUpdateAll(); @@ -1878,7 +1823,7 @@ void CdbEngine::handleModules(const CdbExtensionCommandPtr &reply) handler->endUpdateAll(); } else { showMessage(QString::fromLatin1("Parse error in modules response."), LogError); - qWarning("Parse error in modules response:\n%s", reply->reply.constData()); + qWarning("Parse error in modules response:\n%s", reply->extensionReply.constData()); } } else { showMessage(QString::fromLatin1("Failed to determine modules: %1"). @@ -1888,11 +1833,11 @@ void CdbEngine::handleModules(const CdbExtensionCommandPtr &reply) } -void CdbEngine::handleRegisters(const CdbExtensionCommandPtr &reply) +void CdbEngine::handleRegistersExt(const CdbCommandPtr &reply) { if (reply->success) { GdbMi value; - value.fromString(reply->reply); + value.fromString(reply->extensionReply); if (value.type() == GdbMi::List) { RegisterHandler *handler = registerHandler(); foreach (const GdbMi &item, value.children()) { @@ -1907,7 +1852,7 @@ void CdbEngine::handleRegisters(const CdbExtensionCommandPtr &reply) handler->commitUpdates(); } else { showMessage(QString::fromLatin1("Parse error in registers response."), LogError); - qWarning("Parse error in registers response:\n%s", reply->reply.constData()); + qWarning("Parse error in registers response:\n%s", reply->extensionReply.constData()); } } else { showMessage(QString::fromLatin1("Failed to determine registers: %1"). @@ -1916,12 +1861,11 @@ void CdbEngine::handleRegisters(const CdbExtensionCommandPtr &reply) postCommandSequence(reply->commandSequence); } -void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply) +void CdbEngine::handleLocals(const CdbCommandPtr &reply, int flags) { - const int flags = reply->cookie.toInt(); if (reply->success) { if (boolSetting(VerboseLog)) - showMessage(QLatin1String("Locals: ") + QString::fromLatin1(reply->reply), LogDebug); + showMessage(QLatin1String("Locals: ") + QString::fromLatin1(reply->extensionReply), LogDebug); QList<WatchData> watchData; WatchHandler *handler = watchHandler(); if (flags & LocalsUpdateForNewFrame) { @@ -1929,7 +1873,7 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply) watchData.append(*handler->findData("watch")); } GdbMi root; - root.fromString(reply->reply); + root.fromString(reply->extensionReply); QTC_ASSERT(root.isList(), return); if (debugLocals) qDebug() << root.toString(true, 4); @@ -1965,7 +1909,7 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply) } } -void CdbEngine::handleExpandLocals(const CdbExtensionCommandPtr &reply) +void CdbEngine::handleExpandLocals(const CdbCommandPtr &reply) { if (!reply->success) showMessage(QString::fromLatin1(reply->errorMessage), LogError); @@ -2098,7 +2042,7 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason, QString::number(threadId)); ConditionalBreakPointCookie cookie(id); cookie.stopReason = stopReason; - evaluateExpression(parameters.condition, qVariantFromValue(cookie)); + evaluateExpression(parameters.condition, cookie); return StopReportLog; } } else { @@ -2260,8 +2204,8 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT executeStepOut(); return; case ParseStackWow64: - postBuiltinCommand("lm m wow64", 0, &CdbEngine::handleCheckWow64, - 0, qVariantFromValue(stack)); + postBuiltinCommand("lm m wow64", 0, + [this, stack](const CdbCommandPtr &r) { handleCheckWow64(r, stack); }); break; } } else { @@ -2290,9 +2234,9 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT showStoppedByExceptionMessageBox(exceptionBoxMessage); } -void CdbEngine::handleBreakInsert(const CdbBuiltinCommandPtr &cmd) +void CdbEngine::handleBreakInsert(const CdbCommandPtr &cmd) { - const QList<QByteArray> &reply = cmd->reply; + const QList<QByteArray> &reply = cmd->builtinReply; if (reply.isEmpty()) return; foreach (const QByteArray &line, reply) @@ -2354,49 +2298,47 @@ void CdbEngine::handleBreakInsert(const CdbBuiltinCommandPtr &cmd) attemptBreakpointSynchronization(); } -void CdbEngine::handleCheckWow64(const CdbBuiltinCommandPtr &cmd) +void CdbEngine::handleCheckWow64(const CdbCommandPtr &cmd, const GdbMi &stack) { // Using the lm (list modules) command to check if there is a 32 bit subsystem in this debuggee. // expected reply if there is a 32 bit stack: // start end module name // 00000000`77490000 00000000`774d5000 wow64 (deferred) - if (cmd->reply.value(1).contains("wow64")) { - postBuiltinCommand("k", 0, &CdbEngine::ensureUsing32BitStackInWow64, 0, cmd->cookie); + if (cmd->builtinReply.value(1).contains("wow64")) { + postBuiltinCommand("k", 0, + [this, stack](const CdbCommandPtr &r) { ensureUsing32BitStackInWow64(r, stack); }); return; } m_wow64State = noWow64Stack; - if (cmd->cookie.canConvert<GdbMi>()) - parseStackTrace(qvariant_cast<GdbMi>(cmd->cookie), false); + parseStackTrace(stack, false); } -void CdbEngine::ensureUsing32BitStackInWow64(const CdbEngine::CdbBuiltinCommandPtr &cmd) +void CdbEngine::ensureUsing32BitStackInWow64(const CdbEngine::CdbCommandPtr &cmd, const GdbMi &stack) { // Parsing the header of the stack output to check which bitness // the cdb is currently using. - foreach (const QByteArray &line, cmd->reply) { + foreach (const QByteArray &line, cmd->builtinReply) { if (!line.startsWith("Child")) continue; if (line.startsWith("ChildEBP")) { m_wow64State = wow64Stack32Bit; - if (cmd->cookie.canConvert<GdbMi>()) - parseStackTrace(qvariant_cast<GdbMi>(cmd->cookie), false); + parseStackTrace(stack, false); return; } else if (line.startsWith("Child-SP")) { m_wow64State = wow64Stack64Bit; - postBuiltinCommand("!wow64exts.sw", 0, &CdbEngine::handleSwitchWow64Stack); + postBuiltinCommand("!wow64exts.sw", 0, CB(handleSwitchWow64Stack)); return; } } m_wow64State = noWow64Stack; - if (cmd->cookie.canConvert<GdbMi>()) - parseStackTrace(qvariant_cast<GdbMi>(cmd->cookie), false); + parseStackTrace(stack, false); } -void CdbEngine::handleSwitchWow64Stack(const CdbEngine::CdbBuiltinCommandPtr &cmd) +void CdbEngine::handleSwitchWow64Stack(const CdbEngine::CdbCommandPtr &cmd) { - if (cmd->reply.first() == "Switched to 32bit mode") + if (cmd->builtinReply.first() == "Switched to 32bit mode") m_wow64State = wow64Stack32Bit; - else if (cmd->reply.first() == "Switched to 64bit mode") + else if (cmd->builtinReply.first() == "Switched to 64bit mode") m_wow64State = wow64Stack64Bit; else m_wow64State = noWow64Stack; @@ -2488,10 +2430,10 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what const int index = indexOfCommand(m_extensionCommandQueue, token); if (index != -1) { // Did the command finish? Take off queue and complete, invoke CB - const CdbExtensionCommandPtr command = m_extensionCommandQueue.takeAt(index); + const CdbCommandPtr command = m_extensionCommandQueue.takeAt(index); if (t == 'R') { command->success = true; - command->reply = message; + command->extensionReply = message; } else { command->success = false; command->errorMessage = message; @@ -2500,7 +2442,7 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what qDebug("### Completed extension command '%s', token=%d, pending=%d", command->command.constData(), command->token, m_extensionCommandQueue.size()); if (command->handler) - (this->*(command->handler))(command); + command->handler(command); return; } } @@ -2562,8 +2504,6 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what } return; } - - return; } // Check for a CDB prompt '0:000> ' ('process:thread> ')..no regexps for QByteArray... @@ -2652,21 +2592,21 @@ void CdbEngine::parseOutputLine(QByteArray line) // command, trigger handler and finish, else append to its output. if (m_currentBuiltinCommandIndex != -1) { QTC_ASSERT(!isStartToken && m_currentBuiltinCommandIndex < m_builtinCommandQueue.size(), return; ); - const CdbBuiltinCommandPtr ¤tCommand = m_builtinCommandQueue.at(m_currentBuiltinCommandIndex); + const CdbCommandPtr ¤tCommand = m_builtinCommandQueue.at(m_currentBuiltinCommandIndex); if (isCommandToken) { // Did the command finish? Invoke callback and remove from queue. if (debug) qDebug("### Completed builtin command '%s', token=%d, %d lines, pending=%d", currentCommand->command.constData(), currentCommand->token, - currentCommand->reply.size(), m_builtinCommandQueue.size() - 1); + currentCommand->builtinReply.size(), m_builtinCommandQueue.size() - 1); QTC_ASSERT(token == currentCommand->token, return; ); if (currentCommand->handler) - (this->*(currentCommand->handler))(currentCommand); + currentCommand->handler(currentCommand); m_builtinCommandQueue.removeAt(m_currentBuiltinCommandIndex); m_currentBuiltinCommandIndex = -1; } else { // Record output of current command - currentCommand->reply.push_back(line); + currentCommand->builtinReply.push_back(line); } return; } // m_currentCommandIndex @@ -2675,7 +2615,7 @@ void CdbEngine::parseOutputLine(QByteArray line) const int index = indexOfCommand(m_builtinCommandQueue, token); QTC_ASSERT(isStartToken && index != -1, return; ); m_currentBuiltinCommandIndex = index; - const CdbBuiltinCommandPtr ¤tCommand = m_builtinCommandQueue.at(m_currentBuiltinCommandIndex); + const CdbCommandPtr ¤tCommand = m_builtinCommandQueue.at(m_currentBuiltinCommandIndex); if (debug) qDebug("### Gathering output for '%s' token %d", currentCommand->command.constData(), currentCommand->token); return; @@ -2907,11 +2847,11 @@ void CdbEngine::attemptBreakpointSynchronization() response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber); postBuiltinCommand( cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false), 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); } else { postBuiltinCommand( cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false), 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); } if (!parameters.enabled) postCommand("bd " + QByteArray::number(breakPointIdToCdbId(id)), 0); @@ -2944,7 +2884,7 @@ void CdbEngine::attemptBreakpointSynchronization() postCommand(cdbClearBreakpointCommand(id), 0); postBuiltinCommand( cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false), 0, - &CdbEngine::handleBreakInsert); + CB(handleBreakInsert)); m_pendingBreakpointMap.insert(id, response); } bp.notifyBreakpointChangeOk(); @@ -3084,10 +3024,10 @@ unsigned CdbEngine::parseStackTrace(const GdbMi &data, bool sourceStepInto) void CdbEngine::loadAdditionalQmlStack() { - postExtensionCommand("qmlstack", QByteArray(), 0, &CdbEngine::handleAdditionalQmlStack); + postExtensionCommand("qmlstack", QByteArray(), 0, CB(handleAdditionalQmlStack)); } -void CdbEngine::handleAdditionalQmlStack(const CdbExtensionCommandPtr &reply) +void CdbEngine::handleAdditionalQmlStack(const CdbCommandPtr &reply) { QString errorMessage; do { @@ -3096,7 +3036,7 @@ void CdbEngine::handleAdditionalQmlStack(const CdbExtensionCommandPtr &reply) break; } GdbMi stackGdbMi; - stackGdbMi.fromString(reply->reply); + stackGdbMi.fromString(reply->extensionReply); if (!stackGdbMi.isValid()) { errorMessage = QLatin1String("GDBMI parser error"); break; @@ -3126,14 +3066,14 @@ void CdbEngine::mergeStartParametersSourcePathMap() } } -void CdbEngine::handleStackTrace(const CdbExtensionCommandPtr &command) +void CdbEngine::handleStackTrace(const CdbCommandPtr &command) { if (command->success) { - GdbMi data; - data.fromString(command->reply); - if (parseStackTrace(data, false) == ParseStackWow64) { - postBuiltinCommand("lm m wow64", 0, &CdbEngine::handleCheckWow64, - 0, qVariantFromValue(data)); + GdbMi stack; + stack.fromString(command->extensionReply); + if (parseStackTrace(stack, false) == ParseStackWow64) { + postBuiltinCommand("lm m wow64", 0, + [this, stack](const CdbCommandPtr &r) { handleCheckWow64(r, stack); }); } postCommandSequence(command->commandSequence); } else { @@ -3141,40 +3081,38 @@ void CdbEngine::handleStackTrace(const CdbExtensionCommandPtr &command) } } -void CdbEngine::handleExpression(const CdbExtensionCommandPtr &command) +void CdbEngine::handleExpression(const CdbCommandPtr &command, const ConditionalBreakPointCookie &cookie) { int value = 0; if (command->success) - value = command->reply.toInt(); + value = command->extensionReply.toInt(); else showMessage(QString::fromLocal8Bit(command->errorMessage), LogError); // Is this a conditional breakpoint? - if (command->cookie.isValid() && command->cookie.canConvert<ConditionalBreakPointCookie>()) { - const ConditionalBreakPointCookie cookie = qvariant_cast<ConditionalBreakPointCookie>(command->cookie); - const QString message = value ? - tr("Value %1 obtained from evaluating the condition of breakpoint %2, stopping."). - arg(value).arg(cookie.id.toString()) : - tr("Value 0 obtained from evaluating the condition of breakpoint %1, continuing."). - arg(cookie.id.toString()); - showMessage(message, LogMisc); - // Stop if evaluation is true, else continue - if (value) - processStop(cookie.stopReason, true); - else - doContinueInferior(); - } + const QString message = value ? + tr("Value %1 obtained from evaluating the condition of breakpoint %2, stopping."). + arg(value).arg(cookie.id.toString()) : + tr("Value 0 obtained from evaluating the condition of breakpoint %1, continuing."). + arg(cookie.id.toString()); + showMessage(message, LogMisc); + // Stop if evaluation is true, else continue + if (value) + processStop(cookie.stopReason, true); + else + doContinueInferior(); } -void CdbEngine::evaluateExpression(QByteArray exp, const QVariant &cookie) +void CdbEngine::evaluateExpression(QByteArray exp, const ConditionalBreakPointCookie &cookie) { if (exp.contains(' ') && !exp.startsWith('"')) { exp.prepend('"'); exp.append('"'); } - postExtensionCommand("expression", exp, 0, &CdbEngine::handleExpression, 0, cookie); + postExtensionCommand("expression", exp, 0, + [this, cookie](const CdbCommandPtr &r) { handleExpression(r, cookie); }); } -void CdbEngine::dummyHandler(const CdbBuiltinCommandPtr &command) +void CdbEngine::dummyHandler(const CdbCommandPtr &command) { postCommandSequence(command->commandSequence); } @@ -3188,30 +3126,30 @@ void CdbEngine::postCommandSequence(unsigned mask) if (!mask) return; if (mask & CommandListThreads) { - postExtensionCommand("threads", QByteArray(), 0, &CdbEngine::handleThreads, mask & ~CommandListThreads); + postExtensionCommand("threads", QByteArray(), 0, CB(handleThreads), mask & ~CommandListThreads); return; } if (mask & CommandListStack) { - postExtensionCommand("stack", "unlimited", 0, &CdbEngine::handleStackTrace, mask & ~CommandListStack); + postExtensionCommand("stack", "unlimited", 0, CB(handleStackTrace), mask & ~CommandListStack); return; } if (mask & CommandListRegisters) { QTC_ASSERT(threadsHandler()->currentThreadIndex() >= 0, return); - postExtensionCommand("registers", QByteArray(), 0, &CdbEngine::handleRegisters, mask & ~CommandListRegisters); + postExtensionCommand("registers", QByteArray(), 0, CB(handleRegistersExt), mask & ~CommandListRegisters); return; } if (mask & CommandListModules) { - postExtensionCommand("modules", QByteArray(), 0, &CdbEngine::handleModules, mask & ~CommandListModules); + postExtensionCommand("modules", QByteArray(), 0, CB(handleModules), mask & ~CommandListModules); return; } if (mask & CommandListBreakPoints) { postExtensionCommand("breakpoints", QByteArray("-v"), 0, - &CdbEngine::handleBreakPoints, mask & ~CommandListBreakPoints); + CB(handleBreakPoints), mask & ~CommandListBreakPoints); return; } } -void CdbEngine::handleWidgetAt(const CdbExtensionCommandPtr &reply) +void CdbEngine::handleWidgetAt(const CdbCommandPtr &reply) { bool success = false; QString message; @@ -3221,7 +3159,7 @@ void CdbEngine::handleWidgetAt(const CdbExtensionCommandPtr &reply) break; } // Should be "namespace::QWidget:0x555" - QString watchExp = QString::fromLatin1(reply->reply); + QString watchExp = QString::fromLatin1(reply->extensionReply); const int sepPos = watchExp.lastIndexOf(QLatin1Char(':')); if (sepPos == -1) { message = QString::fromLatin1("Invalid output: %1").arg(watchExp); @@ -3261,16 +3199,16 @@ static inline void formatCdbBreakPointResponse(BreakpointModelId id, const Break str << '\n'; } -void CdbEngine::handleBreakPoints(const CdbExtensionCommandPtr &reply) +void CdbEngine::handleBreakPoints(const CdbCommandPtr &reply) { if (debugBreakpoints) - qDebug("CdbEngine::handleBreakPoints: success=%d: %s", reply->success, reply->reply.constData()); + qDebug("CdbEngine::handleBreakPoints: success=%d: %s", reply->success, reply->extensionReply.constData()); if (!reply->success) { showMessage(QString::fromLatin1(reply->errorMessage), LogError); return; } GdbMi value; - value.fromString(reply->reply); + value.fromString(reply->extensionReply); if (value.type() != GdbMi::List) { showMessage(QString::fromLatin1("Unabled to parse breakpoints reply"), LogError); return; @@ -3364,7 +3302,7 @@ void CdbEngine::postWidgetAtCommand() QByteArray arguments = QByteArray::number(m_watchPointX); arguments.append(' '); arguments.append(QByteArray::number(m_watchPointY)); - postExtensionCommand("widgetat", arguments, 0, &CdbEngine::handleWidgetAt, 0); + postExtensionCommand("widgetat", arguments, 0, CB(handleWidgetAt)); } void CdbEngine::handleCustomSpecialStop(const QVariant &v) diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index ce7f263e63e..b7f455161f4 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -42,14 +42,16 @@ #include <QVariant> #include <QTime> +#include <functional> + namespace Utils { class ConsoleProcess; } namespace Debugger { namespace Internal { class DisassemblerAgent; -struct CdbBuiltinCommand; -struct CdbExtensionCommand; +struct CdbCommand; struct MemoryViewCookie; +struct ConditionalBreakPointCookie; class ByteArrayInputStream; class GdbMi; @@ -68,10 +70,8 @@ public: CommandListBreakPoints = 0x10 }; - typedef QSharedPointer<CdbBuiltinCommand> CdbBuiltinCommandPtr; - typedef QSharedPointer<CdbExtensionCommand> CdbExtensionCommandPtr; - typedef void (CdbEngine::*BuiltinCommandHandler)(const CdbBuiltinCommandPtr &); - typedef void (CdbEngine::*ExtensionCommandHandler)(const CdbExtensionCommandPtr &); + typedef QSharedPointer<CdbCommand> CdbCommandPtr; + typedef std::function<void(const CdbCommandPtr &)> CommandHandler; CdbEngine(const DebuggerStartParameters &sp); ~CdbEngine(); @@ -139,16 +139,14 @@ private slots: void postCommand(const QByteArray &cmd, unsigned flags); void postBuiltinCommand(const QByteArray &cmd, unsigned flags, - BuiltinCommandHandler handler, - unsigned nextCommandFlag = 0, - const QVariant &cookie = QVariant()); + CommandHandler handler, + unsigned nextCommandFlag = 0); void postExtensionCommand(const QByteArray &cmd, const QByteArray &arguments, unsigned flags, - ExtensionCommandHandler handler, - unsigned nextCommandFlag = 0, - const QVariant &cookie = QVariant()); + CommandHandler handler, + unsigned nextCommandFlag = 0); void postCommandSequence(unsigned mask); void operateByInstructionTriggered(bool); @@ -212,41 +210,41 @@ private: void postWidgetAtCommand(); void handleCustomSpecialStop(const QVariant &v); void postFetchMemory(const MemoryViewCookie &c); - inline void postDisassemblerCommand(quint64 address, const QVariant &cookie = QVariant()); + inline void postDisassemblerCommand(quint64 address, DisassemblerAgent *agent); void postDisassemblerCommand(quint64 address, quint64 endAddress, - const QVariant &cookie = QVariant()); + DisassemblerAgent *agent); void postResolveSymbol(const QString &module, const QString &function, - const QVariant &cookie = QVariant()); - void evaluateExpression(QByteArray exp, const QVariant &cookie = QVariant()); + DisassemblerAgent *agent); + void evaluateExpression(QByteArray exp, const ConditionalBreakPointCookie &cookie); // Builtin commands - void dummyHandler(const CdbBuiltinCommandPtr &); - void handleStackTrace(const CdbExtensionCommandPtr &); - void handleRegisters(const CdbBuiltinCommandPtr &); - void handleDisassembler(const CdbBuiltinCommandPtr &); - void handleJumpToLineAddressResolution(const CdbBuiltinCommandPtr &); - void handleExpression(const CdbExtensionCommandPtr &); - void handleResolveSymbol(const CdbBuiltinCommandPtr &command); - void handleResolveSymbol(const QList<quint64> &addresses, const QVariant &cookie); - void handleBreakInsert(const CdbBuiltinCommandPtr &cmd); - void handleCheckWow64(const CdbBuiltinCommandPtr &cmd); - void ensureUsing32BitStackInWow64(const CdbBuiltinCommandPtr &cmd); - void handleSwitchWow64Stack(const CdbBuiltinCommandPtr &cmd); + void dummyHandler(const CdbCommandPtr &); + void handleStackTrace(const CdbCommandPtr &); + void handleRegisters(const CdbCommandPtr &); + void handleDisassembler(const CdbCommandPtr &, DisassemblerAgent *agent); + void handleJumpToLineAddressResolution(const CdbCommandPtr &, const ContextData &context); + void handleExpression(const CdbCommandPtr &, const ConditionalBreakPointCookie &cookie); + void handleResolveSymbol(const CdbCommandPtr &command, const QString &symbol, DisassemblerAgent *agent); + void handleResolveSymbolHelper(const QList<quint64> &addresses, DisassemblerAgent *agent); + void handleBreakInsert(const CdbCommandPtr &cmd); + void handleCheckWow64(const CdbCommandPtr &cmd, const GdbMi &stack); + void ensureUsing32BitStackInWow64(const CdbCommandPtr &cmd, const GdbMi &stack); + void handleSwitchWow64Stack(const CdbCommandPtr &cmd); void jumpToAddress(quint64 address); - void handleCreateFullBackTrace(const CdbBuiltinCommandPtr &cmd); + void handleCreateFullBackTrace(const CdbCommandPtr &cmd); // Extension commands - void handleThreads(const CdbExtensionCommandPtr &); - void handlePid(const CdbExtensionCommandPtr &reply); - void handleLocals(const CdbExtensionCommandPtr &reply); - void handleAddWatch(const CdbExtensionCommandPtr &reply); - void handleExpandLocals(const CdbExtensionCommandPtr &reply); - void handleRegisters(const CdbExtensionCommandPtr &reply); - void handleModules(const CdbExtensionCommandPtr &reply); - void handleMemory(const CdbExtensionCommandPtr &); - void handleWidgetAt(const CdbExtensionCommandPtr &); - void handleBreakPoints(const CdbExtensionCommandPtr &); + void handleThreads(const CdbCommandPtr &); + void handlePid(const CdbCommandPtr &reply); + void handleLocals(const CdbCommandPtr &reply, int flags); + void handleAddWatch(const CdbCommandPtr &reply, WatchData item); + void handleExpandLocals(const CdbCommandPtr &reply); + void handleRegistersExt(const CdbCommandPtr &reply); + void handleModules(const CdbCommandPtr &reply); + void handleMemory(const CdbCommandPtr &, const MemoryViewCookie &memViewCookie); + void handleWidgetAt(const CdbCommandPtr &); + void handleBreakPoints(const CdbCommandPtr &); void handleBreakPoints(const GdbMi &value); - void handleAdditionalQmlStack(const CdbExtensionCommandPtr &); + void handleAdditionalQmlStack(const CdbCommandPtr &); NormalizedSourceFileName sourceMapNormalizeFileNameFromDebugger(const QString &f); void updateLocalVariable(const QByteArray &iname); void updateLocals(bool forNewStackFrame = false); @@ -266,9 +264,9 @@ private: SpecialStopMode m_specialStopMode; ProjectExplorer::DeviceProcessSignalOperation::Ptr m_signalOperation; int m_nextCommandToken; - QList<CdbBuiltinCommandPtr> m_builtinCommandQueue; + QList<CdbCommandPtr> m_builtinCommandQueue; int m_currentBuiltinCommandIndex; //!< Current command whose output is recorded. - QList<CdbExtensionCommandPtr> m_extensionCommandQueue; + QList<CdbCommandPtr> m_extensionCommandQueue; QMap<QString, NormalizedSourceFileName> m_normalizedFileCache; const QByteArray m_extensionCommandPrefixBA; //!< Library name used as prefix bool m_operateByInstructionPending; //!< Creator operate by instruction action changed. diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs index 7001f560b3f..f6a49138c03 100644 --- a/src/plugins/debugger/debugger.qbs +++ b/src/plugins/debugger/debugger.qbs @@ -17,7 +17,7 @@ QtcPlugin { Depends { name: "ProjectExplorer" } Depends { name: "TextEditor" } - cpp.includePaths: base.concat(["../../shared/registryaccess"]) + cpp.includePaths: base.concat([project.sharedSourcesDir + "/registryaccess"]) pluginRecommends: [ "CppEditor" @@ -214,7 +214,7 @@ QtcPlugin { Group { name: "RegistryAccess" condition: qbs.targetOS.contains("windows") - prefix: "../../shared/registryaccess/" + prefix: project.sharedSourcesDir + "/registryaccess/" files: [ "registryaccess.cpp", "registryaccess.h", diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index a82fb84ed84..286127892ae 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -233,7 +233,7 @@ void GdbMi::parseTuple_helper(const char *&from, const char *to) //qDebug() << "\n=======\n" << qPrintable(child.toString()) << "\n========\n"; if (!child.isValid()) return; - m_children += child; + m_children.push_back(child); skipCommas(from, to); } } @@ -253,7 +253,7 @@ void GdbMi::parseList(const char *&from, const char *to) GdbMi child; child.parseResultOrValue(from, to); if (child.isValid()) - m_children += child; + m_children.push_back(child); skipCommas(from, to); } } @@ -265,7 +265,7 @@ static QByteArray ind(int indent) void GdbMi::dumpChildren(QByteArray * str, bool multiline, int indent) const { - for (int i = 0; i < m_children.size(); ++i) { + for (size_t i = 0; i < m_children.size(); ++i) { if (i != 0) { *str += ','; if (multiline) @@ -743,30 +743,6 @@ void DebuggerCommand::argHelper(const char *name, const QByteArray &data) args.append(","); } -QByteArray DebuggerCommand::toData(const QList<QByteArray> &value) -{ - QByteArray res; - foreach (const QByteArray &item, value) { - if (!res.isEmpty()) - res.append(','); - res += item; - } - return '[' + res + ']'; -} - -QByteArray DebuggerCommand::toData(const QHash<QByteArray, QByteArray> &value) -{ - QByteArray res; - QHashIterator<QByteArray, QByteArray> it(value); - while (it.hasNext()) { - it.next(); - if (!res.isEmpty()) - res.append(','); - res += '"' + it.key() + "\":" + it.value(); - } - return '{' + res + '}'; -} - void DebuggerCommand::arg(const char *name, int value) { argHelper(name, QByteArray::number(value)); diff --git a/src/plugins/debugger/debuggerprotocol.h b/src/plugins/debugger/debuggerprotocol.h index 49a0a81514a..dd16bd116b8 100644 --- a/src/plugins/debugger/debuggerprotocol.h +++ b/src/plugins/debugger/debuggerprotocol.h @@ -31,9 +31,11 @@ #ifndef DEBUGGER_PROTOCOL_H #define DEBUGGER_PROTOCOL_H -#include <QTime> +#include <QByteArray> +#include <QString> #include <functional> +#include <vector> namespace Debugger { namespace Internal { @@ -67,13 +69,10 @@ public: void beginGroup(const char *name = 0); void endGroup(); - static QByteArray toData(const QList<QByteArray> &value); - static QByteArray toData(const QHash<QByteArray, QByteArray> &value); - QByteArray function; QByteArray args; Callback callback; - QTime postTime; + uint postTime; // msecsSinceStartOfDay int flags; private: @@ -137,7 +136,7 @@ public: QByteArray m_name; QByteArray m_data; - QList<GdbMi> m_children; + std::vector<GdbMi> m_children; enum Type { Invalid, @@ -159,7 +158,7 @@ public: inline QByteArray data() const { return m_data; } - inline const QList<GdbMi> &children() const { return m_children; } + inline const std::vector<GdbMi> &children() const { return m_children; } inline int childCount() const { return m_children.size(); } const GdbMi &childAt(int index) const { return m_children[index]; } diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 56ae99126ca..6f877d6b4de 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -420,7 +420,7 @@ void GdbEngine::handleResponse(const QByteArray &buff) data.parseResultOrValue(from, to); if (data.isValid()) { //qDebug() << "parsed result:" << data.toString(); - result.m_children += data; + result.m_children.push_back(data); result.m_type = GdbMi::Tuple; } } @@ -944,7 +944,7 @@ void GdbEngine::flushCommand(const DebuggerCommand &cmd0) const int token = ++currentToken(); DebuggerCommand cmd = cmd0; - cmd.postTime = QTime::currentTime(); + cmd.postTime = QTime::currentTime().msecsSinceStartOfDay(); m_commandForToken[token] = cmd; if (cmd.flags & ConsoleCommand) cmd.function = "-interpreter-exec console \"" + cmd.function + '"'; @@ -1119,7 +1119,7 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response) if (boolSetting(LogTimeStamps)) { showMessage(_("Response time: %1: %2 s") .arg(_(cmd.function)) - .arg(cmd.postTime.msecsTo(QTime::currentTime()) / 1000.), + .arg(QTime::fromMSecsSinceStartOfDay(cmd.postTime).msecsTo(QTime::currentTime()) / 1000.), LogTime); } @@ -3441,8 +3441,8 @@ void GdbEngine::handleThreadListIds(const DebuggerResponse &response) // "72^done,{thread-ids={thread-id="2",thread-id="1"},number-of-threads="2"} // In gdb 7.1+ additionally: current-thread-id="1" ThreadsHandler *handler = threadsHandler(); - const QList<GdbMi> items = response.data["thread-ids"].children(); - for (int index = 0, n = items.size(); index != n; ++index) { + const std::vector<GdbMi> &items = response.data["thread-ids"].children(); + for (size_t index = 0, n = items.size(); index != n; ++index) { ThreadData thread; thread.id = ThreadId(items.at(index).toInt()); handler->updateThread(thread); @@ -3896,7 +3896,7 @@ void GdbEngine::handleFetchMemory(const DebuggerResponse &response, MemoryAgentC if (response.resultClass == ResultDone) { GdbMi memory = response.data["memory"]; QTC_ASSERT(memory.children().size() <= 1, return); - if (memory.children().isEmpty()) + if (memory.children().empty()) return; GdbMi memory0 = memory.children().at(0); // we asked for only one 'row' GdbMi data = memory0["data"]; diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index a93f3b94178..3ca82f6dd3f 100644 --- a/src/plugins/debugger/threadshandler.cpp +++ b/src/plugins/debugger/threadshandler.cpp @@ -461,10 +461,10 @@ void ThreadsHandler::updateThreads(const GdbMi &data) // m_currentIndex = -1; // } - const QList<GdbMi> items = data["threads"].children(); + const std::vector<GdbMi> items = data["threads"].children(); const int n = items.size(); for (int index = 0; index != n; ++index) { - const GdbMi item = items.at(index); + const GdbMi item = items[index]; const GdbMi frame = item["frame"]; ThreadData thread; thread.id = ThreadId(item["id"].toInt()); diff --git a/src/plugins/designer/designer.qbs b/src/plugins/designer/designer.qbs index 0cc3c0b514e..1029d77e83b 100644 --- a/src/plugins/designer/designer.qbs +++ b/src/plugins/designer/designer.qbs @@ -49,7 +49,7 @@ QtcPlugin { Group { name: "Shared Sources" id: sharedSources - prefix: "../../shared/designerintegrationv2/" + prefix: project.sharedSourcesDir + "/designerintegrationv2/" files: [ "formresizer.cpp", "formresizer.h", "sizehandlerect.cpp", "sizehandlerect.h", diff --git a/src/plugins/help/help.qbs b/src/plugins/help/help.qbs index af3d320666f..20d225ae6d3 100644 --- a/src/plugins/help/help.qbs +++ b/src/plugins/help/help.qbs @@ -64,7 +64,7 @@ QtcPlugin { Group { id: sharedSources name: "Shared Sources" - prefix: "../../shared/help/" + prefix: project.sharedSourcesDir + "/help/" files: [ "bookmarkdialog.ui", "bookmarkmanager.cpp", "bookmarkmanager.h", diff --git a/src/plugins/ios/ios.qbs b/src/plugins/ios/ios.qbs index 91f9c86eb9b..44924381436 100644 --- a/src/plugins/ios/ios.qbs +++ b/src/plugins/ios/ios.qbs @@ -12,7 +12,6 @@ QtcPlugin { Depends { name: "QmlDebug" } Depends { name: "Qt"; submodules: ["widgets", "xml", "network"] } - cpp.includePaths: base.concat("../../shared") cpp.frameworks: base.concat(qbs.targetOS.contains("osx") ? ["CoreFoundation", "IOKit"] : []) files: [ diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs index 5566daa83ef..a2a25ae27e2 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs +++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs @@ -16,7 +16,7 @@ QtcPlugin { Depends { name: "Qt.widgets" } cpp.includePaths: base.concat([ - "../../shared", + project.sharedSourcesDir, ]) files: [ diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index d8b90a04c0f..a043805bb26 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -117,8 +117,9 @@ public: { return operator()(a->path(), b); } bool operator()(const FileName &a, Node *b) { return operator()(a, b->path()); } + // Compare as strings to correctly detect case-only file rename bool operator()(const FileName &a, const FileName &b) - { return a < b; } + { return a.toString() < b.toString(); } }; class QmakeNodeStaticData { diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs index 950d7a7d73f..5f36819cb95 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs @@ -121,4 +121,9 @@ QtcPlugin { "qtquickapp.png", ] } + + Export { + Depends { name: "cpp" } + cpp.includePaths: [project.sharedSourcesDir] + } } diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index cac76533eb0..e5fa4d23639 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -308,6 +308,8 @@ void QmakeProjectManagerPlugin::updateRunQMakeAction() if (BuildManager::isBuilding(ProjectTree::currentProject())) enable = false; QmakeProject *pro = qobject_cast<QmakeProject *>(ProjectTree::currentProject()); + if (!pro) + pro = qobject_cast<QmakeProject *>(SessionManager::startupProject()); if (!pro || !pro->activeTarget() || !pro->activeTarget()->activeBuildConfiguration()) diff --git a/src/plugins/qmldesigner/designercore/filemanager/addarraymembervisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/addarraymembervisitor.cpp index 049fc14c9c8..47d3eb615d0 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/addarraymembervisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/addarraymembervisitor.cpp @@ -37,7 +37,7 @@ using namespace QmlDesigner::Internal; using namespace QmlJS; using namespace QmlJS::AST; -AddArrayMemberVisitor::AddArrayMemberVisitor(QmlDesigner::TextModifier &modifier, +AddArrayMemberVisitor::AddArrayMemberVisitor(TextModifier &modifier, quint32 parentLocation, const QString &propertyName, const QString &content): @@ -62,7 +62,7 @@ void AddArrayMemberVisitor::findArrayBindingAndInsert(const QString &propertyNam } } -bool AddArrayMemberVisitor::visit(QmlJS::AST::UiObjectBinding *ast) +bool AddArrayMemberVisitor::visit(UiObjectBinding *ast) { if (didRewriting()) return false; @@ -73,7 +73,7 @@ bool AddArrayMemberVisitor::visit(QmlJS::AST::UiObjectBinding *ast) return !didRewriting(); } -bool AddArrayMemberVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) +bool AddArrayMemberVisitor::visit(UiObjectDefinition *ast) { if (didRewriting()) return false; @@ -85,7 +85,7 @@ bool AddArrayMemberVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) } // FIXME: duplicate code in the QmlJS::Rewriter class, remove this -void AddArrayMemberVisitor::insertInto(QmlJS::AST::UiArrayBinding *arrayBinding) +void AddArrayMemberVisitor::insertInto(UiArrayBinding *arrayBinding) { UiObjectMember *lastMember = 0; for (UiArrayMemberList *iter = arrayBinding->members; iter; iter = iter->next) @@ -103,7 +103,7 @@ void AddArrayMemberVisitor::insertInto(QmlJS::AST::UiArrayBinding *arrayBinding) setDidRewriting(true); } -void AddArrayMemberVisitor::convertAndAdd(QmlJS::AST::UiObjectBinding *objectBinding) +void AddArrayMemberVisitor::convertAndAdd(UiObjectBinding *objectBinding) { const int indentDepth = calculateIndentDepth(objectBinding->firstSourceLocation()); const QString arrayPrefix = QStringLiteral("[\n") + addIndentation(QString(), indentDepth); diff --git a/src/plugins/qmldesigner/designercore/filemanager/addobjectvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/addobjectvisitor.cpp index 67880d5c882..39a320038e3 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/addobjectvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/addobjectvisitor.cpp @@ -37,7 +37,7 @@ using namespace QmlDesigner::Internal; using namespace QmlJS; using namespace QmlJS::AST; -AddObjectVisitor::AddObjectVisitor(QmlDesigner::TextModifier &modifier, +AddObjectVisitor::AddObjectVisitor(TextModifier &modifier, quint32 parentLocation, const QString &content, const PropertyNameList &propertyOrder): @@ -48,7 +48,7 @@ AddObjectVisitor::AddObjectVisitor(QmlDesigner::TextModifier &modifier, { } -bool AddObjectVisitor::visit(QmlJS::AST::UiObjectBinding *ast) +bool AddObjectVisitor::visit(UiObjectBinding *ast) { if (didRewriting()) return false; @@ -59,7 +59,7 @@ bool AddObjectVisitor::visit(QmlJS::AST::UiObjectBinding *ast) return !didRewriting(); } -bool AddObjectVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) +bool AddObjectVisitor::visit(UiObjectDefinition *ast) { if (didRewriting()) return false; @@ -71,7 +71,7 @@ bool AddObjectVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) } // FIXME: duplicate code in the QmlJS::Rewriter class, remove this -void AddObjectVisitor::insertInto(QmlJS::AST::UiObjectInitializer *ast) +void AddObjectVisitor::insertInto(UiObjectInitializer *ast) { UiObjectMemberList *insertAfter = searchMemberToInsertAfter(ast->members, m_propertyOrder); diff --git a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp index 6e3a53eca23..9b3421b3e8e 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp @@ -32,18 +32,16 @@ #include <qmljs/parser/qmljsast_p.h> -using namespace QmlDesigner; -using namespace QmlDesigner::Internal; -using namespace QmlJS; -using namespace QmlJS::AST; +namespace QmlDesigner { +namespace Internal { -AddPropertyVisitor::AddPropertyVisitor(QmlDesigner::TextModifier &modifier, +AddPropertyVisitor::AddPropertyVisitor(TextModifier &modifier, quint32 parentLocation, - const QmlDesigner::PropertyName &name, + const PropertyName &name, const QString &value, QmlRefactoring::PropertyType propertyType, const PropertyNameList &propertyOrder, - const QmlDesigner::TypeName &dynamicTypeName) : + const TypeName &dynamicTypeName) : QMLRewriter(modifier), m_parentLocation(parentLocation), m_name(name), @@ -85,9 +83,9 @@ bool AddPropertyVisitor::visit(QmlJS::AST::UiObjectBinding *ast) // FIXME: duplicate code in the QmlJS::Rewriter class, remove this void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializer) { - UiObjectMemberList *insertAfter = searchMemberToInsertAfter(initializer->members, m_name, m_propertyOrder); - SourceLocation endOfPreviousMember; - SourceLocation startOfNextMember; + QmlJS::AST::UiObjectMemberList *insertAfter = searchMemberToInsertAfter(initializer->members, m_name, m_propertyOrder); + QmlJS::AST::SourceLocation endOfPreviousMember; + QmlJS::AST::SourceLocation startOfNextMember; unsigned depth; if (insertAfter == 0 || insertAfter->member == 0) { @@ -168,3 +166,6 @@ void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializ setDidRewriting(true); } + +} // namespace Internal +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.h b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.h index 52243788654..c87bf57439b 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.h +++ b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.h @@ -41,13 +41,13 @@ class AddPropertyVisitor: public QMLRewriter { public: public: - AddPropertyVisitor(QmlDesigner::TextModifier &modifier, + AddPropertyVisitor(TextModifier &modifier, quint32 parentLocation, - const QmlDesigner::PropertyName &name, + const PropertyName &name, const QString &value, - QmlDesigner::QmlRefactoring::PropertyType propertyType, + QmlRefactoring::PropertyType propertyType, const PropertyNameList &propertyOrder, - const QmlDesigner::TypeName &dynamicTypeName); + const TypeName &dynamicTypeName); protected: virtual bool visit(QmlJS::AST::UiObjectDefinition *ast); @@ -62,7 +62,7 @@ private: QString m_value; QmlRefactoring::PropertyType m_propertyType; PropertyNameList m_propertyOrder; - QmlDesigner::TypeName m_dynamicTypeName; + TypeName m_dynamicTypeName; }; } // namespace Internal diff --git a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp index b9ef38ffbaf..d7d1fe6a767 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp @@ -55,7 +55,7 @@ QString ASTObjectTextExtractor::operator ()(int location) return m_text; } -bool ASTObjectTextExtractor::visit(QmlJS::AST::UiObjectBinding *ast) +bool ASTObjectTextExtractor::visit(UiObjectBinding *ast) { if (!m_text.isEmpty()) return false; @@ -66,7 +66,7 @@ bool ASTObjectTextExtractor::visit(QmlJS::AST::UiObjectBinding *ast) return m_text.isEmpty(); } -bool ASTObjectTextExtractor::visit(QmlJS::AST::UiObjectDefinition *ast) +bool ASTObjectTextExtractor::visit(UiObjectDefinition *ast) { if (!m_text.isEmpty()) return false; diff --git a/src/plugins/qmldesigner/designercore/filemanager/changeimportsvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/changeimportsvisitor.cpp index 762f488a2ae..1b9502a9131 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/changeimportsvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/changeimportsvisitor.cpp @@ -44,7 +44,7 @@ ChangeImportsVisitor::ChangeImportsVisitor(TextModifier &textModifier, QMLRewriter(textModifier), m_source(source) {} -bool ChangeImportsVisitor::add(QmlJS::AST::UiProgram *ast, const Import &import) +bool ChangeImportsVisitor::add(UiProgram *ast, const Import &import) { setDidRewriting(false); if (!ast) @@ -72,7 +72,7 @@ bool ChangeImportsVisitor::add(QmlJS::AST::UiProgram *ast, const Import &import) return true; } -bool ChangeImportsVisitor::remove(QmlJS::AST::UiProgram *ast, const Import &import) +bool ChangeImportsVisitor::remove(UiProgram *ast, const Import &import) { setDidRewriting(false); if (!ast) @@ -92,7 +92,7 @@ bool ChangeImportsVisitor::remove(QmlJS::AST::UiProgram *ast, const Import &impo return didRewriting(); } -bool ChangeImportsVisitor::equals(QmlJS::AST::UiImport *ast, const Import &import) +bool ChangeImportsVisitor::equals(UiImport *ast, const Import &import) { if (import.isLibraryImport()) return toString(ast->importUri) == import.url(); diff --git a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp index c78de14be30..d9e4bf5c7f3 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp @@ -37,7 +37,7 @@ using namespace QmlJS::AST; using namespace QmlDesigner; using namespace QmlDesigner::Internal; -ChangePropertyVisitor::ChangePropertyVisitor(QmlDesigner::TextModifier &modifier, +ChangePropertyVisitor::ChangePropertyVisitor(TextModifier &modifier, quint32 parentLocation, const QString &name, const QString &value, @@ -50,7 +50,7 @@ ChangePropertyVisitor::ChangePropertyVisitor(QmlDesigner::TextModifier &modifier { } -bool ChangePropertyVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) +bool ChangePropertyVisitor::visit(UiObjectDefinition *ast) { if (didRewriting()) return false; @@ -66,7 +66,7 @@ bool ChangePropertyVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) return !didRewriting(); } -bool ChangePropertyVisitor::visit(QmlJS::AST::UiObjectBinding *ast) +bool ChangePropertyVisitor::visit(UiObjectBinding *ast) { if (didRewriting()) return false; @@ -192,7 +192,7 @@ bool ChangePropertyVisitor::nextMemberOnSameLine(UiObjectMemberList *members) } // FIXME: duplicate code in the QmlJS::Rewriter class, remove this -void ChangePropertyVisitor::insertIntoArray(QmlJS::AST::UiArrayBinding *ast) +void ChangePropertyVisitor::insertIntoArray(UiArrayBinding *ast) { if (!ast) return; diff --git a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp index a0744bd2b94..653ad1e98db 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp @@ -46,7 +46,7 @@ FirstDefinitionFinder::FirstDefinitionFinder(const QString &text): if (!ok) { qDebug() << text; - foreach (const QmlJS::DiagnosticMessage &message, m_doc->diagnosticMessages()) + foreach (const DiagnosticMessage &message, m_doc->diagnosticMessages()) qDebug() << message.message; } @@ -81,7 +81,7 @@ void FirstDefinitionFinder::extractFirstObjectDefinition(UiObjectInitializer* as } } -bool FirstDefinitionFinder::visit(QmlJS::AST::UiObjectBinding *ast) +bool FirstDefinitionFinder::visit(UiObjectBinding *ast) { if (ast->qualifiedTypeNameId && ast->qualifiedTypeNameId->identifierToken.isValid()) { const quint32 start = ast->qualifiedTypeNameId->identifierToken.offset; @@ -94,7 +94,7 @@ bool FirstDefinitionFinder::visit(QmlJS::AST::UiObjectBinding *ast) return true; } -bool FirstDefinitionFinder::visit(QmlJS::AST::UiObjectDefinition *ast) +bool FirstDefinitionFinder::visit(UiObjectDefinition *ast) { const quint32 start = ast->firstSourceLocation().offset; diff --git a/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp index feb9cb5cb2c..472c5cfd2f8 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp @@ -60,7 +60,7 @@ MoveObjectBeforeObjectVisitor::MoveObjectBeforeObjectVisitor(TextModifier &modif beforeObjectLocation(beforeObjectLocation) {} -bool MoveObjectBeforeObjectVisitor::operator ()(QmlJS::AST::UiProgram *ast) +bool MoveObjectBeforeObjectVisitor::operator ()(UiProgram *ast) { movingObject = 0; beforeObject = 0; diff --git a/src/plugins/qmldesigner/designercore/filemanager/moveobjectvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/moveobjectvisitor.cpp index bb98ff7d729..ae371c6dc76 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/moveobjectvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/moveobjectvisitor.cpp @@ -36,15 +36,16 @@ using namespace QmlJS; using namespace QmlJS::AST; -using namespace QmlDesigner::Internal; -using namespace QmlDesigner; + +namespace QmlDesigner { +namespace Internal { class Inserter: public QMLRewriter { public: - Inserter(QmlDesigner::TextModifier &modifier, + Inserter(TextModifier &modifier, quint32 targetParentObjectLocation, - const QmlDesigner::PropertyName &targetPropertyName, + const PropertyName &targetPropertyName, bool targetIsArrayBinding, TextModifier::MoveInfo moveInfo, const PropertyNameList &propertyOrder): @@ -150,15 +151,15 @@ private: private: quint32 targetParentObjectLocation; - QmlDesigner::PropertyName targetPropertyName; + PropertyName targetPropertyName; bool targetIsArrayBinding; TextModifier::MoveInfo moveInfo; PropertyNameList propertyOrder; }; -MoveObjectVisitor::MoveObjectVisitor(QmlDesigner::TextModifier &modifier, +MoveObjectVisitor::MoveObjectVisitor(TextModifier &modifier, quint32 objectLocation, - const QmlDesigner::PropertyName &targetPropertyName, + const PropertyName &targetPropertyName, bool targetIsArrayBinding, quint32 targetParentObjectLocation, const PropertyNameList &propertyOrder): @@ -292,3 +293,6 @@ void MoveObjectVisitor::doMove(const TextModifier::MoveInfo &moveInfo) setDidRewriting(findTargetAndInsert(program)); } } + +} // namespace Internal +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp index 82f76357532..4880458750b 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp @@ -60,7 +60,7 @@ bool ObjectLengthCalculator::operator()(const QString &text, quint32 offset, } } -bool ObjectLengthCalculator::visit(QmlJS::AST::UiObjectBinding *ast) +bool ObjectLengthCalculator::visit(UiObjectBinding *ast) { if (m_length > 0) return false; @@ -80,7 +80,7 @@ bool ObjectLengthCalculator::visit(QmlJS::AST::UiObjectBinding *ast) } } -bool ObjectLengthCalculator::visit(QmlJS::AST::UiObjectDefinition *ast) +bool ObjectLengthCalculator::visit(UiObjectDefinition *ast) { if (m_length > 0) return false; diff --git a/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.cpp b/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.cpp index 6f6ebea4e67..a5514593838 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.cpp @@ -47,7 +47,7 @@ QMLRewriter::QMLRewriter(QmlDesigner::TextModifier &textModifier): { } -bool QMLRewriter::operator()(QmlJS::AST::UiProgram *ast) +bool QMLRewriter::operator()(UiProgram *ast) { setDidRewriting(false); @@ -71,7 +71,7 @@ QString QMLRewriter::textBetween(int startPosition, int endPosition) const return m_textModifier->text().mid(startPosition, endPosition - startPosition); } -QString QMLRewriter::textAt(const QmlJS::AST::SourceLocation &location) const +QString QMLRewriter::textAt(const SourceLocation &location) const { return m_textModifier->text().mid(location.offset, location.length); } @@ -154,7 +154,7 @@ QString QMLRewriter::removeIndentation(const QString &text, unsigned depth) return result; } -QmlJS::AST::SourceLocation QMLRewriter::calculateLocation(QmlJS::AST::UiQualifiedId *id) +SourceLocation QMLRewriter::calculateLocation(UiQualifiedId *id) { Q_ASSERT(id != 0); @@ -170,7 +170,7 @@ QmlJS::AST::SourceLocation QMLRewriter::calculateLocation(QmlJS::AST::UiQualifie return SourceLocation(startLocation.offset, endLocation.end() - startLocation.offset); } -bool QMLRewriter::isMissingSemicolon(QmlJS::AST::UiObjectMember *member) +bool QMLRewriter::isMissingSemicolon(UiObjectMember *member) { UiScriptBinding *binding = AST::cast<UiScriptBinding *>(member); if (binding) @@ -179,7 +179,7 @@ bool QMLRewriter::isMissingSemicolon(QmlJS::AST::UiObjectMember *member) return false; } -bool QMLRewriter::isMissingSemicolon(QmlJS::AST::Statement *stmt) +bool QMLRewriter::isMissingSemicolon(Statement *stmt) { if (ExpressionStatement *eStmt = AST::cast<ExpressionStatement *>(stmt)) { return !eStmt->semicolonToken.isValid(); diff --git a/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp index 78de848dff3..21f77e4cf4f 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp @@ -45,7 +45,7 @@ RemovePropertyVisitor::RemovePropertyVisitor(QmlDesigner::TextModifier &modifier { } -bool RemovePropertyVisitor::visit(QmlJS::AST::UiObjectBinding *ast) +bool RemovePropertyVisitor::visit(UiObjectBinding *ast) { if (ast->firstSourceLocation().offset == parentLocation) { //this condition is wrong for the UiObjectBinding case, but we keep it @@ -62,7 +62,7 @@ bool RemovePropertyVisitor::visit(QmlJS::AST::UiObjectBinding *ast) return !didRewriting(); } -bool RemovePropertyVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) +bool RemovePropertyVisitor::visit(UiObjectDefinition *ast) { if (ast->firstSourceLocation().offset == parentLocation) { // FIXME: change this to use the QmlJS::Rewriter class @@ -73,7 +73,7 @@ bool RemovePropertyVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) } // FIXME: duplicate code in the QmlJS::Rewriter class, remove this -void RemovePropertyVisitor::removeFrom(QmlJS::AST::UiObjectInitializer *ast) +void RemovePropertyVisitor::removeFrom(UiObjectInitializer *ast) { QString prefix; int dotIdx = propertyName.indexOf(QLatin1Char('.')); diff --git a/src/plugins/qmldesigner/designercore/filemanager/removeuiobjectmembervisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/removeuiobjectmembervisitor.cpp index e974e7d3c4c..05fb06b2701 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/removeuiobjectmembervisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/removeuiobjectmembervisitor.cpp @@ -39,7 +39,7 @@ using namespace QmlDesigner::Internal; using namespace QmlJS; using namespace QmlJS::AST; -RemoveUIObjectMemberVisitor::RemoveUIObjectMemberVisitor(QmlDesigner::TextModifier &modifier, +RemoveUIObjectMemberVisitor::RemoveUIObjectMemberVisitor(TextModifier &modifier, quint32 objectLocation): QMLRewriter(modifier), objectLocation(objectLocation) @@ -58,15 +58,15 @@ void RemoveUIObjectMemberVisitor::postVisit(Node *) parents.pop(); } -bool RemoveUIObjectMemberVisitor::visit(QmlJS::AST::UiPublicMember *ast) { return visitObjectMember(ast); } -bool RemoveUIObjectMemberVisitor::visit(QmlJS::AST::UiObjectDefinition *ast) { return visitObjectMember(ast); } -bool RemoveUIObjectMemberVisitor::visit(QmlJS::AST::UiSourceElement *ast) { return visitObjectMember(ast); } -bool RemoveUIObjectMemberVisitor::visit(QmlJS::AST::UiObjectBinding *ast) { return visitObjectMember(ast); } -bool RemoveUIObjectMemberVisitor::visit(QmlJS::AST::UiScriptBinding *ast) { return visitObjectMember(ast); } -bool RemoveUIObjectMemberVisitor::visit(QmlJS::AST::UiArrayBinding *ast) { return visitObjectMember(ast); } +bool RemoveUIObjectMemberVisitor::visit(UiPublicMember *ast) { return visitObjectMember(ast); } +bool RemoveUIObjectMemberVisitor::visit(UiObjectDefinition *ast) { return visitObjectMember(ast); } +bool RemoveUIObjectMemberVisitor::visit(UiSourceElement *ast) { return visitObjectMember(ast); } +bool RemoveUIObjectMemberVisitor::visit(UiObjectBinding *ast) { return visitObjectMember(ast); } +bool RemoveUIObjectMemberVisitor::visit(UiScriptBinding *ast) { return visitObjectMember(ast); } +bool RemoveUIObjectMemberVisitor::visit(UiArrayBinding *ast) { return visitObjectMember(ast); } // FIXME: duplicate code in the QmlJS::Rewriter class, remove this -bool RemoveUIObjectMemberVisitor::visitObjectMember(QmlJS::AST::UiObjectMember *ast) +bool RemoveUIObjectMemberVisitor::visitObjectMember(UiObjectMember *ast) { const quint32 memberStart = ast->firstSourceLocation().offset; @@ -106,8 +106,8 @@ UiArrayBinding *RemoveUIObjectMemberVisitor::containingArray() const } // FIXME: duplicate code in the QmlJS::Rewriter class, remove this -void RemoveUIObjectMemberVisitor::extendToLeadingOrTrailingComma(QmlJS::AST::UiArrayBinding *parentArray, - QmlJS::AST::UiObjectMember *ast, +void RemoveUIObjectMemberVisitor::extendToLeadingOrTrailingComma(UiArrayBinding *parentArray, + UiObjectMember *ast, int &start, int &end) const { diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index bc4c5e1fe6c..0df41d50b56 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -135,10 +135,10 @@ static QString qualifiedTypeNameForContext(const ObjectValue *objectValue, foreach (const LanguageUtils::FakeMetaObject::Export &e, cppComponent->metaObject()->exports()) { if (e.type == className) packages << e.package; - if (e.package == QmlJS::CppQmlTypes::cppPackage) + if (e.package == CppQmlTypes::cppPackage) cppName = e.type; } - if (packages.size() == 1 && packages.at(0) == QmlJS::CppQmlTypes::cppPackage) + if (packages.size() == 1 && packages.at(0) == CppQmlTypes::cppPackage) return packages.at(0) + QLatin1Char('.') + className; } // try to recover a "global context name" @@ -264,7 +264,7 @@ static QString qualifiedTypeNameForContext(const ObjectValue *objectValue, return optimalName(possibleFiles); } while (false); if (!cppName.isEmpty()) - return QmlJS::CppQmlTypes::cppPackage + QLatin1Char('.') + cppName; + return CppQmlTypes::cppPackage + QLatin1Char('.') + cppName; if (const CppComponentValue *cppComponent = value_cast<CppComponentValue>(objectValue)) { if (cppComponent->moduleName().isEmpty()) return cppComponent->className(); @@ -280,7 +280,7 @@ class PropertyMemberProcessor : public MemberProcessor public: PropertyMemberProcessor(const ContextPtr &context) : m_context(context) {} - bool processProperty(const QString &name, const Value *value, const QmlJS::PropertyInfo &) + bool processProperty(const QString &name, const Value *value, const PropertyInfo &) { PropertyName propertyName = name.toUtf8(); const ASTPropertyReference *ref = value_cast<ASTPropertyReference>(value); @@ -567,13 +567,13 @@ public: private: NodeMetaInfoPrivate(Model *model, TypeName type, int maj = -1, int min = -1); - const QmlJS::CppComponentValue *getCppComponentValue() const; - const QmlJS::ObjectValue *getObjectValue() const; + const CppComponentValue *getCppComponentValue() const; + const ObjectValue *getObjectValue() const; void setupPropertyInfo(QList<PropertyInfo> propertyInfos); void setupLocalPropertyInfo(QList<PropertyInfo> propertyInfos); QString lookupName() const; QStringList lookupNameComponent() const; - const QmlJS::CppComponentValue *getNearestCppComponentValue() const; + const CppComponentValue *getNearestCppComponentValue() const; QString fullQualifiedImportAliasType() const; TypeName m_qualfiedTypeName; @@ -591,7 +591,7 @@ private: QSet<QString> m_prototypeCacheNegatives; //storing the pointer would not be save - QmlJS::ContextPtr context() const; + ContextPtr context() const; const Document *document() const; QPointer<Model> m_model; @@ -721,7 +721,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i } } -const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() const +const CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() const { const QList<TypeName> nameComponents = m_qualfiedTypeName.split('.'); if (nameComponents.size() < 2) @@ -748,29 +748,29 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons return cppValue; } - const QmlJS::CppComponentValue *value = value_cast<CppComponentValue>(getObjectValue()); + const CppComponentValue *value = value_cast<CppComponentValue>(getObjectValue()); if (value) return value; // maybe 'type' is a cpp name - const QmlJS::CppComponentValue *cppValue = context()->valueOwner()->cppQmlTypes().objectByCppName(type); + const CppComponentValue *cppValue = context()->valueOwner()->cppQmlTypes().objectByCppName(type); return cppValue; } -const QmlJS::ObjectValue *NodeMetaInfoPrivate::getObjectValue() const +const ObjectValue *NodeMetaInfoPrivate::getObjectValue() const { return context()->lookupType(document(), lookupNameComponent()); } -QmlJS::ContextPtr NodeMetaInfoPrivate::context() const +ContextPtr NodeMetaInfoPrivate::context() const { if (m_model && m_model->rewriterView() && m_model->rewriterView()->scopeChain()) return m_model->rewriterView()->scopeChain()->context(); - return QmlJS::ContextPtr(0); + return ContextPtr(0); } -const QmlJS::Document *NodeMetaInfoPrivate::document() const +const Document *NodeMetaInfoPrivate::document() const { if (m_model && m_model->rewriterView()) return m_model->rewriterView()->document(); @@ -815,7 +815,7 @@ bool NodeMetaInfoPrivate::isPropertyWritable(const PropertyName &propertyName) c return true; } - const QmlJS::CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); + const CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return true; if (qmlObjectValue->hasProperty(propertyName)) @@ -846,7 +846,7 @@ bool NodeMetaInfoPrivate::isPropertyList(const PropertyName &propertyName) const return true; } - const QmlJS::CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); + const CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return false; return qmlObjectValue->isListProperty(propertyName); @@ -873,7 +873,7 @@ bool NodeMetaInfoPrivate::isPropertyPointer(const PropertyName &propertyName) co return true; } - const QmlJS::CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); + const CppComponentValue *qmlObjectValue = getNearestCppComponentValue(); if (!qmlObjectValue) return false; return qmlObjectValue->isPointer(propertyName); @@ -1239,7 +1239,7 @@ QList<TypeDescription> NodeMetaInfoPrivate::prototypes() const return m_prototypes; } -const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getNearestCppComponentValue() const +const CppComponentValue *NodeMetaInfoPrivate::getNearestCppComponentValue() const { if (m_isFileComponent) return findQmlPrototype(getObjectValue(), context()); diff --git a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp index 7a5a85c30ef..2966cc94adf 100644 --- a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp @@ -243,7 +243,7 @@ void ModelToTextMerger::applyChanges() ModelNodePositionRecalculator positionRecalculator(m_rewriterView->positionStorage(), m_rewriterView->positionStorage()->modelNodes()); positionRecalculator.connectTo(textModifier); - QmlDesigner::QmlRefactoring refactoring(tmpDocument, *textModifier, getPropertyOrder()); + QmlRefactoring refactoring(tmpDocument, *textModifier, getPropertyOrder()); textModifier->deactivateChangeSignals(); textModifier->startGroup(); @@ -312,26 +312,26 @@ void ModelToTextMerger::schedule(RewriteAction *action) m_rewriteActions.append(action); } -QmlDesigner::QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractProperty &property, const QString &textValue) +QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractProperty &property, const QString &textValue) { if (property.isBindingProperty() || property.isSignalHandlerProperty()) { QString val = textValue.trimmed(); if (val.isEmpty()) - return QmlDesigner::QmlRefactoring::ObjectBinding; + return QmlRefactoring::ObjectBinding; const QChar lastChar = val.at(val.size() - 1); if (lastChar == '}' || lastChar == ';') - return QmlDesigner::QmlRefactoring::ObjectBinding; + return QmlRefactoring::ObjectBinding; else - return QmlDesigner::QmlRefactoring::ScriptBinding; + return QmlRefactoring::ScriptBinding; } else if (property.isNodeListProperty()) - return QmlDesigner::QmlRefactoring::ArrayBinding; + return QmlRefactoring::ArrayBinding; else if (property.isNodeProperty()) - return QmlDesigner::QmlRefactoring::ObjectBinding; + return QmlRefactoring::ObjectBinding; else if (property.isVariantProperty()) - return QmlDesigner::QmlRefactoring::ScriptBinding; + return QmlRefactoring::ScriptBinding; Q_ASSERT(!"cannot convert property type"); - return (QmlDesigner::QmlRefactoring::PropertyType) -1; + return (QmlRefactoring::PropertyType) -1; } PropertyNameList ModelToTextMerger::m_propertyOrder; diff --git a/src/plugins/qmldesigner/designercore/model/rewriteaction.cpp b/src/plugins/qmldesigner/designercore/model/rewriteaction.cpp index 519b9271370..ce364f4122d 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriteaction.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriteaction.cpp @@ -127,7 +127,7 @@ QString AddPropertyRewriteAction::info() const return QStringLiteral("AddPropertyRewriteAction for property \"%1\" (type: %2)").arg(m_property.name(), toString(m_propertyType)); } -bool ChangeIdRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) +bool ChangeIdRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) { const int nodeLocation = positionStore.nodeOffset(m_node); static const PropertyName idPropertyName("id"); @@ -172,7 +172,7 @@ QString ChangeIdRewriteAction::info() const return QString("ChangeIdRewriteAction from \"%1\" to \"%2\"").arg(m_oldId, m_newId); } -bool ChangePropertyRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) +bool ChangePropertyRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) { const int nodeLocation = positionStore.nodeOffset(m_property.parentModelNode()); bool result = false; @@ -222,7 +222,7 @@ QString ChangePropertyRewriteAction::info() const (m_containedModelNode.isValid() ? m_containedModelNode.id() : "(none)")); } -bool ChangeTypeRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) +bool ChangeTypeRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) { const int nodeLocation = positionStore.nodeOffset(m_node); bool result = false; @@ -248,7 +248,7 @@ QString ChangeTypeRewriteAction::info() const return QString("ChangeTypeRewriteAction"); } -bool RemoveNodeRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) +bool RemoveNodeRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) { const int nodeLocation = positionStore.nodeOffset(m_node); bool result = refactoring.removeObject(nodeLocation); @@ -266,7 +266,7 @@ QString RemoveNodeRewriteAction::info() const return QString("RemoveNodeRewriteAction"); } -bool RemovePropertyRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) +bool RemovePropertyRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) { const int nodeLocation = positionStore.nodeOffset(m_property.parentModelNode()); bool result = refactoring.removeProperty(nodeLocation, m_property.name()); @@ -285,7 +285,7 @@ QString RemovePropertyRewriteAction::info() const return QStringLiteral("RemovePropertyRewriteAction for property \"%1\"").arg(QLatin1String(m_property.name())); } -bool ReparentNodeRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) +bool ReparentNodeRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) { const int nodeLocation = positionStore.nodeOffset(m_node); const int targetParentObjectLocation = positionStore.nodeOffset(m_targetProperty.parentModelNode()); @@ -352,7 +352,7 @@ QString MoveNodeRewriteAction::info() const } } -bool AddImportRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, +bool AddImportRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePositionStorage &/*positionStore*/) { const bool result = refactoring.addImport(m_import); @@ -370,7 +370,7 @@ QString AddImportRewriteAction::info() const return toInfo(m_import); } -bool RemoveImportRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, +bool RemoveImportRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePositionStorage &/*positionStore*/) { const bool result = refactoring.removeImport(m_import); diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 6d3a3f2153f..a35a4b6d11d 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -59,7 +59,6 @@ using namespace LanguageUtils; using namespace QmlJS; -using namespace QmlJS::AST; namespace { @@ -170,34 +169,34 @@ static inline QVariant cleverConvert(const QString &value) return QVariant(value); } -static bool isLiteralValue(ExpressionNode *expr) +static bool isLiteralValue(AST::ExpressionNode *expr) { - if (cast<NumericLiteral*>(expr)) + if (AST::cast<AST::NumericLiteral*>(expr)) return true; - else if (cast<StringLiteral*>(expr)) + else if (AST::cast<AST::StringLiteral*>(expr)) return true; - else if (UnaryPlusExpression *plusExpr = cast<UnaryPlusExpression*>(expr)) + else if (AST::UnaryPlusExpression *plusExpr = AST::cast<AST::UnaryPlusExpression*>(expr)) return isLiteralValue(plusExpr->expression); - else if (UnaryMinusExpression *minusExpr = cast<UnaryMinusExpression*>(expr)) + else if (AST::UnaryMinusExpression *minusExpr = AST::cast<AST::UnaryMinusExpression*>(expr)) return isLiteralValue(minusExpr->expression); - else if (cast<TrueLiteral*>(expr)) + else if (AST::cast<AST::TrueLiteral*>(expr)) return true; - else if (cast<FalseLiteral*>(expr)) + else if (AST::cast<AST::FalseLiteral*>(expr)) return true; else return false; } -static bool isLiteralValue(Statement *stmt) +static bool isLiteralValue(AST::Statement *stmt) { - ExpressionStatement *exprStmt = cast<ExpressionStatement *>(stmt); + AST::ExpressionStatement *exprStmt = AST::cast<AST::ExpressionStatement *>(stmt); if (exprStmt) return isLiteralValue(exprStmt->expression); else return false; } -static inline bool isLiteralValue(UiScriptBinding *script) +static inline bool isLiteralValue(AST::UiScriptBinding *script) { if (!script || !script->statement) return false; @@ -324,7 +323,7 @@ public: : m_snapshot(snapshot) , m_doc(doc) , m_link(snapshot, vContext, - QmlJS::ModelManagerInterface::instance()->builtins(doc)) + ModelManagerInterface::instance()->builtins(doc)) , m_context(m_link(doc, &m_diagnosticLinkMessages)) , m_scopeChain(doc, m_context) , m_scopeBuilder(&m_scopeChain) @@ -337,31 +336,31 @@ public: Document::Ptr doc() const { return m_doc; } - void enterScope(Node *node) + void enterScope(AST::Node *node) { m_scopeBuilder.push(node); } void leaveScope() { m_scopeBuilder.pop(); } - void lookup(UiQualifiedId *astTypeNode, QString &typeName, int &majorVersion, + void lookup(AST::UiQualifiedId *astTypeNode, QString &typeName, int &majorVersion, int &minorVersion, QString &defaultPropertyName) { const ObjectValue *value = m_context->lookupType(m_doc.data(), astTypeNode); defaultPropertyName = m_context->defaultPropertyName(value); - const CppComponentValue * qmlValue = value_cast<CppComponentValue>(value); + const CppComponentValue *qmlValue = value_cast<CppComponentValue>(value); if (qmlValue) { typeName = qmlValue->moduleName() + QStringLiteral(".") + qmlValue->className(); majorVersion = qmlValue->componentVersion().majorVersion(); minorVersion = qmlValue->componentVersion().minorVersion(); } else { - for (UiQualifiedId *iter = astTypeNode; iter; iter = iter->next) + for (AST::UiQualifiedId *iter = astTypeNode; iter; iter = iter->next) if (!iter->next && !iter->name.isEmpty()) typeName = iter->name.toString(); QString fullTypeName; - for (UiQualifiedId *iter = astTypeNode; iter; iter = iter->next) + for (AST::UiQualifiedId *iter = astTypeNode; iter; iter = iter->next) if (!iter->name.isEmpty()) fullTypeName += iter->name.toString() + QLatin1Char('.'); @@ -399,13 +398,13 @@ public: /// When something is changed here, also change Check::checkScopeObjectMember in /// qmljscheck.cpp /// ### Maybe put this into the context as a helper function. - bool lookupProperty(const QString &prefix, const UiQualifiedId *id, const Value **property = 0, const ObjectValue **parentObject = 0, QString *name = 0) + bool lookupProperty(const QString &prefix, const AST::UiQualifiedId *id, const Value **property = 0, const ObjectValue **parentObject = 0, QString *name = 0) { QList<const ObjectValue *> scopeObjects = m_scopeChain.qmlScopeObjects(); if (scopeObjects.isEmpty()) return false; - if (! id) + if (!id) return false; // ### error? if (id->name.isEmpty()) // possible after error recovery @@ -459,7 +458,7 @@ public: value = m_context->lookupReference(ref); // member lookup - const UiQualifiedId *idPart = id; + const AST::UiQualifiedId *idPart = id; if (prefix.isEmpty()) idPart = idPart->next; for (; idPart; idPart = idPart->next) { @@ -519,7 +518,7 @@ public: return false; } - QVariant convertToVariant(const QString &astValue, const QString &propertyPrefix, UiQualifiedId *propertyId) + QVariant convertToVariant(const QString &astValue, const QString &propertyPrefix, AST::UiQualifiedId *propertyId) { const bool hasQuotes = astValue.trimmed().left(1) == QStringLiteral("\"") && astValue.trimmed().right(1) == QStringLiteral("\""); const QString cleanedValue = fixEscapedUnicodeChar(deEscape(stripQuotes(astValue.trimmed()))); @@ -571,7 +570,7 @@ public: return value; } - QVariant convertToEnum(Statement *rhs, const QString &propertyPrefix, UiQualifiedId *propertyId, const QString &astValue) + QVariant convertToEnum(AST::Statement *rhs, const QString &propertyPrefix, AST::UiQualifiedId *propertyId, const QString &astValue) { QStringList astValueList = astValue.split(QStringLiteral(".")); @@ -580,7 +579,7 @@ public: && globalQtEnums().contains(astValueList.last())) return QVariant::fromValue(Enumeration(astValue)); - ExpressionStatement *eStmt = cast<ExpressionStatement *>(rhs); + AST::ExpressionStatement *eStmt = AST::cast<AST::ExpressionStatement *>(rhs); if (!eStmt || !eStmt->expression) return QVariant(); @@ -598,12 +597,12 @@ public: const ObjectValue *rhsValueObject = 0; QString rhsValueName; - if (IdentifierExpression *idExp = cast<IdentifierExpression *>(eStmt->expression)) { + if (AST::IdentifierExpression *idExp = AST::cast<AST::IdentifierExpression *>(eStmt->expression)) { if (!m_scopeChain.qmlScopeObjects().isEmpty()) rhsValueObject = m_scopeChain.qmlScopeObjects().last(); if (!idExp->name.isEmpty()) rhsValueName = idExp->name.toString(); - } else if (FieldMemberExpression *memberExp = cast<FieldMemberExpression *>(eStmt->expression)) { + } else if (AST::FieldMemberExpression *memberExp = AST::cast<AST::FieldMemberExpression *>(eStmt->expression)) { Evaluate evaluate(&m_scopeChain); const Value *result = evaluate(memberExp->base); rhsValueObject = result->asObjectValue(); @@ -706,8 +705,8 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc, { QList<Import> existingImports = m_rewriterView->model()->imports(); - for (UiHeaderItemList *iter = doc->qmlProgram()->headers; iter; iter = iter->next) { - UiImport *import = AST::cast<UiImport *>(iter->headerItem); + for (AST::UiHeaderItemList *iter = doc->qmlProgram()->headers; iter; iter = iter->next) { + AST::UiImport *import = AST::cast<AST::UiImport *>(iter->headerItem); if (!import) continue; @@ -855,14 +854,14 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH if (!doc->isParsedCorrectly()) { QList<RewriterView::Error> errors; - foreach (const QmlJS::DiagnosticMessage &message, doc->diagnosticMessages()) + foreach (const DiagnosticMessage &message, doc->diagnosticMessages()) errors.append(RewriterView::Error(message, QUrl::fromLocalFile(doc->fileName()))); m_rewriterView->setErrors(errors); setActive(false); return false; } snapshot.insert(doc); - m_vContext = QmlJS::ModelManagerInterface::instance()->defaultVContext(Dialect::Qml, doc, true); + m_vContext = ModelManagerInterface::instance()->defaultVContext(Dialect::Qml, doc, true); ReadingContext ctxt(snapshot, doc, m_vContext); m_scopeChain = QSharedPointer<const ScopeChain>( new ScopeChain(ctxt.scopeChain())); @@ -871,7 +870,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH QList<RewriterView::Error> errors; QList<RewriterView::Error> warnings; - foreach (const QmlJS::DiagnosticMessage &diagnosticMessage, ctxt.diagnosticLinkMessages()) { + foreach (const DiagnosticMessage &diagnosticMessage, ctxt.diagnosticLinkMessages()) { errors.append(RewriterView::Error(diagnosticMessage, QUrl::fromLocalFile(doc->fileName()))); } @@ -879,13 +878,13 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH setupPossibleImports(snapshot, m_vContext); if (m_rewriterView->model()->imports().isEmpty()) { - const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found")); + const DiagnosticMessage diagnosticMessage(Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found")); errors.append(RewriterView::Error(diagnosticMessage, QUrl::fromLocalFile(doc->fileName()))); } foreach (const QmlDesigner::Import &import, m_rewriterView->model()->imports()) { if (import.isLibraryImport() && import.url() == QStringLiteral("QtQuick") && !supportedQtQuickVersion(import.version())) { - const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0), + const DiagnosticMessage diagnosticMessage(Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "Unsupported QtQuick version")); errors.append(RewriterView::Error(diagnosticMessage, QUrl::fromLocalFile(doc->fileName()))); } @@ -955,8 +954,8 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH } setupUsedImports(); - UiObjectMember *astRootNode = 0; - if (UiProgram *program = doc->qmlProgram()) + AST::UiObjectMember *astRootNode = 0; + if (AST::UiProgram *program = doc->qmlProgram()) if (program->members) astRootNode = program->members->member; ModelNode modelRootNode = m_rewriterView->rootModelNode(); @@ -981,12 +980,12 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH } void TextToModelMerger::syncNode(ModelNode &modelNode, - UiObjectMember *astNode, + AST::UiObjectMember *astNode, ReadingContext *context, DifferenceHandler &differenceHandler) { - UiQualifiedId *astObjectType = qualifiedTypeNameId(astNode); - UiObjectInitializer *astInitializer = initializerOfObject(astNode); + AST::UiQualifiedId *astObjectType = qualifiedTypeNameId(astNode); + AST::UiObjectInitializer *astInitializer = initializerOfObject(astNode); if (!astObjectType || !astInitializer) return; @@ -1011,8 +1010,8 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, } if (modelNode.isRootNode() && isComponentType(typeName)) { - for (UiObjectMemberList *iter = astInitializer->members; iter; iter = iter->next) { - if (UiObjectDefinition *def = cast<UiObjectDefinition *>(iter->member)) { + for (AST::UiObjectMemberList *iter = astInitializer->members; iter; iter = iter->next) { + if (AST::UiObjectDefinition *def = AST::cast<AST::UiObjectDefinition *>(iter->member)) { syncNode(modelNode, def, context, differenceHandler); return; } @@ -1044,20 +1043,20 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, QSet<PropertyName> modelPropertyNames = QSet<PropertyName>::fromList(modelNode.propertyNames()); if (!modelNode.id().isEmpty()) modelPropertyNames.insert("id"); - QList<UiObjectMember *> defaultPropertyItems; + QList<AST::UiObjectMember *> defaultPropertyItems; - for (UiObjectMemberList *iter = astInitializer->members; iter; iter = iter->next) { - UiObjectMember *member = iter->member; + for (AST::UiObjectMemberList *iter = astInitializer->members; iter; iter = iter->next) { + AST::UiObjectMember *member = iter->member; if (!member) continue; - if (UiArrayBinding *array = cast<UiArrayBinding *>(member)) { + if (AST::UiArrayBinding *array = AST::cast<AST::UiArrayBinding *>(member)) { const QString astPropertyName = toString(array->qualifiedId); if (isPropertyChangesType(typeName) || isConnectionsType(typeName) || context->lookupProperty(QString(), array->qualifiedId)) { AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8()); - QList<UiObjectMember *> arrayMembers; - for (UiArrayMemberList *iter = array->members; iter; iter = iter->next) - if (UiObjectMember *member = iter->member) + QList<AST::UiObjectMember *> arrayMembers; + for (AST::UiArrayMemberList *iter = array->members; iter; iter = iter->next) + if (AST::UiObjectMember *member = iter->member) arrayMembers.append(member); syncArrayProperty(modelProperty, arrayMembers, context, differenceHandler); @@ -1066,7 +1065,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, qWarning() << "Skipping invalid array property" << astPropertyName << "for node type" << modelNode.type(); } - } else if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) { + } else if (AST::UiObjectDefinition *def = AST::cast<AST::UiObjectDefinition *>(member)) { const QString &name = def->qualifiedTypeNameId->name.toString(); if (name.isEmpty() || !name.at(0).isUpper()) { QStringList props = syncGroupedProperties(modelNode, @@ -1079,7 +1078,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, } else { defaultPropertyItems.append(member); } - } else if (UiObjectBinding *binding = cast<UiObjectBinding *>(member)) { + } else if (AST::UiObjectBinding *binding = AST::cast<AST::UiObjectBinding *>(member)) { const QString astPropertyName = toString(binding->qualifiedId); if (binding->hasOnToken) { // skip value sources @@ -1092,7 +1091,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, || isConnectionsType(typeName)) { AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8()); if (context->isArrayProperty(propertyType, containingObject, name)) - syncArrayProperty(modelProperty, QList<QmlJS::AST::UiObjectMember*>() << member, context, differenceHandler); + syncArrayProperty(modelProperty, QList<AST::UiObjectMember*>() << member, context, differenceHandler); else syncNodeProperty(modelProperty, binding, context, differenceHandler); modelPropertyNames.remove(astPropertyName.toUtf8()); @@ -1101,10 +1100,10 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, << "for node type" << modelNode.type(); } } - } else if (UiScriptBinding *script = cast<UiScriptBinding *>(member)) { + } else if (AST::UiScriptBinding *script = AST::cast<AST::UiScriptBinding *>(member)) { modelPropertyNames.remove(syncScriptBinding(modelNode, QString(), script, context, differenceHandler)); - } else if (UiPublicMember *property = cast<UiPublicMember *>(member)) { - if (property->type == UiPublicMember::Signal) + } else if (AST::UiPublicMember *property = AST::cast<AST::UiPublicMember *>(member)) { + if (property->type == AST::UiPublicMember::Signal) continue; // QML designer doesn't support this yet. if (property->name.isEmpty() || property->memberType.isEmpty()) @@ -1163,32 +1162,32 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, context->leaveScope(); } -static QVariant parsePropertyExpression(ExpressionNode *expressionNode) +static QVariant parsePropertyExpression(AST::ExpressionNode *expressionNode) { Q_ASSERT(expressionNode); - ArrayLiteral *arrayLiteral = cast<ArrayLiteral *>(expressionNode); + AST::ArrayLiteral *arrayLiteral = AST::cast<AST::ArrayLiteral *>(expressionNode); if (arrayLiteral) { QList<QVariant> variantList; - for (ElementList *it = arrayLiteral->elements; it; it = it->next) + for (AST::ElementList *it = arrayLiteral->elements; it; it = it->next) variantList << parsePropertyExpression(it->expression); return variantList; } - StringLiteral *stringLiteral = cast<AST::StringLiteral *>(expressionNode); + AST::StringLiteral *stringLiteral = AST::cast<AST::StringLiteral *>(expressionNode); if (stringLiteral) return stringLiteral->value.toString(); - TrueLiteral *trueLiteral = cast<AST::TrueLiteral *>(expressionNode); + AST::TrueLiteral *trueLiteral = AST::cast<AST::TrueLiteral *>(expressionNode); if (trueLiteral) return true; - FalseLiteral *falseLiteral = cast<AST::FalseLiteral *>(expressionNode); + AST::FalseLiteral *falseLiteral = AST::cast<AST::FalseLiteral *>(expressionNode); if (falseLiteral) return false; - NumericLiteral *numericLiteral = cast<AST::NumericLiteral *>(expressionNode); + AST::NumericLiteral *numericLiteral = AST::cast<AST::NumericLiteral *>(expressionNode); if (numericLiteral) return numericLiteral->value; @@ -1196,11 +1195,11 @@ static QVariant parsePropertyExpression(ExpressionNode *expressionNode) return QVariant(); } -QVariant parsePropertyScriptBinding(UiScriptBinding *uiScriptBinding) +QVariant parsePropertyScriptBinding(AST::UiScriptBinding *uiScriptBinding) { Q_ASSERT(uiScriptBinding); - ExpressionStatement *expStmt = cast<ExpressionStatement *>(uiScriptBinding->statement); + AST::ExpressionStatement *expStmt = AST::cast<AST::ExpressionStatement *>(uiScriptBinding->statement); if (!expStmt) return QVariant(); @@ -1209,7 +1208,7 @@ QVariant parsePropertyScriptBinding(UiScriptBinding *uiScriptBinding) QmlDesigner::PropertyName TextToModelMerger::syncScriptBinding(ModelNode &modelNode, const QString &prefix, - UiScriptBinding *script, + AST::UiScriptBinding *script, ReadingContext *context, DifferenceHandler &differenceHandler) { @@ -1304,7 +1303,7 @@ void TextToModelMerger::syncNodeId(ModelNode &modelNode, const QString &astObjec } void TextToModelMerger::syncNodeProperty(AbstractProperty &modelProperty, - UiObjectBinding *binding, + AST::UiObjectBinding *binding, ReadingContext *context, DifferenceHandler &differenceHandler) { @@ -1366,7 +1365,7 @@ void TextToModelMerger::syncSignalHandler(AbstractProperty &modelProperty, void TextToModelMerger::syncArrayProperty(AbstractProperty &modelProperty, - const QList<UiObjectMember *> &arrayMembers, + const QList<AST::UiObjectMember *> &arrayMembers, ReadingContext *context, DifferenceHandler &differenceHandler) { @@ -1403,7 +1402,7 @@ void TextToModelMerger::syncVariantProperty(AbstractProperty &modelProperty, } void TextToModelMerger::syncNodeListProperty(NodeListProperty &modelListProperty, - const QList<UiObjectMember *> arrayMembers, + const QList<AST::UiObjectMember *> arrayMembers, ReadingContext *context, DifferenceHandler &differenceHandler) { @@ -1416,7 +1415,7 @@ void TextToModelMerger::syncNodeListProperty(NodeListProperty &modelListProperty for (int j = i; j < arrayMembers.size(); ++j) { // more elements in the dom-list, so add them to the model - UiObjectMember *arrayMember = arrayMembers.at(j); + AST::UiObjectMember *arrayMember = arrayMembers.at(j); const ModelNode newNode = differenceHandler.listPropertyMissingModelNode(modelListProperty, context, arrayMember); } @@ -1431,13 +1430,14 @@ ModelNode TextToModelMerger::createModelNode(const TypeName &typeName, int majorVersion, int minorVersion, bool isImplicitComponent, - UiObjectMember *astNode, + AST::UiObjectMember *astNode, ReadingContext *context, DifferenceHandler &differenceHandler) { QString nodeSource; - UiQualifiedId *astObjectType = qualifiedTypeNameId(astNode); + + AST::UiQualifiedId *astObjectType = qualifiedTypeNameId(astNode); if (isCustomParserType(typeName)) nodeSource = textAt(context->doc(), @@ -1475,16 +1475,16 @@ ModelNode TextToModelMerger::createModelNode(const TypeName &typeName, QStringList TextToModelMerger::syncGroupedProperties(ModelNode &modelNode, const QString &name, - UiObjectMemberList *members, + AST::UiObjectMemberList *members, ReadingContext *context, DifferenceHandler &differenceHandler) { QStringList props; - for (UiObjectMemberList *iter = members; iter; iter = iter->next) { - UiObjectMember *member = iter->member; + for (AST::UiObjectMemberList *iter = members; iter; iter = iter->next) { + AST::UiObjectMember *member = iter->member; - if (UiScriptBinding *script = cast<UiScriptBinding *>(member)) { + if (AST::UiScriptBinding *script = AST::cast<AST::UiScriptBinding *>(member)) { const QString prop = syncScriptBinding(modelNode, name, script, context, differenceHandler); if (!prop.isEmpty()) props.append(prop); @@ -1542,7 +1542,7 @@ void ModelValidator::shouldBeSignalHandlerProperty(AbstractProperty &modelProper } void ModelValidator::shouldBeNodeListProperty(AbstractProperty &modelProperty, - const QList<UiObjectMember *> /*arrayMembers*/, + const QList<AST::UiObjectMember *> /*arrayMembers*/, ReadingContext * /*context*/) { Q_UNUSED(modelProperty) @@ -1577,7 +1577,7 @@ void ModelValidator::shouldBeNodeProperty(AbstractProperty &modelProperty, const TypeName &/*typeName*/, int /*majorVersion*/, int /*minorVersion*/, - UiObjectMember * /*astNode*/, + AST::UiObjectMember * /*astNode*/, ReadingContext * /*context*/) { Q_UNUSED(modelProperty) @@ -1596,7 +1596,7 @@ void ModelValidator::modelNodeAbsentFromQml(ModelNode &modelNode) ModelNode ModelValidator::listPropertyMissingModelNode(NodeListProperty &/*modelProperty*/, ReadingContext * /*context*/, - UiObjectMember * /*arrayMember*/) + AST::UiObjectMember * /*arrayMember*/) { Q_ASSERT(0); return ModelNode(); @@ -1683,7 +1683,7 @@ void ModelAmender::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty } void ModelAmender::shouldBeNodeListProperty(AbstractProperty &modelProperty, - const QList<UiObjectMember *> arrayMembers, + const QList<AST::UiObjectMember *> arrayMembers, ReadingContext *context) { ModelNode theNode = modelProperty.parentModelNode(); @@ -1724,7 +1724,7 @@ void ModelAmender::shouldBeNodeProperty(AbstractProperty &modelProperty, const TypeName &typeName, int majorVersion, int minorVersion, - UiObjectMember *astNode, + AST::UiObjectMember *astNode, ReadingContext *context) { ModelNode theNode = modelProperty.parentModelNode(); @@ -1754,14 +1754,14 @@ void ModelAmender::modelNodeAbsentFromQml(ModelNode &modelNode) ModelNode ModelAmender::listPropertyMissingModelNode(NodeListProperty &modelProperty, ReadingContext *context, - UiObjectMember *arrayMember) + AST::UiObjectMember *arrayMember) { - UiQualifiedId *astObjectType = 0; - UiObjectInitializer *astInitializer = 0; - if (UiObjectDefinition *def = cast<UiObjectDefinition *>(arrayMember)) { + AST::UiQualifiedId *astObjectType = 0; + AST::UiObjectInitializer *astInitializer = 0; + if (AST::UiObjectDefinition *def = AST::cast<AST::UiObjectDefinition *>(arrayMember)) { astObjectType = def->qualifiedTypeNameId; astInitializer = def->initializer; - } else if (UiObjectBinding *bin = cast<UiObjectBinding *>(arrayMember)) { + } else if (AST::UiObjectBinding *bin = AST::cast<AST::UiObjectBinding *>(arrayMember)) { astObjectType = bin->qualifiedTypeNameId; astInitializer = bin->initializer; } @@ -1815,7 +1815,7 @@ void ModelAmender::typeDiffers(bool isRootNode, const TypeName &typeName, int majorVersion, int minorVersion, - QmlJS::AST::UiObjectMember *astNode, + AST::UiObjectMember *astNode, ReadingContext *context) { const bool propertyTakesComponent = modelNode.hasParentProperty() && propertyIsComponentType(modelNode.parentProperty(), typeName, modelNode.model()); @@ -1926,14 +1926,14 @@ void TextToModelMerger::delayedSetup() } QString TextToModelMerger::textAt(const Document::Ptr &doc, - const SourceLocation &location) + const AST::SourceLocation &location) { return doc->source().mid(location.offset, location.length); } QString TextToModelMerger::textAt(const Document::Ptr &doc, - const SourceLocation &from, - const SourceLocation &to) + const AST::SourceLocation &from, + const AST::SourceLocation &to) { return doc->source().mid(from.offset, to.end() - from.begin()); } diff --git a/src/plugins/qmljseditor/qmlexpressionundercursor.cpp b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp index 1bac4162501..09ca0c3f711 100644 --- a/src/plugins/qmljseditor/qmlexpressionundercursor.cpp +++ b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp @@ -125,7 +125,7 @@ QmlExpressionUnderCursor::QmlExpressionUnderCursor() : _expressionNode(0), _expressionOffset(0), _expressionLength(0) {} -QmlJS::AST::ExpressionNode *QmlExpressionUnderCursor::operator()(const QTextCursor &cursor) +ExpressionNode *QmlExpressionUnderCursor::operator()(const QTextCursor &cursor) { _expressionNode = 0; _expressionOffset = -1; @@ -152,4 +152,3 @@ ExpressionNode *QmlExpressionUnderCursor::expressionNode() const { return _expressionNode; } - diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp index 1fe4a5dfc6e..c70429224c7 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.cpp +++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp @@ -651,7 +651,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const AssistInterface * // currently path-in-stringliteral is the only completion available in imports if (contextFinder.isInImport()) { - QmlJS::ModelManagerInterface::ProjectInfo pInfo = QmlJS::ModelManagerInterface::instance() + ModelManagerInterface::ProjectInfo pInfo = ModelManagerInterface::instance() ->projectInfo(ProjectExplorer::ProjectTree::currentProject()); QmlBundle platform = pInfo.extendedBundle.bundleForLanguage(document->language()); if (!platform.supportedImports().isEmpty()) { @@ -661,8 +661,8 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const AssistInterface * expressionUnderCursor(tc); QString libVersion = contextFinder.libVersionImport(); if (!libVersion.isNull()) { - QStringList completions=platform.supportedImports().complete(libVersion, QString(), QmlJS::PersistentTrie::LookupFlags(QmlJS::PersistentTrie::CaseInsensitive|QmlJS::PersistentTrie::SkipChars|QmlJS::PersistentTrie::SkipSpaces)); - completions = QmlJS::PersistentTrie::matchStrengthSort(libVersion, completions); + QStringList completions=platform.supportedImports().complete(libVersion, QString(), PersistentTrie::LookupFlags(PersistentTrie::CaseInsensitive|PersistentTrie::SkipChars|PersistentTrie::SkipSpaces)); + completions = PersistentTrie::matchStrengthSort(libVersion, completions); int toSkip = qMax(libVersion.lastIndexOf(QLatin1Char(' ')) , libVersion.lastIndexOf(QLatin1Char('.'))); @@ -691,7 +691,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const AssistInterface * tc.setPosition(m_startPosition - 1); QmlExpressionUnderCursor expressionUnderCursor; - QmlJS::AST::ExpressionNode *expression = expressionUnderCursor(tc); + AST::ExpressionNode *expression = expressionUnderCursor(tc); if (expression != 0 && ! isLiteral(expression)) { // Evaluate the expression under cursor. diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 100f8386f51..c1af7211134 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -134,8 +134,8 @@ void QmlJSEditorWidget::finalizeInitialization() textDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8 - m_modelManager = QmlJS::ModelManagerInterface::instance(); - m_contextPane = ExtensionSystem::PluginManager::getObject<QmlJS::IContextPane>(); + m_modelManager = ModelManagerInterface::instance(); + m_contextPane = ExtensionSystem::PluginManager::getObject<IContextPane>(); m_modelManager->activateScan(); @@ -207,7 +207,7 @@ static void appendExtraSelectionsForMessages( } } -void QmlJSEditorWidget::updateCodeWarnings(QmlJS::Document::Ptr doc) +void QmlJSEditorWidget::updateCodeWarnings(Document::Ptr doc) { if (doc->ast()) { setExtraSelections(CodeWarningsSelection, QList<QTextEdit::ExtraSelection>()); @@ -348,7 +348,7 @@ void QmlJSEditorWidget::updateUses() continue; QTextEdit::ExtraSelection sel; - sel.format = textDocument()->fontSettings().toTextCharFormat(TextEditor::C_OCCURRENCES); + sel.format = textDocument()->fontSettings().toTextCharFormat(C_OCCURRENCES); sel.cursor = textCursor(); sel.cursor.setPosition(loc.begin()); sel.cursor.setPosition(loc.end(), QTextCursor::KeepAnchor); @@ -791,7 +791,7 @@ void QmlJSEditorWidget::semanticInfoUpdated(const SemanticInfo &semanticInfo) if (m_firstSementicInfo) { m_firstSementicInfo = false; if (semanticInfo.document->language() == Dialect::QmlQtQuick2Ui) { - Core::InfoBarEntry info(Core::Id(Constants::QML_UI_FILE_WARNING), + InfoBarEntry info(Id(Constants::QML_UI_FILE_WARNING), tr("This file should only be edited in <b>Design</b> mode.")); info.setCustomButtonInfo(tr("Switch Mode"), []() { ModeManager::activateMode(Core::Constants::MODE_DESIGN); }); textDocument()->infoBar()->addInfo(info); @@ -840,16 +840,16 @@ bool QmlJSEditorWidget::hideContextPane() } AssistInterface *QmlJSEditorWidget::createAssistInterface( - TextEditor::AssistKind assistKind, - TextEditor::AssistReason reason) const + AssistKind assistKind, + AssistReason reason) const { - if (assistKind == TextEditor::Completion) { + if (assistKind == Completion) { return new QmlJSCompletionAssistInterface(document(), position(), textDocument()->filePath().toString(), reason, m_qmlJsEditorDocument->semanticInfo()); - } else if (assistKind == TextEditor::QuickFix) { + } else if (assistKind == QuickFix) { return new QmlJSQuickFixAssistInterface(const_cast<QmlJSEditorWidget *>(this), reason); } return 0; @@ -868,7 +868,7 @@ QString QmlJSEditorWidget::foldReplacementText(const QTextBlock &block) const return QLatin1String("id: ") + objectId + QLatin1String("..."); } - return TextEditor::TextEditorWidget::foldReplacementText(block); + return TextEditorWidget::foldReplacementText(block); } diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index f5f779cc4df..ed460e4445b 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -89,8 +89,8 @@ QmlJSEditorPlugin::QmlJSEditorPlugin() : m_reformatFileAction(0), m_currentDocument(0), m_jsonManager(new Utils::JsonSchemaManager( - QStringList() << Core::ICore::userResourcePath() + QLatin1String("/json/") - << Core::ICore::resourcePath() + QLatin1String("/json/"))) + QStringList() << ICore::userResourcePath() + QLatin1String("/json/") + << ICore::resourcePath() + QLatin1String("/json/"))) { m_instance = this; } @@ -119,63 +119,63 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e connect(m_modelManager, SIGNAL(aboutToRemoveFiles(QStringList)), m_qmlTaskManager, SLOT(documentsRemoved(QStringList))); - Core::Context context(Constants::C_QMLJSEDITOR_ID); + Context context(Constants::C_QMLJSEDITOR_ID); addAutoReleasedObject(new QmlJSEditorFactory); - Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(Constants::M_CONTEXT); - Core::ActionContainer *qmlToolsMenu = Core::ActionManager::actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS)); + ActionContainer *contextMenu = ActionManager::createMenu(Constants::M_CONTEXT); + ActionContainer *qmlToolsMenu = ActionManager::actionContainer(Id(QmlJSTools::Constants::M_TOOLS_QMLJS)); - Core::Context globalContext(Core::Constants::C_GLOBAL); + Context globalContext(Core::Constants::C_GLOBAL); qmlToolsMenu->addSeparator(globalContext); - Core::Command *cmd; - cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); + Command *cmd; + cmd = ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd); QAction *findUsagesAction = new QAction(tr("Find Usages"), this); - cmd = Core::ActionManager::registerAction(findUsagesAction, Constants::FIND_USAGES, context); + cmd = ActionManager::registerAction(findUsagesAction, Constants::FIND_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); connect(findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd); QAction *renameUsagesAction = new QAction(tr("Rename Symbol Under Cursor"), this); - cmd = Core::ActionManager::registerAction(renameUsagesAction, Constants::RENAME_USAGES, context); + cmd = ActionManager::registerAction(renameUsagesAction, Constants::RENAME_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+R"))); connect(renameUsagesAction, SIGNAL(triggered()), this, SLOT(renameUsages())); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd); QAction *semanticScan = new QAction(tr("Run Checks"), this); - cmd = Core::ActionManager::registerAction(semanticScan, Core::Id(Constants::RUN_SEMANTIC_SCAN), globalContext); + cmd = ActionManager::registerAction(semanticScan, Id(Constants::RUN_SEMANTIC_SCAN), globalContext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+C"))); connect(semanticScan, SIGNAL(triggered()), this, SLOT(runSemanticScan())); qmlToolsMenu->addAction(cmd); m_reformatFileAction = new QAction(tr("Reformat File"), this); - cmd = Core::ActionManager::registerAction(m_reformatFileAction, Core::Id(Constants::REFORMAT_FILE), context); + cmd = ActionManager::registerAction(m_reformatFileAction, Id(Constants::REFORMAT_FILE), context); connect(m_reformatFileAction, SIGNAL(triggered()), this, SLOT(reformatFile())); qmlToolsMenu->addAction(cmd); QAction *showQuickToolbar = new QAction(tr("Show Qt Quick Toolbar"), this); - cmd = Core::ActionManager::registerAction(showQuickToolbar, Constants::SHOW_QT_QUICK_HELPER, context); - cmd->setDefaultKeySequence(Core::UseMacShortcuts ? QKeySequence(Qt::META + Qt::ALT + Qt::Key_Space) + cmd = ActionManager::registerAction(showQuickToolbar, Constants::SHOW_QT_QUICK_HELPER, context); + cmd->setDefaultKeySequence(UseMacShortcuts ? QKeySequence(Qt::META + Qt::ALT + Qt::Key_Space) : QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Space)); connect(showQuickToolbar, SIGNAL(triggered()), this, SLOT(showContextPane())); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd); // Insert marker for "Refactoring" menu: - Core::Command *sep = contextMenu->addSeparator(globalContext); + Command *sep = contextMenu->addSeparator(globalContext); sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT)); contextMenu->addSeparator(globalContext); - cmd = Core::ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION); + cmd = ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); - cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION); + cmd = ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); m_quickFixAssistProvider = new QmlJSQuickFixAssistProvider; @@ -183,14 +183,14 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e errorMessage->clear(); - Core::FileIconProvider::registerIconOverlayForSuffix(":/qmljseditor/images/qmlfile.png", "qml"); + FileIconProvider::registerIconOverlayForSuffix(":/qmljseditor/images/qmlfile.png", "qml"); registerQuickFixes(this); addAutoReleasedObject(new QmlJSOutlineWidgetFactory); addAutoReleasedObject(new QuickToolBar); - addAutoReleasedObject(new Internal::QuickToolBarSettingsPage); + addAutoReleasedObject(new QuickToolBarSettingsPage); connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*))); @@ -217,13 +217,13 @@ Utils::JsonSchemaManager *QmlJSEditorPlugin::jsonManager() const void QmlJSEditorPlugin::findUsages() { - if (QmlJSEditorWidget *editor = qobject_cast<QmlJSEditorWidget*>(Core::EditorManager::currentEditor()->widget())) + if (QmlJSEditorWidget *editor = qobject_cast<QmlJSEditorWidget*>(EditorManager::currentEditor()->widget())) editor->findUsages(); } void QmlJSEditorPlugin::renameUsages() { - if (QmlJSEditorWidget *editor = qobject_cast<QmlJSEditorWidget*>(Core::EditorManager::currentEditor()->widget())) + if (QmlJSEditorWidget *editor = qobject_cast<QmlJSEditorWidget*>(EditorManager::currentEditor()->widget())) editor->renameUsages(); } @@ -242,15 +242,15 @@ void QmlJSEditorPlugin::reformatFile() void QmlJSEditorPlugin::showContextPane() { - if (QmlJSEditorWidget *editor = qobject_cast<QmlJSEditorWidget*>(Core::EditorManager::currentEditor()->widget())) + if (QmlJSEditorWidget *editor = qobject_cast<QmlJSEditorWidget*>(EditorManager::currentEditor()->widget())) editor->showContextPane(); } -Core::Command *QmlJSEditorPlugin::addToolAction(QAction *a, - Core::Context &context, Core::Id id, - Core::ActionContainer *c1, const QString &keySequence) +Command *QmlJSEditorPlugin::addToolAction(QAction *a, + Context &context, Id id, + ActionContainer *c1, const QString &keySequence) { - Core::Command *command = Core::ActionManager::registerAction(a, id, context); + Command *command = ActionManager::registerAction(a, id, context); if (!keySequence.isEmpty()) command->setDefaultKeySequence(QKeySequence(keySequence)); c1->addAction(command); @@ -262,7 +262,7 @@ QmlJSQuickFixAssistProvider *QmlJSEditorPlugin::quickFixAssistProvider() const return m_quickFixAssistProvider; } -void QmlJSEditorPlugin::currentEditorChanged(Core::IEditor *editor) +void QmlJSEditorPlugin::currentEditorChanged(IEditor *editor) { QmlJSEditorDocument *document = 0; if (editor) diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index 2c518ca52ed..aa45b9fc5b6 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -834,7 +834,7 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future, if (!doc) return; - QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance(); + ModelManagerInterface *modelManager = ModelManagerInterface::instance(); Link link(snapshot, modelManager->defaultVContext(doc->language(), doc), modelManager->builtins(doc)); ContextPtr context = link(); @@ -957,12 +957,12 @@ void FindReferences::displayResults(int first, int last) const QString label = tr("QML/JS Usages:"); if (replacement.isEmpty()) { - m_currentSearch = Core::SearchResultWindow::instance()->startNewSearch( - label, QString(), symbolName, Core::SearchResultWindow::SearchOnly); + m_currentSearch = SearchResultWindow::instance()->startNewSearch( + label, QString(), symbolName, SearchResultWindow::SearchOnly); } else { - m_currentSearch = Core::SearchResultWindow::instance()->startNewSearch( - label, QString(), symbolName, Core::SearchResultWindow::SearchAndReplace, - Core::SearchResultWindow::PreserveCaseDisabled); + m_currentSearch = SearchResultWindow::instance()->startNewSearch( + label, QString(), symbolName, SearchResultWindow::SearchAndReplace, + SearchResultWindow::PreserveCaseDisabled); m_currentSearch->setTextToReplace(replacement); connect(m_currentSearch, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)), SLOT(onReplaceButtonClicked(QString,QList<Core::SearchResultItem>,bool))); @@ -971,7 +971,7 @@ void FindReferences::displayResults(int first, int last) this, SLOT(openEditor(Core::SearchResultItem))); connect(m_currentSearch, SIGNAL(cancelled()), this, SLOT(cancel())); connect(m_currentSearch, SIGNAL(paused(bool)), this, SLOT(setPaused(bool))); - Core::SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch | IOutputPane::WithFocus)); + SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch | IOutputPane::WithFocus)); FutureProgress *progress = ProgressManager::addTask( m_watcher.future(), tr("Searching for Usages"), @@ -1014,7 +1014,7 @@ void FindReferences::setPaused(bool paused) m_watcher.setPaused(paused); } -void FindReferences::openEditor(const Core::SearchResultItem &item) +void FindReferences::openEditor(const SearchResultItem &item) { if (item.path.size() > 0) { EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()), @@ -1024,7 +1024,7 @@ void FindReferences::openEditor(const Core::SearchResultItem &item) } } -void FindReferences::onReplaceButtonClicked(const QString &text, const QList<Core::SearchResultItem> &items, bool preserveCase) +void FindReferences::onReplaceButtonClicked(const QString &text, const QList<SearchResultItem> &items, bool preserveCase) { const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase); @@ -1039,9 +1039,9 @@ void FindReferences::onReplaceButtonClicked(const QString &text, const QList<Cor } if (!changedOnDisk.isEmpty()) - QmlJS::ModelManagerInterface::instance()->updateSourceFiles(changedOnDisk, true); + ModelManagerInterface::instance()->updateSourceFiles(changedOnDisk, true); if (!changedUnsavedEditors.isEmpty()) - QmlJS::ModelManagerInterface::instance()->updateSourceFiles(changedUnsavedEditors, false); + ModelManagerInterface::instance()->updateSourceFiles(changedUnsavedEditors, false); - Core::SearchResultWindow::instance()->hide(); + SearchResultWindow::instance()->hide(); } diff --git a/src/plugins/qmljseditor/qmljshighlighter.cpp b/src/plugins/qmljseditor/qmljshighlighter.cpp index dac690103ab..4f02c0d03a0 100644 --- a/src/plugins/qmljseditor/qmljshighlighter.cpp +++ b/src/plugins/qmljseditor/qmljshighlighter.cpp @@ -47,15 +47,15 @@ QmlJSHighlighter::QmlJSHighlighter(QTextDocument *parent) m_inMultilineComment(false) { m_currentBlockParentheses.reserve(20); - static QVector<TextEditor::TextStyle> categories; + static QVector<TextStyle> categories; if (categories.isEmpty()) { - categories << TextEditor::C_NUMBER - << TextEditor::C_STRING - << TextEditor::C_TYPE - << TextEditor::C_KEYWORD - << TextEditor::C_FIELD - << TextEditor::C_COMMENT - << TextEditor::C_VISUAL_WHITESPACE; + categories << C_NUMBER + << C_STRING + << C_TYPE + << C_KEYWORD + << C_FIELD + << C_COMMENT + << C_VISUAL_WHITESPACE; } setTextFormatCategories(categories); } diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 981ef133347..4084d7a4f82 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -94,7 +94,7 @@ namespace { QmlJSHoverHandler::QmlJSHoverHandler() : m_modelManager(0) { - m_modelManager = QmlJS::ModelManagerInterface::instance(); + m_modelManager = ModelManagerInterface::instance(); } static inline QString getModuleName(const ScopeChain &scopeChain, const Document::Ptr &qmlDocument, @@ -377,8 +377,8 @@ void QmlJSHoverHandler::operateTooltip(TextEditorWidget *editorWidget, const QPo Utils::ToolTip::show(point, toolTip(), editorWidget); } -void QmlJSHoverHandler::prettyPrintTooltip(const QmlJS::Value *value, - const QmlJS::ContextPtr &context) +void QmlJSHoverHandler::prettyPrintTooltip(const Value *value, + const ContextPtr &context) { if (! value) return; diff --git a/src/plugins/qmljseditor/qmljsquickfix.cpp b/src/plugins/qmljseditor/qmljsquickfix.cpp index 31f043552f5..13438b74710 100644 --- a/src/plugins/qmljseditor/qmljsquickfix.cpp +++ b/src/plugins/qmljseditor/qmljsquickfix.cpp @@ -57,7 +57,7 @@ QmlJSQuickFixOperation::QmlJSQuickFixOperation(const QmlJSQuickFixInterface &int void QmlJSQuickFixOperation::perform() { - QmlJSRefactoringChanges refactoring(QmlJS::ModelManagerInterface::instance(), + QmlJSRefactoringChanges refactoring(ModelManagerInterface::instance(), m_interface->semanticInfo().snapshot); QmlJSRefactoringFilePtr current = refactoring.file(fileName()); diff --git a/src/plugins/qmljseditor/qmljsquickfixassist.cpp b/src/plugins/qmljseditor/qmljsquickfixassist.cpp index b95fb6ae1d6..924da7e78ff 100644 --- a/src/plugins/qmljseditor/qmljsquickfixassist.cpp +++ b/src/plugins/qmljseditor/qmljsquickfixassist.cpp @@ -48,7 +48,7 @@ using namespace Internal; // QuickFixAssistInterface // ----------------------- QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSEditorWidget *editor, - TextEditor::AssistReason reason) + AssistReason reason) : AssistInterface(editor->document(), editor->position(), editor->textDocument()->filePath().toString(), reason) , m_semanticInfo(editor->qmlJsEditorDocument()->semanticInfo()) @@ -94,7 +94,7 @@ IAssistProcessor *QmlJSQuickFixAssistProvider::createProcessor() const QList<QuickFixFactory *> QmlJSQuickFixAssistProvider::quickFixFactories() const { - QList<TextEditor::QuickFixFactory *> results; + QList<QuickFixFactory *> results; foreach (QmlJSQuickFixFactory *f, ExtensionSystem::PluginManager::getObjects<QmlJSQuickFixFactory>()) results.append(f); return results; diff --git a/src/plugins/qmljseditor/qmljsquickfixes.cpp b/src/plugins/qmljseditor/qmljsquickfixes.cpp index 62a5c353406..48e7aaf31ac 100644 --- a/src/plugins/qmljseditor/qmljsquickfixes.cpp +++ b/src/plugins/qmljseditor/qmljsquickfixes.cpp @@ -70,12 +70,12 @@ class SplitInitializerOp: public QmlJSQuickFixFactory const int pos = interface->currentFile()->cursor().position(); - if (QmlJS::AST::Node *member = interface->semanticInfo().rangeAt(pos)) { - if (QmlJS::AST::UiObjectBinding *b = QmlJS::AST::cast<QmlJS::AST::UiObjectBinding *>(member)) { + if (Node *member = interface->semanticInfo().rangeAt(pos)) { + if (UiObjectBinding *b = AST::cast<UiObjectBinding *>(member)) { if (b->initializer->lbraceToken.startLine == b->initializer->rbraceToken.startLine) objectInitializer = b->initializer; - } else if (QmlJS::AST::UiObjectDefinition *b = QmlJS::AST::cast<QmlJS::AST::UiObjectDefinition *>(member)) { + } else if (UiObjectDefinition *b = AST::cast<UiObjectDefinition *>(member)) { if (b->initializer->lbraceToken.startLine == b->initializer->rbraceToken.startLine) objectInitializer = b->initializer; } @@ -106,9 +106,9 @@ class SplitInitializerOp: public QmlJSQuickFixFactory Utils::ChangeSet changes; - for (QmlJS::AST::UiObjectMemberList *it = _objectInitializer->members; it; it = it->next) { - if (QmlJS::AST::UiObjectMember *member = it->member) { - const QmlJS::AST::SourceLocation loc = member->firstSourceLocation(); + for (UiObjectMemberList *it = _objectInitializer->members; it; it = it->next) { + if (UiObjectMember *member = it->member) { + const SourceLocation loc = member->firstSourceLocation(); // insert a newline at the beginning of this binding changes.insert(currentFile->startOf(loc), QLatin1String("\n")); diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index 10be174cc66..08a24a072aa 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -363,7 +363,7 @@ protected: return false; } - void addMessages(QList<QmlJS::DiagnosticMessage> messages, + void addMessages(QList<DiagnosticMessage> messages, const Document::Ptr &doc) { foreach (const DiagnosticMessage &d, messages) { @@ -399,10 +399,10 @@ protected: } } - void addMessages(const QList<QmlJS::StaticAnalysis::Message> &messages, + void addMessages(const QList<StaticAnalysis::Message> &messages, const Document::Ptr &doc) { - foreach (const QmlJS::StaticAnalysis::Message &d, messages) { + foreach (const StaticAnalysis::Message &d, messages) { int line = d.location.startLine; int column = qMax(1U, d.location.startColumn); int length = d.location.length; diff --git a/src/plugins/qmljseditor/quicktoolbar.cpp b/src/plugins/qmljseditor/quicktoolbar.cpp index bcaeb7183b8..00af014ef13 100644 --- a/src/plugins/qmljseditor/quicktoolbar.cpp +++ b/src/plugins/qmljseditor/quicktoolbar.cpp @@ -79,7 +79,7 @@ static inline const ObjectValue * getPropertyChangesTarget(Node *node, const Sco } QuickToolBar::QuickToolBar(QObject *parent) - : ::QmlJS::IContextPane(parent) + : ::IContextPane(parent) , m_editorWidget(0) , m_blockWriting(false) { @@ -116,7 +116,7 @@ QuickToolBar::~QuickToolBar() m_widget = 0; } -void QuickToolBar::apply(TextEditor::TextEditorWidget *editorWidget, Document::Ptr document, const ScopeChain *scopeChain, AST::Node *node, bool update, bool force) +void QuickToolBar::apply(TextEditor::TextEditorWidget *editorWidget, Document::Ptr document, const ScopeChain *scopeChain, Node *node, bool update, bool force) { if (!QuickToolBarSettings::get().enableContextPane && !force && !update) { contextWidget()->hide(); @@ -246,7 +246,7 @@ void QuickToolBar::apply(TextEditor::TextEditorWidget *editorWidget, Document::P } -bool QuickToolBar::isAvailable(TextEditor::TextEditorWidget *, Document::Ptr document, AST::Node *node) +bool QuickToolBar::isAvailable(TextEditor::TextEditorWidget *, Document::Ptr document, Node *node) { if (document.isNull()) return false; diff --git a/src/plugins/qmljstools/qmlconsolemanager.cpp b/src/plugins/qmljstools/qmlconsolemanager.cpp index 7203bb43b9f..616a1702ac0 100644 --- a/src/plugins/qmljstools/qmlconsolemanager.cpp +++ b/src/plugins/qmljstools/qmlconsolemanager.cpp @@ -49,7 +49,7 @@ class QmlConsoleManagerPrivate public: Internal::QmlConsoleItemModel *qmlConsoleItemModel; Internal::QmlConsolePane *qmlConsolePane; - QmlJS::IScriptEvaluator *scriptEvaluator; + IScriptEvaluator *scriptEvaluator; }; QmlConsoleManager::QmlConsoleManager(QObject *parent) @@ -81,7 +81,7 @@ ConsoleItem *QmlConsoleManager::rootItem() const return d->qmlConsoleItemModel->root(); } -void QmlConsoleManager::setScriptEvaluator(QmlJS::IScriptEvaluator *scriptEvaluator) +void QmlConsoleManager::setScriptEvaluator(IScriptEvaluator *scriptEvaluator) { d->scriptEvaluator = scriptEvaluator; if (!scriptEvaluator) diff --git a/src/plugins/qmljstools/qmljsbundleprovider.cpp b/src/plugins/qmljstools/qmljsbundleprovider.cpp index 910bff1fc5c..760004caf77 100644 --- a/src/plugins/qmljstools/qmljsbundleprovider.cpp +++ b/src/plugins/qmljstools/qmljsbundleprovider.cpp @@ -40,10 +40,6 @@ namespace QmlJSTools { -namespace { -typedef QmlJS::QmlBundle QmlBundle; -typedef QmlJS::QmlLanguageBundles QmlLanguageBundles; -} using namespace QmlJS; /*! diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp index 27c9f891380..0a6b3ff40a1 100644 --- a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp +++ b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp @@ -83,18 +83,18 @@ QmlJSCodeStylePreferencesWidget::~QmlJSCodeStylePreferencesWidget() delete m_ui; } -void QmlJSCodeStylePreferencesWidget::setPreferences(TextEditor::ICodeStylePreferences *preferences) +void QmlJSCodeStylePreferencesWidget::setPreferences(ICodeStylePreferences *preferences) { m_preferences = preferences; m_ui->tabPreferencesWidget->setPreferences(preferences); if (m_preferences) - connect(m_preferences, &TextEditor::ICodeStylePreferences::currentTabSettingsChanged, + connect(m_preferences, &ICodeStylePreferences::currentTabSettingsChanged, this, &QmlJSCodeStylePreferencesWidget::slotSettingsChanged); updatePreview(); } -void QmlJSCodeStylePreferencesWidget::decorateEditor(const TextEditor::FontSettings &fontSettings) +void QmlJSCodeStylePreferencesWidget::decorateEditor(const FontSettings &fontSettings) { const ISnippetProvider *provider = ExtensionSystem::PluginManager::getObject<ISnippetProvider>( [](ISnippetProvider *current) { @@ -122,7 +122,7 @@ void QmlJSCodeStylePreferencesWidget::updatePreview() { QTextDocument *doc = m_ui->previewTextEdit->document(); - const TextEditor::TabSettings &ts = m_preferences + const TabSettings &ts = m_preferences ? m_preferences->currentTabSettings() : TextEditorSettings::codeStyle()->tabSettings(); m_ui->previewTextEdit->textDocument()->setTabSettings(ts); @@ -157,9 +157,9 @@ QmlJSCodeStyleSettingsPage::QmlJSCodeStyleSettingsPage(/*QSharedPointer<CppFileS QWidget *QmlJSCodeStyleSettingsPage::widget() { if (!m_widget) { - TextEditor::SimpleCodeStylePreferences *originalTabPreferences + SimpleCodeStylePreferences *originalTabPreferences = QmlJSToolsSettings::globalCodeStyle(); - m_pageTabPreferences = new TextEditor::SimpleCodeStylePreferences(m_widget); + m_pageTabPreferences = new SimpleCodeStylePreferences(m_widget); m_pageTabPreferences->setDelegatingPool(originalTabPreferences->delegatingPool()); m_pageTabPreferences->setTabSettings(originalTabPreferences->tabSettings()); m_pageTabPreferences->setCurrentDelegate(originalTabPreferences->currentDelegate()); @@ -175,7 +175,7 @@ void QmlJSCodeStyleSettingsPage::apply() if (m_widget) { QSettings *s = Core::ICore::settings(); - TextEditor::SimpleCodeStylePreferences *originalTabPreferences = QmlJSToolsSettings::globalCodeStyle(); + SimpleCodeStylePreferences *originalTabPreferences = QmlJSToolsSettings::globalCodeStyle(); if (originalTabPreferences->tabSettings() != m_pageTabPreferences->tabSettings()) { originalTabPreferences->setTabSettings(m_pageTabPreferences->tabSettings()); originalTabPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s); diff --git a/src/plugins/qmljstools/qmljslocatordata.cpp b/src/plugins/qmljstools/qmljslocatordata.cpp index 2fad7753306..93d4055542a 100644 --- a/src/plugins/qmljstools/qmljslocatordata.cpp +++ b/src/plugins/qmljstools/qmljslocatordata.cpp @@ -44,11 +44,11 @@ using namespace QmlJS::AST; LocatorData::LocatorData(QObject *parent) : QObject(parent) { - QmlJS::ModelManagerInterface *manager = QmlJS::ModelManagerInterface::instance(); + ModelManagerInterface *manager = ModelManagerInterface::instance(); - connect(manager, &QmlJS::ModelManagerInterface::documentUpdated, + connect(manager, &ModelManagerInterface::documentUpdated, this, &LocatorData::onDocumentUpdated); - connect(manager, &QmlJS::ModelManagerInterface::aboutToRemoveFiles, + connect(manager, &ModelManagerInterface::aboutToRemoveFiles, this, &LocatorData::onAboutToRemoveFiles); } @@ -185,7 +185,7 @@ QHash<QString, QList<LocatorData::Entry> > LocatorData::entries() const return m_entries; } -void LocatorData::onDocumentUpdated(const QmlJS::Document::Ptr &doc) +void LocatorData::onDocumentUpdated(const Document::Ptr &doc) { QList<Entry> entries = FunctionFinder().run(doc); QMutexLocker l(&m_mutex); diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 83698a91d39..fb8721fe217 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -71,7 +71,7 @@ using namespace QmlJSTools; using namespace QmlJSTools::Internal; -ModelManagerInterface::ProjectInfo QmlJSTools::Internal::ModelManager::defaultProjectInfoForProject( +ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject( ProjectExplorer::Project *project) const { ModelManagerInterface::ProjectInfo projectInfo(project); @@ -171,9 +171,9 @@ void QmlJSTools::setupProjectInfoQmlBundles(ModelManagerInterface::ProjectInfo & } } -QHash<QString,QmlJS::Dialect> ModelManager::languageForSuffix() const +QHash<QString,Dialect> ModelManager::languageForSuffix() const { - QHash<QString,QmlJS::Dialect> res = ModelManagerInterface::languageForSuffix(); + QHash<QString,Dialect> res = ModelManagerInterface::languageForSuffix(); if (ICore::instance()) { Utils::MimeDatabase mdb; @@ -223,7 +223,7 @@ void ModelManager::delayedInitialization() connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::startupProjectChanged, this, &ModelManager::updateDefaultProjectInfo); - QmlJS::ViewerContext qbsVContext; + ViewerContext qbsVContext; qbsVContext.language = Dialect::QmlQbs; qbsVContext.maybeAddPath(ICore::resourcePath() + QLatin1String("/qbs")); setDefaultVContext(qbsVContext); diff --git a/src/plugins/qmljstools/qmljsqtstylecodeformatter.cpp b/src/plugins/qmljstools/qmljsqtstylecodeformatter.cpp index 428a265eeda..fe79a11bc5a 100644 --- a/src/plugins/qmljstools/qmljsqtstylecodeformatter.cpp +++ b/src/plugins/qmljstools/qmljsqtstylecodeformatter.cpp @@ -40,7 +40,7 @@ CreatorCodeFormatter::CreatorCodeFormatter() { } -CreatorCodeFormatter::CreatorCodeFormatter(const TextEditor::TabSettings &tabSettings) +CreatorCodeFormatter::CreatorCodeFormatter(const TabSettings &tabSettings) { setTabSize(tabSettings.m_tabSize); setIndentSize(tabSettings.m_indentSize); diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp index 00f9b2c8244..fb1ed258562 100644 --- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp +++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp @@ -39,9 +39,10 @@ #include <projectexplorer/editorconfiguration.h> using namespace QmlJS; -using namespace QmlJSTools; -class QmlJSTools::QmlJSRefactoringChangesData : public TextEditor::RefactoringChangesData +namespace QmlJSTools { + +class QmlJSRefactoringChangesData : public TextEditor::RefactoringChangesData { public: QmlJSRefactoringChangesData(ModelManagerInterface *modelManager, @@ -90,8 +91,8 @@ public: m_modelManager->updateSourceFiles(QStringList(fileName), true); } - QmlJS::ModelManagerInterface *m_modelManager; - QmlJS::Snapshot m_snapshot; + ModelManagerInterface *m_modelManager; + Snapshot m_snapshot; }; QmlJSRefactoringChanges::QmlJSRefactoringChanges(ModelManagerInterface *modelManager, @@ -129,7 +130,7 @@ QmlJSRefactoringFile::QmlJSRefactoringFile(const QString &fileName, const QShare m_fileName.clear(); } -QmlJSRefactoringFile::QmlJSRefactoringFile(TextEditor::TextEditorWidget *editor, QmlJS::Document::Ptr document) +QmlJSRefactoringFile::QmlJSRefactoringFile(TextEditor::TextEditorWidget *editor, Document::Ptr document) : RefactoringFile(editor) , m_qmljsDocument(document) { @@ -195,3 +196,5 @@ void QmlJSRefactoringFile::fileChanged() m_qmljsDocument.clear(); RefactoringFile::fileChanged(); } + +} // namespace QmlJSTools diff --git a/src/plugins/qmljstools/qmljssemanticinfo.cpp b/src/plugins/qmljstools/qmljssemanticinfo.cpp index 96c0b9101a7..b56a962ed8e 100644 --- a/src/plugins/qmljstools/qmljssemanticinfo.cpp +++ b/src/plugins/qmljstools/qmljssemanticinfo.cpp @@ -150,7 +150,7 @@ AST::Node *SemanticInfo::rangeAt(int cursorPosition) const } // ### the name and behavior of this function is dubious -QmlJS::AST::Node *SemanticInfo::declaringMemberNoProperties(int cursorPosition) const +Node *SemanticInfo::declaringMemberNoProperties(int cursorPosition) const { AST::Node *node = rangeAt(cursorPosition); @@ -191,7 +191,7 @@ QList<AST::Node *> SemanticInfo::rangePath(int cursorPosition) const return path; } -ScopeChain SemanticInfo::scopeChain(const QList<QmlJS::AST::Node *> &path) const +ScopeChain SemanticInfo::scopeChain(const QList<Node *> &path) const { Q_ASSERT(m_rootScopeChain); diff --git a/src/plugins/qmljstools/qmljstools_test.cpp b/src/plugins/qmljstools/qmljstools_test.cpp index d860c1f88ed..6c2c539c2b3 100644 --- a/src/plugins/qmljstools/qmljstools_test.cpp +++ b/src/plugins/qmljstools/qmljstools_test.cpp @@ -39,11 +39,13 @@ #include <QtTest> using namespace QmlJS; -using namespace QmlJSTools; -void QmlJSTools::Internal::QmlJSToolsPlugin::test_basic() +namespace QmlJSTools { +namespace Internal { + +void QmlJSToolsPlugin::test_basic() { - QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance(); + ModelManagerInterface *modelManager = ModelManagerInterface::instance(); const QString welcomescreenRootPath = Core::ICore::resourcePath() + QLatin1String("/welcomescreen/welcomescreen.qml"); modelManager->updateSourceFiles(QStringList(welcomescreenRootPath), false); @@ -88,3 +90,6 @@ void QmlJSTools::Internal::QmlJSToolsPlugin::test_basic() QCOMPARE(qmlImageValue->className(), QLatin1String("Image")); QCOMPARE(qmlImageValue->propertyType(QLatin1String("source")), QLatin1String("QUrl")); } + +} // namespace Internal +} // namespace QmlJSTools diff --git a/src/plugins/qmljstools/qmljstoolsplugin.cpp b/src/plugins/qmljstools/qmljstoolsplugin.cpp index 15c1acb77f8..113aa2bce4b 100644 --- a/src/plugins/qmljstools/qmljstoolsplugin.cpp +++ b/src/plugins/qmljstools/qmljstoolsplugin.cpp @@ -131,13 +131,13 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlJSToolsPlugin::aboutToShutdown() return SynchronousShutdown; } -void QmlJSToolsPlugin::onTaskStarted(Core::Id type) +void QmlJSToolsPlugin::onTaskStarted(Id type) { if (type == QmlJS::Constants::TASK_INDEX) m_resetCodeModelAction->setEnabled(false); } -void QmlJSToolsPlugin::onAllTasksFinished(Core::Id type) +void QmlJSToolsPlugin::onAllTasksFinished(Id type) { if (type == QmlJS::Constants::TASK_INDEX) m_resetCodeModelAction->setEnabled(true); diff --git a/src/plugins/qmljstools/qmljstoolssettings.cpp b/src/plugins/qmljstools/qmljstoolssettings.cpp index 2541faf261a..66fd13d01e3 100644 --- a/src/plugins/qmljstools/qmljstoolssettings.cpp +++ b/src/plugins/qmljstools/qmljstoolssettings.cpp @@ -49,7 +49,7 @@ namespace QmlJSTools { const char idKey[] = "QmlJSGlobal"; -static TextEditor::SimpleCodeStylePreferences *m_globalCodeStyle = 0; +static SimpleCodeStylePreferences *m_globalCodeStyle = 0; QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent) : QObject(parent) diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp index 36833c60c80..02e2458c9ae 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp @@ -50,8 +50,7 @@ LocalQmlProfilerRunner *LocalQmlProfilerRunner::createLocalRunner( LocalApplicationRunConfiguration *larc = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); QTC_ASSERT(larc, return 0); - ProjectExplorer::EnvironmentAspect *environment - = runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>(); + EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>(); QTC_ASSERT(environment, return 0); Configuration conf; conf.executable = larc->executable(); @@ -102,8 +101,7 @@ void LocalQmlProfilerRunner::start() m_launcher.setEnvironment(m_configuration.environment); connect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)), this, SLOT(spontaneousStop(int,QProcess::ExitStatus))); - m_launcher.start(ProjectExplorer::ApplicationLauncher::Gui, m_configuration.executable, - arguments); + m_launcher.start(ApplicationLauncher::Gui, m_configuration.executable, arguments); emit started(); } diff --git a/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp b/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp index 950a9e0a02f..d65ebe7bf02 100644 --- a/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp @@ -96,7 +96,7 @@ void QmlProfilerAttachDialog::setPort(const int port) d->portSpinBox->setValue(port); } -ProjectExplorer::Kit *QmlProfilerAttachDialog::kit() const +Kit *QmlProfilerAttachDialog::kit() const { return d->kitChooser->currentKit(); } diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp index 8585211e746..132052d58d8 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp @@ -342,7 +342,7 @@ void QmlProfilerClientManager::qmlComplete(qint64 maximumTime) d->modelManager->traceTime()->increaseEndTime(maximumTime); d->qmlDataReady = true; if (!d->v8clientplugin || - d->v8clientplugin.data()->state() != QmlDebug::QmlDebugClient::Enabled || + d->v8clientplugin.data()->state() != QmlDebugClient::Enabled || d->v8DataReady) { emit dataReadyForProcessing(); // once complete is sent, reset the flags @@ -355,7 +355,7 @@ void QmlProfilerClientManager::v8Complete() { d->v8DataReady = true; if (!d->qmlclientplugin || - d->qmlclientplugin.data()->state() != QmlDebug::QmlDebugClient::Enabled || + d->qmlclientplugin.data()->state() != QmlDebugClient::Enabled || d->qmlDataReady) { emit dataReadyForProcessing(); // once complete is sent, reset the flags diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index 8d90bdb0c47..d91671fa750 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -68,9 +68,9 @@ struct RootEventType : public QmlProfilerDataModel::QmlEventTypeData { { QString rootEventName = QmlProfilerEventsMainView::tr("<program>"); displayName = rootEventName; - location = QmlDebug::QmlEventLocation(rootEventName, 1, 1); - message = QmlDebug::MaximumMessage; - rangeType = QmlDebug::MaximumRangeType; + location = QmlEventLocation(rootEventName, 1, 1); + message = MaximumMessage; + rangeType = MaximumRangeType; detailType = -1; data = QmlProfilerEventsMainView::tr("Main Program"); } @@ -339,30 +339,30 @@ bool QmlProfilerEventsWidget::showExtendedStatistics() const void QmlProfilerEventsWidget::setShowJavaScript(bool show) { - d->modelProxy->setEventTypeAccepted(QmlDebug::Javascript, show); + d->modelProxy->setEventTypeAccepted(Javascript, show); d->modelProxy->limitToRange(d->rangeStart, d->rangeEnd); } void QmlProfilerEventsWidget::setShowQml(bool show) { - d->modelProxy->setEventTypeAccepted(QmlDebug::Binding, show); - d->modelProxy->setEventTypeAccepted(QmlDebug::HandlingSignal, show); - d->modelProxy->setEventTypeAccepted(QmlDebug::Compiling, show); - d->modelProxy->setEventTypeAccepted(QmlDebug::Creating, show); + d->modelProxy->setEventTypeAccepted(Binding, show); + d->modelProxy->setEventTypeAccepted(HandlingSignal, show); + d->modelProxy->setEventTypeAccepted(Compiling, show); + d->modelProxy->setEventTypeAccepted(Creating, show); d->modelProxy->limitToRange(d->rangeStart, d->rangeEnd); } bool QmlProfilerEventsWidget::showJavaScript() const { - return d->modelProxy->eventTypeAccepted(QmlDebug::Javascript); + return d->modelProxy->eventTypeAccepted(Javascript); } bool QmlProfilerEventsWidget::showQml() const { - return d->modelProxy->eventTypeAccepted(QmlDebug::Binding) && - d->modelProxy->eventTypeAccepted(QmlDebug::HandlingSignal) && - d->modelProxy->eventTypeAccepted(QmlDebug::Compiling) && - d->modelProxy->eventTypeAccepted(QmlDebug::Creating); + return d->modelProxy->eventTypeAccepted(Binding) && + d->modelProxy->eventTypeAccepted(HandlingSignal) && + d->modelProxy->eventTypeAccepted(Compiling) && + d->modelProxy->eventTypeAccepted(Creating); } //////////////////////////////////////////////////////////////////////////////////// @@ -700,15 +700,15 @@ void QmlProfilerEventsMainView::parseModelProxy() } } -QString QmlProfilerEventsMainView::nameForType(QmlDebug::RangeType typeNumber) +QString QmlProfilerEventsMainView::nameForType(RangeType typeNumber) { switch (typeNumber) { - case QmlDebug::Painting: return QmlProfilerEventsMainView::tr("Paint"); - case QmlDebug::Compiling: return QmlProfilerEventsMainView::tr("Compile"); - case QmlDebug::Creating: return QmlProfilerEventsMainView::tr("Create"); - case QmlDebug::Binding: return QmlProfilerEventsMainView::tr("Binding"); - case QmlDebug::HandlingSignal: return QmlProfilerEventsMainView::tr("Signal"); - case QmlDebug::Javascript: return QmlProfilerEventsMainView::tr("JavaScript"); + case Painting: return QmlProfilerEventsMainView::tr("Paint"); + case Compiling: return QmlProfilerEventsMainView::tr("Compile"); + case Creating: return QmlProfilerEventsMainView::tr("Create"); + case Binding: return QmlProfilerEventsMainView::tr("Binding"); + case HandlingSignal: return QmlProfilerEventsMainView::tr("Signal"); + case Javascript: return QmlProfilerEventsMainView::tr("JavaScript"); default: return QString(); } } diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp index 9915dabdc7a..0bf642b64e7 100644 --- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp @@ -44,12 +44,6 @@ using namespace Analyzer; namespace QmlProfiler { namespace Internal { -class QmlProfilerAction : public AnalyzerAction -{ -public: - explicit QmlProfilerAction(QObject *parent = 0) : AnalyzerAction(parent) { } -}; - bool QmlProfilerPlugin::debugOutput = false; QmlProfilerPlugin *QmlProfilerPlugin::instance = 0; @@ -58,26 +52,40 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS Q_UNUSED(arguments) Q_UNUSED(errorString) - IAnalyzerTool *tool = new QmlProfilerTool(this); + auto tool = new QmlProfilerTool(this); + auto toolStarter = [tool](StartMode mode) { return tool->startTool(mode); }; + auto widgetCreator = [tool] { return tool->createWidgets(); }; + auto runControlCreator = [tool](const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) { + return tool->createRunControl(sp, runConfiguration); + }; - QmlProfilerAction *action = 0; + AnalyzerAction *action = 0; QString description = QmlProfilerTool::tr( "The QML Profiler can be used to find performance bottlenecks in " "applications using QML."); - action = new QmlProfilerAction(this); - action->setId("QmlProfiler.Local"); - action->setTool(tool); + action = new AnalyzerAction(this); + action->setActionId("QmlProfiler.Local"); + action->setToolId(QmlProfilerToolId); + action->setWidgetCreator(widgetCreator); + action->setRunControlCreator(runControlCreator); + action->setToolStarter(toolStarter); + action->setRunMode(ProjectExplorer::QmlProfilerRunMode); action->setText(tr("QML Profiler")); action->setToolTip(description); action->setStartMode(StartLocal); action->setMenuGroup(Constants::G_ANALYZER_TOOLS); AnalyzerManager::addAction(action); - action = new QmlProfilerAction(this); - action->setId("QmlProfiler.Remote"); - action->setTool(tool); + action = new AnalyzerAction(this); + action->setActionId("QmlProfiler.Remote"); + action->setToolId(QmlProfilerToolId); + action->setWidgetCreator(widgetCreator); + action->setRunControlCreator(runControlCreator); + action->setToolStarter(toolStarter); + action->setRunMode(ProjectExplorer::QmlProfilerRunMode); action->setText(tr("QML Profiler (External)")); action->setToolTip(description); action->setStartMode(StartRemote); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 99a89d8532a..c4e82c86955 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -121,11 +121,9 @@ public: }; QmlProfilerTool::QmlProfilerTool(QObject *parent) - : IAnalyzerTool(parent), d(new QmlProfilerToolPrivate) + : QObject(parent), d(new QmlProfilerToolPrivate) { setObjectName(QLatin1String("QmlProfilerTool")); - setRunMode(QmlProfilerRunMode); - setToolMode(AnyMode); d->m_profilerState = 0; d->m_viewContainer = 0; @@ -488,7 +486,7 @@ void QmlProfilerTool::clearDisplay() updateTimeDisplay(); } -static void startRemoteTool(IAnalyzerTool *tool, StartMode mode) +static void startRemoteTool(QmlProfilerTool *tool, StartMode mode) { Id kitId; quint16 port; @@ -528,7 +526,7 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode) AnalyzerRunControl *rc = tool->createRunControl(sp, 0); - ProjectExplorerPlugin::startRunControl(rc, tool->runMode()); + ProjectExplorerPlugin::startRunControl(rc, QmlProfilerRunMode); } void QmlProfilerTool::startTool(StartMode mode) @@ -546,9 +544,9 @@ void QmlProfilerTool::startTool(StartMode mode) if (mode == StartLocal) { // ### not sure if we're supposed to check if the RunConFiguration isEnabled Project *pro = SessionManager::startupProject(); - ProjectExplorerPlugin::instance()->runProject(pro, runMode()); + ProjectExplorerPlugin::instance()->runProject(pro, QmlProfilerRunMode); } else if (mode == StartRemote) { - startRemoteTool(this, mode); + Internal::startRemoteTool(this, mode); } } @@ -603,7 +601,7 @@ void QmlProfilerTool::showLoadDialog() if (ModeManager::currentMode()->id() != MODE_ANALYZE) AnalyzerManager::showMode(); - AnalyzerManager::selectTool(this, StartRemote); + AnalyzerManager::selectTool("QmlProfiler", StartRemote); QString filename = QFileDialog::getOpenFileName(ICore::mainWindow(), tr("Load QML Trace"), QString(), tr("QML traces (*%1)").arg(QLatin1String(TraceFileExtension))); @@ -646,21 +644,21 @@ void QmlProfilerTool::clientsDisconnected() // If the connection is closed while the app is still running, no special action is needed } -template<QmlDebug::ProfileFeature feature> +template<ProfileFeature feature> void QmlProfilerTool::updateFeaturesMenu(quint64 features) { if (features & (1ULL << (feature))) { QAction *action = d->m_featuresMenu->addAction(tr(QmlProfilerModelManager::featureName( - static_cast<QmlDebug::ProfileFeature>(feature)))); + static_cast<ProfileFeature>(feature)))); action->setCheckable(true); action->setData(static_cast<uint>(feature)); action->setChecked(d->m_profilerState->recordingFeatures() & (1ULL << (feature))); } - updateFeaturesMenu<static_cast<QmlDebug::ProfileFeature>(feature + 1)>(features); + updateFeaturesMenu<static_cast<ProfileFeature>(feature + 1)>(features); } template<> -void QmlProfilerTool::updateFeaturesMenu<QmlDebug::MaximumProfileFeature>(quint64 features) +void QmlProfilerTool::updateFeaturesMenu<MaximumProfileFeature>(quint64 features) { Q_UNUSED(features); return; @@ -672,7 +670,7 @@ void QmlProfilerTool::setAvailableFeatures(quint64 features) d->m_profilerState->setRecordingFeatures(features); // by default, enable them all. if (d->m_featuresMenu) { d->m_featuresMenu->clear(); - updateFeaturesMenu<static_cast<QmlDebug::ProfileFeature>(0)>(features); + updateFeaturesMenu<static_cast<ProfileFeature>(0)>(features); } } diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index 3af7881eb87..74c6b241741 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -42,7 +42,9 @@ QT_END_NAMESPACE namespace QmlProfiler { namespace Internal { -class QmlProfilerTool : public Analyzer::IAnalyzerTool +const char QmlProfilerToolId[] = "QmlProfiler"; + +class QmlProfilerTool : public QObject { Q_OBJECT diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp index acd9c79488e..05451ae1334 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp @@ -79,41 +79,41 @@ Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == QmlDebug::MaximumMessage * sizeof(con namespace QmlProfiler { namespace Internal { -static QPair<QmlDebug::Message, QmlDebug::RangeType> qmlTypeAsEnum(const QString &typeString) +static QPair<Message, RangeType> qmlTypeAsEnum(const QString &typeString) { - QPair<QmlDebug::Message, QmlDebug::RangeType> ret(QmlDebug::MaximumMessage, - QmlDebug::MaximumRangeType); + QPair<Message, RangeType> ret(MaximumMessage, + MaximumRangeType); - for (int i = 0; i < QmlDebug::MaximumMessage; ++i) { + for (int i = 0; i < MaximumMessage; ++i) { if (typeString == _(MESSAGE_STRINGS[i])) { - ret.first = static_cast<QmlDebug::Message>(i); + ret.first = static_cast<Message>(i); break; } } - for (int i = 0; i < QmlDebug::MaximumRangeType; ++i) { + for (int i = 0; i < MaximumRangeType; ++i) { if (typeString == _(RANGE_TYPE_STRINGS[i])) { - ret.second = static_cast<QmlDebug::RangeType>(i); + ret.second = static_cast<RangeType>(i); break; } } - if (ret.first == QmlDebug::MaximumMessage && ret.second == QmlDebug::MaximumRangeType) { + if (ret.first == MaximumMessage && ret.second == MaximumRangeType) { bool isNumber = false; int type = typeString.toUInt(&isNumber); - if (isNumber && type < QmlDebug::MaximumRangeType) + if (isNumber && type < MaximumRangeType) // Allow saving ranges as numbers, but not messages. - ret.second = static_cast<QmlDebug::RangeType>(type); + ret.second = static_cast<RangeType>(type); } return ret; } -static QString qmlTypeAsString(QmlDebug::Message message, QmlDebug::RangeType rangeType) +static QString qmlTypeAsString(Message message, RangeType rangeType) { - if (rangeType < QmlDebug::MaximumRangeType) + if (rangeType < MaximumRangeType) return _(RANGE_TYPE_STRINGS[rangeType]); - else if (message != QmlDebug::MaximumMessage) + else if (message != MaximumMessage) return _(MESSAGE_STRINGS[message]); else return QString::number((int)rangeType); @@ -247,7 +247,7 @@ void QmlProfilerFileReader::loadEventData(QXmlStreamReader &stream) } if (elementName == _("type")) { - QPair<QmlDebug::Message, QmlDebug::RangeType> enums = qmlTypeAsEnum(readData); + QPair<Message, RangeType> enums = qmlTypeAsEnum(readData); event.message = enums.first; event.rangeType = enums.second; break; @@ -513,14 +513,14 @@ void QmlProfilerFileWriter::save(QIODevice *device) const QmlProfilerDataModel::QmlEventTypeData &event = m_qmlEvents[range.typeIndex]; // special: animation event - if (event.message == QmlDebug::Event && event.detailType == QmlDebug::AnimationFrame) { + if (event.message == Event && event.detailType == AnimationFrame) { stream.writeAttribute(_("framerate"), QString::number(range.numericData1)); stream.writeAttribute(_("animationcount"), QString::number(range.numericData2)); stream.writeAttribute(_("thread"), QString::number(range.numericData3)); } // special: pixmap cache event - if (event.message == QmlDebug::PixmapCacheEvent) { + if (event.message == PixmapCacheEvent) { if (event.detailType == PixmapSizeKnown) { stream.writeAttribute(_("width"), QString::number(range.numericData1)); stream.writeAttribute(_("height"), QString::number(range.numericData2)); @@ -531,7 +531,7 @@ void QmlProfilerFileWriter::save(QIODevice *device) stream.writeAttribute(_("refCount"), QString::number(range.numericData3)); } - if (event.message == QmlDebug::SceneGraphFrame) { + if (event.message == SceneGraphFrame) { // special: scenegraph frame events if (range.numericData1 > 0) stream.writeAttribute(_("timing1"), QString::number(range.numericData1)); @@ -546,7 +546,7 @@ void QmlProfilerFileWriter::save(QIODevice *device) } // special: memory allocation event - if (event.message == QmlDebug::MemoryAllocation) + if (event.message == MemoryAllocation) stream.writeAttribute(_("amount"), QString::number(range.numericData1)); stream.writeEndElement(); diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index 17e8f810408..4e65b3f2d51 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -77,7 +77,7 @@ public: QmlProfilerTraceView *q; QmlProfilerStateManager *m_profilerState; - Analyzer::IAnalyzerTool *m_profilerTool; + QmlProfilerTool *m_profilerTool; QmlProfilerViewManager *m_viewContainer; QSize m_sizeHint; @@ -90,7 +90,7 @@ public: Timeline::TimelineZoomControl *m_zoomControl; }; -QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState) +QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState) : QWidget(parent), d(new QmlProfilerTraceViewPrivate(this)) { setObjectName(QLatin1String("QML Profiler")); @@ -135,8 +135,8 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT d->m_modelProxy->addModel(new QmlProfilerAnimationsModel(modelManager, d->m_modelProxy)); - for (int i = 0; i < QmlDebug::MaximumRangeType; ++i) - d->m_modelProxy->addModel(new QmlProfilerRangeModel(modelManager, (QmlDebug::RangeType)i, + for (int i = 0; i < MaximumRangeType; ++i) + d->m_modelProxy->addModel(new QmlProfilerRangeModel(modelManager, (RangeType)i, d->m_modelProxy)); // Connect this last so that it's executed after the models have updated their data. diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.h b/src/plugins/qmlprofiler/qmlprofilertraceview.h index e468f410b5b..41a5bbc2cc1 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.h +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.h @@ -35,14 +35,13 @@ #include <QWidget> #include <QTimer> -namespace Analyzer { class IAnalyzerTool; } - namespace QmlProfiler { class QmlProfilerModelManager; namespace Internal { class QmlProfilerStateManager; +class QmlProfilerTool; class QmlProfilerViewManager; class QmlProfilerTraceView : public QWidget @@ -50,7 +49,7 @@ class QmlProfilerTraceView : public QWidget Q_OBJECT public: - explicit QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, + explicit QmlProfilerTraceView(QWidget *parent, QmlProfilerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState); diff --git a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp index 05bfd5e2913..c24bcd1b93e 100644 --- a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp @@ -124,11 +124,11 @@ void QmlProfilerViewManager::createViews() d->v8profilerView, SLOT(selectBySourceLocation(QString,int,int))); QDockWidget *eventsDock = AnalyzerManager::createDockWidget - (d->profilerTool, d->eventsView); + (QmlProfilerToolId, d->eventsView); QDockWidget *timelineDock = AnalyzerManager::createDockWidget - (d->profilerTool, d->traceView); + (QmlProfilerToolId, d->traceView); QDockWidget *v8profilerDock = AnalyzerManager::createDockWidget - (d->profilerTool, d->v8profilerView); + (QmlProfilerToolId, d->v8profilerView); eventsDock->show(); timelineDock->show(); diff --git a/src/plugins/qmlprofiler/qv8profilereventview.cpp b/src/plugins/qmlprofiler/qv8profilereventview.cpp index 89d0ae13180..e032fb325b7 100644 --- a/src/plugins/qmlprofiler/qv8profilereventview.cpp +++ b/src/plugins/qmlprofiler/qv8profilereventview.cpp @@ -104,7 +104,7 @@ public: QV8ProfilerEventsWidget *q; - Analyzer::IAnalyzerTool *m_profilerTool; + QmlProfilerTool *m_profilerTool; QmlProfilerViewManager *m_viewContainer; QV8ProfilerEventsMainView *m_eventTree; @@ -115,7 +115,7 @@ public: }; QV8ProfilerEventsWidget::QV8ProfilerEventsWidget(QWidget *parent, - Analyzer::IAnalyzerTool *profilerTool, + QmlProfilerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *profilerModelManager ) : QWidget(parent), d(new QV8ProfilerEventsWidgetPrivate(this)) diff --git a/src/plugins/qmlprofiler/qv8profilereventview.h b/src/plugins/qmlprofiler/qv8profilereventview.h index 20f739a2486..e17ee2a38ab 100644 --- a/src/plugins/qmlprofiler/qv8profilereventview.h +++ b/src/plugins/qmlprofiler/qv8profilereventview.h @@ -55,7 +55,7 @@ class QV8ProfilerEventsWidget : public QWidget Q_OBJECT public: explicit QV8ProfilerEventsWidget(QWidget *parent, - Analyzer::IAnalyzerTool *profilerTool, + QmlProfilerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *profilerModelManager ); ~QV8ProfilerEventsWidget(); diff --git a/src/plugins/qmlprojectmanager/qmlapplicationwizard.cpp b/src/plugins/qmlprojectmanager/qmlapplicationwizard.cpp index 90180aaf7d0..c45bb0487eb 100644 --- a/src/plugins/qmlprojectmanager/qmlapplicationwizard.cpp +++ b/src/plugins/qmlprojectmanager/qmlapplicationwizard.cpp @@ -81,11 +81,11 @@ QmlApplicationWizard::QmlApplicationWizard() QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY)); setDisplayName(tr("Qt Quick UI")); setDescription(tr("Creates a Qt Quick UI project.")); - setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QMLPROJECT) - | Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK)); + setRequiredFeatures(Feature(QtSupport::Constants::FEATURE_QMLPROJECT) + | Feature(QtSupport::Constants::FEATURE_QT_QUICK)); } -Core::BaseFileWizard *QmlApplicationWizard::create(QWidget *parent, const WizardDialogParameters ¶meters) const +BaseFileWizard *QmlApplicationWizard::create(QWidget *parent, const WizardDialogParameters ¶meters) const { QmlApplicationWizardDialog *wizardDialog = new QmlApplicationWizardDialog(parent, parameters); @@ -113,7 +113,7 @@ GeneratedFiles QmlApplicationWizard::generateFiles(const QWizard *w, bool QmlApplicationWizard::postGenerateFiles(const QWizard * /*wizard*/, const GeneratedFiles &l, QString *errorMessage) { - return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage); + return CustomProjectWizard::postGenerateOpen(l, errorMessage); } } // namespace Internal diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 4444ab1db07..380626958f0 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -89,18 +89,18 @@ QmlProject::~QmlProject() delete m_rootNode; } -void QmlProject::addedTarget(ProjectExplorer::Target *target) +void QmlProject::addedTarget(Target *target) { connect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)), this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration*))); - foreach (ProjectExplorer::RunConfiguration *rc, target->runConfigurations()) + foreach (RunConfiguration *rc, target->runConfigurations()) addedRunConfiguration(rc); } -void QmlProject::onActiveTargetChanged(ProjectExplorer::Target *target) +void QmlProject::onActiveTargetChanged(Target *target) { if (m_activeTarget) - disconnect(m_activeTarget, &ProjectExplorer::Target::kitChanged, this, &QmlProject::onKitChanged); + disconnect(m_activeTarget, &Target::kitChanged, this, &QmlProject::onKitChanged); m_activeTarget = target; if (m_activeTarget) connect(target, SIGNAL(kitChanged()), this, SLOT(onKitChanged())); @@ -115,7 +115,7 @@ void QmlProject::onKitChanged() refresh(Configuration); } -void QmlProject::addedRunConfiguration(ProjectExplorer::RunConfiguration *rc) +void QmlProject::addedRunConfiguration(RunConfiguration *rc) { // The enabled state of qml runconfigurations can only be decided after // they have been added to a project @@ -297,14 +297,14 @@ IDocument *QmlProject::document() const return m_file; } -ProjectExplorer::IProjectManager *QmlProject::projectManager() const +IProjectManager *QmlProject::projectManager() const { return m_manager; } -bool QmlProject::supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const +bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const { - Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k); + Id deviceType = DeviceTypeKitInformation::deviceTypeId(k); if (deviceType != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { if (errorMessage) *errorMessage = tr("Device type is not desktop."); @@ -333,7 +333,7 @@ bool QmlProject::supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) con return true; } -ProjectExplorer::ProjectNode *QmlProject::rootProjectNode() const +ProjectNode *QmlProject::rootProjectNode() const { return m_rootNode; } diff --git a/src/plugins/qtsupport/qtsupport.qbs b/src/plugins/qtsupport/qtsupport.qbs index 9ef7bb7a9c1..9b43f4bb98b 100644 --- a/src/plugins/qtsupport/qtsupport.qbs +++ b/src/plugins/qtsupport/qtsupport.qbs @@ -13,7 +13,7 @@ QtcPlugin { Depends { name: "CppTools" } cpp.includePaths: base.concat([ - "../../shared", + project.sharedSourcesDir, ]) cpp.defines: base.concat([ @@ -28,7 +28,7 @@ QtcPlugin { Group { name: "Shared" - prefix: "../../shared/proparser/" + prefix: project.sharedSourcesDir + "/proparser/" files: [ "ioutils.cpp", "ioutils.h", diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index a4beb29e540..2dc03c7785d 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -57,7 +57,10 @@ #include <cplusplus/LookupContext.h> #include <cplusplus/Overview.h> +#include <cplusplus/Symbols.h> + #include <extensionsystem/iplugin.h> + #include <texteditor/texteditor.h> #include <utils/qtcassert.h> @@ -65,7 +68,9 @@ #include <utils/styledbar.h> #include <projectexplorer/project.h> +#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projecttree.h> +#include <projectexplorer/session.h> #include <QFile> #include <QFileInfo> @@ -87,9 +92,6 @@ #include <QToolButton> #include <QVBoxLayout> -// shared/cplusplus includes -#include <cplusplus/Symbols.h> - using namespace Analyzer; using namespace Core; using namespace Valgrind::Callgrind; @@ -498,12 +500,10 @@ static QToolButton *createToolButton(QAction *action) } CallgrindTool::CallgrindTool(QObject *parent) - : ValgrindTool(parent) + : QObject(parent) { d = new CallgrindToolPrivate(this); setObjectName(QLatin1String("CallgrindTool")); - setRunMode(CallgrindRunMode); - setToolMode(ReleaseMode); connect(EditorManager::instance(), &EditorManager::editorOpened, d, &CallgrindToolPrivate::editorOpened); @@ -560,8 +560,18 @@ AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartPa void CallgrindTool::startTool(StartMode mode) { - ValgrindTool::startTool(mode); - d->setBusyCursor(true); + if (mode == StartLocal && checkForLocalStart(ReleaseMode)) { + Project *pro = SessionManager::startupProject(); + ProjectExplorerPlugin::instance()->runProject(pro, CallgrindRunMode); + d->setBusyCursor(true); + } + + AnalyzerStartParameters sp; + if (mode == StartRemote && checkForRemoteStart(&sp)) { + AnalyzerRunControl *rc = createRunControl(sp, 0); + ProjectExplorerPlugin::startRunControl(rc, CallgrindRunMode); + d->setBusyCursor(true); + } } void CallgrindTool::handleShowCostsOfFunction() @@ -633,11 +643,11 @@ QWidget *CallgrindToolPrivate::createWidgets() updateCostFormat(); - QDockWidget *callersDock = AnalyzerManager::createDockWidget(q, m_callersView); - QDockWidget *flatDock = AnalyzerManager::createDockWidget(q, m_flatView); - QDockWidget *calleesDock = AnalyzerManager::createDockWidget(q, m_calleesView); + QDockWidget *callersDock = AnalyzerManager::createDockWidget(CallgrindToolId, m_callersView); + QDockWidget *flatDock = AnalyzerManager::createDockWidget(CallgrindToolId, m_flatView); + QDockWidget *calleesDock = AnalyzerManager::createDockWidget(CallgrindToolId, m_calleesView); QDockWidget *visualizationDock = AnalyzerManager::createDockWidget - (q, m_visualisation, Qt::RightDockWidgetArea); + (CallgrindToolId, m_visualisation, Qt::RightDockWidgetArea); callersDock->show(); calleesDock->show(); @@ -915,7 +925,7 @@ void CallgrindToolPrivate::handleShowCostsOfFunction() m_toggleCollectFunction = qualifiedFunctionName + QLatin1String("()"); - AnalyzerManager::selectTool(q, StartLocal); + AnalyzerManager::selectTool(CallgrindToolId, StartLocal); AnalyzerManager::startTool(); } diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h index b548b7e2d14..809d0efe3c5 100644 --- a/src/plugins/valgrind/callgrindtool.h +++ b/src/plugins/valgrind/callgrindtool.h @@ -31,14 +31,16 @@ #ifndef CALLGRINDTOOL_H #define CALLGRINDTOOL_H -#include "valgrindtool.h" +#include <analyzerbase/ianalyzertool.h> namespace Valgrind { namespace Internal { +const char CallgrindToolId[] = "Callgrind"; + class CallgrindToolPrivate; -class CallgrindTool : public ValgrindTool +class CallgrindTool : public QObject { Q_OBJECT diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 026fb684f52..4f18e98cd44 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -187,7 +187,7 @@ static void initKindFilterAction(QAction *action, const QList<int> &kinds) } MemcheckTool::MemcheckTool(QObject *parent) - : ValgrindTool(parent) + : QObject(parent) { m_settings = 0; m_errorModel = 0; @@ -196,8 +196,6 @@ MemcheckTool::MemcheckTool(QObject *parent) m_filterMenu = 0; setObjectName(QLatin1String("MemcheckTool")); - setRunMode(MemcheckRunMode); - setToolMode(DebugMode); m_filterProjectAction = new QAction(tr("External Errors"), this); m_filterProjectAction->setToolTip( @@ -360,7 +358,7 @@ QWidget *MemcheckTool::createWidgets() m_errorView->setObjectName(QLatin1String("Valgrind.MemcheckTool.ErrorView")); m_errorView->setWindowTitle(tr("Memory Issues")); - QDockWidget *errorDock = AnalyzerManager::createDockWidget(this, m_errorView); + QDockWidget *errorDock = AnalyzerManager::createDockWidget("Memcheck", m_errorView); errorDock->show(); mw->splitDockWidget(mw->toolBarDockWidget(), errorDock, Qt::Vertical); @@ -599,13 +597,40 @@ void MemcheckTool::setBusyCursor(bool busy) m_errorView->setCursor(cursor); } +void MemcheckTool::startTool(StartMode mode) +{ + if (mode == StartLocal && checkForLocalStart(DebugMode)) { + Project *pro = SessionManager::startupProject(); + ProjectExplorerPlugin::instance()->runProject(pro, MemcheckRunMode); + } + + AnalyzerStartParameters sp; + if (mode == StartRemote && checkForRemoteStart(&sp)) { + AnalyzerRunControl *rc = createRunControl(sp, 0); + ProjectExplorerPlugin::startRunControl(rc, MemcheckRunMode); + } +} + MemcheckWithGdbTool::MemcheckWithGdbTool(QObject *parent) : MemcheckTool(parent) { - setRunMode(MemcheckWithGdbRunMode); setObjectName(QLatin1String("MemcheckWithGdbTool")); } +void MemcheckWithGdbTool::startTool(Analyzer::StartMode mode) +{ + if (mode == StartLocal && checkForLocalStart(DebugMode)) { + Project *pro = SessionManager::startupProject(); + ProjectExplorerPlugin::instance()->runProject(pro, MemcheckWithGdbRunMode); + } + + AnalyzerStartParameters sp; + if (mode == StartRemote && checkForRemoteStart(&sp)) { + AnalyzerRunControl *rc = createRunControl(sp, 0); + ProjectExplorerPlugin::startRunControl(rc, MemcheckWithGdbRunMode); + } +} + MemcheckRunControl *MemcheckWithGdbTool::createMemcheckRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) { diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h index 11ebe718cd0..ac242c614c4 100644 --- a/src/plugins/valgrind/memchecktool.h +++ b/src/plugins/valgrind/memchecktool.h @@ -32,7 +32,7 @@ #ifndef MEMCHECKTOOL_H #define MEMCHECKTOOL_H -#include "valgrindtool.h" +#include <analyzerbase/ianalyzertool.h> #include <QSortFilterProxyModel> @@ -76,13 +76,19 @@ private: bool m_filterExternalIssues; }; -class MemcheckTool : public ValgrindTool +class MemcheckTool : public QObject { Q_OBJECT public: MemcheckTool(QObject *parent); + void startTool(Analyzer::StartMode mode); + QWidget *createWidgets(); + + Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration = 0); + private slots: void settingsDestroyed(QObject *settings); void maybeActiveRunConfigurationChanged(); @@ -99,12 +105,8 @@ private slots: void loadExternalXmlLogFile(); private: - QWidget *createWidgets(); void setBusyCursor(bool busy); - Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration = 0); - void clearErrorView(); void updateFromSettings(); int updateUiAfterFinishedHelper(); @@ -137,7 +139,7 @@ class MemcheckWithGdbTool : public MemcheckTool public: MemcheckWithGdbTool(QObject *parent); -protected: + void startTool(Analyzer::StartMode mode); MemcheckRunControl *createMemcheckRunControl( const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration) Q_DECL_OVERRIDE; diff --git a/src/plugins/valgrind/valgrind.pro b/src/plugins/valgrind/valgrind.pro index b8d831d27aa..e7c82174fe4 100644 --- a/src/plugins/valgrind/valgrind.pro +++ b/src/plugins/valgrind/valgrind.pro @@ -22,7 +22,6 @@ HEADERS += \ callgrindengine.h \ workarounds.h \ callgrindtextmark.h \ - valgrindtool.h \ memchecktool.h \ memcheckengine.h \ memcheckerrorview.h \ @@ -36,7 +35,6 @@ SOURCES += \ valgrindsettings.cpp \ valgrindrunner.cpp \ valgrindprocess.cpp \ - valgrindtool.cpp \ callgrindcostdelegate.cpp \ callgrindcostview.cpp \ callgrindhelper.cpp \ diff --git a/src/plugins/valgrind/valgrind.qbs b/src/plugins/valgrind/valgrind.qbs index ff4fd8bcce1..7365b957485 100644 --- a/src/plugins/valgrind/valgrind.qbs +++ b/src/plugins/valgrind/valgrind.qbs @@ -37,7 +37,6 @@ QtcPlugin { "valgrindruncontrolfactory.cpp", "valgrindruncontrolfactory.h", "valgrindrunner.cpp", "valgrindrunner.h", "valgrindsettings.cpp", "valgrindsettings.h", - "valgrindtool.cpp", "valgrindtool.h", "workarounds.cpp", "workarounds.h", ] } diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp index 8a186137f27..7b0dfd0face 100644 --- a/src/plugins/valgrind/valgrindplugin.cpp +++ b/src/plugins/valgrind/valgrindplugin.cpp @@ -95,13 +95,6 @@ private: QPointer<QWidget> m_widget; }; -class ValgrindAction : public AnalyzerAction -{ -public: - explicit ValgrindAction(QObject *parent = 0) : AnalyzerAction(parent) { } -}; - - ValgrindPlugin::~ValgrindPlugin() { delete theGlobalSettings; @@ -119,7 +112,7 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *) m_memcheckWithGdbTool = new MemcheckWithGdbTool(this); m_callgrindTool = new CallgrindTool(this); - ValgrindAction *action = 0; + AnalyzerAction *action = 0; QString callgrindToolTip = tr("Valgrind Function Profile uses the " "\"callgrind\" tool to record function calls when a program runs."); @@ -131,10 +124,38 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *) "Valgrind Analyze Memory with GDB uses the \"memcheck\" tool to find memory leaks.\n" "When a problem is detected, the application is interrupted and can be debugged"); + MemcheckTool *mcTool = m_memcheckTool; + auto mcToolStarter = [mcTool](StartMode mode) { return mcTool->startTool(mode); }; + auto mcWidgetCreator = [mcTool] { return mcTool->createWidgets(); }; + auto mcRunControlCreator = [mcTool](const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) { + return mcTool->createRunControl(sp, runConfiguration); + }; + + MemcheckWithGdbTool *mcgTool = m_memcheckWithGdbTool; + auto mcgToolStarter = [mcgTool](StartMode mode) { return mcgTool->startTool(mode); }; + auto mcgWidgetCreator = [mcgTool] { return mcgTool->createWidgets(); }; + auto mcgRunControlCreator = [mcgTool](const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) { + return mcgTool->createRunControl(sp, runConfiguration); + }; + + CallgrindTool *cgTool = m_callgrindTool; + auto cgToolStarter = [cgTool](StartMode mode) { return cgTool->startTool(mode); }; + auto cgWidgetCreator = [cgTool] { return cgTool->createWidgets(); }; + auto cgRunControlCreator = [cgTool](const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) { + return cgTool->createRunControl(sp, runConfiguration); + }; + if (!Utils::HostOsInfo::isWindowsHost()) { - action = new ValgrindAction(this); - action->setId("Memcheck.Local"); - action->setTool(m_memcheckTool); + action = new AnalyzerAction(this); + action->setActionId("Memcheck.Local"); + action->setToolId("Memcheck"); + action->setWidgetCreator(mcWidgetCreator); + action->setRunControlCreator(mcRunControlCreator); + action->setToolStarter(mcToolStarter); + action->setRunMode(ProjectExplorer::MemcheckRunMode); action->setText(tr("Valgrind Memory Analyzer")); action->setToolTip(memcheckToolTip); action->setMenuGroup(Constants::G_ANALYZER_TOOLS); @@ -142,9 +163,13 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *) action->setEnabled(false); AnalyzerManager::addAction(action); - action = new ValgrindAction(this); - action->setId("MemcheckWithGdb.Local"); - action->setTool(m_memcheckWithGdbTool); + action = new AnalyzerAction(this); + action->setActionId("MemcheckWithGdb.Local"); + action->setToolId("MemcheckWithGdb"); + action->setWidgetCreator(mcgWidgetCreator); + action->setRunControlCreator(mcgRunControlCreator); + action->setToolStarter(mcgToolStarter); + action->setRunMode(ProjectExplorer::MemcheckWithGdbRunMode); action->setText(tr("Valgrind Memory Analyzer with GDB")); action->setToolTip(memcheckWithGdbToolTip); action->setMenuGroup(Constants::G_ANALYZER_TOOLS); @@ -152,9 +177,13 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *) action->setEnabled(false); AnalyzerManager::addAction(action); - action = new ValgrindAction(this); - action->setId("Callgrind.Local"); - action->setTool(m_callgrindTool); + action = new AnalyzerAction(this); + action->setActionId("Callgrind.Local"); + action->setToolId(CallgrindToolId); + action->setWidgetCreator(cgWidgetCreator); + action->setRunControlCreator(cgRunControlCreator); + action->setToolStarter(cgToolStarter); + action->setRunMode(ProjectExplorer::CallgrindRunMode); action->setText(tr("Valgrind Function Profiler")); action->setToolTip(callgrindToolTip); action->setMenuGroup(Constants::G_ANALYZER_TOOLS); @@ -163,18 +192,26 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *) AnalyzerManager::addAction(action); } - action = new ValgrindAction(this); - action->setId("Memcheck.Remote"); - action->setTool(m_memcheckTool); + action = new AnalyzerAction(this); + action->setActionId("Memcheck.Remote"); + action->setToolId("Memcheck"); + action->setWidgetCreator(mcWidgetCreator); + action->setRunControlCreator(mcRunControlCreator); + action->setToolStarter(mcToolStarter); + action->setRunMode(ProjectExplorer::MemcheckRunMode); action->setText(tr("Valgrind Memory Analyzer (External Remote Application)")); action->setToolTip(memcheckToolTip); action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS); action->setStartMode(StartRemote); AnalyzerManager::addAction(action); - action = new ValgrindAction(this); - action->setId("Callgrind.Remote"); - action->setTool(m_callgrindTool); + action = new AnalyzerAction(this); + action->setActionId("Callgrind.Remote"); + action->setToolId(CallgrindToolId); + action->setWidgetCreator(cgWidgetCreator); + action->setRunControlCreator(cgRunControlCreator); + action->setToolStarter(cgToolStarter); + action->setRunMode(ProjectExplorer::CallgrindRunMode); action->setText(tr("Valgrind Function Profiler (External Remote Application)")); action->setToolTip(callgrindToolTip); action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS); diff --git a/src/plugins/valgrind/valgrindtool.cpp b/src/plugins/valgrind/valgrindtool.cpp deleted file mode 100644 index 9f69c4f57ab..00000000000 --- a/src/plugins/valgrind/valgrindtool.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com) -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "valgrindtool.h" - -#include <analyzerbase/analyzermanager.h> -#include <analyzerbase/analyzerruncontrol.h> -#include <analyzerbase/startremotedialog.h> - -#include <coreplugin/icore.h> -#include <coreplugin/imode.h> -#include <coreplugin/modemanager.h> - -#include <projectexplorer/projectexplorer.h> -#include <projectexplorer/project.h> -#include <projectexplorer/buildconfiguration.h> -#include <projectexplorer/session.h> -#include <projectexplorer/target.h> - -#include <utils/qtcassert.h> -#include <utils/checkablemessagebox.h> - -#include <QAction> -#include <QDialog> -#include <QDialogButtonBox> -#include <QSettings> - -using namespace Analyzer; -using namespace Core; -using namespace ProjectExplorer; - -namespace Valgrind { -namespace Internal { - -ValgrindTool::ValgrindTool(QObject *parent) - : IAnalyzerTool(parent) -{} - -static bool buildTypeAccepted(IAnalyzerTool::ToolMode toolMode, - BuildConfiguration::BuildType buildType) -{ - if (toolMode == IAnalyzerTool::AnyMode) - return true; - if (buildType == BuildConfiguration::Unknown) - return true; - if (buildType == BuildConfiguration::Debug - && toolMode == IAnalyzerTool::DebugMode) - return true; - if (buildType == BuildConfiguration::Release - && toolMode == IAnalyzerTool::ReleaseMode) - return true; - return false; -} - -static void startLocalTool(IAnalyzerTool *tool) -{ - // Make sure mode is shown. - AnalyzerManager::showMode(); - - // ### not sure if we're supposed to check if the RunConFiguration isEnabled - Project *pro = SessionManager::startupProject(); - BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown; - if (pro) { - if (const Target *target = pro->activeTarget()) { - // Build configuration is 0 for QML projects. - if (const BuildConfiguration *buildConfig = target->activeBuildConfiguration()) - buildType = buildConfig->buildType(); - } - } - - // Check the project for whether the build config is in the correct mode - // if not, notify the user and urge him to use the correct mode. - if (!buildTypeAccepted(tool->toolMode(), buildType)) { - const QString currentMode = buildType == BuildConfiguration::Debug - ? AnalyzerManager::tr("Debug") - : AnalyzerManager::tr("Release"); - - QString toolModeString; - switch (tool->toolMode()) { - case IAnalyzerTool::DebugMode: - toolModeString = AnalyzerManager::tr("Debug"); - break; - case IAnalyzerTool::ReleaseMode: - toolModeString = AnalyzerManager::tr("Release"); - break; - default: - QTC_CHECK(false); - } - //const QString toolName = tool->displayName(); - const QString toolName = AnalyzerManager::tr("Tool"); // FIXME - const QString title = AnalyzerManager::tr("Run %1 in %2 Mode?").arg(toolName).arg(currentMode); - const QString message = AnalyzerManager::tr("<html><head/><body><p>You are trying " - "to run the tool \"%1\" on an application in %2 mode. " - "The tool is designed to be used in %3 mode.</p><p>" - "Debug and Release mode run-time characteristics differ " - "significantly, analytical findings for one mode may or " - "may not be relevant for the other.</p><p>" - "Do you want to continue and run the tool in %2 mode?</p></body></html>") - .arg(toolName).arg(currentMode).arg(toolModeString); - if (Utils::CheckableMessageBox::doNotAskAgainQuestion(ICore::mainWindow(), - title, message, ICore::settings(), QLatin1String("AnalyzerCorrectModeWarning")) - != QDialogButtonBox::Yes) - return; - } - - ProjectExplorerPlugin::instance()->runProject(pro, tool->runMode()); -} - -static void startRemoteTool(IAnalyzerTool *tool) -{ - StartRemoteDialog dlg; - if (dlg.exec() != QDialog::Accepted) - return; - - AnalyzerStartParameters sp; - sp.startMode = StartRemote; - sp.connParams = dlg.sshParams(); - sp.debuggee = dlg.executable(); - sp.debuggeeArgs = dlg.arguments(); - sp.displayName = dlg.executable(); - sp.workingDirectory = dlg.workingDirectory(); - - AnalyzerRunControl *rc = tool->createRunControl(sp, 0); - - ProjectExplorerPlugin::startRunControl(rc, tool->runMode()); -} - -void ValgrindTool::startTool(StartMode mode) -{ - if (mode == StartLocal) - startLocalTool(this); - if (mode == StartRemote) - startRemoteTool(this); -} - -} // namespace Internal -} // namespace Valgrind diff --git a/src/plugins/valgrind/valgrindtool.h b/src/plugins/valgrind/valgrindtool.h deleted file mode 100644 index 9fb4f6ab0e6..00000000000 --- a/src/plugins/valgrind/valgrindtool.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com) -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef VALGRINDTOOL_H -#define VALGRINDTOOL_H - -#include <analyzerbase/ianalyzertool.h> - -namespace Valgrind { -namespace Internal { - -class ValgrindTool : public Analyzer::IAnalyzerTool -{ - Q_OBJECT - -public: - explicit ValgrindTool(QObject *parent = 0); - - void startTool(Analyzer::StartMode mode); -}; - -} // namespace Internal -} // namespace Valgrind - -#endif // VALGRIND_TOOL diff --git a/src/src.qbs b/src/src.qbs index 34118460ac9..48bf9fc2dff 100644 --- a/src/src.qbs +++ b/src/src.qbs @@ -19,7 +19,7 @@ Project { Project { name: "qbs" id: qbsProject - property string qbsBaseDir: path + "/shared/qbs" + property string qbsBaseDir: project.sharedSourcesDir + "/qbs" condition: qbsSubModuleExists && !useExternalQbs qbsSearchPaths: [qbsBaseDir + "/qbs-resources"] diff --git a/src/tools/qtcdebugger/qtcdebugger.qbs b/src/tools/qtcdebugger/qtcdebugger.qbs index 490ed9d134a..69fb445bcec 100644 --- a/src/tools/qtcdebugger/qtcdebugger.qbs +++ b/src/tools/qtcdebugger/qtcdebugger.qbs @@ -4,7 +4,9 @@ QtcTool { name: "qtcdebugger" condition: qbs.targetOS.contains("windows") - cpp.includePaths: base.concat(["../../shared/registryaccess"]) + property string registryAccessDir: project.sharedSourcesDir + "/registryaccess" + + cpp.includePaths: base.concat([registryAccessDir]) cpp.dynamicLibraries: [ "psapi", "advapi32" @@ -15,7 +17,7 @@ QtcTool { files: [ "main.cpp", - "../../shared/registryaccess/registryaccess.cpp", - "../../shared/registryaccess/registryaccess.h", + registryAccessDir + "/registryaccess.cpp", + registryAccessDir + "/registryaccess.h", ] } diff --git a/tests/auto/ioutils/ioutils.qbs b/tests/auto/ioutils/ioutils.qbs index 0abf2c96c32..2f9f0ff3c94 100644 --- a/tests/auto/ioutils/ioutils.qbs +++ b/tests/auto/ioutils/ioutils.qbs @@ -4,8 +4,8 @@ QtcAutotest { name: "IoUtils autotest" Depends { name: "Qt.core" } files: [ - project.ide_source_tree + "/src/shared/proparser/ioutils.cpp", + project.sharedSourcesDir + "/proparser/ioutils.cpp", "tst_ioutils.cpp" ] - cpp.includePaths: base.concat([project.ide_source_tree + "/src/shared"]) + cpp.includePaths: base.concat([project.sharedSourcesDir]) } diff --git a/tests/auto/profilewriter/profilewriter.qbs b/tests/auto/profilewriter/profilewriter.qbs index e05ec165661..03de7d00d37 100644 --- a/tests/auto/profilewriter/profilewriter.qbs +++ b/tests/auto/profilewriter/profilewriter.qbs @@ -6,7 +6,7 @@ QtcAutotest { Group { name: "Sources from ProParser" id: proParserGroup - prefix: project.ide_source_tree + "/src/shared/proparser/" + prefix: project.sharedSourcesDir + "/proparser/" files: [ "ioutils.h", "ioutils.cpp", "profileevaluator.h", "profileevaluator.cpp", diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index 588d6c408c5..53219974b3e 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp @@ -129,11 +129,11 @@ static void initializeMetaTypeSystem(const QString &resourcePath) qWarning() << qPrintable(errorAndWarning); } -static QmlDesigner::Model* createModel(const QString &typeName, int major = 1, int minor = 1, Model *metaInfoPropxyModel = 0) +static Model* createModel(const QString &typeName, int major = 1, int minor = 1, Model *metaInfoPropxyModel = 0) { QApplication::processEvents(); - QmlDesigner::Model *model = QmlDesigner::Model::create(typeName, major, minor, metaInfoPropxyModel); + Model *model = Model::create(typeName, major, minor, metaInfoPropxyModel); QPlainTextEdit *textEdit = new QPlainTextEdit; QObject::connect(model, SIGNAL(destroyed()), textEdit, SLOT(deleteLater())); @@ -145,7 +145,7 @@ static QmlDesigner::Model* createModel(const QString &typeName, int major = 1, i NotIndentingTextEditModifier *modifier = new NotIndentingTextEditModifier(textEdit); modifier->setParent(textEdit); - QmlDesigner::RewriterView *rewriterView = new QmlDesigner::RewriterView(QmlDesigner::RewriterView::Validate, model); + RewriterView *rewriterView = new RewriterView(RewriterView::Validate, model); rewriterView->setCheckSemanticErrors(false); rewriterView->setTextModifier(modifier); @@ -2162,7 +2162,7 @@ void tst_TestCore::testModelRootNode() QVERIFY(childNode.isValid()); QVERIFY(rootModelNode.isValid()); QVERIFY(rootModelNode.isRootNode()); - } catch (const QmlDesigner::Exception &exception) { + } catch (const Exception &exception) { QString errorMsg = tr("Exception: %1 %2 %3:%4").arg(exception.type(), exception.function(), exception.file()).arg(exception.line()); QFAIL(errorMsg.toLatin1().constData()); } diff --git a/tests/auto/qml/qmljssimplereader/tst_qmljssimplereader.cpp b/tests/auto/qml/qmljssimplereader/tst_qmljssimplereader.cpp index e371919f84d..6568de00eb2 100644 --- a/tests/auto/qml/qmljssimplereader/tst_qmljssimplereader.cpp +++ b/tests/auto/qml/qmljssimplereader/tst_qmljssimplereader.cpp @@ -68,11 +68,11 @@ void tst_SimpleReader::testWellFormed() " propertyBlah: false\n" "}\n"; - QmlJS::SimpleReaderNode::WeakPtr weak01; - QmlJS::SimpleReaderNode::WeakPtr weak02; + SimpleReaderNode::WeakPtr weak01; + SimpleReaderNode::WeakPtr weak02; { - QmlJS::SimpleReader reader; - QmlJS::SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReader reader; + SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); QVERIFY(reader.errors().isEmpty()); QVERIFY(rootNode); QVERIFY(rootNode->isValid()); @@ -90,7 +90,7 @@ void tst_SimpleReader::testWellFormed() QVERIFY(rootNode->children().first()->properties().contains("property01")); QCOMPARE(rootNode->children().first()->property("property01").toInt(), 10); - QmlJS::SimpleReaderNode::Ptr secondChild = rootNode->children().at(1); + SimpleReaderNode::Ptr secondChild = rootNode->children().at(1); QVERIFY(secondChild); QVERIFY(secondChild->isValid()); @@ -102,7 +102,7 @@ void tst_SimpleReader::testWellFormed() QCOMPARE(secondChild->children().count(), 1); - QmlJS::SimpleReaderNode::Ptr innerChild = secondChild->children().first(); + SimpleReaderNode::Ptr innerChild = secondChild->children().first(); QVERIFY(innerChild); QVERIFY(innerChild->isValid()); @@ -134,8 +134,8 @@ void tst_SimpleReader::testIllFormed01() " }\n" " propertyBlah: false\n" "}\n"; - QmlJS::SimpleReader reader; - QmlJS::SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReader reader; + SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); QVERIFY(!rootNode); QVERIFY(!reader.errors().empty()); @@ -157,8 +157,8 @@ void tst_SimpleReader::testIllFormed02() " }\n" "}\n"; - QmlJS::SimpleReader reader; - QmlJS::SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReader reader; + SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); QVERIFY(rootNode); QVERIFY(rootNode->isValid()); @@ -167,7 +167,7 @@ void tst_SimpleReader::testIllFormed02() QVERIFY(!reader.errors().empty()); QCOMPARE(reader.errors().count(), 2); - QmlJS::SimpleReaderNode::Ptr firstChild = rootNode->children().at(0); + SimpleReaderNode::Ptr firstChild = rootNode->children().at(0); QVERIFY(firstChild); QVERIFY(firstChild->isValid()); @@ -192,8 +192,8 @@ void tst_SimpleReader::testArrays() variantList << QVariant(QLatin1String("string01")) << QVariant(QLatin1String("string02")); const QVariant variant = variantList; - QmlJS::SimpleReader reader; - QmlJS::SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReader reader; + SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); QVERIFY(rootNode); QVERIFY(rootNode->isValid()); @@ -202,7 +202,7 @@ void tst_SimpleReader::testArrays() QCOMPARE(rootNode->property("propertyArray"), variant); - QmlJS::SimpleReaderNode::Ptr firstChild = rootNode->children().at(0); + SimpleReaderNode::Ptr firstChild = rootNode->children().at(0); QVERIFY(firstChild); QVERIFY(firstChild->isValid()); @@ -243,8 +243,8 @@ void tst_SimpleReader::testBug01() " }\n" "}\n"; - QmlJS::SimpleReader reader; - QmlJS::SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReader reader; + SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); QVERIFY(rootNode); QVERIFY(rootNode->isValid()); diff --git a/tests/system/README b/tests/system/README index bc209af1c3c..f8d1d848000 100644 --- a/tests/system/README +++ b/tests/system/README @@ -33,14 +33,6 @@ How to do so, see QTCREATOR_REPO/src/plugins/clangcodemodel/README. Attention! If any of these prerequisites cannot be satisfied the tests will likely fail (or not run at all). -Prerequisites - testing on Qt4 ------------------------------- -If you want to test a Qt Creator based on Qt4, you should make sure that your build of Qt contains the change -98530cbc3a0bbb633bab96eebb535d7f92ecb1fa -Qt 4.8.7 will contain this change. -Additionally, you'll have to set the variable isQt4Build to "True" in shared/classes.py. - - Prerequisites - hooking into subprocesses ----------------------------------------- The usage of the hook-into subprocess has following prerequisites: |