Merge remote-tracking branch 'origin/4.3'

Conflicts:
	src/plugins/genericprojectmanager/genericproject.cpp
	src/plugins/genericprojectmanager/genericproject.h
	src/plugins/projectexplorer/projectmodels.cpp

Change-Id: I290cba328212cadd3c12909d1f2f3642d326a1ca
This commit is contained in:
Eike Ziller
2017-03-28 09:56:16 +02:00
139 changed files with 1057 additions and 1111 deletions

View File

@@ -51,9 +51,7 @@ depends += qtwidgets \
qtgui \
qthelp \
qtquickcontrols \
qtquicklayouts \
qtlinguist \
qtscript \
qtsensors \
qtuitools \
qtwebkit \

View File

@@ -40,7 +40,6 @@ depends += qtwidgets \
qtquickcontrols2 \
qtquickextras \
qtlinguist \
qtscript \
qtscxml \
qtsensors \
qttestlib \

View File

@@ -1,7 +1,7 @@
build_online_docs: \
QTC_DOCS = $$PWD/qtcreator-online.qdocconf $$PWD/api/qtcreator-dev-online.qdocconf
DOC_FILES += $$PWD/qtcreator-online.qdocconf $$PWD/api/qtcreator-dev-online.qdocconf
else: \
QTC_DOCS = $$PWD/qtcreator.qdocconf $$PWD/api/qtcreator-dev.qdocconf
DOC_FILES += $$PWD/qtcreator.qdocconf $$PWD/api/qtcreator-dev.qdocconf
include(../docs.pri)

81
doc/doc_targets.pri Normal file
View File

@@ -0,0 +1,81 @@
# Creates targets for building documentation
# (adapted from qt_docs.prf)
#
# Usage: Define variables (details below) and include this pri file afterwards.
#
# QDOC_ENV - environment variables to set for the qdoc call (see example below)
# DOC_INDEX_PATHS - list of paths where qdoc should search for index files of dependent
# modules (Qt index path is included by default)
# DOC_FILES - list of qdocconf files
# DOC_OUTDIR_POSTFIX - html is generated in $$OUT_PWD/<qdocconf_name>$$DOC_OUTDIR_POSTFIX
# DOC_HTML_INSTALLDIR - path were to install the directory of html files
# DOC_QCH_OUTDIR - path where to generated the qch files
# DOC_QCH_INSTALLDIR - path where to install the qch files
#
# Example for QDOC_ENV:
# ver.name = VERSION
# ver.value = 1.0.2
# foo.name = FOO
# foo.value = foo
# QDOC_ENV = ver foo
isEmpty(DOC_FILES): error("Set DOC_FILES before including doc_targets.pri")
isEmpty(DOC_HTML_INSTALLDIR): error("Set DOC_HTML_INSTALLDIR before including doc_targets.pri")
isEmpty(DOC_QCH_OUTDIR): error("Set DOC_QCH_OUTDIR before including doc_targets.pri")
isEmpty(DOC_QCH_INSTALLDIR): error("Set DOC_QCH_INSTALLDIR before including doc_targets.pri")
QT_TOOL_ENV = $$QDOC_ENV
qtPrepareTool(QDOC, qdoc)
QT_TOOL_ENV =
!build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
DOCS_BASE_OUTDIR = $$OUT_PWD/doc
DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS])
for (index_path, DOC_INDEX_PATHS): \
DOC_INDEXES += -indexdir $$shell_quote($$index_path)
for (doc_file, DOC_FILES) {
!exists($$doc_file): error("Cannot find documentation specification file $$doc_file")
DOC_TARGET = $$replace(doc_file, ^(.*/)?(.*)\\.qdocconf$, \\2)
DOC_TARGETDIR = $$DOC_TARGET
DOC_OUTPUTDIR = $${DOCS_BASE_OUTDIR}/$${DOC_TARGETDIR}$${DOC_OUTDIR_POSTFIX}
html_docs_$${DOC_TARGET}.commands = $$QDOC -outputdir $$shell_quote($$DOC_OUTPUTDIR) $$doc_file $$DOC_INDEXES
QMAKE_EXTRA_TARGETS += html_docs_$${DOC_TARGET}
!isEmpty(html_docs.commands): html_docs.commands += &&
html_docs.commands += $$eval(html_docs_$${DOC_TARGET}.commands)
inst_html_docs.files += $$DOC_OUTPUTDIR
!build_online_docs {
qch_docs_$${DOC_TARGET}.commands = $$QHELPGENERATOR $$shell_quote($$DOC_OUTPUTDIR/$${DOC_TARGET}.qhp) -o $$shell_quote($$DOC_QCH_OUTDIR/$${DOC_TARGET}.qch)
qch_docs_$${DOC_TARGET}.depends = html_docs_$${DOC_TARGET}
QMAKE_EXTRA_TARGETS += qch_docs_$${DOC_TARGET}
!isEmpty(qch_docs.commands): qch_docs.commands += &&
qch_docs.commands += $$eval(qch_docs_$${DOC_TARGET}.commands)
inst_qch_docs.files += $$DOC_QCH_OUTDIR/$${DOC_TARGET}.qch
}
}
!build_online_docs {
qch_docs.depends = html_docs
inst_qch_docs.path = $$DOC_QCH_INSTALLDIR
inst_qch_docs.CONFIG += no_check_exist no_default_install no_build
install_docs.depends = install_inst_qch_docs
docs.depends = qch_docs
INSTALLS += inst_qch_docs
QMAKE_EXTRA_TARGETS += qch_docs install_docs
} else {
docs.depends = html_docs
}
inst_html_docs.path = $$DOC_HTML_INSTALLDIR
inst_html_docs.CONFIG += no_check_exist no_default_install directory
INSTALLS += inst_html_docs
install_docs.depends += install_inst_html_docs
QMAKE_EXTRA_TARGETS += html_docs docs

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 168 KiB

View File

@@ -292,11 +292,6 @@
If your Git project uses Gerrit for code reviews, you can view your changes
in \QC.
Select \uicontrol Tools > \uicontrol Options > \uicontrol {Version Control}
> \uicontrol Gerrit to specify the connection to the Gerrit server.
\image qtcreator-gerrit-options.png
To push committed changes to Gerrit, select \uicontrol Tools >
\uicontrol Git > \uicontrol {Remote Repository} >
\uicontrol {Push to Gerrit}.
@@ -319,6 +314,17 @@
To refresh the list of changes, select \uicontrol Refresh.
The \uicontrol Remote field lists the remotes of the current repository that
are detected as Gerrit servers. Select \uicontrol Tools > \uicontrol Options
> \uicontrol {Version Control} > \uicontrol Gerrit to specify a fallback
connection to a Gerrit server over SSH. The Gerrit REST interface and the
\l{https://curl.haxx.se/}{curl} tool are used for HTTP connections.
Select the \uicontrol HTTPS check box to prepend \c https to the Gerrit URL
if Gerrit does not provide it.
\image qtcreator-gerrit-options.png
\section1 Working with Git Tools
To start a graphical interface to Git, select \uicontrol Tools >

View File

@@ -1,4 +1,7 @@
# adapted from qt_docs.prf
# Creates targets for building Qt Creator documentation
#
# Usage: Include qtcreator.pri and define DOC_FILES to point to a list of qdocconf files,
# then include this .pri file
isEmpty(VERSION): error("Include qtcreator.pri before including docs.pri!")
@@ -12,50 +15,11 @@ qdocindex.name = QDOC_INDEX_DIR
qdocindex.value = $$[QT_INSTALL_DOCS]
qtcdocsdir.name = QTC_DOCS_DIR
qtcdocsdir.value = $$IDE_SOURCE_TREE/doc
QT_TOOL_ENV = qtcver qtcvertag qtdocs qdocindex qtcdocsdir
qtPrepareTool(QDOC, qdoc)
QT_TOOL_ENV =
QDOC_ENV += qtcver qtcvertag qtdocs qdocindex qtcdocsdir
!build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
DOC_INDEX_PATHS += $$IDE_BUILD_TREE/doc
DOC_HTML_INSTALLDIR = $$INSTALL_DOC_PATH
DOC_QCH_OUTDIR = $$IDE_DOC_PATH
DOC_QCH_INSTALLDIR = $$INSTALL_DOC_PATH
QTC_DOCS_BASE_OUTDIR = $$OUT_PWD/doc
DOC_INDEXES = -indexdir $$shell_quote($$[QT_INSTALL_DOCS]) \
-indexdir $$shell_quote($$IDE_BUILD_TREE/doc)
for (qtc_doc, QTC_DOCS) {
!exists($$qtc_doc): error("Cannot find documentation specification file $$qtc_doc")
QTC_DOCS_TARGET = $$replace(qtc_doc, ^(.*/)?(.*)\\.qdocconf$, \\2)
QTC_DOCS_TARGETDIR = $$QTC_DOCS_TARGET
QTC_DOCS_OUTPUTDIR = $$QTC_DOCS_BASE_OUTDIR/$$QTC_DOCS_TARGETDIR
html_docs_$${QTC_DOCS_TARGET}.commands = $$QDOC -outputdir $$shell_quote($$QTC_DOCS_OUTPUTDIR) $$qtc_doc $$DOC_INDEXES
QMAKE_EXTRA_TARGETS += html_docs_$${QTC_DOCS_TARGET}
!isEmpty(html_docs.commands): html_docs.commands += &&
html_docs.commands += $$eval(html_docs_$${QTC_DOCS_TARGET}.commands)
!build_online_docs {
qch_docs_$${QTC_DOCS_TARGET}.commands = $$QHELPGENERATOR $$shell_quote($$QTC_DOCS_OUTPUTDIR/$${QTC_DOCS_TARGET}.qhp) -o $$shell_quote($$IDE_DOC_PATH/$${QTC_DOCS_TARGET}.qch)
qch_docs_$${QTC_DOCS_TARGET}.depends = html_docs_$${QTC_DOCS_TARGET}
QMAKE_EXTRA_TARGETS += qch_docs_$${QTC_DOCS_TARGET}
!isEmpty(qch_docs.commands): qch_docs.commands += &&
qch_docs.commands += $$eval(qch_docs_$${QTC_DOCS_TARGET}.commands)
inst_qch_docs.files += $$IDE_DOC_PATH/$${QTC_DOCS_TARGET}.qch
}
}
!build_online_docs {
qch_docs.depends = html_docs
inst_qch_docs.path = $$INSTALL_DOC_PATH
inst_qch_docs.CONFIG += no_check_exist no_default_install no_build
install_docs.depends = install_inst_qch_docs
docs.depends = qch_docs
INSTALLS += inst_qch_docs
QMAKE_EXTRA_TARGETS += qch_docs install_docs
} else {
docs.depends = html_docs
}
QMAKE_EXTRA_TARGETS += html_docs docs
include(doc/doc_targets.pri)

View File

@@ -153,18 +153,20 @@ class Dumper(DumperBase):
code = nativeType.code()
if code == TypeCodePointer:
if nativeType.name().startswith('<function>'):
code = TypeCodeFunction
else:
if not nativeType.name().startswith('<function>'):
targetType = self.lookupType(nativeType.targetName(), nativeType.moduleId())
return self.createPointerType(targetType)
if targetType is not None:
return self.createPointerType(targetType)
code = TypeCodeFunction
if code == TypeCodeArray:
if nativeType.name().startswith('__fptr()'):
code = TypeCodeStruct
else:
# cdb reports virtual function tables as arrays those ar handled separetly by
# the DumperBase. Declare those types as structs prevents a lookup to a none existing type
if not nativeType.name().startswith('__fptr()') and not nativeType.name().startswith('<gentype '):
targetType = self.lookupType(nativeType.targetName(), nativeType.moduleId())
return self.createArrayType(targetType, nativeType.arrayElements())
if targetType is not None:
return self.createArrayType(targetType, nativeType.arrayElements())
code = TypeCodeStruct
tdata = self.TypeData(self)
tdata.name = nativeType.name()

View File

@@ -192,6 +192,10 @@ def qdump__Utils__ElfSection(d, value):
d.putByteArrayValue(value["name"])
d.putPlainChildren(value)
def qdump__Utf8String(d, value):
d.putByteArrayValue(value['byteArray'])
d.putPlainChildren(value)
def qdump__CPlusPlus__Token(d, value):
k = value["f"]["kind"]
e = int(k)

View File

@@ -763,7 +763,7 @@ def qdump__QHostAddress(d, value):
(ipString, scopeId, a4, pad, a6, protocol, isParsed) \
= d.split('{QString}{QString}{quint32}I16sI{bool}', dd)
elif qtVersion >= 0x050600: # 5.6.0 at f3aabb42
if d.ptrSize() == 8 or d.isMsvcTarget():
if d.ptrSize() == 8 or d.isWindowsTarget():
(ipString, scopeId, a4, pad, a6, protocol, isParsed) \
= d.split('{QString}{QString}{quint32}I16sI{bool}', dd)
else:

View File

@@ -367,7 +367,7 @@ QImage QuickItemNodeInstance::renderImage() const
QRectF renderBoundingRect = boundingRect();
QSize size = renderBoundingRect.size().toSize();
static float devicePixelRatio = qgetenv("FORMEDITOR_DEVICE_PIXEL_RATIO").toDouble();
static double devicePixelRatio = qgetenv("FORMEDITOR_DEVICE_PIXEL_RATIO").toDouble();
size *= devicePixelRatio;
QImage renderImage = designerSupport()->renderImageForItem(quickItem(), renderBoundingRect, size);

View File

@@ -73,12 +73,8 @@ Item {
id: mouseRegion
anchors.fill: parent
property bool reallyPressed: false
property int pressedX
property int pressedY
onPressed: {
rootView.startDragAndDrop(itemLibraryEntry)
rootView.startDragAndDrop(mouseRegion, itemLibraryEntry)
}
}
}

View File

@@ -54,12 +54,22 @@ PyValue::PyValue(unsigned long index, CIDebugSymbolGroup *symbolGroup)
: m_index(index)
, m_symbolGroup(symbolGroup)
{
valuesForSymbolGroup[symbolGroup].push_back(this);
if (m_symbolGroup)
valuesForSymbolGroup[symbolGroup].push_back(this);
}
PyValue::PyValue(const PyValue &other)
: m_index(other.m_index)
, m_symbolGroup(other.m_symbolGroup)
{
if (m_symbolGroup)
valuesForSymbolGroup[m_symbolGroup].push_back(this);
}
PyValue::~PyValue()
{
valuesForSymbolGroup[m_symbolGroup].remove(this);
if (m_symbolGroup)
valuesForSymbolGroup[m_symbolGroup].remove(this);
}
std::string PyValue::name() const

View File

@@ -36,6 +36,7 @@ class PyValue
public:
PyValue() = default;
PyValue(unsigned long index, CIDebugSymbolGroup *symbolGroup);
PyValue(const PyValue &other);
~PyValue();
std::string name() const;

View File

@@ -46,10 +46,7 @@ Rectangle {
property bool selectionRangeMode: false
property bool selectionRangeReady: selectionRange.ready
property int typeId: content.typeId
onWidthChanged: {
zoomSliderToolBar.updateZoomLevel();
content.scroll();
}
onWidthChanged: zoomSliderToolBar.updateZoomLevel();
color: Theme.color(Theme.Timeline_BackgroundColor1)

View File

@@ -80,43 +80,43 @@ ScrollView {
property bool recursionGuard: false
// Update the zoom control on srolling.
onContentXChanged: {
function guarded(operation) {
if (recursionGuard)
return;
recursionGuard = true;
var newStartTime = contentX * zoomer.rangeDuration / scroller.width +
zoomer.windowStart;
if (isFinite(newStartTime) && Math.abs(newStartTime - zoomer.rangeStart) >= 1) {
var newEndTime = (contentX + scroller.width) * zoomer.rangeDuration /
scroller.width + zoomer.windowStart;
if (isFinite(newEndTime))
zoomer.setRange(newStartTime, newEndTime);
}
operation();
recursionGuard = false;
}
onWidthChanged: scroll()
// Update the zoom control on scrolling.
onContentXChanged: guarded(function() {
var newStartTime = contentX * zoomer.rangeDuration / width + zoomer.windowStart;
if (isFinite(newStartTime) && Math.abs(newStartTime - zoomer.rangeStart) >= 1) {
var newEndTime = (contentX + width) * zoomer.rangeDuration / width
+ zoomer.windowStart;
if (isFinite(newEndTime))
zoomer.setRange(newStartTime, newEndTime);
}
});
// Scroll when the zoom control is updated
function scroll() {
if (recursionGuard)
return;
recursionGuard = true;
if (zoomer.rangeDuration <= 0) {
contentWidth = 0;
contentX = 0;
} else {
var newWidth = zoomer.windowDuration * scroller.width / zoomer.rangeDuration;
if (isFinite(newWidth) && Math.abs(newWidth - contentWidth) >= 1)
contentWidth = newWidth;
var newStartX = (zoomer.rangeStart - zoomer.windowStart) * scroller.width /
zoomer.rangeDuration;
if (isFinite(newStartX) && Math.abs(newStartX - contentX) >= 1)
contentX = newStartX;
}
recursionGuard = false;
guarded(function() {
if (zoomer.rangeDuration <= 0) {
contentWidth = 0;
contentX = 0;
} else {
var newWidth = zoomer.windowDuration * width / zoomer.rangeDuration;
if (isFinite(newWidth) && Math.abs(newWidth - contentWidth) >= 1)
contentWidth = newWidth;
var newStartX = (zoomer.rangeStart - zoomer.windowStart) * width /
zoomer.rangeDuration;
if (isFinite(newStartX) && Math.abs(newStartX - contentX) >= 1)
contentX = newStartX;
}
});
}
Column {

View File

@@ -43,8 +43,7 @@
namespace Timeline {
TimelineRenderer::TimelineRendererPrivate::TimelineRendererPrivate(TimelineRenderer *q) :
lastState(0), q_ptr(q)
TimelineRenderer::TimelineRendererPrivate::TimelineRendererPrivate() : lastState(0)
{
resetCurrentSelection();
}
@@ -63,7 +62,7 @@ void TimelineRenderer::TimelineRendererPrivate::clear()
}
TimelineRenderer::TimelineRenderer(QQuickItem *parent) :
TimelineAbstractRenderer(*(new TimelineRendererPrivate(this)), parent)
TimelineAbstractRenderer(*(new TimelineRendererPrivate), parent)
{
setAcceptedMouseButtons(Qt::LeftButton);
setAcceptHoverEvents(true);
@@ -182,9 +181,8 @@ int TimelineRenderer::TimelineRendererPrivate::rowFromPosition(int y) const
void TimelineRenderer::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(TimelineRenderer);
Q_UNUSED(event);
if (d->model && !d->model->isEmpty())
d->manageClicked();
d->findCurrentSelection(event->pos().x(), event->pos().y(), width());
setSelectedItem(d->currentSelection.eventIndex);
}
void TimelineRenderer::mouseMoveEvent(QMouseEvent *event)
@@ -195,7 +193,11 @@ void TimelineRenderer::mouseMoveEvent(QMouseEvent *event)
void TimelineRenderer::hoverMoveEvent(QHoverEvent *event)
{
Q_D(TimelineRenderer);
d->manageHovered(event->pos().x(), event->pos().y());
if (!d->selectionLocked) {
d->findCurrentSelection(event->pos().x(), event->pos().y(), width());
if (d->currentSelection.eventIndex != -1)
setSelectedItem(d->currentSelection.eventIndex);
}
if (d->currentSelection.eventIndex == -1)
event->setAccepted(false);
}
@@ -227,19 +229,10 @@ void TimelineRenderer::wheelEvent(QWheelEvent *event)
}
}
void TimelineRenderer::TimelineRendererPrivate::manageClicked()
void TimelineRenderer::TimelineRendererPrivate::findCurrentSelection(int mouseX, int mouseY,
int width)
{
Q_Q(TimelineRenderer);
if (currentSelection.eventIndex != -1)
q->setSelectedItem(currentSelection.eventIndex);
else
q->setSelectedItem(-1);
}
void TimelineRenderer::TimelineRendererPrivate::manageHovered(int mouseX, int mouseY)
{
Q_Q(TimelineRenderer);
if (!zoomer || !model || q->width() < 1)
if (!zoomer || !model || width < 1)
return;
qint64 duration = zoomer->windowDuration();
@@ -247,18 +240,16 @@ void TimelineRenderer::TimelineRendererPrivate::manageHovered(int mouseX, int mo
return;
// Make the "selected" area 3 pixels wide by adding/subtracting 1 to catch very narrow events.
qint64 startTime = (mouseX - 1) * duration / q->width() + zoomer->windowStart();
qint64 endTime = (mouseX + 1) * duration / q->width() + zoomer->windowStart();
qint64 startTime = (mouseX - 1) * duration / width + zoomer->windowStart();
qint64 endTime = (mouseX + 1) * duration / width + zoomer->windowStart();
qint64 exactTime = (startTime + endTime) / 2;
int row = rowFromPosition(mouseY);
// already covered? Only recheck selectionLocked and make sure d->selectedItem is correct.
// already covered? Only make sure d->selectedItem is correct.
if (currentSelection.eventIndex != -1 &&
exactTime >= currentSelection.startTime &&
exactTime < currentSelection.endTime &&
row == currentSelection.row) {
if (!selectionLocked)
q->setSelectedItem(currentSelection.eventIndex);
return;
}
@@ -310,8 +301,6 @@ void TimelineRenderer::TimelineRendererPrivate::manageHovered(int mouseX, int mo
bestOffset = offset;
}
if (!selectionLocked && currentSelection.eventIndex != -1)
q->setSelectedItem(currentSelection.eventIndex);
}
void TimelineRenderer::clearData()

View File

@@ -31,17 +31,15 @@
namespace Timeline {
class TimelineRenderer::TimelineRendererPrivate :
TimelineAbstractRenderer::TimelineAbstractRendererPrivate {
public TimelineAbstractRenderer::TimelineAbstractRendererPrivate {
public:
TimelineRendererPrivate(TimelineRenderer *q);
TimelineRendererPrivate();
~TimelineRendererPrivate();
void clear();
int rowFromPosition(int y) const;
void manageClicked();
void manageHovered(int mouseX, int mouseY);
void findCurrentSelection(int mouseX, int mouseY, int width);
static const int SafeFloatMax = 1 << 12;
@@ -58,10 +56,6 @@ public:
QVector<QHash<qint64, TimelineRenderState *> > renderStates;
TimelineRenderState *lastState;
private:
TimelineRenderer *q_ptr;
Q_DECLARE_PUBLIC(TimelineRenderer)
};
} // namespace Timeline

View File

@@ -268,6 +268,19 @@ QStringList Environment::appendExeExtensions(const QString &executable) const
return execs;
}
bool Environment::isSameExecutable(const QString &exe1, const QString &exe2) const
{
const QStringList exe1List = appendExeExtensions(exe1);
const QStringList exe2List = appendExeExtensions(exe2);
for (const QString &i1 : exe1List) {
for (const QString &i2 : exe2List) {
if (Utils::FileName::fromString(i1) == Utils::FileName::fromString(i2))
return true;
}
}
return false;
}
FileName Environment::searchInPath(const QString &executable,
const QStringList &additionalDirs,
bool (*func)(const QString &name)) const

View File

@@ -106,6 +106,8 @@ public:
QStringList path() const;
QStringList appendExeExtensions(const QString &executable) const;
bool isSameExecutable(const QString &exe1, const QString &exe2) const;
QString expandVariables(const QString &input) const;
QStringList expandVariables(const QStringList &input) const;

View File

@@ -546,8 +546,8 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
if (wrapperProps.exists()) {
GradleProperties wrapperProperties = readGradleProperties(wrapperProps.toString());
QString distributionUrl = QString::fromLocal8Bit(wrapperProperties["distributionUrl"]);
QRegExp re(QLatin1String(".*services.gradle.org/distributions/gradle-2..*.zip"));
if (!re.exactMatch(distributionUrl)) {
// Update only old gradle distributionUrl
if (distributionUrl.endsWith(QLatin1String("distributions/gradle-1.12-all.zip"))) {
wrapperProperties["distributionUrl"] = "https\\://services.gradle.org/distributions/gradle-2.2.1-all.zip";
mergeGradleProperties(wrapperProps.toString(), wrapperProperties);
}

View File

@@ -88,9 +88,6 @@ TestConfiguration *GTestTreeItem::testConfiguration() const
config->setTestCaseCount(count);
config->setProjectFile(proFile());
config->setProject(project);
// item has no filePath set - so take it of the first children
config->setDisplayName(
TestUtils::getCMakeDisplayNameIfNecessary(childItem(0)->filePath(), proFile()));
}
break;
}
@@ -103,8 +100,6 @@ TestConfiguration *GTestTreeItem::testConfiguration() const
config->setTestCases(QStringList(testSpecifier));
config->setProjectFile(proFile());
config->setProject(project);
config->setDisplayName(
TestUtils::getCMakeDisplayNameIfNecessary(filePath(), parent->proFile()));
break;
}
default:
@@ -179,7 +174,6 @@ QList<TestConfiguration *> GTestTreeItem::getAllTestConfigurations() const
GTestConfiguration *tc = new GTestConfiguration;
tc->setTestCaseCount(it.value());
tc->setProjectFile(key.proFile);
tc->setDisplayName(key.displayName);
tc->setProject(project);
result << tc;
}
@@ -244,7 +238,6 @@ QList<TestConfiguration *> GTestTreeItem::getSelectedTestConfigurations() const
tc->setTestCases(it.value().filters);
tc->setTestCaseCount(tc->testCaseCount() + it.value().additionalTestCaseCount);
tc->setProjectFile(proFileWithDisplayName.proFile);
tc->setDisplayName(proFileWithDisplayName.displayName);
tc->setProject(project);
result << tc;
}

View File

@@ -111,7 +111,6 @@ TestConfiguration *QtTestTreeItem::testConfiguration() const
config->setTestCaseCount(childCount());
config->setProjectFile(proFile());
config->setProject(project);
config->setDisplayName(TestUtils::getCMakeDisplayNameIfNecessary(filePath(), proFile()));
break;
case TestFunctionOrSet: {
TestTreeItem *parent = parentItem();
@@ -119,8 +118,6 @@ TestConfiguration *QtTestTreeItem::testConfiguration() const
config->setTestCases(QStringList(name()));
config->setProjectFile(parent->proFile());
config->setProject(project);
config->setDisplayName(
TestUtils::getCMakeDisplayNameIfNecessary(filePath(), parent->proFile()));
break;
}
case TestDataTag: {
@@ -133,8 +130,6 @@ TestConfiguration *QtTestTreeItem::testConfiguration() const
config->setTestCases(QStringList(functionWithTag));
config->setProjectFile(parent->proFile());
config->setProject(project);
config->setDisplayName(TestUtils::getCMakeDisplayNameIfNecessary(filePath(),
parent->proFile()));
break;
}
default:
@@ -166,8 +161,6 @@ QList<TestConfiguration *> QtTestTreeItem::getAllTestConfigurations() const
tc->setTestCaseCount(child->childCount());
tc->setProjectFile(child->proFile());
tc->setProject(project);
tc->setDisplayName(TestUtils::getCMakeDisplayNameIfNecessary(child->filePath(),
child->proFile()));
result << tc;
}
return result;
@@ -193,8 +186,6 @@ QList<TestConfiguration *> QtTestTreeItem::getSelectedTestConfigurations() const
testConfiguration->setTestCaseCount(child->childCount());
testConfiguration->setProjectFile(child->proFile());
testConfiguration->setProject(project);
testConfiguration->setDisplayName(
TestUtils::getCMakeDisplayNameIfNecessary(child->filePath(), child->proFile()));
result << testConfiguration;
continue;
case Qt::PartiallyChecked:
@@ -220,8 +211,6 @@ QList<TestConfiguration *> QtTestTreeItem::getSelectedTestConfigurations() const
testConfiguration->setTestCases(testCases);
testConfiguration->setProjectFile(child->proFile());
testConfiguration->setProject(project);
testConfiguration->setDisplayName(
TestUtils::getCMakeDisplayNameIfNecessary(child->filePath(), child->proFile()));
result << testConfiguration;
}
}

View File

@@ -54,30 +54,6 @@ TestConfiguration::~TestConfiguration()
m_testCases.clear();
}
void completeBasicProjectInformation(Project *project, const QString &proFile, QString *displayName,
Project **targetProject)
{
CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance();
QVector<CppTools::ProjectPart::Ptr> projParts = cppMM->projectInfo(project).projectParts();
if (displayName->isEmpty()) {
foreach (const CppTools::ProjectPart::Ptr &part, projParts) {
if (part->projectFile == proFile) {
*displayName = part->displayName;
*targetProject = part->project;
return;
}
}
} else { // for CMake based projects we've got the displayname already
foreach (const CppTools::ProjectPart::Ptr &part, projParts) {
if (part->displayName == *displayName) {
*targetProject = part->project;
return;
}
}
}
}
static bool isLocal(RunConfiguration *runConfiguration)
{
Target *target = runConfiguration ? runConfiguration->target() : 0;
@@ -93,106 +69,80 @@ void TestConfiguration::completeTestInformation(int runMode)
if (!project)
return;
QString executable;
QString targetName;
QString workDir;
QString displayName = m_displayName;
QString buildDir;
Project *targetProject = 0;
Utils::Environment env;
Target *runConfigTarget = 0;
bool hasDesktopTarget = false;
bool guessedRunConfiguration = false;
setProject(0);
completeBasicProjectInformation(project, m_projectFile, &displayName, &targetProject);
Target *target = project->activeTarget();
if (!target)
return;
BuildTargetInfoList appTargets = target->applicationTargets();
if (m_displayName.isEmpty()) {
foreach (const BuildTargetInfo &bti, appTargets.list) {
// some project manager store line/column information as well inside ProjectPart
if (bti.isValid() && m_projectFile.startsWith(bti.projectFilePath.toString())) {
executable = bti.targetFilePath.toString();
if (Utils::HostOsInfo::isWindowsHost() && !executable.toLower().endsWith(".exe"))
executable = Utils::HostOsInfo::withExecutableSuffix(executable);
targetName = bti.targetName;
break;
}
}
} else { // CMake based projects have no specific pro file, but target name matches displayname
foreach (const BuildTargetInfo &bti, appTargets.list) {
if (bti.isValid() && m_displayName == bti.targetName) {
// for CMake base projects targetFilePath has executable suffix already
executable = bti.targetFilePath.toString();
targetName = m_displayName;
break;
}
}
}
const auto cppMM = CppTools::CppModelManager::instance();
const QVector<CppTools::ProjectPart::Ptr> projectParts = cppMM->projectInfo(project).projectParts();
const QVector<CppTools::ProjectPart::Ptr> relevantParts
= Utils::filtered(projectParts, [this] (const CppTools::ProjectPart::Ptr &part) {
return part->selectedForBuilding && part->projectFile == m_projectFile;
});
const QSet<QString> buildSystemTargets
= Utils::transform<QSet>(relevantParts, [] (const CppTools::ProjectPart::Ptr &part) {
return part->buildSystemTarget;
});
if (targetProject) {
if (auto buildConfig = target->activeBuildConfiguration()) {
const QString buildBase = buildConfig->buildDirectory().toString();
const QString projBase = targetProject->projectDirectory().toString();
if (m_projectFile.startsWith(projBase))
buildDir = QFileInfo(buildBase + m_projectFile.mid(projBase.length())).absolutePath();
}
}
const BuildTargetInfo targetInfo
= Utils::findOrDefault(target->applicationTargets().list, [&buildSystemTargets] (const BuildTargetInfo &bti) {
return buildSystemTargets.contains(bti.targetName);
});
const Utils::FileName executable = targetInfo.targetFilePath; // empty if BTI is default created
for (RunConfiguration *runConfig : target->runConfigurations()) {
if (!isLocal(runConfig)) // TODO add device support
continue;
QList<RunConfiguration *> rcs = target->runConfigurations();
foreach (RunConfiguration *rc, rcs) {
Runnable runnable = rc->runnable();
if (isLocal(rc) && runnable.is<StandardRunnable>()) {
if (buildSystemTargets.contains(runConfig->buildSystemTarget())) {
Runnable runnable = runConfig->runnable();
if (!runnable.is<StandardRunnable>())
continue;
StandardRunnable stdRunnable = runnable.as<StandardRunnable>();
// we might have an executable that gets installed - in such a case the
// runnable's executable and executable won't match - but the (unique) display name
// of the run configuration should match targetName
if (stdRunnable.executable == executable
|| (!targetName.isEmpty() && rc->displayName() == targetName)) {
executable = stdRunnable.executable;
workDir = Utils::FileUtils::normalizePathName(stdRunnable.workingDirectory);
env = stdRunnable.environment;
hasDesktopTarget = true;
runConfigTarget = rc->target();
break;
}
// TODO this might pick up the wrong executable
m_executableFile = stdRunnable.executable;
m_displayName = runConfig->displayName();
m_workingDir = Utils::FileUtils::normalizePathName(stdRunnable.workingDirectory);
m_environment = stdRunnable.environment;
m_project = project;
if (runMode == TestRunner::Debug)
m_runConfig = new TestRunConfiguration(runConfig->target(), this);
break;
}
}
// if we could not figure out the run configuration
// try to use the run configuration of the parent project
if (!hasDesktopTarget && targetProject && !executable.isEmpty()) {
// RunConfiguration for this target could be explicitly removed or not created at all
if (m_displayName.isEmpty() && !executable.isEmpty()) {
// we failed to find a valid runconfiguration - but we've got the executable already
if (auto rc = target->activeRunConfiguration()) {
Runnable runnable = rc->runnable();
if (isLocal(rc) && runnable.is<StandardRunnable>()) {
StandardRunnable stdRunnable = runnable.as<StandardRunnable>();
workDir = Utils::FileUtils::normalizePathName(stdRunnable.workingDirectory);
env = stdRunnable.environment;
hasDesktopTarget = true;
guessedRunConfiguration = true;
runConfigTarget = rc->target();
if (isLocal(rc)) { // FIXME for now only Desktop support
Runnable runnable = rc->runnable();
if (runnable.is<StandardRunnable>()) {
StandardRunnable stdRunnable = runnable.as<StandardRunnable>();
m_environment = stdRunnable.environment;
// when guessing we might have no extension
const QString &exeString = executable.toString();
if (Utils::HostOsInfo::isWindowsHost() && !exeString.toLower().endsWith(".exe"))
m_executableFile = Utils::HostOsInfo::withExecutableSuffix(exeString);
else
m_executableFile = exeString;
m_project = project;
m_guessedConfiguration = true;
if (runMode == TestRunner::Debug)
m_runConfig = new TestRunConfiguration(rc->target(), this);
}
}
}
}
setDisplayName(displayName);
if (hasDesktopTarget) {
setExecutableFile(executable);
setWorkingDirectory(workDir);
setBuildDirectory(buildDir);
setEnvironment(env);
setProject(project);
setGuessedConfiguration(guessedRunConfiguration);
if (runMode == TestRunner::Debug)
m_runConfig = new TestRunConfiguration(runConfigTarget, this);
if (auto buildConfig = target->activeBuildConfiguration()) {
const QString buildBase = buildConfig->buildDirectory().toString();
const QString projBase = project->projectDirectory().toString();
if (m_projectFile.startsWith(projBase))
m_buildDir = QFileInfo(buildBase + m_projectFile.mid(projBase.length())).absolutePath();
}
}
if (m_displayName.isEmpty()) // happens e.g. when guessing the TestConfiguration or error
m_displayName = buildSystemTargets.isEmpty() ? "unknown" : *buildSystemTargets.begin();
}
/**
* @brief sets the test cases for this test configuration.

View File

@@ -100,12 +100,19 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
const TestSettings &settings)
{
const int timeout = settings.timeout;
const bool omitRunConfigWarnings = settings.omitRunConfigWarn;
QEventLoop eventLoop;
int testCaseCount = 0;
for (TestConfiguration *config : selectedTests) {
config->completeTestInformation(TestRunner::Run);
if (config->project()) {
testCaseCount += config->testCaseCount();
if (!omitRunConfigWarnings && config->guessedConfiguration()) {
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
TestRunner::tr("Project's run configuration was guessed for \"%1\".\n"
"This might cause trouble during execution."
).arg(config->displayName()))));
}
} else {
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
TestRunner::tr("Project is null for \"%1\". Removing from test run.\n"
@@ -196,22 +203,12 @@ void TestRunner::prepareToRunTests(Mode mode)
return;
}
const bool omitRunConfigWarnings = AutotestPlugin::instance()->settings()->omitRunConfigWarn;
m_executingTests = true;
emit testRunStarted();
// clear old log and output pane
TestResultsPane::instance()->clearContents();
for (TestConfiguration *config : m_selectedTests) {
if (!omitRunConfigWarnings && config->guessedConfiguration()) {
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
tr("Project's run configuration was guessed for \"%1\".\n"
"This might cause trouble during execution.").arg(config->displayName()))));
}
}
if (m_selectedTests.empty()) {
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
tr("No tests selected. Canceling test run."))));

View File

@@ -101,12 +101,6 @@ QString AutotoolsProject::defaultBuildDirectory(const QString &projectPath)
return QFileInfo(projectPath).absolutePath();
}
QStringList AutotoolsProject::files(FilesMode fileMode) const
{
Q_UNUSED(fileMode);
return m_files;
}
// This function, is called at the very beginning, to
// restore the settings if there are some stored.
Project::RestoreResult AutotoolsProject::fromMap(const QVariantMap &map, QString *errorMessage)

View File

@@ -58,7 +58,6 @@ public:
~AutotoolsProject() override;
QString displayName() const override;
QStringList files(FilesMode fileMode) const override;
static QString defaultBuildDirectory(const QString &projectPath);
QStringList buildTargets() const;

View File

@@ -83,6 +83,12 @@ void BareMetalDevice::setGdbServerProviderId(const QString &id)
}
}
void BareMetalDevice::unregisterProvider(GdbServerProvider *provider)
{
if (provider->id() == m_gdbServerProviderId)
m_gdbServerProviderId.clear();
}
void BareMetalDevice::providerUpdated(GdbServerProvider *provider)
{
GdbServerProvider *myProvider = GdbServerProviderManager::findProvider(m_gdbServerProviderId);

View File

@@ -59,6 +59,7 @@ public:
QString gdbServerProviderId() const;
void setGdbServerProviderId(const QString &id);
void unregisterProvider(GdbServerProvider *provider);
void providerUpdated(GdbServerProvider *provider);
virtual void fromMap(const QVariantMap &map) override;

View File

@@ -78,7 +78,7 @@ GdbServerProvider::~GdbServerProvider()
{
const QSet<BareMetalDevice *> devices = m_devices;
for (BareMetalDevice *device : devices)
device->setGdbServerProviderId(QString());
device->unregisterProvider(this);
}
QString GdbServerProvider::displayName() const

View File

@@ -35,12 +35,13 @@ ClangAssistProposal::ClangAssistProposal(int cursorPos, TextEditor::GenericPropo
{
}
bool ClangAssistProposal::isCorrective() const
bool ClangAssistProposal::isCorrective(TextEditor::TextEditorWidget *editorWidget) const
{
auto clangAssistProposalModel = static_cast<ClangAssistProposalModel*>(model());
return clangAssistProposalModel->neededCorrection()
== ClangBackEnd::CompletionCorrection::DotToArrowCorrection;
== ClangBackEnd::CompletionCorrection::DotToArrowCorrection
&& editorWidget->textAt(basePosition() - 1, 1) == ".";
}
void ClangAssistProposal::makeCorrection(TextEditor::TextEditorWidget *editorWidget)

View File

@@ -37,8 +37,8 @@ class ClangAssistProposal : public TextEditor::GenericProposal
public:
ClangAssistProposal(int cursorPos, TextEditor::GenericProposalModel *model);
virtual bool isCorrective() const;
virtual void makeCorrection(TextEditor::TextEditorWidget *editorWidget);
bool isCorrective(TextEditor::TextEditorWidget *editorWidget) const override;
void makeCorrection(TextEditor::TextEditorWidget *editorWidget) override;
};
} // namespace Internal

View File

@@ -112,10 +112,16 @@ private:
label->setTextFormat(Qt::RichText);
label->setText(text);
label->setTextInteractionFlags(Qt::TextBrowserInteraction);
// Using "setWordWrap(true)" alone will wrap the text already for small
// widths, so do not require word wrapping until we hit limits.
if (m_displayHints.limitWidth && label->sizeHint().width() > widthLimit()) {
label->setMaximumWidth(widthLimit());
if (m_displayHints.limitWidth) {
const int limit = widthLimit();
// Using "setWordWrap(true)" alone will wrap the text already for small
// widths, so do not require word wrapping until we hit limits.
if (label->sizeHint().width() > limit) {
label->setMaximumWidth(limit);
label->setWordWrap(true);
}
} else {
label->setWordWrap(true);
}
@@ -141,7 +147,7 @@ private:
QString htmlText(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics)
{
// For debugging, add: style='border-width:1px;border-color:black'
QString text = "<table cellspacing='0' cellpadding='0'>";
QString text = "<table cellspacing='0' cellpadding='0' width='100%'>";
foreach (const ClangBackEnd::DiagnosticContainer &diagnostic, diagnostics)
text.append(tableRows(diagnostic));
@@ -173,7 +179,7 @@ private:
const QString text = QString::fromLatin1(
" <tr>"
" <td align='left'><b>%1</b></td>"
" <td align='right'><font color='gray'>%2</font></td>"
" <td align='right'>&nbsp;<font color='gray'>%2</font></td>"
" </tr>")
.arg(diagnostic.category(), diagnostic.enableOption());
@@ -185,15 +191,7 @@ private:
const bool hasFixit = m_displayHints.enableClickableFixits
&& !diagnostic.fixIts().isEmpty();
const QString diagnosticText = diagnostic.text().toString().toHtmlEscaped();
// For debugging, add to <table>: style='border-width:1px;border-color:red'
const QString text = QString::fromLatin1(
"<table cellspacing='0' cellpadding='0'>"
" <tr>"
" <td>%1:&nbsp;</td>"
" <td width='100%'>%2</td>"
" </tr>"
"</table>")
const QString text = QString::fromLatin1("%1: %2")
.arg(clickableLocation(diagnostic, m_mainFilePath),
clickableFixIt(diagnostic, diagnosticText, hasFixit));

View File

@@ -75,7 +75,7 @@ const Utils::FileName BuildDirManager::workDirectory() const
if (!m_tempDir) {
m_tempDir.reset(new Utils::TemporaryDirectory("qtc-cmake-XXXXXXXX"));
if (!m_tempDir->isValid())
emit errorOccured(tr("Failed to create temporary directory \"%1\".").arg(m_tempDir->path()));
emitErrorOccured(tr("Failed to create temporary directory \"%1\".").arg(m_tempDir->path()));
}
return Utils::FileName::fromString(m_tempDir->path());
}
@@ -86,6 +86,13 @@ void BuildDirManager::emitDataAvailable()
emit dataAvailable();
}
void BuildDirManager::emitErrorOccured(const QString &message) const
{
m_isHandlingError = true;
emit errorOccured(message);
m_isHandlingError = false;
}
void BuildDirManager::updateReaderType(std::function<void()> todo)
{
BuildDirReader::Parameters p(m_buildConfiguration);
@@ -98,7 +105,7 @@ void BuildDirManager::updateReaderType(std::function<void()> todo)
connect(m_reader.get(), &BuildDirReader::dataAvailable,
this, &BuildDirManager::emitDataAvailable);
connect(m_reader.get(), &BuildDirReader::errorOccured,
this, &BuildDirManager::errorOccured);
this, &BuildDirManager::emitErrorOccured);
connect(m_reader.get(), &BuildDirReader::dirty, this, &BuildDirManager::becameDirty);
}
m_reader->setParameters(p);
@@ -216,6 +223,8 @@ void BuildDirManager::becameDirty()
void BuildDirManager::forceReparse()
{
QTC_ASSERT(!m_isHandlingError, return);
if (m_buildConfiguration->target()->activeBuildConfiguration() != m_buildConfiguration)
return;
@@ -228,6 +237,8 @@ void BuildDirManager::forceReparse()
void BuildDirManager::resetData()
{
QTC_ASSERT(!m_isHandlingError, return);
if (m_reader)
m_reader->resetData();
@@ -259,6 +270,7 @@ bool BuildDirManager::persistCMakeState()
void BuildDirManager::generateProjectTree(CMakeProjectNode *root, const QList<const FileNode *> &allFiles)
{
QTC_ASSERT(!m_isHandlingError, return);
QTC_ASSERT(m_reader, return);
const Utils::FileName projectFile = m_buildConfiguration->target()->project()->projectFilePath();
@@ -272,6 +284,7 @@ void BuildDirManager::generateProjectTree(CMakeProjectNode *root, const QList<co
void BuildDirManager::updateCodeModel(CppTools::RawProjectParts &rpps)
{
QTC_ASSERT(!m_isHandlingError, return);
QTC_ASSERT(m_reader, return);
return m_reader->updateCodeModel(rpps);
}
@@ -283,6 +296,8 @@ void BuildDirManager::parse()
void BuildDirManager::clearCache()
{
QTC_ASSERT(!m_isHandlingError, return);
auto cmakeCache = Utils::FileName(workDirectory()).appendPath(QLatin1String("CMakeCache.txt"));
auto cmakeFiles = Utils::FileName(workDirectory()).appendPath(QLatin1String("CMakeFiles"));
@@ -298,6 +313,8 @@ void BuildDirManager::clearCache()
QList<CMakeBuildTarget> BuildDirManager::buildTargets() const
{
QTC_ASSERT(!m_isHandlingError, return {});
if (!m_reader)
return QList<CMakeBuildTarget>();
if (m_buildTargets.isEmpty())
@@ -307,6 +324,8 @@ QList<CMakeBuildTarget> BuildDirManager::buildTargets() const
CMakeConfig BuildDirManager::parsedConfiguration() const
{
QTC_ASSERT(!m_isHandlingError, return {});
if (!m_reader)
return m_cmakeCache;
if (m_cmakeCache.isEmpty())
@@ -389,6 +408,9 @@ void BuildDirManager::checkConfiguration()
void BuildDirManager::maybeForceReparse()
{
if (m_isHandlingError)
return;
if (!m_reader || !m_reader->hasData()) {
forceReparse();
return;

View File

@@ -86,6 +86,7 @@ signals:
private:
void emitDataAvailable();
void emitErrorOccured(const QString &message) const;
void checkConfiguration();
const Utils::FileName workDirectory() const;
@@ -109,6 +110,7 @@ private:
std::unique_ptr<BuildDirReader> m_reader;
mutable QList<CMakeBuildTarget> m_buildTargets;
mutable bool m_isHandlingError = false;
};
} // namespace Internal

View File

@@ -185,7 +185,6 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
updateQmlJSCodeModel();
emit displayNameChanged();
emit fileListChanged();
emit bc->emitBuildTypeChanged();
@@ -220,7 +219,7 @@ void CMakeProject::updateQmlJSCodeModel()
}
foreach (const QString &cmakeImport, CMakeConfigItem::cmakeSplitValue(cmakeImports))
projectInfo.importPaths.maybeInsert(FileName::fromString(cmakeImport),QmlJS::Dialect::Qml);
projectInfo.importPaths.maybeInsert(FileName::fromString(cmakeImport), QmlJS::Dialect::Qml);
modelManager->updateProjectInfo(projectInfo, this);
}
@@ -307,21 +306,6 @@ QString CMakeProject::displayName() const
return root ? root->displayName() : projectDirectory().fileName();
}
QStringList CMakeProject::files(FilesMode fileMode) const
{
QStringList result;
if (ProjectNode *rpn = rootProjectNode()) {
rpn->forEachNode([&](const FileNode *fn) {
const bool isGenerated = fn->isGenerated();
if ((fileMode & Project::SourceFiles) && !isGenerated)
result.append(fn->filePath().toString());
if ((fileMode & Project::GeneratedFiles) && isGenerated)
result.append(fn->filePath().toString());
});
}
return result;
}
Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
{
RestoreResult result = Project::fromMap(map, errorMessage);

View File

@@ -88,7 +88,6 @@ public:
QString displayName() const final;
QStringList files(FilesMode fileMode) const final;
QStringList buildTargetTitles(bool runnable = false) const;
bool hasBuildTarget(const QString &title) const;

View File

@@ -62,7 +62,8 @@ const char TITLE_KEY[] = "CMakeProjectManager.CMakeRunConfiguation.Title";
CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, Core::Id id, const QString &target,
const Utils::FileName &workingDirectory, const QString &title) :
RunConfiguration(parent, id),
m_buildTarget(target),
m_buildSystemTarget(target),
m_executable(target),
m_title(title)
{
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
@@ -78,7 +79,8 @@ CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, Core::Id id, const
CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, CMakeRunConfiguration *source) :
RunConfiguration(parent, source),
m_buildTarget(source->m_buildTarget),
m_buildSystemTarget(source->m_buildSystemTarget),
m_executable(source->m_executable),
m_title(source->m_title),
m_enabled(source->m_enabled)
{
@@ -93,7 +95,7 @@ void CMakeRunConfiguration::ctor()
Runnable CMakeRunConfiguration::runnable() const
{
StandardRunnable r;
r.executable = m_buildTarget;
r.executable = m_executable;
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments();
r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString();
r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
@@ -103,9 +105,9 @@ Runnable CMakeRunConfiguration::runnable() const
QString CMakeRunConfiguration::baseWorkingDirectory() const
{
const QString exe = m_buildTarget;
const QString exe = m_executable;
if (!exe.isEmpty())
return QFileInfo(m_buildTarget).absolutePath();
return QFileInfo(m_executable).absolutePath();
return QString();
}
@@ -116,7 +118,7 @@ QString CMakeRunConfiguration::title() const
void CMakeRunConfiguration::setExecutable(const QString &executable)
{
m_buildTarget = executable;
m_executable = executable;
}
void CMakeRunConfiguration::setBaseWorkingDirectory(const Utils::FileName &wd)

View File

@@ -56,7 +56,7 @@ public:
bool isEnabled() const override;
QString disabledReason() const override;
QString buildSystemTarget() const final { return m_buildTarget; }
QString buildSystemTarget() const final { return m_buildSystemTarget; }
protected:
CMakeRunConfiguration(ProjectExplorer::Target *parent, CMakeRunConfiguration *source);
@@ -67,7 +67,8 @@ private:
QString baseWorkingDirectory() const;
void ctor();
QString m_buildTarget;
const QString m_buildSystemTarget;
QString m_executable;
QString m_title;
bool m_enabled = true;
};

View File

@@ -284,8 +284,8 @@ void ServerModeReader::generateProjectTree(CMakeProjectNode *root,
addCMakeInputs(root, m_parameters.sourceDirectory, m_parameters.buildDirectory,
cmakeFilesSource, cmakeFilesBuild, cmakeFilesOther);
addCMakeLists(root, cmakeLists);
addProjects(root, m_projects, allFiles);
QHash<Utils::FileName, ProjectNode *> cmakeListsNodes = addCMakeLists(root, cmakeLists);
addProjects(cmakeListsNodes, m_projects, allFiles);
}
void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps)
@@ -488,6 +488,8 @@ void ServerModeReader::extractCMakeInputsData(const QVariantMap &data)
QTC_ASSERT(src == m_parameters.sourceDirectory, return);
QDir srcDir(src.toString());
m_cmakeFiles.clear();
const QVariantList buildFiles = data.value("buildFiles").toList();
for (const QVariant &bf : buildFiles) {
const QVariantMap &section = bf.toMap();
@@ -528,30 +530,36 @@ void ServerModeReader::extractCacheData(const QVariantMap &data)
m_cmakeCache = config;
}
void ServerModeReader::addCMakeLists(CMakeProjectNode *root, const QList<FileNode *> &cmakeLists)
QHash<Utils::FileName, ProjectNode *>
ServerModeReader::addCMakeLists(CMakeProjectNode *root, const QList<FileNode *> &cmakeLists)
{
const QDir baseDir = QDir(m_parameters.sourceDirectory.toString());
QHash<Utils::FileName, ProjectNode *> cmakeListsNodes;
cmakeListsNodes.insert(root->filePath(), root);
const QSet<Utils::FileName> cmakeDirs
= Utils::transform<QSet>(cmakeLists, [](const Node *n) { return n->filePath().parentDir(); });
root->addNestedNodes(cmakeLists, Utils::FileName(),
[&cmakeLists](const Utils::FileName &fp) -> ProjectExplorer::FolderNode * {
if (Utils::contains(cmakeLists, [&fp](const FileNode *fn) { return fn->filePath().parentDir() == fp; }))
return new CMakeListsNode(fp);
else
return new FolderNode(fp);
[&cmakeDirs, &cmakeListsNodes](const Utils::FileName &fp)
-> ProjectExplorer::FolderNode * {
FolderNode *fn = nullptr;
if (cmakeDirs.contains(fp)) {
CMakeListsNode *n = new CMakeListsNode(fp);
cmakeListsNodes.insert(fp, n);
fn = n;
} else {
fn = new FolderNode(fp);
}
return fn;
});
root->compress();
return cmakeListsNodes;
}
static ProjectNode *findCMakeNode(ProjectNode *root, const Utils::FileName &dir)
static ProjectNode *createProjectNode(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes,
const Utils::FileName &dir, const QString &displayName)
{
Node *n = root->findNode([&dir](Node *n) { return n->asProjectNode() && n->filePath() == dir; });
return n ? n->asProjectNode() : nullptr;
}
static ProjectNode *findOrCreateProjectNode(ProjectNode *root, const Utils::FileName &dir,
const QString &displayName)
{
ProjectNode *cmln = findCMakeNode(root, dir);
QTC_ASSERT(cmln, return nullptr);
ProjectNode *cmln = cmakeListsNodes.value(dir);
QTC_ASSERT(cmln, qDebug() << dir.toUserOutput() ; return nullptr);
Utils::FileName projectName = dir;
projectName.appendPath(".project::" + displayName);
@@ -565,7 +573,7 @@ static ProjectNode *findOrCreateProjectNode(ProjectNode *root, const Utils::File
return pn;
}
void ServerModeReader::addProjects(CMakeProjectNode *root,
void ServerModeReader::addProjects(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes,
const QList<Project *> &projects,
const QList<const FileNode *> &allFiles)
{
@@ -577,16 +585,16 @@ void ServerModeReader::addProjects(CMakeProjectNode *root,
}
for (const Project *p : projects) {
ProjectNode *pNode = findOrCreateProjectNode(root, p->sourceDirectory, p->name);
QTC_ASSERT(pNode, continue);
addTargets(root, p->targets, includeFiles);
ProjectNode *pNode = createProjectNode(cmakeListsNodes, p->sourceDirectory, p->name);
QTC_ASSERT(pNode, qDebug() << p->sourceDirectory.toUserOutput() ; continue);
addTargets(cmakeListsNodes, p->targets, includeFiles);
}
}
static CMakeTargetNode *findOrCreateTargetNode(ProjectNode *root, const Utils::FileName &dir,
const QString &displayName)
static CMakeTargetNode *createTargetNode(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes,
const Utils::FileName &dir, const QString &displayName)
{
ProjectNode *cmln = findCMakeNode(root, dir);
ProjectNode *cmln = cmakeListsNodes.value(dir);
QTC_ASSERT(cmln, return nullptr);
Utils::FileName targetName = dir;
@@ -601,12 +609,12 @@ static CMakeTargetNode *findOrCreateTargetNode(ProjectNode *root, const Utils::F
return tn;
}
void ServerModeReader::addTargets(CMakeProjectNode *root,
void ServerModeReader::addTargets(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes,
const QList<ServerModeReader::Target *> &targets,
const QHash<FileName, QList<const FileNode *>> &headers)
{
for (const Target *t : targets) {
CMakeTargetNode *tNode = findOrCreateTargetNode(root, t->sourceDirectory, t->name);
CMakeTargetNode *tNode = createTargetNode(cmakeListsNodes, t->sourceDirectory, t->name);
QTC_ASSERT(tNode, qDebug() << "No target node for" << t->sourceDirectory << t->name; return);
tNode->setTargetInformation(t->artifacts, t->type);
addFileGroups(tNode, t->sourceDirectory, t->buildDirectory, t->fileGroups, headers);

View File

@@ -113,10 +113,13 @@ private:
void extractCMakeInputsData(const QVariantMap &data);
void extractCacheData(const QVariantMap &data);
void addCMakeLists(CMakeProjectNode *root, const QList<ProjectExplorer::FileNode *> &cmakeLists);
void addProjects(CMakeProjectNode *root, const QList<Project *> &projects,
QHash<Utils::FileName, ProjectExplorer::ProjectNode *>
addCMakeLists(CMakeProjectNode *root, const QList<ProjectExplorer::FileNode *> &cmakeLists);
void addProjects(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
const QList<Project *> &projects,
const QList<const ProjectExplorer::FileNode *> &allFiles);
void addTargets(CMakeProjectNode *root, const QList<Target *> &targets,
void addTargets(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
const QList<Target *> &targets,
const QHash<Utils::FileName, QList<const ProjectExplorer::FileNode *>> &headers);
void addFileGroups(ProjectExplorer::ProjectNode *targetRoot,
const Utils::FileName &sourceDirectory,

View File

@@ -67,19 +67,20 @@ void SearchResultTreeItemDelegate::paint(QPainter *painter, const QStyleOptionVi
// icon
QIcon icon = index.model()->data(index, ItemDataRoles::ResultIconRole).value<QIcon>();
if (!icon.isNull())
pixmapRect = QRect(0, 0, iconSize, iconSize);
if (!icon.isNull()) {
const QSize size = icon.actualSize(QSize(iconSize, iconSize));
pixmapRect = QRect(0, 0, size.width(), size.height());
}
// text
textRect = opt.rect.adjusted(0, 0, checkRect.width() + pixmapRect.width(), 0);
// do layout
doLayout(opt, &checkRect, &pixmapRect, &textRect, false);
// ---- draw the items
// icon
if (!icon.isNull())
QItemDelegate::drawDecoration(painter, opt, pixmapRect, icon.pixmap(iconSize));
icon.paint(painter, pixmapRect, option.decorationAlignment);
// line numbers
int lineNumberAreaWidth = drawLineNumber(painter, opt, textRect, index);

View File

@@ -49,11 +49,6 @@ IWelcomePage::~IWelcomePage()
{
}
int IWelcomePage::screenDependHeightDistance()
{
return std::min(50, std::max(16, ICore::mainWindow()->height() / 30));
}
static QPalette buttonPalette(bool isActive, bool isCursorInside, bool forText)
{
QPalette pal;

View File

@@ -55,8 +55,6 @@ public:
virtual int priority() const { return 0; }
virtual Core::Id id() const = 0;
virtual QWidget *createWidget() const = 0;
static int screenDependHeightDistance();
};
class WelcomePageButtonPrivate;

View File

@@ -102,6 +102,7 @@ public:
CompletionList(QWidget *parent = 0);
void resize();
void resizeHeaders();
QSize preferredSize() const { return m_preferredSize; }
void focusOutEvent (QFocusEvent *event) {
@@ -217,10 +218,14 @@ void LocatorModel::addEntries(const QList<LocatorFilterEntry> &entries)
{
beginInsertRows(QModelIndex(), mEntries.size(), mEntries.size() + entries.size() - 1);
mEntries.append(entries);
hasExtraInfo = hasExtraInfo || Utils::anyOf(entries, [](const LocatorFilterEntry &e) {
return !e.extraInfo.isEmpty();
});
endInsertRows();
if (hasExtraInfo)
return;
if (Utils::anyOf(entries, [](const LocatorFilterEntry &e) { return !e.extraInfo.isEmpty();})) {
beginInsertColumns(QModelIndex(), 1, 1);
hasExtraInfo = true;
endInsertColumns();
}
}
// =========== CompletionList ===========
@@ -252,8 +257,14 @@ void CompletionList::resize()
const int width = qMax(730, windowSize.width() * 2 / 3);
m_preferredSize = QSize(width, shint.height() * 17 + frameWidth() * 2);
header()->resizeSection(0, width / 2);
QTreeView::resize(m_preferredSize);
resizeHeaders();
}
void CompletionList::resizeHeaders()
{
header()->resizeSection(0, m_preferredSize.width() / 2);
header()->resizeSection(1, 0); // last section is auto resized because of stretchLastSection
}
// =========== LocatorWidget ===========
@@ -303,6 +314,8 @@ LocatorWidget::LocatorWidget(Locator *qop) :
m_completionList->setModel(m_locatorModel);
m_completionList->resize();
connect(m_locatorModel, &QAbstractItemModel::columnsInserted,
m_completionList, &CompletionList::resizeHeaders);
m_filterMenu->addAction(m_refreshAction);
m_filterMenu->addAction(m_configureAction);

View File

@@ -33,6 +33,11 @@
namespace CppTools {
static QStringList commonOptions()
{
return { QStringLiteral("-Wno-unknown-pragmas") };
}
static void addConfigForQuestionableConstructs(ClangDiagnosticConfigsModel &model)
{
ClangDiagnosticConfig config;
@@ -40,10 +45,10 @@ static void addConfigForQuestionableConstructs(ClangDiagnosticConfigsModel &mode
config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel",
"Warnings for questionable constructs"));
config.setIsReadOnly(true);
config.setCommandLineOptions({
config.setCommandLineOptions(QStringList{
QStringLiteral("-Wall"),
QStringLiteral("-Wextra"),
});
} + commonOptions());
model.appendOrUpdate(config);
}
@@ -55,7 +60,7 @@ static void addConfigForPedanticWarnings(ClangDiagnosticConfigsModel &model)
config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel",
"Pedantic Warnings"));
config.setIsReadOnly(true);
config.setCommandLineOptions({QStringLiteral("-Wpedantic")});
config.setCommandLineOptions(QStringList{QStringLiteral("-Wpedantic")} + commonOptions());
model.appendOrUpdate(config);
}
@@ -67,7 +72,7 @@ static void addConfigForAlmostEveryWarning(ClangDiagnosticConfigsModel &model)
config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel",
"Warnings for almost everything"));
config.setIsReadOnly(true);
config.setCommandLineOptions({
config.setCommandLineOptions(QStringList{
QStringLiteral("-Weverything"),
QStringLiteral("-Wno-c++98-compat"),
QStringLiteral("-Wno-c++98-compat-pedantic"),
@@ -79,7 +84,7 @@ static void addConfigForAlmostEveryWarning(ClangDiagnosticConfigsModel &model)
QStringLiteral("-Wno-documentation"),
QStringLiteral("-Wno-shadow"),
QStringLiteral("-Wno-missing-prototypes"), // Not optimal for C projects.
});
} + commonOptions());
model.appendOrUpdate(config);
}

View File

@@ -458,7 +458,7 @@ public:
, m_replaceDotForArrow(static_cast<CppAssistProposalModel *>(model)->m_replaceDotForArrow)
{}
bool isCorrective() const override { return m_replaceDotForArrow; }
bool isCorrective(TextEditorWidget *) const override { return m_replaceDotForArrow; }
void makeCorrection(TextEditorWidget *editorWidget) override;
private:

View File

@@ -45,8 +45,6 @@ public:
QString displayName() const override { return m_name; }
QStringList files(FilesMode fileMode) const override { Q_UNUSED(fileMode); return QStringList(); }
private:
QString m_name;
};

View File

@@ -2320,7 +2320,9 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QString &what, c
isFatalWinException(exception.exceptionCode) ? Task::Error : Task::Warning;
const FileName fileName = exception.file.isEmpty()
? FileName() : FileName::fromUserInput(exception.file);
TaskHub::addTask(type, exception.toString(false).trimmed(),
const QString taskEntry = tr("Debugger encountered an exception: %1").arg(
exception.toString(false).trimmed());
TaskHub::addTask(type, taskEntry,
Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME,
fileName, exception.lineNumber);
}

View File

@@ -326,9 +326,6 @@ void GenericProject::parseProject(RefreshOptions options)
// TODO: Possibly load some configuration from the project file
//QSettings projectInfo(m_fileName, QSettings::IniFormat);
}
if (options & Files)
emit fileListChanged();
}
void GenericProject::refresh(RefreshOptions options)
@@ -469,22 +466,11 @@ void GenericProject::activeBuildConfigurationWasChanged()
refresh(Everything);
}
QStringList GenericProject::files() const
{
return m_files;
}
QString GenericProject::displayName() const
{
return projectFilePath().toFileInfo().completeBaseName();
}
QStringList GenericProject::files(FilesMode fileMode) const
{
Q_UNUSED(fileMode);
return m_files;
}
QStringList GenericProject::buildTargets() const
{
const QStringList targets = { "all", "clean" };

View File

@@ -44,8 +44,6 @@ public:
QString displayName() const override;
QStringList files(FilesMode fileMode) const override;
QStringList buildTargets() const;
bool addFiles(const QStringList &filePaths);
@@ -61,8 +59,6 @@ public:
void refresh(RefreshOptions options);
QStringList files() const;
protected:
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;

View File

@@ -87,7 +87,8 @@ void GenericProjectPlugin::editFiles()
if (!genericProject)
return;
SelectableFilesDialogEditFiles sfd(genericProject->projectDirectory(),
Utils::transform(genericProject->files(), [](const QString &f) { return Utils::FileName::fromString(f); }),
Utils::transform(genericProject->files(Project::AllFiles),
[](const QString &f) { return Utils::FileName::fromString(f); }),
ICore::mainWindow());
if (sfd.exec() == QDialog::Accepted)
genericProject->setFiles(Utils::transform(sfd.selectedFiles(), &Utils::FileName::toString));

View File

@@ -92,6 +92,7 @@ BranchDialog::BranchDialog(QWidget *parent) :
connect(m_model, &QAbstractItemModel::dataChanged, this, &BranchDialog::resizeColumns);
connect(m_model, &QAbstractItemModel::rowsInserted, this, &BranchDialog::resizeColumns);
connect(m_model, &QAbstractItemModel::rowsRemoved, this, &BranchDialog::resizeColumns);
connect(m_model, &QAbstractItemModel::modelReset, this, &BranchDialog::expandAndResize);
m_ui->branchView->selectionModel()->clear();
}
@@ -111,7 +112,10 @@ void BranchDialog::refresh(const QString &repository, bool force)
QString errorMessage;
if (!m_model->refresh(m_repository, &errorMessage))
VcsOutputWindow::appendError(errorMessage);
}
void BranchDialog::expandAndResize()
{
m_ui->branchView->expandAll();
resizeColumns();
}

View File

@@ -56,6 +56,7 @@ public:
void refreshIfSame(const QString &repository);
private:
void expandAndResize();
void resizeColumns();
void enableButtons();
void refreshCurrentRepository();

View File

@@ -55,13 +55,12 @@ class BranchNode
{
public:
BranchNode() :
parent(0),
name("<ROOT>")
{ }
BranchNode(const QString &n, const QString &s = QString(), const QString &t = QString(),
const QDateTime &dt = QDateTime()) :
parent(0), name(n), sha(s), tracking(t), dateTime(dt)
name(n), sha(s), tracking(t), dateTime(dt)
{ }
~BranchNode()
@@ -120,7 +119,7 @@ public:
if (children.at(i)->name == name)
return children.at(i);
}
return 0;
return nullptr;
}
QStringList fullName(bool includePrefix = false) const
@@ -182,7 +181,7 @@ public:
return children.indexOf(node);
}
BranchNode *parent;
BranchNode *parent = nullptr;
QList<BranchNode *> children;
QString name;
@@ -273,7 +272,7 @@ QVariant BranchModel::data(const QModelIndex &index, int role) const
return res;
}
case Qt::EditRole:
return index.column() == 0 ? node->name : QVariant();
return index.column() == 0 ? node->fullName().join('/') : QVariant();
case Qt::ToolTipRole:
if (!node->isLeaf())
return QVariant();
@@ -308,24 +307,11 @@ bool BranchModel::setData(const QModelIndex &index, const QVariant &value, int r
if (newName.isEmpty())
return false;
if (node->name == newName)
return true;
QStringList oldFullName = node->fullName();
node->name = newName;
QStringList newFullName = node->fullName();
QString output;
QString errorMessage;
if (!m_client->synchronousBranchCmd(m_workingDirectory,
{"-m", oldFullName.last(), newFullName.last()},
&output, &errorMessage)) {
node->name = oldFullName.last();
VcsOutputWindow::appendError(errorMessage);
const QString oldName = node->fullName().join('/');
if (oldName == newName)
return false;
}
emit dataChanged(index, index);
renameBranch(oldName, newName);
return true;
}
@@ -349,7 +335,7 @@ void BranchModel::clear()
if (hasTags())
m_rootNode->children.takeLast();
m_currentBranch = 0;
m_currentBranch = nullptr;
m_obsoleteLocalBranches.clear();
}
@@ -375,8 +361,8 @@ bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage
parseOutputLine(l);
if (m_currentBranch) {
if (m_currentBranch->parent == m_rootNode->children.at(LocalBranches))
m_currentBranch = 0;
if (m_currentBranch->isLocal())
m_currentBranch = nullptr;
setCurrentBranch();
}
@@ -392,11 +378,13 @@ void BranchModel::setCurrentBranch()
return;
BranchNode *local = m_rootNode->children.at(LocalBranches);
int pos = 0;
for (pos = 0; pos < local->count(); ++pos) {
if (local->children.at(pos)->name == currentBranch)
m_currentBranch = local->children[pos];
const QStringList branchParts = currentBranch.split('/');
for (const QString &branchPart : branchParts) {
local = local->childOfName(branchPart);
if (!local)
return;
}
m_currentBranch = local;
}
void BranchModel::renameBranch(const QString &oldName, const QString &newName)
@@ -448,8 +436,7 @@ QString BranchModel::fullName(const QModelIndex &idx, bool includePrefix) const
BranchNode *node = indexToNode(idx);
if (!node || !node->isLeaf())
return QString();
QStringList path = node->fullName(includePrefix);
return path.join('/');
return node->fullName(includePrefix).join('/');
}
QStringList BranchModel::localBranchNames() const
@@ -623,7 +610,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel
if (slash != -1) {
const QString nodeName = name.left(slash);
int pos = positionForName(local, nodeName);
BranchNode *child = (pos == local->count()) ? 0 : local->children.at(pos);
BranchNode *child = (pos == local->count()) ? nullptr : local->children.at(pos);
if (!child || child->name != nodeName) {
child = new BranchNode(nodeName);
beginInsertRows(nodeToIndex(local, 0), pos, pos);
@@ -697,7 +684,7 @@ void BranchModel::parseOutputLine(const QString &line)
QStringList nameParts = fullName.split('/');
nameParts.removeFirst(); // remove refs...
BranchNode *root = 0;
BranchNode *root = nullptr;
if (nameParts.first() == "heads") {
root = m_rootNode->children.at(LocalBranches);
} else if (nameParts.first() == "remotes") {
@@ -731,7 +718,7 @@ void BranchModel::parseOutputLine(const QString &line)
BranchNode *BranchModel::indexToNode(const QModelIndex &index) const
{
if (index.column() > 1)
return 0;
return nullptr;
if (!index.isValid())
return m_rootNode;
return static_cast<BranchNode *>(index.internalPointer());

View File

@@ -148,7 +148,7 @@
<item>
<widget class="QCheckBox" name="signOffCheckBox">
<property name="text">
<string>&amp;Sign off</string>
<string>Sign off</string>
</property>
</widget>
</item>

View File

@@ -17,6 +17,11 @@ QtcPlugin {
"ios.qrc",
"iosanalyzesupport.cpp",
"iosanalyzesupport.h",
"iosbuildconfiguration.cpp",
"iosbuildconfiguration.h",
"iosbuildsettingswidget.cpp",
"iosbuildsettingswidget.h",
"iosbuildsettingswidget.ui",
"iosbuildstep.cpp",
"iosbuildstep.h",
"iosbuildstep.ui",

View File

@@ -49,17 +49,15 @@ public:
bool isSigningAutoManaged, QWidget *parent = 0);
~IosBuildSettingsWidget();
public:
bool isSigningAutomaticallyManaged() const;
private slots:
void onSigningEntityComboIndexChanged();
void onReset();
signals:
void signingSettingsChanged(bool isAutoManaged, QString identifier);
private:
void onSigningEntityComboIndexChanged();
void onReset();
void setDefaultSigningIdentfier(const QString &identifier) const;
void configureSigningUi(bool autoManageSigning);
void populateDevelopmentTeams();

View File

@@ -34,6 +34,7 @@
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/kitinformation.h>
@@ -73,11 +74,6 @@ QString NimProject::displayName() const
return projectFilePath().toFileInfo().completeBaseName();
}
QStringList NimProject::files(FilesMode) const
{
return m_files;
}
bool NimProject::needsConfiguration() const
{
return targets().empty();
@@ -133,7 +129,7 @@ void NimProject::collectProjectFiles()
void NimProject::updateProject()
{
QStringList oldFiles = m_files;
const QStringList oldFiles = m_files;
m_files.clear();
QList<FileNode *> fileNodes = Utils::filtered(m_futureWatcher.future().result(),
@@ -158,9 +154,6 @@ void NimProject::updateProject()
newRoot->setDisplayName(displayName());
newRoot->addNestedNodes(fileNodes);
setRootProjectNode(newRoot);
emit fileListChanged();
emit parsingFinished();
}
@@ -182,12 +175,10 @@ bool NimProject::supportsKit(Kit *k, QString *errorMessage) const
FileNameList NimProject::nimFiles() const
{
FileNameList result;
rootProjectNode()->forEachNode([&](FileNode *file) {
if (file->displayName().endsWith(QLatin1String(".nim")))
result.append(file->filePath());
const QStringList nim = files(AllFiles, [](const ProjectExplorer::FileNode *fn) {
return fn->filePath().endsWith(".nim");
});
return result;
return Utils::transform(nim, [](const QString &fp) { return Utils::FileName::fromString(fp); });
}
QVariantMap NimProject::toMap() const
@@ -203,4 +194,4 @@ Project::RestoreResult NimProject::fromMap(const QVariantMap &map, QString *erro
return Project::fromMap(map, errorMessage);
}
}
} // namespace Nim

View File

@@ -42,7 +42,6 @@ public:
explicit NimProject(const Utils::FileName &fileName);
QString displayName() const override;
QStringList files(FilesMode) const override;
bool needsConfiguration() const override;
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;
Utils::FileNameList nimFiles() const;

View File

@@ -76,10 +76,10 @@ qtHaveModule(designercomponents_private) {
}
DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER)
isEmpty(DO_NOT_BUILD_QMLDESIGNER):qtHaveModule(quick) {
isEmpty(DO_NOT_BUILD_QMLDESIGNER):qtHaveModule(quick-private) {
SUBDIRS += qmldesigner
} else {
!qtHaveModule(quick) {
!qtHaveModule(quick-private) {
warning("QmlDesigner plugin has been disabled since the Qt Quick module is not available.")
} else {
warning("QmlDesigner plugin has been disabled since DO_NOT_BUILD_QMLDESIGNER is set.")

View File

@@ -348,9 +348,11 @@ Abi::Abi(const Architecture &a, const OS &o,
case Abi::VxWorks:
if (m_osFlavor != VxWorksFlavor)
m_osFlavor = VxWorksFlavor;
break;
case Abi::QnxOS:
if (m_osFlavor != GenericQnxFlavor)
m_osFlavor = UnknownFlavor;
break;
}
}

View File

@@ -84,38 +84,6 @@ const char PLUGIN_SETTINGS_KEY[] = "ProjectExplorer.Project.PluginSettings";
namespace ProjectExplorer {
class ContainerNode : public ProjectNode
{
public:
ContainerNode(Project *project)
: ProjectNode(Utils::FileName()),
m_project(project)
{}
QString displayName() const final
{
QString name = m_project->displayName();
const QFileInfo fi = m_project->projectFilePath().toFileInfo();
const QString dir = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
if (Core::IVersionControl *vc = Core::VcsManager::findVersionControlForDirectory(dir)) {
QString vcsTopic = vc->vcsTopic(dir);
if (!vcsTopic.isEmpty())
name += " [" + vcsTopic + ']';
}
return name;
}
QList<ProjectAction> supportedActions(Node *) const final
{
return {};
}
private:
Project *m_project;
};
// -------------------------------------------------------------------------
// Project
// -------------------------------------------------------------------------
@@ -461,6 +429,14 @@ void Project::setRootProjectNode(ProjectNode *root)
if (d->m_rootProjectNode == root)
return;
if (root && root->nodes().isEmpty()) {
// Something went wrong with parsing: At least the project file needs to be
// shown so that the user can fix the breakage.
// Do not leak root and use default project tree in this case.
delete root;
root = nullptr;
}
ProjectTree::applyTreeManager(root);
ProjectNode *oldNode = d->m_rootProjectNode;
@@ -468,6 +444,7 @@ void Project::setRootProjectNode(ProjectNode *root)
if (root)
root->setParentFolderNode(&d->m_containerNode);
ProjectTree::emitSubtreeChanged(root);
emit fileListChanged();
delete oldNode;
}
@@ -516,6 +493,25 @@ Project::RestoreResult Project::restoreSettings(QString *errorMessage)
return result;
}
QStringList Project::files(Project::FilesMode fileMode,
const std::function<bool (const FileNode *)> &filter) const
{
QStringList result;
if (!rootProjectNode())
return result;
rootProjectNode()->forEachNode([&](const FileNode *fn) {
if (filter && !filter(fn))
return;
if ((fileMode == AllFiles)
|| (fileMode == SourceFiles && !fn->isGenerated())
|| (fileMode == GeneratedFiles && fn->isGenerated()))
result.append(fn->filePath().toString());
});
return result;
}
/*!
Serializes all data into a QVariantMap.
@@ -573,7 +569,7 @@ ProjectNode *Project::rootProjectNode() const
return d->m_rootProjectNode;
}
ProjectNode *Project::containerNode() const
ContainerNode *Project::containerNode() const
{
return &d->m_containerNode;
}

View File

@@ -36,6 +36,8 @@
#include <QObject>
#include <QFileSystemModel>
#include <functional>
namespace Core {
class IDocument;
class Context;
@@ -46,7 +48,9 @@ namespace Utils { class MacroExpander; }
namespace ProjectExplorer {
class BuildInfo;
class ContainerNode;
class EditorConfiguration;
class FileNode;
class NamedWidget;
class ProjectImporter;
class ProjectNode;
@@ -81,7 +85,7 @@ public:
static Utils::FileName projectDirectory(const Utils::FileName &top);
virtual ProjectNode *rootProjectNode() const;
ProjectNode *containerNode() const;
ContainerNode *containerNode() const;
bool hasActiveBuildSettings() const;
@@ -112,7 +116,8 @@ public:
GeneratedFiles = 0x2,
AllFiles = SourceFiles | GeneratedFiles
};
virtual QStringList files(FilesMode fileMode) const = 0;
virtual QStringList files(FilesMode fileMode,
const std::function<bool(const FileNode *)> &filter = {}) const;
virtual QStringList filesGeneratedFrom(const QString &sourceFile) const;
static QString makeUnique(const QString &preferredName, const QStringList &usedNames);
@@ -143,7 +148,6 @@ public:
Utils::MacroExpander *macroExpander() const;
signals:
void displayNameChanged();
void fileListChanged();
// Note: activeTarget can be 0 (if no targets are defined).

View File

@@ -278,26 +278,6 @@ public:
void buildQueueFinished(bool success);
void buildStateChanged(ProjectExplorer::Project * pro);
void buildProjectOnly();
void handleBuildProject();
void buildProjectContextMenu();
void buildProjectDependenciesContextMenu();
void buildSession();
void rebuildProjectOnly();
void rebuildProject();
void rebuildProjectContextMenu();
void rebuildProjectDependenciesContextMenu();
void rebuildSession();
void deployProjectOnly();
void deployProject();
void deployProjectContextMenu();
void deploySession();
void cleanProjectOnly();
void cleanProject();
void cleanProjectContextMenu();
void cleanProjectDependenciesContextMenu();
void cleanSession();
void cancelBuild();
void loadAction();
void handleUnloadProject();
void unloadProjectContextMenu();
@@ -1203,50 +1183,85 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
tmp = Utils::HostOsInfo::isWindowsHost() ? 1 : 0;
dd->m_projectExplorerSettings.stopBeforeBuild = ProjectExplorerSettings::StopBeforeBuild(tmp);
auto buildManager = new BuildManager(this, dd->m_cancelBuildAction);
connect(buildManager, &BuildManager::buildStateChanged,
dd, &ProjectExplorerPluginPrivate::buildStateChanged);
connect(buildManager, &BuildManager::buildQueueFinished,
dd, &ProjectExplorerPluginPrivate::buildQueueFinished, Qt::QueuedConnection);
connect(dd->m_sessionManagerAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::showSessionManager);
connect(dd->m_newAction, &QAction::triggered,
dd, &ProjectExplorerPlugin::openNewProjectDialog);
connect(dd->m_loadAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::loadAction);
connect(dd->m_buildProjectOnlyAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::buildProjectOnly);
connect(dd->m_buildProjectOnlyAction, &QAction::triggered, dd, [this] {
dd->queue({ SessionManager::startupProject() }, { Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_buildAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleBuildProject);
connect(dd->m_buildActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::buildProjectContextMenu);
connect(dd->m_buildDependenciesActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::buildProjectDependenciesContextMenu);
connect(dd->m_buildSessionAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::buildSession);
connect(dd->m_rebuildProjectOnlyAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::rebuildProjectOnly);
connect(dd->m_rebuildAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::rebuildProject);
connect(dd->m_rebuildActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::rebuildProjectContextMenu);
connect(dd->m_rebuildDependenciesActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::rebuildProjectDependenciesContextMenu);
connect(dd->m_rebuildSessionAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::rebuildSession);
connect(dd->m_deployProjectOnlyAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::deployProjectOnly);
connect(dd->m_deployAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::deployProject);
connect(dd->m_deployActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::deployProjectContextMenu);
connect(dd->m_deploySessionAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::deploySession);
connect(dd->m_cleanProjectOnlyAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cleanProjectOnly);
connect(dd->m_cleanAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cleanProject);
connect(dd->m_cleanActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cleanProjectContextMenu);
connect(dd->m_cleanDependenciesActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cleanProjectDependenciesContextMenu);
connect(dd->m_cleanSessionAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cleanSession);
dd, [this] {
dd->queue(SessionManager::projectOrder(SessionManager::startupProject()),
{ Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_buildActionContextMenu, &QAction::triggered, dd, [this] {
dd->queue({ ProjectTree::currentProject() }, { Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_buildDependenciesActionContextMenu, &QAction::triggered, dd, [this] {
dd->queue(SessionManager::projectOrder(ProjectTree::currentProject()),
{ Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_buildSessionAction, &QAction::triggered, dd, [this] {
dd->queue(SessionManager::projectOrder(), { Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_rebuildProjectOnlyAction, &QAction::triggered, dd, [this] {
dd->queue({ SessionManager::startupProject() },
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_rebuildAction, &QAction::triggered, dd, [this] {
dd->queue(SessionManager::projectOrder(SessionManager::startupProject()),
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_rebuildActionContextMenu, &QAction::triggered, dd, [this] {
dd->queue({ ProjectTree::currentProject() },
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_rebuildDependenciesActionContextMenu, &QAction::triggered, dd, [this] {
dd->queue(SessionManager::projectOrder(ProjectTree::currentProject()),
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_rebuildSessionAction, &QAction::triggered, dd, [this] {
dd->queue(SessionManager::projectOrder(),
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
});
connect(dd->m_deployProjectOnlyAction, &QAction::triggered, dd, [this] {
dd->deploy({ SessionManager::startupProject() });
});
connect(dd->m_deployAction, &QAction::triggered, dd, [this] {
dd->deploy(SessionManager::projectOrder(SessionManager::startupProject()));
});
connect(dd->m_deployActionContextMenu, &QAction::triggered, dd, [this] {
dd->deploy({ ProjectTree::currentProject() });
});
connect(dd->m_deploySessionAction, &QAction::triggered, dd, [this] {
dd->deploy(SessionManager::projectOrder());
});
connect(dd->m_cleanProjectOnlyAction, &QAction::triggered, dd, [this] {
dd->queue({ SessionManager::startupProject() }, { Id(Constants::BUILDSTEPS_CLEAN) });
});
connect(dd->m_cleanAction, &QAction::triggered, dd, [this] {
dd->queue(SessionManager::projectOrder(SessionManager::startupProject()),
{ Id(Constants::BUILDSTEPS_CLEAN) });
});
connect(dd->m_cleanActionContextMenu, &QAction::triggered, dd, [this] {
dd->queue({ ProjectTree::currentProject() }, { Id(Constants::BUILDSTEPS_CLEAN) });
});
connect(dd->m_cleanDependenciesActionContextMenu, &QAction::triggered, dd, [this] {
dd->queue(SessionManager::projectOrder(ProjectTree::currentProject()),
{ Id(Constants::BUILDSTEPS_CLEAN) });
});
connect(dd->m_cleanSessionAction, &QAction::triggered, dd, [this] {
dd->queue(SessionManager::projectOrder(), { Id(Constants::BUILDSTEPS_CLEAN) });
});
connect(dd->m_runAction, &QAction::triggered,
dd, [this]() { m_instance->runStartupProject(Constants::NORMAL_RUN_MODE); });
connect(dd->m_runActionContextMenu, &QAction::triggered,
@@ -1254,7 +1269,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(dd->m_runWithoutDeployAction, &QAction::triggered,
dd, [this]() { m_instance->runStartupProject(Constants::NORMAL_RUN_MODE, true); });
connect(dd->m_cancelBuildAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::cancelBuild);
BuildManager::instance(), &BuildManager::cancel);
connect(dd->m_unloadAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleUnloadProject);
connect(dd->m_unloadActionContextMenu, &QAction::triggered,
@@ -1297,12 +1312,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(this, &ProjectExplorerPlugin::settingsChanged,
dd, &ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu);
auto buildManager = new BuildManager(this, dd->m_cancelBuildAction);
connect(buildManager, &BuildManager::buildStateChanged,
dd, &ProjectExplorerPluginPrivate::buildStateChanged);
connect(buildManager, &BuildManager::buildQueueFinished,
dd, &ProjectExplorerPluginPrivate::buildQueueFinished, Qt::QueuedConnection);
connect(ICore::instance(), &ICore::newItemDialogStateChanged,
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions);
@@ -2353,119 +2362,9 @@ int ProjectExplorerPluginPrivate::queue(QList<Project *> projects, QList<Id> ste
return stepLists.count();
}
void ProjectExplorerPluginPrivate::buildProjectOnly()
{
queue(QList<Project *>() << SessionManager::startupProject(), QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPlugin::buildProject(Project *p)
{
dd->queue(SessionManager::projectOrder(p),
QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::handleBuildProject()
{
queue(SessionManager::projectOrder(SessionManager::startupProject()),
QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::buildProjectContextMenu()
{
queue(QList<Project *>() << ProjectTree::currentProject(),
QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::buildProjectDependenciesContextMenu()
{
queue(SessionManager::projectOrder(ProjectTree::currentProject()),
QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::buildSession()
{
queue(SessionManager::projectOrder(),
QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::rebuildProjectOnly()
{
queue(QList<Project *>() << SessionManager::startupProject(),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::rebuildProject()
{
queue(SessionManager::projectOrder(SessionManager::startupProject()),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::rebuildProjectContextMenu()
{
queue(QList<Project *>() << ProjectTree::currentProject(),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::rebuildProjectDependenciesContextMenu()
{
queue(SessionManager::projectOrder(ProjectTree::currentProject()),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::rebuildSession()
{
queue(SessionManager::projectOrder(),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
}
void ProjectExplorerPluginPrivate::deployProjectOnly()
{
deploy(QList<Project *>() << SessionManager::startupProject());
}
void ProjectExplorerPluginPrivate::deployProject()
{
deploy(SessionManager::projectOrder(SessionManager::startupProject()));
}
void ProjectExplorerPluginPrivate::deployProjectContextMenu()
{
deploy(QList<Project *>() << ProjectTree::currentProject());
}
void ProjectExplorerPluginPrivate::deploySession()
{
deploy(SessionManager::projectOrder());
}
void ProjectExplorerPluginPrivate::cleanProjectOnly()
{
queue(QList<Project *>() << SessionManager::startupProject(),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
}
void ProjectExplorerPluginPrivate::cleanProject()
{
queue(SessionManager::projectOrder(SessionManager::startupProject()),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
}
void ProjectExplorerPluginPrivate::cleanProjectContextMenu()
{
queue(QList<Project *>() << ProjectTree::currentProject(),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
}
void ProjectExplorerPluginPrivate::cleanProjectDependenciesContextMenu()
{
queue(SessionManager::projectOrder(ProjectTree::currentProject()),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
}
void ProjectExplorerPluginPrivate::cleanSession()
{
queue(SessionManager::projectOrder(),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
dd->queue(SessionManager::projectOrder(p), { Id(Constants::BUILDSTEPS_BUILD) });
}
void ProjectExplorerPluginPrivate::runProjectContextMenu()
@@ -2881,12 +2780,6 @@ void ProjectExplorerPluginPrivate::slotUpdateRunActions()
m_runWithoutDeployAction->setEnabled(state);
}
void ProjectExplorerPluginPrivate::cancelBuild()
{
if (BuildManager::isBuilding())
BuildManager::cancel();
}
void ProjectExplorerPluginPrivate::addToRecentProjects(const QString &fileName, const QString &displayName)
{
if (fileName.isEmpty())
@@ -3015,7 +2908,13 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
if (currentNode && currentNode->managingProject()) {
QList<ProjectAction> actions = currentNode->supportedActions(currentNode);
if (ProjectNode *pn = currentNode->asProjectNode()) {
ProjectNode *pn;
if (ContainerNode *cn = currentNode->asContainerNode())
pn = cn->rootProjectNode();
else
pn = currentNode->asProjectNode();
if (pn) {
if (ProjectTree::currentProject() && pn == ProjectTree::currentProject()->rootProjectNode()) {
m_runActionContextMenu->setVisible(true);
} else {

View File

@@ -238,13 +238,8 @@ ExpandData FlatModel::expandDataForNode(const Node *node) const
void FlatModel::handleProjectAdded(Project *project)
{
Node *node = project->rootProjectNode();
Node *node = project->containerNode();
m_toExpand.insert(expandDataForNode(node));
if (WrapperNode *wrapper = wrapperForNode(node)) {
wrapper->forFirstLevelChildren([this](WrapperNode *child) {
m_toExpand.insert(expandDataForNode(child->m_node));
});
}
update();
}
@@ -266,7 +261,8 @@ void FlatModel::addFolderNode(WrapperNode *parent, FolderNode *folderNode, QSet<
{
for (Node *node : folderNode->nodes()) {
if (FolderNode *subFolderNode = node->asFolderNode()) {
if (!filter(subFolderNode) && !seen->contains(subFolderNode)) {
const bool isHidden = m_filterProjects && !subFolderNode->showInSimpleTree();
if (!isHidden && !seen->contains(subFolderNode)) {
seen->insert(subFolderNode);
auto node = new WrapperNode(subFolderNode);
parent->appendChild(node);
@@ -275,11 +271,9 @@ void FlatModel::addFolderNode(WrapperNode *parent, FolderNode *folderNode, QSet<
} else {
addFolderNode(parent, subFolderNode, seen);
}
}
}
for (Node *node : folderNode->nodes()) {
if (FileNode *fileNode = node->asFileNode()) {
if (!filter(fileNode) && !seen->contains(fileNode)) {
} else if (FileNode *fileNode = node->asFileNode()) {
const bool isHidden = m_filterProjects && fileNode->isGenerated();
if (!isHidden && !seen->contains(fileNode)) {
seen->insert(fileNode);
parent->appendChild(new WrapperNode(fileNode));
}
@@ -353,19 +347,6 @@ Node *FlatModel::nodeForIndex(const QModelIndex &index) const
return flatNode ? flatNode->m_node : nullptr;
}
bool FlatModel::filter(Node *node) const
{
bool isHidden = false;
if (FolderNode *folderNode = node->asFolderNode()) {
if (m_filterProjects)
isHidden = !folderNode->showInSimpleTree();
} else if (FileNode *fileNode = node->asFileNode()) {
if (m_filterGeneratedFiles)
isHidden = fileNode->isGenerated();
}
return isHidden;
}
const QLoggingCategory &FlatModel::logger()
{
static QLoggingCategory logger("qtc.projectexplorer.flatmodel");

View File

@@ -85,8 +85,6 @@ signals:
void requestExpansion(const QModelIndex &index);
private:
bool filter(Node *node) const; // Returns true if node is hidden.
bool m_filterProjects = false;
bool m_filterGeneratedFiles = true;

View File

@@ -25,6 +25,7 @@
#include "projectnodes.h"
#include "project.h"
#include "projectexplorerconstants.h"
#include "projecttree.h"
@@ -77,6 +78,7 @@ static FolderNode *recursiveFindOrCreateFolderNode(FolderNode *folder,
directoryWithoutPrefix = directory.relativeChildPath(path);
} else {
isRelative = false;
path.clear();
directoryWithoutPrefix = directory;
}
}
@@ -170,8 +172,9 @@ FolderNode *Node::parentFolderNode() const
ProjectNode *Node::managingProject()
{
if (!m_parentFolderNode)
return nullptr;
if (asContainerNode())
return asContainerNode()->rootProjectNode();
QTC_ASSERT(m_parentFolderNode, return nullptr);
ProjectNode *pn = parentProjectNode();
return pn ? pn : asProjectNode(); // projects manage themselves...
}
@@ -499,8 +502,7 @@ void FolderNode::addNestedNode(FileNode *fileNode, const Utils::FileName &overri
const FolderNodeFactory &factory)
{
// Get relative path to rootNode
QString parentDir = fileNode->filePath().toFileInfo().absolutePath();
FolderNode *folder = recursiveFindOrCreateFolderNode(this, Utils::FileName::fromString(parentDir),
FolderNode *folder = recursiveFindOrCreateFolderNode(this, fileNode->filePath().parentDir(),
overrideBaseDir, factory);
folder->addNode(fileNode);
@@ -521,6 +523,8 @@ void FolderNode::compress()
{
QList<Node *> children = nodes();
if (auto subFolder = children.count() == 1 ? children.at(0)->asFolderNode() : nullptr) {
if (subFolder->nodeType() != nodeType())
return;
// Only one subfolder: Compress!
setDisplayName(QDir::toNativeSeparators(displayName() + "/" + subFolder->displayName()));
for (Node *n : subFolder->nodes()) {
@@ -788,4 +792,35 @@ bool FolderNode::isEmpty() const
return m_nodes.isEmpty();
}
ContainerNode::ContainerNode(Project *project)
: FolderNode(Utils::FileName(), NodeType::Project), m_project(project)
{}
QString ContainerNode::displayName() const
{
QString name = m_project->displayName();
const QFileInfo fi = m_project->projectFilePath().toFileInfo();
const QString dir = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
if (Core::IVersionControl *vc = Core::VcsManager::findVersionControlForDirectory(dir)) {
QString vcsTopic = vc->vcsTopic(dir);
if (!vcsTopic.isEmpty())
name += " [" + vcsTopic + ']';
}
return name;
}
QList<ProjectAction> ContainerNode::supportedActions(Node *node) const
{
if (Node *rootNode = m_project->rootProjectNode())
return rootNode->supportedActions(node);
return {};
}
ProjectNode *ContainerNode::rootProjectNode() const
{
return m_project->rootProjectNode();
}
} // namespace ProjectExplorer

View File

@@ -39,6 +39,8 @@
namespace Utils { class MimeType; }
namespace ProjectExplorer {
class Project;
class RunConfiguration;
enum class NodeType : quint16 {
@@ -92,6 +94,7 @@ enum ProjectAction {
class FileNode;
class FolderNode;
class ProjectNode;
class ContainerNode;
// Documentation inside.
class PROJECTEXPLORER_EXPORT Node : public QObject
@@ -115,8 +118,9 @@ public:
FolderNode *parentFolderNode() const; // parent folder or project
ProjectNode *managingProject(); // project managing this node.
// result is nullptr if node is the SessionNode
// or node if node is a ProjectNode directly below SessionNode
// result is the container's rootProject node if this is a project container node
// (i.e. possibly null)
// or node if node is a top-level ProjectNode directly below a container
// or node->parentProjectNode() for all other cases.
const ProjectNode *managingProject() const; // see above.
@@ -137,6 +141,8 @@ public:
virtual const FolderNode *asFolderNode() const { return nullptr; }
virtual ProjectNode *asProjectNode() { return nullptr; }
virtual const ProjectNode *asProjectNode() const { return nullptr; }
virtual ContainerNode *asContainerNode() { return nullptr; }
virtual const ContainerNode *asContainerNode() const { return nullptr; }
static bool sortByPath(const Node *a, const Node *b);
void setParentFolderNode(FolderNode *parentFolder);
@@ -297,6 +303,24 @@ protected:
explicit ProjectNode(const Utils::FileName &projectFilePath);
};
class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode
{
public:
ContainerNode(Project *project);
QString displayName() const final;
QList<ProjectAction> supportedActions(Node *node) const final;
ContainerNode *asContainerNode() final { return this; }
const ContainerNode *asContainerNode() const final { return this; }
ProjectNode *rootProjectNode() const;
private:
Project *m_project;
QList<Node *> m_nodes;
};
} // namespace ProjectExplorer
Q_DECLARE_METATYPE(ProjectExplorer::Node *)

View File

@@ -322,12 +322,14 @@ void ProjectTree::showContextMenu(ProjectTreeWidget *focus, const QPoint &global
contextMenu = Core::ActionManager::actionContainer(Constants::M_SESSIONCONTEXT)->menu();
} else {
switch (node->nodeType()) {
case NodeType::Project:
if (node->parentFolderNode())
case NodeType::Project: {
if ((node->parentFolderNode() && node->parentFolderNode()->asContainerNode())
|| node->asContainerNode())
contextMenu = Core::ActionManager::actionContainer(Constants::M_PROJECTCONTEXT)->menu();
else
contextMenu = Core::ActionManager::actionContainer(Constants::M_SUBPROJECTCONTEXT)->menu();
break;
}
case NodeType::VirtualFolder:
case NodeType::Folder:
contextMenu = Core::ActionManager::actionContainer(Constants::M_FOLDERCONTEXT)->menu();

View File

@@ -56,6 +56,7 @@ using namespace Core;
using namespace Utils;
const int LINK_HEIGHT = 35;
const char PROJECT_BASE_ID[] = "Welcome.OpenRecentProject";
namespace ProjectExplorer {
namespace Internal {
@@ -84,6 +85,12 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
return data.first;
case PrettyFilePathRole:
return Utils::withTildeHomePath(data.first);
case ShortcutRole: {
const Id projectBase = PROJECT_BASE_ID;
if (Command *cmd = ActionManager::command(projectBase.withSuffix(index.row() + 1)))
return cmd->keySequence().toString(QKeySequence::NativeText);
return QVariant();
}
default:
return QVariant();
}
@@ -108,6 +115,26 @@ void ProjectModel::resetProjects()
///////////////////
ProjectWelcomePage::ProjectWelcomePage()
{
const int actionsCount = 9;
Context welcomeContext(Core::Constants::C_WELCOME_MODE);
const Id projectBase = PROJECT_BASE_ID;
const Id sessionBase = SESSION_BASE_ID;
for (int i = 1; i <= actionsCount; ++i) {
auto act = new QAction(tr("Open Session #%1").arg(i), this);
Command *cmd = ActionManager::registerAction(act, sessionBase.withSuffix(i), welcomeContext);
cmd->setDefaultKeySequence(QKeySequence((UseMacShortcuts ? tr("Ctrl+Meta+%1") : tr("Ctrl+Alt+%1")).arg(i)));
connect(act, &QAction::triggered, this, [this, i] { openSessionAt(i - 1); });
act = new QAction(tr("Open Recent Project #%1").arg(i), this);
cmd = ActionManager::registerAction(act, projectBase.withSuffix(i), welcomeContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+%1").arg(i)));
connect(act, &QAction::triggered, this, [this, i] { openProjectAt(i - 1); });
}
}
Core::Id ProjectWelcomePage::id() const
{
return "Develop";
@@ -128,7 +155,21 @@ void ProjectWelcomePage::newProject()
void ProjectWelcomePage::openProject()
{
ProjectExplorerPlugin::openOpenProjectDialog();
ProjectExplorerPlugin::openOpenProjectDialog();
}
void ProjectWelcomePage::openSessionAt(int index)
{
QTC_ASSERT(m_sessionModel, return);
m_sessionModel->switchToSession(m_sessionModel->sessionAt(index));
}
void ProjectWelcomePage::openProjectAt(int index)
{
QTC_ASSERT(m_projectModel, return);
const QString projectFile = m_projectModel->data(m_projectModel->index(index, 0),
ProjectModel::FilePathRole).toString();
ProjectExplorerPlugin::openProjectWelcomePage(projectFile);
}
///////////////////
@@ -160,6 +201,7 @@ protected:
{
return itemRect;
}
virtual int shortcutRole() const = 0;
bool helpEvent(QHelpEvent *ev, QAbstractItemView *view,
const QStyleOptionViewItem &option, const QModelIndex &idx) final
@@ -169,9 +211,7 @@ protected:
return false;
}
QString shortcut;
if (idx.row() < m_shortcuts.size())
shortcut = m_shortcuts.at(idx.row());
QString shortcut = idx.data(shortcutRole()).toString();
QString name = idx.data(Qt::DisplayRole).toString();
QString tooltipText;
@@ -187,8 +227,6 @@ protected:
QToolTip::showText(ev->globalPos(), tooltipText, view);
return true;
}
QStringList m_shortcuts;
};
class SessionDelegate : public BaseDelegate
@@ -202,31 +240,11 @@ protected:
const bool expanded = m_expandedSessions.contains(idx.data(Qt::DisplayRole).toString());
return expanded ? itemRect.adjusted(0, 0, 0, -LINK_HEIGHT) : itemRect;
}
int shortcutRole() const override { return SessionModel::ShortcutRole; }
public:
SessionDelegate() {
const int actionsCount = 9;
Context welcomeContext(Core::Constants::C_WELCOME_MODE);
const Id sessionBase = "Welcome.OpenSession";
for (int i = 1; i <= actionsCount; ++i) {
auto act = new QAction(tr("Open Session #%1").arg(i), this);
Command *cmd = ActionManager::registerAction(act, sessionBase.withSuffix(i), welcomeContext);
cmd->setDefaultKeySequence(QKeySequence((UseMacShortcuts ? tr("Ctrl+Meta+%1") : tr("Ctrl+Alt+%1")).arg(i)));
m_shortcuts.append(cmd->keySequence().toString(QKeySequence::NativeText));
// connect(act, &QAction::triggered, this, [this, i] { openSessionTriggered(i-1); });
connect(cmd, &Command::keySequenceChanged, this, [this, i, cmd] {
m_shortcuts[i-1] = cmd->keySequence().toString(QKeySequence::NativeText);
// emit sessionsShortcutsChanged(m_sessionShortcuts);
});
}
}
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const final
{
static const QPixmap arrowUp = pixmap("expandarrow",Theme::Welcome_ForegroundSecondaryColor);
static const QPixmap arrowDown = QPixmap::fromImage(arrowUp.toImage().mirrored(false, true));
static const QPixmap sessionIcon = pixmap("session", Theme::Welcome_ForegroundSecondaryColor);
const QRect rc = option.rect;
@@ -236,17 +254,27 @@ public:
//const bool hovered = option.state & QStyle::State_MouseOver;
const bool hovered = option.rect.contains(mousePos);
const bool expanded = m_expandedSessions.contains(sessionName);
painter->fillRect(rc, hovered || expanded ? hoverColor : backgroundColor);
if (hovered)
painter->fillRect(expanded ? rc : rc.adjusted(0, 0, -24, 0), hoverColor);
const int x = rc.x();
const int x1 = x + 36;
const int y = rc.y();
const int firstBase = y + 18;
painter->drawPixmap(x + 11, y + 5, sessionIcon);
painter->drawPixmap(x + 11, y + 6, sessionIcon);
if (hovered || expanded)
painter->drawPixmap(rc.right() - 16, y + 5, expanded ? arrowDown : arrowUp);
if (hovered && !expanded) {
const QRect arrowRect = rc.adjusted(rc.width() - 24, 0, 0, 0);
if (arrowRect.contains(mousePos))
painter->fillRect(arrowRect, hoverColor);
}
if (hovered || expanded) {
static const QPixmap arrowUp = pixmap("expandarrow",Theme::Welcome_ForegroundSecondaryColor);
static const QPixmap arrowDown = QPixmap::fromImage(arrowUp.toImage().mirrored(false, true));
painter->drawPixmap(rc.right() - 20, y + 7, expanded ? arrowDown : arrowUp);
}
if (idx.row() < 9) {
painter->setPen(foregroundColor2);
@@ -264,10 +292,10 @@ public:
if (isActiveSession && !isDefaultVirgin)
fullSessionName = ProjectWelcomePage::tr("%1 (current session)").arg(fullSessionName);
const QRect switchRect = QRect(x, y, rc.width() - 20, firstBase + 3 - y);
const QRect switchRect = QRect(x, y, rc.width() - 24, firstBase + 3 - y);
const bool switchActive = switchRect.contains(mousePos);
painter->setPen(linkColor);
painter->setFont(sizedFont(12, option.widget, switchActive));
painter->setFont(sizedFont(13, option.widget, switchActive));
painter->drawText(x1, firstBase, fullSessionName);
if (switchActive)
m_activeSwitchToRect = switchRect;
@@ -336,7 +364,7 @@ public:
{
if (ev->type() == QEvent::MouseButtonRelease) {
const QPoint pos = static_cast<QMouseEvent *>(ev)->pos();
const QRect rc(option.rect.right() - 20, option.rect.top(), 20, 30);
const QRect rc(option.rect.right() - 24, option.rect.top(), 24, 30);
const QString sessionName = idx.data(Qt::DisplayRole).toString();
if (rc.contains(pos)) {
// The expand/collapse "button".
@@ -385,41 +413,24 @@ private:
class ProjectDelegate : public BaseDelegate
{
QString entryType() override { return tr("project", "Appears in \"Open project <name>\""); }
int shortcutRole() const override { return ProjectModel::ShortcutRole; }
public:
ProjectDelegate()
{
const int actionsCount = 9;
Context welcomeContext(Core::Constants::C_WELCOME_MODE);
const Id projectBase = "Welcome.OpenRecentProject";
for (int i = 1; i <= actionsCount; ++i) {
auto act = new QAction(tr("Open Recent Project #%1").arg(i), this);
Command *cmd = ActionManager::registerAction(act, projectBase.withSuffix(i), welcomeContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+%1").arg(i)));
m_shortcuts.append(cmd->keySequence().toString(QKeySequence::NativeText));
// connect(act, &QAction::triggered, this, [this, i] { openRecentProjectTriggered(i-1); });
connect(cmd, &Command::keySequenceChanged, this, [this, i, cmd] {
m_shortcuts[i - 1] = cmd->keySequence().toString(QKeySequence::NativeText);
});
}
}
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const final
{
QRect rc = option.rect;
const bool hovered = option.widget->isActiveWindow() && option.state & QStyle::State_MouseOver;
QColor color = themeColor(hovered ? Theme::Welcome_HoverColor : Theme::Welcome_BackgroundColor);
painter->fillRect(rc, color);
if (hovered)
painter->fillRect(rc, themeColor(Theme::Welcome_HoverColor));
const int x = rc.x();
const int y = rc.y();
const int firstBase = y + 15;
const int secondBase = firstBase + 15;
const int firstBase = y + 18;
const int secondBase = firstBase + 19;
painter->drawPixmap(x + 11, y + 3, pixmap("project", Theme::Welcome_ForegroundSecondaryColor));
static const QPixmap projectIcon = pixmap("project", Theme::Welcome_ForegroundSecondaryColor);
painter->drawPixmap(x + 11, y + 6, projectIcon);
QString projectName = idx.data(Qt::DisplayRole).toString();
QString projectPath = idx.data(ProjectModel::FilePathRole).toString();
@@ -431,11 +442,11 @@ public:
painter->drawText(x + 3, firstBase, QString::number(idx.row() + 1));
painter->setPen(themeColor(Theme::Welcome_LinkColor));
painter->setFont(sizedFont(12, option.widget, hovered));
painter->setFont(sizedFont(13, option.widget, hovered));
painter->drawText(x + 36, firstBase, projectName);
painter->setPen(themeColor(Theme::Welcome_ForegroundPrimaryColor));
painter->setFont(sizedFont(12, option.widget));
painter->setFont(sizedFont(13, option.widget));
QString pathWithTilde = Utils::withTildeHomePath(QDir::toNativeSeparators(projectPath));
painter->drawText(x + 36, secondBase, pathWithTilde);
}
@@ -511,11 +522,11 @@ public:
openButton->setOnClicked([] { ProjectExplorerPlugin::openOpenProjectDialog(); });
auto sessionsLabel = new QLabel(this);
sessionsLabel->setFont(sizedFont(15, this));
sessionsLabel->setFont(sizedFont(16, this));
sessionsLabel->setText(ProjectWelcomePage::tr("Sessions"));
auto recentProjectsLabel = new QLabel(this);
recentProjectsLabel->setFont(sizedFont(15, this));
recentProjectsLabel->setFont(sizedFont(16, this));
recentProjectsLabel->setText(ProjectWelcomePage::tr("Recent Projects"));
auto sessionsList = new TreeView(this);
@@ -530,8 +541,6 @@ public:
projectsList->setItemDelegate(&m_projectDelegate);
projectsList->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
const int d = IWelcomePage::screenDependHeightDistance();
auto hbox11 = new QHBoxLayout;
hbox11->setContentsMargins(0, 0, 0, 0);
hbox11->addWidget(newButton);
@@ -546,23 +555,23 @@ public:
vbox1->setContentsMargins(0, 0, 0, 0);
vbox1->addStrut(200);
vbox1->addItem(hbox11);
vbox1->addSpacing(d);
vbox1->addSpacing(16);
vbox1->addWidget(sessionsLabel);
vbox1->addSpacing(d + 5);
vbox1->addSpacing(21);
vbox1->addWidget(sessionsList);
auto vbox2 = new QVBoxLayout;
vbox2->setContentsMargins(0, 0, 0, 0);
vbox2->addItem(hbox21);
vbox2->addSpacing(d);
vbox2->addSpacing(16);
vbox2->addWidget(recentProjectsLabel);
vbox2->addSpacing(d + 5);
vbox2->addSpacing(21);
vbox2->addWidget(projectsList);
auto hbox = new QHBoxLayout(this);
hbox->setContentsMargins(30, 27, 0, 27);
hbox->addItem(vbox1);
hbox->addSpacing(d);
hbox->addSpacing(16);
hbox->addItem(vbox2);
hbox->setStretchFactor(vbox2, 2);
}

View File

@@ -40,7 +40,7 @@ class ProjectModel : public QAbstractListModel
Q_OBJECT
public:
enum { FilePathRole = Qt::UserRole+1, PrettyFilePathRole };
enum { FilePathRole = Qt::UserRole+1, PrettyFilePathRole, ShortcutRole };
ProjectModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent) const override;
@@ -55,7 +55,7 @@ class ProjectWelcomePage : public Core::IWelcomePage
{
Q_OBJECT
public:
ProjectWelcomePage() = default;
ProjectWelcomePage();
QString title() const override { return tr("Projects"); }
int priority() const override { return 20; }
@@ -73,6 +73,9 @@ signals:
void manageSessions();
private:
void openSessionAt(int index);
void openProjectAt(int index);
friend class SessionsPage;
SessionModel *m_sessionModel = nullptr;
ProjectModel *m_projectModel = nullptr;

View File

@@ -28,6 +28,9 @@
#include "sessiondialog.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/id.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/stringutils.h>
@@ -35,6 +38,8 @@
#include <QFileInfo>
#include <QDir>
using namespace Core;
namespace ProjectExplorer {
namespace Internal {
@@ -146,6 +151,11 @@ QVariant SessionModel::data(const QModelIndex &index, int role) const
case ProjectsDisplayRole:
result = pathsToBaseNames(SessionManager::projectsForSessionName(sessionName));
break;
case ShortcutRole: {
const Id sessionBase = SESSION_BASE_ID;
if (Command *cmd = ActionManager::command(sessionBase.withSuffix(index.row() + 1)))
result = cmd->keySequence().toString(QKeySequence::NativeText);
} break;
} // switch (role)
}

View File

@@ -32,12 +32,21 @@
namespace ProjectExplorer {
namespace Internal {
const char SESSION_BASE_ID[] = "Welcome.OpenSession";
class SessionModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum { DefaultSessionRole = Qt::UserRole+1, LastSessionRole, ActiveSessionRole, ProjectsPathRole, ProjectsDisplayRole };
enum {
DefaultSessionRole = Qt::UserRole+1,
LastSessionRole,
ActiveSessionRole,
ProjectsPathRole,
ProjectsDisplayRole,
ShortcutRole
};
explicit SessionModel(QObject *parent = nullptr);

View File

@@ -96,9 +96,6 @@ public:
QString displayName() const override;
QStringList files(FilesMode) const override { return m_files; }
QStringList files() const { return m_files; }
bool addFiles(const QStringList &filePaths);
bool removeFiles(const QStringList &filePaths);
bool setFiles(const QStringList &filePaths);
@@ -356,7 +353,7 @@ public:
PythonProject *project = static_cast<PythonProject *>(parent->project());
QList<Core::Id> allIds;
foreach (const QString &file, project->files())
foreach (const QString &file, project->files(ProjectExplorer::Project::AllFiles))
allIds.append(idFromScript(file));
return allIds;
}
@@ -371,7 +368,7 @@ public:
if (!canHandle(parent))
return false;
PythonProject *project = static_cast<PythonProject *>(parent->project());
return project->files().contains(scriptFromId(id));
return project->files(ProjectExplorer::Project::AllFiles).contains(scriptFromId(id));
}
bool canRestore(Target *parent, const QVariantMap &map) const override
@@ -533,7 +530,6 @@ void PythonProject::parseProject()
m_rawFileList = readLines(projectFilePath().toString());
m_rawFileList << projectFilePath().fileName();
m_files = processEntries(m_rawFileList, &m_rawListEntries);
emit fileListChanged();
}
/**

View File

@@ -175,58 +175,6 @@ void QbsProject::projectLoaded()
m_parsingDelay.start(0);
}
static void collectFilesForProject(const qbs::ProjectData &project, Project::FilesMode mode,
QSet<QString> &result)
{
if (mode & Project::SourceFiles)
result.insert(project.location().filePath());
foreach (const qbs::ProductData &prd, project.products()) {
if (mode & Project::SourceFiles) {
foreach (const qbs::GroupData &grp, prd.groups()) {
foreach (const QString &file, grp.allFilePaths())
result.insert(file);
result.insert(grp.location().filePath());
}
result.insert(prd.location().filePath());
}
if (mode & Project::GeneratedFiles) {
foreach (const qbs::ProductData &prd, project.products()) {
foreach (const qbs::ArtifactData &artifact, prd.generatedArtifacts()) {
// A list of human-readable file types that we can reasonably expect
// to get generated during a build. Extend as needed.
static const QSet<QString> sourceTags = {
QLatin1String("c"), QLatin1String("cpp"), QLatin1String("hpp"),
QLatin1String("objc"), QLatin1String("objcpp"),
QLatin1String("c_pch_src"), QLatin1String("cpp_pch_src"),
QLatin1String("objc_pch_src"), QLatin1String("objcpp_pch_src"),
QLatin1String("asm"), QLatin1String("asm_cpp"),
QLatin1String("linkerscript"),
QLatin1String("qrc"), QLatin1String("java.java")
};
if (artifact.fileTags().toSet().intersects(sourceTags))
result.insert(artifact.filePath());
}
}
}
}
foreach (const qbs::ProjectData &subProject, project.subProjects())
collectFilesForProject(subProject, mode, result);
}
QStringList QbsProject::files(Project::FilesMode fileMode) const
{
qCDebug(qbsPmLog) << Q_FUNC_INFO << fileMode << m_qbsProject.isValid() << isParsing();
if (!m_qbsProject.isValid() || isParsing())
return QStringList();
QSet<QString> result;
collectFilesForProject(m_projectData, fileMode, result);
result.unite(m_qbsProject.buildSystemFiles());
qCDebug(qbsPmLog) << "file count:" << result.count();
return result.toList();
}
QStringList QbsProject::filesGeneratedFrom(const QString &sourceFile) const
{
QStringList generated;
@@ -312,7 +260,6 @@ bool QbsProject::addFilesToProduct(const QStringList &filePaths,
if (notAdded->count() != filePaths.count()) {
m_projectData = m_qbsProject.projectData();
setRootProjectNode(Internal::QbsNodeTreeBuilder::buildTree(this));
emit fileListChanged();
}
return notAdded->isEmpty();
}

View File

@@ -64,7 +64,6 @@ public:
QString displayName() const override;
QbsRootProjectNode *rootProjectNode() const override;
QStringList files(FilesMode fileMode) const override;
QStringList filesGeneratedFrom(const QString &sourceFile) const override;
bool isProjectEditable() const;

View File

@@ -93,6 +93,7 @@ static const char *const variableKeywords[] = {
"QMAKE_CFLAGS_MT_DLL",
"QMAKE_CFLAGS_MT_DLLDBG",
"QMAKE_CFLAGS_RELEASE",
"QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO",
"QMAKE_CFLAGS_SHLIB",
"QMAKE_CFLAGS_THREAD",
"QMAKE_CFLAGS_WARN_OFF",
@@ -106,6 +107,7 @@ static const char *const variableKeywords[] = {
"QMAKE_CXXFLAGS_MT_DLL",
"QMAKE_CXXFLAGS_MT_DLLDBG",
"QMAKE_CXXFLAGS_RELEASE",
"QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO",
"QMAKE_CXXFLAGS_SHLIB",
"QMAKE_CXXFLAGS_THREAD",
"QMAKE_CXXFLAGS_WARN_OFF",

View File

@@ -191,7 +191,6 @@ static QList<QmakeProject *> s_projects;
*/
QmakeProject::QmakeProject(const FileName &fileName) :
m_projectFiles(new QmakeProjectFiles),
m_qmakeVfs(new QMakeVfs),
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
{
@@ -230,7 +229,6 @@ QmakeProject::~QmakeProject()
setRootProjectNode(nullptr);
m_rootProFile.reset();
delete m_projectFiles;
m_cancelEvaluate = true;
Q_ASSERT(m_qmakeGlobalsRefCnt == 0);
delete m_qmakeVfs;
@@ -241,32 +239,6 @@ QmakeProFile *QmakeProject::rootProFile() const
return m_rootProFile.get();
}
void QmakeProject::updateFileList()
{
QmakeProjectFiles files;
rootProjectNode()->forEachNode([&](FileNode *fileNode) {
const int type = static_cast<int>(fileNode->fileType());
QStringList &targetList = fileNode->isGenerated() ? files.generatedFiles[type] : files.files[type];
targetList.push_back(fileNode->filePath().toString());
}, [&](FolderNode *folderNode) {
if (ProjectNode *projectNode = folderNode->asProjectNode())
files.proFiles.append(projectNode->filePath().toString());
if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(folderNode))
files.files[static_cast<int>(FileType::Resource)].push_back(folderNode->filePath().toString());
});
for (QStringList &f : files.files)
f.removeDuplicates();
for (QStringList &f : files.generatedFiles)
f.removeDuplicates();
files.proFiles.removeDuplicates();
if (files != *m_projectFiles) {
*m_projectFiles = files;
emit fileListChanged();
}
}
Project::RestoreResult QmakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
{
RestoreResult result = Project::fromMap(map, errorMessage);
@@ -576,7 +548,6 @@ void QmakeProject::decrementPendingEvaluateFutures()
setAllBuildConfigurationsEnabled(true);
m_asyncUpdateState = Base;
updateFileList();
updateCodeModels();
updateBuildSystemData();
if (activeTarget())
@@ -639,21 +610,6 @@ QString QmakeProject::displayName() const
return projectFilePath().toFileInfo().completeBaseName();
}
QStringList QmakeProject::files(FilesMode fileMode) const
{
QStringList files;
for (int i = 0; i < static_cast<int>(FileType::FileTypeSize); ++i) {
if (fileMode & SourceFiles)
files += m_projectFiles->files[i];
if (fileMode & GeneratedFiles)
files += m_projectFiles->generatedFiles[i];
}
files.removeDuplicates();
return files;
}
// Find the folder that contains a file with a certain name (recurse down)
static FolderNode *folderOf(FolderNode *in, const FileName &fileName)
{
@@ -1086,10 +1042,8 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
m_recursiveWatchedFolders += tmp;
}
if (newOrRemovedFiles) {
m_project->updateFileList();
if (newOrRemovedFiles)
m_project->updateCodeModels();
}
}
bool QmakeProject::needsConfiguration() const
@@ -1346,7 +1300,16 @@ void QmakeProject::testToolChain(ToolChain *tc, const Utils::FileName &path) con
return;
const Utils::FileName expected = tc->compilerCommand();
if (expected != path) {
Environment env = Environment::systemEnvironment();
if (Target *t = activeTarget()) {
if (BuildConfiguration *bc = t->activeBuildConfiguration())
env = bc->environment();
else
t->kit()->addToEnvironment(env);
}
if (env.isSameExecutable(path.toString(), expected.toString())) {
const QPair<Utils::FileName, Utils::FileName> pair = qMakePair(expected, path);
if (!m_toolChainWarnings.contains(pair)) {
TaskHub::addTask(Task(Task::Warning,

View File

@@ -73,7 +73,6 @@ public:
bool validParse(const Utils::FileName &proFilePath) const;
bool parseInProgress(const Utils::FileName &proFilePath) const;
virtual QStringList files(FilesMode fileMode) const final;
virtual QStringList filesGeneratedFrom(const QString &file) const final;
enum Parsing {ExactParse, ExactAndCumulativeParse };
@@ -109,8 +108,6 @@ public:
/// \internal
bool wasEvaluateCanceled();
// For QmakeProFileNode after a on disk change
void updateFileList();
void updateCodeModels();
void watchFolders(const QStringList &l, QmakePriFile *file);
@@ -188,9 +185,6 @@ private:
std::unique_ptr<QmakeProFile> m_rootProFile;
// cached lists of all of files
Internal::QmakeProjectFiles *m_projectFiles = nullptr;
QMakeVfs *m_qmakeVfs = nullptr;
// cached data during project rescan

View File

@@ -318,9 +318,11 @@ void QmakeProjectManagerPlugin::updateContextActions()
{
Node *node = ProjectTree::currentNode();
Project *project = ProjectTree::currentProject();
m_addLibraryActionContextMenu->setEnabled(dynamic_cast<QmakeProFileNode *>(node));
auto proFileNode = dynamic_cast<QmakeProFileNode *>(node);
ContainerNode *containerNode = node ? node->asContainerNode() : nullptr;
ProjectNode *proFileNode = containerNode ? containerNode->rootProjectNode() : dynamic_cast<QmakeProFileNode *>(node);
m_addLibraryActionContextMenu->setEnabled(proFileNode);
QmakeProject *qmakeProject = qobject_cast<QmakeProject *>(QmakeManager::contextProject());
QmakeProFileNode *subProjectNode = nullptr;
if (node) {

View File

@@ -187,11 +187,14 @@ Core::GeneratedFiles GuiAppWizard::generateFiles(const QWizard *w,
QTextStream proStr(&contents);
QtProjectParameters::writeProFileHeader(proStr);
projectParams.writeProFile(proStr);
proStr << "\n\nSOURCES += " << Utils::FileName::fromString(mainSourceFileName).fileName()
<< "\\\n " << Utils::FileName::fromString(formSource.path()).fileName()
<< "\n\nHEADERS += " << Utils::FileName::fromString(formHeader.path()).fileName();
proStr << "\n\nSOURCES +="
<< " \\\n " << Utils::FileName::fromString(mainSourceFileName).fileName()
<< " \\\n " << Utils::FileName::fromString(formSource.path()).fileName()
<< "\n\nHEADERS +="
<< " \\\n " << Utils::FileName::fromString(formHeader.path()).fileName();
if (params.designerForm)
proStr << "\n\nFORMS += " << Utils::FileName::fromString(form->path()).fileName();
proStr << "\n\nFORMS +="
<< " \\\n " << Utils::FileName::fromString(form->path()).fileName();
if (params.isMobileApplication) {
proStr << "\n\nCONFIG += mobility"
<< "\nMOBILITY = "

View File

@@ -132,12 +132,14 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w,
QTextStream proStr(&profileContents);
QtProjectParameters::writeProFileHeader(proStr);
projectParams.writeProFile(proStr);
proStr << "\nSOURCES += " << Utils::FileName::fromString(source.path()).fileName()
<< "\n\nHEADERS += " << headerFileName;
proStr << "\nSOURCES +="
<< " \\\n " << Utils::FileName::fromString(source.path()).fileName()
<< "\n\nHEADERS +="
<< " \\\n " << headerFileName;
if (!globalHeaderFileName.isEmpty())
proStr << "\\\n " << globalHeaderFileName << '\n';
proStr << " \\\n " << globalHeaderFileName << " \n";
if (!pluginJsonFileName.isEmpty())
proStr << "\nDISTFILES += " << pluginJsonFileName << '\n';
proStr << "\nDISTFILES += " << pluginJsonFileName << " \n";
writeLinuxProFile(proStr);
}
profile.setContents(profileContents);

View File

@@ -170,8 +170,9 @@ Core::GeneratedFiles TestWizard::generateFiles(const QWizard *w, QString *errorM
QTextStream proStr(&contents);
QtProjectParameters::writeProFileHeader(proStr);
projectParams.writeProFile(proStr);
proStr << "\n\nSOURCES += " << Utils::FileName::fromString(sourceFilePath).fileName() << '\n'
<< "DEFINES += SRCDIR=\\\\\\\"$$PWD/\\\\\\\"\n";
proStr << "\n\nSOURCES +="
<< " \\\n " << Utils::FileName::fromString(sourceFilePath).fileName()
<< " \n\nDEFINES += SRCDIR=\\\\\\\"$$PWD/\\\\\\\"\n";
}
profile.setContents(contents);

View File

@@ -647,7 +647,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeAction(
raiseCommandId, raiseDisplayName,
Utils::Icon({{":/qmldesigner/icon/designeractions/images/lower.png", Utils::Theme::IconsBaseColor}}).icon(),
Utils::Icon({{":/qmldesigner/icon/designeractions/images/raise.png", Utils::Theme::IconsBaseColor}}).icon(),
raiseToolTip,
stackCategory,
QKeySequence(),
@@ -658,7 +658,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeAction(
lowerCommandId,
lowerDisplayName,
Utils::Icon({{":/qmldesigner/icon/designeractions/images/raise.png", Utils::Theme::IconsBaseColor}}).icon(),
Utils::Icon({{":/qmldesigner/icon/designeractions/images/lower.png", Utils::Theme::IconsBaseColor}}).icon(),
lowerToolTip,
stackCategory,
QKeySequence(),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 168 B

View File

@@ -48,6 +48,7 @@
#include <QTabBar>
#include <QImageReader>
#include <QMimeData>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QMenu>
#include <QApplication>
@@ -55,10 +56,6 @@
#include <QShortcut>
#include <QQuickItem>
#include <private/qquickwidget_p.h> // mouse ungrabbing workaround on quickitems
#include <private/qquickwindow_p.h> // mouse ungrabbing workaround on quickitems
namespace QmlDesigner {
ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
@@ -265,14 +262,7 @@ void ItemLibraryWidget::setResourcePath(const QString &resourcePath)
updateSearch();
}
static void ungrabMouseOnQMLWorldWorkAround(QQuickWidget *quickWidget)
{
const QQuickWidgetPrivate *widgetPrivate = QQuickWidgetPrivate::get(quickWidget);
if (widgetPrivate && widgetPrivate->offscreenWindow && widgetPrivate->offscreenWindow->mouseGrabberItem())
widgetPrivate->offscreenWindow->mouseGrabberItem()->ungrabMouse();
}
void ItemLibraryWidget::startDragAndDrop(QVariant itemLibraryId)
void ItemLibraryWidget::startDragAndDrop(QQuickItem *mouseArea, QVariant itemLibraryId)
{
m_currentitemLibraryEntry = itemLibraryId.value<ItemLibraryEntry>();
@@ -283,9 +273,14 @@ void ItemLibraryWidget::startDragAndDrop(QVariant itemLibraryId)
m_currentitemLibraryEntry.libraryEntryIconPath()));
drag->setMimeData(mimeData);
drag->exec();
/* Workaround for bug in Qt. The release event is not delivered for Qt < 5.9 if a drag is started */
QMouseEvent event (QEvent::MouseButtonRelease, QPoint(-1, -1), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QApplication::sendEvent(mouseArea, &event);
ungrabMouseOnQMLWorldWorkAround(m_itemViewQuickWidget.data());
QTimer::singleShot(0, [drag]() {
drag->exec();
drag->deleteLater();
});
}
void ItemLibraryWidget::removeImport(const QString &name)

View File

@@ -84,7 +84,7 @@ public:
void setModel(Model *model);
Q_INVOKABLE void startDragAndDrop(QVariant itemLibId);
Q_INVOKABLE void startDragAndDrop(QQuickItem *mouseArea, QVariant itemLibId);
protected:
void removeImport(const QString &name);

View File

@@ -278,7 +278,7 @@ void PropertyEditorView::changeExpression(const QString &propertyName)
}
} else if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(name) == "qreal") {
bool ok;
qreal realValue = value->expression().toFloat(&ok);
qreal realValue = value->expression().toDouble(&ok);
if (ok) {
qmlObjectNode.setVariantProperty(name, realValue);
transaction.commit(); //committing in the try block

View File

@@ -28,7 +28,7 @@ QTabBar#centralTabBar::tab:selected {
color: creatorTheme.QmlDesignerTabDark;
}
QToolButton {
QToolButton#centralTabBar {
background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate;
width: 08px;
height: 16px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

View File

@@ -5,5 +5,9 @@
<file>scrollbar.css</file>
<file>formeditorstylesheet.css</file>
<file>centerwidget.css</file>
<file>images/spliteditorhorizontally.png</file>
<file>images/spliteditorhorizontally@2x.png</file>
<file>images/spliteditorvertically.png</file>
<file>images/spliteditorvertically@2x.png</file>
</qresource>
</RCC>

View File

@@ -146,13 +146,18 @@ WidgetInfo TextEditorView::widgetInfo()
}
QString TextEditorView::contextHelpId() const
{
return AbstractView::contextHelpId();
}
QString TextEditorView::qmlJSEditorHelpId() const
{
if (m_widget->textEditor()) {
QString contextHelpId = m_widget->textEditor()->contextHelpId();
if (!contextHelpId.isEmpty())
return m_widget->textEditor()->contextHelpId();
}
return AbstractView::contextHelpId();
return QString();
}
void TextEditorView::nodeIdChanged(const ModelNode& /*node*/, const QString &/*newId*/, const QString &/*oldId*/)

Some files were not shown because too many files have changed in this diff Show More