Merge remote-tracking branch 'origin/4.5'

Change-Id: I16e3bb9ee3a1e6dc6edf7a65f8a137a25cda4fe3
This commit is contained in:
Orgad Shaneh
2017-11-05 16:49:17 +02:00
43 changed files with 358 additions and 229 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@@ -133,18 +133,37 @@
For more information, see \l{Qt for Android}. For more information, see \l{Qt for Android}.
\section2 Specifying Android Device Settings
To configure connections between \QC and Android devices: To configure connections between \QC and Android devices:
\list 1 \list 1
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices > \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 You can use the \inlineimage download.png
(\uicontrol Download) buttons to go to the sites where you can download (\uicontrol Download) buttons to go to the sites where you can download
the Android NDK and SDK. 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} \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 check box to allow \QC to create the kits for you. \QC displays a
@@ -174,6 +193,46 @@
\uicontrol {Select Android Devices} dialog. \uicontrol {Select Android Devices} dialog.
\endlist \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 \section1 Selecting Android Devices
When you deploy an application to an Android device with Android When you deploy an application to an Android device with Android

View File

@@ -37,9 +37,8 @@
\title Using External Tools \title Using External Tools
You can use external tools directly from \QC. Qt Linguist, You can use external tools directly from \QC. Qt Linguist, QML preview
QML preview tools, the tools, and the default text editor for your system are preconfigured
default text editor for your system, and the \c sort tool are preconfigured
for use. You can change their default configurations and configure new for use. You can change their default configurations and configure new
tools. tools.
@@ -93,16 +92,6 @@
\QC looks for the editor path in the PATH environment variable \QC looks for the editor path in the PATH environment variable
of your operating system. 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 \section1 Configuring External Tools
You can change the configuration of preconfigured tools and configure You can change the configuration of preconfigured tools and configure

View File

@@ -257,4 +257,10 @@
history, press \key {Ctrl+Shift+V} until the clip appears. history, press \key {Ctrl+Shift+V} until the clip appears.
The number of clips in the history is fixed to 10. 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).
*/ */

View File

@@ -57,10 +57,8 @@
To change the location of the project directory, and to specify settings To change the location of the project directory, and to specify settings
for building and running projects, select \uicontrol Tools > for building and running projects, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Build & Run} > \uicontrol General. The \uicontrol Options > \uicontrol {Build & Run} > \uicontrol General. The
\uicontrol CMake tab contains additional CMake settings. \uicontrol CMake and \uicontrol Qbs tabs contain additional settings for
those build systems.
To specify build profiles for Qbs, select \uicontrol Tools >
\uicontrol Options > \uicontrol Qbs.
To specify build and run settings for different target platforms, To specify build and run settings for different target platforms,
select \uicontrol Projects. For more information on the options you have, select \uicontrol Projects. For more information on the options you have,

View File

@@ -41,7 +41,7 @@
kit. You can edit the build profiles by adding new keys and values. kit. You can edit the build profiles by adding new keys and values.
To check which Qbs version is being used, select \uicontrol Tools > 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 \section1 Building Qbs
@@ -57,46 +57,24 @@
\endlist \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 \image qtcreator-options-qbs.png
You can modify a build profile that is associated with a build and run kit By default, Qbs profiles are stored in the \c qbs directory in the \QC
by editing the values of the keys generated by \QC and by adding new values: 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 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
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Qbs. Qbs profile associated with a kit, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Build & Run} > \uicontrol Kits. For more
\li By default, Qbs profiles are stored in the \c qbs directory in the information, see \l{Editing Qbs Profiles}.
\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 <module_name>.<property_name>.
\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.
\section1 Related Topics \section1 Related Topics

View File

@@ -142,7 +142,7 @@
\li In the \uicontrol {Additional Qbs profile settings} field, select \li In the \uicontrol {Additional Qbs profile settings} field, select
\uicontrol Change to add settings to Qbs build profiles. For more \uicontrol Change to add settings to Qbs build profiles. For more
information, see \l {Editing Build Profiles}. information, see \l {Editing Qbs Profiles}.
\endlist \endlist
@@ -150,4 +150,38 @@
choose the kit to use. To set the selected kit as the default kit, choose the kit to use. To set the selected kit as the default kit,
select \uicontrol {Make Default}. 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 <module_name>.<property_name>.
\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.
*/ */

View File

@@ -140,8 +140,16 @@ def qdump__CPlusPlus__Symbol(d, value):
def qdump__CPlusPlus__Class(d, value): def qdump__CPlusPlus__Class(d, value):
qdump__CPlusPlus__Symbol(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): def qdump__CPlusPlus__IntegerType(d, value):
d.putValue(value["_kind"]) d.putValue(kindName(d, value["_kind"]))
d.putPlainChildren(value) d.putPlainChildren(value)
def qdump__CPlusPlus__FullySpecifiedType(d, value): def qdump__CPlusPlus__FullySpecifiedType(d, value):
@@ -202,11 +210,7 @@ def qdump__Utf8String(d, value):
def qdump__CPlusPlus__Token(d, value): def qdump__CPlusPlus__Token(d, value):
k = value["f"]["kind"] k = value["f"]["kind"]
e = k.lvalue e = k.lvalue
if e: type = kindName(d, k)
kindType = d.lookupType("CPlusPlus::Kind")
type = kindType.typeData().enumDisplay(e, k.address())[11:]
else:
type = ''
try: try:
if e == 6: if e == 6:
type = readLiteral(d, value["identifier"]) + " (%s)" % type type = readLiteral(d, value["identifier"]) + " (%s)" % type

View File

@@ -3,7 +3,7 @@
"supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ], "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
"id": "V.QtQuickApplicationSwipe", "id": "V.QtQuickApplicationSwipe",
"category": "F.Application", "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", "trDisplayName": "Qt Quick Application - Swipe",
"trDisplayCategory": "Application", "trDisplayCategory": "Application",
"icon": "icon.png", "icon": "icon.png",

View File

@@ -51,7 +51,6 @@ Product {
"lupdate.xml", "lupdate.xml",
"qmlscene.xml", "qmlscene.xml",
"qmlviewer.xml", "qmlviewer.xml",
"sort.xml",
] ]
if (qbs.targetOS.contains("windows")) if (qbs.targetOS.contains("windows"))
list.push("notepad_win.xml"); list.push("notepad_win.xml");

View File

@@ -285,11 +285,8 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
createGeneratedCodeModelSupport(); createGeneratedCodeModelSupport();
ToolChain *tc = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID); ToolChain *tcC = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::C_LANGUAGE_ID);
if (!tc) { ToolChain *tcCxx = ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
emit fileListChanged();
return;
}
CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt; CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt;
if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k)) { if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k)) {
@@ -307,11 +304,13 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
for (CppTools::RawProjectPart &rpp : rpps) { for (CppTools::RawProjectPart &rpp : rpps) {
// TODO: Set the Qt version only if target actually depends on Qt. // TODO: Set the Qt version only if target actually depends on Qt.
rpp.setQtVersion(activeQtVersion); rpp.setQtVersion(activeQtVersion);
// TODO: Support also C if (tcCxx)
rpp.setFlagsForCxx({tc, rpp.flagsForCxx.commandLineFlags}); 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(); updateQmlJSCodeModel();

View File

@@ -27,6 +27,7 @@
#include "icore.h" #include "icore.h"
#include "idocument.h" #include "idocument.h"
#include "idocumentfactory.h"
#include "coreconstants.h" #include "coreconstants.h"
#include <coreplugin/diffservice.h> #include <coreplugin/diffservice.h>
@@ -710,6 +711,33 @@ bool DocumentManager::saveDocument(IDocument *document, const QString &fileName,
return ret; return ret;
} }
template<typename FactoryType>
QSet<QString> filterStrings()
{
QSet<QString> filters;
for (FactoryType *factory : ExtensionSystem::PluginManager::getObjects<FactoryType>()) {
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<QString> uniqueFilters = filterStrings<IDocumentFactory>()
+ filterStrings<IEditorFactory>();
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, QString DocumentManager::getSaveFileName(const QString &title, const QString &pathIn,
const QString &filter, QString *selectedFilter) const QString &filter, QString *selectedFilter)
{ {
@@ -771,7 +799,7 @@ QString DocumentManager::getSaveFileNameWithExtension(const QString &title, cons
QString DocumentManager::getSaveAsFileName(const IDocument *document) QString DocumentManager::getSaveAsFileName(const IDocument *document)
{ {
QTC_ASSERT(document, return QString()); QTC_ASSERT(document, return QString());
const QString filter = Utils::allFiltersString(); const QString filter = allDocumentFactoryFiltersString();
const QString filePath = document->filePath().toString(); const QString filePath = document->filePath().toString();
QString selectedFilter; QString selectedFilter;
QString fileDialogPath = filePath; QString fileDialogPath = filePath;

View File

@@ -84,6 +84,8 @@ public:
const QString &fileName = QString(), const QString &fileName = QString(),
bool *isReadOnly = nullptr); bool *isReadOnly = nullptr);
static QString allDocumentFactoryFiltersString(QString *allFilesFilter);
static QStringList getOpenFileNames(const QString &filters, static QStringList getOpenFileNames(const QString &filters,
const QString &path = QString(), const QString &path = QString(),
QString *selectedFilter = nullptr); QString *selectedFilter = nullptr);

View File

@@ -2726,7 +2726,7 @@ void EditorManager::addCloseEditorListener(const std::function<bool (IEditor *)>
QStringList EditorManager::getOpenFileNames() QStringList EditorManager::getOpenFileNames()
{ {
QString selectedFilter; QString selectedFilter;
const QString &fileFilters = Utils::allFiltersString(&selectedFilter); const QString &fileFilters = DocumentManager::allDocumentFactoryFiltersString(&selectedFilter);
return DocumentManager::getOpenFileNames(fileFilters, QString(), &selectedFilter); return DocumentManager::getOpenFileNames(fileFilters, QString(), &selectedFilter);
} }

View File

@@ -4750,7 +4750,7 @@ public:
scopeAtInsertPos); scopeAtInsertPos);
QString funcDef = prefix + funcDec; QString funcDef = prefix + funcDec;
const int startPosition = m_fromFile->endOf(funcAST->declarator); 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 += m_fromFile->textOf(startPosition, endPosition);
funcDef += suffix; funcDef += suffix;

View File

@@ -83,8 +83,11 @@ QList<Core::LocatorFilterEntry> CppLocatorFilter::matchesFor(
m_data->filterAllFiles([&](const IndexItem::Ptr &info) -> IndexItem::VisitorResult { m_data->filterAllFiles([&](const IndexItem::Ptr &info) -> IndexItem::VisitorResult {
if (future.isCanceled()) if (future.isCanceled())
return IndexItem::Break; return IndexItem::Break;
if (info->type() & wanted) { const IndexItem::ItemType type = info->type();
if (type & wanted) {
QString matchString = hasColonColon ? info->scopedSymbolName() : info->symbolName(); QString matchString = hasColonColon ? info->scopedSymbolName() : info->symbolName();
if (type == IndexItem::Function)
matchString += info->symbolType();
QRegularExpressionMatch match = regexp.match(matchString); QRegularExpressionMatch match = regexp.match(matchString);
if (match.hasMatch()) { if (match.hasMatch()) {
Core::LocatorFilterEntry filterEntry = filterEntryFromIndexItem(info); Core::LocatorFilterEntry filterEntry = filterEntryFromIndexItem(info);

View File

@@ -196,10 +196,26 @@ void CppToolsPlugin::test_cpplocatorfilters_CppLocatorFilter_data()
<< _("pos") << _("pos")
<< (QList<ResultData>() << (QList<ResultData>()
<< ResultData(_("positiveNumber()"), testFileShort) << ResultData(_("positiveNumber()"), testFileShort)
<< ResultData(_("getPosition()"), testFileShort) << ResultData(_("matchArgument(Pos)"), testFileShort)
<< ResultData(_("pointOfService()"), testFileShort) << ResultData(_("pointOfService()"), testFileShort)
); );
QTest::newRow("CppFunctionsFilter-arguments")
<< testFile
<< cppFunctionsFilter
<< _("function*bool")
<< (QList<ResultData>()
<< ResultData(_("functionDefinedInClass(bool, int)"),
_("MyClass (file1.cpp)"))
<< ResultData(_("functionDefinedInClass(bool, int)"),
_("MyNamespace::MyClass (file1.cpp)"))
<< ResultData(_("functionDefinedInClass(bool, int)"),
_("<anonymous namespace>::MyClass (file1.cpp)"))
<< ResultData(_("myFunction(bool, int)"), testFileShort)
<< ResultData(_("myFunction(bool, int)"), _("MyNamespace (file1.cpp)"))
<< ResultData(_("myFunction(bool, int)"), _("<anonymous namespace> (file1.cpp)"))
);
QTest::newRow("CppFunctionsFilter-WithNamespacePrefix") QTest::newRow("CppFunctionsFilter-WithNamespacePrefix")
<< testFile << testFile
<< cppFunctionsFilter << cppFunctionsFilter
@@ -290,8 +306,9 @@ void CppToolsPlugin::test_cpplocatorfilters_CppCurrentDocumentFilter()
QList<ResultData> expectedResults = QList<ResultData>() QList<ResultData> expectedResults = QList<ResultData>()
<< ResultData(_("int myVariable"), _("")) << ResultData(_("int myVariable"), _(""))
<< ResultData(_("myFunction(bool, int)"), _("")) << ResultData(_("myFunction(bool, int)"), _(""))
<< ResultData(_("Pos"), _(""))
<< ResultData(_("pointOfService()"), _("")) << ResultData(_("pointOfService()"), _(""))
<< ResultData(_("getPosition()"), _("")) << ResultData(_("matchArgument(Pos)"), _(""))
<< ResultData(_("positiveNumber()"), _("")) << ResultData(_("positiveNumber()"), _(""))
<< ResultData(_("MyEnum"), _("")) << ResultData(_("MyEnum"), _(""))
<< ResultData(_("int V1"), _("MyEnum")) << ResultData(_("int V1"), _("MyEnum"))

View File

@@ -163,16 +163,17 @@ ProjectInfoGenerator::ProjectInfoGenerator(const QFutureInterface<void> &futureI
ProjectInfo ProjectInfoGenerator::generate() ProjectInfo ProjectInfoGenerator::generate()
{ {
m_projectInfo = ProjectInfo(m_projectUpdateInfo.project); ProjectInfo projectInfo(m_projectUpdateInfo.project);
for (const RawProjectPart &rpp : m_projectUpdateInfo.rawProjectParts) { for (const RawProjectPart &rpp : m_projectUpdateInfo.rawProjectParts) {
if (m_futureInterface.isCanceled()) if (m_futureInterface.isCanceled())
return ProjectInfo(); 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, static ProjectPart::Ptr projectPartFromRawProjectPart(const RawProjectPart &rawProjectPart,
@@ -196,8 +197,9 @@ static ProjectPart::Ptr projectPartFromRawProjectPart(const RawProjectPart &rawP
return part; return part;
} }
void ProjectInfoGenerator::createProjectParts(const RawProjectPart &rawProjectPart) QVector<ProjectPart::Ptr> ProjectInfoGenerator::createProjectParts(const RawProjectPart &rawProjectPart)
{ {
QVector<ProjectPart::Ptr> result;
ProjectFileCategorizer cat(rawProjectPart.displayName, ProjectFileCategorizer cat(rawProjectPart.displayName,
rawProjectPart.files, rawProjectPart.files,
rawProjectPart.fileClassifier); rawProjectPart.fileClassifier);
@@ -210,49 +212,50 @@ void ProjectInfoGenerator::createProjectParts(const RawProjectPart &rawProjectPa
if (rawProjectPart.qtVersion == ProjectPart::Qt4_8_6AndOlder) if (rawProjectPart.qtVersion == ProjectPart::Qt4_8_6AndOlder)
defaultVersion = ProjectPart::CXX11; defaultVersion = ProjectPart::CXX11;
if (cat.hasCxxSources()) { if (cat.hasCxxSources()) {
createProjectPart(rawProjectPart, result << createProjectPart(rawProjectPart,
part, part,
cat.cxxSources(), cat.cxxSources(),
cat.partName("C++"), cat.partName("C++"),
defaultVersion, defaultVersion,
ProjectPart::NoExtensions); ProjectPart::NoExtensions);
} }
if (cat.hasObjcxxSources()) { if (cat.hasObjcxxSources()) {
createProjectPart(rawProjectPart, result << createProjectPart(rawProjectPart,
part, part,
cat.objcxxSources(), cat.objcxxSources(),
cat.partName("Obj-C++"), cat.partName("Obj-C++"),
defaultVersion, defaultVersion,
ProjectPart::ObjectiveCExtensions); ProjectPart::ObjectiveCExtensions);
} }
if (cat.hasCSources()) { if (cat.hasCSources()) {
createProjectPart(rawProjectPart, result << createProjectPart(rawProjectPart,
part, part,
cat.cSources(), cat.cSources(),
cat.partName("C"), cat.partName("C"),
ProjectPart::LatestCVersion, ProjectPart::LatestCVersion,
ProjectPart::NoExtensions); ProjectPart::NoExtensions);
} }
if (cat.hasObjcSources()) { if (cat.hasObjcSources()) {
createProjectPart(rawProjectPart, result << createProjectPart(rawProjectPart,
part, part,
cat.objcSources(), cat.objcSources(),
cat.partName("Obj-C"), cat.partName("Obj-C"),
ProjectPart::LatestCVersion, ProjectPart::LatestCVersion,
ProjectPart::ObjectiveCExtensions); ProjectPart::ObjectiveCExtensions);
} }
} }
return result;
} }
void ProjectInfoGenerator::createProjectPart(const RawProjectPart &rawProjectPart, ProjectPart::Ptr ProjectInfoGenerator::createProjectPart(const RawProjectPart &rawProjectPart,
const ProjectPart::Ptr &templateProjectPart, const ProjectPart::Ptr &templateProjectPart,
const ProjectFiles &projectFiles, const ProjectFiles &projectFiles,
const QString &partName, const QString &partName,
ProjectPart::LanguageVersion languageVersion, ProjectPart::LanguageVersion languageVersion,
ProjectPart::LanguageExtensions languageExtensions) ProjectPart::LanguageExtensions languageExtensions)
{ {
ProjectPart::Ptr part(templateProjectPart->copy()); ProjectPart::Ptr part(templateProjectPart->copy());
part->displayName = partName; part->displayName = partName;
@@ -277,7 +280,7 @@ void ProjectInfoGenerator::createProjectPart(const RawProjectPart &rawProjectPar
part->languageExtensions |= languageExtensions; part->languageExtensions |= languageExtensions;
part->updateLanguageFeatures(); part->updateLanguageFeatures();
m_projectInfo.appendProjectPart(part); return part;
} }
} // namespace Internal } // namespace Internal

View File

@@ -41,19 +41,17 @@ public:
ProjectInfo generate(); ProjectInfo generate();
private: private:
void createProjectParts(const RawProjectPart &rawProjectPart); QVector<ProjectPart::Ptr> createProjectParts(const RawProjectPart &rawProjectPart);
void createProjectPart(const RawProjectPart &rawProjectPart, ProjectPart::Ptr createProjectPart(const RawProjectPart &rawProjectPart,
const ProjectPart::Ptr &templateProjectPart, const ProjectPart::Ptr &templateProjectPart,
const ProjectFiles &projectFiles, const ProjectFiles &projectFiles,
const QString &partName, const QString &partName,
ProjectPart::LanguageVersion languageVersion, ProjectPart::LanguageVersion languageVersion,
ProjectPart::LanguageExtensions languageExtensions); ProjectPart::LanguageExtensions languageExtensions);
private: private:
const QFutureInterface<void> &m_futureInterface; const QFutureInterface<void> m_futureInterface;
const ProjectUpdateInfo &m_projectUpdateInfo; const ProjectUpdateInfo &m_projectUpdateInfo;
ProjectInfo m_projectInfo;
}; };
} // namespace Internal } // namespace Internal
} // namespace CppTools } // namespace CppTools

View File

@@ -62,9 +62,8 @@ void CppProjectUpdater::update(const ProjectUpdateInfo &projectUpdateInfo)
this, &CppProjectUpdater::onToolChainRemoved); this, &CppProjectUpdater::onToolChainRemoved);
// Run the project info generator in a worker thread and continue if that one is finished. // Run the project info generator in a worker thread and continue if that one is finished.
const QFutureInterface<void> &futureInterface = m_futureInterface;
const QFuture<ProjectInfo> future = Utils::runAsync([=]() { const QFuture<ProjectInfo> future = Utils::runAsync([=]() {
Internal::ProjectInfoGenerator generator(futureInterface, projectUpdateInfo); Internal::ProjectInfoGenerator generator(m_futureInterface, projectUpdateInfo);
return generator.generate(); return generator.generate();
}); });
m_generateFutureWatcher.setFuture(future); m_generateFutureWatcher.setFuture(future);

View File

@@ -88,7 +88,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent),
d->m_architectureComboBox->addItem(Abi::toString(static_cast<Abi::Architecture>(i)), i); d->m_architectureComboBox->addItem(Abi::toString(static_cast<Abi::Architecture>(i)), i);
d->m_architectureComboBox->setCurrentIndex(static_cast<int>(Abi::UnknownArchitecture)); d->m_architectureComboBox->setCurrentIndex(static_cast<int>(Abi::UnknownArchitecture));
connect(d->m_architectureComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(d->m_architectureComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &AbiWidget::customAbiChanged); this, &AbiWidget::updateCustomItemData);
QLabel *separator1 = new QLabel(this); QLabel *separator1 = new QLabel(this);
separator1->setText(QLatin1String("-")); separator1->setText(QLatin1String("-"));
@@ -111,7 +111,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent),
d->m_osFlavorComboBox = new QComboBox(this); d->m_osFlavorComboBox = new QComboBox(this);
layout->addWidget(d->m_osFlavorComboBox); layout->addWidget(d->m_osFlavorComboBox);
connect(d->m_osFlavorComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(d->m_osFlavorComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &AbiWidget::customAbiChanged); this, &AbiWidget::updateCustomItemData);
QLabel *separator3 = new QLabel(this); QLabel *separator3 = new QLabel(this);
separator3->setText(QLatin1String("-")); separator3->setText(QLatin1String("-"));
@@ -124,7 +124,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent),
d->m_binaryFormatComboBox->addItem(Abi::toString(static_cast<Abi::BinaryFormat>(i)), i); d->m_binaryFormatComboBox->addItem(Abi::toString(static_cast<Abi::BinaryFormat>(i)), i);
d->m_binaryFormatComboBox->setCurrentIndex(static_cast<int>(Abi::UnknownFormat)); d->m_binaryFormatComboBox->setCurrentIndex(static_cast<int>(Abi::UnknownFormat));
connect(d->m_binaryFormatComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(d->m_binaryFormatComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &AbiWidget::customAbiChanged); this, &AbiWidget::updateCustomItemData);
QLabel *separator4 = new QLabel(this); QLabel *separator4 = new QLabel(this);
separator4->setText(QLatin1String("-")); separator4->setText(QLatin1String("-"));
@@ -139,7 +139,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent),
d->m_wordWidthComboBox->addItem(Abi::toString(0), 0); d->m_wordWidthComboBox->addItem(Abi::toString(0), 0);
d->m_wordWidthComboBox->setCurrentIndex(2); d->m_wordWidthComboBox->setCurrentIndex(2);
connect(d->m_wordWidthComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(d->m_wordWidthComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &AbiWidget::customAbiChanged); this, &AbiWidget::updateCustomItemData);
layout->setStretchFactor(d->m_abi, 1); layout->setStretchFactor(d->m_abi, 1);
@@ -164,24 +164,23 @@ void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi &current)
defaultAbi = Abi::hostAbi(); defaultAbi = Abi::hostAbi();
} }
d->m_abi->addItem(tr("<custom>"), defaultAbi.toString()); d->m_abi->addItem(tr("<custom>"));
d->m_abi->setCurrentIndex(0); d->m_abi->setCurrentIndex(0);
setCustomAbi(defaultAbi);
for (int i = 0; i < abiList.count(); ++i) { for (int i = 0; i < abiList.count(); ++i) {
int index = i + 1; int index = i + 1;
const QString abiString = abiList.at(i).toString(); const QString abiString = abiList.at(i).toString();
d->m_abi->insertItem(index, abiString, abiString); 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->setCurrentIndex(index);
} }
d->m_abi->setVisible(!abiList.isEmpty()); d->m_abi->setVisible(!abiList.isEmpty());
if (d->isCustom()) { if (d->isCustom() && !current.isValid() && !abiList.isEmpty())
if (!current.isValid() && !abiList.isEmpty()) d->m_abi->setCurrentIndex(1); // default to the first Abi if none is selected.
d->m_abi->setCurrentIndex(1); // default to the first Abi if none is selected.
else
setCustomAbi(current);
}
modeChanged(); modeChanged();
} }
@@ -215,7 +214,7 @@ void AbiWidget::osChanged()
d->m_osFlavorComboBox->addItem(Abi::toString(f), static_cast<int>(f)); d->m_osFlavorComboBox->addItem(Abi::toString(f), static_cast<int>(f));
d->m_osFlavorComboBox->setCurrentIndex(0); // default to generic flavor d->m_osFlavorComboBox->setCurrentIndex(0); // default to generic flavor
} }
customAbiChanged(); updateCustomItemData();
} }
void AbiWidget::modeChanged() void AbiWidget::modeChanged()
@@ -230,11 +229,8 @@ void AbiWidget::modeChanged()
setCustomAbi(currentAbi()); setCustomAbi(currentAbi());
} }
void AbiWidget::customAbiChanged() void AbiWidget::updateCustomItemData()
{ {
if (signalsBlocked())
return;
Abi current(static_cast<Abi::Architecture>(d->m_architectureComboBox->currentIndex()), Abi current(static_cast<Abi::Architecture>(d->m_architectureComboBox->currentIndex()),
static_cast<Abi::OS>(d->m_osComboBox->currentIndex()), static_cast<Abi::OS>(d->m_osComboBox->currentIndex()),
static_cast<Abi::OSFlavor>(d->m_osFlavorComboBox->itemData(d->m_osFlavorComboBox->currentIndex()).toInt()), static_cast<Abi::OSFlavor>(d->m_osFlavorComboBox->itemData(d->m_osFlavorComboBox->currentIndex()).toInt()),
@@ -265,8 +261,7 @@ void AbiWidget::setCustomAbi(const Abi &current)
break; break;
} }
} }
if (d->isCustom()) updateCustomItemData();
d->m_abi->setItemData(0, current.toString());
} }
emit abiChanged(); emit abiChanged();

View File

@@ -57,7 +57,7 @@ signals:
private: private:
void osChanged(); void osChanged();
void modeChanged(); void modeChanged();
void customAbiChanged(); void updateCustomItemData();
void setCustomAbi(const Abi &a); void setCustomAbi(const Abi &a);

View File

@@ -177,6 +177,13 @@ QList<HeaderPath> GccToolChain::gccHeaderPaths(const FileName &gcc, const QStrin
return systemHeaderPaths; return systemHeaderPaths;
} }
void GccToolChain::toolChainUpdated()
{
m_predefinedMacrosCache->invalidate();
m_headerPathsCache->invalidate();
ToolChain::toolChainUpdated();
}
static QList<Abi> guessGccAbi(const QString &m, const ProjectExplorer::Macros &macros) static QList<Abi> guessGccAbi(const QString &m, const ProjectExplorer::Macros &macros)
{ {
QList<Abi> abiList; QList<Abi> abiList;
@@ -245,7 +252,7 @@ GccToolChain::GccToolChain(Detection d) :
GccToolChain::GccToolChain(Core::Id typeId, Detection d) : GccToolChain::GccToolChain(Core::Id typeId, Detection d) :
ToolChain(typeId, d), ToolChain(typeId, d),
m_predefinedMacrosCache(std::make_shared<Cache<QVector<Macro>>>()), m_predefinedMacrosCache(std::make_shared<Cache<QVector<Macro>, 64>>()),
m_headerPathsCache(std::make_shared<Cache<QList<HeaderPath>>>()) m_headerPathsCache(std::make_shared<Cache<QList<HeaderPath>>>())
{ } { }
@@ -385,7 +392,7 @@ ToolChain::PredefinedMacrosRunner GccToolChain::createPredefinedMacrosRunner() c
const QStringList platformCodeGenFlags = m_platformCodeGenFlags; const QStringList platformCodeGenFlags = m_platformCodeGenFlags;
OptionsReinterpreter reinterpretOptions = m_optionsReinterpreter; OptionsReinterpreter reinterpretOptions = m_optionsReinterpreter;
QTC_CHECK(reinterpretOptions); QTC_CHECK(reinterpretOptions);
std::shared_ptr<Cache<QVector<Macro>>> macroCache = m_predefinedMacrosCache; std::shared_ptr<Cache<QVector<Macro>, 64>> macroCache = m_predefinedMacrosCache;
Core::Id lang = language(); Core::Id lang = language();
// This runner must be thread-safe! // This runner must be thread-safe!

View File

@@ -104,6 +104,12 @@ public:
return checkImpl(compilerArguments); return checkImpl(compilerArguments);
} }
void invalidate()
{
QMutexLocker locker(&m_mutex);
m_cache.clear();
}
private: private:
Utils::optional<T> checkImpl(const QStringList &compilerArguments) Utils::optional<T> checkImpl(const QStringList &compilerArguments)
{ {
@@ -217,6 +223,7 @@ protected:
bool m_doesEnable = false; bool m_doesEnable = false;
bool m_triggered = false; bool m_triggered = false;
}; };
void toolChainUpdated() override;
private: private:
explicit GccToolChain(Detection d); explicit GccToolChain(Detection d);
@@ -235,7 +242,7 @@ private:
mutable QList<HeaderPath> m_headerPaths; mutable QList<HeaderPath> m_headerPaths;
mutable QString m_version; mutable QString m_version;
mutable std::shared_ptr<Cache<QVector<Macro>>> m_predefinedMacrosCache; mutable std::shared_ptr<Cache<QVector<Macro>, 64>> m_predefinedMacrosCache;
mutable std::shared_ptr<Cache<QList<HeaderPath>>> m_headerPathsCache; mutable std::shared_ptr<Cache<QList<HeaderPath>>> m_headerPathsCache;
friend class Internal::GccToolChainConfigWidget; friend class Internal::GccToolChainConfigWidget;

View File

@@ -158,7 +158,7 @@ protected:
explicit ToolChain(Core::Id typeId, Detection d); explicit ToolChain(Core::Id typeId, Detection d);
explicit ToolChain(const ToolChain &); explicit ToolChain(const ToolChain &);
void toolChainUpdated(); virtual void toolChainUpdated();
// Make sure to call this function when deriving! // Make sure to call this function when deriving!
virtual bool fromMap(const QVariantMap &data); virtual bool fromMap(const QVariantMap &data);

View File

@@ -44,20 +44,21 @@ namespace QmakeProjectManager {
*/ */
QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode,
const FileName &filePath) : const FileName &filePath, QmakePriFile *pf) :
ProjectNode(filePath), ProjectNode(filePath),
m_project(project), m_project(project),
m_qmakeProFileNode(qmakeProFileNode) m_qmakeProFileNode(qmakeProFileNode),
m_qmakePriFile(pf)
{ } { }
QmakePriFile *QmakePriFileNode::priFile() const QmakePriFile *QmakePriFileNode::priFile() const
{ {
return m_project->rootProFile()->findPriFile(filePath()); return m_qmakePriFile;
} }
bool QmakePriFileNode::deploysFolder(const QString &folder) const bool QmakePriFileNode::deploysFolder(const QString &folder) const
{ {
QmakePriFile *pri = priFile(); const QmakePriFile *pri = priFile();
return pri ? pri->deploysFolder(folder) : false; 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 bool QmakePriFileNode::canAddSubProject(const QString &proFilePath) const
{ {
QmakePriFile *pri = priFile(); const QmakePriFile *pri = priFile();
return pri ? pri->canAddSubProject(proFilePath) : false; return pri ? pri->canAddSubProject(proFilePath) : false;
} }
@@ -213,8 +214,8 @@ QmakeProFileNode *QmakeProFileNode::findProFileFor(const FileName &fileName) con
\class QmakeProFileNode \class QmakeProFileNode
Implements abstract ProjectNode class Implements abstract ProjectNode class
*/ */
QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FileName &filePath) : QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FileName &filePath, QmakeProFile *pf) :
QmakePriFileNode(project, this, filePath) QmakePriFileNode(project, this, filePath, pf)
{ } { }
bool QmakeProFileNode::showInSimpleTree() const bool QmakeProFileNode::showInSimpleTree() const
@@ -224,7 +225,7 @@ bool QmakeProFileNode::showInSimpleTree() const
QmakeProFile *QmakeProFileNode::proFile() const QmakeProFile *QmakeProFileNode::proFile() const
{ {
return m_project->rootProFile()->findProFile(filePath()); return static_cast<QmakeProFile*>(QmakePriFileNode::priFile());
} }
FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const

View File

@@ -42,7 +42,7 @@ class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::Proj
{ {
public: public:
QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode,
const Utils::FileName &filePath); const Utils::FileName &filePath, QmakePriFile *pf);
QmakePriFile *priFile() const; QmakePriFile *priFile() const;
@@ -73,13 +73,14 @@ protected:
private: private:
QmakeProFileNode *m_qmakeProFileNode = nullptr; QmakeProFileNode *m_qmakeProFileNode = nullptr;
QmakePriFile *m_qmakePriFile = nullptr;
}; };
// Implements ProjectNode for qmake .pro files // Implements ProjectNode for qmake .pro files
class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode
{ {
public: public:
QmakeProFileNode(QmakeProject *project, const Utils::FileName &filePath); QmakeProFileNode(QmakeProject *project, const Utils::FileName &filePath, QmakeProFile *pf);
QmakeProFile *proFile() const; QmakeProFile *proFile() const;

View File

@@ -183,12 +183,12 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi
} }
// Virtual folders: // Virtual folders:
for (const QmakePriFile *c : pri->children()) { for (QmakePriFile *c : pri->children()) {
QmakePriFileNode *newNode = nullptr; QmakePriFileNode *newNode = nullptr;
if (dynamic_cast<const QmakeProFile *>(c)) if (auto pf = dynamic_cast<QmakeProFile *>(c))
newNode = new QmakeProFileNode(c->project(), c->filePath()); newNode = new QmakeProFileNode(c->project(), c->filePath(), pf);
else else
newNode = new QmakePriFileNode(c->project(), node->proFileNode(), c->filePath()); newNode = new QmakePriFileNode(c->project(), node->proFileNode(), c->filePath(), c);
createTree(c, newNode, toExclude); createTree(c, newNode, toExclude);
node->addNode(newNode); node->addNode(newNode);
} }
@@ -203,7 +203,7 @@ QmakeProFileNode *QmakeNodeTreeBuilder::buildTree(QmakeProject *project)
const FileNameList toExclude = qt ? qt->directoriesToIgnoreInProjectTree() : FileNameList(); 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); createTree(project->rootProFile(), root, toExclude);
return root; return root;

View File

@@ -43,6 +43,7 @@
#include <qtsupport/profilereader.h> #include <qtsupport/profilereader.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/asconst.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/mimetypes/mimedatabase.h> #include <utils/mimetypes/mimedatabase.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
@@ -199,12 +200,22 @@ QmakePriFile *QmakePriFile::findPriFile(const FileName &fileName)
{ {
if (fileName == filePath()) if (fileName == filePath())
return this; return this;
for (QmakePriFile *n : children()) { for (QmakePriFile *n : Utils::asConst(m_children)) {
if (QmakePriFile *result = n->findPriFile(fileName)) if (QmakePriFile *result = n->findPriFile(fileName))
return result; return result;
} }
return nullptr; 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() void QmakePriFile::makeEmpty()
@@ -1009,7 +1020,12 @@ static ProjectType proFileTemplateTypeToProjectType(ProFileEvaluator::TemplateTy
QmakeProFile *QmakeProFile::findProFile(const FileName &fileName) QmakeProFile *QmakeProFile::findProFile(const FileName &fileName)
{ {
return dynamic_cast<QmakeProFile *>(findPriFile(fileName)); return static_cast<QmakeProFile *>(findPriFile(fileName));
}
const QmakeProFile *QmakeProFile::findProFile(const FileName &fileName) const
{
return static_cast<const QmakeProFile *>(findPriFile(fileName));
} }
QString QmakeProFile::makefile() const QString QmakeProFile::makefile() const
@@ -1406,6 +1422,7 @@ QmakeEvalResult *QmakeProFile::evaluate(const QmakeEvalInput &input)
result->newVarValues[Variable::IncludePath] = includePaths(exactReader, input.sysroot, result->newVarValues[Variable::IncludePath] = includePaths(exactReader, input.sysroot,
input.buildDirectory, input.projectDir); input.buildDirectory, input.projectDir);
result->newVarValues[Variable::CppFlags] = exactReader->values(QLatin1String("QMAKE_CXXFLAGS")); result->newVarValues[Variable::CppFlags] = exactReader->values(QLatin1String("QMAKE_CXXFLAGS"));
result->newVarValues[Variable::CFlags] = exactReader->values(QLatin1String("QMAKE_CFLAGS"));
result->newVarValues[Variable::Source] = result->newVarValues[Variable::Source] =
fileListForVar(exactSourceFiles, QLatin1String("SOURCES")) + fileListForVar(exactSourceFiles, QLatin1String("SOURCES")) +
fileListForVar(cumulativeSourceFiles, 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::CumulativeResource] = fileListForVar(cumulativeSourceFiles, QLatin1String("RESOURCES"));
result->newVarValues[Variable::PkgConfig] = exactReader->values(QLatin1String("PKGCONFIG")); result->newVarValues[Variable::PkgConfig] = exactReader->values(QLatin1String("PKGCONFIG"));
result->newVarValues[Variable::PrecompiledHeader] = ProFileEvaluator::sourcesToFiles(exactReader->fixifiedValues( 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::LibDirectories] = libDirectories(exactReader);
result->newVarValues[Variable::Config] = exactReader->values(QLatin1String("CONFIG")); result->newVarValues[Variable::Config] = exactReader->values(QLatin1String("CONFIG"));
result->newVarValues[Variable::QmlImportPath] = exactReader->absolutePathValues( result->newVarValues[Variable::QmlImportPath] = exactReader->absolutePathValues(
@@ -1475,7 +1492,7 @@ void QmakeProFile::asyncEvaluate(QFutureInterface<QmakeEvalResult *> &fi, QmakeE
void QmakeProFile::applyAsyncEvaluate() void QmakeProFile::applyAsyncEvaluate()
{ {
applyEvaluate(m_parseFutureWatcher.result()); applyEvaluate(m_parseFutureWatcher.result());
m_project->decrementPendingEvaluateFutures(validParse()); m_project->decrementPendingEvaluateFutures();
} }
bool sortByParserNodes(Node *a, Node *b) bool sortByParserNodes(Node *a, Node *b)
@@ -1659,7 +1676,8 @@ QStringList QmakeProFile::includePaths(QtSupport::ProFileReader *reader, const F
} }
foreach (const ProFileEvaluator::SourceFile &el, 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 << 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 // 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; result.targetPath = itemPath;
} else { } else {
const auto &itemFiles = reader->fixifiedValues( const auto &itemFiles = reader->fixifiedValues(
item + QLatin1String(".files"), projectDir, buildDir); item + QLatin1String(".files"), projectDir, buildDir, true);
result.items << InstallsItem(itemPath, itemFiles, active); result.items << InstallsItem(itemPath, itemFiles, active);
} }
} }

View File

@@ -64,6 +64,7 @@ enum class Variable {
Defines = 1, Defines = 1,
IncludePath, IncludePath,
CppFlags, CppFlags,
CFlags,
Source, Source,
ExactResource, ExactResource,
CumulativeResource, CumulativeResource,
@@ -121,6 +122,7 @@ public:
QVector<QmakePriFile *> children() const; QVector<QmakePriFile *> children() const;
QmakePriFile *findPriFile(const Utils::FileName &fileName); QmakePriFile *findPriFile(const Utils::FileName &fileName);
const QmakePriFile *findPriFile(const Utils::FileName &fileName) const;
bool knowsFile(const Utils::FileName &filePath) const; bool knowsFile(const Utils::FileName &filePath) const;
@@ -280,6 +282,7 @@ public:
QList<QmakeProFile *> allProFiles(); QList<QmakeProFile *> allProFiles();
QmakeProFile *findProFile(const Utils::FileName &fileName); QmakeProFile *findProFile(const Utils::FileName &fileName);
const QmakeProFile *findProFile(const Utils::FileName &fileName) const;
ProjectType projectType() const; ProjectType projectType() const;

View File

@@ -294,8 +294,8 @@ void QmakeProject::updateCppCodeModel()
rpp.setBuildTargetType(isExecutable ? CppTools::ProjectPart::Executable rpp.setBuildTargetType(isExecutable ? CppTools::ProjectPart::Executable
: CppTools::ProjectPart::Library); : CppTools::ProjectPart::Library);
// TODO: Handle QMAKE_CFLAGS
rpp.setFlagsForCxx({cxxToolChain, pro->variableValue(Variable::CppFlags)}); rpp.setFlagsForCxx({cxxToolChain, pro->variableValue(Variable::CppFlags)});
rpp.setFlagsForC({cToolChain, pro->variableValue(Variable::CFlags)});
rpp.setMacros(ProjectExplorer::Macro::toMacros(pro->cxxDefines())); rpp.setMacros(ProjectExplorer::Macro::toMacros(pro->cxxDefines()));
rpp.setPreCompiledHeaders(pro->variableValue(Variable::PrecompiledHeader)); rpp.setPreCompiledHeaders(pro->variableValue(Variable::PrecompiledHeader));
rpp.setSelectedForBuilding(pro->includedInExactParse()); rpp.setSelectedForBuilding(pro->includedInExactParse());
@@ -500,24 +500,20 @@ void QmakeProject::startAsyncTimer(QmakeProFile::AsyncUpdateDelay delay)
void QmakeProject::incrementPendingEvaluateFutures() void QmakeProject::incrementPendingEvaluateFutures()
{ {
++m_pendingEvaluateFuturesCount; ++m_pendingEvaluateFuturesCount;
if (m_pendingEvaluateFuturesCount == 1)
m_totalEvaluationSuccess = true;
m_asyncUpdateFutureInterface->setProgressRange(m_asyncUpdateFutureInterface->progressMinimum(), m_asyncUpdateFutureInterface->setProgressRange(m_asyncUpdateFutureInterface->progressMinimum(),
m_asyncUpdateFutureInterface->progressMaximum() + 1); m_asyncUpdateFutureInterface->progressMaximum() + 1);
} }
void QmakeProject::decrementPendingEvaluateFutures(bool success) void QmakeProject::decrementPendingEvaluateFutures()
{ {
--m_pendingEvaluateFuturesCount; --m_pendingEvaluateFuturesCount;
m_totalEvaluationSuccess = m_totalEvaluationSuccess && success;
m_asyncUpdateFutureInterface->setProgressValue(m_asyncUpdateFutureInterface->progressValue() + 1); m_asyncUpdateFutureInterface->setProgressValue(m_asyncUpdateFutureInterface->progressValue() + 1);
if (m_pendingEvaluateFuturesCount == 0) { if (m_pendingEvaluateFuturesCount == 0) {
// We are done! // We are done!
setRootProjectNode(QmakeNodeTreeBuilder::buildTree(this)); setRootProjectNode(QmakeNodeTreeBuilder::buildTree(this));
if (!m_totalEvaluationSuccess) if (!m_rootProFile->validParse())
m_asyncUpdateFutureInterface->reportCanceled(); m_asyncUpdateFutureInterface->reportCanceled();
m_asyncUpdateFutureInterface->reportFinished(); m_asyncUpdateFutureInterface->reportFinished();

View File

@@ -100,7 +100,7 @@ public:
/// \internal /// \internal
void incrementPendingEvaluateFutures(); void incrementPendingEvaluateFutures();
/// \internal /// \internal
void decrementPendingEvaluateFutures(bool success); void decrementPendingEvaluateFutures();
/// \internal /// \internal
bool wasEvaluateCanceled(); bool wasEvaluateCanceled();
@@ -186,7 +186,6 @@ private:
// cached data during project rescan // cached data during project rescan
QMakeGlobals *m_qmakeGlobals = nullptr; QMakeGlobals *m_qmakeGlobals = nullptr;
int m_qmakeGlobalsRefCnt = 0; int m_qmakeGlobalsRefCnt = 0;
bool m_totalEvaluationSuccess = false;
QString m_qmakeSysroot; QString m_qmakeSysroot;

View File

@@ -455,6 +455,9 @@ static Core::MiniSplitter *createCentralSplitter(const QList<WidgetInfo> &widget
outputPlaceholderSplitter->setStretchFactor(1, 0); outputPlaceholderSplitter->setStretchFactor(1, 0);
outputPlaceholderSplitter->setOrientation(Qt::Vertical); outputPlaceholderSplitter->setOrientation(Qt::Vertical);
QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css"));
outputPlaceholderSplitter->setStyleSheet(Theme::replaceCssColors(sheet));
SwitchSplitTabWidget *switchSplitTabWidget = new SwitchSplitTabWidget(); SwitchSplitTabWidget *switchSplitTabWidget = new SwitchSplitTabWidget();
foreach (const WidgetInfo &widgetInfo, widgetInfos) { foreach (const WidgetInfo &widgetInfo, widgetInfos) {

View File

@@ -257,18 +257,19 @@ public:
QPalette pal; QPalette pal;
pal.setColor(QPalette::Base, themeColor(Theme::Welcome_BackgroundColor)); 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->setFrame(false);
m_lineEdit->setFont(sizedFont(14, this)); m_lineEdit->setFont(sizedFont(14, this));
m_lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); m_lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
m_lineEdit->setPalette(pal); m_lineEdit->setPalette(pal);
auto box = new QHBoxLayout(this); auto box = new QHBoxLayout(this);
box->setContentsMargins(15, 3, 15, 3); box->setContentsMargins(10, 3, 3, 3);
box->addWidget(m_lineEdit); box->addWidget(m_lineEdit);
} }
QLineEdit *m_lineEdit; FancyLineEdit *m_lineEdit;
}; };
class GridView : public QTableView class GridView : public QTableView

View File

@@ -9,7 +9,6 @@ STATIC_INSTALL_BASE = $$INSTALL_DATA_PATH
STATIC_FILES = \ STATIC_FILES = \
$$PWD/externaltools/lrelease.xml \ $$PWD/externaltools/lrelease.xml \
$$PWD/externaltools/lupdate.xml \ $$PWD/externaltools/lupdate.xml \
$$PWD/externaltools/sort.xml \
$$PWD/externaltools/qmlviewer.xml \ $$PWD/externaltools/qmlviewer.xml \
$$PWD/externaltools/qmlscene.xml $$PWD/externaltools/qmlscene.xml
unix { unix {

View File

@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
-->
<externaltool id="sort">
<description>Sorts the selected text</description>
<displayname>Sort Selection</displayname>
<category>Text</category>
<executable output="replaceselection" error="ignore">
<path>sort</path>
<input>%{CurrentDocument:Selection}</input>
<workingdirectory>%{CurrentDocument:Path}</workingdirectory>
</executable>
</externaltool>

View File

@@ -77,7 +77,8 @@ QStringList ProFileEvaluator::values(const QString &variableName) const
} }
QVector<ProFileEvaluator::SourceFile> ProFileEvaluator::fixifiedValues( QVector<ProFileEvaluator::SourceFile> 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<SourceFile> result; QVector<SourceFile> result;
foreach (const ProString &str, d->values(ProKey(variable))) { foreach (const ProString &str, d->values(ProKey(variable))) {
@@ -86,11 +87,29 @@ QVector<ProFileEvaluator::SourceFile> ProFileEvaluator::fixifiedValues(
result << SourceFile{QDir::cleanPath(el), str.sourceFile()}; result << SourceFile{QDir::cleanPath(el), str.sourceFile()};
} else { } else {
QString fn = QDir::cleanPath(baseDirectory + QLatin1Char('/') + el); QString fn = QDir::cleanPath(baseDirectory + QLatin1Char('/') + el);
if (IoUtils::exists(fn)) if (IoUtils::exists(fn)) {
result << SourceFile{fn, str.sourceFile()}; result << SourceFile{fn, str.sourceFile()};
else } else {
result << SourceFile{QDir::cleanPath(buildDirectory + QLatin1Char('/') + el), QStringRef fileNamePattern;
str.sourceFile()}; 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; return result;

View File

@@ -81,7 +81,8 @@ public:
QString value(const QString &variableName) const; QString value(const QString &variableName) const;
QStringList values(const QString &variableName) const; QStringList values(const QString &variableName) const;
QVector<SourceFile> fixifiedValues( QVector<SourceFile> 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; QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const;
QVector<SourceFile> absoluteFileValues( QVector<SourceFile> absoluteFileValues(
const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, const QString &variable, const QString &baseDirectory, const QStringList &searchDirs,

View File

@@ -12,8 +12,9 @@ int myVariable;
int myFunction(bool yesno, int number) {} int myFunction(bool yesno, int number) {}
struct Pos {};
void pointOfService() {} void pointOfService() {}
int getPosition() { return 0; } int matchArgument(Pos p) { return 0; }
int positiveNumber() { return 2; } int positiveNumber() { return 2; }
enum MyEnum { V1, V2 }; enum MyEnum { V1, V2 };