diff options
143 files changed, 1206 insertions, 627 deletions
diff --git a/dist/changes-3.2.0 b/dist/changes-3.2.0 index 31d9cae009..95cb455196 100644 --- a/dist/changes-3.2.0 +++ b/dist/changes-3.2.0 @@ -131,6 +131,7 @@ Analyzer C++ Support * Added support for C99 designated initializers (QTCREATORBUG-1902) + * Added support for UTF-8 in the lexer (QTCREATORBUG-7356) * Fixed finding usages of members of typedef'ed anonymous structs (QTCREATORBUG-11859, QTCREATORBUG-11860) * Fixed indentation of concatenated strings @@ -140,12 +141,10 @@ C++ Support (QTCREATORBUG-12309) * Fixed parsing of trailing type-specifier * Fixed parsing of expressions like vector<int>{1} - * Fixed generating getters and setters for variables with - 'm' and 'm_' prefixes - * Fixed that "using namespace" did not highlight class in including files (QTCREATORBUG-12357) + * Fixed the Create Getter and Setter Member Functions refactoring action + for variables with "m" and "m_" prefixes (QTCREATORBUG-12244) + * Fixed that "using Ns::Class" did not highlight class in including files (QTCREATORBUG-12357) * Fixed include paths handling (QTCREATORBUG-11599) - * Fixed corner cases for "Create Getter and Setter Member Functions" refactoring action - (QTCREATORBUG-12244) * Fixed parsing of expressions like vector<int>{1} * Fixed completion for template with default argument (QTCREATORBUG-12606, QTCREATORBUG-12605) @@ -155,8 +154,6 @@ C++ Support * Improved infrastructure for Clang integration * Reworked indexing data structure * Started to clean up C++ editor - * Added support for UTF-8 in the lexer (QTCREATORBUG-7356) - * Added support for C99 designated initializers QML Support * Fixed handling of properties that start with underscore (QTCREATORBUG-12214) @@ -196,6 +193,11 @@ FakeVim * Improved sharing of navigation data between editors of the same document +Beautifier + * Added support for formatting a file asynchronously + * Added support for redirecting text to a formatter tool + instead of using temporary files + Platform Specific Windows diff --git a/qbs/imports/QtcAutotest.qbs b/qbs/imports/QtcAutotest.qbs index e05257e985..376c2f91c6 100644 --- a/qbs/imports/QtcAutotest.qbs +++ b/qbs/imports/QtcAutotest.qbs @@ -8,13 +8,13 @@ QtcProduct { targetName: "tst_" + name.split(' ').join("") // This needs to be absolute, because it is passed to one of the source files. - destinationDirectory: buildDirectory + '/' + destinationDirectory: project.buildDirectory + '/' + FileInfo.relativePath(project.ide_source_tree, sourceDirectory) cpp.rpaths: [ - buildDirectory + '/' + project.ide_library_path, - buildDirectory + '/' + project.ide_library_path + "/..", // OSX - buildDirectory + '/' + project.ide_plugin_path + project.buildDirectory + '/' + project.ide_library_path, + project.buildDirectory + '/' + project.ide_library_path + "/..", // OSX + project.buildDirectory + '/' + project.ide_plugin_path ] cpp.minimumOsxVersion: "10.7" cpp.defines: base.filter(function(d) { return d != "QT_NO_CAST_FROM_ASCII"; }) diff --git a/qtcreator.pri b/qtcreator.pri index 5ba38a7f9f..ec48dbed5a 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -3,7 +3,7 @@ QTCREATOR_PRI_INCLUDED = 1 QTCREATOR_VERSION = 3.1.83 QTCREATOR_COMPAT_VERSION = 3.1.83 -BINARY_ARTIFACTS_BRANCH = master +BINARY_ARTIFACTS_BRANCH = 3.2 # enable c++11 isEqual(QT_MAJOR_VERSION, 5) { diff --git a/scripts/deployqtHelper_mac.sh b/scripts/deployqtHelper_mac.sh index ababf8a7de..28e3d26c23 100755 --- a/scripts/deployqtHelper_mac.sh +++ b/scripts/deployqtHelper_mac.sh @@ -61,9 +61,9 @@ if [ $LLVM_INSTALL_DIR ]; then cp -f "$LLVM_INSTALL_DIR"/lib/libclang.dylib "$1/Contents/PlugIns/" || exit 1 cp -Rf "$LLVM_INSTALL_DIR"/lib/clang "$1/Contents/Resources/cplusplus/" || exit 1 fi - _CLANG_CODEMODEL_LIB="$1/Contents/PlugIns/QtProject/libClangCodeModel_debug.dylib" + _CLANG_CODEMODEL_LIB="$1/Contents/PlugIns/libClangCodeModel_debug.dylib" if [ ! -f "$_CLANG_CODEMODEL_LIB" ]; then - _CLANG_CODEMODEL_LIB="$1/Contents/PlugIns/QtProject/libClangCodeModel.dylib" + _CLANG_CODEMODEL_LIB="$1/Contents/PlugIns/libClangCodeModel.dylib" fi xcrun install_name_tool -rpath "$LLVM_INSTALL_DIR/lib" "@loader_path/.." "$_CLANG_CODEMODEL_LIB" || true fi diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index 2464113124..8333ccfe63 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -1732,13 +1732,16 @@ def qform__QString(): def qdump__QString(d, value): d.putStringValue(value) - d.putNumChild(0) + data, size, alloc = d.stringData(value) + d.putNumChild(size) format = d.currentItemFormat() if format == 1: d.putDisplay(StopDisplay) elif format == 2: d.putField("editformat", DisplayUtf16String) d.putField("editvalue", d.encodeString(value, limit=None)) + if d.isExpanded(): + d.putArrayData(data, size, d.lookupType(d.qtNamespace() + "QChar")) def qdump__QStringData(d, value): d.putStringValueByAddress(toInteger(value)) diff --git a/src/libs/3rdparty/cplusplus/AST.h b/src/libs/3rdparty/cplusplus/AST.h index 76213cc2c3..a0f5a2fa64 100644 --- a/src/libs/3rdparty/cplusplus/AST.h +++ b/src/libs/3rdparty/cplusplus/AST.h @@ -4467,6 +4467,7 @@ public: , mutable_token(0) , exception_specification(0) , trailing_return_type(0) + , symbol(0) {} virtual LambdaDeclaratorAST *asLambdaDeclarator() { return this; } diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index c90fdb005d..6cc6db4226 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -721,7 +721,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope, continue; // skip using namespace directives else if (! id->match(s->identifier())) continue; - else if (s->name()->isQualifiedNameId()) + else if (s->name() && s->name()->isQualifiedNameId()) continue; // skip qualified ids. if (Q_UNLIKELY(debug)) { diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp index c36478909d..3474eac0aa 100644 --- a/src/libs/cplusplus/ResolveExpression.cpp +++ b/src/libs/cplusplus/ResolveExpression.cpp @@ -350,13 +350,15 @@ void ResolveExpression::thisObject() FullySpecifiedType ptrTy(control()->pointerType(classTy)); addResult(ptrTy, fun->enclosingScope()); break; - } else if (const QualifiedNameId *q = fun->name()->asQualifiedNameId()) { - if (q->base()) { - FullySpecifiedType classTy(control()->namedType(q->base())); - FullySpecifiedType ptrTy(control()->pointerType(classTy)); - addResult(ptrTy, fun->enclosingScope()); + } else if (const Name *name = fun->name()) { + if (const QualifiedNameId *q = name->asQualifiedNameId()) { + if (q->base()) { + FullySpecifiedType classTy(control()->namedType(q->base())); + FullySpecifiedType ptrTy(control()->pointerType(classTy)); + addResult(ptrTy, fun->enclosingScope()); + } + break; } - break; } } } diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index ffe5e2b3f7..f5bcf525ea 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -35,6 +35,7 @@ #include "iplugin.h" #include "plugincollection.h" +#include <QCoreApplication> #include <QEventLoop> #include <QDateTime> #include <QDir> @@ -691,6 +692,13 @@ void PluginManager::formatPluginVersions(QTextStream &str) void PluginManager::startTests() { + if (PluginManager::hasError()) { + qWarning("Errors occurred while loading plugins, skipping test run. " + "For details, start without \"-test\" option."); + QTimer::singleShot(1, QCoreApplication::instance(), SLOT(quit())); + return; + } + #ifdef WITH_TESTS foreach (const PluginManagerPrivate::TestSpec &testSpec, d->testSpecs) { const PluginSpec * const pluginSpec = testSpec.pluginSpec; diff --git a/src/libs/qmljs/qmljscontext.cpp b/src/libs/qmljs/qmljscontext.cpp index fe8fc51643..7c60dcc03a 100644 --- a/src/libs/qmljs/qmljscontext.cpp +++ b/src/libs/qmljs/qmljscontext.cpp @@ -91,6 +91,11 @@ QmlJS::Snapshot Context::snapshot() const return _snapshot; } +ViewerContext Context::vContext() const +{ + return _vContext; +} + const Imports *Context::imports(const QmlJS::Document *doc) const { if (!doc) diff --git a/src/libs/qmljs/qmljscontext.h b/src/libs/qmljs/qmljscontext.h index c06332f322..ac0b23d61f 100644 --- a/src/libs/qmljs/qmljscontext.h +++ b/src/libs/qmljs/qmljscontext.h @@ -59,6 +59,7 @@ public: ValueOwner *valueOwner() const; Snapshot snapshot() const; + ViewerContext vContext() const; const Imports *imports(const Document *doc) const; diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index efa966ba3c..cf7fd70bd1 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -558,20 +558,19 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info) QRegExp vNr(QLatin1String("^(.+)\\.([0-9]+)(?:\\.([0-9]+))?$")); QRegExp safeName(QLatin1String("^[a-zA-Z_][[a-zA-Z0-9_]*$")); foreach (const ImportKey &importKey, packages) { - if (importKey.splitPath.size() == 1 && importKey.splitPath.at(0).isEmpty()) { + if (importKey.splitPath.size() == 1 && importKey.splitPath.at(0).isEmpty() && splitPath.length() > 0) { // relocatable QStringList myPath = splitPath; - if (vNr.indexIn(myPath.last()) == 0) { + if (vNr.indexIn(myPath.last()) == 0) myPath.last() = vNr.cap(1); - } for (int iPath = myPath.size(); iPath != 1; ) { --iPath; if (safeName.indexIn(myPath.at(iPath)) != 0) break; ImportKey iKey(ImportType::Library, QStringList(myPath.mid(iPath)).join(QLatin1String(".")), importKey.majorVersion, importKey.minorVersion); - cImport.possibleExports.append(Export(iKey, QStringList(myPath.mid(0, iPath)) - .join(QLatin1String("/")), true)); + cImport.possibleExports.append(Export(iKey, (iPath == 1) ? QLatin1String("/") : + QStringList(myPath.mid(0, iPath)).join(QLatin1String("/")), true)); } } else { QString requiredPath = QStringList(splitPath.mid(0, splitPath.size() - importKey.splitPath.size())) @@ -579,7 +578,7 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info) cImport.possibleExports << Export(importKey, requiredPath, true); } } - if (cImport.possibleExports.isEmpty()) { + if (cImport.possibleExports.isEmpty() && splitPath.size() > 0) { QRegExp vNr(QLatin1String("^(.+)\\.([0-9]+)(?:\\.([0-9]+))?$")); QRegExp safeName(QLatin1String("^[a-zA-Z_][[a-zA-Z0-9_]*$")); int majorVersion = LanguageUtils::ComponentVersion::NoVersion; @@ -601,8 +600,8 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info) break; ImportKey iKey(ImportType::Library, QStringList(splitPath.mid(iPath)).join(QLatin1String(".")), majorVersion, minorVersion); - cImport.possibleExports.append(Export(iKey, QStringList(splitPath.mid(0, iPath)) - .join(QLatin1String("/")), true)); + cImport.possibleExports.append(Export(iKey, (iPath == 1) ? QLatin1String("/") : + QStringList(splitPath.mid(0, iPath)).join(QLatin1String("/")), true)); } } foreach (const QmlDirParser::Component &component, info.components()) { diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp index 60a79c51b0..cfe16ae7d3 100644 --- a/src/libs/qmljs/qmljsimportdependencies.cpp +++ b/src/libs/qmljs/qmljsimportdependencies.cpp @@ -198,6 +198,14 @@ ImportKey ImportKey::flatKey() const { return res; } +QString ImportKey::libPath() const +{ + QString res = splitPath.join(QString::fromLatin1(".")); + if (res.isEmpty() && !splitPath.isEmpty()) + return QLatin1String(""); + return res; +} + QString ImportKey::path() const { QString res = splitPath.join(QString::fromLatin1("/")); diff --git a/src/libs/qmljs/qmljsimportdependencies.h b/src/libs/qmljs/qmljsimportdependencies.h index 0d2978e21c..0ec88cc1e7 100644 --- a/src/libs/qmljs/qmljsimportdependencies.h +++ b/src/libs/qmljs/qmljsimportdependencies.h @@ -108,6 +108,7 @@ public: int minorVersion; QString path() const; + QString libPath() const; void addToHash(QCryptographicHash &hash) const; ImportKey flatKey() const; diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 7bf7b3ed22..0898bb77ac 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -170,13 +170,29 @@ public: } }; } // namespace Internal + +FakeMetaObjectWithOrigin::FakeMetaObjectWithOrigin(FakeMetaObject::ConstPtr fakeMetaObject, const QString &originId) + : fakeMetaObject(fakeMetaObject) + , originId(originId) +{ } + +bool FakeMetaObjectWithOrigin::operator ==(const FakeMetaObjectWithOrigin &o) const +{ + return fakeMetaObject == o.fakeMetaObject; +} + +uint qHash(const FakeMetaObjectWithOrigin &fmoo, int seed) +{ + return qHash(fmoo.fakeMetaObject, seed); +} + } // namespace QmlJS CppComponentValue::CppComponentValue(FakeMetaObject::ConstPtr metaObject, const QString &className, - const QString &packageName, const ComponentVersion &componentVersion, - const ComponentVersion &importVersion, int metaObjectRevision, - ValueOwner *valueOwner) - : ObjectValue(valueOwner), + const QString &packageName, const ComponentVersion &componentVersion, + const ComponentVersion &importVersion, int metaObjectRevision, + ValueOwner *valueOwner, const QString &originId) + : ObjectValue(valueOwner, originId), m_metaObject(metaObject), m_moduleName(packageName), m_componentVersion(componentVersion), @@ -960,8 +976,8 @@ bool MemberProcessor::processGeneratedSlot(const QString &, const Value *) return true; } -ObjectValue::ObjectValue(ValueOwner *valueOwner) - : m_valueOwner(valueOwner), +ObjectValue::ObjectValue(ValueOwner *valueOwner, const QString &originId) + : m_valueOwner(valueOwner), m_originId(originId), _prototype(0) { valueOwner->registerValue(this); @@ -1374,7 +1390,7 @@ const QLatin1String CppQmlTypes::defaultPackage("<default>"); const QLatin1String CppQmlTypes::cppPackage("<cpp>"); template <typename T> -void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) +void CppQmlTypes::load(const QString &originId, const T &fakeMetaObjects, const QString &overridePackage) { QList<CppComponentValue *> newCppTypes; foreach (const FakeMetaObject::ConstPtr &fmo, fakeMetaObjects) { @@ -1382,7 +1398,7 @@ void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) QString package = exp.package; if (package.isEmpty()) package = overridePackage; - m_fakeMetaObjectsByPackage[package].insert(fmo); + m_fakeMetaObjectsByPackage[package].insert(FakeMetaObjectWithOrigin(fmo, originId)); // make versionless cpp types directly // needed for access to property types that are not exported, like QDeclarativeAnchors @@ -1391,7 +1407,7 @@ void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) QTC_ASSERT(exp.type == fmo->className(), continue); CppComponentValue *cppValue = new CppComponentValue( fmo, fmo->className(), cppPackage, ComponentVersion(), ComponentVersion(), - ComponentVersion::MaxVersion, m_valueOwner); + ComponentVersion::MaxVersion, m_valueOwner, originId); m_objectsByQualifiedName[qualifiedName(cppPackage, fmo->className(), ComponentVersion())] = cppValue; newCppTypes += cppValue; } @@ -1407,8 +1423,8 @@ void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) } } // explicitly instantiate load for list and hash -template void CppQmlTypes::load< QList<FakeMetaObject::ConstPtr> >(const QList<FakeMetaObject::ConstPtr> &, const QString &); -template void CppQmlTypes::load< QHash<QString, FakeMetaObject::ConstPtr> >(const QHash<QString, FakeMetaObject::ConstPtr> &, const QString &); +template void CppQmlTypes::load< QList<FakeMetaObject::ConstPtr> >(const QString &, const QList<FakeMetaObject::ConstPtr> &, const QString &); +template void CppQmlTypes::load< QHash<QString, FakeMetaObject::ConstPtr> >(const QString &, const QHash<QString, FakeMetaObject::ConstPtr> &, const QString &); QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QString &package, ComponentVersion version) { @@ -1417,7 +1433,8 @@ QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QStri QList<const CppComponentValue *> newObjects; // make new exported objects - foreach (const FakeMetaObject::ConstPtr &fmo, m_fakeMetaObjectsByPackage.value(package)) { + foreach (const FakeMetaObjectWithOrigin &fmoo, m_fakeMetaObjectsByPackage.value(package)) { + const FakeMetaObject::ConstPtr &fmo = fmoo.fakeMetaObject; // find the highest-version export for each alias QHash<QString, FakeMetaObject::Export> bestExports; foreach (const FakeMetaObject::Export &exp, fmo->exports()) { @@ -1449,7 +1466,8 @@ QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QStri CppComponentValue *newComponent = new CppComponentValue( fmo, name, package, bestExport.version, version, - bestExport.metaObjectRevision, m_valueOwner); + bestExport.metaObjectRevision, m_valueOwner, + fmoo.originId); // use package.cppname importversion as key m_objectsByQualifiedName.insert(key, newComponent); @@ -1463,6 +1481,8 @@ QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QStri } // set their prototypes, creating them if necessary + // this ensures that the prototypes of C++ objects are resolved correctly and with the correct + // revision, and cannot be hidden by other objects. foreach (const CppComponentValue *cobject, newObjects) { CppComponentValue *object = const_cast<CppComponentValue *>(cobject); while (!object->prototype()) { @@ -1485,8 +1505,10 @@ QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QStri // make a new object CppComponentValue *proto = new CppComponentValue( - protoFmo, protoCppName, object->moduleName(), ComponentVersion(), - object->importVersion(), ComponentVersion::MaxVersion, m_valueOwner); + protoFmo, protoCppName, object->moduleName(), + ComponentVersion(), + object->importVersion(), ComponentVersion::MaxVersion, m_valueOwner, + cppProto->originId()); m_objectsByQualifiedName.insert(key, proto); object->setPrototype(proto); @@ -1786,7 +1808,8 @@ ASTObjectValue::ASTObjectValue(UiQualifiedId *typeName, UiObjectInitializer *initializer, const Document *doc, ValueOwner *valueOwner) - : ObjectValue(valueOwner), m_typeName(typeName), m_initializer(initializer), m_doc(doc), m_defaultPropertyRef(0) + : ObjectValue(valueOwner, doc->importId()), + m_typeName(typeName), m_initializer(initializer), m_doc(doc), m_defaultPropertyRef(0) { if (m_initializer) { for (UiObjectMemberList *it = m_initializer->members; it; it = it->next) { diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 6bb48b8a6f..64e89fee15 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -443,7 +443,7 @@ public: class QMLJS_EXPORT ObjectValue: public Value { public: - ObjectValue(ValueOwner *valueOwner); + ObjectValue(ValueOwner *valueOwner, const QString &originId = QString()); ~ObjectValue(); ValueOwner *valueOwner() const; @@ -475,6 +475,9 @@ public: // Value interface const ObjectValue *asObjectValue() const QTC_OVERRIDE; void accept(ValueVisitor *visitor) const QTC_OVERRIDE; + QString originId() const + { return m_originId; } + private: bool checkPrototype(const ObjectValue *prototype, QSet<const ObjectValue *> *processed) const; @@ -483,6 +486,7 @@ private: ValueOwner *m_valueOwner; QHash<QString, const Value *> m_members; QString m_className; + QString m_originId; protected: const Value *_prototype; @@ -542,7 +546,7 @@ public: CppComponentValue(LanguageUtils::FakeMetaObject::ConstPtr metaObject, const QString &className, const QString &moduleName, const LanguageUtils::ComponentVersion &componentVersion, const LanguageUtils::ComponentVersion &importVersion, int metaObjectRevision, - ValueOwner *valueOwner); + ValueOwner *valueOwner, const QString &originId); ~CppComponentValue(); const CppComponentValue *asCppComponentValue() const QTC_OVERRIDE; @@ -673,6 +677,18 @@ public: QList<ModuleApiInfo> *newModuleApis, QString *errorMessage, QString *warningMessage, const QString &fileName); }; +class QMLJS_EXPORT FakeMetaObjectWithOrigin +{ +public: + LanguageUtils::FakeMetaObject::ConstPtr fakeMetaObject; + QString originId; + FakeMetaObjectWithOrigin(LanguageUtils::FakeMetaObject::ConstPtr fakeMetaObject, + const QString &originId); + bool operator ==(const FakeMetaObjectWithOrigin &o) const; +}; + +QMLJS_EXPORT uint qHash(const FakeMetaObjectWithOrigin &fmoo, int seed = 0); + class QMLJS_EXPORT CppQmlTypes { public: @@ -684,7 +700,7 @@ public: static const QLatin1String cppPackage; template <typename T> - void load(const T &fakeMetaObjects, const QString &overridePackage = QString()); + void load(const QString &originId, const T &fakeMetaObjects, const QString &overridePackage = QString()); QList<const CppComponentValue *> createObjectsForImport(const QString &package, LanguageUtils::ComponentVersion version); bool hasModule(const QString &module) const; @@ -703,7 +719,7 @@ public: private: // "Package.CppName ImportVersion" -> CppComponentValue QHash<QString, const CppComponentValue *> m_objectsByQualifiedName; - QHash<QString, QSet<LanguageUtils::FakeMetaObject::ConstPtr> > m_fakeMetaObjectsByPackage; + QHash<QString, QSet<FakeMetaObjectWithOrigin> > m_fakeMetaObjectsByPackage; const ObjectValue *m_cppContextProperties; ValueOwner *m_valueOwner; }; diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 969bc8c939..e0006e4b83 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -147,10 +147,14 @@ Link::Link(const Snapshot &snapshot, const ViewerContext &vContext, const Librar ModelManagerInterface *modelManager = ModelManagerInterface::instance(); if (modelManager) { ModelManagerInterface::CppDataHash cppDataHash = modelManager->cppData(); - - // populate engine with types from C++ - foreach (const ModelManagerInterface::CppData &cppData, cppDataHash) { - d->valueOwner->cppQmlTypes().load(cppData.exportedTypes); + { + // populate engine with types from C++ + ModelManagerInterface::CppDataHashIterator cppDataHashIterator(cppDataHash); + while (cppDataHashIterator.hasNext()) { + cppDataHashIterator.next(); + d->valueOwner->cppQmlTypes().load(cppDataHashIterator.key(), + cppDataHashIterator.value().exportedTypes); + } } // build an object with the context properties from C++ @@ -197,13 +201,13 @@ Context::ImportsPerDocument LinkPrivate::linkImports() // load builtin objects if (builtins.pluginTypeInfoStatus() == LibraryInfo::DumpDone || builtins.pluginTypeInfoStatus() == LibraryInfo::TypeInfoFileDone) { - valueOwner->cppQmlTypes().load(builtins.metaObjects()); + valueOwner->cppQmlTypes().load(QLatin1String("<builtins>"), builtins.metaObjects()); } else { - valueOwner->cppQmlTypes().load(CppQmlTypesLoader::defaultQtObjects); + valueOwner->cppQmlTypes().load(QLatin1String("<defaults>"), CppQmlTypesLoader::defaultQtObjects); } // load library objects shipped with Creator - valueOwner->cppQmlTypes().load(CppQmlTypesLoader::defaultLibraryObjects); + valueOwner->cppQmlTypes().load(QLatin1String("<defaultQt4>"), CppQmlTypesLoader::defaultLibraryObjects); if (document) { // do it on document first, to make sure import errors are shown @@ -483,7 +487,7 @@ bool LinkPrivate::importLibrary(Document::Ptr doc, } } else { const QString packageName = importInfo.name(); - valueOwner->cppQmlTypes().load(libraryInfo.metaObjects(), packageName); + valueOwner->cppQmlTypes().load(libraryPath, libraryInfo.metaObjects(), packageName); foreach (const CppComponentValue *object, valueOwner->cppQmlTypes().createObjectsForImport(packageName, version)) { import->object->setMember(object->className(), object); } @@ -578,7 +582,7 @@ void LinkPrivate::loadImplicitDefaultImports(Imports *imports) if (!import.object) { import.valid = true; import.info = info; - import.object = new ObjectValue(valueOwner); + import.object = new ObjectValue(valueOwner, QLatin1String("<defaults>")); foreach (const CppComponentValue *object, valueOwner->cppQmlTypes().createObjectsForImport( defaultPackage, maxVersion)) { diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 6a65e9a6fa..543e0c6955 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -1250,8 +1250,20 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface, hasNewInfo = hasNewInfo || newData.remove(fileName) > 0; } else { CppData &data = newData[fileName]; - // currently we have no simple way to compare, so we assume the worse - hasNewInfo = true; + if (!hasNewInfo && (data.exportedTypes.size() != exported.size() + || data.contextProperties != contextProperties)) + hasNewInfo = true; + if (!hasNewInfo) { + QHash<QString, QByteArray> newFingerprints; + foreach (LanguageUtils::FakeMetaObject::ConstPtr newType, exported) + newFingerprints[newType->className()]=newType->fingerprint(); + foreach (LanguageUtils::FakeMetaObject::ConstPtr oldType, data.exportedTypes) { + if (newFingerprints.value(oldType->className()) != oldType->fingerprint()) { + hasNewInfo = true; + break; + } + } + } data.exportedTypes = exported; data.contextProperties = contextProperties; } diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index 089b70e68e..ad2a14b81b 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -142,6 +142,7 @@ public: }; typedef QHash<QString, CppData> CppDataHash; + typedef QHashIterator<QString, CppData> CppDataHashIterator; public: ModelManagerInterface(QObject *parent = 0); diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp index ee39ba0ef4..fc5c4791a3 100644 --- a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp +++ b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp @@ -278,7 +278,7 @@ extern "C" HRESULT CALLBACK pid(CIDebugClient *client, PCSTR args) int token; commandTokens<StringList>(args, &token); - dprintf("Qt Creator CDB extension version 3.1 %d bit built %s.\n", + dprintf("Qt Creator CDB extension version 3.2 %d bit built %s.\n", sizeof(void *) * 8, __DATE__); if (const ULONG pid = currentProcessId(client)) ExtensionContext::instance().report('R', token, 0, "pid", "%u", pid); diff --git a/src/libs/utils/basetreeview.cpp b/src/libs/utils/basetreeview.cpp index 7114021e63..5ca1e1bd60 100644 --- a/src/libs/utils/basetreeview.cpp +++ b/src/libs/utils/basetreeview.cpp @@ -59,7 +59,7 @@ public: }; BaseTreeView::BaseTreeView(QWidget *parent) - : Utils::TreeView(parent) + : TreeView(parent) { setAttribute(Qt::WA_MacShowFocusRect, false); setFrameStyle(QFrame::NoFrame); @@ -87,7 +87,7 @@ void BaseTreeView::setModel(QAbstractItemModel *m) if (index != -1) disconnect(model(), SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns())); } - Utils::TreeView::setModel(m); + TreeView::setModel(m); if (m) { int index = m->metaObject()->indexOfSignal(sig); if (index != -1) @@ -97,7 +97,7 @@ void BaseTreeView::setModel(QAbstractItemModel *m) void BaseTreeView::mousePressEvent(QMouseEvent *ev) { - Utils::TreeView::mousePressEvent(ev); + TreeView::mousePressEvent(ev); const QModelIndex mi = indexAt(ev->pos()); if (!mi.isValid()) toggleColumnWidth(columnAt(ev->x())); diff --git a/src/libs/utils/basetreeview.h b/src/libs/utils/basetreeview.h index f034abb1db..123839ce77 100644 --- a/src/libs/utils/basetreeview.h +++ b/src/libs/utils/basetreeview.h @@ -36,7 +36,7 @@ namespace Utils { -class QTCREATOR_UTILS_EXPORT BaseTreeView : public Utils::TreeView +class QTCREATOR_UTILS_EXPORT BaseTreeView : public TreeView { Q_OBJECT diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp index 1cce9ffb1b..a405c71aee 100644 --- a/src/libs/utils/buildablehelperlibrary.cpp +++ b/src/libs/utils/buildablehelperlibrary.cpp @@ -64,7 +64,7 @@ QString BuildableHelperLibrary::qtChooserToQmakePath(const QString &path) return result; } -Utils::FileName BuildableHelperLibrary::findSystemQt(const Utils::Environment &env) +FileName BuildableHelperLibrary::findSystemQt(const Environment &env) { QStringList paths = env.path(); foreach (const QString &path, paths) { @@ -78,11 +78,11 @@ Utils::FileName BuildableHelperLibrary::findSystemQt(const Utils::Environment &e qmake.setFile(qtChooserToQmakePath(qmake.symLinkTarget())); if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull()) - return Utils::FileName(qmake); + return FileName(qmake); } } } - return Utils::FileName(); + return FileName(); } QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath) @@ -105,7 +105,7 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath, bool return QString(); } if (!qmake.waitForFinished()) { - Utils::SynchronousProcess::stopProcess(qmake); + SynchronousProcess::stopProcess(qmake); qWarning("Timeout running '%s'.", qPrintable(qmakePath)); return QString(); } diff --git a/src/libs/utils/buildablehelperlibrary.h b/src/libs/utils/buildablehelperlibrary.h index c01a45d231..6d0ed8bc68 100644 --- a/src/libs/utils/buildablehelperlibrary.h +++ b/src/libs/utils/buildablehelperlibrary.h @@ -42,7 +42,7 @@ class QTCREATOR_UTILS_EXPORT BuildableHelperLibrary public: // returns the full path to the first qmake, qmake-qt4, qmake4 that has // at least version 2.0.0 and thus is a qt4 qmake - static FileName findSystemQt(const Utils::Environment &env); + static FileName findSystemQt(const Environment &env); static bool isQtChooser(const QFileInfo &info); static QString qtChooserToQmakePath(const QString &path); // return true if the qmake at qmakePath is qt4 (used by QtVersion) @@ -63,11 +63,11 @@ public: struct BuildHelperArguments { QString helperName; QString directory; - Utils::Environment environment; + Environment environment; - Utils::FileName qmakeCommand; + FileName qmakeCommand; QString targetMode; - Utils::FileName mkspec; + FileName mkspec; QString proFilename; QStringList qmakeArguments; diff --git a/src/libs/utils/classnamevalidatinglineedit.cpp b/src/libs/utils/classnamevalidatinglineedit.cpp index a2a5d4e067..e8cd7740b4 100644 --- a/src/libs/utils/classnamevalidatinglineedit.cpp +++ b/src/libs/utils/classnamevalidatinglineedit.cpp @@ -65,7 +65,7 @@ ClassNameValidatingLineEditPrivate:: ClassNameValidatingLineEditPrivate() : // --------------------- ClassNameValidatingLineEdit ClassNameValidatingLineEdit::ClassNameValidatingLineEdit(QWidget *parent) : - Utils::FancyLineEdit(parent), + FancyLineEdit(parent), d(new ClassNameValidatingLineEditPrivate) { updateRegExp(); diff --git a/src/libs/utils/classnamevalidatinglineedit.h b/src/libs/utils/classnamevalidatinglineedit.h index be0d6a7ede..cb1593c2c2 100644 --- a/src/libs/utils/classnamevalidatinglineedit.h +++ b/src/libs/utils/classnamevalidatinglineedit.h @@ -36,8 +36,7 @@ namespace Utils { struct ClassNameValidatingLineEditPrivate; -class QTCREATOR_UTILS_EXPORT ClassNameValidatingLineEdit - : public Utils::FancyLineEdit +class QTCREATOR_UTILS_EXPORT ClassNameValidatingLineEdit : public FancyLineEdit { Q_OBJECT Q_PROPERTY(bool namespacesEnabled READ namespacesEnabled WRITE setNamespacesEnabled DESIGNABLE true) diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index 9c55d970cc..25834ffd83 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -150,7 +150,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args) } QString stubPath = QCoreApplication::applicationDirPath(); - if (Utils::HostOsInfo::isMacHost()) + if (HostOsInfo::isMacHost()) stubPath.append(QLatin1String("/../Resources/qtcreator_process_stub")); else stubPath.append(QLatin1String("/qtcreator_process_stub")); @@ -363,7 +363,7 @@ static const Terminal knownTerminals[] = QString ConsoleProcess::defaultTerminalEmulator() { - if (Utils::HostOsInfo::isMacHost()) { + if (HostOsInfo::isMacHost()) { QString termCmd = QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/scripts/openTerminal.command"); if (QFile(termCmd).exists()) return termCmd.replace(QLatin1Char(' '), QLatin1String("\\ ")); diff --git a/src/libs/utils/crumblepath.cpp b/src/libs/utils/crumblepath.cpp index 85f785555c..28e808c0d3 100644 --- a/src/libs/utils/crumblepath.cpp +++ b/src/libs/utils/crumblepath.cpp @@ -121,18 +121,18 @@ void CrumblePathButton::paintEvent(QPaintEvent *) if (m_isEnd) { if (m_isPressed || m_isSelected) - Utils::StyleHelper::drawCornerImage(m_segmentSelectedEnd, &p, geom, 2, 0, 2, 0); + StyleHelper::drawCornerImage(m_segmentSelectedEnd, &p, geom, 2, 0, 2, 0); else if (m_isHovering) - Utils::StyleHelper::drawCornerImage(m_segmentHoverEnd, &p, geom, 2, 0, 2, 0); + StyleHelper::drawCornerImage(m_segmentHoverEnd, &p, geom, 2, 0, 2, 0); else - Utils::StyleHelper::drawCornerImage(m_segmentEnd, &p, geom, 2, 0, 2, 0); + StyleHelper::drawCornerImage(m_segmentEnd, &p, geom, 2, 0, 2, 0); } else { if (m_isPressed || m_isSelected) - Utils::StyleHelper::drawCornerImage(m_segmentSelected, &p, geom, 2, 0, 12, 0); + StyleHelper::drawCornerImage(m_segmentSelected, &p, geom, 2, 0, 12, 0); else if (m_isHovering) - Utils::StyleHelper::drawCornerImage(m_segmentHover, &p, geom, 2, 0, 12, 0); + StyleHelper::drawCornerImage(m_segmentHover, &p, geom, 2, 0, 12, 0); else - Utils::StyleHelper::drawCornerImage(m_segment, &p, geom, 2, 0, 12, 0); + StyleHelper::drawCornerImage(m_segment, &p, geom, 2, 0, 12, 0); } if (isEnabled()) p.setPen(StyleHelper::panelTextColor()); diff --git a/src/libs/utils/detailswidget.cpp b/src/libs/utils/detailswidget.cpp index 53cda0dda4..4fcbe604f0 100644 --- a/src/libs/utils/detailswidget.cpp +++ b/src/libs/utils/detailswidget.cpp @@ -78,7 +78,7 @@ public: QLabel *m_summaryLabel; QCheckBox *m_summaryCheckBox; QLabel *m_additionalSummaryLabel; - Utils::FadingPanel *m_toolWidget; + FadingPanel *m_toolWidget; QWidget *m_widget; QPixmap m_collapsedPixmap; @@ -375,7 +375,7 @@ void DetailsWidget::setWidget(QWidget *widget) d->updateControls(); } -void DetailsWidget::setToolWidget(Utils::FadingPanel *widget) +void DetailsWidget::setToolWidget(FadingPanel *widget) { if (d->m_toolWidget == widget) return; diff --git a/src/libs/utils/detailswidget.h b/src/libs/utils/detailswidget.h index 0b18c077b1..bce52a88ec 100644 --- a/src/libs/utils/detailswidget.h +++ b/src/libs/utils/detailswidget.h @@ -73,7 +73,7 @@ public: QWidget *widget() const; QWidget *takeWidget(); - void setToolWidget(Utils::FadingPanel *widget); + void setToolWidget(FadingPanel *widget); QWidget *toolWidget() const; void setSummaryFontBold(bool b); diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index ba3ed30b45..04e2a75d1f 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -373,23 +373,23 @@ QList<EnvironmentItem> Environment::diff(const Environment &other) const QList<EnvironmentItem> result; while (thisIt != constEnd() || otherIt != other.constEnd()) { if (thisIt == constEnd()) { - result.append(Utils::EnvironmentItem(otherIt.key(), otherIt.value())); + result.append(EnvironmentItem(otherIt.key(), otherIt.value())); ++otherIt; } else if (otherIt == constEnd()) { - Utils::EnvironmentItem item(thisIt.key(), QString()); + EnvironmentItem item(thisIt.key(), QString()); item.unset = true; result.append(item); ++thisIt; } else if (thisIt.key() < otherIt.key()) { - Utils::EnvironmentItem item(thisIt.key(), QString()); + EnvironmentItem item(thisIt.key(), QString()); item.unset = true; result.append(item); ++thisIt; } else if (thisIt.key() > otherIt.key()) { - result.append(Utils::EnvironmentItem(otherIt.key(), otherIt.value())); + result.append(EnvironmentItem(otherIt.key(), otherIt.value())); ++otherIt; } else { - result.append(Utils::EnvironmentItem(otherIt.key(), otherIt.value())); + result.append(EnvironmentItem(otherIt.key(), otherIt.value())); ++otherIt; ++thisIt; } diff --git a/src/libs/utils/environmentmodel.cpp b/src/libs/utils/environmentmodel.cpp index bb2967fcd7..6d00b6ce91 100644 --- a/src/libs/utils/environmentmodel.cpp +++ b/src/libs/utils/environmentmodel.cpp @@ -47,7 +47,7 @@ public: m_resultEnvironment.modify(m_items); // Add removed variables again and mark them as "<UNSET>" so // that the user can actually see those removals: - foreach (const Utils::EnvironmentItem &item, m_items) { + foreach (const EnvironmentItem &item, m_items) { if (item.unset) m_resultEnvironment.set(item.name, EnvironmentModel::tr("<UNSET>")); } @@ -63,7 +63,7 @@ public: int findInResultInsertPosition(const QString &name) const { - Utils::Environment::const_iterator it; + Environment::const_iterator it; int i = 0; for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i) if (m_resultEnvironment.key(it) > name) @@ -73,7 +73,7 @@ public: int findInResult(const QString &name) const { - Utils::Environment::const_iterator it; + Environment::const_iterator it; int i = 0; for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i) if (m_resultEnvironment.key(it) == name) @@ -81,9 +81,9 @@ public: return -1; } - Utils::Environment m_baseEnvironment; - Utils::Environment m_resultEnvironment; - QList<Utils::EnvironmentItem> m_items; + Environment m_baseEnvironment; + Environment m_resultEnvironment; + QList<EnvironmentItem> m_items; }; } // namespace Internal @@ -103,7 +103,7 @@ QString EnvironmentModel::indexToVariable(const QModelIndex &index) const return d->m_resultEnvironment.key(d->m_resultEnvironment.constBegin() + index.row()); } -void EnvironmentModel::setBaseEnvironment(const Utils::Environment &env) +void EnvironmentModel::setBaseEnvironment(const Environment &env) { if (d->m_baseEnvironment == env) return; @@ -215,7 +215,7 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value, if (d->m_resultEnvironment.hasKey(newName) || newName.isEmpty()) return false; - Utils::EnvironmentItem newVariable(newName, oldValue); + EnvironmentItem newVariable(newName, oldValue); if (changesPos != -1) resetVariable(oldName); // restore the original base variable again @@ -238,7 +238,7 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value, } } else { // Add a new change item: - d->m_items.append(Utils::EnvironmentItem(oldName, stringValue)); + d->m_items.append(EnvironmentItem(oldName, stringValue)); } d->updateResultEnvironment(); emit dataChanged(index, index); @@ -251,12 +251,12 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value, QModelIndex EnvironmentModel::addVariable() { //: Name when inserting a new variable - return addVariable(Utils::EnvironmentItem(tr("<VARIABLE>"), - //: Value when inserting a new variable - tr("<VALUE>"))); + return addVariable(EnvironmentItem(tr("<VARIABLE>"), + //: Value when inserting a new variable + tr("<VALUE>"))); } -QModelIndex EnvironmentModel::addVariable(const Utils::EnvironmentItem &item) +QModelIndex EnvironmentModel::addVariable(const EnvironmentItem &item) { // Return existing index if the name is already in the result set: @@ -331,7 +331,7 @@ void EnvironmentModel::unsetVariable(const QString &name) emit userChangesChanged(); return; } - Utils::EnvironmentItem item(name, QString()); + EnvironmentItem item(name, QString()); item.unset = true; d->m_items.append(item); d->updateResultEnvironment(); @@ -353,12 +353,12 @@ bool EnvironmentModel::canReset(const QString &name) return d->m_baseEnvironment.hasKey(name); } -QList<Utils::EnvironmentItem> EnvironmentModel::userChanges() const +QList<EnvironmentItem> EnvironmentModel::userChanges() const { return d->m_items; } -void EnvironmentModel::setUserChanges(QList<Utils::EnvironmentItem> list) +void EnvironmentModel::setUserChanges(QList<EnvironmentItem> list) { // We assume nobody is reordering the items here. if (list == d->m_items) diff --git a/src/libs/utils/environmentmodel.h b/src/libs/utils/environmentmodel.h index 340b2c9009..782d192247 100644 --- a/src/libs/utils/environmentmodel.h +++ b/src/libs/utils/environmentmodel.h @@ -56,7 +56,7 @@ public: QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QModelIndex addVariable(); - QModelIndex addVariable(const Utils::EnvironmentItem &item); + QModelIndex addVariable(const EnvironmentItem &item); void resetVariable(const QString &name); void unsetVariable(const QString &name); bool canUnset(const QString &name); @@ -64,9 +64,9 @@ public: QString indexToVariable(const QModelIndex &index) const; QModelIndex variableToIndex(const QString &name) const; bool changes(const QString &key) const; - void setBaseEnvironment(const Utils::Environment &env); - QList<Utils::EnvironmentItem> userChanges() const; - void setUserChanges(QList<Utils::EnvironmentItem> list); + void setBaseEnvironment(const Environment &env); + QList<EnvironmentItem> userChanges() const; + void setUserChanges(QList<EnvironmentItem> list); signals: void userChangesChanged(); diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h index 27be689831..61cabefd13 100644 --- a/src/libs/utils/fancylineedit.h +++ b/src/libs/utils/fancylineedit.h @@ -177,7 +177,7 @@ private: void updateMargins(); void updateButtonPositions(); - friend class Utils::FancyLineEditPrivate; + friend class FancyLineEditPrivate; FancyLineEditPrivate *d; }; diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp index 1b50f30caa..46c366df22 100644 --- a/src/libs/utils/fancymainwindow.cpp +++ b/src/libs/utils/fancymainwindow.cpp @@ -32,17 +32,199 @@ #include "qtcassert.h" #include <QContextMenuEvent> -#include <QMenu> +#include <QDebug> #include <QDockWidget> +#include <QHBoxLayout> +#include <QIcon> +#include <QLabel> +#include <QMenu> +#include <QPainter> #include <QSettings> +#include <QStyle> +#include <QStyleOption> +#include <QToolButton> -static const char lockedKeyC[] = "Locked"; static const char stateKeyC[] = "State"; static const int settingsVersion = 2; static const char dockWidgetActiveState[] = "DockWidgetActiveState"; namespace Utils { +// Stolen from QDockWidgetTitleButton +class DockWidgetTitleButton : public QAbstractButton +{ +public: + DockWidgetTitleButton(QWidget *parent) + : QAbstractButton(parent) + { + setFocusPolicy(Qt::NoFocus); + } + + QSize sizeHint() const + { + ensurePolished(); + + int size = 2*style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this); + if (!icon().isNull()) { + int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this); + QSize sz = icon().actualSize(QSize(iconSize, iconSize)); + size += qMax(sz.width(), sz.height()); + } + + return QSize(size, size); + } + + QSize minimumSizeHint() const { return sizeHint(); } + + void enterEvent(QEvent *event) + { + if (isEnabled()) update(); + QAbstractButton::enterEvent(event); + } + + void leaveEvent(QEvent *event) + { + if (isEnabled()) update(); + QAbstractButton::leaveEvent(event); + } + + void paintEvent(QPaintEvent *event); +}; + +void DockWidgetTitleButton::paintEvent(QPaintEvent *) +{ + QPainter p(this); + + QStyleOptionToolButton opt; + opt.init(this); + opt.state |= QStyle::State_AutoRaise; + opt.icon = icon(); + opt.subControls = 0; + opt.activeSubControls = 0; + opt.features = QStyleOptionToolButton::None; + opt.arrowType = Qt::NoArrow; + int size = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this); + opt.iconSize = QSize(size, size); + style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &p, this); +} + + +class TitleBarWidget : public QWidget +{ +public: + TitleBarWidget(QDockWidget *parent, const QStyleOptionDockWidget &opt) + : QWidget(parent), q(parent), m_active(true) + { + m_titleLabel = new QLabel(this); + + m_floatButton = new DockWidgetTitleButton(this); + m_floatButton->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarNormalButton, &opt, q)); + m_floatButton->setAccessibleName(QDockWidget::tr("Float")); + m_floatButton->setAccessibleDescription(QDockWidget::tr("Undocks and re-attaches the dock widget")); + + m_closeButton = new DockWidgetTitleButton(this); + m_closeButton->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton, &opt, q)); + m_closeButton->setAccessibleName(QDockWidget::tr("Close")); + m_closeButton->setAccessibleDescription(QDockWidget::tr("Closes the dock widget")); + + setActive(false); + + const int minWidth = 10; + const int maxWidth = 10000; + const int inactiveHeight = 3; + const int activeHeight = m_closeButton->sizeHint().height() + 2; + + m_minimumInactiveSize = QSize(minWidth, inactiveHeight); + m_maximumInactiveSize = QSize(maxWidth, inactiveHeight); + m_minimumActiveSize = QSize(minWidth, activeHeight); + m_maximumActiveSize = QSize(maxWidth, activeHeight); + + auto layout = new QHBoxLayout(this); + layout->setMargin(0); + layout->setSpacing(0); + layout->setContentsMargins(4, 0, 0, 0); + layout->addWidget(m_titleLabel); + layout->addStretch(); + layout->addWidget(m_floatButton); + layout->addWidget(m_closeButton); + setLayout(layout); + } + + void enterEvent(QEvent *event) + { + setActive(true); + QWidget::enterEvent(event); + } + + void leaveEvent(QEvent *event) + { + if (!q->isFloating()) + setActive(false); + QWidget::leaveEvent(event); + } + + void setActive(bool on) + { + if (m_active == on) + return; + m_active = on; + m_titleLabel->setVisible(on); + m_floatButton->setVisible(on); + m_closeButton->setVisible(on); + update(); + } + + QSize sizeHint() const + { + ensurePolished(); + return m_active ? m_maximumActiveSize : m_maximumInactiveSize; + } + + QSize minimumSizeHint() const + { + ensurePolished(); + return m_active ? m_minimumActiveSize : m_minimumInactiveSize; + } + +public: + QDockWidget *q; + bool m_active; + QSize m_minimumActiveSize; + QSize m_maximumActiveSize; + QSize m_minimumInactiveSize; + QSize m_maximumInactiveSize; + + QLabel *m_titleLabel; + DockWidgetTitleButton *m_floatButton; + DockWidgetTitleButton *m_closeButton; +}; + + +class DockWidget : public QDockWidget +{ +public: + DockWidget(QWidget *inner, QWidget *parent) + : QDockWidget(parent) + { + setWidget(inner); + setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable); + setObjectName(inner->objectName() + QLatin1String("DockWidget")); + setWindowTitle(inner->windowTitle()); + + QStyleOptionDockWidget opt; + initStyleOption(&opt); + auto titleBar = new TitleBarWidget(this, opt); + titleBar->m_titleLabel->setText(inner->windowTitle()); + setTitleBarWidget(titleBar); + + auto origFloatButton = findChild<QAbstractButton *>(QLatin1String("qt_dockwidget_floatbutton")); + connect(titleBar->m_floatButton, SIGNAL(clicked()), origFloatButton, SIGNAL(clicked())); + + auto origCloseButton = findChild<QAbstractButton *>(QLatin1String("qt_dockwidget_closebutton")); + connect(titleBar->m_closeButton, SIGNAL(clicked()), origCloseButton, SIGNAL(clicked())); + } +}; + /*! \class Utils::FancyMainWindow \brief The FancyMainWindow class is a MainWindow with dock widgets and @@ -53,40 +235,30 @@ namespace Utils { in a Window-menu. */ -struct FancyMainWindowPrivate +class FancyMainWindowPrivate { +public: FancyMainWindowPrivate(); - bool m_locked; bool m_handleDockVisibilityChanges; - QAction m_menuSeparator1; - QAction m_toggleLockedAction; - QAction m_menuSeparator2; + QAction m_menuSeparator; QAction m_resetLayoutAction; QDockWidget *m_toolBarDockWidget; }; FancyMainWindowPrivate::FancyMainWindowPrivate() : - m_locked(true), m_handleDockVisibilityChanges(true), - m_menuSeparator1(0), - m_toggleLockedAction(FancyMainWindow::tr("Locked"), 0), - m_menuSeparator2(0), + m_menuSeparator(0), m_resetLayoutAction(FancyMainWindow::tr("Reset to Default Layout"), 0), m_toolBarDockWidget(0) { - m_toggleLockedAction.setCheckable(true); - m_toggleLockedAction.setChecked(m_locked); - m_menuSeparator1.setSeparator(true); - m_menuSeparator2.setSeparator(true); + m_menuSeparator.setSeparator(true); } FancyMainWindow::FancyMainWindow(QWidget *parent) : QMainWindow(parent), d(new FancyMainWindowPrivate) { - connect(&d->m_toggleLockedAction, SIGNAL(toggled(bool)), - this, SLOT(setLocked(bool))); connect(&d->m_resetLayoutAction, SIGNAL(triggered()), this, SIGNAL(resetLayout())); } @@ -98,41 +270,18 @@ FancyMainWindow::~FancyMainWindow() QDockWidget *FancyMainWindow::addDockForWidget(QWidget *widget) { - QDockWidget *dockWidget = new QDockWidget(widget->windowTitle(), this); - dockWidget->setWidget(widget); - // Set an object name to be used in settings, derive from widget name - const QString objectName = widget->objectName(); - if (objectName.isEmpty()) - dockWidget->setObjectName(QLatin1String("dockWidget") + QString::number(dockWidgets().size() + 1)); - else - dockWidget->setObjectName(objectName + QLatin1String("DockWidget")); + QTC_ASSERT(widget, return 0); + QTC_CHECK(widget->objectName().size()); + QTC_CHECK(widget->windowTitle().size()); + + auto dockWidget = new DockWidget(widget, this); connect(dockWidget->toggleViewAction(), SIGNAL(triggered()), this, SLOT(onDockActionTriggered()), Qt::QueuedConnection); connect(dockWidget, SIGNAL(visibilityChanged(bool)), this, SLOT(onDockVisibilityChange(bool))); - connect(dockWidget, SIGNAL(topLevelChanged(bool)), - this, SLOT(onTopLevelChanged())); dockWidget->setProperty(dockWidgetActiveState, true); - updateDockWidget(dockWidget); - return dockWidget; -} -void FancyMainWindow::updateDockWidget(QDockWidget *dockWidget) -{ - const QDockWidget::DockWidgetFeatures features = - (d->m_locked) ? QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable - : QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable; - if (dockWidget->property("managed_dockwidget").isNull()) { // for the debugger tool bar - QWidget *titleBarWidget = dockWidget->titleBarWidget(); - if (d->m_locked && !titleBarWidget && !dockWidget->isFloating()) { - titleBarWidget = new QWidget(dockWidget); - } else if ((!d->m_locked || dockWidget->isFloating()) && titleBarWidget) { - delete titleBarWidget; - titleBarWidget = 0; - } - dockWidget->setTitleBarWidget(titleBarWidget); - } - dockWidget->setFeatures(features); + return dockWidget; } void FancyMainWindow::onDockActionTriggered() @@ -150,11 +299,6 @@ void FancyMainWindow::onDockVisibilityChange(bool visible) sender()->setProperty(dockWidgetActiveState, visible); } -void FancyMainWindow::onTopLevelChanged() -{ - updateDockWidget(qobject_cast<QDockWidget*>(sender())); -} - void FancyMainWindow::setTrackingEnabled(bool enabled) { if (enabled) { @@ -166,14 +310,6 @@ void FancyMainWindow::setTrackingEnabled(bool enabled) } } -void FancyMainWindow::setLocked(bool locked) -{ - d->m_locked = locked; - foreach (QDockWidget *dockWidget, dockWidgets()) { - updateDockWidget(dockWidget); - } -} - void FancyMainWindow::hideEvent(QHideEvent *event) { Q_UNUSED(event) @@ -229,7 +365,6 @@ QHash<QString, QVariant> FancyMainWindow::saveSettings() const { QHash<QString, QVariant> settings; settings.insert(QLatin1String(stateKeyC), saveState(settingsVersion)); - settings.insert(QLatin1String(lockedKeyC), d->m_locked); foreach (QDockWidget *dockWidget, dockWidgets()) { settings.insert(dockWidget->objectName(), dockWidget->property(dockWidgetActiveState)); @@ -242,8 +377,6 @@ void FancyMainWindow::restoreSettings(const QHash<QString, QVariant> &settings) QByteArray ba = settings.value(QLatin1String(stateKeyC), QByteArray()).toByteArray(); if (!ba.isEmpty()) restoreState(ba, settingsVersion); - d->m_locked = settings.value(QLatin1String("Locked"), true).toBool(); - d->m_toggleLockedAction.setChecked(d->m_locked); foreach (QDockWidget *widget, dockWidgets()) { widget->setProperty(dockWidgetActiveState, settings.value(widget->objectName(), false)); @@ -255,11 +388,6 @@ QList<QDockWidget *> FancyMainWindow::dockWidgets() const return findChildren<QDockWidget *>(); } -bool FancyMainWindow::isLocked() const -{ - return d->m_locked; -} - static bool actionLessThan(const QAction *action1, const QAction *action2) { QTC_ASSERT(action1, return true); @@ -282,26 +410,14 @@ QMenu *FancyMainWindow::createPopupMenu() QMenu *menu = new QMenu(this); foreach (QAction *action, actions) menu->addAction(action); - menu->addAction(&d->m_menuSeparator1); - menu->addAction(&d->m_toggleLockedAction); - menu->addAction(&d->m_menuSeparator2); + menu->addAction(&d->m_menuSeparator); menu->addAction(&d->m_resetLayoutAction); return menu; } -QAction *FancyMainWindow::menuSeparator1() const -{ - return &d->m_menuSeparator1; -} - -QAction *FancyMainWindow::toggleLockedAction() const -{ - return &d->m_toggleLockedAction; -} - -QAction *FancyMainWindow::menuSeparator2() const +QAction *FancyMainWindow::menuSeparator() const { - return &d->m_menuSeparator2; + return &d->m_menuSeparator; } QAction *FancyMainWindow::resetLayoutAction() const @@ -313,9 +429,7 @@ void FancyMainWindow::setDockActionsVisible(bool v) { foreach (const QDockWidget *dockWidget, dockWidgets()) dockWidget->toggleViewAction()->setVisible(v); - d->m_toggleLockedAction.setVisible(v); - d->m_menuSeparator1.setVisible(v); - d->m_menuSeparator2.setVisible(v); + d->m_menuSeparator.setVisible(v); d->m_resetLayoutAction.setVisible(v); } diff --git a/src/libs/utils/fancymainwindow.h b/src/libs/utils/fancymainwindow.h index aed4accb95..736e6ce9b5 100644 --- a/src/libs/utils/fancymainwindow.h +++ b/src/libs/utils/fancymainwindow.h @@ -40,7 +40,7 @@ QT_END_NAMESPACE namespace Utils { -struct FancyMainWindowPrivate; +class FancyMainWindowPrivate; class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow { @@ -56,7 +56,6 @@ public: QList<QDockWidget *> dockWidgets() const; void setTrackingEnabled(bool enabled); - bool isLocked() const; void saveSettings(QSettings *settings) const; void restoreSettings(const QSettings *settings); @@ -64,15 +63,12 @@ public: void restoreSettings(const QHash<QString, QVariant> &settings); // Additional context menu actions - QAction *menuSeparator1() const; - QAction *toggleLockedAction() const; - QAction *menuSeparator2() const; + QAction *menuSeparator() const; QAction *resetLayoutAction() const; // Overwritten to add locked/reset. virtual QMenu *createPopupMenu(); - QDockWidget *toolBarDockWidget() const; void setToolBarDockWidget(QDockWidget *dock); @@ -82,20 +78,18 @@ signals: void resetLayout(); public slots: - void setLocked(bool locked); void setDockActionsVisible(bool v); protected: void hideEvent(QHideEvent *event); void showEvent(QShowEvent *event); void contextMenuEvent(QContextMenuEvent *event); + private slots: void onDockActionTriggered(); void onDockVisibilityChange(bool); - void onTopLevelChanged(); private: - void updateDockWidget(QDockWidget *dockWidget); void handleVisibilityChanged(bool visible); FancyMainWindowPrivate *d; diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index 4993f99a48..146a03dc64 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -644,7 +644,7 @@ bool FileName::isChildOf(const FileName &s) const /// \overload bool FileName::isChildOf(const QDir &dir) const { - return isChildOf(Utils::FileName::fromString(dir.absolutePath())); + return isChildOf(FileName::fromString(dir.absolutePath())); } /// \returns whether FileName endsWith \a s @@ -659,7 +659,7 @@ bool FileName::endsWith(const QString &s) const FileName FileName::relativeChildPath(const FileName &parent) const { if (!isChildOf(parent)) - return Utils::FileName(); + return FileName(); return FileName(QString::mid(parent.size() + 1, -1)); } diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index b2dbd66ac1..8a7edeef38 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -80,10 +80,10 @@ public: bool isChildOf(const QDir &dir) const; bool endsWith(const QString &s) const; - Utils::FileName relativeChildPath(const FileName &parent) const; - Utils::FileName &appendPath(const QString &s); - Utils::FileName &appendString(const QString &str); - Utils::FileName &appendString(QChar str); + FileName relativeChildPath(const FileName &parent) const; + FileName &appendPath(const QString &s); + FileName &appendString(const QString &str); + FileName &appendString(QChar str); using QString::size; using QString::count; diff --git a/src/libs/utils/filewizardpage.cpp b/src/libs/utils/filewizardpage.cpp index 8fcd6afa98..66594b5e91 100644 --- a/src/libs/utils/filewizardpage.cpp +++ b/src/libs/utils/filewizardpage.cpp @@ -69,7 +69,7 @@ FileWizardPage::FileWizardPage(QWidget *parent) : connect(d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated())); connect(d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated())); - setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Location")); + setProperty(SHORT_TITLE_PROPERTY, tr("Location")); } FileWizardPage::~FileWizardPage() diff --git a/src/libs/utils/ipaddresslineedit.cpp b/src/libs/utils/ipaddresslineedit.cpp index c051b1438d..6291bc993e 100644 --- a/src/libs/utils/ipaddresslineedit.cpp +++ b/src/libs/utils/ipaddresslineedit.cpp @@ -90,7 +90,7 @@ bool IpAddressLineEdit::validate(const QString &value, QString *errorMessage) co void IpAddressLineEdit::handleChanged(const QString &t) { - Utils::FancyLineEdit::handleChanged(t); + FancyLineEdit::handleChanged(t); if (isValid()) emit validAddressChanged(t); else diff --git a/src/libs/utils/ipaddresslineedit.h b/src/libs/utils/ipaddresslineedit.h index 848c78a839..b62de39534 100644 --- a/src/libs/utils/ipaddresslineedit.h +++ b/src/libs/utils/ipaddresslineedit.h @@ -36,7 +36,7 @@ namespace Utils { class IpAddressLineEditPrivate; -class QTCREATOR_UTILS_EXPORT IpAddressLineEdit : public Utils::FancyLineEdit +class QTCREATOR_UTILS_EXPORT IpAddressLineEdit : public FancyLineEdit { Q_OBJECT diff --git a/src/libs/utils/json.h b/src/libs/utils/json.h index f2d7ac23e8..636139abbf 100644 --- a/src/libs/utils/json.h +++ b/src/libs/utils/json.h @@ -398,22 +398,22 @@ public: JsonSchemaManager(const QStringList &searchPaths); ~JsonSchemaManager(); - Utils::JsonSchema *schemaForFile(const QString &fileName) const; - Utils::JsonSchema *schemaByName(const QString &baseName) const; + JsonSchema *schemaForFile(const QString &fileName) const; + JsonSchema *schemaByName(const QString &baseName) const; private: struct JsonSchemaData { - JsonSchemaData(const QString &absoluteFileName, Utils::JsonSchema *schema = 0) + JsonSchemaData(const QString &absoluteFileName, JsonSchema *schema = 0) : m_absoluteFileName(absoluteFileName) , m_schema(schema) {} QString m_absoluteFileName; - Utils::JsonSchema *m_schema; + JsonSchema *m_schema; QDateTime m_lastParseAttempt; }; - Utils::JsonSchema *parseSchema(const QString &schemaFileName) const; + JsonSchema *parseSchema(const QString &schemaFileName) const; QStringList m_searchPaths; mutable QHash<QString, JsonSchemaData> m_schemas; diff --git a/src/libs/utils/navigationtreeview.h b/src/libs/utils/navigationtreeview.h index f9846f3dff..6e12ca95ec 100644 --- a/src/libs/utils/navigationtreeview.h +++ b/src/libs/utils/navigationtreeview.h @@ -36,7 +36,7 @@ namespace Utils { -class QTCREATOR_UTILS_EXPORT NavigationTreeView : public Utils::TreeView +class QTCREATOR_UTILS_EXPORT NavigationTreeView : public TreeView { Q_OBJECT public: diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 4580a18c3f..5966dac7e2 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -148,7 +148,7 @@ QString BinaryVersionToolTipEventFilter::toolVersion(const QString &binary, cons if (!proc.waitForStarted()) return QString(); if (!proc.waitForFinished()) { - Utils::SynchronousProcess::stopProcess(proc); + SynchronousProcess::stopProcess(proc); return QString(); } return QString::fromLocal8Bit(QByteArray(proc.readAllStandardOutput() @@ -271,7 +271,7 @@ void PathChooser::insertButton(int index, const QString &text, QObject *receiver d->m_buttons.insert(index, button); } -QString Utils::PathChooser::browseButtonLabel() +QString PathChooser::browseButtonLabel() { return HostOsInfo::isMacHost() ? tr("Choose...") : tr("Browse..."); } @@ -296,7 +296,7 @@ void PathChooser::setBaseDirectory(const QString &directory) FileName PathChooser::baseFileName() const { - return Utils::FileName::fromString(d->m_baseDirectory); + return FileName::fromString(d->m_baseDirectory); } void PathChooser::setBaseFileName(const FileName &base) @@ -305,7 +305,7 @@ void PathChooser::setBaseFileName(const FileName &base) triggerChanged(); } -void PathChooser::setEnvironment(const Utils::Environment &env) +void PathChooser::setEnvironment(const Environment &env) { QString oldExpand = path(); d->m_environment = env; @@ -327,7 +327,7 @@ QString PathChooser::rawPath() const FileName PathChooser::fileName() const { - return Utils::FileName::fromString(path()); + return FileName::fromString(path()); } void PathChooser::setPath(const QString &path) @@ -335,7 +335,7 @@ void PathChooser::setPath(const QString &path) d->m_lineEdit->setText(QDir::toNativeSeparators(path)); } -void PathChooser::setFileName(const Utils::FileName &fn) +void PathChooser::setFileName(const FileName &fn) { d->m_lineEdit->setText(fn.toUserOutput()); } diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index 86250849a8..e650efbcb5 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -94,15 +94,15 @@ public: QString path() const; QString rawPath() const; // The raw unexpanded input. - Utils::FileName fileName() const; + FileName fileName() const; QString baseDirectory() const; void setBaseDirectory(const QString &directory); - Utils::FileName baseFileName() const; - void setBaseFileName(const Utils::FileName &base); + FileName baseFileName() const; + void setBaseFileName(const FileName &base); - void setEnvironment(const Utils::Environment &env); + void setEnvironment(const Environment &env); /** Returns the suggested label title when used in a form layout. */ static QString label(); diff --git a/src/libs/utils/persistentsettings.cpp b/src/libs/utils/persistentsettings.cpp index 80ffd46dde..bdfc54ba4c 100644 --- a/src/libs/utils/persistentsettings.cpp +++ b/src/libs/utils/persistentsettings.cpp @@ -350,7 +350,7 @@ QVariantMap PersistentSettingsReader::restoreValues() const return m_valueMap; } -bool PersistentSettingsReader::load(const Utils::FileName &fileName) +bool PersistentSettingsReader::load(const FileName &fileName) { m_valueMap.clear(); @@ -442,7 +442,7 @@ bool PersistentSettingsWriter::write(const QVariantMap &data, QWidget *parent) c { QDir tmp; tmp.mkpath(m_fileName.toFileInfo().path()); - Utils::FileSaver saver(m_fileName.toString(), QIODevice::Text); + FileSaver saver(m_fileName.toString(), QIODevice::Text); if (!saver.hasError()) { const Context ctx; QXmlStreamWriter w(saver.file()); diff --git a/src/libs/utils/persistentsettings.h b/src/libs/utils/persistentsettings.h index 947355cb12..834c875ad7 100644 --- a/src/libs/utils/persistentsettings.h +++ b/src/libs/utils/persistentsettings.h @@ -60,12 +60,12 @@ public: bool save(const QVariantMap &data, QWidget *parent) const; - Utils::FileName fileName() const; + FileName fileName() const; private: bool write(const QVariantMap &data, QWidget *parent) const; - const Utils::FileName m_fileName; + const FileName m_fileName; const QString m_docType; mutable QMap<QString, QVariant> m_savedData; }; diff --git a/src/libs/utils/reloadpromptutils.cpp b/src/libs/utils/reloadpromptutils.cpp index 0b632e385a..664b47dba0 100644 --- a/src/libs/utils/reloadpromptutils.cpp +++ b/src/libs/utils/reloadpromptutils.cpp @@ -34,11 +34,11 @@ #include <QMessageBox> #include <QPushButton> -using namespace Utils; +namespace Utils { -QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer Utils::reloadPrompt(const QString &fileName, - bool modified, - QWidget *parent) +QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &fileName, + bool modified, + QWidget *parent) { const QString title = QCoreApplication::translate("Utils::reloadPrompt", "File Changed"); @@ -56,10 +56,10 @@ QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer Utils::reloadPrompt(const QStri return reloadPrompt(title, msg, QDir::toNativeSeparators(fileName), parent); } -QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer Utils::reloadPrompt(const QString &title, - const QString &prompt, - const QString &details, - QWidget *parent) +QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &title, + const QString &prompt, + const QString &details, + QWidget *parent) { QMessageBox msg(parent); msg.setStandardButtons(QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::Close @@ -84,8 +84,8 @@ QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer Utils::reloadPrompt(const QStri return ReloadNone; } -QTCREATOR_UTILS_EXPORT Utils::FileDeletedPromptAnswer - Utils::fileDeletedPrompt(const QString &fileName, bool triggerExternally, QWidget *parent) +QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer + fileDeletedPrompt(const QString &fileName, bool triggerExternally, QWidget *parent) { const QString title = QCoreApplication::translate("Utils::fileDeletedPrompt", "File has been removed"); @@ -127,3 +127,5 @@ QTCREATOR_UTILS_EXPORT Utils::FileDeletedPromptAnswer return FileDeletedSave; return FileDeletedClose; } + +} // namespace Utils diff --git a/src/libs/utils/tcpportsgatherer.cpp b/src/libs/utils/tcpportsgatherer.cpp index abd11cf9ad..b25d95f954 100644 --- a/src/libs/utils/tcpportsgatherer.cpp +++ b/src/libs/utils/tcpportsgatherer.cpp @@ -270,9 +270,9 @@ void TcpPortsGatherer::update(QAbstractSocket::NetworkLayerProtocol protocol) d->protocol = protocol; d->usedPorts.clear(); - if (Utils::HostOsInfo::isWindowsHost()) + if (HostOsInfo::isWindowsHost()) d->updateWin(); - else if (Utils::HostOsInfo::isLinuxHost()) + else if (HostOsInfo::isLinuxHost()) d->updateLinux(); else d->updateNetstat(); diff --git a/src/libs/utils/textfileformat.cpp b/src/libs/utils/textfileformat.cpp index f9a2e21c86..9aceec7dd1 100644 --- a/src/libs/utils/textfileformat.cpp +++ b/src/libs/utils/textfileformat.cpp @@ -213,7 +213,7 @@ TextFileFormat::ReadResult readTextFile(const QString &fileName, const QTextCode QByteArray data; try { - Utils::FileReader reader; + FileReader reader; if (!reader.fetch(fileName, errorString)) return TextFileFormat::ReadIOError; data = reader.data(); @@ -277,16 +277,16 @@ TextFileFormat::ReadResult TextFileFormat::readFileUTF8(const QString &fileName, { QByteArray data; try { - Utils::FileReader reader; + FileReader reader; if (!reader.fetch(fileName, errorString)) - return Utils::TextFileFormat::ReadIOError; + return TextFileFormat::ReadIOError; data = reader.data(); } catch (const std::bad_alloc &) { *errorString = QCoreApplication::translate("Utils::TextFileFormat", "Out of memory."); - return Utils::TextFileFormat::ReadMemoryAllocationError; + return TextFileFormat::ReadMemoryAllocationError; } - Utils::TextFileFormat format = Utils::TextFileFormat::detect(data); + TextFileFormat format = TextFileFormat::detect(data); if (!format.codec) format.codec = defaultCodec ? defaultCodec : QTextCodec::codecForLocale(); QString target; @@ -294,10 +294,10 @@ TextFileFormat::ReadResult TextFileFormat::readFileUTF8(const QString &fileName, if (format.hasUtf8Bom) data.remove(0, 3); *plainText = data; - return Utils::TextFileFormat::ReadSuccess; + return TextFileFormat::ReadSuccess; } *plainText = target.toUtf8(); - return Utils::TextFileFormat::ReadSuccess; + return TextFileFormat::ReadSuccess; } /*! @@ -318,7 +318,7 @@ bool TextFileFormat::writeFile(const QString &fileName, QString plainText, QStri plainText.replace(QLatin1Char('\n'), QLatin1String("\r\n")); } - Utils::FileSaver saver(fileName, fileMode); + FileSaver saver(fileName, fileMode); if (!saver.hasError()) { if (hasUtf8Bom && codec->name() == "UTF-8") saver.write("\xef\xbb\xbf", 3); diff --git a/src/libs/utils/tooltip/reuse.h b/src/libs/utils/tooltip/reuse.h index afaee3136d..9398924478 100644 --- a/src/libs/utils/tooltip/reuse.h +++ b/src/libs/utils/tooltip/reuse.h @@ -51,7 +51,7 @@ inline int screenNumber(const QPoint &pos, QWidget *w) inline QRect screenGeometry(const QPoint &pos, QWidget *w) { - if (Utils::HostOsInfo::isMacHost()) + if (HostOsInfo::isMacHost()) return QApplication::desktop()->availableGeometry(screenNumber(pos, w)); return QApplication::desktop()->screenGeometry(screenNumber(pos, w)); } diff --git a/src/libs/utils/tooltip/tips.cpp b/src/libs/utils/tooltip/tips.cpp index 25572d99b2..f85abe4959 100644 --- a/src/libs/utils/tooltip/tips.cpp +++ b/src/libs/utils/tooltip/tips.cpp @@ -72,7 +72,7 @@ QTipLabel::QTipLabel(QWidget *parent) : QTipLabel::~QTipLabel() { - Utils::TipContent *tmpTipContent = m_tipContent; + TipContent *tmpTipContent = m_tipContent; m_tipContent = 0; delete tmpTipContent; } @@ -84,7 +84,7 @@ bool QTipLabel::isInteractive() const void QTipLabel::setContent(const TipContent &content) { - Utils::TipContent *tmpTipContent = m_tipContent; + TipContent *tmpTipContent = m_tipContent; m_tipContent = content.clone(); delete tmpTipContent; } diff --git a/src/libs/utils/tooltip/tips.h b/src/libs/utils/tooltip/tips.h index 84c776a65e..168731ab6b 100644 --- a/src/libs/utils/tooltip/tips.h +++ b/src/libs/utils/tooltip/tips.h @@ -53,16 +53,16 @@ protected: public: virtual ~QTipLabel(); - void setContent(const Utils::TipContent &content); - const Utils::TipContent &content() const; + void setContent(const TipContent &content); + const TipContent &content() const; virtual void configure(const QPoint &pos, QWidget *w) = 0; - virtual bool canHandleContentReplacement(const Utils::TipContent &content) const = 0; + virtual bool canHandleContentReplacement(const TipContent &content) const = 0; bool isInteractive() const; private: - Utils::TipContent *m_tipContent; + TipContent *m_tipContent; }; class ColorTip : public QTipLabel diff --git a/src/libs/utils/tooltip/tooltip.cpp b/src/libs/utils/tooltip/tooltip.cpp index 35450e8a74..8521b04b44 100644 --- a/src/libs/utils/tooltip/tooltip.cpp +++ b/src/libs/utils/tooltip/tooltip.cpp @@ -222,7 +222,7 @@ void ToolTip::placeTip(const QPoint &pos, QWidget *w) { QRect screen = Internal::screenGeometry(pos, w); QPoint p = pos; - p += QPoint(2, Utils::HostOsInfo::isWindowsHost() ? 21 : 16); + p += QPoint(2, HostOsInfo::isWindowsHost() ? 21 : 16); if (p.x() + m_tip->width() > screen.x() + screen.width()) p.rx() -= 4 + m_tip->width(); if (p.y() + m_tip->height() > screen.y() + screen.height()) diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp index 9e08879a42..ed534716d4 100644 --- a/src/libs/utils/wizard.cpp +++ b/src/libs/utils/wizard.cpp @@ -30,13 +30,14 @@ #include "wizard.h" #include "hostosinfo.h" -#include <QMap> #include <QHash> -#include <QVariant> - +#include <QKeyEvent> #include <QLabel> -#include <QVBoxLayout> +#include <QMap> #include <QStyle> +#include <QVBoxLayout> +#include <QVariant> + /*! \class Utils::Wizard @@ -325,7 +326,7 @@ Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags) : setOption(QWizard::NoBackButtonOnStartPage, true); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - if (Utils::HostOsInfo::isMacHost()) { + if (HostOsInfo::isMacHost()) { setButtonLayout(QList<QWizard::WizardButton>() << QWizard::CancelButton << QWizard::Stretch @@ -376,6 +377,18 @@ bool Wizard::validateCurrentPage() return QWizard::validateCurrentPage(); } +bool Wizard::event(QEvent *event) +{ + if (event->type() == QEvent::ShortcutOverride) { + auto ke = static_cast<QKeyEvent *>(event); + if (ke->key() == Qt::Key_Escape && !ke->modifiers()) { + ke->accept(); + return true; + } + } + return QWizard::event(event); +} + void Wizard::_q_currentPageChanged(int pageId) { Q_D(Wizard); diff --git a/src/libs/utils/wizard.h b/src/libs/utils/wizard.h index 4cfecf2f13..58df9979ce 100644 --- a/src/libs/utils/wizard.h +++ b/src/libs/utils/wizard.h @@ -72,6 +72,9 @@ signals: void nextClicked(); /* workaround for QWizard behavior where page->initialize is * called before currentIdChanged */ +protected: + bool event(QEvent *event); + private slots: void _q_currentPageChanged(int pageId); void _q_pageAdded(int pageId); diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 92a6b4e9bd..afb06ab464 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -290,18 +290,10 @@ void AnalyzerManagerPrivate::delayedInit() // Populate Windows->Views menu with standard actions. Context analyzerContext(C_ANALYZEMODE); ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Id(M_WINDOW_VIEWS)); - Command *cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator1(), + Command *cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator(), "Analyzer.Views.Separator1", analyzerContext); cmd->setAttribute(Command::CA_Hide); viewsMenu->addAction(cmd, G_DEFAULT_THREE); - cmd = Core::ActionManager::registerAction(m_mainWindow->toggleLockedAction(), - "Analyzer.Views.ToggleLocked", analyzerContext); - cmd->setAttribute(Command::CA_Hide); - viewsMenu->addAction(cmd, G_DEFAULT_THREE); - cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator2(), - "Analyzer.Views.Separator2", analyzerContext); - cmd->setAttribute(Command::CA_Hide); - viewsMenu->addAction(cmd, G_DEFAULT_THREE); cmd = Core::ActionManager::registerAction(m_mainWindow->resetLayoutAction(), "Analyzer.Views.ResetSimple", analyzerContext); cmd->setAttribute(Command::CA_Hide); diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index a66c351be0..7aa05047f2 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -620,8 +620,13 @@ QVector<AndroidDeviceInfo> AndroidConfig::androidVirtualDevices() const line = QLatin1String(avds[i]); if (line.contains(QLatin1String("---------"))) break; - if (line.contains(QLatin1String("Target:"))) - dev.sdk = line.mid(line.lastIndexOf(QLatin1Char(' '))).remove(QLatin1Char(')')).toInt(); + if (line.contains(QLatin1String("Target:"))) { + QString tmp = line.mid(line.lastIndexOf(QLatin1Char(' '))).remove(QLatin1Char(')')).trimmed(); + if (tmp == QLatin1String("L")) // HACK for android-L preview + dev.sdk = 20; + else + dev.sdk = tmp.toInt(); + } if (line.contains(QLatin1String("Tag/ABI:"))) dev.cpuAbi = QStringList() << line.mid(line.lastIndexOf(QLatin1Char('/')) +1); else if (line.contains(QLatin1String("ABI:"))) diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 55914e9ace..e6be2237d1 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -793,8 +793,10 @@ QString AndroidManager::androidNameForApiLevel(int x) return QLatin1String("Android 4.3"); case 19: return QLatin1String("Android 4.4"); + case 20: + return QLatin1String("Android L"); // prelimary name? default: - return tr("Unknown Android version."); + return tr("Unknown Android version. API Level: %1").arg(QString::number(x)); } } diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp index fa47a0b9eb..04be02cae2 100644 --- a/src/plugins/android/androidmanifesteditorwidget.cpp +++ b/src/plugins/android/androidmanifesteditorwidget.cpp @@ -70,6 +70,8 @@ #include <QTimer> #include <QCheckBox> +#include <limits> + using namespace ProjectExplorer; using namespace Android; using namespace Android::Internal; @@ -180,7 +182,7 @@ void AndroidManifestEditorWidget::initializePage() m_versionCode = new QSpinBox(packageGroupBox); - m_versionCode->setMaximum(99); + m_versionCode->setMaximum(std::numeric_limits<int>::max()); m_versionCode->setValue(1); m_versionCode->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); formLayout->addRow(tr("Version code:"), m_versionCode); diff --git a/src/plugins/android/androidpotentialkit.cpp b/src/plugins/android/androidpotentialkit.cpp index 247872b3e4..603f5444d7 100644 --- a/src/plugins/android/androidpotentialkit.cpp +++ b/src/plugins/android/androidpotentialkit.cpp @@ -120,7 +120,8 @@ AndroidPotentialKitWidget::AndroidPotentialKitWidget(QWidget *parent) void AndroidPotentialKitWidget::openOptions() { Core::ICore::showOptionsDialog(Constants::ANDROID_SETTINGS_CATEGORY, - Constants::ANDROID_SETTINGS_ID); + Constants::ANDROID_SETTINGS_ID, + this); } void AndroidPotentialKitWidget::recheck() diff --git a/src/plugins/beautifier/beautifier.qrc b/src/plugins/beautifier/beautifier.qrc index db98b065bc..cab6cb4740 100644 --- a/src/plugins/beautifier/beautifier.qrc +++ b/src/plugins/beautifier/beautifier.qrc @@ -1,5 +1,6 @@ <RCC> - <qresource prefix="/"> - <file alias="categoryicon">images/beautifier.png</file> + <qresource prefix="/beautifier"> + <file>images/beautifier.png</file> + <file>images/beautifier@2x.png</file> </qresource> </RCC> diff --git a/src/plugins/beautifier/beautifierconstants.h b/src/plugins/beautifier/beautifierconstants.h index f317a14ddf..b1c8277262 100644 --- a/src/plugins/beautifier/beautifierconstants.h +++ b/src/plugins/beautifier/beautifierconstants.h @@ -39,7 +39,7 @@ const char ACTION_ID[] = "Beautifier.Action"; const char MENU_ID[] = "Beautifier.Menu"; const char OPTION_CATEGORY[] = "II.Beautifier"; const char OPTION_TR_CATEGORY[] = QT_TRANSLATE_NOOP("Beautifier", "Beautifier"); -const char OPTION_CATEGORY_ICON[] = ":/categoryicon"; +const char OPTION_CATEGORY_ICON[] = ":/beautifier/images/beautifier.png"; const char SETTINGS_GROUP[] = "Beautifier"; const char SETTINGS_DIRNAME[] = "beautifier"; const char DOCUMENTATION_DIRNAME[] = "documentation"; diff --git a/src/plugins/beautifier/images/beautifier.png b/src/plugins/beautifier/images/beautifier.png Binary files differindex 65cf56ae8e..69b25dd6b9 100644 --- a/src/plugins/beautifier/images/beautifier.png +++ b/src/plugins/beautifier/images/beautifier.png diff --git a/src/plugins/beautifier/images/beautifier@2x.png b/src/plugins/beautifier/images/beautifier@2x.png Binary files differnew file mode 100644 index 0000000000..d44edef21d --- /dev/null +++ b/src/plugins/beautifier/images/beautifier@2x.png diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index 5d5b30d72a..0bc10828b0 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -292,7 +292,8 @@ bool NoKitPage::isComplete() const void NoKitPage::showOptions() { Core::ICore::showOptionsDialog(Core::Id(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY), - Core::Id(ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID), this); + Core::Id(ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID), + this); } InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard) diff --git a/src/plugins/coreplugin/basefilewizardfactory.cpp b/src/plugins/coreplugin/basefilewizardfactory.cpp index 08e3bb2e81..c4c5bc1cae 100644 --- a/src/plugins/coreplugin/basefilewizardfactory.cpp +++ b/src/plugins/coreplugin/basefilewizardfactory.cpp @@ -122,7 +122,7 @@ WizardEventLoop::WizardResult WizardEventLoop::execWizardPage(QWizard &wizard) connect(&wizard, SIGNAL(currentIdChanged(int)), eventLoop, SLOT(pageChanged(int))); connect(&wizard, SIGNAL(accepted()), eventLoop, SLOT(accepted())); connect(&wizard, SIGNAL(rejected()), eventLoop, SLOT(rejected())); - wizard.setWindowFlags(wizard.windowFlags() | Qt::WindowStaysOnTopHint); + wizard.setWindowFlags(wizard.windowFlags()); wizard.show(); } const WizardResult result = eventLoop->execWizardPageI(); diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp index 32704ec31d..95d0a134f5 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.cpp +++ b/src/plugins/coreplugin/dialogs/newdialog.cpp @@ -195,7 +195,7 @@ NewDialog::NewDialog(QWidget *parent) : m_okButton(0) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); + setWindowFlags(windowFlags()); setAttribute(Qt::WA_DeleteOnClose); m_ui->setupUi(this); QPalette p = m_ui->frame->palette(); diff --git a/src/plugins/coreplugin/editormanager/documentmodel.cpp b/src/plugins/coreplugin/editormanager/documentmodel.cpp index 47b19883f2..8f2fc35a65 100644 --- a/src/plugins/coreplugin/editormanager/documentmodel.cpp +++ b/src/plugins/coreplugin/editormanager/documentmodel.cpp @@ -32,6 +32,7 @@ #include <coreplugin/documentmanager.h> #include <coreplugin/idocument.h> +#include <utils/algorithm.h> #include <utils/qtcassert.h> #include <QDir> @@ -147,16 +148,6 @@ int DocumentModelPrivate::rowCount(const QModelIndex &parent) const return 0; } -// TODO remove -QList<IEditor *> DocumentModel::oneEditorForEachOpenedDocument() -{ - QList<IEditor *> result; - QMapIterator<IDocument *, QList<IEditor *> > it(d->m_editors); - while (it.hasNext()) - result << it.next().value().first(); - return result; -} - void DocumentModel::addEditor(IEditor *editor, bool *isNewDocument) { if (!editor) @@ -224,11 +215,6 @@ void DocumentModelPrivate::addEntry(DocumentModel::Entry *entry) endInsertRows(); } -int DocumentModel::indexOfFilePath(const QString &filePath) -{ - return d->indexOfFilePath(filePath); -} - int DocumentModelPrivate::indexOfFilePath(const QString &filePath) const { if (filePath.isEmpty()) @@ -266,7 +252,7 @@ void DocumentModel::removeEditor(IEditor *editor, bool *lastOneForDocument) void DocumentModel::removeDocument(const QString &fileName) { - int index = indexOfFilePath(fileName); + int index = d->indexOfFilePath(fileName); QTC_ASSERT(!d->m_entries.at(index)->document, return); // we wouldn't know what to do with the associated editors d->removeDocument(index); } @@ -343,7 +329,7 @@ QList<IDocument *> DocumentModel::openedDocuments() IDocument *DocumentModel::documentForFilePath(const QString &filePath) { - int index = indexOfFilePath(filePath); + int index = d->indexOfFilePath(filePath); if (index < 0) return 0; return d->m_entries.at(index)->document; diff --git a/src/plugins/coreplugin/editormanager/documentmodel.h b/src/plugins/coreplugin/editormanager/documentmodel.h index 4845aef826..5bc2315440 100644 --- a/src/plugins/coreplugin/editormanager/documentmodel.h +++ b/src/plugins/coreplugin/editormanager/documentmodel.h @@ -70,7 +70,6 @@ public: static int entryCount(); static QList<Entry *> entries(); static int indexOfDocument(IDocument *document); - static int indexOfFilePath(const QString &filePath); static Entry *entryForDocument(IDocument *document); static QList<IDocument *> openedDocuments(); @@ -78,7 +77,6 @@ public: static QList<IEditor *> editorsForFilePath(const QString &filePath); static QList<IEditor *> editorsForDocument(IDocument *document); static QList<IEditor *> editorsForDocuments(const QList<IDocument *> &entries); - static QList<IEditor *> oneEditorForEachOpenedDocument(); static QList<IEditor *> editorsForOpenedDocuments(); // editor manager related functions, nobody else should call it diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 1c3fe72bc7..b9a13dd56d 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -830,7 +830,7 @@ void EditorManager::addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentM contextMenu->addAction(d->m_openGraphicalShellAction); contextMenu->addAction(d->m_openTerminalAction); contextMenu->addAction(d->m_findInDirectoryAction); - QMenu *openWith = contextMenu->addMenu(tr("Open with")); + QMenu *openWith = contextMenu->addMenu(tr("Open With")); connect(openWith, SIGNAL(triggered(QAction*)), DocumentManager::instance(), SLOT(executeOpenWithMenuAction(QAction*))); openWith->setEnabled(enabled); diff --git a/src/plugins/coreplugin/editormanager/iexternaleditor.cpp b/src/plugins/coreplugin/editormanager/iexternaleditor.cpp index 53723745f8..98df2ff318 100644 --- a/src/plugins/coreplugin/editormanager/iexternaleditor.cpp +++ b/src/plugins/coreplugin/editormanager/iexternaleditor.cpp @@ -34,7 +34,7 @@ \mainclass \brief The IExternalEditor class enables registering an external - editor in the \gui{Open with} dialog. + editor in the \gui{Open With} dialog. */ /*! diff --git a/src/plugins/coreplugin/fileutils.cpp b/src/plugins/coreplugin/fileutils.cpp index 003f677434..7a90335aa3 100644 --- a/src/plugins/coreplugin/fileutils.cpp +++ b/src/plugins/coreplugin/fileutils.cpp @@ -69,8 +69,11 @@ static void showGraphicalShellError(QWidget *parent, const QString &app, const Q QAbstractButton *settingsButton = mbox.addButton(Core::ICore::msgShowOptionsDialog(), QMessageBox::ActionRole); mbox.exec(); - if (mbox.clickedButton() == settingsButton) - ICore::showOptionsDialog(Constants::SETTINGS_CATEGORY_CORE, Constants::SETTINGS_ID_ENVIRONMENT); + if (mbox.clickedButton() == settingsButton) { + ICore::showOptionsDialog(Constants::SETTINGS_CATEGORY_CORE, + Constants::SETTINGS_ID_ENVIRONMENT, + parent); + } } void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn) diff --git a/src/plugins/coreplugin/find/searchresultwindow.cpp b/src/plugins/coreplugin/find/searchresultwindow.cpp index 4b9b3ae7a3..e111166215 100644 --- a/src/plugins/coreplugin/find/searchresultwindow.cpp +++ b/src/plugins/coreplugin/find/searchresultwindow.cpp @@ -36,15 +36,17 @@ #include <coreplugin/coreconstants.h> #include <coreplugin/icontext.h> #include <utils/qtcassert.h> +#include <utils/styledbar.h> -#include <QSettings> -#include <QDebug> -#include <QFont> #include <QAction> -#include <QToolButton> #include <QComboBox> +#include <QDebug> +#include <QFont> +#include <QLabel> #include <QScrollArea> +#include <QSettings> #include <QStackedWidget> +#include <QToolButton> static const char SETTINGSKEYSECTIONNAME[] = "SearchResults"; static const char SETTINGSKEYEXPANDRESULTS[] = "ExpandResults"; @@ -90,6 +92,8 @@ namespace Internal { QAction *m_expandCollapseAction; static const bool m_initiallyExpand = false; QWidget *m_spacer; + QLabel *m_historyLabel; + QWidget *m_spacer2; QComboBox *m_recentSearchesBox; QStackedWidget *m_widget; QList<SearchResult *> m_searchResults; @@ -276,7 +280,11 @@ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel) d->m_spacer = new QWidget; d->m_spacer->setMinimumWidth(30); + d->m_historyLabel = new QLabel(tr("History:")); + d->m_spacer2 = new QWidget; + d->m_spacer2->setMinimumWidth(5); d->m_recentSearchesBox = new QComboBox; + d->m_recentSearchesBox->setProperty("drawleftborder", true); d->m_recentSearchesBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); d->m_recentSearchesBox->addItem(tr("New Search")); connect(d->m_recentSearchesBox, SIGNAL(activated(int)), d, SLOT(setCurrentIndex(int))); @@ -347,7 +355,8 @@ QWidget *SearchResultWindow::outputWidget(QWidget *) */ QList<QWidget*> SearchResultWindow::toolBarWidgets() const { - return QList<QWidget*>() << d->m_expandCollapseButton << d->m_spacer << d->m_recentSearchesBox; + return QList<QWidget*>() << d->m_expandCollapseButton << d->m_spacer + << d->m_historyLabel << d->m_spacer2 << d->m_recentSearchesBox; } /*! diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index d2a469b5a7..6a4b4e3371 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -833,7 +833,7 @@ bool MainWindow::showOptionsDialog(Id category, Id page, QWidget *parent) { emit m_coreImpl->optionsDialogRequested(); if (!parent) - parent = this; + parent = ICore::dialogParent(); SettingsDialog *dialog = SettingsDialog::getSettingsDialog(parent, category, page); return dialog->execDialog(); } diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 9317802865..8333df0c57 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -923,17 +923,25 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti bool isEmpty = cb->currentText.isEmpty() && cb->currentIcon.isNull(); bool reverse = option->direction == Qt::RightToLeft; bool drawborder = !(widget && widget->property("hideborder").toBool()); + bool drawleftborder = (widget && widget->property("drawleftborder").toBool()); bool alignarrow = !(widget && widget->property("alignarrow").toBool()); - if (drawborder) + if (drawborder) { drawButtonSeparator(painter, rect, reverse); + if (drawleftborder) + drawButtonSeparator(painter, rect.adjusted(0, 0, -rect.width() + 2, 0), reverse); + } QStyleOption toolbutton = *option; if (isEmpty) toolbutton.state &= ~(State_Enabled | State_Sunken); painter->save(); - if (drawborder) - painter->setClipRect(toolbutton.rect.adjusted(0, 0, -2, 0)); + if (drawborder) { + int leftClipAdjust = 0; + if (drawleftborder) + leftClipAdjust = 2; + painter->setClipRect(toolbutton.rect.adjusted(leftClipAdjust, 0, -2, 0)); + } drawPrimitive(PE_PanelButtonTool, &toolbutton, painter, widget); painter->restore(); // Draw arrow diff --git a/src/plugins/cpaster/protocol.cpp b/src/plugins/cpaster/protocol.cpp index 2306ed252a..abaaba8a01 100644 --- a/src/plugins/cpaster/protocol.cpp +++ b/src/plugins/cpaster/protocol.cpp @@ -169,9 +169,11 @@ bool Protocol::showConfigurationError(const Protocol *p, settingsButton = mb.addButton(Core::ICore::msgShowOptionsDialog(), QMessageBox::AcceptRole); mb.exec(); bool rc = false; - if (mb.clickedButton() == settingsButton) + if (mb.clickedButton() == settingsButton) { rc = Core::ICore::showOptionsDialog(p->settingsPage()->category(), - p->settingsPage()->id(), parent); + p->settingsPage()->id(), + parent); + } return rc; } diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 6eb8a847d2..be1b348340 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -193,7 +193,7 @@ Class *isMemberFunction(const LookupContext &context, Function *function) const Name *functionName = function->name(); if (!functionName) - return 0; // anonymous function names are not valid c++ + return 0; if (!functionName->isQualifiedNameId()) return 0; // trying to add a declaration for a global function @@ -225,7 +225,7 @@ Namespace *isNamespaceFunction(const LookupContext &context, Function *function) const Name *functionName = function->name(); if (!functionName) - return 0; // anonymous function names are not valid c++ + return 0; // global namespace if (!functionName->isQualifiedNameId()) { @@ -4148,7 +4148,7 @@ QString definitionSignature(const CppQuickFixAssistInterface *assist, oo.showReturnTypes = true; oo.showArgumentNames = true; const Name *name = func->name(); - if (nameIncludesOperatorName(name)) { + if (name && nameIncludesOperatorName(name)) { CoreDeclaratorAST *coreDeclarator = functionDefinitionAST->declarator->core_declarator; const QString operatorNameText = baseFile->textOf(coreDeclarator); oo.includeWhiteSpaceInOperatorName = operatorNameText.contains(QLatin1Char(' ')); diff --git a/src/plugins/cpptools/symbolfinder.cpp b/src/plugins/cpptools/symbolfinder.cpp index 73ae0d4d82..81953adad4 100644 --- a/src/plugins/cpptools/symbolfinder.cpp +++ b/src/plugins/cpptools/symbolfinder.cpp @@ -278,7 +278,7 @@ void SymbolFinder::findMatchingDeclaration(const LookupContext &context, const Name *functionName = functionType->name(); if (!functionName) - return; // anonymous function names are not valid c++ + return; ClassOrNamespace *binding = 0; const QualifiedNameId *qName = functionName->asQualifiedNameId(); diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 5279e1c0ef..c6a5bd0c06 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -729,15 +729,6 @@ void BreakTreeView::mouseDoubleClickEvent(QMouseEvent *ev) BaseTreeView::mouseDoubleClickEvent(ev); } -void BreakTreeView::setModel(QAbstractItemModel *model) -{ - BaseTreeView::setModel(model); - resizeColumnToContents(0); // Number - resizeColumnToContents(3); // Line - resizeColumnToContents(6); // Ignore count - connect(model, SIGNAL(layoutChanged()), this, SLOT(expandAll())); -} - void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev) { QMenu menu; @@ -783,9 +774,6 @@ void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev) deleteByFileAction->setEnabled(false); } - QAction *adjustColumnAction = - new QAction(tr("Adjust Column Widths to Contents"), &menu); - QAction *editBreakpointAction = new QAction(tr("Edit Breakpoint..."), &menu); editBreakpointAction->setEnabled(!selectedIds.isEmpty()); @@ -842,8 +830,6 @@ void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev) deleteAllBreakpoints(); else if (act == deleteByFileAction) deleteBreakpoints(breakpointsInFile); - else if (act == adjustColumnAction) - resizeColumns(); else if (act == editBreakpointAction) editBreakpoints(selectedIds); else if (act == associateBreakpointAction) diff --git a/src/plugins/debugger/breakwindow.h b/src/plugins/debugger/breakwindow.h index 66a79145a9..0d3e2ba42d 100644 --- a/src/plugins/debugger/breakwindow.h +++ b/src/plugins/debugger/breakwindow.h @@ -44,7 +44,6 @@ public: BreakTreeView(); static void editBreakpoint(BreakpointModelId id, QWidget *parent); - void setModel(QAbstractItemModel *model); private slots: void showAddressColumn(bool on); diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 4fbbecb1ba..913febe699 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -585,7 +585,7 @@ DebuggerSettings::DebuggerSettings() item = new SavedAction(this); item->setSettingsKey(debugModeGroup, QLatin1String("DisplayStringLimit")); - item->setToolTip(tr("The maximal length of string entries in the " + item->setToolTip(tr("The maximum length of string entries in the " "Locals and Expressions pane. Longer than that are cut off " "and displayed with an ellipsis attached.")); item->setDefaultValue(100); @@ -593,7 +593,7 @@ DebuggerSettings::DebuggerSettings() item = new SavedAction(this); item->setSettingsKey(debugModeGroup, QLatin1String("MaximalStringLength")); - item->setToolTip(tr("The maximal length for strings in separated windows. " + item->setToolTip(tr("The maximum length for strings in separated windows. " "Longer strings are cut off and displayed with an ellipsis attached.")); item->setDefaultValue(10000); insertItem(MaximalStringLength, item); diff --git a/src/plugins/debugger/debuggerkitconfigwidget.cpp b/src/plugins/debugger/debuggerkitconfigwidget.cpp index ce8a925399..391742dfe0 100644 --- a/src/plugins/debugger/debuggerkitconfigwidget.cpp +++ b/src/plugins/debugger/debuggerkitconfigwidget.cpp @@ -136,7 +136,8 @@ QWidget *DebuggerKitConfigWidget::mainWidget() const void DebuggerKitConfigWidget::manageDebuggers() { Core::ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, - ProjectExplorer::Constants::DEBUGGER_SETTINGS_PAGE_ID); + ProjectExplorer::Constants::DEBUGGER_SETTINGS_PAGE_ID, + buttonWidget()); } void DebuggerKitConfigWidget::currentDebuggerChanged(int) diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 3d5aeaec0e..190b0152b2 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -90,6 +90,8 @@ public: // Debuggable languages are registered with this function. void addLanguage(DebuggerLanguage language, const Core::Context &context); + QDockWidget *dockWidget(const QString &objectName) const + { return q->findChild<QDockWidget *>(objectName); } public slots: void resetDebuggerLayout(); @@ -313,16 +315,8 @@ void DebuggerMainWindowPrivate::createViewsMenuItems() cmd->setAttribute(Command::CA_Hide); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); - cmd = Core::ActionManager::registerAction(q->menuSeparator1(), - "Debugger.Views.Separator1", debugcontext); - cmd->setAttribute(Command::CA_Hide); - m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); - cmd = Core::ActionManager::registerAction(q->toggleLockedAction(), - "Debugger.Views.ToggleLocked", debugcontext); - cmd->setAttribute(Command::CA_Hide); - m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); - cmd = Core::ActionManager::registerAction(q->menuSeparator2(), - "Debugger.Views.Separator2", debugcontext); + cmd = Core::ActionManager::registerAction(q->menuSeparator(), + "Debugger.Views.Separator", debugcontext); cmd->setAttribute(Command::CA_Hide); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); cmd = Core::ActionManager::registerAction(q->resetLayoutAction(), @@ -397,17 +391,6 @@ void DebuggerMainWindow::setToolBar(DebuggerLanguage language, QWidget *widget) d->m_debugToolBarLayout->insertWidget(-1, widget, 10); } -QDockWidget *DebuggerMainWindow::dockWidget(const QString &objectName) const -{ - return findChild<QDockWidget *>(objectName); -} - -bool DebuggerMainWindow::isDockVisible(const QString &objectName) const -{ - QDockWidget *dock = dockWidget(objectName); - return dock && dock->toggleViewAction()->isChecked(); -} - /*! Keep track of dock widgets so they can be shown/hidden for different languages */ @@ -464,8 +447,6 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) setDockNestingEnabled(true); connect(this, SIGNAL(resetLayout()), d, SLOT(resetDebuggerLayout())); - connect(toggleLockedAction(), SIGNAL(triggered()), - d, SLOT(updateDockWidgetSettings())); QBoxLayout *editorHolderLayout = new QVBoxLayout; editorHolderLayout->setMargin(0); @@ -659,16 +640,16 @@ void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement() } QDockWidget *toolBarDock = q->toolBarDockWidget(); - QDockWidget *breakDock = q->dockWidget(QLatin1String(DOCKWIDGET_BREAK)); - QDockWidget *stackDock = q->dockWidget(QLatin1String(DOCKWIDGET_STACK)); - QDockWidget *watchDock = q->dockWidget(QLatin1String(DOCKWIDGET_WATCHERS)); - QDockWidget *snapshotsDock = q->dockWidget(QLatin1String(DOCKWIDGET_SNAPSHOTS)); - QDockWidget *threadsDock = q->dockWidget(QLatin1String(DOCKWIDGET_THREADS)); - QDockWidget *outputDock = q->dockWidget(QLatin1String(DOCKWIDGET_OUTPUT)); - QDockWidget *qmlInspectorDock = q->dockWidget(QLatin1String(DOCKWIDGET_QML_INSPECTOR)); - QDockWidget *modulesDock = q->dockWidget(QLatin1String(DOCKWIDGET_MODULES)); - QDockWidget *registerDock = q->dockWidget(QLatin1String(DOCKWIDGET_REGISTER)); - QDockWidget *sourceFilesDock = q->dockWidget(QLatin1String(DOCKWIDGET_SOURCE_FILES)); + QDockWidget *breakDock = dockWidget(QLatin1String(DOCKWIDGET_BREAK)); + QDockWidget *stackDock = dockWidget(QLatin1String(DOCKWIDGET_STACK)); + QDockWidget *watchDock = dockWidget(QLatin1String(DOCKWIDGET_WATCHERS)); + QDockWidget *snapshotsDock = dockWidget(QLatin1String(DOCKWIDGET_SNAPSHOTS)); + QDockWidget *threadsDock = dockWidget(QLatin1String(DOCKWIDGET_THREADS)); + QDockWidget *outputDock = dockWidget(QLatin1String(DOCKWIDGET_OUTPUT)); + QDockWidget *qmlInspectorDock = dockWidget(QLatin1String(DOCKWIDGET_QML_INSPECTOR)); + QDockWidget *modulesDock = dockWidget(QLatin1String(DOCKWIDGET_MODULES)); + QDockWidget *registerDock = dockWidget(QLatin1String(DOCKWIDGET_REGISTER)); + QDockWidget *sourceFilesDock = dockWidget(QLatin1String(DOCKWIDGET_SOURCE_FILES)); QTC_ASSERT(breakDock, return); QTC_ASSERT(stackDock, return); diff --git a/src/plugins/debugger/debuggermainwindow.h b/src/plugins/debugger/debuggermainwindow.h index ad9b55599d..6ebc2e5c9c 100644 --- a/src/plugins/debugger/debuggermainwindow.h +++ b/src/plugins/debugger/debuggermainwindow.h @@ -80,8 +80,6 @@ public: void initialize(); void onModeChanged(Core::IMode *mode); - QDockWidget *dockWidget(const QString &objectName) const; - bool isDockVisible(const QString &objectName) const; // Dockwidgets are registered to the main window. QDockWidget *createDockWidget(const DebuggerLanguage &language, QWidget *widget); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 5a3dbd662b..60ab8baa4b 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -909,8 +909,12 @@ public slots: const CPlusPlus::Snapshot &cppCodeModelSnapshot() const; DebuggerMainWindow *mainWindow() const { return m_mainWindow; } + bool isDockVisible(const QString &objectName) const - { return mainWindow()->isDockVisible(objectName); } + { + QDockWidget *dock = mainWindow()->findChild<QDockWidget *>(objectName); + return dock && dock->toggleViewAction()->isChecked(); + } bool hasSnapshots() const { return m_snapshotHandler->size(); } void createNewDock(QWidget *widget); @@ -2626,7 +2630,6 @@ void DebuggerPluginPrivate::createNewDock(QWidget *widget) { QDockWidget *dockWidget = m_mainWindow->createDockWidget(CppLanguage, widget); - dockWidget->setWindowTitle(widget->windowTitle()); dockWidget->setFeatures(QDockWidget::DockWidgetClosable); dockWidget->show(); } diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp index 30f33bcf4d..0f89a87b3e 100644 --- a/src/plugins/debugger/loadcoredialog.cpp +++ b/src/plugins/debugger/loadcoredialog.cpp @@ -321,12 +321,15 @@ bool AttachCoreDialog::useLocalCoreFile() const void AttachCoreDialog::coreFileChanged(const QString &core) { - Kit *k = d->kitChooser->currentKit(); - QTC_ASSERT(k, return); - FileName cmd = DebuggerKitInformation::debuggerCommand(k); - bool isCore = false; - QString exe = readExecutableNameFromCore(cmd.toString(), core, &isCore); - d->localExecFileName->setFileName(FileName::fromString(exe)); + if (!Utils::HostOsInfo::isWindowsHost()) { + Kit *k = d->kitChooser->currentKit(); + QTC_ASSERT(k, return); + FileName cmd = DebuggerKitInformation::debuggerCommand(k); + bool isCore = false; + const QString exe = readExecutableNameFromCore(cmd.toString(), core, &isCore); + if (!exe.isEmpty()) + d->localExecFileName->setFileName(FileName::fromString(exe)); + } changed(); } diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index f91ae1cae5..c9c6ba369f 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -230,14 +230,8 @@ void FormEditorW::setupViewActions() addDockViewAction(viewMenu, ActionEditorSubWindow, m_contexts, tr("Action Editor"), "FormEditor.ActionEditor"); - // Lock/Reset - Command *cmd = addToolAction(m_editorWidget->menuSeparator1(), m_contexts, "FormEditor.SeparatorLock", viewMenu); - cmd->setAttribute(Command::CA_Hide); - - cmd = addToolAction(m_editorWidget->toggleLockedAction(), m_contexts, "FormEditor.Locked", viewMenu); - cmd->setAttribute(Command::CA_Hide); - - cmd = addToolAction(m_editorWidget->menuSeparator2(), m_contexts, "FormEditor.SeparatorReset", viewMenu); + // Reset + Command *cmd = addToolAction(m_editorWidget->menuSeparator(), m_contexts, "FormEditor.SeparatorReset", viewMenu); cmd->setAttribute(Command::CA_Hide); cmd = addToolAction(m_editorWidget->resetLayoutAction(), m_contexts, "FormEditor.ResetToDefaultLayout", viewMenu); diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp index 9de7bafe2f..ad942e57ae 100644 --- a/src/plugins/git/clonewizardpage.cpp +++ b/src/plugins/git/clonewizardpage.cpp @@ -44,14 +44,12 @@ struct CloneWizardPagePrivate { const QString mainLinePostfix; const QString gitPostFix; - const QString protocolDelimiter; QCheckBox *recursiveCheckBox; }; CloneWizardPagePrivate::CloneWizardPagePrivate() : mainLinePostfix(QLatin1String("/mainline.git")), gitPostFix(QLatin1String(".git")), - protocolDelimiter(QLatin1String("://")), recursiveCheckBox(0) { } @@ -83,33 +81,21 @@ CloneWizardPage::~CloneWizardPage() QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const { - /* Try to figure out a good directory name from something like: - * 'user@host:qt/qt.git', 'http://host/qt/qt.git' 'local repo' - * ------> 'qt' . */ const QChar slash = QLatin1Char('/'); QString url = urlIn.trimmed().replace(QLatin1Char('\\'), slash); - // remove host - const int protocolDelimiterPos = url.indexOf(d->protocolDelimiter); // "://" - const int startRepoSearchPos = protocolDelimiterPos == -1 ? 0 : protocolDelimiterPos + d->protocolDelimiter.size(); - int repoPos = url.indexOf(QLatin1Char(':'), startRepoSearchPos); - if (repoPos == -1) - repoPos = url.indexOf(slash, startRepoSearchPos); - if (repoPos != -1) - url.remove(0, repoPos + 1); // Remove postfixes - if (url.endsWith(d->mainLinePostfix)) { + if (url.endsWith(d->mainLinePostfix)) url.truncate(url.size() - d->mainLinePostfix.size()); - } else { - if (url.endsWith(d->gitPostFix)) - url.truncate(url.size() - d->gitPostFix.size()); - } - // Check for equal parts, something like "qt/qt" -> "qt" - const int slashPos = url.indexOf(slash); - if (slashPos != -1 && slashPos == (url.size() - 1) / 2) { - if (url.leftRef(slashPos) == url.rightRef(slashPos)) - url.truncate(slashPos); - } + else if (url.endsWith(d->gitPostFix)) + url.truncate(url.size() - d->gitPostFix.size()); + + // extract repository name (last part of path) + int startOfRepoName = url.lastIndexOf(slash); + if (startOfRepoName == -1) + startOfRepoName = url.lastIndexOf(QLatin1Char(':')); + url.remove(0, startOfRepoName); + // fix invalid characters const QChar dash = QLatin1Char('-'); url.replace(QRegExp(QLatin1String("[^0-9a-zA-Z_.-]")), dash); @@ -154,3 +140,15 @@ QStringList CloneWizardPage::branches(const QString &repository, int *current) } } // namespace Git + +#ifdef WITH_TESTS +#include <QTest> + +void Git::CloneWizardPage::testDirectoryFromRepository() +{ + QFETCH(QString, repository); + QFETCH(QString, localDirectory); + + QCOMPARE(directoryFromRepository(repository), localDirectory); +} +#endif diff --git a/src/plugins/git/clonewizardpage.h b/src/plugins/git/clonewizardpage.h index 14cba30d47..a89f2871b8 100644 --- a/src/plugins/git/clonewizardpage.h +++ b/src/plugins/git/clonewizardpage.h @@ -54,6 +54,11 @@ protected: QString directoryFromRepository(const QString &r) const; QStringList branches(const QString &repository, int *current); +#ifdef WITH_TESTS +public: + void testDirectoryFromRepository(); +#endif + private: CloneWizardPagePrivate *d; }; diff --git a/src/plugins/git/gerrit/gerritparameters.cpp b/src/plugins/git/gerrit/gerritparameters.cpp index 50731d5fd8..d4b2eaee4f 100644 --- a/src/plugins/git/gerrit/gerritparameters.cpp +++ b/src/plugins/git/gerrit/gerritparameters.cpp @@ -73,14 +73,9 @@ static inline QString detectSsh() if (!ssh.isEmpty()) return ssh; if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found. - const Utils::FileName git = GerritPlugin::gitBinary(); - if (!git.isEmpty()) { - // Is 'git\cmd' in the path (folder containing .bats)? - QString path = git.parentDir().toString(); - if (path.endsWith(QLatin1String("cmd"), Qt::CaseInsensitive)) - path.replace(path.size() - 3, 3, QLatin1String("bin")); - ssh = path + QLatin1Char('/') + QLatin1String(defaultSshC); - } + Utils::FileName path = GerritPlugin::gitBinDirectory(); + if (!path.isEmpty()) + ssh = path.appendPath(QLatin1String(defaultSshC)).toString(); } return ssh; } diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index d3115b60ec..64c7e0eb9a 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -399,6 +399,11 @@ Utils::FileName GerritPlugin::gitBinary() return git; } +Utils::FileName GerritPlugin::gitBinDirectory() +{ + return gitClient()->gitBinDirectory(); +} + // Find the branch of a repository. QString GerritPlugin::branch(const QString &repository) { diff --git a/src/plugins/git/gerrit/gerritplugin.h b/src/plugins/git/gerrit/gerritplugin.h index 781f945974..423f6a2390 100644 --- a/src/plugins/git/gerrit/gerritplugin.h +++ b/src/plugins/git/gerrit/gerritplugin.h @@ -64,6 +64,7 @@ public: bool initialize(Core::ActionContainer *ac); static Utils::FileName gitBinary(); + static Utils::FileName gitBinDirectory(); static QString branch(const QString &repository); void addToLocator(Core::CommandLocator *locator); void push(const QString &topLevel); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 9debfc7343..f04fbe7cb8 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2639,6 +2639,24 @@ bool GitClient::launchGitGui(const QString &workingDirectory) { return success; } +Utils::FileName GitClient::gitBinDirectory() +{ + const QString git = gitBinaryPath(); + if (git.isEmpty()) + return Utils::FileName(); + + // Is 'git\cmd' in the path (folder containing .bats)? + QString path = QFileInfo(git).absolutePath(); + // Git for Windows (msysGit) has git and gitk redirect executables in {setup dir}/cmd + // and the real binaries are in {setup dir}/bin. If cmd is configured in PATH + // or in Git settings, return bin instead. + if (Utils::HostOsInfo::isWindowsHost() + && path.endsWith(QLatin1String("/cmd"), Utils::HostOsInfo::fileNameCaseSensitivity())) { + path.replace(path.size() - 3, 3, QLatin1String("bin")); + } + return Utils::FileName::fromString(path); +} + Utils::FileName GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const { return settings()->gitBinaryPath(ok, errorMessage); diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index b10022d2ba..14279f9d3b 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -35,6 +35,8 @@ #include <coreplugin/editormanager/ieditor.h> +#include <utils/fileutils.h> + #include <QFutureSynchronizer> #include <QObject> #include <QString> @@ -315,6 +317,7 @@ public: void launchGitK(const QString &workingDirectory, const QString &fileName); void launchGitK(const QString &workingDirectory) { launchGitK(workingDirectory, QString()); } bool launchGitGui(const QString &workingDirectory); + Utils::FileName gitBinDirectory(); void launchRepositoryBrowser(const QString &workingDirectory); diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index ce36dab836..9ee1fe321f 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1041,7 +1041,9 @@ Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const Commit default: title = tr("Git Commit"); } - submitEditor->document()->setDisplayName(title); + Core::IDocument *document = submitEditor->document(); + document->setDisplayName(title); + VcsBasePlugin::setSource(document, m_submitRepository); connect(submitEditor, SIGNAL(diff(QStringList,QStringList)), this, SLOT(submitEditorDiff(QStringList,QStringList))); connect(submitEditor, SIGNAL(merge(QStringList)), this, SLOT(submitEditorMerge(QStringList))); connect(submitEditor, SIGNAL(show(QString,QString)), m_gitClient, SLOT(show(QString,QString))); @@ -1487,6 +1489,8 @@ Gerrit::Internal::GerritPlugin *GitPlugin::gerritPlugin() const #ifdef WITH_TESTS +#include "clonewizardpage.h" + #include <QTest> Q_DECLARE_METATYPE(FileStates) @@ -1602,6 +1606,27 @@ void GitPlugin::testLogResolving() "50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn", "3587b513 - Update draft release notes to 1.8.2"); } + +void GitPlugin::testCloneWizard_directoryFromRepository() +{ + CloneWizardPage page; + page.testDirectoryFromRepository(); +} + +void GitPlugin::testCloneWizard_directoryFromRepository_data() +{ + QTest::addColumn<QString>("repository"); + QTest::addColumn<QString>("localDirectory"); + + QTest::newRow("http") << "http://host/qt/qt.git" << "qt"; + QTest::newRow("without slash") << "user@host:qt.git" << "qt"; + QTest::newRow("mainline.git") << "git://gitorious.org/gitorious/mainline.git" << "gitorious"; + QTest::newRow("local repo (Unix)") << "/home/user/qt-creator.git" << "qt-creator"; + QTest::newRow("local repo (Windows)") << "c:\\repos\\qt-creator.git" << "qt-creator"; + QTest::newRow("ssh with port") << "ssh://host:29418/qt/qt.git" << "qt"; + QTest::newRow("invalid chars removed") << "ssh://host/in%va$lid.git" << "in-va-lid"; + QTest::newRow("leading dashs removed") << "https://gerrit.local/--leadingDash" << "leadingDash"; +} #endif Q_EXPORT_PLUGIN(GitPlugin) diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 843f9b1e1c..dda50d4835 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -149,6 +149,8 @@ private slots: void testDiffFileResolving_data(); void testDiffFileResolving(); void testLogResolving(); + void testCloneWizard_directoryFromRepository(); + void testCloneWizard_directoryFromRepository_data(); #endif protected: void updateActions(VcsBase::VcsBasePlugin::ActionState); diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp index 87cd360a5a..e4f3808cf3 100644 --- a/src/plugins/git/gitversioncontrol.cpp +++ b/src/plugins/git/gitversioncontrol.cpp @@ -154,7 +154,11 @@ QString GitVersionControl::vcsTopic(const QString &directory) QStringList GitVersionControl::additionalToolsPath() const { - return m_client->settings()->searchPathList(); + QStringList res = m_client->settings()->searchPathList(); + const QString binaryPath = m_client->gitBinDirectory().toString(); + if (!binaryPath.isEmpty() && !res.contains(binaryPath)) + res << binaryPath; + return res; } bool GitVersionControl::managesDirectory(const QString &directory, QString *topLevel) const diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index b3e4bfc2aa..a68a83b963 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -343,7 +343,7 @@ void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev) actionFind->setEnabled(hasCurrentItem); // open with... if (hasCurrentItem && !isDirectory) { - QMenu *openWith = menu.addMenu(tr("Open with")); + QMenu *openWith = menu.addMenu(tr("Open With")); Core::DocumentManager::populateOpenWithMenu(openWith, m_fileSystemModel->filePath(current)); } diff --git a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp index dffc0d31ab..82a401ae38 100644 --- a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp +++ b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp @@ -205,7 +205,8 @@ void ToolChainInformationConfigWidget::toolChainUpdated(ProjectExplorer::ToolCha void ToolChainInformationConfigWidget::manageToolChains() { Core::ICore::showOptionsDialog(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, - Constants::TOOLCHAIN_SETTINGS_PAGE_ID); + Constants::TOOLCHAIN_SETTINGS_PAGE_ID, + buttonWidget()); } void ToolChainInformationConfigWidget::currentToolChainChanged(int idx) @@ -368,7 +369,8 @@ QWidget *DeviceInformationConfigWidget::buttonWidget() const void DeviceInformationConfigWidget::manageDevices() { ICore::showOptionsDialog(Constants::DEVICE_SETTINGS_CATEGORY, - Constants::DEVICE_SETTINGS_PAGE_ID); + Constants::DEVICE_SETTINGS_PAGE_ID, + buttonWidget()); } void DeviceInformationConfigWidget::modelAboutToReset() diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp index 426ab73edb..3a37bdd500 100644 --- a/src/plugins/projectexplorer/projectwizardpage.cpp +++ b/src/plugins/projectexplorer/projectwizardpage.cpp @@ -491,7 +491,8 @@ void ProjectWizardPage::slotProjectChanged(int index) void ProjectWizardPage::slotManageVcs() { Core::ICore::showOptionsDialog(VcsBase::Constants::VCS_SETTINGS_CATEGORY, - VcsBase::Constants::VCS_COMMON_SETTINGS_ID); + VcsBase::Constants::VCS_COMMON_SETTINGS_ID, + this); } } // namespace Internal diff --git a/src/plugins/projectexplorer/sessiondialog.cpp b/src/plugins/projectexplorer/sessiondialog.cpp index b193ab1b77..81b8f28218 100644 --- a/src/plugins/projectexplorer/sessiondialog.cpp +++ b/src/plugins/projectexplorer/sessiondialog.cpp @@ -92,7 +92,7 @@ SessionNameInputDialog::SessionNameInputDialog(const QStringList &sessions, QWid m_newSessionLineEdit->setValidator(new SessionValidator(this, sessions)); hlayout->addWidget(m_newSessionLineEdit); QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); - m_switchToButton = buttons->addButton(tr("Switch to"), QDialogButtonBox::AcceptRole); + m_switchToButton = buttons->addButton(tr("Switch To"), QDialogButtonBox::AcceptRole); connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); connect(buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(clicked(QAbstractButton*))); @@ -217,7 +217,7 @@ void SessionDialog::updateActions() void SessionDialog::createNew() { SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), this); - newSessionInputDialog.setWindowTitle(tr("New session name")); + newSessionInputDialog.setWindowTitle(tr("New Session Name")); if (newSessionInputDialog.exec() == QDialog::Accepted) { QString sessionName = newSessionInputDialog.value(); @@ -233,7 +233,7 @@ void SessionDialog::clone() { SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), this); newSessionInputDialog.setValue(m_ui.sessionList->currentItem()->text()); - newSessionInputDialog.setWindowTitle(tr("New session name")); + newSessionInputDialog.setWindowTitle(tr("New Session Name")); if (newSessionInputDialog.exec() == QDialog::Accepted) { QString newSession = newSessionInputDialog.value(); @@ -258,7 +258,7 @@ void SessionDialog::rename() { SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), this); newSessionInputDialog.setValue(m_ui.sessionList->currentItem()->text()); - newSessionInputDialog.setWindowTitle(tr("Rename session")); + newSessionInputDialog.setWindowTitle(tr("Rename Session")); if (newSessionInputDialog.exec() == QDialog::Accepted) { SessionManager::renameSession(m_ui.sessionList->currentItem()->text(), newSessionInputDialog.value()); diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 7e78e69197..d1b821f375 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -630,7 +630,8 @@ void TargetSettingsPanelWidget::openTargetPreferences() page->showKit(m_targets.at(targetIndex)->kit()); } ICore::showOptionsDialog(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, - Constants::KITS_SETTINGS_PAGE_ID); + Constants::KITS_SETTINGS_PAGE_ID, + this); } void TargetSettingsPanelWidget::importTarget() diff --git a/src/plugins/projectexplorer/targetsetupwidget.cpp b/src/plugins/projectexplorer/targetsetupwidget.cpp index 281f2809cc..a4dca88cd7 100644 --- a/src/plugins/projectexplorer/targetsetupwidget.cpp +++ b/src/plugins/projectexplorer/targetsetupwidget.cpp @@ -231,7 +231,8 @@ void TargetSetupWidget::manageKit() page->showKit(m_kit); Core::ICore::showOptionsDialog(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, - Constants::KITS_SETTINGS_PAGE_ID); + Constants::KITS_SETTINGS_PAGE_ID, + this); } void TargetSetupWidget::setProjectPath(const QString &projectPath) diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 24c03a94ec..9ee071ace6 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -67,7 +67,7 @@ namespace Internal { QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl) : ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_BUILDSTEP_ID)), - m_job(0), m_parser(0) + m_job(0), m_parser(0), m_parsingProject(false) { setDisplayName(tr("Qbs Build")); setQbsConfiguration(QVariantMap()); @@ -76,7 +76,7 @@ QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl) : QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl, const QbsBuildStep *other) : ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_BUILDSTEP_ID)), - m_qbsBuildOptions(other->m_qbsBuildOptions), m_job(0), m_parser(0) + m_qbsBuildOptions(other->m_qbsBuildOptions), m_job(0), m_parser(0), m_parsingProject(false) { setQbsConfiguration(other->qbsConfiguration()); } @@ -125,30 +125,9 @@ void QbsBuildStep::run(QFutureInterface<bool> &fi) { m_fi = &fi; - QbsProject *pro = static_cast<QbsProject *>(project()); - qbs::BuildOptions options(m_qbsBuildOptions); - options.setChangedFiles(m_changedFiles); - options.setFilesToConsider(m_changedFiles); - options.setActiveFileTags(m_activeFileTags); - - m_job = pro->build(options, m_products); - - if (!m_job) { - m_fi->reportResult(false); - return; - } - - m_progressBase = 0; - - connect(m_job, SIGNAL(finished(bool,qbs::AbstractJob*)), this, SLOT(buildingDone(bool))); - connect(m_job, SIGNAL(taskStarted(QString,int,qbs::AbstractJob*)), - this, SLOT(handleTaskStarted(QString,int))); - connect(m_job, SIGNAL(taskProgress(int,qbs::AbstractJob*)), - this, SLOT(handleProgress(int))); - connect(m_job, SIGNAL(reportCommandDescription(QString,QString)), - this, SLOT(handleCommandDescriptionReport(QString,QString))); - connect(m_job, SIGNAL(reportProcessResult(qbs::ProcessResult)), - this, SLOT(handleProcessResultReport(qbs::ProcessResult))); + // We need a pre-build parsing step in order not to lose project file changes done + // right before building (but before the delay has elapsed). + parseProject(); } ProjectExplorer::BuildStepConfigWidget *QbsBuildStep::createConfigWidget() @@ -163,7 +142,9 @@ bool QbsBuildStep::runInGuiThread() const void QbsBuildStep::cancel() { - if (m_job) + if (m_parsingProject) + qbsProject()->cancelParsing(); + else if (m_job) m_job->cancel(); } @@ -249,19 +230,24 @@ void QbsBuildStep::buildingDone(bool success) // The reparsing, if it is necessary, has to be done before finished() is emitted, as // otherwise a potential additional build step could conflict with the parsing step. - if (pro->parsingScheduled()) { - connect(pro, SIGNAL(projectParsingDone(bool)), this, SLOT(reparsingDone())); - pro->parseCurrentBuildConfiguration(true); - } else { + if (pro->parsingScheduled()) + parseProject(); + else finish(); - } } -void QbsBuildStep::reparsingDone() +void QbsBuildStep::reparsingDone(bool success) { - disconnect(static_cast<QbsProject *>(project()), SIGNAL(projectParsingDone(bool)), - this, SLOT(reparsingDone())); - finish(); + disconnect(qbsProject(), SIGNAL(projectParsingDone(bool)), this, SLOT(reparsingDone(bool))); + m_parsingProject = false; + if (m_job) { // This was a scheduled reparsing after building. + finish(); + } else if (!success) { + m_lastWasSuccess = false; + finish(); + } else { + build(); + } } void QbsBuildStep::handleTaskStarted(const QString &desciption, int max) @@ -375,17 +361,59 @@ void QbsBuildStep::setMaxJobs(int jobcount) emit qbsBuildOptionsChanged(); } +void QbsBuildStep::parseProject() +{ + m_parsingProject = true; + connect(qbsProject(), SIGNAL(projectParsingDone(bool)), SLOT(reparsingDone(bool))); + qbsProject()->parseCurrentBuildConfiguration(true); +} + +void QbsBuildStep::build() +{ + qbs::BuildOptions options(m_qbsBuildOptions); + options.setChangedFiles(m_changedFiles); + options.setFilesToConsider(m_changedFiles); + options.setActiveFileTags(m_activeFileTags); + + m_job = qbsProject()->build(options, m_products); + + if (!m_job) { + m_fi->reportResult(false); + return; + } + + m_progressBase = 0; + + connect(m_job, SIGNAL(finished(bool,qbs::AbstractJob*)), this, SLOT(buildingDone(bool))); + connect(m_job, SIGNAL(taskStarted(QString,int,qbs::AbstractJob*)), + this, SLOT(handleTaskStarted(QString,int))); + connect(m_job, SIGNAL(taskProgress(int,qbs::AbstractJob*)), + this, SLOT(handleProgress(int))); + connect(m_job, SIGNAL(reportCommandDescription(QString,QString)), + this, SLOT(handleCommandDescriptionReport(QString,QString))); + connect(m_job, SIGNAL(reportProcessResult(qbs::ProcessResult)), + this, SLOT(handleProcessResultReport(qbs::ProcessResult))); + +} + void QbsBuildStep::finish() { QTC_ASSERT(m_fi, return); m_fi->reportResult(m_lastWasSuccess); m_fi = 0; // do not delete, it is not ours - m_job->deleteLater(); - m_job = 0; + if (m_job) { + m_job->deleteLater(); + m_job = 0; + } emit finished(); } +QbsProject *QbsBuildStep::qbsProject() const +{ + return static_cast<QbsProject *>(project()); +} + // -------------------------------------------------------------------- // QbsBuildStepConfigWidget: // -------------------------------------------------------------------- diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.h b/src/plugins/qbsprojectmanager/qbsbuildstep.h index dded12290a..6951143701 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.h +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.h @@ -39,6 +39,7 @@ namespace QbsProjectManager { namespace Internal { +class QbsProject; class QbsBuildStepConfigWidget; @@ -80,7 +81,7 @@ signals: private slots: void buildingDone(bool success); - void reparsingDone(); + void reparsingDone(bool success); void handleTaskStarted(const QString &desciption, int max); void handleProgress(int value); void handleCommandDescriptionReport(const QString &highlight, const QString &message); @@ -98,8 +99,12 @@ private: void setCheckTimestamps(bool ts); void setMaxJobs(int jobcount); + void parseProject(); + void build(); void finish(); + QbsProject *qbsProject() const; + QVariantMap m_qbsConfiguration; qbs::BuildOptions m_qbsBuildOptions; @@ -113,6 +118,7 @@ private: int m_progressBase; bool m_lastWasSuccess; ProjectExplorer::IOutputParser *m_parser; + bool m_parsingProject; friend class QbsBuildStepConfigWidget; }; diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index eaafb89c81..682c65395b 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -102,6 +102,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) : m_qbsUpdateFutureInterface(0), m_forceParsing(false), m_parsingScheduled(false), + m_cancelStatus(CancelStatusNone), m_currentBc(0) { m_parsingDelay.setInterval(1000); // delay parsing by 1s. @@ -275,12 +276,25 @@ void QbsProject::handleQbsParsingDone(bool success) { QTC_ASSERT(m_qbsProjectParser, return); + const CancelStatus cancelStatus = m_cancelStatus; + m_cancelStatus = CancelStatusNone; + + // Start a new one parse operation right away, ignoring the old result. + if (cancelStatus == CancelStatusCancelingForReparse) { + m_qbsProjectParser->deleteLater(); + m_qbsProjectParser = 0; + parseCurrentBuildConfiguration(m_forceParsing); + return; + } + generateErrors(m_qbsProjectParser->error()); if (success) { m_qbsProject = m_qbsProjectParser->qbsProject(); QTC_CHECK(m_qbsProject.isValid()); readQbsData(); + } else { + m_qbsUpdateFutureInterface->reportCanceled(); } m_qbsProjectParser->deleteLater(); @@ -328,9 +342,10 @@ void QbsProject::startParsing() { // Qbs does update the build graph during the build. So we cannot // start to parse while a build is running or we will lose information. - // Just return since the qbsbuildstep will trigger a reparse after the build. - if (ProjectExplorer::BuildManager::isBuilding(this)) + if (ProjectExplorer::BuildManager::isBuilding(this)) { + scheduleParsing(); return; + } parseCurrentBuildConfiguration(false); } @@ -369,15 +384,42 @@ void QbsProject::parseCurrentBuildConfiguration(bool force) m_parsingScheduled = false; if (!m_forceParsing) m_forceParsing = force; + if (m_cancelStatus == CancelStatusCancelingForReparse) + return; + + // The CancelStatusCancelingAltoghether type can only be set by a build job, during + // which no other parse requests come through to this point (except by the build job itself, + // but of course not while canceling is in progress). + QTC_ASSERT(m_cancelStatus == CancelStatusNone, return); if (!activeTarget()) return; QbsBuildConfiguration *bc = qobject_cast<QbsBuildConfiguration *>(activeTarget()->activeBuildConfiguration()); if (!bc) return; + + // New parse requests override old ones. + // NOTE: We need to wait for the current operation to finish, since otherwise there could + // be a conflict. Consider the case where the old qbs::ProjectSetupJob is writing + // to the build graph file when the cancel request comes in. If we don't wait for + // acknowledgment, it might still be doing that when the new one already reads from the + // same file. + if (m_qbsProjectParser) { + m_cancelStatus = CancelStatusCancelingForReparse; + m_qbsProjectParser->cancel(); + return; + } + parse(bc->qbsConfiguration(), bc->environment(), bc->buildDirectory().toString()); } +void QbsProject::cancelParsing() +{ + QTC_ASSERT(m_qbsProjectParser, return); + m_cancelStatus = CancelStatusCancelingAltoghether; + m_qbsProjectParser->cancel(); +} + void QbsProject::updateAfterBuild() { updateBuildTargetData(); diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h index 97c01787bc..ab86c24074 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.h +++ b/src/plugins/qbsprojectmanager/qbsproject.h @@ -96,6 +96,7 @@ public: void parseCurrentBuildConfiguration(bool force); void scheduleParsing() { m_parsingScheduled = true; } bool parsingScheduled() const { return m_parsingScheduled; } + void cancelParsing(); void updateAfterBuild(); void registerQbsProjectParser(QbsProjectParser *p); @@ -154,6 +155,12 @@ private: bool m_forceParsing; bool m_parsingScheduled; + enum CancelStatus { + CancelStatusNone, + CancelStatusCancelingForReparse, + CancelStatusCancelingAltoghether + } m_cancelStatus; + QFuture<void> m_codeModelFuture; QbsBuildConfiguration *m_currentBc; diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp index e707dc36f8..b43d8d4dd2 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp @@ -124,7 +124,7 @@ bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env, params.setSearchPaths(prefs.searchPaths(resourcesBaseDirectory())); params.setPluginPaths(prefs.pluginPaths(pluginsBaseDirectory())); - m_qbsSetupProjectJob = qbs::Project::setupProject(params, QbsManager::logSink(), 0); + m_qbsSetupProjectJob = m_project.setupProject(params, QbsManager::logSink(), 0); connect(m_qbsSetupProjectJob, SIGNAL(finished(bool,qbs::AbstractJob*)), this, SLOT(handleQbsParsingDone(bool))); @@ -136,6 +136,12 @@ bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env, return true; } +void QbsProjectParser::cancel() +{ + QTC_ASSERT(m_qbsSetupProjectJob, return); + m_qbsSetupProjectJob->cancel(); +} + qbs::Project QbsProjectParser::qbsProject() const { return m_project; @@ -153,8 +159,8 @@ void QbsProjectParser::handleQbsParsingDone(bool success) m_project = m_qbsSetupProjectJob->project(); m_error = m_qbsSetupProjectJob->error(); - if (!success) - m_fi->reportCanceled(); + // Do not report the operation as canceled here, as we might want to make overlapping + // parses appear atomic to the user. emit done(success); } diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.h b/src/plugins/qbsprojectmanager/qbsprojectparser.h index 36ddd7ea8f..9d0d1496ae 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.h +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.h @@ -54,6 +54,7 @@ public: void setForced(bool); bool parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir); + void cancel(); qbs::Project qbsProject() const; qbs::ErrorInfo error(); diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index a96ff8999b..737cabc1fc 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -244,8 +244,6 @@ void DesignDocument::loadDocument(QPlainTextEdit *edit) updateFileName(QString(), fileName()); - m_subComponentManager->update(QUrl::fromLocalFile(fileName()), currentModel()->imports()); - m_documentLoaded = true; } diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp index 2d60729a61..e1384e6eb2 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp @@ -488,7 +488,7 @@ InformationName NodeInstance::setInformationIsInLayoutable(bool isInLayoutable) InformationName NodeInstance::setInformationSceneTransform(const QTransform &sceneTransform) { - if (!directUpdates() && d->sceneTransform != sceneTransform) { + if (d->sceneTransform != sceneTransform) { d->sceneTransform = sceneTransform; return SceneTransform; } diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index 8c265dd0e4..a45fbcd589 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -101,8 +101,8 @@ static bool hasQtQuick1(NodeInstanceView *nodeInstanceView) static void showCannotConnectToPuppetWarningAndSwitchToEditMode() { QmlDesignerWarning::show(QCoreApplication::translate("NodeInstanceServerProxy", "Cannot Connect to QML Emulation Layer (QML Puppet)"), - QCoreApplication::translate("NodeInstanceServerProxy", "The executable of the QML emulation layer (QML Puppet) process is maybe hanging. " - "Switching to an other kit maybe helps.")); + QCoreApplication::translate("NodeInstanceServerProxy", "The executable of the QML emulation layer (QML Puppet) may not be responding. " + "Switching to another kit might help.")); QmlDesignerPlugin::instance()->switchToTextModeDeferred(); @@ -201,7 +201,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV } else { QmlDesignerWarning::show(tr("Cannot Start QML Emulation Layer (QML Puppet)"), - tr("The executable of the QML emulation layer (QML Puppet) process cannot be started or is hanging.")); + tr("The executable of the QML emulation layer (QML Puppet) process cannot be started or does not respond.")); QmlDesignerPlugin::instance()->switchToTextModeDeferred(); } @@ -525,7 +525,7 @@ void NodeInstanceServerProxy::readThirdDataStream() void NodeInstanceServerProxy::printEditorProcessOutput() { - while (m_qmlPuppetEditorProcess->canReadLine()) { + while (m_qmlPuppetEditorProcess && m_qmlPuppetEditorProcess->canReadLine()) { QByteArray line = m_qmlPuppetEditorProcess->readLine(); line.chop(1); qDebug().nospace() << "Editor Puppet: " << qPrintable(line); @@ -535,7 +535,7 @@ void NodeInstanceServerProxy::printEditorProcessOutput() void NodeInstanceServerProxy::printPreviewProcessOutput() { - while (m_qmlPuppetPreviewProcess->canReadLine()) { + while (m_qmlPuppetPreviewProcess && m_qmlPuppetPreviewProcess->canReadLine()) { QByteArray line = m_qmlPuppetPreviewProcess->readLine(); line.chop(1); qDebug().nospace() << "Preview Puppet: " << qPrintable(line); @@ -545,7 +545,7 @@ void NodeInstanceServerProxy::printPreviewProcessOutput() void NodeInstanceServerProxy::printRenderProcessOutput() { - while (m_qmlPuppetRenderProcess->canReadLine()) { + while (m_qmlPuppetRenderProcess && m_qmlPuppetRenderProcess->canReadLine()) { QByteArray line = m_qmlPuppetRenderProcess->readLine(); line.chop(1); qDebug().nospace() << "Render Puppet: " << qPrintable(line); diff --git a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.cpp b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.cpp index adf6c5ec7a..4bcd929159 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.cpp @@ -41,11 +41,13 @@ namespace QmlDesigner { PuppetBuildProgressDialog::PuppetBuildProgressDialog() : QDialog(Core::ICore::dialogParent()), ui(new Ui::PuppetBuildProgressDialog), - m_lineCount(0) + m_lineCount(0), + m_useFallbackPuppet(false) { setWindowFlags(Qt::SplashScreen); ui->setupUi(this); ui->buildProgressBar->setMaximum(85); + connect(ui->useFallbackPuppetPushButton, SIGNAL(clicked()), this, SLOT(setUseFallbackPuppet())); } PuppetBuildProgressDialog::~PuppetBuildProgressDialog() @@ -56,7 +58,17 @@ PuppetBuildProgressDialog::~PuppetBuildProgressDialog() void PuppetBuildProgressDialog::setProgress(int progress) { ui->buildProgressBar->setValue(progress); - QApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); + QApplication::processEvents(QEventLoop::ExcludeSocketNotifiers); +} + +bool PuppetBuildProgressDialog::useFallbackPuppet() const +{ + return m_useFallbackPuppet; +} + +void PuppetBuildProgressDialog::setUseFallbackPuppet() +{ + m_useFallbackPuppet = true; } void PuppetBuildProgressDialog::newBuildOutput(const QByteArray &standardOutput) diff --git a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.h b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.h index 0f20985194..5437e4766e 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.h +++ b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.h @@ -49,12 +49,16 @@ public: ~PuppetBuildProgressDialog(); void setProgress(int progress); - void newBuildOutput(const QByteArray &standardOutput); + bool useFallbackPuppet() const; + +private slots: + void setUseFallbackPuppet(); private: Ui::PuppetBuildProgressDialog *ui; int m_lineCount; + bool m_useFallbackPuppet; }; } diff --git a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.ui b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.ui index 0825b53043..3ef3ba9da0 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.ui +++ b/src/plugins/qmldesigner/designercore/instances/puppetbuildprogressdialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>609</width> - <height>67</height> + <width>695</width> + <height>99</height> </rect> </property> <property name="windowTitle"> @@ -31,6 +31,33 @@ </property> </widget> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="useFallbackPuppetPushButton"> + <property name="text"> + <string>Use fallback QML emulation layer</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> <resources/> diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index f7e69c674e..48096c6d03 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -78,6 +78,31 @@ QDateTime PuppetCreator::qtLastModified() const return QDateTime(); } +QDateTime PuppetCreator::puppetSourceLastModified() const +{ + QString basePuppetSourcePath = puppetSourceDirectoryPath(); + QStringList sourceDirectoryPathes; + QDateTime lastModified; + + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/commands")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/container")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/instances")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/interfaces")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/types")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qmlpuppet")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qmlpuppet/instances")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qml2puppet")); + sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qml2puppet/instances")); + + foreach (const QString directoryPath, sourceDirectoryPathes) { + QDateTime directoryPathLastModified = QFileInfo(directoryPath).lastModified(); + if (lastModified < directoryPathLastModified) + lastModified = directoryPathLastModified; + } + + return lastModified; +} + PuppetCreator::PuppetCreator(ProjectExplorer::Kit *kit, const QString &qtCreatorVersion) : m_qtCreatorVersion(qtCreatorVersion), m_kit(kit), @@ -101,9 +126,9 @@ QProcess *PuppetCreator::createPuppetProcess(PuppetCreator::QmlPuppetVersion pup { QString puppetPath; if (puppetVersion == Qml1Puppet) - puppetPath = qmlpuppetPath(m_availablePuppetType); + puppetPath = qmlPuppetPath(m_availablePuppetType); else - puppetPath = qml2puppetPath(m_availablePuppetType); + puppetPath = qml2PuppetPath(m_availablePuppetType); return puppetProcess(puppetPath, puppetMode, @@ -165,12 +190,12 @@ bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const QStringList qmakeArguments; qmakeArguments.append(QStringLiteral("-r")); qmakeArguments.append(QStringLiteral("-after")); - qmakeArguments.append(QStringLiteral("DESTDIR=") + qmlpuppetDirectory(UserSpacePuppet)); + qmakeArguments.append(QStringLiteral("DESTDIR=") + qmlPuppetDirectory(UserSpacePuppet)); #ifndef QT_DEBUG qmakeArguments.append(QStringLiteral("CONFIG+=release")); #endif qmakeArguments.append(qmlPuppetProjectFilePath); - buildSucceeded = startBuildProcess(buildDirectory.path(), qmakeCommand(), qmakeArguments); + buildSucceeded = startBuildProcess(buildDirectory.path(), qmakeCommand(), qmakeArguments, &progressDialog); if (buildSucceeded) { progressDialog.show(); QString buildingCommand = buildCommand(); @@ -223,7 +248,7 @@ void PuppetCreator::createQml1PuppetExecutableIfMissing() } else { if (m_kit->isValid()) { - bool buildSucceeded = build(qmlpuppetProjectFile()); + bool buildSucceeded = build(qmlPuppetProjectFile()); if (buildSucceeded) m_availablePuppetType = UserSpacePuppet; else @@ -245,11 +270,11 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing() if (m_qml2PuppetForKitPuppetHash.contains(m_kit->id())) { m_availablePuppetType = m_qml2PuppetForKitPuppetHash.value(m_kit->id()); - } else if (checkQml2puppetIsReady()) { + } else if (checkQml2PuppetIsReady()) { m_availablePuppetType = UserSpacePuppet; } else { if (m_kit->isValid()) { - bool buildSucceeded = build(qml2puppetProjectFile()); + bool buildSucceeded = build(qml2PuppetProjectFile()); if (buildSucceeded) m_availablePuppetType = UserSpacePuppet; else @@ -265,7 +290,7 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing() } } -QString PuppetCreator::qmlpuppetDirectory(PuppetType puppetType) const +QString PuppetCreator::qmlPuppetDirectory(PuppetType puppetType) const { if (puppetType == UserSpacePuppet) @@ -275,22 +300,22 @@ QString PuppetCreator::qmlpuppetDirectory(PuppetType puppetType) const + qtHash(); - return qmlpuppetFallbackDirectory(); + return qmlPuppetFallbackDirectory(); } -QString PuppetCreator::qmlpuppetFallbackDirectory() const +QString PuppetCreator::qmlPuppetFallbackDirectory() const { return QCoreApplication::applicationDirPath(); } -QString PuppetCreator::qml2puppetPath(PuppetType puppetType) const +QString PuppetCreator::qml2PuppetPath(PuppetType puppetType) const { - return qmlpuppetDirectory(puppetType) + QStringLiteral("/qml2puppet") + QStringLiteral(QTC_HOST_EXE_SUFFIX); + return qmlPuppetDirectory(puppetType) + QStringLiteral("/qml2puppet") + QStringLiteral(QTC_HOST_EXE_SUFFIX); } -QString PuppetCreator::qmlpuppetPath(PuppetType puppetType) const +QString PuppetCreator::qmlPuppetPath(PuppetType puppetType) const { - return qmlpuppetDirectory(puppetType) + QStringLiteral("/qmlpuppet") + QStringLiteral(QTC_HOST_EXE_SUFFIX); + return qmlPuppetDirectory(puppetType) + QStringLiteral("/qmlpuppet") + QStringLiteral(QTC_HOST_EXE_SUFFIX); } QProcessEnvironment PuppetCreator::processEnvironment() const @@ -346,6 +371,9 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath, process.start(command, processArguments); process.waitForStarted(); while (process.waitForReadyRead(-1)) { + if (progressDialog->useFallbackPuppet()) + return false; + QByteArray newOutput = process.readAllStandardOutput(); if (progressDialog) progressDialog->newBuildOutput(newOutput); @@ -357,8 +385,8 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath, if (process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0) return true; - else - return false; + + return false; } QString PuppetCreator::puppetSourceDirectoryPath() @@ -366,12 +394,12 @@ QString PuppetCreator::puppetSourceDirectoryPath() return Core::ICore::resourcePath() + QStringLiteral("/qml/qmlpuppet"); } -QString PuppetCreator::qml2puppetProjectFile() +QString PuppetCreator::qml2PuppetProjectFile() { return puppetSourceDirectoryPath() + QStringLiteral("/qml2puppet/qml2puppet.pro"); } -QString PuppetCreator::qmlpuppetProjectFile() +QString PuppetCreator::qmlPuppetProjectFile() { return puppetSourceDirectoryPath() + QStringLiteral("/qmlpuppet/qmlpuppet.pro"); } @@ -379,18 +407,28 @@ QString PuppetCreator::qmlpuppetProjectFile() bool PuppetCreator::checkPuppetIsReady(const QString &puppetPath) const { QFileInfo puppetFileInfo(puppetPath); + if (puppetFileInfo.exists()) { + QDateTime puppetExecutableLastModified = puppetFileInfo.lastModified(); + + return puppetExecutableLastModified > qtLastModified() && puppetExecutableLastModified > puppetSourceLastModified(); + } - return puppetFileInfo.exists() && puppetFileInfo.lastModified() > qtLastModified(); + return false; } -bool PuppetCreator::checkQml2puppetIsReady() const +bool PuppetCreator::checkQml2PuppetIsReady() const { - return checkPuppetIsReady(qml2puppetPath(UserSpacePuppet)); + return checkPuppetIsReady(qml2PuppetPath(UserSpacePuppet)); } bool PuppetCreator::checkQmlpuppetIsReady() const { - return checkPuppetIsReady(qmlpuppetPath(UserSpacePuppet)); + return checkPuppetIsReady(qmlPuppetPath(UserSpacePuppet)); +} + +static bool nonEarlyQt5Version(const QtSupport::QtVersionNumber ¤tQtVersionNumber) +{ + return currentQtVersionNumber >= QtSupport::QtVersionNumber(5, 2, 0) || currentQtVersionNumber < QtSupport::QtVersionNumber(5, 0, 0); } bool PuppetCreator::qtIsSupported() const @@ -399,7 +437,7 @@ bool PuppetCreator::qtIsSupported() const if (currentQtVersion && currentQtVersion->isValid() - && currentQtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0) + && nonEarlyQt5Version(currentQtVersion->qtVersion()) && (currentQtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT) || currentQtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT))) return true; diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.h b/src/plugins/qmldesigner/designercore/instances/puppetcreator.h index 63edbdd53a..31bc499c43 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.h +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.h @@ -75,21 +75,21 @@ protected: void createQml1PuppetExecutableIfMissing(); void createQml2PuppetExecutableIfMissing(); - QString qmlpuppetDirectory(PuppetType puppetPathType) const; - QString qmlpuppetFallbackDirectory() const; - QString qml2puppetPath(PuppetType puppetType) const; - QString qmlpuppetPath(PuppetType puppetPathType) const; + QString qmlPuppetDirectory(PuppetType puppetPathType) const; + QString qmlPuppetFallbackDirectory() const; + QString qml2PuppetPath(PuppetType puppetType) const; + QString qmlPuppetPath(PuppetType puppetPathType) const; bool startBuildProcess(const QString &buildDirectoryPath, const QString &command, const QStringList &processArguments = QStringList(), PuppetBuildProgressDialog *progressDialog = 0) const; static QString puppetSourceDirectoryPath(); - static QString qml2puppetProjectFile(); - static QString qmlpuppetProjectFile(); + static QString qml2PuppetProjectFile(); + static QString qmlPuppetProjectFile(); bool checkPuppetIsReady(const QString &puppetPath) const; - bool checkQml2puppetIsReady() const; + bool checkQml2PuppetIsReady() const; bool checkQmlpuppetIsReady() const; bool qtIsSupported() const; static bool checkPuppetVersion(const QString &qmlPuppetPath); @@ -107,6 +107,7 @@ protected: QByteArray qtHash() const; QDateTime qtLastModified() const; + QDateTime puppetSourceLastModified() const; private: QString m_qtCreatorVersion; diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index e50d18383d..0f48b1a2c2 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -122,6 +122,157 @@ static TypeName resolveTypeName(const ASTPropertyReference *ref, const ContextPt return type; } +static QString qualifiedTypeNameForContext(const ObjectValue *objectValue, + const ViewerContext &vContext, + const ImportDependencies &dep) +{ + QString cppName; + QStringList packages; + if (const CppComponentValue *cppComponent = value_cast<CppComponentValue>(objectValue)) { + QString className = cppComponent->className(); + foreach (const LanguageUtils::FakeMetaObject::Export &e, cppComponent->metaObject()->exports()) { + if (e.type == className) + packages << e.package; + if (e.package == QmlJS::CppQmlTypes::cppPackage) + cppName = e.type; + } + if (packages.size() == 1 && packages.at(0) == QmlJS::CppQmlTypes::cppPackage) + return packages.at(0) + QLatin1Char('.') + className; + } + // try to recover a "global context name" + QStringList possibleLibraries; + QStringList possibleQrcFiles; + QStringList possibleFiles; + bool hasQtQuick = false; + do { + if (objectValue->originId().isEmpty()) + break; + CoreImport cImport = dep.coreImport(objectValue->originId()); + if (!cImport.valid()) + break; + foreach (const Export &e, cImport.possibleExports) { + if (e.pathRequired.isEmpty() || vContext.paths.contains(e.pathRequired)) { + switch (e.exportName.type) { + case ImportType::Library: + { + QString typeName = objectValue->className(); + if (!e.typeName.isEmpty() && e.typeName != Export::LibraryTypeName) { + typeName = e.typeName; + if (typeName != objectValue->className()) + qCWarning(qmljsLog) << "Outdated classname " << objectValue->className() + << " vs " << typeName + << " for " << e.exportName.toString(); + } + if (packages.isEmpty() || packages.contains(e.exportName.libPath())) { + if (e.exportName.splitPath.value(0) == QLatin1String("QtQuick")) + hasQtQuick = true; + possibleLibraries.append(e.exportName.libPath() + '.' + typeName); + } + break; + } + case ImportType::File: + { + // remove the search path prefix. + // this means that the same relative path wrt. different import paths will clash + QString filePath = e.exportName.path(); + foreach (const QString &path, vContext.paths) { + if (filePath.startsWith(path) && filePath.size() > path.size() + && filePath.at(path.size()) == QLatin1Char('/')) + { + filePath = filePath.mid(path.size() + 1); + break; + } + } + + if (filePath.startsWith(QLatin1Char('/'))) + filePath = filePath.mid(1); + QFileInfo fileInfo(filePath); + QStringList splitName = fileInfo.path().split(QLatin1Char('/')); + QString typeName = fileInfo.baseName(); + if (!e.typeName.isEmpty()) { + if (e.typeName != fileInfo.baseName()) + qCWarning(qmljsLog) << "type renaming in file import " << e.typeName + << " for " << e.exportName.path(); + typeName = e.typeName; + } + if (typeName != objectValue->className()) + qCWarning(qmljsLog) << "Outdated classname " << objectValue->className() + << " vs " << typeName + << " for " << e.exportName.toString(); + splitName.append(typeName); + possibleFiles.append(splitName.join(QLatin1Char('.'))); + break; + } + case ImportType::QrcFile: + { + QString filePath = e.exportName.path(); + if (filePath.startsWith(QLatin1Char('/'))) + filePath = filePath.mid(1); + QFileInfo fileInfo(filePath); + QStringList splitName = fileInfo.path().split(QLatin1Char('/')); + QString typeName = fileInfo.baseName(); + if (!e.typeName.isEmpty()) { + if (e.typeName != fileInfo.baseName()) + qCWarning(qmljsLog) << "type renaming in file import " << e.typeName + << " for " << e.exportName.path(); + typeName = e.typeName; + } + if (typeName != objectValue->className()) + qCWarning(qmljsLog) << "Outdated classname " << objectValue->className() + << " vs " << typeName + << " for " << e.exportName.toString(); + splitName.append(typeName); + possibleQrcFiles.append(splitName.join(QLatin1Char('.'))); + break; + } + case ImportType::Invalid: + case ImportType::UnknownFile: + break; + case ImportType::Directory: + case ImportType::ImplicitDirectory: + case ImportType::QrcDirectory: + qCWarning(qmljsLog) << "unexpected import type in export " + << e.exportName.toString() << " of coreExport " + << objectValue->originId(); + break; + } + } + } + auto optimalName = [] (const QStringList &list) -> QString { + QString res = list.at(0); + for (int i = 1; i < list.size(); ++i) { + const QString &nameNow = list.at(i); + if (nameNow.size() < res.size() + || (nameNow.size() == res.size() && nameNow < res)) + res = nameNow; + } + return res; + }; + if (!possibleLibraries.isEmpty()) { + if (hasQtQuick) { + foreach (const QString &libImport, possibleLibraries) + if (!libImport.startsWith(QLatin1String("QtQuick"))) + possibleLibraries.removeAll(libImport); + } + return optimalName(possibleLibraries); + } + if (!possibleQrcFiles.isEmpty()) + return optimalName(possibleQrcFiles); + if (!possibleFiles.isEmpty()) + return optimalName(possibleFiles); + } while (false); + if (!cppName.isEmpty()) + return QmlJS::CppQmlTypes::cppPackage + QLatin1Char('.') + cppName; + if (const CppComponentValue *cppComponent = value_cast<CppComponentValue>(objectValue)) { + if (cppComponent->moduleName().isEmpty()) + return cppComponent->className(); + else + return cppComponent->moduleName() + QLatin1Char('.') + cppComponent->className(); + } else { + return objectValue->className(); + } +} + class PropertyMemberProcessor : public MemberProcessor { public: @@ -144,8 +295,10 @@ public: } } } else { + if (const CppComponentValue * cppComponentValue = value_cast<CppComponentValue>(value)) { - TypeName qualifiedTypeName = cppComponentValue->moduleName().isEmpty() ? cppComponentValue->className().toUtf8() : cppComponentValue->moduleName().toUtf8() + '.' + cppComponentValue->className().toUtf8(); + TypeName qualifiedTypeName = qualifiedTypeNameForContext(cppComponentValue, + m_context->vContext(), *m_context->snapshot().importDependencies()).toUtf8(); m_properties.append(qMakePair(propertyName, qualifiedTypeName)); } else { TypeId typeId; @@ -519,19 +672,19 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i m_model(model) { if (context()) { - const CppComponentValue *objectValue = getCppComponentValue(); + const CppComponentValue *cppObjectValue = getCppComponentValue(); - if (objectValue) { + if (cppObjectValue) { if (m_majorVersion == -1 && m_minorVersion == -1) { - m_majorVersion = objectValue->componentVersion().majorVersion(); - m_minorVersion = objectValue->componentVersion().minorVersion(); + m_majorVersion = cppObjectValue->componentVersion().majorVersion(); + m_minorVersion = cppObjectValue->componentVersion().minorVersion(); } - setupPropertyInfo(getTypes(objectValue, context())); - setupLocalPropertyInfo(getTypes(objectValue, context(), true)); - m_defaultPropertyName = objectValue->defaultPropertyName().toUtf8(); + setupPropertyInfo(getTypes(cppObjectValue, context())); + setupLocalPropertyInfo(getTypes(cppObjectValue, context(), true)); + m_defaultPropertyName = cppObjectValue->defaultPropertyName().toUtf8(); m_isValid = true; setupPrototypes(); - m_signals = getSignals(objectValue, context()); + m_signals = getSignals(cppObjectValue, context()); } else { const ObjectValue *objectValue = getObjectValue(); if (objectValue) { diff --git a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp index 8dda0a418f..9f1aee3769 100644 --- a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp +++ b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp @@ -193,9 +193,11 @@ QVariant read(const QString &typeStr, const QString &str) { int type = QMetaType::type(typeStr.toUtf8().constData()); if (type == 0) { - qWarning() << "Type " << typeStr - << " is unknown to QMetaType system. Cannot create properly typed QVariant for value " - << str; + if (typeStr != QStringLiteral("binding")) { + qWarning() << "Type " << typeStr + << " is unknown to QMetaType system. Cannot create properly typed QVariant for value " + << str; + } // Fall back to a QVariant of type String return QVariant(str); } diff --git a/src/plugins/qnx/blackberrypotentialkit.cpp b/src/plugins/qnx/blackberrypotentialkit.cpp index dc1a91e647..9eed5968ae 100644 --- a/src/plugins/qnx/blackberrypotentialkit.cpp +++ b/src/plugins/qnx/blackberrypotentialkit.cpp @@ -77,10 +77,11 @@ bool BlackBerryPotentialKit::shouldShow() return true; } -void BlackBerryPotentialKit::openSettings() +void BlackBerryPotentialKit::openSettings(QWidget *parent) { Core::ICore::showOptionsDialog(Qnx::Constants::QNX_BB_CATEGORY, - Qnx::Constants::QNX_BB_SETUP_ID); + Qnx::Constants::QNX_BB_SETUP_ID, + parent); } BlackBerryPotentialKitWidget::BlackBerryPotentialKitWidget(QWidget *parent) @@ -111,7 +112,7 @@ BlackBerryPotentialKitWidget::BlackBerryPotentialKitWidget(QWidget *parent) void BlackBerryPotentialKitWidget::openOptions() { - BlackBerryPotentialKit::openSettings(); + BlackBerryPotentialKit::openSettings(this); } void BlackBerryPotentialKitWidget::recheck() diff --git a/src/plugins/qnx/blackberrypotentialkit.h b/src/plugins/qnx/blackberrypotentialkit.h index 7722f98b7f..d918ac01ef 100644 --- a/src/plugins/qnx/blackberrypotentialkit.h +++ b/src/plugins/qnx/blackberrypotentialkit.h @@ -44,7 +44,7 @@ public: bool isEnabled() const; static bool shouldShow(); - static void openSettings(); + static void openSettings(QWidget *parent = 0); }; class BlackBerryPotentialKitWidget : public Utils::DetailsWidget diff --git a/src/plugins/qtsupport/qtkitconfigwidget.cpp b/src/plugins/qtsupport/qtkitconfigwidget.cpp index 129ab7f953..1c4d9d2238 100644 --- a/src/plugins/qtsupport/qtkitconfigwidget.cpp +++ b/src/plugins/qtsupport/qtkitconfigwidget.cpp @@ -139,7 +139,8 @@ void QtKitConfigWidget::versionsChanged(const QList<int> &added, const QList<int void QtKitConfigWidget::manageQtVersions() { Core::ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, - Constants::QTVERSION_SETTINGS_PAGE_ID); + Constants::QTVERSION_SETTINGS_PAGE_ID, + buttonWidget()); } void QtKitConfigWidget::currentWasChanged(int idx) diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp index 33adbd382c..84a600d097 100644 --- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp +++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp @@ -41,6 +41,7 @@ #include <QFile> #include <QMimeData> #include <QtAlgorithms> +#include <QTextCodec> #include <QTextStream> #include <QIcon> @@ -124,6 +125,12 @@ bool ResourceFile::load() m_error_message = file.errorString(); return false; } + QByteArray data = file.readAll(); + // Detect line ending style + m_textFileFormat = Utils::TextFileFormat::detect(data); + // we always write UTF-8 when saving + m_textFileFormat.codec = QTextCodec::codecForName("UTF-8"); + file.close(); clearPrefixList(); @@ -131,7 +138,7 @@ bool ResourceFile::load() QString error_msg; int error_line, error_col; - if (!doc.setContent(&file, &error_msg, &error_line, &error_col)) { + if (!doc.setContent(data, &error_msg, &error_line, &error_col)) { m_error_message = tr("XML error on line %1, col %2: %3") .arg(error_line).arg(error_col).arg(error_msg); return false; @@ -184,12 +191,6 @@ bool ResourceFile::save() return false; } - QFile file(m_file_name); - if (!file.open(QIODevice::WriteOnly)) { - m_error_message = file.errorString(); - return false; - } - QDomDocument doc; QDomElement root = doc.createElement(QLatin1String("RCC")); doc.appendChild(root); @@ -221,13 +222,9 @@ bool ResourceFile::save() } } - QTextStream stream(&file); - doc.save(stream, 4); - stream.flush(); - if (stream.status() != QTextStream::Ok) { - m_error_message = tr("Cannot write file. Disk full?"); + QString data = doc.toString(4); + if (!m_textFileFormat.writeFile(m_file_name, data, &m_error_message)) return false; - } return true; } diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile_p.h b/src/plugins/resourceeditor/qrceditor/resourcefile_p.h index 5ee82563df..78d681339a 100644 --- a/src/plugins/resourceeditor/qrceditor/resourcefile_p.h +++ b/src/plugins/resourceeditor/qrceditor/resourcefile_p.h @@ -37,6 +37,8 @@ #include <QStringList> #include <QIcon> +#include <utils/textfileformat.h> + namespace ResourceEditor { namespace Internal { @@ -177,6 +179,7 @@ private: PrefixList m_prefix_list; QString m_file_name; QString m_error_message; + Utils::TextFileFormat m_textFileFormat; public: void * prefixPointer(int prefixIndex) const; diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp index 4fb935ea67..16a3e45abd 100644 --- a/src/plugins/texteditor/plaintexteditor.cpp +++ b/src/plugins/texteditor/plaintexteditor.cpp @@ -181,7 +181,8 @@ bool PlainTextEditorWidget::isMissingSyntaxDefinition() const void PlainTextEditorWidget::acceptMissingSyntaxDefinitionInfo() { ICore::showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY, - Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS); + Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS, + this); } PlainTextDocument::PlainTextDocument() diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 4436499e6a..ab4fb99389 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -170,7 +170,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe connect(completionAction, SIGNAL(triggered()), this, SLOT(invokeCompletion())); // Add shortcut for invoking quick fix options - QAction *quickFixAction = new QAction(tr("Trigger Quick Fix"), this); + QAction *quickFixAction = new QAction(tr("Trigger Refactoring Action"), this); Core::Command *quickFixCommand = Core::ActionManager::registerAction(quickFixAction, Constants::QUICKFIX_THIS, context); quickFixCommand->setDefaultKeySequence(QKeySequence(tr("Alt+Return"))); connect(quickFixAction, SIGNAL(triggered()), this, SLOT(invokeQuickFix())); diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index b499ff242e..37b9aad28e 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -140,7 +140,7 @@ TextEditorSettings::TextEditorSettings(QObject *parent) formatDescr.append(FormatDescription(C_STRING, tr("String"), tr("Character and string literals."), Qt::darkGreen)); formatDescr.append(FormatDescription(C_PRIMITIVE_TYPE, tr("Primitive Type"), - tr("Primitive data types"), Qt::darkYellow)); + tr("Name of a primitive data type."), Qt::darkYellow)); formatDescr.append(FormatDescription(C_TYPE, tr("Type"), tr("Name of a type."), Qt::darkMagenta)); formatDescr.append(FormatDescription(C_LOCAL, tr("Local"), tr("Local variables."))); diff --git a/src/plugins/todo/constants.h b/src/plugins/todo/constants.h index c3c488f0e8..c25f4b877c 100644 --- a/src/plugins/todo/constants.h +++ b/src/plugins/todo/constants.h @@ -59,7 +59,7 @@ enum OutputColumnIndex { OUTPUT_COLUMN_TEXT, OUTPUT_COLUMN_FILE, OUTPUT_COLUMN_LINE, - OUTPUT_COLUMN_LAST + OUTPUT_COLUMN_COUNT }; const char OUTPUT_COLUMN_TEXT_TITLE[] = QT_TRANSLATE_NOOP("Todo::Internal::TodoItemsModel", "Description"); diff --git a/src/plugins/todo/todoitemsmodel.cpp b/src/plugins/todo/todoitemsmodel.cpp index 6fdca97d5d..4128fadfd8 100644 --- a/src/plugins/todo/todoitemsmodel.cpp +++ b/src/plugins/todo/todoitemsmodel.cpp @@ -70,7 +70,7 @@ int TodoItemsModel::columnCount(const QModelIndex &parent) const { Q_UNUSED(parent) - return Constants::OUTPUT_COLUMN_LAST; + return Constants::OUTPUT_COLUMN_COUNT; } QVariant TodoItemsModel::data(const QModelIndex &index, int role) const diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 17227ceff0..41741a2235 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -163,7 +163,7 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel for (int i = 0; i < framesToLookAt; ++i) { const Frame &frame = frames.at(i); foreach (const QString &folder, validFolders) { - if (frame.object().startsWith(folder)) { + if (frame.directory().startsWith(folder)) { inProject = true; break; } diff --git a/src/plugins/vcsbase/nicknamedialog.cpp b/src/plugins/vcsbase/nicknamedialog.cpp index e04bdf6b06..1aba9261a1 100644 --- a/src/plugins/vcsbase/nicknamedialog.cpp +++ b/src/plugins/vcsbase/nicknamedialog.cpp @@ -231,8 +231,8 @@ QStandardItemModel *NickNameDialog::createModel(QObject *parent) { QStandardItemModel *model = new QStandardItemModel(parent); QStringList headers; - headers << tr("Name") << tr("E-mail") - << tr("Alias") << tr("Alias e-mail"); + headers << tr("Name") << tr("Email") + << tr("Alias") << tr("Alias email"); model->setHorizontalHeaderLabels(headers); return model; } diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 21fbe06a4f..5db0cf47a8 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -237,9 +237,8 @@ void StateListener::slotStateChanged() state.currentFile.clear(); } else { state.currentFile = currentDocument->filePath(); - if (state.currentFile.isEmpty()) { + if (state.currentFile.isEmpty() || currentDocument->isTemporary()) state.currentFile = VcsBasePlugin::source(currentDocument); - } } QScopedPointer<QFileInfo> currentFileInfo; // Instantiate QFileInfo only once if required. if (!state.currentFile.isEmpty()) { diff --git a/src/plugins/vcsbase/vcsconfigurationpage.cpp b/src/plugins/vcsbase/vcsconfigurationpage.cpp index 41e7d7532b..1a83241e69 100644 --- a/src/plugins/vcsbase/vcsconfigurationpage.cpp +++ b/src/plugins/vcsbase/vcsconfigurationpage.cpp @@ -83,7 +83,8 @@ bool VcsConfigurationPage::isComplete() const void VcsConfigurationPage::openConfiguration() { Core::ICore::showOptionsDialog(Constants::VCS_SETTINGS_CATEGORY, - d->m_versionControl->id()); + d->m_versionControl->id(), + this); } } // namespace VcsBase diff --git a/src/shared/qbs b/src/shared/qbs -Subproject c653f6ab0d04a39298f9b4365528372dee5b302 +Subproject 4d0a76fafebf11af4ab948e60f9f8eae7097fca diff --git a/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp b/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp index 9348350af8..7c84817c99 100644 --- a/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp +++ b/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp @@ -1122,56 +1122,59 @@ void generateAST_cpp(const Snapshot &snapshot, const QDir &cplusplusDir) TranslationUnitAST *xUnit = AST_cpp_document->translationUnit()->ast()->asTranslationUnit(); for (DeclarationListAST *iter = xUnit->declaration_list; iter; iter = iter->next) { if (FunctionDefinitionAST *funDef = iter->value->asFunctionDefinition()) { - if (const QualifiedNameId *qName = funDef->symbol->name()->asQualifiedNameId()) { - const QString className = oo(qName->base()); - const QString methodName = oo(qName->name()); - - QTextCursor cursor(&cpp_document); - - unsigned line = 0, column = 0; - AST_cpp_document->translationUnit()->getTokenStartPosition(funDef->firstToken(), &line, &column); - const int start = cpp_document.findBlockByNumber(line - 1).position() + column - 1; - cursor.setPosition(start); - int doxyStart = start; - - const bool isGenerated = checkGenerated(cursor, &doxyStart); - - AST_cpp_document->translationUnit()->getTokenEndPosition(funDef->lastToken() - 1, &line, &column); - int end = cpp_document.findBlockByNumber(line - 1).position() + column - 1; - while (cpp_document.characterAt(end).isSpace()) - ++end; - - if (methodName == QLatin1String("firstToken")) { - ClassSpecifierAST *classAST = classesNeedingFirstToken.value(className, 0); - GenInfo info; - info.end = end; - if (classAST) { - info.classAST = classAST; - info.firstToken = true; - info.start = start; - classesNeedingFirstToken.remove(className); - } else { - info.start = doxyStart; - info.remove = true; + if (const Name *name = funDef->symbol->name()) { + if (const QualifiedNameId *qName = name->asQualifiedNameId()) { + const QString className = oo(qName->base()); + const QString methodName = oo(qName->name()); + + QTextCursor cursor(&cpp_document); + + unsigned line = 0, column = 0; + AST_cpp_document->translationUnit()->getTokenStartPosition(funDef->firstToken(), &line, &column); + const int start = cpp_document.findBlockByNumber(line - 1).position() + column - 1; + cursor.setPosition(start); + int doxyStart = start; + + const bool isGenerated = checkGenerated(cursor, &doxyStart); + + AST_cpp_document->translationUnit()->getTokenEndPosition(funDef->lastToken() - 1, &line, &column); + int end = cpp_document.findBlockByNumber(line - 1).position() + column - 1; + while (cpp_document.characterAt(end).isSpace()) + ++end; + + if (methodName == QLatin1String("firstToken")) { + ClassSpecifierAST *classAST = classesNeedingFirstToken.value(className, 0); + GenInfo info; + info.end = end; + if (classAST) { + info.classAST = classAST; + info.firstToken = true; + info.start = start; + classesNeedingFirstToken.remove(className); + } else { + info.start = doxyStart; + info.remove = true; + } + if (isGenerated) + todo.append(info); + } else if (methodName == QLatin1String("lastToken")) { + ClassSpecifierAST *classAST = classesNeedingLastToken.value(className, 0); + GenInfo info; + info.end = end; + if (classAST) { + info.classAST = classAST; + info.start = start; + info.lastToken = true; + classesNeedingLastToken.remove(className); + } else { + info.start = doxyStart; + info.remove = true; + } + if (isGenerated) + todo.append(info); } - if (isGenerated) - todo.append(info); - } else if (methodName == QLatin1String("lastToken")) { - ClassSpecifierAST *classAST = classesNeedingLastToken.value(className, 0); - GenInfo info; - info.end = end; - if (classAST) { - info.classAST = classAST; - info.start = start; - info.lastToken = true; - classesNeedingLastToken.remove(className); - } else { - info.start = doxyStart; - info.remove = true; - } - if (isGenerated) - todo.append(info); } + } } } diff --git a/tests/auto/debugger/dumpers.qbs b/tests/auto/debugger/dumpers.qbs index 2ca6226fbc..e3f10b331c 100644 --- a/tests/auto/debugger/dumpers.qbs +++ b/tests/auto/debugger/dumpers.qbs @@ -26,7 +26,7 @@ QtcAutotest { } cpp.defines: base.concat([ - 'CDBEXT_PATH="' + buildDirectory + '\\\\lib"', + 'CDBEXT_PATH="' + project.buildDirectory + '\\\\lib"', 'DUMPERDIR="' + path + '/../../../share/qtcreator/debugger"', 'QT_NO_CAST_FROM_ASCII', 'QT_DISABLE_DEPRECATED_BEFORE=0x040900' diff --git a/tests/auto/extensionsystem/plugin.qbs b/tests/auto/extensionsystem/plugin.qbs index f7b99b7f7c..98c27e15c7 100644 --- a/tests/auto/extensionsystem/plugin.qbs +++ b/tests/auto/extensionsystem/plugin.qbs @@ -9,10 +9,11 @@ DynamicLibrary { Depends { name: "cpp" } Depends { name: "Qt.core" } targetName: QtcFunctions.qtLibraryName(qbs, name.split('_')[1]) - destinationDirectory: FileInfo.relativePath(project.ide_source_tree, sourceDirectory) + destinationDirectory: project.buildDirectory + '/' + + FileInfo.relativePath(project.ide_source_tree, sourceDirectory) cpp.rpaths: [ - buildDirectory + "/" + project.libDirName + "/qtcreator", - buildDirectory + "/" + project.libDirName + "/qtcreator/plugins" + project.buildDirectory + "/" + project.libDirName + "/qtcreator", + project.buildDirectory + "/" + project.libDirName + "/qtcreator/plugins" ].concat(additionalRPaths) property pathList filesToCopy property pathList additionalRPaths: [] diff --git a/tests/auto/utils/fileutils/fileutils.pro b/tests/auto/utils/fileutils/fileutils.pro index 4f17bba98b..7378524f7a 100644 --- a/tests/auto/utils/fileutils/fileutils.pro +++ b/tests/auto/utils/fileutils/fileutils.pro @@ -1,7 +1,6 @@ QTC_LIB_DEPENDS += utils include(../../qttest.pri) -DEFINES += QTCREATOR_UTILS_LIB *-g++ { CONFIG -= warn_on QMAKE_CXXFLAGS += -Wall -Wno-trigraphs diff --git a/tests/auto/valgrind/memcheck/modeldemo.qbs b/tests/auto/valgrind/memcheck/modeldemo.qbs index c6a4a4ee45..a2f9c53890 100644 --- a/tests/auto/valgrind/memcheck/modeldemo.qbs +++ b/tests/auto/valgrind/memcheck/modeldemo.qbs @@ -8,6 +8,6 @@ ValgrindAutotest { files: ["modeldemo.h", "modeldemo.cpp"] cpp.defines: base.concat([ 'PARSERTESTS_DATA_DIR="' + path + '/data"', - 'VALGRIND_FAKE_PATH="' + product.buildDirectory + '/' + project.ide_bin_path + '/valgrind-fake"' + 'VALGRIND_FAKE_PATH="' + project.buildDirectory + '/' + project.ide_bin_path + '/valgrind-fake"' ]) } diff --git a/tests/auto/valgrind/memcheck/parsertests.qbs b/tests/auto/valgrind/memcheck/parsertests.qbs index 3e0dabcdf4..60ced3f8d4 100644 --- a/tests/auto/valgrind/memcheck/parsertests.qbs +++ b/tests/auto/valgrind/memcheck/parsertests.qbs @@ -8,6 +8,6 @@ ValgrindAutotest { files: ["parsertests.h", "parsertests.cpp"] cpp.defines: base.concat([ 'PARSERTESTS_DATA_DIR="' + path + '/data"', - 'VALGRIND_FAKE_PATH="' + product.buildDirectory + '/' + project.ide_bin_path + '/valgrind-fake"' + 'VALGRIND_FAKE_PATH="' + project.buildDirectory + '/' + project.ide_bin_path + '/valgrind-fake"' ]) } diff --git a/tests/auto/valgrind/memcheck/testapps/testapp.qbs b/tests/auto/valgrind/memcheck/testapps/testapp.qbs index f4ded88748..fa88860dff 100644 --- a/tests/auto/valgrind/memcheck/testapps/testapp.qbs +++ b/tests/auto/valgrind/memcheck/testapps/testapp.qbs @@ -5,6 +5,7 @@ QtcAutotest { name: "Memcheck " + testName + " autotest" property string testName targetName: testName // Test runner hardcodes the names of the executables - destinationDirectory: buildDirectory + '/' + project.ide_bin_path + '/testapps/' + testName + destinationDirectory: project.buildDirectory + '/' + + project.ide_bin_path + '/testapps/' + testName files: "main.cpp" } diff --git a/tests/auto/valgrind/memcheck/testrunner.qbs b/tests/auto/valgrind/memcheck/testrunner.qbs index 686554b974..a274933bdf 100644 --- a/tests/auto/valgrind/memcheck/testrunner.qbs +++ b/tests/auto/valgrind/memcheck/testrunner.qbs @@ -19,6 +19,6 @@ ValgrindAutotest { destinationDirectory: project.ide_bin_path cpp.defines: base.concat([ 'TESTRUNNER_SRC_DIR="' + path + '/testapps"', - 'TESTRUNNER_APP_DIR="' + product.buildDirectory + '/' + destinationDirectory + '/testapps"' + 'TESTRUNNER_APP_DIR="' + project.buildDirectory + '/' + destinationDirectory + '/testapps"' ]) } |