diff options
88 files changed, 1381 insertions, 692 deletions
diff --git a/doc/images/qmldesigner-run-settings.png b/doc/images/qmldesigner-run-settings.png Binary files differindex 0dc1d2f764..bea676931f 100644 --- a/doc/images/qmldesigner-run-settings.png +++ b/doc/images/qmldesigner-run-settings.png diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index 45b8f14018..c81ffb10e2 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -1816,6 +1816,7 @@ \gui{Code Pasting} > \gui{Paste Snippet...} or press \key{Alt+C,Alt+P}. + To fetch a snippet of code from the server, select \gui{Tools} > \gui{Code Pasting} > \gui{Fetch Snippet...} or press \key{Alt+C,Alt+F}. @@ -4526,30 +4527,25 @@ \image qmldesigner-run-custom-exe.png "Run settings for custom executables" - \section1 Specifying Run Settings for Qt Quick Projects + \section1 Specifying Run Settings for Qt Quick UI Projects - Select run settings in the \gui {Run configuration} field. The settings - are specified automatically and, you mostly need to change them if you - develop applications that use both C++ and QML: + You can specify run settings for the \gui Desktop target: \list - \o \gui {Custom QML Viewer} is the path to the \QQV executable. - Qt Creator ships with a specific version of \QQV and imported - modules, which is used by default. If you develop Qt Quick applications - that contain C++ plugins, you must select the \QQV version - shipped with your Qt version here. + \o In the \gui {Qt version} field, select a Qt version that has support + for QML. - \o \gui {QML Viewer arguments} sets arguments for running \QQV. - The \c{-I <directory>} argument searches for C++ or QML plugins from - the project folder. For a list of available arguments, enter \c {qml --help} - on the command line. + \o In the \gui Arguments field, you can specify command line arguments + to be passed to the executable. - \o \gui {Main QML file} is the Qt Quick project file. + \o In the \gui {Main QML file}, select the file that \QQV will be + started with. - \o \gui Debugger allows you to select the languages to debug: + \o In the \gui Debugger group, select the languages to debug: \gui{C++} and \gui QML. \gui {Debug port} is the port to access \QQV. You can use any free port in the registered port range. + For more information, see \l{Debugging Qt Quick Projects}. \endlist @@ -4558,7 +4554,7 @@ execute any JavaScript functions. Therefore, you must make sure that the port is properly protected by a firewall. - \image qmldesigner-run-settings.png "Run settings for Qt Quick projects" + \image qmldesigner-run-settings.png "Run settings for Qt Quick UI projects" */ diff --git a/qtcreator.pri b/qtcreator.pri index 2890da370a..99eb0fa125 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -127,10 +127,7 @@ INCLUDEPATH += \ $$IDE_SOURCE_TREE/tools \ $$IDE_SOURCE_TREE/src/plugins -DEPENDPATH += \ - $$IDE_SOURCE_TREE/src/libs \ - $$IDE_SOURCE_TREE/tools \ - $$IDE_SOURCE_TREE/src/plugins +CONFIG += depend_includepath LIBS += -L$$IDE_LIBRARY_PATH diff --git a/share/qtcreator/qml/qmldump/main.cpp b/share/qtcreator/qml/qmldump/main.cpp index 301daee4d2..56bce64f66 100644 --- a/share/qtcreator/qml/qmldump/main.cpp +++ b/share/qtcreator/qml/qmldump/main.cpp @@ -242,8 +242,7 @@ public: // some qmltype names are missing the actual names, ignore that import if (qmlTyName.endsWith('/')) continue; - if (!relocatableModuleUri.isNull() - && qmlTyName.startsWith(relocatableModuleUri + QLatin1Char('/'))) { + if (qmlTyName.startsWith(relocatableModuleUri + QLatin1Char('/'))) { qmlTyName.remove(0, relocatableModuleUri.size() + 1); } exports += enquote(QString("%1 %2.%3").arg( @@ -410,6 +409,7 @@ void printUsage(const QString &appName) { qWarning() << qPrintable(QString( "Usage: %1 [--notrelocatable] module.uri version [module/import/path]\n" + " %1 --path path/to/qmldir/directory [version]\n" " %1 --builtins\n" "Example: %1 Qt.labs.particles 4.7 /home/user/dev/qt-install/imports").arg( appName)); @@ -445,6 +445,7 @@ int main(int argc, char *argv[]) QString pluginImportVersion; QString pluginImportPath; bool relocatable = true; + bool pathImport = false; if (args.size() >= 3) { QStringList positionalArgs; foreach (const QString &arg, args) { @@ -455,20 +456,32 @@ int main(int argc, char *argv[]) if (arg == QLatin1String("--notrelocatable")) { relocatable = false; + } else if (arg == QLatin1String("--path")) { + pathImport = true; } else { qWarning() << "Invalid argument: " << arg; return EXIT_INVALIDARGUMENTS; } } - if (positionalArgs.size() != 3 && positionalArgs.size() != 4) { - qWarning() << "Incorrect number of positional arguments"; - return EXIT_INVALIDARGUMENTS; + if (!pathImport) { + if (positionalArgs.size() != 3 && positionalArgs.size() != 4) { + qWarning() << "Incorrect number of positional arguments"; + return EXIT_INVALIDARGUMENTS; + } + pluginImportUri = positionalArgs[1]; + pluginImportVersion = positionalArgs[2]; + if (positionalArgs.size() >= 4) + pluginImportPath = positionalArgs[3]; + } else { + if (positionalArgs.size() != 2 && positionalArgs.size() != 3) { + qWarning() << "Incorrect number of positional arguments"; + return EXIT_INVALIDARGUMENTS; + } + pluginImportPath = positionalArgs[1]; + if (positionalArgs.size() == 3) + pluginImportVersion = positionalArgs[2]; } - pluginImportUri = positionalArgs[1]; - pluginImportVersion = positionalArgs[2]; - if (positionalArgs.size() >= 4) - pluginImportPath = positionalArgs[3]; } QDeclarativeView view; @@ -483,11 +496,16 @@ int main(int argc, char *argv[]) // this will hold the meta objects we want to dump information of QSet<const QMetaObject *> metas; - if (pluginImportUri.isEmpty()) { + if (pluginImportUri.isEmpty() && !pathImport) { metas = defaultReachable; } else { // find all QMetaObjects reachable when the specified module is imported - importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii(); + if (!pathImport) { + importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii(); + } else { + // pluginImportVersion can be empty + importCode += QString("import \"%1\" %2\n").arg(pluginImportPath, pluginImportVersion).toAscii(); + } // create a component with these imports to make sure the imports are valid // and to populate the declarative meta type system diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri index 570cba1da9..49e2da8ff7 100644 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri @@ -1,5 +1,4 @@ INCLUDEPATH += $$PWD/include -DEPENDPATH += $$PWD $$PWD/include editor $$PWD/qt-private include($$PWD/protocol/protocol.pri) diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pri index 5743fca3ac..75bcdc56b6 100644 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pri +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pri @@ -2,7 +2,6 @@ # It enables debugging of Qt Quick applications INCLUDEPATH += $$PWD/include -DEPENDPATH += $PPWD/include QT += declarative script LIBS *= -l$$qtLibraryName(QmlJSDebugger) diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/AnchorButtons.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/AnchorButtons.qml index 44d3cc6ac0..c2a607d10b 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/AnchorButtons.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/AnchorButtons.qml @@ -26,6 +26,7 @@ QWidget { fixedHeight: 28 height: fixedHeight styleSheetFile: "anchortop.css"; + toolTip: enabled ? qsTr("Set top anchor") : qsTr("Setting anchors in states is not supported.") checked: anchorBackend.topAnchored; onReleased: { @@ -49,6 +50,7 @@ QWidget { height: fixedHeight styleSheetFile: "anchorbottom.css"; + toolTip: enabled ? qsTr("Set bottom anchor") : qsTr("Setting anchors in states is not supported.") checked: anchorBackend.bottomAnchored; onReleased: { @@ -71,6 +73,7 @@ QWidget { height: fixedHeight styleSheetFile: "anchorleft.css"; + toolTip: enabled ? qsTr("Set left anchor") : qsTr("Setting anchors in states is not supported.") checked: anchorBackend.leftAnchored; onReleased: { @@ -93,6 +96,7 @@ QWidget { height: fixedHeight styleSheetFile: "anchorright.css"; + toolTip: enabled ? qsTr("Set right anchor") : qsTr("Setting anchors in states is not supported.") checked: anchorBackend.rightAnchored; onReleased: { @@ -125,6 +129,7 @@ QWidget { height: fixedHeight styleSheetFile: "anchorfill.css"; + toolTip: enabled ? qsTr("Fill to parent") : qsTr("Setting anchors in states is not supported.") checkable: true onReleased: { @@ -157,6 +162,7 @@ QWidget { height: fixedHeight styleSheetFile: "anchorvertical.css"; + toolTip: enabled ? qsTr("Set vertical anchor") : qsTr("Setting anchors in states is not supported.") checked: anchorBackend.verticalCentered; onReleased: { @@ -181,6 +187,7 @@ QWidget { height: fixedHeight styleSheetFile: "anchorhorizontal.css"; + toolTip: enabled ? qsTr("Set horizontal anchor") : qsTr("Setting anchors in states is not supported.") checked: anchorBackend.horizontalCentered; onReleased: { diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/ColorGroupBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/ColorGroupBox.qml index ce1c57c046..5b08c18876 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/ColorGroupBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/ColorGroupBox.qml @@ -175,6 +175,7 @@ QExtGroupBox { fixedWidth: 22; width: fixedWidth height: fixedHeight + toolTip: qsTr("Color editor") onClicked: { if (colorGroupBox.animated) diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/ColorTypeButtons.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/ColorTypeButtons.qml index b8ccfcad76..8436718b4b 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/ColorTypeButtons.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/ColorTypeButtons.qml @@ -50,6 +50,7 @@ QWidget { styleSheetFile: "styledbuttonleft.css" iconFromFile: "images/icon_color_solid.png" + toolTip: qsTr("Solid color") onToggled: { if (checked) { @@ -74,6 +75,7 @@ QWidget { styleSheetFile: "styledbuttonmiddle.css" iconFromFile: "images/icon_color_gradient.png" + toolTip: qsTr("Gradient") onToggled: { if (checked) { @@ -97,6 +99,7 @@ QWidget { fixedHeight: 28 styleSheetFile: "styledbuttonright.css" iconFromFile: "images/icon_color_none.png" + toolTip: qsTr("Transparent") onToggled: { if (checked) { diff --git a/src/libs/cplusplus/cplusplus.pri b/src/libs/cplusplus/cplusplus.pri index 85cb972095..8b49cd3d0e 100644 --- a/src/libs/cplusplus/cplusplus.pri +++ b/src/libs/cplusplus/cplusplus.pri @@ -1,5 +1,3 @@ INCLUDEPATH += $$IDE_SOURCE_TREE/src/shared/cplusplus -DEPENDPATH += $$IDE_SOURCE_TREE/src/shared/cplusplus INCLUDEPATH += $$IDE_SOURCE_TREE/src/libs/cplusplus -DEPENDPATH += $$IDE_SOURCE_TREE/src/libs/cplusplus LIBS *= -l$$qtLibraryName(CPlusPlus) diff --git a/src/libs/glsl/glsl.pri b/src/libs/glsl/glsl.pri index 112d313ae6..3ff20ace08 100644 --- a/src/libs/glsl/glsl.pri +++ b/src/libs/glsl/glsl.pri @@ -1,6 +1,7 @@ -INCLUDEPATH += $$PWD/../../shared -INCLUDEPATH += $$PWD/../../shared/glsl $$PWD/../../shared/glsl/parser +INCLUDEPATH += \ + $$PWD/../../shared \ + $$PWD/../../shared/glsl \ + $$PWD/../../shared/glsl/parser -DEPENDPATH += $$PWD/../../shared/glsl $$PWD/../../shared/glsl/parser LIBS *= -l$$qtLibraryName(GLSL) DEFINES += QT_CREATOR diff --git a/src/libs/languageutils/languageutils-lib.pri b/src/libs/languageutils/languageutils-lib.pri index 59e3b6a42f..6eaa315814 100644 --- a/src/libs/languageutils/languageutils-lib.pri +++ b/src/libs/languageutils/languageutils-lib.pri @@ -4,7 +4,6 @@ contains(CONFIG, dll) { DEFINES += LANGUAGEUTILS_BUILD_STATIC_LIB } -DEPENDPATH += $$PWD INCLUDEPATH += $$PWD/.. HEADERS += \ diff --git a/src/libs/qmleditorwidgets/qmleditorwidgets-lib.pri b/src/libs/qmleditorwidgets/qmleditorwidgets-lib.pri index 942e9eeb4c..1faa8eec80 100644 --- a/src/libs/qmleditorwidgets/qmleditorwidgets-lib.pri +++ b/src/libs/qmleditorwidgets/qmleditorwidgets-lib.pri @@ -1,6 +1,5 @@ QT += declarative script INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD contains(CONFIG, dll) { DEFINES += BUILD_QMLEDITORWIDGETS_LIB diff --git a/src/libs/qmleditorwidgets/qmleditorwidgets.pri b/src/libs/qmleditorwidgets/qmleditorwidgets.pri index 72520ed980..55a4c3da0a 100644 --- a/src/libs/qmleditorwidgets/qmleditorwidgets.pri +++ b/src/libs/qmleditorwidgets/qmleditorwidgets.pri @@ -1,5 +1,4 @@ INCLUDEPATH += $$PWD $$PWD/easingpane -DEPENDPATH += $$PWD $$PWD/easingpane QT += declarative LIBS *= -l$$qtLibraryName(QmlEditorWidgets) diff --git a/src/libs/qmljs/qmljs-lib.pri b/src/libs/qmljs/qmljs-lib.pri index 7bd069c63a..9c5b7eec9e 100644 --- a/src/libs/qmljs/qmljs-lib.pri +++ b/src/libs/qmljs/qmljs-lib.pri @@ -6,7 +6,6 @@ contains(CONFIG, dll) { include(parser/parser.pri) -DEPENDPATH += $$PWD INCLUDEPATH += $$PWD/.. HEADERS += \ diff --git a/src/libs/qmljs/qmljs.pri b/src/libs/qmljs/qmljs.pri index af334ef81f..20d20c513d 100644 --- a/src/libs/qmljs/qmljs.pri +++ b/src/libs/qmljs/qmljs.pri @@ -1,6 +1,7 @@ -INCLUDEPATH += $$PWD/../../shared -INCLUDEPATH += $$PWD/../../shared/qmljs $$PWD/../../shared/qmljs/parser +INCLUDEPATH += \ + $$PWD/../../shared \ + $$PWD/../../shared/qmljs \ + $$PWD/../../shared/qmljs/parser -DEPENDPATH += $$PWD/../../shared/qmljs $$PWD/../../shared/qmljs/parser LIBS *= -l$$qtLibraryName(QmlJS) DEFINES += QT_CREATOR diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index f8fd9f26a2..c9e1c52833 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -2015,7 +2015,7 @@ const QLatin1String CppQmlTypes::defaultPackage("<default>"); const QLatin1String CppQmlTypes::cppPackage("<cpp>"); template <typename T> -void CppQmlTypes::load(Engine *engine, const T &objects) +QList<QmlObjectValue *> CppQmlTypes::load(Engine *engine, const T &objects) { // load QList<QmlObjectValue *> newObjects; @@ -2031,10 +2031,12 @@ void CppQmlTypes::load(Engine *engine, const T &objects) foreach (QmlObjectValue *object, newObjects) { setPrototypes(object); } + + return newObjects; } // explicitly instantiate load for list and hash -template void CppQmlTypes::load< QList<FakeMetaObject::ConstPtr> >(Engine *, const QList<FakeMetaObject::ConstPtr> &); -template void CppQmlTypes::load< QHash<QString, FakeMetaObject::ConstPtr> >(Engine *, const QHash<QString, FakeMetaObject::ConstPtr> &); +template QList<QmlObjectValue *> CppQmlTypes::load< QList<FakeMetaObject::ConstPtr> >(Engine *, const QList<FakeMetaObject::ConstPtr> &); +template QList<QmlObjectValue *> CppQmlTypes::load< QHash<QString, FakeMetaObject::ConstPtr> >(Engine *, const QHash<QString, FakeMetaObject::ConstPtr> &); QList<QmlObjectValue *> CppQmlTypes::typesForImport(const QString &packageName, ComponentVersion version) const { diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 53c32f14f8..c45b4ae8d0 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -616,7 +616,7 @@ public: static const QLatin1String cppPackage; template <typename T> - void load(Interpreter::Engine *interpreter, const T &objects); + QList<QmlObjectValue *> load(Interpreter::Engine *interpreter, const T &objects); QList<Interpreter::QmlObjectValue *> typesForImport(const QString &prefix, LanguageUtils::ComponentVersion version) const; Interpreter::QmlObjectValue *typeByCppName(const QString &cppName) const; @@ -982,7 +982,6 @@ public: enum Type { InvalidImport, ImplicitDirectoryImport, - ImplicitLibraryImport, LibraryImport, FileImport, DirectoryImport, diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 6fc158fac5..1f9b947881 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -180,10 +180,6 @@ void Link::populateImportedTypes(TypeEnvironment *typeEnv, Document::Ptr doc) // qml files in the same directory are available without explicit imports loadImplicitDirectoryImports(typeEnv, doc); - // implicit imports: - // a qmldir file in the same directory gets automatically imported at the highest version - loadImplicitLibraryImports(typeEnv, doc->path()); - // explicit imports, whether directories, files or libraries foreach (const ImportInfo &info, doc->bind()->imports()) { ObjectValue *import = d->importCache.value(ImportCacheKey(info)); @@ -191,7 +187,7 @@ void Link::populateImportedTypes(TypeEnvironment *typeEnv, Document::Ptr doc) switch (info.type()) { case ImportInfo::FileImport: case ImportInfo::DirectoryImport: - import = importFile(doc, info); + import = importFileOrDirectory(doc, info); break; case ImportInfo::LibraryImport: import = importNonFile(doc, info); @@ -215,7 +211,7 @@ void Link::populateImportedTypes(TypeEnvironment *typeEnv, Document::Ptr doc) import "http://www.ovi.com/" as Ovi */ -ObjectValue *Link::importFile(Document::Ptr, const ImportInfo &importInfo) +ObjectValue *Link::importFileOrDirectory(Document::Ptr doc, const ImportInfo &importInfo) { Q_D(Link); @@ -225,6 +221,9 @@ ObjectValue *Link::importFile(Document::Ptr, const ImportInfo &importInfo) if (importInfo.type() == ImportInfo::DirectoryImport || importInfo.type() == ImportInfo::ImplicitDirectoryImport) { import = new ObjectValue(engine()); + + importLibrary(doc, import, path, importInfo); + const QList<Document::Ptr> &documentsInDirectory = d->snapshot.documentsInDirectory(path); foreach (Document::Ptr importedDoc, documentsInDirectory) { if (importedDoc->bind()->rootObjectValue()) { @@ -263,33 +262,10 @@ ObjectValue *Link::importNonFile(Document::Ptr doc, const ImportInfo &importInfo libraryPath += QDir::separator(); libraryPath += packagePath; - const LibraryInfo libraryInfo = d->snapshot.libraryInfo(libraryPath); - if (!libraryInfo.isValid()) - continue; - - importFound = true; - - if (!libraryInfo.plugins().isEmpty()) { - if (libraryInfo.dumpStatus() == LibraryInfo::DumpNotStartedOrRunning) { - ModelManagerInterface *modelManager = ModelManagerInterface::instance(); - if (modelManager) - modelManager->loadPluginTypes(libraryPath, importPath, - packageName, version.toString()); - warning(doc, locationFromRange(importInfo.ast()->firstSourceLocation(), - importInfo.ast()->lastSourceLocation()), - tr("Library contains C++ plugins, type dump is in progress.")); - } else if (libraryInfo.dumpStatus() == LibraryInfo::DumpError) { - error(doc, locationFromRange(importInfo.ast()->firstSourceLocation(), - importInfo.ast()->lastSourceLocation()), - libraryInfo.dumpError()); - } else { - engine()->cppQmlTypes().load(engine(), libraryInfo.metaObjects()); - } + if (importLibrary(doc, import, libraryPath, importInfo, importPath)) { + importFound = true; + break; } - - loadQmldirComponents(import, version, libraryInfo, libraryPath); - - break; } // if there are cpp-based types for this package, use them too @@ -310,6 +286,61 @@ ObjectValue *Link::importNonFile(Document::Ptr doc, const ImportInfo &importInfo return import; } +bool Link::importLibrary(Document::Ptr doc, Interpreter::ObjectValue *import, + const QString &libraryPath, + const Interpreter::ImportInfo &importInfo, + const QString &importPath) +{ + Q_D(Link); + + const LibraryInfo libraryInfo = d->snapshot.libraryInfo(libraryPath); + if (!libraryInfo.isValid()) + return false; + + const ComponentVersion version = importInfo.version(); + const UiImport *ast = importInfo.ast(); + SourceLocation errorLoc; + if (ast) + errorLoc = locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation()); + + if (!libraryInfo.plugins().isEmpty()) { + if (libraryInfo.dumpStatus() == LibraryInfo::DumpNotStartedOrRunning) { + ModelManagerInterface *modelManager = ModelManagerInterface::instance(); + if (modelManager) { + if (importInfo.type() == ImportInfo::LibraryImport) { + modelManager->loadPluginTypes( + libraryPath, importPath, + importInfo.name(), version.toString()); + } else { + modelManager->loadPluginTypes( + libraryPath, libraryPath, + QString(), version.toString()); + } + } + if (errorLoc.isValid()) { + warning(doc, errorLoc, + tr("Library contains C++ plugins, type dump is in progress.")); + } + } else if (libraryInfo.dumpStatus() == LibraryInfo::DumpError) { + if (errorLoc.isValid()) { + error(doc, errorLoc, libraryInfo.dumpError()); + } + } else { + QList<QmlObjectValue *> loadedObjects = + engine()->cppQmlTypes().load(engine(), libraryInfo.metaObjects()); + foreach (QmlObjectValue *object, loadedObjects) { + if (object->packageName().isEmpty()) { + import->setProperty(object->className(), object); + } + } + } + } + + loadQmldirComponents(import, version, libraryInfo, libraryPath); + + return true; +} + UiQualifiedId *Link::qualifiedTypeNameId(Node *node) { if (UiObjectBinding *binding = AST::cast<UiObjectBinding *>(node)) @@ -341,6 +372,13 @@ void Link::loadQmldirComponents(Interpreter::ObjectValue *import, ComponentVersi { Q_D(Link); + // if the version isn't valid, import the latest + if (!version.isValid()) { + const int maxVersion = std::numeric_limits<int>::max(); + version = ComponentVersion(maxVersion, maxVersion); + } + + QSet<QString> importedTypes; foreach (const QmlDirParser::Component &component, libraryInfo.components()) { if (importedTypes.contains(component.typeName)) @@ -364,10 +402,12 @@ void Link::loadImplicitDirectoryImports(TypeEnvironment *typeEnv, Document::Ptr { Q_D(Link); - ImportInfo implcitDirectoryImportInfo(ImportInfo::ImplicitDirectoryImport, doc->path()); + ImportInfo implcitDirectoryImportInfo( + ImportInfo::ImplicitDirectoryImport, doc->path()); + ObjectValue *directoryImport = d->importCache.value(ImportCacheKey(implcitDirectoryImportInfo)); if (!directoryImport) { - directoryImport = importFile(doc, implcitDirectoryImportInfo); + directoryImport = importFileOrDirectory(doc, implcitDirectoryImportInfo); if (directoryImport) d->importCache.insert(ImportCacheKey(implcitDirectoryImportInfo), directoryImport); } @@ -375,48 +415,6 @@ void Link::loadImplicitDirectoryImports(TypeEnvironment *typeEnv, Document::Ptr typeEnv->addImport(directoryImport, implcitDirectoryImportInfo); } -void Link::loadImplicitLibraryImports(TypeEnvironment *typeEnv, const QString &path) -{ - Q_D(Link); - - ImportInfo implicitLibraryImportInfo(ImportInfo::ImplicitLibraryImport, path); - ObjectValue *libraryImport = d->importCache.value(ImportCacheKey(implicitLibraryImportInfo)); - LibraryInfo libraryInfo = d->snapshot.libraryInfo(path); - if (!libraryImport && libraryInfo.isValid()) { - libraryImport = new ObjectValue(engine()); - ComponentVersion latestVersion(std::numeric_limits<int>::max(), - std::numeric_limits<int>::max()); - - loadQmldirComponents(libraryImport, latestVersion, libraryInfo, path); - - // ### since there is no way of determining the plugin URI, we can't dump - // the plugin if it has not been dumped already. - if (!libraryInfo.plugins().isEmpty() - && libraryInfo.dumpStatus() == LibraryInfo::DumpDone) { - // add types to the engine - engine()->cppQmlTypes().load(engine(), libraryInfo.metaObjects()); - - // guess a likely URI - QMap<QString, int> uris; - foreach (const FakeMetaObject::ConstPtr &fmo, libraryInfo.metaObjects()) { - foreach (const FakeMetaObject::Export &exp, fmo->exports()) { - ++uris[exp.package]; - } - } - if (!uris.isEmpty()) { - const QString uri = (uris.end() - 1).key(); - - foreach (QmlObjectValue *object, - engine()->cppQmlTypes().typesForImport(uri, latestVersion)) { - libraryImport->setProperty(object->className(), object); - } - } - } - } - if (libraryImport) - typeEnv->addImport(libraryImport, implicitLibraryImportInfo); -} - void Link::loadImplicitDefaultImports(TypeEnvironment *typeEnv) { Q_D(Link); diff --git a/src/libs/qmljs/qmljslink.h b/src/libs/qmljs/qmljslink.h index ad19a54781..a81a8faa00 100644 --- a/src/libs/qmljs/qmljslink.h +++ b/src/libs/qmljs/qmljslink.h @@ -70,16 +70,20 @@ private: void linkImports(); void populateImportedTypes(Interpreter::TypeEnvironment *typeEnv, Document::Ptr doc); - Interpreter::ObjectValue *importFile(Document::Ptr doc, const Interpreter::ImportInfo &importInfo); + Interpreter::ObjectValue *importFileOrDirectory(Document::Ptr doc, const Interpreter::ImportInfo &importInfo); Interpreter::ObjectValue *importNonFile(Document::Ptr doc, const Interpreter::ImportInfo &importInfo); void importObject(Bind *bind, const QString &name, Interpreter::ObjectValue *object, NameId *targetNamespace); + bool importLibrary(Document::Ptr doc, + Interpreter::ObjectValue *import, + const QString &libraryPath, + const Interpreter::ImportInfo &importInfo, + const QString &importPath = QString()); void loadQmldirComponents(Interpreter::ObjectValue *import, LanguageUtils::ComponentVersion version, const LibraryInfo &libraryInfo, const QString &libraryPath); void loadImplicitDirectoryImports(Interpreter::TypeEnvironment *typeEnv, Document::Ptr doc); - void loadImplicitLibraryImports(Interpreter::TypeEnvironment *typeEnv, const QString &path); void loadImplicitDefaultImports(Interpreter::TypeEnvironment *typeEnv); void error(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message); diff --git a/src/libs/symbianutils/symbianutils.pri b/src/libs/symbianutils/symbianutils.pri index c90d4da432..978aabebdb 100644 --- a/src/libs/symbianutils/symbianutils.pri +++ b/src/libs/symbianutils/symbianutils.pri @@ -1,3 +1,2 @@ INCLUDEPATH *= $$PWD/../../shared/symbianutils -DEPENDPATH += $$PWD/../../shared/symbianutils LIBS *= -l$$qtLibraryName(symbianutils) diff --git a/src/libs/valgrind/valgrindprocess.cpp b/src/libs/valgrind/valgrindprocess.cpp index cf7775d853..7dd5945de9 100644 --- a/src/libs/valgrind/valgrindprocess.cpp +++ b/src/libs/valgrind/valgrindprocess.cpp @@ -106,8 +106,14 @@ void LocalValgrindProcess::run(const QString &valgrindExecutable, const QStringL { QString arguments; Utils::QtcProcess::addArgs(&arguments, valgrindArguments); +#ifdef Q_OS_MAC + // May be slower to start but without it we get no filenames for symbols. + Utils::QtcProcess::addArg(&arguments, QLatin1String("--dsymutil=yes")); +#endif + Utils::QtcProcess::addArg(&arguments, debuggeeExecutable); Utils::QtcProcess::addArgs(&arguments, debuggeeArguments); + m_process.setCommand(valgrindExecutable, arguments); m_process.start(); m_process.waitForStarted(); diff --git a/src/plugins/analyzerbase/analyzerbase.pri b/src/plugins/analyzerbase/analyzerbase.pri index 7d37bb401d..82780bd242 100644 --- a/src/plugins/analyzerbase/analyzerbase.pri +++ b/src/plugins/analyzerbase/analyzerbase.pri @@ -1,5 +1,4 @@ include(analyzerbase_dependencies.pri) INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD LIBS *= -l$$qtLibraryName(AnalyzerBase) diff --git a/src/plugins/analyzerbase/analyzerbase.pro b/src/plugins/analyzerbase/analyzerbase.pro index a2af77de91..d224a2518b 100644 --- a/src/plugins/analyzerbase/analyzerbase.pro +++ b/src/plugins/analyzerbase/analyzerbase.pro @@ -18,7 +18,8 @@ SOURCES += \ analyzermanager.cpp \ analyzersettings.cpp \ analyzeroptionspage.cpp \ - analyzerrunconfigwidget.cpp + analyzerrunconfigwidget.cpp \ + analyzeroutputpane.cpp HEADERS += \ ianalyzerengine.h \ @@ -30,7 +31,8 @@ HEADERS += \ analyzermanager.h \ analyzersettings.h \ analyzeroptionspage.h \ - analyzerrunconfigwidget.h + analyzerrunconfigwidget.h \ + analyzeroutputpane.h RESOURCES += \ analyzerbase.qrc diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 13c807cd2e..7b36348601 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -40,6 +40,7 @@ #include "analyzerplugin.h" #include "analyzerruncontrol.h" #include "analyzeroptionspage.h" +#include "analyzeroutputpane.h" #include <coreplugin/actionmanager/command.h> #include <coreplugin/findplaceholder.h> @@ -94,6 +95,11 @@ using namespace Core; using namespace Analyzer; using namespace Analyzer::Internal; +// A separate 'Analzye' mode is not used in Qt Creator 2.2. +// Consider re-introducing it if a real use case for a separate main window with docks +// appears. +enum { useAnalyzeMode = 0 }; + namespace Analyzer { namespace Internal { @@ -183,14 +189,15 @@ public: void delayedInit(); void setupActions(); - QWidget *createContents(); - QWidget *createMainWindow(); + QWidget *createModeContents(); + QWidget *createModeMainWindow(); void addDock(IAnalyzerTool *tool, Qt::DockWidgetArea area, QDockWidget *dockWidget); void startTool(); AnalyzerManager *q; AnalyzerMode *m_mode; + AnalyzerOutputPane *m_outputpane; AnalyzerRunControlFactory *m_runControlFactory; ProjectExplorer::RunControl *m_currentRunControl; Utils::FancyMainWindow *m_mainWindow; @@ -200,14 +207,11 @@ public: QAction *m_stopAction; QMenu *m_menu; QComboBox *m_toolBox; - Utils::StyledSeparator *m_toolBoxSeparator; ActionContainer *m_viewsMenu; typedef QPair<Qt::DockWidgetArea, QDockWidget*> ToolWidgetPair; typedef QList<ToolWidgetPair> ToolWidgetPairList; QMap<IAnalyzerTool*, ToolWidgetPairList> m_toolWidgets; DockWidgetEventFilter *m_resizeEventFilter; - QMap<IAnalyzerTool*, QWidget*> m_toolToolbarWidgets; - QStackedWidget *m_toolbarStackedWidget; QMap<IAnalyzerTool *, QSettings *> m_defaultSettings; // list of dock widgets to prevent memory leak @@ -220,6 +224,7 @@ public: AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq): q(qq), m_mode(0), + m_outputpane(0), m_runControlFactory(0), m_currentRunControl(0), m_mainWindow(0), @@ -227,18 +232,20 @@ AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager m_startAction(0), m_stopAction(0), m_menu(0), - m_toolBox(0), - m_toolBoxSeparator(0), + m_toolBox(new QComboBox), m_viewsMenu(0), m_resizeEventFilter(new DockWidgetEventFilter(qq)), - m_toolbarStackedWidget(0), m_initialized(false) { + m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox")); m_runControlFactory = new AnalyzerRunControlFactory(); AnalyzerPlugin::instance()->addAutoReleasedObject(m_runControlFactory); connect(m_runControlFactory, SIGNAL(runControlCreated(Analyzer::Internal::AnalyzerRunControl *)), q, SLOT(runControlCreated(Analyzer::Internal::AnalyzerRunControl *))); + connect(m_toolBox, SIGNAL(currentIndexChanged(int)), + q, SLOT(toolSelected(int))); + setupActions(); } @@ -295,17 +302,20 @@ void AnalyzerManager::AnalyzerManagerPrivate::delayedInit() if (m_initialized) return; - m_mode = new AnalyzerMode(q); - m_mode->setWidget(createContents()); - AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode); + if (useAnalyzeMode) { + m_mode = new AnalyzerMode(q); + m_mode->setWidget(createModeContents()); + AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode); + } m_initialized = true; } -QWidget *AnalyzerManager::AnalyzerManagerPrivate::createContents() +QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeContents() { + QTC_ASSERT(useAnalyzeMode, return 0; ) // right-side window with editor, output etc. MiniSplitter *mainWindowSplitter = new MiniSplitter; - mainWindowSplitter->addWidget(createMainWindow()); + mainWindowSplitter->addWidget(createModeMainWindow()); mainWindowSplitter->addWidget(new OutputPanePlaceHolder(m_mode, mainWindowSplitter)); mainWindowSplitter->setStretchFactor(0, 10); mainWindowSplitter->setStretchFactor(1, 0); @@ -327,9 +337,19 @@ static QToolButton *toolButton(QAction *action) return button; } -QWidget *AnalyzerManager::AnalyzerManagerPrivate::createMainWindow() +QWidgetList AnalyzerManager::outputPaneToolBarWidgets() const { + QWidgetList result; + result << toolButton(d->m_startAction) << toolButton(d->m_stopAction) + << new Utils::StyledSeparator << d->m_toolBox; + return result; +} + +QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow() +{ + QTC_ASSERT(useAnalyzeMode, return 0; ) m_mainWindow = new Utils::FancyMainWindow(); + m_mainWindow->setObjectName(QLatin1String("AnalyzerManagerMainWindow")); connect(m_mainWindow, SIGNAL(resetLayout()), q, SLOT(resetLayout())); m_mainWindow->setDocumentMode(true); @@ -352,35 +372,6 @@ QWidget *AnalyzerManager::AnalyzerManagerPrivate::createMainWindow() documentAndRightPane->setStretchFactor(0, 1); documentAndRightPane->setStretchFactor(1, 0); - Utils::StyledBar *analyzeToolBar = new Utils::StyledBar; - analyzeToolBar->setProperty("topBorder", true); - QHBoxLayout *analyzeToolBarLayout = new QHBoxLayout(analyzeToolBar); - analyzeToolBarLayout->setMargin(0); - analyzeToolBarLayout->setSpacing(0); - QToolButton *startButton = toolButton(m_startAction); - analyzeToolBarLayout->addWidget(startButton); - analyzeToolBarLayout->addWidget(toolButton(m_stopAction)); - analyzeToolBarLayout->addWidget(new Utils::StyledSeparator); - m_toolBox = new QComboBox; - connect(m_toolBox, SIGNAL(currentIndexChanged(int)), - q, SLOT(toolSelected(int))); - analyzeToolBarLayout->addWidget(m_toolBox); - m_toolBoxSeparator = new Utils::StyledSeparator; - analyzeToolBarLayout->addWidget(m_toolBoxSeparator); - m_toolbarStackedWidget = new QStackedWidget; - analyzeToolBarLayout->addWidget(m_toolbarStackedWidget); - analyzeToolBarLayout->addStretch(); - - QDockWidget *dock = new QDockWidget(tr("Analyzer Toolbar")); - dock->setObjectName(QLatin1String("Analyzer Toolbar")); - dock->setWidget(analyzeToolBar); - dock->setFeatures(QDockWidget::NoDockWidgetFeatures); - dock->setProperty("managed_dockwidget", QLatin1String("true")); - dock->setAllowedAreas(Qt::BottomDockWidgetArea); - // hide title bar - dock->setTitleBarWidget(new QWidget(dock)); - m_mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dock); - m_mainWindow->setToolBarDockWidget(dock); QWidget *centralWidget = new QWidget; m_mainWindow->setCentralWidget(centralWidget); @@ -399,7 +390,7 @@ QWidget *AnalyzerManager::AnalyzerManagerPrivate::createMainWindow() void AnalyzerManager::AnalyzerManagerPrivate::addDock(IAnalyzerTool *tool, Qt::DockWidgetArea area, QDockWidget *dockWidget) { - QTC_ASSERT(tool == q->currentTool(), return) + QTC_ASSERT(useAnalyzeMode && tool == q->currentTool(), return) dockWidget->setParent(m_mainWindow); m_mainWindow->addDockWidget(area, dockWidget); @@ -448,10 +439,11 @@ bool buildTypeAcceppted(IAnalyzerTool::ToolMode toolMode, void AnalyzerManager::AnalyzerManagerPrivate::startTool() { - QTC_ASSERT(!m_currentRunControl, return); - + QTC_ASSERT(!m_currentRunControl && q->currentTool(), return); // make sure our mode is shown - ModeManager::instance()->activateMode(m_mode->id()); + m_outputpane->popup(); + if (m_mode) + ModeManager::instance()->activateMode(m_mode->id()); ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); @@ -520,14 +512,16 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool() // AnalyzerManager //////////////////////////////////////////////////// AnalyzerManager *AnalyzerManager::m_instance = 0; -AnalyzerManager::AnalyzerManager(QObject *parent) : +AnalyzerManager::AnalyzerManager(Internal::AnalyzerOutputPane *op, QObject *parent) : QObject(parent), d(new AnalyzerManagerPrivate(this)) { m_instance = this; + d->m_outputpane = op; - connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), - this, SLOT(modeChanged(Core::IMode*))); + if (useAnalyzeMode) + connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), + this, SLOT(modeChanged(Core::IMode*))); ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); connect(pe, SIGNAL(updateRunActions()), this, SLOT(updateRunActions())); @@ -545,7 +539,8 @@ bool AnalyzerManager::isInitialized() const void AnalyzerManager::shutdown() { - saveToolSettings(currentTool()); + if (useAnalyzeMode) + saveToolSettings(currentTool()); } AnalyzerManager * AnalyzerManager::instance() @@ -555,6 +550,7 @@ AnalyzerManager * AnalyzerManager::instance() void AnalyzerManager::modeChanged(IMode *mode) { + QTC_ASSERT(d->m_mainWindow, return; ) const bool makeVisible = mode->id() == Constants::MODE_ANALYZE; if (!makeVisible) return; @@ -576,7 +572,7 @@ void AnalyzerManager::toolSelected(int idx) selectingTool = true; IAnalyzerTool *oldTool = currentTool(); - if (oldTool) { + if (useAnalyzeMode && oldTool != 0) { saveToolSettings(oldTool); ActionManager *am = ICore::instance()->actionManager(); @@ -599,13 +595,13 @@ void AnalyzerManager::toolSelected(int idx) IAnalyzerTool *newTool = currentTool(); - if (QWidget *toolbarWidget = d->m_toolToolbarWidgets.value(newTool)) - d->m_toolbarStackedWidget->setCurrentWidget(toolbarWidget); - - foreach(const AnalyzerManagerPrivate::ToolWidgetPair &widget, d->m_toolWidgets.value(newTool)) { - d->addDock(newTool, widget.first, widget.second); + if (useAnalyzeMode) { + foreach (const AnalyzerManagerPrivate::ToolWidgetPair &widget, d->m_toolWidgets.value(newTool)) { + d->addDock(newTool, widget.first, widget.second); + } + loadToolSettings(newTool); } - loadToolSettings(newTool); + d->m_outputpane->setTool(newTool); selectingTool = false; } @@ -628,33 +624,23 @@ void AnalyzerManager::addTool(IAnalyzerTool *tool) d->m_toolGroup->setVisible(d->m_toolGroup->actions().count() > 1); d->m_tools.append(tool); d->m_toolBox->addItem(tool->displayName()); - d->m_toolBox->setVisible(d->m_toolBox->count() > 1); - d->m_toolBoxSeparator->setVisible(d->m_toolBox->isVisible()); - + d->m_toolBox->setEnabled(d->m_toolBox->count() > 1); if (currentTool() != tool) selectTool(tool); // the first tool gets selected automatically due to signal emission from toolbox tool->initialize(plugin); - QSettings *defaultSettings = new QSettings(this); - d->m_defaultSettings[tool] = defaultSettings; - d->m_mainWindow->saveSettings(defaultSettings); - - loadToolSettings(tool); -} - -void AnalyzerManager::setToolbar(IAnalyzerTool *tool, QWidget *widget) -{ - d->m_toolToolbarWidgets[tool] = widget; - d->m_toolbarStackedWidget->addWidget(widget); - - if (currentTool() == tool) - d->m_toolbarStackedWidget->setCurrentWidget(widget); + if (useAnalyzeMode) { + QSettings *defaultSettings = new QSettings(this); + d->m_defaultSettings[tool] = defaultSettings; + d->m_mainWindow->saveSettings(defaultSettings); + loadToolSettings(tool); + } } QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QString &title, QWidget *widget, Qt::DockWidgetArea area) { - QTC_ASSERT(!widget->objectName().isEmpty(), qt_noop()); + QTC_ASSERT(useAnalyzeMode && !widget->objectName().isEmpty(), return 0;); QDockWidget *dockWidget = d->m_mainWindow->addDockForWidget(widget); d->m_dockWidgets << AnalyzerManagerPrivate::DockPtr(dockWidget); @@ -727,6 +713,7 @@ void AnalyzerManager::resetLayout() void AnalyzerManager::loadToolSettings(IAnalyzerTool *tool) { + QTC_ASSERT(d->m_mainWindow, return; ) QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id()); if (settings->value("ToolSettingsSaved", false).toBool()) { @@ -739,6 +726,7 @@ void AnalyzerManager::saveToolSettings(IAnalyzerTool *tool) { if (!tool) return; // no active tool, do nothing + QTC_ASSERT(d->m_mainWindow, return ; ) QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id()); @@ -751,7 +739,8 @@ void AnalyzerManager::updateRunActions() { ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); ProjectExplorer::Project *project = pe->startupProject(); - bool startEnabled = !d->m_currentRunControl && pe->canRun(project, Constants::MODE_ANALYZE); + bool startEnabled = !d->m_currentRunControl && pe->canRun(project, Constants::MODE_ANALYZE) + && currentTool(); d->m_startAction->setEnabled(startEnabled); } diff --git a/src/plugins/analyzerbase/analyzermanager.h b/src/plugins/analyzerbase/analyzermanager.h index b89359c46e..0187eeb3d3 100644 --- a/src/plugins/analyzerbase/analyzermanager.h +++ b/src/plugins/analyzerbase/analyzermanager.h @@ -57,6 +57,7 @@ namespace Analyzer { class IAnalyzerTool; namespace Internal { class AnalyzerRunControl; +class AnalyzerOutputPane; } // namespace Internal class ANALYZER_EXPORT AnalyzerManager : public QObject @@ -64,7 +65,7 @@ class ANALYZER_EXPORT AnalyzerManager : public QObject Q_OBJECT public: - explicit AnalyzerManager(QObject *parent = 0); + explicit AnalyzerManager(Internal::AnalyzerOutputPane *op, QObject *parent = 0); ~AnalyzerManager(); static AnalyzerManager *instance(); @@ -83,19 +84,12 @@ public: QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title, QWidget *widget, Qt::DockWidgetArea area = Qt::TopDockWidgetArea); - /** - * Add the given @p widget into this mode's toolbar. - * - * It will be shown whenever this tool is selected by the user. - * - * @Note The manager will take ownership of @p widget. - */ - void setToolbar(Analyzer::IAnalyzerTool *tool, QWidget *widget); - Utils::FancyMainWindow *mainWindow() const; void selectTool(IAnalyzerTool *tool); + QList<QWidget *> outputPaneToolBarWidgets() const; + private slots: void startTool(); void stopTool(); diff --git a/src/plugins/analyzerbase/analyzeroutputpane.cpp b/src/plugins/analyzerbase/analyzeroutputpane.cpp new file mode 100644 index 0000000000..cc384504b5 --- /dev/null +++ b/src/plugins/analyzerbase/analyzeroutputpane.cpp @@ -0,0 +1,318 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#include "analyzeroutputpane.h" +#include "analyzermanager.h" +#include "ianalyzertool.h" + +#include <utils/qtcassert.h> +#include <utils/styledbar.h> + +#include <QtCore/QVariant> +#include <QtCore/QDebug> + +#include <QtGui/QWidget> +#include <QtGui/QStackedLayout> +#include <QtGui/QLabel> +#include <QtGui/QStackedWidget> + +static const char dummyWidgetPropertyC[] = "dummyWidget"; + +enum { debug = 0 }; +enum { dummyIndex = 0 }; + +namespace Analyzer { +namespace Internal { + +static inline QWidget *createDummyWidget() +{ + QWidget *widget = new QWidget; + widget->setProperty(dummyWidgetPropertyC, QVariant(true)); + return widget; +} + +/*! + \class AnalyzerPane::Internal::AnalyzerOutputPane + + \brief Common analysis output pane managing several tools. + + Output pane for all tools derived from IAnalyzerTool. + The IAnalyzerOutputPaneAdapter (unless 0) provides + \list + \i Pane widget + \i Optional toolbar widget + \endlist + + Both are inserted into a pane stacked layout and a stacked toolbar widget respectively. + + The indexes of the stacked widgets/layouts and the adapter list go in sync + (dummy widgets on the toolbar are used to achieve this). + Dummy widgets that are shown in case there is no tool with an output pane + are added at index 0 to the stacks (usage of index 0 is to avoid using + QStackedWidget::insert() when adding adapters, which causes flicker). + + Besides the tool-specific toolbar widget, the start/stop buttons and the combo + box of the AnalyzerManager are shown in the toolbar. + + The initialization is a bit tricky here, as the sequence of calls to + setTool(), outputWindow()/toolBarWidgets() is basically undefined. The pane widget + should be created on the correct parent when outputWindow() + is called, tools will typically be added before. + + \sa AnalyzerPane::Internal::IAnalyzerOutputPaneAdapter +*/ + +AnalyzerOutputPane::AnalyzerOutputPane(QObject *parent) : + Core::IOutputPane(parent), + m_paneWidget(0), + m_paneStackedLayout(0), + m_toolbarStackedWidget(0), + m_toolBarSeparator(0) +{ + setObjectName(QLatin1String("AnalyzerOutputPane")); +} + +void AnalyzerOutputPane::clearTool() +{ + // No tool. Show dummy label, which is the last widget. + if (m_paneWidget) { + m_paneStackedLayout->setCurrentIndex(dummyIndex); + m_toolbarStackedWidget->setCurrentIndex(dummyIndex); + emit navigateStateChanged(); + } + hide(); +} + +int AnalyzerOutputPane::currentIndex() const +{ + return m_paneStackedLayout ? m_paneStackedLayout->currentIndex() : -1; +} + +IAnalyzerOutputPaneAdapter *AnalyzerOutputPane::currentAdapter() const +{ + const int index = currentIndex(); // Rule out leading dummy widget + if (index != dummyIndex && index < m_adapters.size()) + return m_adapters.at(index); + return 0; +} + +void AnalyzerOutputPane::setCurrentIndex(int i) +{ + QTC_ASSERT(isInitialized(), return ) + + if (i != currentIndex()) { + // Show up pane widget and optional toolbar widget. Hide + // the toolbar if the toolbar widget is a dummy. + m_paneStackedLayout->setCurrentIndex(i); + m_toolbarStackedWidget->setCurrentIndex(i); + const bool hasToolBarWidget = !m_toolbarStackedWidget->currentWidget()->property(dummyWidgetPropertyC).toBool(); + m_toolbarStackedWidget->setVisible(hasToolBarWidget); + m_toolBarSeparator->setVisible(hasToolBarWidget); + navigateStateChanged(); + } +} + +void AnalyzerOutputPane::add(IAnalyzerOutputPaneAdapter *adapter) +{ + if (m_adapters.isEmpty()) + m_adapters.push_back(0); // Index for leading dummy widgets. + m_adapters.push_back(adapter); + connect(adapter, SIGNAL(navigationStatusChanged()), this, SLOT(slotNavigationStatusChanged())); + connect(adapter, SIGNAL(popup(bool)), this, SLOT(slotPopup(bool))); + if (isInitialized()) + addToWidgets(adapter); +} + +void AnalyzerOutputPane::addToWidgets(IAnalyzerOutputPaneAdapter *adapter) +{ + QTC_ASSERT(m_paneWidget, return; ) + QWidget *toolPaneWidget = adapter->paneWidget(); + QTC_ASSERT(toolPaneWidget, return; ) + m_paneStackedLayout->addWidget(toolPaneWidget); + QWidget *toolBarWidget = adapter->toolBarWidget(); // Might be 0 + m_toolbarStackedWidget->addWidget(toolBarWidget ? toolBarWidget : createDummyWidget()); +} + +void AnalyzerOutputPane::setTool(IAnalyzerTool *t) +{ + if (debug) + qDebug() << "AnalyzerOutputPane::setTool" << t; + // No tool. show dummy label. + IAnalyzerOutputPaneAdapter *adapter = t ? t->outputPaneAdapter() : + static_cast<IAnalyzerOutputPaneAdapter *>(0); + // Re-show or add. + if (adapter) { + int index = m_adapters.indexOf(adapter); + if (index == -1) { + index = m_adapters.size(); + add(adapter); + } + if (isInitialized()) { + popup(false); + setCurrentIndex(index); + } + } else { + clearTool(); + } +} + +QWidget * AnalyzerOutputPane::outputWidget(QWidget *parent) +{ + if (debug) + qDebug() << "AnalyzerOutputPane::outputWidget"; + // Delayed creation of main pane widget. Add a trailing dummy widget + // and add all adapters. + if (!isInitialized()) + createWidgets(parent); + return m_paneWidget; +} + +void AnalyzerOutputPane::createWidgets(QWidget *paneParent) +{ + // Create pane and toolbar stack with leading dummy widget. + m_paneWidget = new QWidget(paneParent); + m_paneStackedLayout = new QStackedLayout(m_paneWidget); + m_paneWidget->setObjectName(objectName() + QLatin1String("Widget")); + m_paneStackedLayout->addWidget(new QLabel(tr("No current analysis tool"))); + + m_toolbarStackedWidget = new QStackedWidget; + m_toolBarSeparator = new Utils::StyledSeparator; + m_toolbarStackedWidget->setObjectName(objectName() + QLatin1String("ToolBarStackedWidget")); + + // Add adapters added before. + const int adapterCount = m_adapters.size(); + const int firstAdapter = dummyIndex + 1; + for (int i = firstAdapter; i < adapterCount; i++) + addToWidgets(m_adapters.at(i)); + // Make last one current + if (adapterCount > firstAdapter) + setCurrentIndex(firstAdapter); +} + +QWidgetList AnalyzerOutputPane::toolBarWidgets() const +{ + if (debug) + qDebug() << "AnalyzerOutputPane::toolBarWidget"; + QTC_ASSERT(isInitialized(), return QWidgetList(); ) + + QWidgetList list = AnalyzerManager::instance()->outputPaneToolBarWidgets(); + list << m_toolBarSeparator << m_toolbarStackedWidget; + return list; +} + +QString AnalyzerOutputPane::displayName() const +{ + return tr("Analysis"); +} + +int AnalyzerOutputPane::priorityInStatusBar() const +{ + return -1; // Not visible in status bar. +} + +void AnalyzerOutputPane::clearContents() +{ + if (IAnalyzerOutputPaneAdapter *adapter = currentAdapter()) + adapter->clearContents(); +} + +void AnalyzerOutputPane::visibilityChanged(bool v) +{ + Q_UNUSED(v) +} + +void AnalyzerOutputPane::setFocus() +{ + if (IAnalyzerOutputPaneAdapter *adapter = currentAdapter()) + adapter->setFocus(); +} + +bool AnalyzerOutputPane::hasFocus() +{ + const IAnalyzerOutputPaneAdapter *adapter = currentAdapter(); + return adapter ? adapter->hasFocus() : false; +} + +bool AnalyzerOutputPane::canFocus() +{ + const IAnalyzerOutputPaneAdapter *adapter = currentAdapter(); + return adapter ? adapter->canFocus() : false; +} + +bool AnalyzerOutputPane::canNavigate() +{ + const IAnalyzerOutputPaneAdapter *adapter = currentAdapter(); + return adapter ? adapter->canNavigate() : false; +} + +bool AnalyzerOutputPane::canNext() +{ + const IAnalyzerOutputPaneAdapter *adapter = currentAdapter(); + return adapter ? adapter->canNext() : false; +} + +bool AnalyzerOutputPane::canPrevious() +{ + const IAnalyzerOutputPaneAdapter *adapter = currentAdapter(); + return adapter ? adapter->canPrevious() : false; +} + +void AnalyzerOutputPane::goToNext() +{ + if (IAnalyzerOutputPaneAdapter *adapter = currentAdapter()) + adapter->goToNext(); +} + +void AnalyzerOutputPane::goToPrev() +{ + if (IAnalyzerOutputPaneAdapter *adapter = currentAdapter()) + adapter->goToPrev(); +} + +void AnalyzerOutputPane::slotPopup(bool withFocus) +{ + popup(withFocus); +} + +void AnalyzerOutputPane::slotNavigationStatusChanged() +{ + IAnalyzerOutputPaneAdapter *adapter = qobject_cast<IAnalyzerOutputPaneAdapter *>(sender()); + const int index = m_adapters.indexOf(adapter); + QTC_ASSERT(adapter != 0 && index != -1, return; ) + // Forward navigation status if it is the current pane. + if (index == currentIndex()) + navigateStateChanged(); +} + +} // namespace Internal +} // namespace Analyzer diff --git a/src/plugins/analyzerbase/analyzeroutputpane.h b/src/plugins/analyzerbase/analyzeroutputpane.h new file mode 100644 index 0000000000..8773d5205c --- /dev/null +++ b/src/plugins/analyzerbase/analyzeroutputpane.h @@ -0,0 +1,101 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef ANALYZEROUTPUTPANE_H +#define ANALYZEROUTPUTPANE_H + +#include <coreplugin/ioutputpane.h> + +QT_FORWARD_DECLARE_CLASS(QStackedLayout) +QT_FORWARD_DECLARE_CLASS(QStackedWidget) + +namespace Utils { +class StyledSeparator; +} + +namespace Analyzer { +class IAnalyzerTool; +class IAnalyzerOutputPaneAdapter; +namespace Internal { + +class AnalyzerOutputPane : public Core::IOutputPane +{ + Q_OBJECT +public: + explicit AnalyzerOutputPane(QObject *parent = 0); + + void setTool(IAnalyzerTool *t); + // IOutputPane + virtual QWidget *outputWidget(QWidget *parent); + virtual QList<QWidget*> toolBarWidgets() const; + virtual QString displayName() const; + + virtual int priorityInStatusBar() const; + + virtual void clearContents(); + virtual void visibilityChanged(bool visible); + + virtual void setFocus(); + virtual bool hasFocus(); + virtual bool canFocus(); + virtual bool canNavigate(); + virtual bool canNext(); + virtual bool canPrevious(); + virtual void goToNext(); + virtual void goToPrev(); + +private slots: + void slotPopup(bool withFocus); + void slotNavigationStatusChanged(); + +private: + void clearTool(); + inline int currentIndex() const; + inline IAnalyzerOutputPaneAdapter *currentAdapter() const; + void setCurrentIndex(int ); + void add(IAnalyzerOutputPaneAdapter *adapter); + void addToWidgets(IAnalyzerOutputPaneAdapter *adapter); + void createWidgets(QWidget *paneParent); + bool isInitialized() const { return m_paneWidget != 0; } + + QWidget *m_paneWidget; + QStackedLayout *m_paneStackedLayout; + QList<IAnalyzerOutputPaneAdapter *> m_adapters; + QStackedWidget *m_toolbarStackedWidget; + Utils::StyledSeparator *m_toolBarSeparator; +}; + +} // namespace Internal +} // namespace Analyzer + +#endif // ANALYZEROUTPUTPANE_H diff --git a/src/plugins/analyzerbase/analyzerplugin.cpp b/src/plugins/analyzerbase/analyzerplugin.cpp index b202dc57c1..62d8f7b127 100644 --- a/src/plugins/analyzerbase/analyzerplugin.cpp +++ b/src/plugins/analyzerbase/analyzerplugin.cpp @@ -36,6 +36,7 @@ #include "analyzerplugin.h" #include "analyzerconstants.h" #include "analyzermanager.h" +#include "analyzeroutputpane.h" #include <coreplugin/imode.h> #include <coreplugin/coreconstants.h> @@ -76,7 +77,9 @@ void AnalyzerPlugin::AnalyzerPluginPrivate::initialize(const QStringList &argume { Q_UNUSED(arguments) Q_UNUSED(errorString) - m_manager = new AnalyzerManager(q); + AnalyzerOutputPane *outputPane = new AnalyzerOutputPane; + q->addAutoReleasedObject(outputPane); + m_manager = new AnalyzerManager(outputPane, q); } diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp index 110862dbb8..4596ce8c03 100644 --- a/src/plugins/analyzerbase/ianalyzertool.cpp +++ b/src/plugins/analyzerbase/ianalyzertool.cpp @@ -34,14 +34,158 @@ **************************************************************************/ #include "ianalyzertool.h" +#include "analyzeroutputpane.h" -using namespace Analyzer; +#include <utils/qtcassert.h> + +#include <QtGui/QAbstractItemView> +#include <QtGui/QItemSelectionModel> +#include <QtCore/QAbstractItemModel> +#include <QtCore/QModelIndex> + +namespace Analyzer { IAnalyzerTool::IAnalyzerTool(QObject *parent) : QObject(parent) { } +/*! + \class Analyzer::IAnalyzerOutputPaneAdapter + + \brief Adapter for handling multiple tools in the common 'Analysis' output pane. + + Provides the tool-specific output pane widget and optionally, a widget to be + inserted into into the toolbar. Ownership of them is taken by the output pane. + Forwards navigation calls issued by the output pane. +*/ + +IAnalyzerOutputPaneAdapter::IAnalyzerOutputPaneAdapter(QObject *parent) : + QObject(parent) +{ +} + +IAnalyzerOutputPaneAdapter::~IAnalyzerOutputPaneAdapter() +{ +} + +/*! + \class Analyzer::ListItemViewOutputPaneAdapter + + \brief Utility class implementing wrap-around navigation for flat lists. + + Provides an optional mechanism to pop up automatically in case errors show up. +*/ + +ListItemViewOutputPaneAdapter::ListItemViewOutputPaneAdapter(QObject *parent) : + IAnalyzerOutputPaneAdapter(parent), m_listView(0), m_showOnRowsInserted(true) +{ +} + +void ListItemViewOutputPaneAdapter::connectNavigationSignals(QAbstractItemModel *model) +{ + connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SIGNAL(navigationStatusChanged())); + connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(slotRowsInserted())); + connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SIGNAL(navigationStatusChanged())); + connect(model, SIGNAL(modelReset()), + this, SIGNAL(navigationStatusChanged())); +} + +void ListItemViewOutputPaneAdapter::slotRowsInserted() +{ + if (m_showOnRowsInserted && !m_listView->isVisible()) + emit popup(true); +} + +QWidget *ListItemViewOutputPaneAdapter::paneWidget() +{ + if (!m_listView) { + m_listView = createItemView(); + if (QAbstractItemModel *model = m_listView->model()) + connectNavigationSignals(model); + } + return m_listView; +} + +void ListItemViewOutputPaneAdapter::setFocus() +{ + if (m_listView) + m_listView->setFocus(); +} + +bool ListItemViewOutputPaneAdapter::hasFocus() const +{ + return m_listView ? m_listView->hasFocus() : false; +} + +bool ListItemViewOutputPaneAdapter::canFocus() const +{ + return true; +} + +bool ListItemViewOutputPaneAdapter::canNavigate() const +{ + return true; +} + +bool ListItemViewOutputPaneAdapter::canNext() const +{ + return rowCount() > 0; +} + +bool ListItemViewOutputPaneAdapter::canPrevious() const +{ + return rowCount() > 0; +} + +void ListItemViewOutputPaneAdapter::goToNext() +{ + setCurrentRow((currentRow() + 1) % rowCount()); +} + +void ListItemViewOutputPaneAdapter::goToPrev() +{ + const int prevRow = currentRow() - 1; + setCurrentRow(prevRow >= 0 ? prevRow : rowCount() - 1); +} + +bool ListItemViewOutputPaneAdapter::showOnRowsInserted() const +{ + return m_showOnRowsInserted; +} + +void ListItemViewOutputPaneAdapter::setShowOnRowsInserted(bool v) +{ + m_showOnRowsInserted = v; +} + +int ListItemViewOutputPaneAdapter::currentRow() const +{ + if (m_listView) { + const QModelIndex index = m_listView->selectionModel()->currentIndex(); + if (index.isValid()) + return index.row(); + } + return -1; +} + +void ListItemViewOutputPaneAdapter::setCurrentRow(int r) +{ + QTC_ASSERT(m_listView, return; ) + const QModelIndex index = m_listView->model()->index(r, 0); + m_listView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect|QItemSelectionModel::Current); + m_listView->scrollTo(index); +} + +int ListItemViewOutputPaneAdapter::rowCount() const +{ + return m_listView ? m_listView->model()->rowCount() : 0; +} + +// -------------IAnalyzerTool QString IAnalyzerTool::modeString() { switch (mode()) { @@ -54,3 +198,10 @@ QString IAnalyzerTool::modeString() } return QString(); } + +IAnalyzerOutputPaneAdapter *IAnalyzerTool::outputPaneAdapter() +{ + return 0; +} + +} // namespace Analyzer diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h index f86b0e964a..849abde056 100644 --- a/src/plugins/analyzerbase/ianalyzertool.h +++ b/src/plugins/analyzerbase/ianalyzertool.h @@ -40,6 +40,9 @@ #include <QtCore/QObject> +QT_FORWARD_DECLARE_CLASS(QAbstractItemView) +QT_FORWARD_DECLARE_CLASS(QAbstractItemModel) + namespace ProjectExplorer { class RunConfiguration; } @@ -49,9 +52,66 @@ class IPlugin; } namespace Analyzer { - class IAnalyzerEngine; +class ANALYZER_EXPORT IAnalyzerOutputPaneAdapter : public QObject +{ + Q_OBJECT +public: + explicit IAnalyzerOutputPaneAdapter(QObject *parent = 0); + virtual ~IAnalyzerOutputPaneAdapter(); + + virtual QWidget *toolBarWidget() = 0; + virtual QWidget *paneWidget() = 0; + virtual void clearContents() = 0; + virtual void setFocus() = 0; + virtual bool hasFocus() const = 0; + virtual bool canFocus() const = 0; + virtual bool canNavigate() const = 0; + virtual bool canNext() const = 0; + virtual bool canPrevious() const = 0; + virtual void goToNext() = 0; + virtual void goToPrev() = 0; + +signals: + void popup(bool withFocus); + void navigationStatusChanged(); +}; + +class ANALYZER_EXPORT ListItemViewOutputPaneAdapter : public IAnalyzerOutputPaneAdapter +{ + Q_OBJECT +public: + explicit ListItemViewOutputPaneAdapter(QObject *parent = 0); + + virtual QWidget *paneWidget(); + virtual void setFocus(); + virtual bool hasFocus() const; + virtual bool canFocus() const; + virtual bool canNavigate() const; + virtual bool canNext() const; + virtual bool canPrevious() const; + virtual void goToNext(); + virtual void goToPrev(); + + bool showOnRowsInserted() const; + void setShowOnRowsInserted(bool v); + +protected: + int currentRow() const; + void setCurrentRow(int); + int rowCount() const; + void connectNavigationSignals(QAbstractItemModel *); + virtual QAbstractItemView *createItemView() = 0; + +private slots: + void slotRowsInserted(); + +private: + QAbstractItemView *m_listView; + bool m_showOnRowsInserted; +}; + class ANALYZER_EXPORT IAnalyzerTool : public QObject { Q_OBJECT @@ -78,6 +138,8 @@ public: virtual void initialize(ExtensionSystem::IPlugin *plugin) = 0; + virtual IAnalyzerOutputPaneAdapter *outputPaneAdapter(); + virtual IAnalyzerEngine *createEngine(ProjectExplorer::RunConfiguration *runConfiguration) = 0; }; diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 6819fbbb0a..399e83f0c2 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -286,6 +286,10 @@ bool CMakeProject::parseCMakeLists() return true; QStringList allIncludePaths; + // This explicitly adds -I. to the include paths + allIncludePaths.append(projectDirectory()); + allIncludePaths.append(cbpparser.includeFiles()); + QStringList allFrameworkPaths; QList<ProjectExplorer::HeaderPath> allHeaderPaths = activeBC->toolChain()->systemHeaderPaths(); foreach (const ProjectExplorer::HeaderPath &headerPath, allHeaderPaths) { @@ -294,10 +298,7 @@ bool CMakeProject::parseCMakeLists() else allIncludePaths.append(headerPath.path()); } - // This explicitly adds -I. to the include paths - allIncludePaths.append(projectDirectory()); - allIncludePaths.append(cbpparser.includeFiles()); CPlusPlus::CppModelManagerInterface *modelmanager = CPlusPlus::CppModelManagerInterface::instance(); if (modelmanager) { diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 76976c50a2..dca8eb9359 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -294,6 +294,7 @@ void CMakeSettingsPage::pathCmakeFinished() void CMakeSettingsPage::cmakeFinished(CMakeValidator *cmakeValidator) const { if (cmakeValidator->process) { + cmakeValidator->process->waitForFinished(); QString response = cmakeValidator->process->readAll(); QRegExp versionRegexp(QLatin1String("^cmake version ([\\d\\.]*)")); versionRegexp.indexIn(response); diff --git a/src/plugins/coreplugin/coreplugin.pri b/src/plugins/coreplugin/coreplugin.pri index 7db79341c3..92714693c1 100644 --- a/src/plugins/coreplugin/coreplugin.pri +++ b/src/plugins/coreplugin/coreplugin.pri @@ -2,4 +2,3 @@ include(coreplugin_dependencies.pri) LIBS *= -l$$qtLibraryName(Core) # for ide_version.h INCLUDEPATH *= $$IDE_BUILD_TREE/src/plugins/coreplugin -DEPENDPATH *= $$IDE_BUILD_TREE/src/plugins/coreplugin diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index c25dcb3c43..63a4a52aba 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -16,10 +16,6 @@ INCLUDEPATH += dialogs \ editormanager \ progressmanager \ scriptmanager -DEPENDPATH += dialogs \ - actionmanager \ - editormanager \ - scriptmanager SOURCES += mainwindow.cpp \ editmode.cpp \ tabpositionindicator.cpp \ diff --git a/src/plugins/coreplugin/mimedatabase.cpp b/src/plugins/coreplugin/mimedatabase.cpp index ad5853deb2..50c9548b8a 100644 --- a/src/plugins/coreplugin/mimedatabase.cpp +++ b/src/plugins/coreplugin/mimedatabase.cpp @@ -712,20 +712,21 @@ unsigned MimeType::matchesFileBySuffix(Internal::FileMatchContext &c) const unsigned MimeType::matchesFileByContent(Internal::FileMatchContext &c) const { - unsigned priority = 0; - // Nope, try magic matchers on context data if (m_d->magicMatchers.isEmpty()) - return priority; + return 0; + + return matchesData(c.data()); +} - const QByteArray data = c.data(); +unsigned MimeType::matchesData(const QByteArray &data) const +{ + unsigned priority = 0; if (!data.isEmpty()) { foreach (const IMagicMatcher::IMagicMatcherSharedPointer &matcher, m_d->magicMatchers) { - if (matcher->matches(data)) { - const unsigned magicPriority = matcher->priority(); - if (magicPriority > priority) - priority = magicPriority; - } + const unsigned magicPriority = matcher->priority(); + if (magicPriority > priority && matcher->matches(data)) + priority = magicPriority; } } return priority; @@ -1093,6 +1094,7 @@ public: MimeType findByType(const QString &type) const; MimeType findByFile(const QFileInfo &f) const; + MimeType findByData(const QByteArray &data) const; QStringList filterStrings() const; @@ -1132,6 +1134,7 @@ private: bool addMimeTypes(QIODevice *device, const QString &fileName, QString *errorMessage); inline const QString &resolveAlias(const QString &name) const; MimeType findByFile(const QFileInfo &f, unsigned *priority) const; + MimeType findByData(const QByteArray &data, unsigned *priority) const; void determineLevels(); void raiseLevelRecursion(MimeMapEntry &e, int level); @@ -1367,6 +1370,49 @@ MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f, unsigned *priorityP return candidate; } +// Debugging wrapper around findByData() +MimeType MimeDatabasePrivate::findByData(const QByteArray &data) const +{ + unsigned priority = 0; + if (debugMimeDB) + qDebug() << '>' << Q_FUNC_INFO << data.left(20).toHex(); + const MimeType rc = findByData(data, &priority); + if (debugMimeDB) { + if (rc) { + qDebug() << "<MimeDatabase::findByData: match prio=" << priority << rc.type(); + } else { + qDebug() << "<MimeDatabase::findByData: no match"; + } + } + return rc; +} + +// Returns a mime type or Null one if none found +MimeType MimeDatabasePrivate::findByData(const QByteArray &data, unsigned *priorityPtr) const +{ + // Is the hierarchy set up in case we find several matches? + if (m_maxLevel < 0) { + MimeDatabasePrivate *db = const_cast<MimeDatabasePrivate *>(this); + db->determineLevels(); + } + + *priorityPtr = 0; + MimeType candidate; + + const TypeMimeTypeMap::const_iterator cend = m_typeMimeTypeMap.constEnd(); + for (int level = m_maxLevel; level >= 0; level--) + for (TypeMimeTypeMap::const_iterator it = m_typeMimeTypeMap.constBegin(); it != cend; ++it) + if (it.value().level == level) { + const unsigned contentPriority = it.value().type.matchesData(data); + if (contentPriority && contentPriority > *priorityPtr) { + *priorityPtr = contentPriority; + candidate = it.value().type; + } + } + + return candidate; +} + // Return all known suffixes QStringList MimeDatabasePrivate::suffixes() const { @@ -1623,6 +1669,14 @@ MimeType MimeDatabase::findByFile(const QFileInfo &f) const return rc; } +MimeType MimeDatabase::findByData(const QByteArray &data) const +{ + m_mutex.lock(); + const MimeType rc = m_d->findByData(data); + m_mutex.unlock(); + return rc; +} + bool MimeDatabase::addMimeType(const MimeType &mt) { m_mutex.lock(); diff --git a/src/plugins/coreplugin/mimedatabase.h b/src/plugins/coreplugin/mimedatabase.h index 722a015870..32a457f388 100644 --- a/src/plugins/coreplugin/mimedatabase.h +++ b/src/plugins/coreplugin/mimedatabase.h @@ -261,6 +261,7 @@ private: explicit MimeType(const MimeTypeData &d); unsigned matchesFileBySuffix(Internal::FileMatchContext &c) const; unsigned matchesFileByContent(Internal::FileMatchContext &c) const; + unsigned matchesData(const QByteArray &data) const; friend class Internal::BaseMimeTypeParser; friend class MimeDatabasePrivate; @@ -293,6 +294,9 @@ public: // Returns a mime type or Null one if none found MimeType findByFile(const QFileInfo &f) const; + // Returns a mime type or Null one if none found + MimeType findByData(const QByteArray &data) const; + // Convenience that mutex-locks the DB and calls a function // of the signature 'void f(const MimeType &, const QFileInfo &, const QString &)' // for each filename of a sequence. This avoids locking the DB for each diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index f06bc1b9e7..5ceef87b4b 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -274,8 +274,7 @@ static inline QString filePrefixFromTitle(const QString &title) } // Return a temp file pattern with extension or not -static inline QString tempFilePattern(const QString &prefix, - const QString &extension = QString()) +static inline QString tempFilePattern(const QString &prefix, const QString &extension) { // Get directory QString pattern = QDir::tempPath(); @@ -283,11 +282,8 @@ static inline QString tempFilePattern(const QString &prefix, pattern.append(QDir::separator()); // Prefix, placeholder, extension pattern += prefix; - pattern += QLatin1String("_XXXXXX"); - if (!extension.isEmpty()) { - pattern += QLatin1Char('.'); - pattern += extension; - } + pattern += QLatin1String("_XXXXXX."); + pattern += extension; return pattern; } @@ -322,29 +318,19 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription, messageManager->printToOutputPane(tr("Empty snippet received for \"%1\".").arg(titleDescription), true); return; } - // Write the file out and do a mime type detection on the content. Note - // that for the initial detection, there must not be a suffix - // as we want mime type detection to trigger on the content and not on - // higher-prioritized suffixes. - const QString filePrefix = filePrefixFromTitle(titleDescription); - QString errorMessage; - TemporaryFilePtr tempFile = writeTemporaryFile(tempFilePattern(filePrefix), content, &errorMessage); - if (tempFile.isNull()) { - messageManager->printToOutputPane(errorMessage); - return; - } // If the mime type has a preferred suffix (cpp/h/patch...), use that for // the temporary file. This is to make it more convenient to "Save as" // for the user and also to be able to tell a patch or diff in the VCS plugins // by looking at the file name of FileManager::currentFile() without expensive checking. // Default to "txt". QString suffix; - if (const Core::MimeType mimeType = Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(tempFile->fileName()))) + if (const Core::MimeType mimeType = Core::ICore::instance()->mimeDatabase()->findByData(content.toUtf8())) suffix = mimeType.preferredSuffix(); if (suffix.isEmpty()) suffix = QLatin1String("txt"); - // Write out with extension. - tempFile = writeTemporaryFile(tempFilePattern(filePrefix, suffix), content, &errorMessage); + const QString filePrefix = filePrefixFromTitle(titleDescription); + QString errorMessage; + TemporaryFilePtr tempFile = writeTemporaryFile(tempFilePattern(filePrefix, suffix), content, &errorMessage); if (tempFile.isNull()) { messageManager->printToOutputPane(errorMessage); return; diff --git a/src/plugins/debugger/cdb/cdb.pri b/src/plugins/debugger/cdb/cdb.pri index 2801ddd096..8a62bd5e6d 100644 --- a/src/plugins/debugger/cdb/cdb.pri +++ b/src/plugins/debugger/cdb/cdb.pri @@ -13,4 +13,3 @@ SOURCES += $$PWD/cdbengine.cpp \ FORMS += cdb/cdboptionspagewidget.ui INCLUDEPATH*=$$PWD -DEPENDPATH*=$$PWD diff --git a/src/plugins/debugger/debugger.pri b/src/plugins/debugger/debugger.pri index d2df959e56..357158b002 100644 --- a/src/plugins/debugger/debugger.pri +++ b/src/plugins/debugger/debugger.pri @@ -1,5 +1,4 @@ include(debugger_dependencies.pri) INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD LIBS *= -l$$qtLibraryName(Debugger) diff --git a/src/plugins/debugger/gdb/codagdbadapter.cpp b/src/plugins/debugger/gdb/codagdbadapter.cpp index 69196ca380..5b0dbd4f15 100644 --- a/src/plugins/debugger/gdb/codagdbadapter.cpp +++ b/src/plugins/debugger/gdb/codagdbadapter.cpp @@ -256,18 +256,8 @@ void CodaGdbAdapter::handleCodaRunControlModuleLoadContextSuspendedEvent(const C m_session.codeseg = minfo.codeAddress; m_session.dataseg = minfo.dataAddress; logMessage(startMsg(m_session), LogMisc); - // 26.8.2010: When paging occurs in S^3, bogus starting ROM addresses - // like 0x500000 or 0x40000 are reported. Warn about symbol resolution - // errors. Code duplicated in TrkAdapter. @TODO: Hopefully fixed in - // future TRK versions. - if ((m_session.codeseg & 0xFFFFF) == 0) { - const QString warnMessage = tr("The reported code segment address " - "(0x%1) might be invalid. Symbol resolution or setting breakoints " - "may not work.").arg(m_session.codeseg, 0, 16); - logMessage(warnMessage, LogError); - } - const QByteArray symbolFile = m_symbolFile.toLocal8Bit(); + const QByteArray symbolFile = m_symbolFile.toLocal8Bit(); if (symbolFile.isEmpty()) { logMessage(_("WARNING: No symbol file available."), LogError); } else { @@ -299,7 +289,7 @@ void CodaGdbAdapter::handleTargetRemote(const GdbResponse &record) if (debug) qDebug() << "handleTargetRemote" << m_session.toString(); } else { - QString msg = tr("Connecting to TRK server adapter failed:\n") + QString msg = tr("Connecting to CODA server adapter failed:\n") + QString::fromLocal8Bit(record.data.findChild("msg").data()); m_engine->notifyInferiorSetupFailed(msg); } @@ -1232,7 +1222,7 @@ void CodaGdbAdapter::shutdownAdapter() m_engine->notifyAdapterShutdownOk(); } else { // Something is wrong, gdb crashed. Kill debuggee (see handleDeleteProcess2) - if (m_codaDevice->device()->isOpen()) { + if (m_codaDevice && m_codaDevice->device()->isOpen()) { logMessage("Emergency shutdown of CODA", LogError); sendRunControlTerminateCommand(); } diff --git a/src/plugins/designer/cpp/cpp.pri b/src/plugins/designer/cpp/cpp.pri index 2df8138f63..a30a794022 100644 --- a/src/plugins/designer/cpp/cpp.pri +++ b/src/plugins/designer/cpp/cpp.pri @@ -1,5 +1,4 @@ INCLUDEPATH+=$$PWD -DEPENDPATH+=$$PWD DEFINES+=CPP_ENABLED diff --git a/src/plugins/git/gitorious/gitorious.pri b/src/plugins/git/gitorious/gitorious.pri index d10e09c15b..8678042a26 100644 --- a/src/plugins/git/gitorious/gitorious.pri +++ b/src/plugins/git/gitorious/gitorious.pri @@ -1,6 +1,5 @@ QT += network INCLUDEPATH+=$$PWD -DEPENDPATH+=$$PWD HEADERS += $$PWD/gitoriousclonewizard.h \ $$PWD/gitorioushostwizardpage.h \ diff --git a/src/plugins/memcheck/memcheck.pri b/src/plugins/memcheck/memcheck.pri index 85b4382fbd..9224189ba2 100644 --- a/src/plugins/memcheck/memcheck.pri +++ b/src/plugins/memcheck/memcheck.pri @@ -1,5 +1,4 @@ include(memcheck_dependencies.pri) INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD LIBS *= -l$$qtLibraryName(Memcheck) diff --git a/src/plugins/memcheck/memcheckplugin.cpp b/src/plugins/memcheck/memcheckplugin.cpp index da888fc149..7c66ab53fe 100644 --- a/src/plugins/memcheck/memcheckplugin.cpp +++ b/src/plugins/memcheck/memcheckplugin.cpp @@ -63,7 +63,6 @@ bool MemcheckPlugin::initialize(const QStringList &/*arguments*/, QString */*err AnalyzerGlobalSettings::instance()->registerSubConfigFactory(new MemcheckConfigFactory); AnalyzerManager::instance()->addTool(new MemcheckTool(this)); - return true; } diff --git a/src/plugins/memcheck/memchecktool.cpp b/src/plugins/memcheck/memchecktool.cpp index 3240c8a1ff..f5470a95a9 100644 --- a/src/plugins/memcheck/memchecktool.cpp +++ b/src/plugins/memcheck/memchecktool.cpp @@ -91,10 +91,29 @@ #include <QtGui/QCheckBox> #include <utils/stylehelper.h> -using namespace Analyzer; -using namespace Analyzer::Internal; using namespace Valgrind::XmlProtocol; +namespace Analyzer { +namespace Internal { + +// Adapter for output pane. +class MemCheckOutputPaneAdapter : public Analyzer::ListItemViewOutputPaneAdapter +{ +public: + explicit MemCheckOutputPaneAdapter(MemcheckTool *mct) : + ListItemViewOutputPaneAdapter(mct), m_tool(mct) {} + + virtual QWidget *toolBarWidget() { return m_tool->createPaneToolBarWidget(); } + virtual void clearContents() { m_tool->clearErrorView(); } + +protected: + virtual QAbstractItemView *createItemView() { return m_tool->ensurePaneErrorView(); } + +private: + MemcheckTool *m_tool; +}; + +// ---------------------------- MemcheckErrorFilterProxyModel MemcheckErrorFilterProxyModel::MemcheckErrorFilterProxyModel(QObject *parent) : QSortFilterProxyModel(parent), m_filterExternalIssues(false) @@ -174,19 +193,52 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel return true; } +static void initKindFilterAction(QAction *action, const QList<int> &kinds) +{ + action->setCheckable(true); + QVariantList data; + foreach (int kind, kinds) + data << kind; + action->setData(data); +} + MemcheckTool::MemcheckTool(QObject *parent) : Analyzer::IAnalyzerTool(parent), m_settings(0), m_errorModel(0), m_errorProxyModel(0), m_errorView(0), - m_prevAction(0), - m_nextAction(0), - m_clearAction(0), - m_filterProjectAction(0) + m_filterProjectAction(new QAction(tr("External Errors"), this)), + m_suppressionSeparator(new QAction(tr("Suppressions"), this)), + m_outputPaneAdapter(0) { + setObjectName(QLatin1String("MemcheckTool")); connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(updateRunActions()), SLOT(maybeActiveRunConfigurationChanged())); + + QAction *a = new QAction(tr("Definite Memory Leaks"), this); + initKindFilterAction(a, QList<int>() << Leak_DefinitelyLost << Leak_IndirectlyLost); + m_errorFilterActions << a; + + a = new QAction(tr("Possible Memory Leaks"), this); + initKindFilterAction(a, QList<int>() << Leak_PossiblyLost << Leak_StillReachable); + m_errorFilterActions << a; + + a = new QAction(tr("Use of Uninitialized Memory"), this); + initKindFilterAction(a, QList<int>() << InvalidRead << InvalidWrite << InvalidJump << Overlap + << InvalidMemPool << UninitCondition << UninitValue + << SyscallParam << ClientCheck); + m_errorFilterActions << a; + + a = new QAction(tr("Invalid Frees"), this); + initKindFilterAction(a, QList<int>() << InvalidFree << MismatchedFree); + m_errorFilterActions << a; + + m_filterProjectAction->setToolTip(tr("Show issues originating outside currently opened projects.")); + m_filterProjectAction->setCheckable(true); + + m_suppressionSeparator->setSeparator(true); + m_suppressionSeparator->setToolTip(tr("These suppression files where used in the last memory analyzer run.")); } void MemcheckTool::settingsDestroyed(QObject *settings) @@ -267,8 +319,6 @@ IAnalyzerTool::ToolMode MemcheckTool::mode() const return DebugMode; } -namespace Analyzer { -namespace Internal { class FrameFinder : public ErrorListModel::RelevantFrameFinder { public: Frame findRelevant(const Error &error) const { @@ -310,130 +360,61 @@ public: private: QStringList m_projectFiles; }; -} -} -static void initKindFilterAction(QAction *action, const QList<int> &kinds) +MemcheckErrorView *MemcheckTool::ensurePaneErrorView() { - action->setCheckable(true); - QVariantList data; - foreach (int kind, kinds) - data << kind; - action->setData(data); + if (!m_errorView) { + m_errorView = new MemcheckErrorView; + m_errorView->setObjectName(QLatin1String("MemcheckErrorView")); + m_errorView->setFrameStyle(QFrame::NoFrame); + m_errorView->setAttribute(Qt::WA_MacShowFocusRect, false); + m_errorModel = new ErrorListModel(m_errorView); + m_frameFinder = new Internal::FrameFinder; + m_errorModel->setRelevantFrameFinder(QSharedPointer<Internal::FrameFinder>(m_frameFinder)); + m_errorProxyModel = new MemcheckErrorFilterProxyModel(m_errorView); + m_errorProxyModel->setSourceModel(m_errorModel); + m_errorProxyModel->setDynamicSortFilter(true); + m_errorView->setModel(m_errorProxyModel); + m_errorView->setSelectionMode(QAbstractItemView::ExtendedSelection); + // make m_errorView->selectionModel()->selectedRows() return something + m_errorView->setSelectionBehavior(QAbstractItemView::SelectRows); + m_errorView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); + m_errorView->setAutoScroll(false); + m_errorView->setObjectName("Valgrind.MemcheckTool.ErrorView"); + } + return m_errorView; } -void MemcheckTool::initialize(ExtensionSystem::IPlugin */*plugin*/) +QWidget *MemcheckTool::createPaneToolBarWidget() { - AnalyzerManager *am = AnalyzerManager::instance(); - - m_errorView = new MemcheckErrorView; - m_errorView->setFrameStyle(QFrame::NoFrame); - m_errorView->setAttribute(Qt::WA_MacShowFocusRect, false); - m_errorModel = new ErrorListModel(m_errorView); - m_frameFinder = new FrameFinder; - m_errorModel->setRelevantFrameFinder(QSharedPointer<FrameFinder>(m_frameFinder)); - m_errorProxyModel = new MemcheckErrorFilterProxyModel(m_errorView); - m_errorProxyModel->setSourceModel(m_errorModel); - m_errorProxyModel->setDynamicSortFilter(true); - m_errorView->setModel(m_errorProxyModel); - m_errorView->setSelectionMode(QAbstractItemView::ExtendedSelection); - // make m_errorView->selectionModel()->selectedRows() return something - m_errorView->setSelectionBehavior(QAbstractItemView::SelectRows); - m_errorView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); - m_errorView->setAutoScroll(false); - m_errorView->setObjectName("Valgrind.MemcheckTool.ErrorView"); - - am->createDockWidget(this, tr("Memory Errors"), m_errorView, Qt::BottomDockWidgetArea); - + QWidget *toolbarWidget = new QWidget; + toolbarWidget->setObjectName(QLatin1String("MemCheckToolBarWidget")); QHBoxLayout *layout = new QHBoxLayout; layout->setMargin(0); layout->setSpacing(0); - - { // clear / next / prev - QToolButton *button = 0; - - m_clearAction = new QAction(this); - m_clearAction->setIcon(QIcon(Core::Constants::ICON_CLEAN_PANE)); - m_clearAction->setText(tr("Clear")); - connect(m_clearAction, SIGNAL(triggered()), this, SLOT(slotClear())); - button = new QToolButton; - button->setDefaultAction(m_clearAction); - layout->addWidget(button); - - m_prevAction = new QAction(this); - m_prevAction->setIcon(QIcon(QLatin1String(Core::Constants::ICON_PREV))); - m_prevAction->setText(tr("Previous Item")); - connect(m_prevAction, SIGNAL(triggered()), this, SLOT(slotPrev())); - button = new QToolButton; - button->setDefaultAction(m_prevAction); - layout->addWidget(button); - - m_nextAction = new QAction(this); - m_nextAction->setIcon(QIcon(QLatin1String(Core::Constants::ICON_NEXT))); - m_nextAction->setText(tr("Next Item")); - connect(m_nextAction, SIGNAL(triggered()), this, SLOT(slotNext())); - button = new QToolButton; - button->setDefaultAction(m_nextAction); - layout->addWidget(button); - } - { // filter QToolButton *filterButton = new QToolButton; filterButton->setIcon(QIcon(Core::Constants::ICON_FILTER)); filterButton->setText(tr("Error Filter")); filterButton->setPopupMode(QToolButton::InstantPopup); QMenu *filterMenu = new QMenu(filterButton); - - QAction *a = filterMenu->addAction(tr("Definite Memory Leaks")); - initKindFilterAction(a, QList<int>() << Leak_DefinitelyLost << Leak_IndirectlyLost); - m_errorFilterActions << a; - - a = filterMenu->addAction(tr("Possible Memory Leaks")); - initKindFilterAction(a, QList<int>() << Leak_PossiblyLost << Leak_StillReachable); - m_errorFilterActions << a; - - a = filterMenu->addAction(tr("Use of Uninitialized Memory")); - initKindFilterAction(a, QList<int>() << InvalidRead << InvalidWrite << InvalidJump << Overlap - << InvalidMemPool << UninitCondition << UninitValue - << SyscallParam << ClientCheck); - m_errorFilterActions << a; - - a = filterMenu->addAction(tr("Invalid Frees")); - initKindFilterAction(a, QList<int>() << InvalidFree << MismatchedFree); - m_errorFilterActions << a; - + foreach (QAction *filterAction, m_errorFilterActions) + filterMenu->addAction(filterAction); filterMenu->addSeparator(); - - m_filterProjectAction = filterMenu->addAction(tr("External Errors")); - m_filterProjectAction->setToolTip(tr("Show issues originating outside currently opened projects.")); - m_filterProjectAction->setCheckable(true); - - m_suppressionSeparator = filterMenu->addSeparator(); - m_suppressionSeparator->setText(tr("Suppressions")); - m_suppressionSeparator->setToolTip(tr("These suppression files where used in the last memory analyzer run.")); - + filterMenu->addAction(m_filterProjectAction); + filterMenu->addAction(m_suppressionSeparator); connect(filterMenu, SIGNAL(triggered(QAction *)), SLOT(updateErrorFilter())); filterButton->setMenu(filterMenu); layout->addWidget(filterButton); - } - layout->addStretch(); - QWidget *toolbar = new QWidget; - toolbar->setLayout(layout); - am->setToolbar(this, toolbar); + toolbarWidget->setLayout(layout); + return toolbarWidget; +} +void MemcheckTool::initialize(ExtensionSystem::IPlugin */*plugin*/) +{ + ensurePaneErrorView(); // register shortcuts - Core::ActionManager *actionManager = Core::ICore::instance()->actionManager(); - const Core::Context analyzeContext(Constants::C_ANALYZEMODE); - - Core::Command *cmd; - - cmd = actionManager->registerAction(m_prevAction, "Analyzer.MemcheckTool.previtem", analyzeContext); - cmd->setDefaultKeySequence(QKeySequence("Shift+F10")); - - cmd = actionManager->registerAction(m_nextAction, "Analyzer.MemcheckTool.nextitem", analyzeContext); - cmd->setDefaultKeySequence(QKeySequence("F10")); - maybeActiveRunConfigurationChanged(); } @@ -454,7 +435,7 @@ IAnalyzerEngine *MemcheckTool::createEngine(ProjectExplorer::RunConfiguration *r void MemcheckTool::engineStarting(const IAnalyzerEngine *engine) { - slotClear(); + clearErrorView(); const QString dir = engine->runConfiguration()->target()->project()->projectDirectory(); const MemcheckEngine *mEngine = dynamic_cast<const MemcheckEngine*>(engine); @@ -463,7 +444,7 @@ void MemcheckTool::engineStarting(const IAnalyzerEngine *engine) m_errorView->setDefaultSuppressionFile(dir + QDir::separator() + name + QLatin1String(".supp")); - QMenu *menu = qobject_cast<QMenu*>(m_suppressionSeparator->parentWidget()); + QMenu *menu = filterMenu(); QTC_ASSERT(menu, return); foreach(const QString &file, mEngine->suppressionFiles()) { QAction *action = menu->addAction(QFileInfo(file).fileName()); @@ -475,6 +456,15 @@ void MemcheckTool::engineStarting(const IAnalyzerEngine *engine) } } +QMenu *MemcheckTool::filterMenu() const +{ + QTC_ASSERT(m_suppressionSeparator, return 0; ) + foreach (QWidget *w, m_suppressionSeparator->associatedWidgets()) + if (QMenu *menu = qobject_cast<QMenu*>(w)) + return menu; + return 0; +} + void MemcheckTool::suppressionActionTriggered() { QAction *action = qobject_cast<QAction*>(sender()); @@ -495,48 +485,13 @@ void MemcheckTool::internalParserError(const QString &errorString) QMessageBox::critical(m_errorView, tr("Internal Error"), tr("Error occurred parsing valgrind output: %1").arg(errorString)); } -void MemcheckTool::slotNext() -{ - QModelIndex current = m_errorView->selectionModel()->currentIndex(); - if (!current.isValid()) { - if (!m_errorView->model()->rowCount()) - return; - - current = m_errorView->model()->index(0, 0); - } else if (current.row() < m_errorView->model()->rowCount(current.parent()) - 1) { - current = m_errorView->model()->index(current.row() + 1, 0); - } else { - return; - } - - m_errorView->selectionModel()->setCurrentIndex(current, QItemSelectionModel::ClearAndSelect); - m_errorView->scrollTo(current); -} - -void MemcheckTool::slotPrev() -{ - QModelIndex current = m_errorView->selectionModel()->currentIndex(); - if (!current.isValid()) { - if (!m_errorView->model()->rowCount()) - return; - current = m_errorView->model()->index(m_errorView->model()->rowCount() - 1, 0); - } else if (current.row() > 0) { - current = m_errorView->model()->index(current.row() - 1, 0); - } else { - return; - } - - m_errorView->selectionModel()->setCurrentIndex(current, QItemSelectionModel::ClearAndSelect); - m_errorView->scrollTo(current); -} - -void MemcheckTool::slotClear() +void MemcheckTool::clearErrorView() { m_errorModel->clear(); qDeleteAll(m_suppressionActions); m_suppressionActions.clear(); - QTC_ASSERT(m_suppressionSeparator->parentWidget()->actions().last() == m_suppressionSeparator, qt_noop()); + QTC_ASSERT(filterMenu()->actions().last() == m_suppressionSeparator, qt_noop()); } void MemcheckTool::updateErrorFilter() @@ -560,3 +515,13 @@ void MemcheckTool::updateErrorFilter() } memcheckSettings->setVisibleErrorKinds(errorKinds); } + +IAnalyzerOutputPaneAdapter *MemcheckTool::outputPaneAdapter() +{ + if (!m_outputPaneAdapter) + m_outputPaneAdapter = new MemCheckOutputPaneAdapter(this); + return m_outputPaneAdapter; +} + +} // namespace Internal +} // namespace Analyzer diff --git a/src/plugins/memcheck/memchecktool.h b/src/plugins/memcheck/memchecktool.h index 1aa26068fe..e71cb83ed8 100644 --- a/src/plugins/memcheck/memchecktool.h +++ b/src/plugins/memcheck/memchecktool.h @@ -48,6 +48,7 @@ class QModelIndex; class QAction; class QSpinBox; class QCheckBox; +class QMenu; QT_END_NAMESPACE namespace Valgrind { @@ -58,11 +59,9 @@ class Error; } namespace Analyzer { - class AnalyzerSettings; - namespace Internal { - +class MemCheckOutputPaneAdapter; class MemcheckErrorView; class FrameFinder; @@ -95,8 +94,14 @@ public: void initialize(ExtensionSystem::IPlugin *plugin); + virtual IAnalyzerOutputPaneAdapter *outputPaneAdapter(); IAnalyzerEngine *createEngine(ProjectExplorer::RunConfiguration *runConfiguration); + // For the output pane adapter. + MemcheckErrorView *ensurePaneErrorView(); + QWidget *createPaneToolBarWidget(); + void clearErrorView(); + private slots: void settingsDestroyed(QObject *settings); void maybeActiveRunConfigurationChanged(); @@ -104,13 +109,9 @@ private slots: void engineStarting(const IAnalyzerEngine *engine); void parserError(const Valgrind::XmlProtocol::Error &error); void internalParserError(const QString &errorString); - - void slotNext(); - void slotPrev(); - void slotClear(); - void updateErrorFilter(); void suppressionActionTriggered(); + QMenu *filterMenu() const; private: AnalyzerSettings *m_settings; @@ -120,13 +121,11 @@ private: MemcheckErrorFilterProxyModel *m_errorProxyModel; MemcheckErrorView *m_errorView; - QAction *m_prevAction; - QAction *m_nextAction; - QAction *m_clearAction; QList<QAction *> m_errorFilterActions; QAction *m_filterProjectAction; QList<QAction *> m_suppressionActions; QAction *m_suppressionSeparator; + MemCheckOutputPaneAdapter *m_outputPaneAdapter; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp index 3589955063..1314bc2a5a 100644 --- a/src/plugins/projectexplorer/abi.cpp +++ b/src/plugins/projectexplorer/abi.cpp @@ -310,6 +310,11 @@ QString Abi::toString() const return dn.join(QLatin1String("-")); } +bool Abi::operator != (const Abi &other) const +{ + return !operator ==(other); +} + bool Abi::operator == (const Abi &other) const { return m_architecture == other.m_architecture diff --git a/src/plugins/projectexplorer/abi.h b/src/plugins/projectexplorer/abi.h index af162d3fc3..98dbcbb924 100644 --- a/src/plugins/projectexplorer/abi.h +++ b/src/plugins/projectexplorer/abi.h @@ -107,6 +107,7 @@ public: const OSFlavor &so, const BinaryFormat &f, unsigned char w); Abi(const QString &abiString); + bool operator != (const Abi &other) const; bool operator == (const Abi &other) const; bool isCompatibleWith(const Abi &other) const; diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 77573066e0..849a82c3b3 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -49,9 +49,9 @@ #include <QtCore/QProcess> #include <QtCore/QScopedPointer> +#include <QtGui/QComboBox> #include <QtGui/QFormLayout> #include <QtGui/QLabel> -#include <QtGui/QCheckBox> namespace ProjectExplorer { @@ -60,7 +60,7 @@ namespace ProjectExplorer { // -------------------------------------------------------------------------- static const char compilerPathKeyC[] = "ProjectExplorer.GccToolChain.Path"; -static const char force32bitKeyC[] = "ProjectExplorer.GccToolChain.Force32Bit"; +static const char targetAbiKeyC[] = "ProjectExplorer.GccToolChain.TargetAbi"; static const char debuggerCommandKeyC[] = "ProjectExplorer.GccToolChain.Debugger"; static QByteArray runGcc(const QString &gcc, const QStringList &arguments, const QStringList &env) @@ -162,11 +162,13 @@ static QList<HeaderPath> gccHeaderPathes(const QString &gcc, const QStringList & return systemHeaderPaths; } -static ProjectExplorer::Abi guessGccAbi(const QString &m) +static QList<ProjectExplorer::Abi> guessGccAbi(const QString &m) { + QList<ProjectExplorer::Abi> abiList; + QString machine = m.toLower(); if (machine.isEmpty()) - return ProjectExplorer::Abi(); + return abiList; QStringList parts = machine.split(QRegExp("[ /-]")); @@ -223,11 +225,28 @@ static ProjectExplorer::Abi guessGccAbi(const QString &m) } if (unknownCount == parts.count()) - return ProjectExplorer::Abi(); - return ProjectExplorer::Abi(arch, os, flavor, format, width); + return abiList; + + if (os == Abi::MacOS) { + // Apple does PPC and x86! + abiList << ProjectExplorer::Abi(arch, os, flavor, format, width); + if (width == 64) + abiList << ProjectExplorer::Abi(arch, os, flavor, format, 32); + if (arch != Abi::PowerPCArchitecture) { + abiList << ProjectExplorer::Abi(Abi::PowerPCArchitecture, os, flavor, format, width); + if (width == 64) + abiList << ProjectExplorer::Abi(Abi::PowerPCArchitecture, os, flavor, format, 32); + } + } else if (width == 64) { + abiList << ProjectExplorer::Abi(arch, os, flavor, format, width); + abiList << ProjectExplorer::Abi(arch, os, flavor, format, 32); + } else { + abiList << ProjectExplorer::Abi(arch, os, flavor, format, width); + } + return abiList; } -static ProjectExplorer::Abi guessGccAbi(const QString &path, const QStringList &env) +static QList<ProjectExplorer::Abi> guessGccAbi(const QString &path, const QStringList &env) { QStringList arguments(QLatin1String("-dumpmachine")); QString machine = QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed(); @@ -239,23 +258,17 @@ static ProjectExplorer::Abi guessGccAbi(const QString &path, const QStringList & // -------------------------------------------------------------------------- GccToolChain::GccToolChain(bool autodetect) : - ToolChain(QLatin1String(Constants::GCC_TOOLCHAIN_ID), autodetect), - m_forcedTo32Bit(false), - m_supports64Bit(false) + ToolChain(QLatin1String(Constants::GCC_TOOLCHAIN_ID), autodetect) { } GccToolChain::GccToolChain(const QString &id, bool autodetect) : - ToolChain(id, autodetect), - m_forcedTo32Bit(false), - m_supports64Bit(false) + ToolChain(id, autodetect) { } GccToolChain::GccToolChain(const GccToolChain &tc) : ToolChain(tc), m_compilerPath(tc.compilerPath()), m_debuggerCommand(tc.debuggerCommand()), - m_forcedTo32Bit(tc.m_forcedTo32Bit), - m_supports64Bit(tc.m_supports64Bit), m_targetAbi(tc.m_targetAbi) { setCompilerPath(tc.m_compilerPath); @@ -274,7 +287,7 @@ void GccToolChain::updateId() { QString i = id(); i = i.left(i.indexOf(QLatin1Char(':'))); - setId(QString::fromLatin1("%1:%2.%3").arg(i).arg(m_compilerPath).arg(m_forcedTo32Bit)); + setId(QString::fromLatin1("%1:%2.%3").arg(i).arg(m_compilerPath).arg(m_targetAbi.toString())); } QString GccToolChain::typeName() const @@ -284,21 +297,22 @@ QString GccToolChain::typeName() const Abi GccToolChain::targetAbi() const { - if (!m_targetAbi.isValid()) { - Utils::Environment env = Utils::Environment::systemEnvironment(); - addToEnvironment(env); - m_targetAbi = guessGccAbi(m_compilerPath, env.toStringList()); - m_supports64Bit = (m_targetAbi.wordWidth() == 64); - if (m_targetAbi.wordWidth() == 64 && m_forcedTo32Bit) - m_targetAbi = Abi(m_targetAbi.architecture(), m_targetAbi.os(), m_targetAbi.osFlavor(), - m_targetAbi.binaryFormat(), 32); - - if (displayName() == typeName()) - setDisplayName(defaultDisplayName()); - } return m_targetAbi; } +void GccToolChain::setTargetAbi(const Abi &abi) +{ + updateSupportedAbis(); + if (m_supportedAbis.contains(abi)) + m_targetAbi = abi; +} + +QList<Abi> GccToolChain::supportedAbis() const +{ + updateSupportedAbis(); + return m_supportedAbis; +} + bool GccToolChain::isValid() const { return !m_compilerPath.isNull(); @@ -360,13 +374,18 @@ void GccToolChain::setCompilerPath(const QString &path) if (displayName() == defaultDisplayName()) setDisplayName(typeName()); m_compilerPath = path; - m_targetAbi = Abi(); - updateId(); + m_supportedAbis.clear(); - if (m_compilerPath.isEmpty()) - return; + m_targetAbi = Abi(); + if (!m_compilerPath.isEmpty()) { + updateSupportedAbis(); + if (!m_supportedAbis.isEmpty()) + m_targetAbi = m_supportedAbis.at(0); - targetAbi(); // update ABI information (and default display name) + if (displayName() == typeName()) + setDisplayName(defaultDisplayName()); + } + updateId(); } QString GccToolChain::compilerPath() const @@ -374,30 +393,6 @@ QString GccToolChain::compilerPath() const return m_compilerPath; } -bool GccToolChain::isForcedTo32Bit() const -{ - return m_forcedTo32Bit; -} -void GccToolChain::forceTo32Bit(bool f) -{ - if (f == m_forcedTo32Bit) - return; - - if (displayName() == defaultDisplayName()) - setDisplayName(typeName()); - - m_forcedTo32Bit = f; - m_targetAbi = Abi(); // Invalidate ABI. - updateId(); - - targetAbi(); -} - -bool GccToolChain::supports64Bit() const -{ - return m_supports64Bit; -} - ToolChain *GccToolChain::clone() const { return new GccToolChain(*this); @@ -407,7 +402,7 @@ QVariantMap GccToolChain::toMap() const { QVariantMap data = ToolChain::toMap(); data.insert(QLatin1String(compilerPathKeyC), m_compilerPath); - data.insert(QLatin1String(force32bitKeyC), m_forcedTo32Bit); + data.insert(QLatin1String(targetAbiKeyC), m_targetAbi.toString()); data.insert(QLatin1String(debuggerCommandKeyC), m_debuggerCommand); return data; } @@ -418,7 +413,7 @@ bool GccToolChain::fromMap(const QVariantMap &data) return false; m_compilerPath = data.value(QLatin1String(compilerPathKeyC)).toString(); - m_forcedTo32Bit = data.value(QLatin1String(force32bitKeyC)).toBool(); + m_targetAbi = Abi(data.value(QLatin1String(targetAbiKeyC)).toString()); m_debuggerCommand = data.value(QLatin1String(debuggerCommandKeyC)).toString(); updateId(); return true; @@ -430,7 +425,7 @@ bool GccToolChain::operator ==(const ToolChain &other) const return false; const GccToolChain *gccTc = static_cast<const GccToolChain *>(&other); - return m_compilerPath == gccTc->m_compilerPath && m_forcedTo32Bit == gccTc->m_forcedTo32Bit + return m_compilerPath == gccTc->m_compilerPath && m_targetAbi == gccTc->m_targetAbi && m_debuggerCommand == gccTc->m_debuggerCommand; } @@ -439,6 +434,15 @@ ToolChainConfigWidget *GccToolChain::configurationWidget() return new Internal::GccToolChainConfigWidget(this); } +void GccToolChain::updateSupportedAbis() const +{ + if (m_supportedAbis.isEmpty()) { + Utils::Environment env = Utils::Environment::systemEnvironment(); + addToEnvironment(env); + m_supportedAbis = guessGccAbi(m_compilerPath, env.toStringList()); + } +} + // -------------------------------------------------------------------------- // GccToolChainFactory // -------------------------------------------------------------------------- @@ -504,6 +508,11 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QSt const QString compilerPath = systemEnvironment.searchInPath(compiler); if (compilerPath.isEmpty()) return result; + + QList<Abi> abiList = guessGccAbi(compilerPath, systemEnvironment.toStringList()); + if (!abiList.contains(requiredAbi)) + return result; + QString debuggerPath; // Find the first debugger foreach (const QString &debugger, debuggers) { debuggerPath = systemEnvironment.searchInPath(debugger); @@ -511,29 +520,17 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QSt break; } - // Create 64bit - QScopedPointer<GccToolChain> tc(createToolChain(true)); - if (tc.isNull()) - return result; - - tc->setCompilerPath(compilerPath); - tc->setDebuggerCommand(debuggerPath); - const ProjectExplorer::Abi abi = tc->targetAbi(); - if (abi.isValid() && abi == requiredAbi) - result.append(tc.take()); - - if (abi.wordWidth() != 64) - return result; + foreach (const Abi &abi, abiList) { + QScopedPointer<GccToolChain> tc(createToolChain(true)); + if (tc.isNull()) + return result; - // Create 32bit - tc.reset(createToolChain(true)); - QTC_ASSERT(!tc.isNull(), return result; ); // worked once, so should work again:-) + tc->setCompilerPath(compilerPath); + tc->setDebuggerCommand(debuggerPath); + tc->setTargetAbi(abi); - tc->forceTo32Bit(true); - tc->setCompilerPath(compilerPath); - tc->setDebuggerCommand(debuggerPath); - if (tc->targetAbi().isValid()) result.append(tc.take()); + } return result; } @@ -545,20 +542,22 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QSt Internal::GccToolChainConfigWidget::GccToolChainConfigWidget(GccToolChain *tc) : ToolChainConfigWidget(tc), m_compilerPath(new Utils::PathChooser), - m_force32BitCheckBox(new QCheckBox) + m_abiComboBox(new QComboBox) { Q_ASSERT(tc); + QFormLayout *layout = new QFormLayout(this); + const QStringList gnuVersionArgs = QStringList(QLatin1String("--version")); m_compilerPath->setExpectedKind(Utils::PathChooser::ExistingCommand); m_compilerPath->setCommandVersionArguments(gnuVersionArgs); connect(m_compilerPath, SIGNAL(changed(QString)), this, SLOT(handlePathChange())); - - QFormLayout *layout = new QFormLayout(this); layout->addRow(tr("&Compiler path:"), m_compilerPath); - layout->addRow(tr("&Force 32bit compilation:"), m_force32BitCheckBox); - connect(m_force32BitCheckBox, SIGNAL(toggled(bool)), this, SLOT(handle32BitChange())); + populateAbiList(tc->supportedAbis()); + layout->addRow(tr("&ABI:"), m_abiComboBox); + + connect(m_abiComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleAbiChange())); addDebuggerCommandControls(layout, gnuVersionArgs); addErrorLabel(layout); @@ -577,20 +576,37 @@ void Internal::GccToolChainConfigWidget::apply() QString path = m_compilerPath->path(); if (path.isEmpty()) path = m_compilerPath->rawPath(); - tc->forceTo32Bit(m_force32BitCheckBox->isChecked()); tc->setCompilerPath(path); + tc->setTargetAbi(m_abiList.at(m_abiComboBox->currentIndex())); tc->setDisplayName(displayName); // reset display name tc->setDebuggerCommand(debuggerCommand()); } +void Internal::GccToolChainConfigWidget::populateAbiList(const QList<Abi> &list) +{ + GccToolChain *tc = static_cast<GccToolChain *>(toolChain()); + Abi currentAbi = tc->targetAbi(); + + m_abiComboBox->clear(); + m_abiList = list; + + if (m_abiList.isEmpty()) + m_abiList.append(Abi()); + + for (int i = 0; i < m_abiList.count(); ++i) { + m_abiComboBox->addItem(m_abiList.at(i).toString()); + if (m_abiList.at(i) == currentAbi) + m_abiComboBox->setCurrentIndex(i); + } +} + void Internal::GccToolChainConfigWidget::setFromToolchain() { GccToolChain *tc = static_cast<GccToolChain *>(toolChain()); Q_ASSERT(tc); m_compilerPath->setPath(tc->compilerPath()); - m_force32BitCheckBox->setChecked(tc->isForcedTo32Bit()); - m_force32BitCheckBox->setEnabled(tc->supports64Bit()); setDebuggerCommand(tc->debuggerCommand()); + populateAbiList(tc->supportedAbis()); } bool Internal::GccToolChainConfigWidget::isDirty() const @@ -598,24 +614,20 @@ bool Internal::GccToolChainConfigWidget::isDirty() const GccToolChain *tc = static_cast<GccToolChain *>(toolChain()); Q_ASSERT(tc); return m_compilerPath->path() != tc->compilerPath() - || m_force32BitCheckBox->isChecked() != tc->isForcedTo32Bit(); + || m_abiList.at(m_abiComboBox->currentIndex()) != tc->targetAbi(); } void Internal::GccToolChainConfigWidget::handlePathChange() { QString path = m_compilerPath->path(); - if (!QFileInfo(path).isExecutable()) { - m_force32BitCheckBox->setEnabled(false); - m_force32BitCheckBox->setChecked(true); - } else { - ProjectExplorer::Abi abi = guessGccAbi(path, Utils::Environment::systemEnvironment().toStringList()); - m_force32BitCheckBox->setEnabled(abi.wordWidth() == 64); - m_force32BitCheckBox->setChecked(abi.wordWidth() == 32); - } + QList<Abi> abiList; + if (QFileInfo(path).isExecutable()) + abiList = guessGccAbi(path, Utils::Environment::systemEnvironment().toStringList()); + populateAbiList(abiList); emit dirty(toolChain()); } -void Internal::GccToolChainConfigWidget::handle32BitChange() +void Internal::GccToolChainConfigWidget::handleAbiChange() { emit dirty(toolChain()); } @@ -775,54 +787,66 @@ namespace ProjectExplorer { void ProjectExplorerPlugin::testGccAbiGuessing_data() { QTest::addColumn<QString>("input"); - QTest::addColumn<QString>("abi"); + QTest::addColumn<QStringList>("abiList"); QTest::newRow("invalid input") << QString::fromLatin1("Some text") - << QString::fromLatin1("unknown-unknown-unknown-unknown-unknown"); + << (QStringList()); QTest::newRow("empty input") << QString::fromLatin1("") - << QString::fromLatin1("unknown-unknown-unknown-unknown-unknown"); + << (QStringList()); QTest::newRow("broken input") << QString::fromLatin1("arm-none-foo-gnueabi") - << QString::fromLatin1("arm-unknown-unknown-elf-32bit"); + << (QStringList() << QLatin1String("arm-unknown-unknown-elf-32bit")); + QTest::newRow("totally broken input") + << QString::fromLatin1("foo-bar-foo") + << (QStringList()); QTest::newRow("Maemo 1") << QString::fromLatin1("arm-none-linux-gnueabi") - << QString::fromLatin1("arm-linux-generic-elf-32bit"); + << (QStringList() << QLatin1String("arm-linux-generic-elf-32bit")); QTest::newRow("Linux 1") << QString::fromLatin1("i686-linux-gnu") - << QString::fromLatin1("x86-linux-generic-elf-32bit"); + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")); QTest::newRow("Linux 2") << QString::fromLatin1("i486-linux-gnu") - << QString::fromLatin1("x86-linux-generic-elf-32bit"); + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")); QTest::newRow("Linux 3") << QString::fromLatin1("x86_64-linux-gnu") - << QString::fromLatin1("x86-linux-generic-elf-64bit"); + << (QStringList() << QLatin1String("x86-linux-generic-elf-64bit") + << QLatin1String("x86-linux-generic-elf-32bit")); QTest::newRow("Mingw 1") << QString::fromLatin1("i686-w64-mingw32") - << QString::fromLatin1("x86-windows-msys-pe-64bit"); + << (QStringList() << QLatin1String("x86-windows-msys-pe-64bit") + << QLatin1String("x86-windows-msys-pe-32bit")); QTest::newRow("Mingw 2") << QString::fromLatin1("mingw32") - << QString::fromLatin1("x86-windows-msys-pe-32bit"); + << (QStringList() << QLatin1String("x86-windows-msys-pe-32bit")); QTest::newRow("Mac 1") << QString::fromLatin1("i686-apple-darwin10") - << QString::fromLatin1("x86-macos-generic-mach_o-64bit"); + << (QStringList() << QLatin1String("x86-macos-generic-mach_o-64bit") + << QLatin1String("x86-macos-generic-mach_o-32bit") + << QLatin1String("ppc-macos-generic-mach_o-64bit") + << QLatin1String("ppc-macos-generic-mach_o-32bit")); QTest::newRow("Intel 1") << QString::fromLatin1("86_64 x86_64 GNU/Linux") - << QString::fromLatin1("x86-linux-generic-elf-64bit"); + << (QStringList() << QLatin1String("x86-linux-generic-elf-64bit") + << QLatin1String("x86-linux-generic-elf-32bit")); QTest::newRow("Symbian 1") << QString::fromLatin1("arm-none-symbianelf") - << QString::fromLatin1("arm-symbian-device-elf-32bit"); + << (QStringList() << QLatin1String("arm-symbian-device-elf-32bit")); } void ProjectExplorerPlugin::testGccAbiGuessing() { QFETCH(QString, input); - QFETCH(QString, abi); + QFETCH(QStringList, abiList); - ProjectExplorer::Abi a = guessGccAbi(input); - QCOMPARE(a.toString(), abi); + QList<ProjectExplorer::Abi> al = guessGccAbi(input); + QCOMPARE(al.count(), abiList.count()); + for (int i = 0; i < al.count(); ++i) { + QCOMPARE(al.at(i).toString(), abiList.at(i)); + } } } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h index c0a79c16b7..cda7a4c875 100644 --- a/src/plugins/projectexplorer/gcctoolchain.h +++ b/src/plugins/projectexplorer/gcctoolchain.h @@ -56,6 +56,8 @@ class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain public: QString typeName() const; Abi targetAbi() const; + QList<Abi> supportedAbis() const; + void setTargetAbi(const Abi &); bool isValid() const; @@ -77,11 +79,6 @@ public: void setCompilerPath(const QString &); QString compilerPath() const; - bool isForcedTo32Bit() const; - void forceTo32Bit(bool); - - bool supports64Bit() const; - ToolChain *clone() const; protected: @@ -97,12 +94,13 @@ protected: private: GccToolChain(bool autodetect); + void updateSupportedAbis() const; + QString m_compilerPath; QString m_debuggerCommand; - bool m_forcedTo32Bit; - mutable bool m_supports64Bit; - mutable Abi m_targetAbi; + Abi m_targetAbi; + mutable QList<Abi> m_supportedAbis; mutable QList<HeaderPath> m_headerPathes; friend class Internal::GccToolChainFactory; diff --git a/src/plugins/projectexplorer/gcctoolchainfactories.h b/src/plugins/projectexplorer/gcctoolchainfactories.h index 852349537b..3d47a61cfa 100644 --- a/src/plugins/projectexplorer/gcctoolchainfactories.h +++ b/src/plugins/projectexplorer/gcctoolchainfactories.h @@ -36,9 +36,12 @@ #include "toolchain.h" #include "toolchainconfigwidget.h" +#include "abi.h" + +#include <QtCore/QList> QT_BEGIN_NAMESPACE -class QCheckBox; +class QComboBox; QT_END_NAMESPACE namespace Utils { @@ -91,13 +94,16 @@ public: private slots: void handlePathChange(); - void handle32BitChange(); + void handleAbiChange(); private: + void populateAbiList(const QList<Abi> &); void setFromToolchain(); Utils::PathChooser *m_compilerPath; - QCheckBox *m_force32BitCheckBox; + QComboBox *m_abiComboBox; + + QList<Abi> m_abiList; }; // -------------------------------------------------------------------------- diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp index 6b16b86cfd..47cb7e6d72 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp @@ -78,6 +78,7 @@ #include <QtGui/QMessageBox> #include <QtGui/QUndoStack> #include <QtGui/QPlainTextEdit> +#include <QtGui/QApplication> enum { debug = false @@ -366,6 +367,8 @@ void DesignDocumentController::changeCurrentModelTo(const ModelNode &componentNo void DesignDocumentController::loadCurrentModel() { + QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); + Q_ASSERT(m_d->masterModel); Q_ASSERT(m_d->model); m_d->model->setMasterModel(m_d->masterModel.data()); @@ -399,6 +402,7 @@ void DesignDocumentController::loadCurrentModel() m_d->documentLoaded = true; Q_ASSERT(m_d->masterModel); + QApplication::restoreOverrideCursor(); } QList<RewriterView::Error> DesignDocumentController::loadMaster(const QByteArray &qml) diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrary.pri b/src/plugins/qmldesigner/components/itemlibrary/itemlibrary.pri index 919e7fafe4..37b3b059b2 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrary.pri +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrary.pri @@ -1,7 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Fri Mar 6 12:55:36 2009 -###################################################################### - VPATH += $$PWD INCLUDEPATH += $$PWD diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index dad0507271..edf2f39035 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -528,6 +528,9 @@ void PropertyEditor::otherPropertyChanged(const QmlObjectNode &fxObjectNode, con { QmlModelView::otherPropertyChanged(fxObjectNode, propertyName); + if (!m_selectedNode.isValid()) + return; + if (fxObjectNode.isValid() && m_currentType && fxObjectNode == m_selectedNode && fxObjectNode.currentState().isValid()) { AbstractProperty property = fxObjectNode.modelNode().property(propertyName); if (fxObjectNode == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == fxObjectNode) { @@ -543,6 +546,9 @@ void PropertyEditor::transformChanged(const QmlObjectNode &fxObjectNode, const Q { QmlModelView::transformChanged(fxObjectNode, propertyName); + if (!m_selectedNode.isValid()) + return; + if (fxObjectNode.isValid() && m_currentType && fxObjectNode == m_selectedNode && fxObjectNode.currentState().isValid()) { AbstractProperty property = fxObjectNode.modelNode().property(propertyName); if (fxObjectNode == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == fxObjectNode) { diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri index 14cb33579a..134ace2864 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri @@ -43,8 +43,4 @@ HEADERS += propertyeditor.h \ QT += declarative RESOURCES += propertyeditor.qrc -FORMS += behaviordialog.ui \ - contextpanetext.ui \ - contextpanewidgetrectangle.ui \ - contextpanewidgetimage.ui \ - contextpanewidgetborderimage.ui +FORMS += behaviordialog.ui diff --git a/src/plugins/qmldesigner/designercore/depend_paths.pri b/src/plugins/qmldesigner/designercore/depend_paths.pri deleted file mode 100644 index c2059ccbec..0000000000 --- a/src/plugins/qmldesigner/designercore/depend_paths.pri +++ /dev/null @@ -1 +0,0 @@ -DEPENDPATH += $$PWD/qtpropertybrowser/src/
\ No newline at end of file diff --git a/src/plugins/qmldesigner/designercore/designercore.pri b/src/plugins/qmldesigner/designercore/designercore.pri index 7ff4acf125..17f5e8d235 100644 --- a/src/plugins/qmldesigner/designercore/designercore.pri +++ b/src/plugins/qmldesigner/designercore/designercore.pri @@ -7,7 +7,6 @@ QT += script \ DEFINES += TEST_EXPORTS INCLUDEPATH += $$PWD \ $$PWD/include -DEPENDPATH += $$PWD $$PWD/include SOURCES += $$PWD/model/abstractview.cpp \ $$PWD/instances/nodeinstanceview.cpp \ $$PWD/model/rewriterview.cpp \ diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 50479a17e3..d6a829b987 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -349,6 +349,56 @@ static void findNewFileImports(const Document::Ptr &doc, const Snapshot &snapsho } } +static bool findNewQmlLibraryInPath(const QString &path, + const Snapshot &snapshot, + ModelManager *modelManager, + QStringList *importedFiles, + QSet<QString> *scannedPaths, + QSet<QString> *newLibraries) +{ + // if we know there is a library, done + if (snapshot.libraryInfo(path).isValid()) + return true; + if (newLibraries->contains(path)) + return true; + + const QDir dir(path); + QFile qmldirFile(dir.filePath(QLatin1String("qmldir"))); + if (!qmldirFile.exists()) + return false; + +#ifdef Q_OS_WIN + // QTCREATORBUG-3402 - be case sensitive even here? +#endif + + // found a new library! + qmldirFile.open(QFile::ReadOnly); + QString qmldirData = QString::fromUtf8(qmldirFile.readAll()); + + QmlDirParser qmldirParser; + qmldirParser.setSource(qmldirData); + qmldirParser.parse(); + + const QString libraryPath = QFileInfo(qmldirFile).absolutePath(); + newLibraries->insert(libraryPath); + modelManager->updateLibraryInfo(libraryPath, + LibraryInfo(qmldirParser)); + + // scan the qml files in the library + foreach (const QmlDirParser::Component &component, qmldirParser.components()) { + if (! component.fileName.isEmpty()) { + const QFileInfo componentFileInfo(dir.filePath(component.fileName)); + const QString path = QDir::cleanPath(componentFileInfo.absolutePath()); + if (! scannedPaths->contains(path)) { + *importedFiles += qmlFilesInDirectory(path); + scannedPaths->insert(path); + } + } + } + + return true; +} + static void findNewLibraryImports(const Document::Ptr &doc, const Snapshot &snapshot, ModelManager *modelManager, QStringList *importedFiles, QSet<QString> *scannedPaths, QSet<QString> *newLibraries) @@ -356,53 +406,23 @@ static void findNewLibraryImports(const Document::Ptr &doc, const Snapshot &snap // scan library imports const QStringList importPaths = modelManager->importPaths(); foreach (const Interpreter::ImportInfo &import, doc->bind()->imports()) { - if (import.type() != Interpreter::ImportInfo::LibraryImport) - continue; - foreach (const QString &importPath, importPaths) { - const QString targetPath = QDir(importPath).filePath(import.name()); - - // if we know there is a library, done - if (snapshot.libraryInfo(targetPath).isValid()) - break; - if (newLibraries->contains(targetPath)) - break; - - // check for a qmldir file - const QDir targetDir(targetPath); - QFile qmldirFile(targetDir.filePath(QLatin1String("qmldir"))); - if (!qmldirFile.exists()) - continue; - -#ifdef Q_OS_WIN - // QTCREATORBUG-3402 - be case sensitive even here? -#endif + if (import.type() == Interpreter::ImportInfo::LibraryImport) { + foreach (const QString &importPath, importPaths) { + const QString targetPath = QDir(importPath).filePath(import.name()); - // found a new library! - qmldirFile.open(QFile::ReadOnly); - QString qmldirData = QString::fromUtf8(qmldirFile.readAll()); - - QmlDirParser qmldirParser; - qmldirParser.setSource(qmldirData); - qmldirParser.parse(); - - const QString libraryPath = QFileInfo(qmldirFile).absolutePath(); - newLibraries->insert(libraryPath); - modelManager->updateLibraryInfo(libraryPath, - LibraryInfo(qmldirParser)); - - // scan the qml files in the library - foreach (const QmlDirParser::Component &component, qmldirParser.components()) { - if (! component.fileName.isEmpty()) { - const QFileInfo componentFileInfo(targetDir.filePath(component.fileName)); - const QString path = QDir::cleanPath(componentFileInfo.absolutePath()); - if (! scannedPaths->contains(path)) { - *importedFiles += qmlFilesInDirectory(path); - scannedPaths->insert(path); - } - } + if (findNewQmlLibraryInPath(targetPath, snapshot, modelManager, + importedFiles, scannedPaths, newLibraries)) + break; } + } else if (import.type() == Interpreter::ImportInfo::DirectoryImport) { + const QString targetPath = import.name(); + findNewQmlLibraryInPath(targetPath, snapshot, modelManager, + importedFiles, scannedPaths, newLibraries); } } + + findNewQmlLibraryInPath(doc->path(), snapshot, modelManager, + importedFiles, scannedPaths, newLibraries); } static bool suffixMatches(const QString &fileName, const Core::MimeType &mimeType) diff --git a/src/plugins/qmljstools/qmljsplugindumper.cpp b/src/plugins/qmljstools/qmljsplugindumper.cpp index ac9ced8998..bf81bfa4a1 100644 --- a/src/plugins/qmljstools/qmljsplugindumper.cpp +++ b/src/plugins/qmljstools/qmljsplugindumper.cpp @@ -275,10 +275,16 @@ void PluginDumper::dump(const Plugin &plugin) connect(process, SIGNAL(finished(int)), SLOT(qmlPluginTypeDumpDone(int))); connect(process, SIGNAL(error(QProcess::ProcessError)), SLOT(qmlPluginTypeDumpError(QProcess::ProcessError))); QStringList args; - args << QLatin1String("--notrelocatable"); // ### temporary until relocatable libraries work - args << plugin.importUri; - args << plugin.importVersion; - args << plugin.importPath; + if (plugin.importUri.isEmpty()) { + args << QLatin1String("--path"); + args << plugin.importPath; + if (ComponentVersion(plugin.importVersion).isValid()) + args << plugin.importVersion; + } else { + args << plugin.importUri; + args << plugin.importVersion; + args << plugin.importPath; + } process->start(info.qmlDumpPath, args); m_runningQmldumps.insert(process, plugin.qmldirPath); } diff --git a/src/plugins/qmljstools/qmljstools-lib.pri b/src/plugins/qmljstools/qmljstools-lib.pri index 14e1c763de..6c622dba07 100644 --- a/src/plugins/qmljstools/qmljstools-lib.pri +++ b/src/plugins/qmljstools/qmljstools-lib.pri @@ -2,7 +2,6 @@ DEFINES += QMLJSTOOLS_STATIC } -DEPENDPATH += $$PWD INCLUDEPATH += $$PWD/.. HEADERS += \ diff --git a/src/plugins/qmljstools/qmljstools.pri b/src/plugins/qmljstools/qmljstools.pri index 196d757a14..5b1a7b957c 100644 --- a/src/plugins/qmljstools/qmljstools.pri +++ b/src/plugins/qmljstools/qmljstools.pri @@ -1,6 +1,5 @@ include(qmljstools_dependencies.pri) -DEPENDPATH += $$PWD INCLUDEPATH += $$PWD/.. LIBS *= -l$$qtLibraryName(QmlJSTools) diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.pri b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.pri index 2494093aeb..488f9c30fb 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.pri +++ b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.pri @@ -1,5 +1,4 @@ INCLUDEPATH *= $$PWD -DEPENDPATH *= $$PWD SOURCES += \ $$PWD/plugingenerator.cpp \ $$PWD/classlist.cpp \ diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp index a5498c5617..f576506d31 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp +++ b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp @@ -136,7 +136,7 @@ QList<BuildConfigurationInfo> Qt4DesktopTargetFactory::availableBuildConfigurati QList<QtVersion *> knownVersions = QtVersionManager::instance()->versionsForTargetId(id, minimumQtVersion); foreach (QtVersion *version, knownVersions) { - if (!version->isValid()) + if (!version->isValid() || !version->toolChainAvailable()) continue; QtVersion::QmakeBuildConfigs config = version->defaultBuildConfig(); diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp index 161320f652..9d7e3bb4c9 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp +++ b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp @@ -136,7 +136,7 @@ QList<BuildConfigurationInfo> Qt4SimulatorTargetFactory::availableBuildConfigura QList<QtVersion *> knownVersions = QtVersionManager::instance()->versionsForTargetId(id, minimumQtVersion); foreach (QtVersion *version, knownVersions) { - if (!version->isValid()) + if (!version->isValid() || !version->toolChainAvailable()) continue; QtVersion::QmakeBuildConfigs config = version->defaultBuildConfig(); QString dir = defaultShadowBuildDirectory(Qt4Project::defaultTopLevelBuildDirectory(proFilePath), id); diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp index 43d3884ee8..2836340359 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp @@ -156,7 +156,7 @@ QList<BuildConfigurationInfo> Qt4MaemoTargetFactory::availableBuildConfiguration QList<QtVersion *> knownVersions = QtVersionManager::instance()->versionsForTargetId(id, minimumQtVersion); foreach (QtVersion *version, knownVersions) { - if (!version->isValid()) + if (!version->isValid() || !version->toolChainAvailable()) continue; QtVersion::QmakeBuildConfigs config = version->defaultBuildConfig(); QString dir = defaultShadowBuildDirectory(Qt4Project::defaultTopLevelBuildDirectory(proFilePath), id); diff --git a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp index 2cb0a78d54..c5f4bb7f71 100644 --- a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp @@ -144,9 +144,8 @@ bool CodaRunControl::setupLauncher() codaSocket->connectToHost(m_address, m_port); m_state = StateConnecting; appendMessage(tr("Connecting to %1:%2...").arg(m_address).arg(m_port), NormalMessageFormat); - } - QTimer::singleShot(4000, this, SLOT(checkForTimeout())); + QTimer::singleShot(5000, this, SLOT(checkForTimeout())); if (debug) m_codaDevice->setVerbose(debug); diff --git a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp index 5d4e3989e9..2c17faae42 100644 --- a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp @@ -45,6 +45,7 @@ #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/customexecutablerunconfiguration.h> +#include <projectexplorer/toolchainmanager.h> using ProjectExplorer::idFromMap; using namespace Qt4ProjectManager; @@ -139,8 +140,9 @@ QList<BuildConfigurationInfo> Qt4SymbianTargetFactory::availableBuildConfigurati QList<QtVersion *> knownVersions = QtVersionManager::instance()->versionsForTargetId(id, minimumQtVersion); foreach (QtVersion *version, knownVersions) { - if (!version->isValid()) + if (!version->isValid() || !version->toolChainAvailable()) continue; + bool buildAll = version->defaultBuildConfig() & QtVersion::BuildAll; QtVersion::QmakeBuildConfigs config = buildAll ? QtVersion::BuildAll : QtVersion::QmakeBuildConfig(0); QString dir = QFileInfo(proFilePath).absolutePath(), id; diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp index a09beb886b..d92988de51 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp @@ -589,19 +589,18 @@ void S60DeployConfigurationWidget::codaEvent(const Coda::CodaEvent &event) void S60DeployConfigurationWidget::getQtVersionCommandResult(const Coda::CodaCommandResult &result) { - codaIncreaseProgress(); m_deviceInfo.clear(); if (result.type == Coda::CodaCommandResult::FailReply) { setDeviceInfoLabel(tr("No device information available"), true); SymbianUtils::SymbianDeviceManager::instance()->releaseCodaDevice(m_codaInfoDevice); m_deviceInfoButton->setEnabled(true); + m_codaTimeout->stop(); return; } else if (result.type == Coda::CodaCommandResult::CommandErrorReply){ startTable(m_deviceInfo); QTextStream str(&m_deviceInfo); addErrorToTable(str, tr("Qt version: "), tr("Not installed on device")); finishTable(m_deviceInfo); - setDeviceInfoLabel(m_deviceInfo, false); } else { if (result.values.count()) { QHash<QString, QVariant> obj = result.values[0].toVariant().toHash(); @@ -663,6 +662,7 @@ void S60DeployConfigurationWidget::getQtVersionCommandResult(const Coda::CodaCom finishTable(m_deviceInfo); } } + codaIncreaseProgress(); m_codaInfoDevice->sendSymbianOsDataGetRomInfoCommand(Coda::CodaCallback(this, &S60DeployConfigurationWidget::getRomInfoResult)); } diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index bae2bf390f..6be3306c0d 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -254,10 +254,10 @@ void QtVersionManager::removeVersion(QtVersion *version) bool QtVersionManager::supportsTargetId(const QString &id) const { - foreach (QtVersion *version, m_versions) { - if (version->supportsTargetId(id)) + QList<QtVersion *> versions = QtVersionManager::instance()->versionsForTargetId(id); + foreach (QtVersion *v, versions) + if (v->isValid() && v->toolChainAvailable()) return true; - } return false; } @@ -1750,6 +1750,16 @@ bool QtVersion::isValid() const && !m_abis.isEmpty(); } +bool QtVersion::toolChainAvailable() const +{ + if (!isValid()) + return false; + foreach (const ProjectExplorer::Abi &abi, qtAbis()) + if (!ProjectExplorer::ToolChainManager::instance()->findToolChains(abi).isEmpty()) + return true; + return false; +} + QString QtVersion::invalidReason() const { if (isValid()) diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h index a73423d4c3..0fbad7f9fd 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -95,7 +95,8 @@ public: QtVersion(); ~QtVersion(); - bool isValid() const; //TOOD check that the dir exists and the name is non empty + bool isValid() const; + bool toolChainAvailable() const; QString invalidReason() const; QString description() const; bool isAutodetected() const { return m_isAutodetected; } diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index 7b42317bbb..51558f8ed2 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -7,9 +7,6 @@ include(texteditor_dependencies.pri) INCLUDEPATH += generichighlighter \ tooltip \ snippets -DEPENDPATH += generichighlighter \ - tooltip \ - snippets SOURCES += texteditorplugin.cpp \ textfilewizard.cpp \ plaintexteditor.cpp \ diff --git a/src/plugins/valgrindtoolbase/valgrindtoolbase.pri b/src/plugins/valgrindtoolbase/valgrindtoolbase.pri index 22fc88f3e3..0ffb7c37dc 100644 --- a/src/plugins/valgrindtoolbase/valgrindtoolbase.pri +++ b/src/plugins/valgrindtoolbase/valgrindtoolbase.pri @@ -1,5 +1,4 @@ include(valgrindtoolbase_dependencies.pri) INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD LIBS *= -l$$qtLibraryName(ValgrindToolBase) diff --git a/src/private_headers.pri b/src/private_headers.pri index 60b4788e90..b00401a055 100644 --- a/src/private_headers.pri +++ b/src/private_headers.pri @@ -8,10 +8,4 @@ isEmpty(QT_PRIVATE_HEADERS) { $${QT_PRIVATE_HEADERS}/QtGui \ $${QT_PRIVATE_HEADERS}/QtScript \ $${QT_PRIVATE_HEADERS}/QtDeclarative - DEPENDPATH += \ - $${QT_PRIVATE_HEADERS} \ - $${QT_PRIVATE_HEADERS}/QtCore \ - $${QT_PRIVATE_HEADERS}/QtGui \ - $${QT_PRIVATE_HEADERS}/QtScript \ - $${QT_PRIVATE_HEADERS}/QtDeclarative } diff --git a/src/share/qtcreator/externaltools/vi.xml b/src/share/qtcreator/externaltools/vi.xml index a93771dfea..1e1a7d4925 100644 --- a/src/share/qtcreator/externaltools/vi.xml +++ b/src/share/qtcreator/externaltools/vi.xml @@ -38,7 +38,7 @@ <category xml:lang="de">Text</category> <executable modifiesdocument="yes"> <path>xterm</path> - <arguments>-geom %{CurrentDocument:ColumnCount}x%{CurrentDocument:RowCount}+%{CurrentDocument:XPos}+%{CurrentDocument:YPos} -e vi "%{CurrentDocument:FilePath}" +%{CurrentDocument:Row} +"normal %{CurrentDocument:Column}|"</arguments> + <arguments>-geom %{CurrentDocument:ColumnCount}x%{CurrentDocument:RowCount}+%{CurrentDocument:XPos}+%{CurrentDocument:YPos} -e vi "%{CurrentDocument:FilePath}" +%{CurrentDocument:Row}</arguments> <workingdirectory>%{CurrentDocument:Path}</workingdirectory> </executable> </externaltool> diff --git a/src/shared/qrceditor/test/test.pro b/src/shared/qrceditor/test/test.pro index aae1b39461..6931488fce 100644 --- a/src/shared/qrceditor/test/test.pro +++ b/src/shared/qrceditor/test/test.pro @@ -1,7 +1,3 @@ -###################################################################### -# Automatically generated by qmake (1.07a) Mon Mar 19 11:10:13 2007 -###################################################################### - TEMPLATE = app QT += gui diff --git a/src/shared/symbianutils/symbiandevicemanager.cpp b/src/shared/symbianutils/symbiandevicemanager.cpp index 9ddb1c2d2b..27fc593417 100644 --- a/src/shared/symbianutils/symbiandevicemanager.cpp +++ b/src/shared/symbianutils/symbiandevicemanager.cpp @@ -267,11 +267,11 @@ SYMBIANUTILS_EXPORT QDebug operator<<(QDebug d, const SymbianDevice &cd) // ------------- SymbianDeviceManagerPrivate struct SymbianDeviceManagerPrivate { - SymbianDeviceManagerPrivate() : m_initialized(false) /*, m_destroyReleaseMapper(0),*/ {} + SymbianDeviceManagerPrivate() : m_initialized(false), m_devicesLock(QMutex::Recursive) {} bool m_initialized; SymbianDeviceManager::SymbianDeviceList m_devices; - //QSignalMapper *m_destroyReleaseMapper; + QMutex m_devicesLock; // Used for protecting access to m_devices and serialising getCodaDevice/delayedClosePort // The following 2 variables are needed to manage requests for a TCF port not coming from the main thread int m_constructTcfPortEventType; QMutex m_codaPortWaitMutex; @@ -305,11 +305,13 @@ SymbianDeviceManager::~SymbianDeviceManager() SymbianDeviceManager::SymbianDeviceList SymbianDeviceManager::devices() const { ensureInitialized(); + QMutexLocker lock(&d->m_devicesLock); return d->m_devices; } QString SymbianDeviceManager::toString() const { + QMutexLocker lock(&d->m_devicesLock); QString rc; QTextStream str(&rc); str << d->m_devices.size() << " devices:\n"; @@ -334,6 +336,7 @@ int SymbianDeviceManager::findByPortName(const QString &p) const QString SymbianDeviceManager::friendlyNameForPort(const QString &port) const { + QMutexLocker lock(&d->m_devicesLock); const int idx = findByPortName(port); return idx == -1 ? QString() : d->m_devices.at(idx).friendlyName(); } @@ -358,6 +361,7 @@ SymbianDeviceManager::TrkDevicePtr CodaDevicePtr SymbianDeviceManager::getCodaDevice(const QString &port) { ensureInitialized(); + QMutexLocker lock(&d->m_devicesLock); const int idx = findByPortName(port); if (idx == -1) { qWarning("Attempt to acquire device '%s' that does not exist.", qPrintable(port)); @@ -422,6 +426,7 @@ void SymbianDeviceManager::customEvent(QEvent *event) void SymbianDeviceManager::releaseCodaDevice(CodaDevicePtr &port) { if (port) { + QMutexLocker(&d->m_devicesLock); // Check if this was the last reference to the port, if so close it after a short delay foreach (const SymbianDevice& device, d->m_devices) { if (device.m_data->codaDevice.data() == port.data()) { @@ -442,6 +447,7 @@ void SymbianDeviceManager::releaseCodaDevice(CodaDevicePtr &port) void SymbianDeviceManager::delayedClosePort() { // Find any coda ports that are still open but have a reference count of zero, and delete them + QMutexLocker(&d->m_devicesLock); foreach (const SymbianDevice& device, d->m_devices) { Coda::CodaDevice* codaDevice = device.m_data->codaDevice.data(); if (codaDevice && device.m_data->deviceAcquired == 0 && codaDevice->device()->isOpen()) { @@ -483,6 +489,8 @@ void SymbianDeviceManager::ensureInitialized() const void SymbianDeviceManager::update(bool emitSignals) { + QMutexLocker lock(&d->m_devicesLock); + static int n = 0; typedef SymbianDeviceList::iterator SymbianDeviceListIterator; @@ -502,6 +510,7 @@ void SymbianDeviceManager::update(bool emitSignals) } // Merge the lists and emit the respective added/removed signals, assuming // no one can plug a different device on the same port at the speed of lightning + SymbianDeviceList removedDevices; if (!d->m_devices.isEmpty()) { // Find deleted devices for (SymbianDeviceListIterator oldIt = d->m_devices.begin(); oldIt != d->m_devices.end(); ) { @@ -511,25 +520,33 @@ void SymbianDeviceManager::update(bool emitSignals) SymbianDevice toBeDeleted = *oldIt; toBeDeleted.forcedClose(); oldIt = d->m_devices.erase(oldIt); - if (emitSignals) - emit deviceRemoved(toBeDeleted); + removedDevices.append(toBeDeleted); } } } + SymbianDeviceList addedDevices; if (!newDevices.isEmpty()) { // Find new devices and insert in order foreach(const SymbianDevice &newDevice, newDevices) { if (!d->m_devices.contains(newDevice)) { d->m_devices.append(newDevice); - if (emitSignals) - emit deviceAdded(newDevice); + addedDevices.append(newDevice); } } if (d->m_devices.size() > 1) qStableSort(d->m_devices.begin(), d->m_devices.end()); } - if (emitSignals) + + lock.unlock(); + if (emitSignals) { + foreach (const SymbianDevice &device, removedDevices) { + emit deviceRemoved(device); + } + foreach (const SymbianDevice &device, addedDevices) { + emit deviceAdded(device); + } emit updated(); + } if (debug) qDebug("<SerialDeviceLister::update\n%s\n", qPrintable(toString())); diff --git a/src/shared/symbianutils/virtualserialdevice_win.cpp b/src/shared/symbianutils/virtualserialdevice_win.cpp index e62e9e8d7a..604e8516a5 100644 --- a/src/shared/symbianutils/virtualserialdevice_win.cpp +++ b/src/shared/symbianutils/virtualserialdevice_win.cpp @@ -73,6 +73,23 @@ QString windowsPortName(const QString& port) // Copied from \creator\src\libs\utils\winutils.cpp QString winErrorMessage(unsigned long error) { + // Some of the windows error messages are a bit too obscure + switch (error) + { + case ERROR_FILE_NOT_FOUND: + case ERROR_NOT_FOUND: + return VirtualSerialDevice::tr("Port not found"); + break; + case ERROR_ACCESS_DENIED: + return VirtualSerialDevice::tr("Port in use"); + case ERROR_SEM_TIMEOUT: // Bluetooth ports sometimes return this + return VirtualSerialDevice::tr("Timed out"); + case ERROR_NETWORK_UNREACHABLE: + return VirtualSerialDevice::tr("Port unreachable"); // I don't know what this error indicates... from observation, that the windows Bluetooth stack has got itself into a state and needs resetting + default: + break; + } + QString rc = QString::fromLatin1("#%1: ").arg(error); ushort *lpMsgBuf; diff --git a/src/tools/gen-cpp-ast/gen-cpp-ast.pro b/src/tools/gen-cpp-ast/gen-cpp-ast.pro index 24a8b74c4e..e7fb63f3de 100644 --- a/src/tools/gen-cpp-ast/gen-cpp-ast.pro +++ b/src/tools/gen-cpp-ast/gen-cpp-ast.pro @@ -1,12 +1,7 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Mon Nov 9 11:48:58 2009 -###################################################################### - QT = core gui macx:CONFIG -= app_bundle TEMPLATE = app TARGET = generate-ast -DEPENDPATH += . INCLUDEPATH += . ../../libs include(../../libs/cplusplus/cplusplus-lib.pri) diff --git a/src/tools/mkvisitor/mkvisitor.pro b/src/tools/mkvisitor/mkvisitor.pro index 3f3f7dbc6b..03c53754d2 100644 --- a/src/tools/mkvisitor/mkvisitor.pro +++ b/src/tools/mkvisitor/mkvisitor.pro @@ -1,7 +1,6 @@ QT = core gui macx:CONFIG -= app_bundle TARGET = cplusplus0 -DEPENDPATH += . INCLUDEPATH += . ../../libs include(../../libs/cplusplus/cplusplus-lib.pri) diff --git a/src/tools/qpatch/bootstrap.pri b/src/tools/qpatch/bootstrap.pri index b3ee948487..a82caf5ff2 100644 --- a/src/tools/qpatch/bootstrap.pri +++ b/src/tools/qpatch/bootstrap.pri @@ -29,13 +29,6 @@ INCLUDEPATH += $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ $$QT_BUILD_TREE/include/QtXml \ $$QT_SOURCE_TREE/src/xml -DEPENDPATH += $$INCLUDEPATH \ - $$QT_SOURCE_TREE/src/corelib/global \ - $$QT_SOURCE_TREE/src/corelib/kernel \ - $$QT_SOURCE_TREE/src/corelib/tools \ - $$QT_SOURCE_TREE/src/corelib/io \ - $$QT_SOURCE_TREE/src/corelib/codecs \ - $$QT_SOURCE_TREE/src/xml hpux-acc*|hpuxi-acc* { LIBS += $$QT_BUILD_TREE/src/tools/bootstrap/libbootstrap.a diff --git a/src/tools/qtlibspatcher/qtlibspatcher.pro b/src/tools/qtlibspatcher/qtlibspatcher.pro index 83eab9088f..9ef8d70434 100644 --- a/src/tools/qtlibspatcher/qtlibspatcher.pro +++ b/src/tools/qtlibspatcher/qtlibspatcher.pro @@ -1,12 +1,7 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Di 8. Jul 15:08:13 2008 -###################################################################### - CONFIG += console QT -= gui TEMPLATE = app TARGET = -DEPENDPATH += . INCLUDEPATH += . DESTDIR = . diff --git a/tests/auto/extensionsystem/pluginmanager/test.pro b/tests/auto/extensionsystem/pluginmanager/test.pro index f9047d1927..06421f233a 100644 --- a/tests/auto/extensionsystem/pluginmanager/test.pro +++ b/tests/auto/extensionsystem/pluginmanager/test.pro @@ -1,7 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Fr Jul 27 23:12:52 2007 -###################################################################### - TARGET = pluginmanager # Input diff --git a/tests/auto/externaltool/externaltool.pro b/tests/auto/externaltool/externaltool.pro index 75544ec597..3fa493e7de 100644 --- a/tests/auto/externaltool/externaltool.pro +++ b/tests/auto/externaltool/externaltool.pro @@ -4,7 +4,6 @@ include(../../../src/plugins/coreplugin/coreplugin.pri) LIBS *= -L$$IDE_PLUGIN_PATH/Nokia INCLUDEPATH *= $$IDE_SOURCE_TREE/src/plugins/coreplugin INCLUDEPATH *= $$IDE_BUILD_TREE/src/plugins/coreplugin -DEPENDPATH *= $$IDE_BUILD_TREE/src/plugins/coreplugin SOURCES += tst_externaltooltest.cpp \ $$IDE_SOURCE_TREE/src/plugins/coreplugin/externaltool.cpp diff --git a/tests/auto/qml/codemodel/basic/basic.pro b/tests/auto/qml/codemodel/basic/basic.pro index 90072f8c6d..32f35b0196 100644 --- a/tests/auto/qml/codemodel/basic/basic.pro +++ b/tests/auto/qml/codemodel/basic/basic.pro @@ -25,8 +25,6 @@ CONFIG += qtestlib testcase DEFINES+=QTCREATORDIR=\\\"$$IDE_SOURCE_TREE\\\" DEFINES+=QT_CREATOR QTCREATOR_TEST -DEPENDPATH += . - include($$IDE_SOURCE_TREE/src/libs/utils/utils.pri) include($$IDE_SOURCE_TREE/src/plugins/qmljstools/qmljstools.pri) diff --git a/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro b/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro index 886207cc69..521f671663 100644 --- a/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro +++ b/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro @@ -4,7 +4,6 @@ CONFIG += qtestlib testcase ##DEFINES += DONT_MESS_WITH_QDEBUG -DEPENDPATH += .. INCLUDEPATH += $$IDE_SOURCE_TREE/src/plugins/qmldesigner/designercore/include TARGET = tst_bauhaus diff --git a/tests/auto/qml/qmldesigner/coretests/coretests.pro b/tests/auto/qml/qmldesigner/coretests/coretests.pro index c26f30f7f6..78445403c0 100644 --- a/tests/auto/qml/qmldesigner/coretests/coretests.pro +++ b/tests/auto/qml/qmldesigner/coretests/coretests.pro @@ -25,8 +25,6 @@ QT += script \ DEFINES+=QTCREATORDIR=\\\"$$IDE_BUILD_TREE\\\" DEFINES+=QT_CREATOR QTCREATOR_TEST -DEPENDPATH += .. -DEPENDPATH += $$IDE_SOURCE_TREE/src/plugins/qmldesigner/designercore INCLUDEPATH += $$IDE_SOURCE_TREE/src/plugins/qmldesigner/designercore/include INCLUDEPATH += $$IDE_SOURCE_TREE/src/plugins/qmldesigner/designercore diff --git a/tests/manual/gdbdebugger/gui/gui.pro b/tests/manual/gdbdebugger/gui/gui.pro index 21480760ed..c62000beab 100644 --- a/tests/manual/gdbdebugger/gui/gui.pro +++ b/tests/manual/gdbdebugger/gui/gui.pro @@ -1,7 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Fri Mar 5 09:08:08 2010 -###################################################################### - TARGET = gui CONFIG+=console TEMPLATE = app |