diff --git a/doc/images/qtcreator-android-sdk-manager.png b/doc/images/qtcreator-android-sdk-manager.png new file mode 100644 index 00000000000..6a0090894a0 Binary files /dev/null and b/doc/images/qtcreator-android-sdk-manager.png differ diff --git a/doc/images/qtcreator-options-android1.png b/doc/images/qtcreator-options-android1.png index 9b5d3ff0394..b3806a361da 100644 Binary files a/doc/images/qtcreator-options-android1.png and b/doc/images/qtcreator-options-android1.png differ diff --git a/doc/images/qtcreator-options-android2.png b/doc/images/qtcreator-options-android2.png new file mode 100644 index 00000000000..176b2cd3a1d Binary files /dev/null and b/doc/images/qtcreator-options-android2.png differ diff --git a/doc/images/qtcreator-options-qbs.png b/doc/images/qtcreator-options-qbs.png index f46db113b08..40149a37e0e 100644 Binary files a/doc/images/qtcreator-options-qbs.png and b/doc/images/qtcreator-options-qbs.png differ diff --git a/doc/images/qtcreator-qbs-profile-settings.png b/doc/images/qtcreator-qbs-profile-settings.png new file mode 100644 index 00000000000..e100701bd06 Binary files /dev/null and b/doc/images/qtcreator-qbs-profile-settings.png differ diff --git a/doc/src/android/androiddev.qdoc b/doc/src/android/androiddev.qdoc index 90a1510854a..0b2b38aa072 100644 --- a/doc/src/android/androiddev.qdoc +++ b/doc/src/android/androiddev.qdoc @@ -133,18 +133,37 @@ For more information, see \l{Qt for Android}. + \section2 Specifying Android Device Settings + To configure connections between \QC and Android devices: \list 1 \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices > - \uicontrol Android to add paths to the Android NDK and SDK. + \uicontrol Android. + + \image qtcreator-options-android1.png "Android options" + + \li In the \uicontrol {JDK location} field, add the path to the JDK. + + You can use the \inlineimage download.png + (\uicontrol Download) button to go to the site where you can + download the JDK. \QC checks the JDK installation and reports + errors. + + \li In the \uicontrol {Android Settings} group, add paths to the Android + NDK and SDK. You can use the \inlineimage download.png (\uicontrol Download) buttons to go to the sites where you can download the Android NDK and SDK. - \image qtcreator-options-android1.png "Android options" + The SDK Manager checks the Android NDK and SDK installations, + reports errors, and offers to install the necessary packages. + + \image qtcreator-options-android2.png "Android NDK and SDK checks" + + For more information, see \l {Managing Android SDK Packages}. \li Select the \uicontrol {Automatically create kits for Android tool chains} check box to allow \QC to create the kits for you. \QC displays a @@ -174,6 +193,46 @@ \uicontrol {Select Android Devices} dialog. \endlist + \section2 Managing Android SDK Packages + + Since Android SDK Tools version 25.3.0, only a command-line tool, + \l{https://developer.android.com/studio/command-line/sdkmanager.html} + {sdkmanager}, is provided by Android for SDK package management. To make SDK + management easier, \QC provides an SDK Manager for installing, updating, and + removing SDK packages. You can still use sdkmanager for advanced SDK + management. + + When you add paths to the Anroid NDK and SDK in the device options, the + SDK Manager checks that all the necessary SDK packages have been installed. + If packages are missing or updates are needed, the SDK Manager offers to + add and remove packages, as necessary. Before taking action, it prompts you + to accept the changes it is about to make. In addition, it prompts you to + accept Google licenses, as necessary. + + To view the installed Android SDK packages, select \uicontrol Tools > + \uicontrol Options > \uicontrol Devices > \uicontrol Android > + \uicontrol {SDK Manager}. + + \image qtcreator-android-sdk-manager.png "Android SDK Manager" + + To filter the packages, select \uicontrol Available, \uicontrol Installed, + or \uicontrol All in \uicontrol {Show Packages}. + + To update the installed Android SDK packages, select + \uicontrol {Update Installed}. Select the packages to update, and then + select \uicontrol Apply. + + To specify advanced sdkmanager settings, select + \uicontrol {Advanced Options} and enter arguments in the + \uicontrol {SDK Manager arguments} field. The available arguments are listed + and described in \uicontrol {Available arguments}. + + To manage packages installed from Android SDK Tools version 25.2.5, or + earlier, you can use the native Android SDK Manager. The \QC SDK Manager and + the native SDK Manager are mutually exclusive, because they are used for + different Android SDK Tools versions. If you have the native SDK Manager + installed, you can open it by selecting \uicontrol {Native SDK Manager}. + \section1 Selecting Android Devices When you deploy an application to an Android device with Android diff --git a/doc/src/howto/creator-external-tools.qdoc b/doc/src/howto/creator-external-tools.qdoc index afb77bdf182..93833dccf15 100644 --- a/doc/src/howto/creator-external-tools.qdoc +++ b/doc/src/howto/creator-external-tools.qdoc @@ -37,9 +37,8 @@ \title Using External Tools - You can use external tools directly from \QC. Qt Linguist, - QML preview tools, the - default text editor for your system, and the \c sort tool are preconfigured + You can use external tools directly from \QC. Qt Linguist, QML preview + tools, and the default text editor for your system are preconfigured for use. You can change their default configurations and configure new tools. @@ -93,16 +92,6 @@ \QC looks for the editor path in the PATH environment variable of your operating system. - \section1 Sorting Text Alphabetically - - To sort selected text alphabetically, select \uicontrol {Tools > External > Text - > Sort Selection}. The \c sort tool takes the selected text as input and - returns it in alphabetic order. By default, the output replaces the - original selection in the code editor. - - To change the default configuration, select \uicontrol {Tools > External > - Configure}. - \section1 Configuring External Tools You can change the configuration of preconfigured tools and configure diff --git a/doc/src/howto/creator-tips.qdoc b/doc/src/howto/creator-tips.qdoc index 57e2d26c504..eea0f79c2bd 100644 --- a/doc/src/howto/creator-tips.qdoc +++ b/doc/src/howto/creator-tips.qdoc @@ -257,4 +257,10 @@ history, press \key {Ctrl+Shift+V} until the clip appears. The number of clips in the history is fixed to 10. + \section1 Sorting Lines Alphabetically + + To sort selected lines alphabetically, select \uicontrol Edit > + \uicontrol Advanced > \uicontrol {Sort Selected Lines} or press + \key {Alt+Shift+S} (or \key Ctrl+Shift+S on \macos). + */ diff --git a/doc/src/projects/creator-projects-build-systems.qdocinc b/doc/src/projects/creator-projects-build-systems.qdocinc index 72e4e109706..8771fb693fd 100644 --- a/doc/src/projects/creator-projects-build-systems.qdocinc +++ b/doc/src/projects/creator-projects-build-systems.qdocinc @@ -57,10 +57,8 @@ To change the location of the project directory, and to specify settings for building and running projects, select \uicontrol Tools > \uicontrol Options > \uicontrol {Build & Run} > \uicontrol General. The - \uicontrol CMake tab contains additional CMake settings. - - To specify build profiles for Qbs, select \uicontrol Tools > - \uicontrol Options > \uicontrol Qbs. + \uicontrol CMake and \uicontrol Qbs tabs contain additional settings for + those build systems. To specify build and run settings for different target platforms, select \uicontrol Projects. For more information on the options you have, diff --git a/doc/src/projects/creator-projects-qbs.qdoc b/doc/src/projects/creator-projects-qbs.qdoc index 9ad54a7dae0..2abe657f1fc 100644 --- a/doc/src/projects/creator-projects-qbs.qdoc +++ b/doc/src/projects/creator-projects-qbs.qdoc @@ -41,7 +41,7 @@ kit. You can edit the build profiles by adding new keys and values. To check which Qbs version is being used, select \uicontrol Tools > - \uicontrol Options > \uicontrol Qbs > \uicontrol {Version Info}. + \uicontrol Options > \uicontrol {Build & Run} > \uicontrol Qbs. \section1 Building Qbs @@ -57,46 +57,24 @@ \endlist - \section1 Editing Build Profiles + \section1 Specifying Qbs Settings + + To specify settings for Qbs, select \uicontrol Tools > \uicontrol Options > + \uicontrol {Build & Run} > \uicontrol Qbs. \image qtcreator-options-qbs.png - You can modify a build profile that is associated with a build and run kit - by editing the values of the keys generated by \QC and by adding new values: + By default, Qbs profiles are stored in the \c qbs directory in the \QC + settings directory to ensure that different \QC instances do not overwrite + each other's profiles. If you only run one \QC instance, you can store the + profiles in the Qbs settings directory instead, by deselecting the + \uicontrol {Store profiles in Qt Creator settings directory} check box. - \list 1 - - \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Qbs. - - \li By default, Qbs profiles are stored in the \c qbs directory in the - \QC settings directory to ensure that different \QC instances do not - overwrite each other's profiles. If you only run one \QC instance, - you can store the profiles in the Qbs settings directory instead, - by deselecting the \uicontrol {Store profiles in Qt Creator settings - directory} check box. - - \li In the \uicontrol Kit field, select a build and run kit. - - \li Select \uicontrol Edit to edit the profile associated with the kit. - - \li Select \uicontrol Add to add keys and values to the profile or to - modify existing values. - - \li In the \uicontrol Key column, spefify the key to add or modify as: - \c .. - - \li In the \uicontrol Value column, specify a value as a JSON literal. - - \li Click \uicontrol OK. - - \endlist - - The values that you have modified are displayed in red in the - \uicontrol {Profile properties} field. - - For a list of available keys and values, see the - \l{http://doc.qt.io/qbs/list-of-modules.html}{List of Modules} in the - Qbs Manual. + In the \uicontrol Kit field, select a build and run kit to view the + properties of the associated Qbs profile. To modify the properties of the + Qbs profile associated with a kit, select \uicontrol Tools > + \uicontrol Options > \uicontrol {Build & Run} > \uicontrol Kits. For more + information, see \l{Editing Qbs Profiles}. \section1 Related Topics diff --git a/doc/src/projects/creator-projects-targets.qdoc b/doc/src/projects/creator-projects-targets.qdoc index b327354656d..229bbc196e1 100644 --- a/doc/src/projects/creator-projects-targets.qdoc +++ b/doc/src/projects/creator-projects-targets.qdoc @@ -142,7 +142,7 @@ \li In the \uicontrol {Additional Qbs profile settings} field, select \uicontrol Change to add settings to Qbs build profiles. For more - information, see \l {Editing Build Profiles}. + information, see \l {Editing Qbs Profiles}. \endlist @@ -150,4 +150,38 @@ choose the kit to use. To set the selected kit as the default kit, select \uicontrol {Make Default}. + \section1 Editing Qbs Profiles + + To view the Qbs profile associated with the kit, select \uicontrol Tools > + \uicontrol Options > \uicontrol {Build & Run} > \uicontrol Qbs. + + You can add keys and values to the profile or remove them from it, as well + as modify existing values. For a list of available keys and values, see + \l{http://doc.qt.io/qbs/list-of-modules.html}{List of Modules} in the Qbs + Manual. + + To edit the Qbs profile associated with the kit: + + \list 1 + + \li Select \uicontrol Change next to the + \uicontrol {Additional Qbs Profile Settings} field. + + \image qtcreator-qbs-profile-settings. + + \li Select \uicontrol Add. + + \li In the \uicontrol Key column, spefify the key to add or modify as: + \c .. + + \li In the \uicontrol Value column, specify a value as a JSON literal. + + \li Click \uicontrol OK. + + \endlist + + To modify an existing value, double-click it in the \uicontrol Value field. + + To remove the selected property, select \uicontrol Remove. + */ diff --git a/share/qtcreator/debugger/creatortypes.py b/share/qtcreator/debugger/creatortypes.py index e3bbc58f265..182057e2556 100644 --- a/share/qtcreator/debugger/creatortypes.py +++ b/share/qtcreator/debugger/creatortypes.py @@ -140,8 +140,16 @@ def qdump__CPlusPlus__Symbol(d, value): def qdump__CPlusPlus__Class(d, value): qdump__CPlusPlus__Symbol(d, value) +def kindName(d, value): + e = value.integer() + if e: + kindType = d.lookupType("CPlusPlus::Kind") + return kindType.typeData().enumDisplay(e, value.address())[11:] + else: + return '' + def qdump__CPlusPlus__IntegerType(d, value): - d.putValue(value["_kind"]) + d.putValue(kindName(d, value["_kind"])) d.putPlainChildren(value) def qdump__CPlusPlus__FullySpecifiedType(d, value): @@ -202,11 +210,7 @@ def qdump__Utf8String(d, value): def qdump__CPlusPlus__Token(d, value): k = value["f"]["kind"] e = k.lvalue - if e: - kindType = d.lookupType("CPlusPlus::Kind") - type = kindType.typeData().enumDisplay(e, k.address())[11:] - else: - type = '' + type = kindName(d, k) try: if e == 6: type = readLiteral(d, value["identifier"]) + " (%s)" % type diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json index 1156a6ffeb1..b19479ea7ff 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json @@ -3,7 +3,7 @@ "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ], "id": "V.QtQuickApplicationSwipe", "category": "F.Application", - "trDescription": "Creates a Qt Quick Controls application with a with a StackView to display content, and a Drawer and ToolBar for navigation.", + "trDescription": "Creates a Qt Quick Controls application with a SwipeView for navigation.", "trDisplayName": "Qt Quick Application - Swipe", "trDisplayCategory": "Application", "icon": "icon.png", diff --git a/share/share.qbs b/share/share.qbs index 08688ec0926..c5ee2b1c394 100644 --- a/share/share.qbs +++ b/share/share.qbs @@ -51,7 +51,6 @@ Product { "lupdate.xml", "qmlscene.xml", "qmlviewer.xml", - "sort.xml", ] if (qbs.targetOS.contains("windows")) list.push("notepad_win.xml"); diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index e733202608d..81345fee8e4 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -285,11 +285,8 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc) createGeneratedCodeModelSupport(); - ToolChain *tc = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID); - if (!tc) { - emit fileListChanged(); - return; - } + ToolChain *tcC = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::C_LANGUAGE_ID); + ToolChain *tcCxx = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID); CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt; if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k)) { @@ -307,11 +304,13 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc) for (CppTools::RawProjectPart &rpp : rpps) { // TODO: Set the Qt version only if target actually depends on Qt. rpp.setQtVersion(activeQtVersion); - // TODO: Support also C - rpp.setFlagsForCxx({tc, rpp.flagsForCxx.commandLineFlags}); + if (tcCxx) + rpp.setFlagsForCxx({tcCxx, rpp.flagsForCxx.commandLineFlags}); + if (tcC) + rpp.setFlagsForC({tcC, rpp.flagsForC.commandLineFlags}); } - m_cppCodeModelUpdater->update({this, nullptr, tc, k, rpps}); + m_cppCodeModelUpdater->update({this, tcC, tcCxx, k, rpps}); updateQmlJSCodeModel(); diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 8cc8b812469..7d7309f8ab2 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -27,6 +27,7 @@ #include "icore.h" #include "idocument.h" +#include "idocumentfactory.h" #include "coreconstants.h" #include @@ -710,6 +711,33 @@ bool DocumentManager::saveDocument(IDocument *document, const QString &fileName, return ret; } +template +QSet filterStrings() +{ + QSet filters; + for (FactoryType *factory : ExtensionSystem::PluginManager::getObjects()) { + for (const QString &mt : factory->mimeTypes()) { + const QString filter = mimeTypeForName(mt).filterString(); + if (!filter.isEmpty()) + filters.insert(filter); + } + } + return filters; +} + +QString DocumentManager::allDocumentFactoryFiltersString(QString *allFilesFilter = 0) +{ + const QSet uniqueFilters = filterStrings() + + filterStrings(); + QStringList filters = uniqueFilters.toList(); + filters.sort(); + const QString allFiles = Utils::allFilesFilterString(); + if (allFilesFilter) + *allFilesFilter = allFiles; + filters.prepend(allFiles); + return filters.join(QLatin1String(";;")); +} + QString DocumentManager::getSaveFileName(const QString &title, const QString &pathIn, const QString &filter, QString *selectedFilter) { @@ -771,7 +799,7 @@ QString DocumentManager::getSaveFileNameWithExtension(const QString &title, cons QString DocumentManager::getSaveAsFileName(const IDocument *document) { QTC_ASSERT(document, return QString()); - const QString filter = Utils::allFiltersString(); + const QString filter = allDocumentFactoryFiltersString(); const QString filePath = document->filePath().toString(); QString selectedFilter; QString fileDialogPath = filePath; diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h index 0714cdf7bf3..5e3eda755fb 100644 --- a/src/plugins/coreplugin/documentmanager.h +++ b/src/plugins/coreplugin/documentmanager.h @@ -84,6 +84,8 @@ public: const QString &fileName = QString(), bool *isReadOnly = nullptr); + static QString allDocumentFactoryFiltersString(QString *allFilesFilter); + static QStringList getOpenFileNames(const QString &filters, const QString &path = QString(), QString *selectedFilter = nullptr); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 15912ab85ce..cab82df4cce 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -2726,7 +2726,7 @@ void EditorManager::addCloseEditorListener(const std::function QStringList EditorManager::getOpenFileNames() { QString selectedFilter; - const QString &fileFilters = Utils::allFiltersString(&selectedFilter); + const QString &fileFilters = DocumentManager::allDocumentFactoryFiltersString(&selectedFilter); return DocumentManager::getOpenFileNames(fileFilters, QString(), &selectedFilter); } diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 9f51f15febb..b5fb1f9958c 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -4750,7 +4750,7 @@ public: scopeAtInsertPos); QString funcDef = prefix + funcDec; const int startPosition = m_fromFile->endOf(funcAST->declarator); - const int endPosition = m_fromFile->endOf(funcAST->function_body); + const int endPosition = m_fromFile->endOf(funcAST); funcDef += m_fromFile->textOf(startPosition, endPosition); funcDef += suffix; diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index 977c6188554..ba31251bf37 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -83,8 +83,11 @@ QList CppLocatorFilter::matchesFor( m_data->filterAllFiles([&](const IndexItem::Ptr &info) -> IndexItem::VisitorResult { if (future.isCanceled()) return IndexItem::Break; - if (info->type() & wanted) { + const IndexItem::ItemType type = info->type(); + if (type & wanted) { QString matchString = hasColonColon ? info->scopedSymbolName() : info->symbolName(); + if (type == IndexItem::Function) + matchString += info->symbolType(); QRegularExpressionMatch match = regexp.match(matchString); if (match.hasMatch()) { Core::LocatorFilterEntry filterEntry = filterEntryFromIndexItem(info); diff --git a/src/plugins/cpptools/cpplocatorfilter_test.cpp b/src/plugins/cpptools/cpplocatorfilter_test.cpp index 501a396eb13..1b309fbe8ae 100644 --- a/src/plugins/cpptools/cpplocatorfilter_test.cpp +++ b/src/plugins/cpptools/cpplocatorfilter_test.cpp @@ -196,10 +196,26 @@ void CppToolsPlugin::test_cpplocatorfilters_CppLocatorFilter_data() << _("pos") << (QList() << ResultData(_("positiveNumber()"), testFileShort) - << ResultData(_("getPosition()"), testFileShort) + << ResultData(_("matchArgument(Pos)"), testFileShort) << ResultData(_("pointOfService()"), testFileShort) ); + QTest::newRow("CppFunctionsFilter-arguments") + << testFile + << cppFunctionsFilter + << _("function*bool") + << (QList() + << ResultData(_("functionDefinedInClass(bool, int)"), + _("MyClass (file1.cpp)")) + << ResultData(_("functionDefinedInClass(bool, int)"), + _("MyNamespace::MyClass (file1.cpp)")) + << ResultData(_("functionDefinedInClass(bool, int)"), + _("::MyClass (file1.cpp)")) + << ResultData(_("myFunction(bool, int)"), testFileShort) + << ResultData(_("myFunction(bool, int)"), _("MyNamespace (file1.cpp)")) + << ResultData(_("myFunction(bool, int)"), _(" (file1.cpp)")) + ); + QTest::newRow("CppFunctionsFilter-WithNamespacePrefix") << testFile << cppFunctionsFilter @@ -290,8 +306,9 @@ void CppToolsPlugin::test_cpplocatorfilters_CppCurrentDocumentFilter() QList expectedResults = QList() << ResultData(_("int myVariable"), _("")) << ResultData(_("myFunction(bool, int)"), _("")) + << ResultData(_("Pos"), _("")) << ResultData(_("pointOfService()"), _("")) - << ResultData(_("getPosition()"), _("")) + << ResultData(_("matchArgument(Pos)"), _("")) << ResultData(_("positiveNumber()"), _("")) << ResultData(_("MyEnum"), _("")) << ResultData(_("int V1"), _("MyEnum")) diff --git a/src/plugins/cpptools/cppprojectinfogenerator.cpp b/src/plugins/cpptools/cppprojectinfogenerator.cpp index 4a32d255fc8..2be82ea6b47 100644 --- a/src/plugins/cpptools/cppprojectinfogenerator.cpp +++ b/src/plugins/cpptools/cppprojectinfogenerator.cpp @@ -163,16 +163,17 @@ ProjectInfoGenerator::ProjectInfoGenerator(const QFutureInterface &futureI ProjectInfo ProjectInfoGenerator::generate() { - m_projectInfo = ProjectInfo(m_projectUpdateInfo.project); + ProjectInfo projectInfo(m_projectUpdateInfo.project); for (const RawProjectPart &rpp : m_projectUpdateInfo.rawProjectParts) { if (m_futureInterface.isCanceled()) return ProjectInfo(); - createProjectParts(rpp); + for (ProjectPart::Ptr part : createProjectParts(rpp)) + projectInfo.appendProjectPart(part); } - return m_projectInfo; + return projectInfo; } static ProjectPart::Ptr projectPartFromRawProjectPart(const RawProjectPart &rawProjectPart, @@ -196,8 +197,9 @@ static ProjectPart::Ptr projectPartFromRawProjectPart(const RawProjectPart &rawP return part; } -void ProjectInfoGenerator::createProjectParts(const RawProjectPart &rawProjectPart) +QVector ProjectInfoGenerator::createProjectParts(const RawProjectPart &rawProjectPart) { + QVector result; ProjectFileCategorizer cat(rawProjectPart.displayName, rawProjectPart.files, rawProjectPart.fileClassifier); @@ -210,49 +212,50 @@ void ProjectInfoGenerator::createProjectParts(const RawProjectPart &rawProjectPa if (rawProjectPart.qtVersion == ProjectPart::Qt4_8_6AndOlder) defaultVersion = ProjectPart::CXX11; if (cat.hasCxxSources()) { - createProjectPart(rawProjectPart, - part, - cat.cxxSources(), - cat.partName("C++"), - defaultVersion, - ProjectPart::NoExtensions); + result << createProjectPart(rawProjectPart, + part, + cat.cxxSources(), + cat.partName("C++"), + defaultVersion, + ProjectPart::NoExtensions); } if (cat.hasObjcxxSources()) { - createProjectPart(rawProjectPart, - part, - cat.objcxxSources(), - cat.partName("Obj-C++"), - defaultVersion, - ProjectPart::ObjectiveCExtensions); + result << createProjectPart(rawProjectPart, + part, + cat.objcxxSources(), + cat.partName("Obj-C++"), + defaultVersion, + ProjectPart::ObjectiveCExtensions); } if (cat.hasCSources()) { - createProjectPart(rawProjectPart, - part, - cat.cSources(), - cat.partName("C"), - ProjectPart::LatestCVersion, - ProjectPart::NoExtensions); + result << createProjectPart(rawProjectPart, + part, + cat.cSources(), + cat.partName("C"), + ProjectPart::LatestCVersion, + ProjectPart::NoExtensions); } if (cat.hasObjcSources()) { - createProjectPart(rawProjectPart, - part, - cat.objcSources(), - cat.partName("Obj-C"), - ProjectPart::LatestCVersion, - ProjectPart::ObjectiveCExtensions); + result << createProjectPart(rawProjectPart, + part, + cat.objcSources(), + cat.partName("Obj-C"), + ProjectPart::LatestCVersion, + ProjectPart::ObjectiveCExtensions); } } + return result; } -void ProjectInfoGenerator::createProjectPart(const RawProjectPart &rawProjectPart, - const ProjectPart::Ptr &templateProjectPart, - const ProjectFiles &projectFiles, - const QString &partName, - ProjectPart::LanguageVersion languageVersion, - ProjectPart::LanguageExtensions languageExtensions) +ProjectPart::Ptr ProjectInfoGenerator::createProjectPart(const RawProjectPart &rawProjectPart, + const ProjectPart::Ptr &templateProjectPart, + const ProjectFiles &projectFiles, + const QString &partName, + ProjectPart::LanguageVersion languageVersion, + ProjectPart::LanguageExtensions languageExtensions) { ProjectPart::Ptr part(templateProjectPart->copy()); part->displayName = partName; @@ -277,7 +280,7 @@ void ProjectInfoGenerator::createProjectPart(const RawProjectPart &rawProjectPar part->languageExtensions |= languageExtensions; part->updateLanguageFeatures(); - m_projectInfo.appendProjectPart(part); + return part; } } // namespace Internal diff --git a/src/plugins/cpptools/cppprojectinfogenerator.h b/src/plugins/cpptools/cppprojectinfogenerator.h index f1972cd5c2c..6f81eaf85f5 100644 --- a/src/plugins/cpptools/cppprojectinfogenerator.h +++ b/src/plugins/cpptools/cppprojectinfogenerator.h @@ -41,19 +41,17 @@ public: ProjectInfo generate(); private: - void createProjectParts(const RawProjectPart &rawProjectPart); - void createProjectPart(const RawProjectPart &rawProjectPart, - const ProjectPart::Ptr &templateProjectPart, - const ProjectFiles &projectFiles, - const QString &partName, - ProjectPart::LanguageVersion languageVersion, - ProjectPart::LanguageExtensions languageExtensions); + QVector createProjectParts(const RawProjectPart &rawProjectPart); + ProjectPart::Ptr createProjectPart(const RawProjectPart &rawProjectPart, + const ProjectPart::Ptr &templateProjectPart, + const ProjectFiles &projectFiles, + const QString &partName, + ProjectPart::LanguageVersion languageVersion, + ProjectPart::LanguageExtensions languageExtensions); private: - const QFutureInterface &m_futureInterface; + const QFutureInterface m_futureInterface; const ProjectUpdateInfo &m_projectUpdateInfo; - - ProjectInfo m_projectInfo; }; } // namespace Internal } // namespace CppTools diff --git a/src/plugins/cpptools/cppprojectupdater.cpp b/src/plugins/cpptools/cppprojectupdater.cpp index 33a2b1df585..50a404664c3 100644 --- a/src/plugins/cpptools/cppprojectupdater.cpp +++ b/src/plugins/cpptools/cppprojectupdater.cpp @@ -62,9 +62,8 @@ void CppProjectUpdater::update(const ProjectUpdateInfo &projectUpdateInfo) this, &CppProjectUpdater::onToolChainRemoved); // Run the project info generator in a worker thread and continue if that one is finished. - const QFutureInterface &futureInterface = m_futureInterface; const QFuture future = Utils::runAsync([=]() { - Internal::ProjectInfoGenerator generator(futureInterface, projectUpdateInfo); + Internal::ProjectInfoGenerator generator(m_futureInterface, projectUpdateInfo); return generator.generate(); }); m_generateFutureWatcher.setFuture(future); diff --git a/src/plugins/projectexplorer/abiwidget.cpp b/src/plugins/projectexplorer/abiwidget.cpp index 942e9b55ace..5262ffc66f2 100644 --- a/src/plugins/projectexplorer/abiwidget.cpp +++ b/src/plugins/projectexplorer/abiwidget.cpp @@ -88,7 +88,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent), d->m_architectureComboBox->addItem(Abi::toString(static_cast(i)), i); d->m_architectureComboBox->setCurrentIndex(static_cast(Abi::UnknownArchitecture)); connect(d->m_architectureComboBox, static_cast(&QComboBox::currentIndexChanged), - this, &AbiWidget::customAbiChanged); + this, &AbiWidget::updateCustomItemData); QLabel *separator1 = new QLabel(this); separator1->setText(QLatin1String("-")); @@ -111,7 +111,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent), d->m_osFlavorComboBox = new QComboBox(this); layout->addWidget(d->m_osFlavorComboBox); connect(d->m_osFlavorComboBox, static_cast(&QComboBox::currentIndexChanged), - this, &AbiWidget::customAbiChanged); + this, &AbiWidget::updateCustomItemData); QLabel *separator3 = new QLabel(this); separator3->setText(QLatin1String("-")); @@ -124,7 +124,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent), d->m_binaryFormatComboBox->addItem(Abi::toString(static_cast(i)), i); d->m_binaryFormatComboBox->setCurrentIndex(static_cast(Abi::UnknownFormat)); connect(d->m_binaryFormatComboBox, static_cast(&QComboBox::currentIndexChanged), - this, &AbiWidget::customAbiChanged); + this, &AbiWidget::updateCustomItemData); QLabel *separator4 = new QLabel(this); separator4->setText(QLatin1String("-")); @@ -139,7 +139,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent), d->m_wordWidthComboBox->addItem(Abi::toString(0), 0); d->m_wordWidthComboBox->setCurrentIndex(2); connect(d->m_wordWidthComboBox, static_cast(&QComboBox::currentIndexChanged), - this, &AbiWidget::customAbiChanged); + this, &AbiWidget::updateCustomItemData); layout->setStretchFactor(d->m_abi, 1); @@ -164,24 +164,23 @@ void AbiWidget::setAbis(const QList &abiList, const Abi ¤t) defaultAbi = Abi::hostAbi(); } - d->m_abi->addItem(tr(""), defaultAbi.toString()); + d->m_abi->addItem(tr("")); d->m_abi->setCurrentIndex(0); + setCustomAbi(defaultAbi); for (int i = 0; i < abiList.count(); ++i) { int index = i + 1; const QString abiString = abiList.at(i).toString(); + d->m_abi->insertItem(index, abiString, abiString); - if (abiList.at(i) == current) + if (abiList.at(i) == defaultAbi) d->m_abi->setCurrentIndex(index); } d->m_abi->setVisible(!abiList.isEmpty()); - if (d->isCustom()) { - if (!current.isValid() && !abiList.isEmpty()) - d->m_abi->setCurrentIndex(1); // default to the first Abi if none is selected. - else - setCustomAbi(current); - } + if (d->isCustom() && !current.isValid() && !abiList.isEmpty()) + d->m_abi->setCurrentIndex(1); // default to the first Abi if none is selected. + modeChanged(); } @@ -215,7 +214,7 @@ void AbiWidget::osChanged() d->m_osFlavorComboBox->addItem(Abi::toString(f), static_cast(f)); d->m_osFlavorComboBox->setCurrentIndex(0); // default to generic flavor } - customAbiChanged(); + updateCustomItemData(); } void AbiWidget::modeChanged() @@ -230,11 +229,8 @@ void AbiWidget::modeChanged() setCustomAbi(currentAbi()); } -void AbiWidget::customAbiChanged() +void AbiWidget::updateCustomItemData() { - if (signalsBlocked()) - return; - Abi current(static_cast(d->m_architectureComboBox->currentIndex()), static_cast(d->m_osComboBox->currentIndex()), static_cast(d->m_osFlavorComboBox->itemData(d->m_osFlavorComboBox->currentIndex()).toInt()), @@ -265,8 +261,7 @@ void AbiWidget::setCustomAbi(const Abi ¤t) break; } } - if (d->isCustom()) - d->m_abi->setItemData(0, current.toString()); + updateCustomItemData(); } emit abiChanged(); diff --git a/src/plugins/projectexplorer/abiwidget.h b/src/plugins/projectexplorer/abiwidget.h index 55a27134e0b..dff42068fc9 100644 --- a/src/plugins/projectexplorer/abiwidget.h +++ b/src/plugins/projectexplorer/abiwidget.h @@ -57,7 +57,7 @@ signals: private: void osChanged(); void modeChanged(); - void customAbiChanged(); + void updateCustomItemData(); void setCustomAbi(const Abi &a); diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 64939ffc739..5a580d24e3b 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -177,6 +177,13 @@ QList GccToolChain::gccHeaderPaths(const FileName &gcc, const QStrin return systemHeaderPaths; } +void GccToolChain::toolChainUpdated() +{ + m_predefinedMacrosCache->invalidate(); + m_headerPathsCache->invalidate(); + ToolChain::toolChainUpdated(); +} + static QList guessGccAbi(const QString &m, const ProjectExplorer::Macros ¯os) { QList abiList; @@ -245,7 +252,7 @@ GccToolChain::GccToolChain(Detection d) : GccToolChain::GccToolChain(Core::Id typeId, Detection d) : ToolChain(typeId, d), - m_predefinedMacrosCache(std::make_shared>>()), + m_predefinedMacrosCache(std::make_shared, 64>>()), m_headerPathsCache(std::make_shared>>()) { } @@ -385,7 +392,7 @@ ToolChain::PredefinedMacrosRunner GccToolChain::createPredefinedMacrosRunner() c const QStringList platformCodeGenFlags = m_platformCodeGenFlags; OptionsReinterpreter reinterpretOptions = m_optionsReinterpreter; QTC_CHECK(reinterpretOptions); - std::shared_ptr>> macroCache = m_predefinedMacrosCache; + std::shared_ptr, 64>> macroCache = m_predefinedMacrosCache; Core::Id lang = language(); // This runner must be thread-safe! diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h index e80ccb13e5e..ad1007c239b 100644 --- a/src/plugins/projectexplorer/gcctoolchain.h +++ b/src/plugins/projectexplorer/gcctoolchain.h @@ -104,6 +104,12 @@ public: return checkImpl(compilerArguments); } + void invalidate() + { + QMutexLocker locker(&m_mutex); + m_cache.clear(); + } + private: Utils::optional checkImpl(const QStringList &compilerArguments) { @@ -217,6 +223,7 @@ protected: bool m_doesEnable = false; bool m_triggered = false; }; + void toolChainUpdated() override; private: explicit GccToolChain(Detection d); @@ -235,7 +242,7 @@ private: mutable QList m_headerPaths; mutable QString m_version; - mutable std::shared_ptr>> m_predefinedMacrosCache; + mutable std::shared_ptr, 64>> m_predefinedMacrosCache; mutable std::shared_ptr>> m_headerPathsCache; friend class Internal::GccToolChainConfigWidget; diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h index 30009378236..018c99fd7eb 100644 --- a/src/plugins/projectexplorer/toolchain.h +++ b/src/plugins/projectexplorer/toolchain.h @@ -158,7 +158,7 @@ protected: explicit ToolChain(Core::Id typeId, Detection d); explicit ToolChain(const ToolChain &); - void toolChainUpdated(); + virtual void toolChainUpdated(); // Make sure to call this function when deriving! virtual bool fromMap(const QVariantMap &data); diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index f19723df952..2d0ff674657 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -44,20 +44,21 @@ namespace QmakeProjectManager { */ QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, - const FileName &filePath) : + const FileName &filePath, QmakePriFile *pf) : ProjectNode(filePath), m_project(project), - m_qmakeProFileNode(qmakeProFileNode) + m_qmakeProFileNode(qmakeProFileNode), + m_qmakePriFile(pf) { } QmakePriFile *QmakePriFileNode::priFile() const { - return m_project->rootProFile()->findPriFile(filePath()); + return m_qmakePriFile; } bool QmakePriFileNode::deploysFolder(const QString &folder) const { - QmakePriFile *pri = priFile(); + const QmakePriFile *pri = priFile(); return pri ? pri->deploysFolder(folder) : false; } @@ -145,7 +146,7 @@ bool QmakePriFileNode::supportsAction(ProjectAction action, const Node *node) co bool QmakePriFileNode::canAddSubProject(const QString &proFilePath) const { - QmakePriFile *pri = priFile(); + const QmakePriFile *pri = priFile(); return pri ? pri->canAddSubProject(proFilePath) : false; } @@ -213,8 +214,8 @@ QmakeProFileNode *QmakeProFileNode::findProFileFor(const FileName &fileName) con \class QmakeProFileNode Implements abstract ProjectNode class */ -QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FileName &filePath) : - QmakePriFileNode(project, this, filePath) +QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FileName &filePath, QmakeProFile *pf) : + QmakePriFileNode(project, this, filePath, pf) { } bool QmakeProFileNode::showInSimpleTree() const @@ -224,7 +225,7 @@ bool QmakeProFileNode::showInSimpleTree() const QmakeProFile *QmakeProFileNode::proFile() const { - return m_project->rootProFile()->findProFile(filePath()); + return static_cast(QmakePriFileNode::priFile()); } FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.h b/src/plugins/qmakeprojectmanager/qmakenodes.h index aca17e18a29..56a2b6be622 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.h +++ b/src/plugins/qmakeprojectmanager/qmakenodes.h @@ -42,7 +42,7 @@ class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::Proj { public: QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, - const Utils::FileName &filePath); + const Utils::FileName &filePath, QmakePriFile *pf); QmakePriFile *priFile() const; @@ -73,13 +73,14 @@ protected: private: QmakeProFileNode *m_qmakeProFileNode = nullptr; + QmakePriFile *m_qmakePriFile = nullptr; }; // Implements ProjectNode for qmake .pro files class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode { public: - QmakeProFileNode(QmakeProject *project, const Utils::FileName &filePath); + QmakeProFileNode(QmakeProject *project, const Utils::FileName &filePath, QmakeProFile *pf); QmakeProFile *proFile() const; diff --git a/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp b/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp index a65b9cd44b4..6e071c90e0a 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp @@ -183,12 +183,12 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi } // Virtual folders: - for (const QmakePriFile *c : pri->children()) { + for (QmakePriFile *c : pri->children()) { QmakePriFileNode *newNode = nullptr; - if (dynamic_cast(c)) - newNode = new QmakeProFileNode(c->project(), c->filePath()); + if (auto pf = dynamic_cast(c)) + newNode = new QmakeProFileNode(c->project(), c->filePath(), pf); else - newNode = new QmakePriFileNode(c->project(), node->proFileNode(), c->filePath()); + newNode = new QmakePriFileNode(c->project(), node->proFileNode(), c->filePath(), c); createTree(c, newNode, toExclude); node->addNode(newNode); } @@ -203,7 +203,7 @@ QmakeProFileNode *QmakeNodeTreeBuilder::buildTree(QmakeProject *project) const FileNameList toExclude = qt ? qt->directoriesToIgnoreInProjectTree() : FileNameList(); - auto root = new QmakeProFileNode(project, project->projectFilePath()); + auto root = new QmakeProFileNode(project, project->projectFilePath(), project->rootProFile()); createTree(project->rootProFile(), root, toExclude); return root; diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp index 6a52da6c402..7bb64a521c9 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -199,12 +200,22 @@ QmakePriFile *QmakePriFile::findPriFile(const FileName &fileName) { if (fileName == filePath()) return this; - for (QmakePriFile *n : children()) { + for (QmakePriFile *n : Utils::asConst(m_children)) { if (QmakePriFile *result = n->findPriFile(fileName)) return result; } return nullptr; +} +const QmakePriFile *QmakePriFile::findPriFile(const FileName &fileName) const +{ + if (fileName == filePath()) + return this; + for (const QmakePriFile *n : Utils::asConst(m_children)) { + if (const QmakePriFile *result = n->findPriFile(fileName)) + return result; + } + return nullptr; } void QmakePriFile::makeEmpty() @@ -1009,7 +1020,12 @@ static ProjectType proFileTemplateTypeToProjectType(ProFileEvaluator::TemplateTy QmakeProFile *QmakeProFile::findProFile(const FileName &fileName) { - return dynamic_cast(findPriFile(fileName)); + return static_cast(findPriFile(fileName)); +} + +const QmakeProFile *QmakeProFile::findProFile(const FileName &fileName) const +{ + return static_cast(findPriFile(fileName)); } QString QmakeProFile::makefile() const @@ -1406,6 +1422,7 @@ QmakeEvalResult *QmakeProFile::evaluate(const QmakeEvalInput &input) result->newVarValues[Variable::IncludePath] = includePaths(exactReader, input.sysroot, input.buildDirectory, input.projectDir); result->newVarValues[Variable::CppFlags] = exactReader->values(QLatin1String("QMAKE_CXXFLAGS")); + result->newVarValues[Variable::CFlags] = exactReader->values(QLatin1String("QMAKE_CFLAGS")); result->newVarValues[Variable::Source] = fileListForVar(exactSourceFiles, QLatin1String("SOURCES")) + fileListForVar(cumulativeSourceFiles, QLatin1String("SOURCES")) + @@ -1421,7 +1438,7 @@ QmakeEvalResult *QmakeProFile::evaluate(const QmakeEvalInput &input) result->newVarValues[Variable::CumulativeResource] = fileListForVar(cumulativeSourceFiles, QLatin1String("RESOURCES")); result->newVarValues[Variable::PkgConfig] = exactReader->values(QLatin1String("PKGCONFIG")); result->newVarValues[Variable::PrecompiledHeader] = ProFileEvaluator::sourcesToFiles(exactReader->fixifiedValues( - QLatin1String("PRECOMPILED_HEADER"), input.projectDir, input.buildDirectory.toString())); + QLatin1String("PRECOMPILED_HEADER"), input.projectDir, input.buildDirectory.toString(), false)); result->newVarValues[Variable::LibDirectories] = libDirectories(exactReader); result->newVarValues[Variable::Config] = exactReader->values(QLatin1String("CONFIG")); result->newVarValues[Variable::QmlImportPath] = exactReader->absolutePathValues( @@ -1475,7 +1492,7 @@ void QmakeProFile::asyncEvaluate(QFutureInterface &fi, QmakeE void QmakeProFile::applyAsyncEvaluate() { applyEvaluate(m_parseFutureWatcher.result()); - m_project->decrementPendingEvaluateFutures(validParse()); + m_project->decrementPendingEvaluateFutures(); } bool sortByParserNodes(Node *a, Node *b) @@ -1659,7 +1676,8 @@ QStringList QmakeProFile::includePaths(QtSupport::ProFileReader *reader, const F } foreach (const ProFileEvaluator::SourceFile &el, - reader->fixifiedValues(QLatin1String("INCLUDEPATH"), projectDir, buildDir.toString())) { + reader->fixifiedValues(QLatin1String("INCLUDEPATH"), projectDir, buildDir.toString(), + false)) { paths << sysrootify(el.fileName, sysroot.toString(), projectDir, buildDir.toString()); } // paths already contains moc dir and ui dir, due to corrrectly parsing uic.prf and moc.prf @@ -1816,7 +1834,7 @@ InstallsList QmakeProFile::installsList(const QtSupport::ProFileReader *reader, result.targetPath = itemPath; } else { const auto &itemFiles = reader->fixifiedValues( - item + QLatin1String(".files"), projectDir, buildDir); + item + QLatin1String(".files"), projectDir, buildDir, true); result.items << InstallsItem(itemPath, itemFiles, active); } } diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h index 2cad1340cc8..4c5c84ca439 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h @@ -64,6 +64,7 @@ enum class Variable { Defines = 1, IncludePath, CppFlags, + CFlags, Source, ExactResource, CumulativeResource, @@ -121,6 +122,7 @@ public: QVector children() const; QmakePriFile *findPriFile(const Utils::FileName &fileName); + const QmakePriFile *findPriFile(const Utils::FileName &fileName) const; bool knowsFile(const Utils::FileName &filePath) const; @@ -280,6 +282,7 @@ public: QList allProFiles(); QmakeProFile *findProFile(const Utils::FileName &fileName); + const QmakeProFile *findProFile(const Utils::FileName &fileName) const; ProjectType projectType() const; diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index c3b847447aa..b8e9ffb77f9 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -294,8 +294,8 @@ void QmakeProject::updateCppCodeModel() rpp.setBuildTargetType(isExecutable ? CppTools::ProjectPart::Executable : CppTools::ProjectPart::Library); - // TODO: Handle QMAKE_CFLAGS rpp.setFlagsForCxx({cxxToolChain, pro->variableValue(Variable::CppFlags)}); + rpp.setFlagsForC({cToolChain, pro->variableValue(Variable::CFlags)}); rpp.setMacros(ProjectExplorer::Macro::toMacros(pro->cxxDefines())); rpp.setPreCompiledHeaders(pro->variableValue(Variable::PrecompiledHeader)); rpp.setSelectedForBuilding(pro->includedInExactParse()); @@ -500,24 +500,20 @@ void QmakeProject::startAsyncTimer(QmakeProFile::AsyncUpdateDelay delay) void QmakeProject::incrementPendingEvaluateFutures() { ++m_pendingEvaluateFuturesCount; - if (m_pendingEvaluateFuturesCount == 1) - m_totalEvaluationSuccess = true; m_asyncUpdateFutureInterface->setProgressRange(m_asyncUpdateFutureInterface->progressMinimum(), m_asyncUpdateFutureInterface->progressMaximum() + 1); } -void QmakeProject::decrementPendingEvaluateFutures(bool success) +void QmakeProject::decrementPendingEvaluateFutures() { --m_pendingEvaluateFuturesCount; - m_totalEvaluationSuccess = m_totalEvaluationSuccess && success; - m_asyncUpdateFutureInterface->setProgressValue(m_asyncUpdateFutureInterface->progressValue() + 1); if (m_pendingEvaluateFuturesCount == 0) { // We are done! setRootProjectNode(QmakeNodeTreeBuilder::buildTree(this)); - if (!m_totalEvaluationSuccess) + if (!m_rootProFile->validParse()) m_asyncUpdateFutureInterface->reportCanceled(); m_asyncUpdateFutureInterface->reportFinished(); diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h index b8d3192f098..717c11951bf 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.h +++ b/src/plugins/qmakeprojectmanager/qmakeproject.h @@ -100,7 +100,7 @@ public: /// \internal void incrementPendingEvaluateFutures(); /// \internal - void decrementPendingEvaluateFutures(bool success); + void decrementPendingEvaluateFutures(); /// \internal bool wasEvaluateCanceled(); @@ -186,7 +186,6 @@ private: // cached data during project rescan QMakeGlobals *m_qmakeGlobals = nullptr; int m_qmakeGlobalsRefCnt = 0; - bool m_totalEvaluationSuccess = false; QString m_qmakeSysroot; diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index d56857ea80d..31b1198cf2f 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -455,6 +455,9 @@ static Core::MiniSplitter *createCentralSplitter(const QList &widget outputPlaceholderSplitter->setStretchFactor(1, 0); outputPlaceholderSplitter->setOrientation(Qt::Vertical); + QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css")); + outputPlaceholderSplitter->setStyleSheet(Theme::replaceCssColors(sheet)); + SwitchSplitTabWidget *switchSplitTabWidget = new SwitchSplitTabWidget(); foreach (const WidgetInfo &widgetInfo, widgetInfos) { diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index 23872cdf61c..045222fe77f 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -257,18 +257,19 @@ public: QPalette pal; pal.setColor(QPalette::Base, themeColor(Theme::Welcome_BackgroundColor)); - m_lineEdit = new QLineEdit; + m_lineEdit = new FancyLineEdit; + m_lineEdit->setFiltering(true); m_lineEdit->setFrame(false); m_lineEdit->setFont(sizedFont(14, this)); m_lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); m_lineEdit->setPalette(pal); auto box = new QHBoxLayout(this); - box->setContentsMargins(15, 3, 15, 3); + box->setContentsMargins(10, 3, 3, 3); box->addWidget(m_lineEdit); } - QLineEdit *m_lineEdit; + FancyLineEdit *m_lineEdit; }; class GridView : public QTableView diff --git a/src/share/qtcreator/data.pro b/src/share/qtcreator/data.pro index 5ae7d1d2697..fc96289f3a4 100644 --- a/src/share/qtcreator/data.pro +++ b/src/share/qtcreator/data.pro @@ -9,7 +9,6 @@ STATIC_INSTALL_BASE = $$INSTALL_DATA_PATH STATIC_FILES = \ $$PWD/externaltools/lrelease.xml \ $$PWD/externaltools/lupdate.xml \ - $$PWD/externaltools/sort.xml \ $$PWD/externaltools/qmlviewer.xml \ $$PWD/externaltools/qmlscene.xml unix { diff --git a/src/share/qtcreator/externaltools/sort.xml b/src/share/qtcreator/externaltools/sort.xml deleted file mode 100644 index e5918f0b4f9..00000000000 --- a/src/share/qtcreator/externaltools/sort.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - Sorts the selected text - Sort Selection - Text - - sort - %{CurrentDocument:Selection} - %{CurrentDocument:Path} - - diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 28a1144de48..a3425ec6cbd 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -77,7 +77,8 @@ QStringList ProFileEvaluator::values(const QString &variableName) const } QVector ProFileEvaluator::fixifiedValues( - const QString &variable, const QString &baseDirectory, const QString &buildDirectory) const + const QString &variable, const QString &baseDirectory, const QString &buildDirectory, + bool expandWildcards) const { QVector result; foreach (const ProString &str, d->values(ProKey(variable))) { @@ -86,11 +87,29 @@ QVector ProFileEvaluator::fixifiedValues( result << SourceFile{QDir::cleanPath(el), str.sourceFile()}; } else { QString fn = QDir::cleanPath(baseDirectory + QLatin1Char('/') + el); - if (IoUtils::exists(fn)) + if (IoUtils::exists(fn)) { result << SourceFile{fn, str.sourceFile()}; - else - result << SourceFile{QDir::cleanPath(buildDirectory + QLatin1Char('/') + el), - str.sourceFile()}; + } else { + QStringRef fileNamePattern; + if (expandWildcards) { + fileNamePattern = IoUtils::fileName(fn); + expandWildcards = fileNamePattern.contains('*') + || fileNamePattern.contains('?'); + } + if (expandWildcards) { + const QString patternBaseDir = IoUtils::pathName(fn).toString(); + const QDir::Filters filters = QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot; + for (const QString &fileName : QDir(patternBaseDir).entryList( + QStringList(fileNamePattern.toString()), filters)) { + const QString fullFilePath + = QDir::cleanPath(patternBaseDir + '/' + fileName); + result << SourceFile({fullFilePath, str.sourceFile()}); + } + } else { + result << SourceFile{QDir::cleanPath(buildDirectory + QLatin1Char('/') + el), + str.sourceFile()}; + } + } } } return result; diff --git a/src/shared/proparser/profileevaluator.h b/src/shared/proparser/profileevaluator.h index d001c9d7b0d..b0116aebd4c 100644 --- a/src/shared/proparser/profileevaluator.h +++ b/src/shared/proparser/profileevaluator.h @@ -81,7 +81,8 @@ public: QString value(const QString &variableName) const; QStringList values(const QString &variableName) const; QVector fixifiedValues( - const QString &variable, const QString &baseDirectory, const QString &buildDirectory) const; + const QString &variable, const QString &baseDirectory, const QString &buildDirectory, + bool expandWildcards) const; QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const; QVector absoluteFileValues( const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, diff --git a/tests/cpplocators/testdata_basic/file1.cpp b/tests/cpplocators/testdata_basic/file1.cpp index 5c1e3caff32..ae8cdf9916c 100644 --- a/tests/cpplocators/testdata_basic/file1.cpp +++ b/tests/cpplocators/testdata_basic/file1.cpp @@ -12,8 +12,9 @@ int myVariable; int myFunction(bool yesno, int number) {} +struct Pos {}; void pointOfService() {} -int getPosition() { return 0; } +int matchArgument(Pos p) { return 0; } int positiveNumber() { return 2; } enum MyEnum { V1, V2 };