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 \ qtgui \
qthelp \ qthelp \
qtquickcontrols \ qtquickcontrols \
qtquicklayouts \
qtlinguist \ qtlinguist \
qtscript \
qtsensors \ qtsensors \
qtuitools \ qtuitools \
qtwebkit \ qtwebkit \

View File

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

View File

@@ -1,7 +1,7 @@
build_online_docs: \ 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: \ else: \
QTC_DOCS = $$PWD/qtcreator.qdocconf $$PWD/api/qtcreator-dev.qdocconf DOC_FILES += $$PWD/qtcreator.qdocconf $$PWD/api/qtcreator-dev.qdocconf
include(../docs.pri) 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 If your Git project uses Gerrit for code reviews, you can view your changes
in \QC. 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 > To push committed changes to Gerrit, select \uicontrol Tools >
\uicontrol Git > \uicontrol {Remote Repository} > \uicontrol Git > \uicontrol {Remote Repository} >
\uicontrol {Push to Gerrit}. \uicontrol {Push to Gerrit}.
@@ -319,6 +314,17 @@
To refresh the list of changes, select \uicontrol Refresh. 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 \section1 Working with Git Tools
To start a graphical interface to Git, select \uicontrol 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!") isEmpty(VERSION): error("Include qtcreator.pri before including docs.pri!")
@@ -12,50 +15,11 @@ qdocindex.name = QDOC_INDEX_DIR
qdocindex.value = $$[QT_INSTALL_DOCS] qdocindex.value = $$[QT_INSTALL_DOCS]
qtcdocsdir.name = QTC_DOCS_DIR qtcdocsdir.name = QTC_DOCS_DIR
qtcdocsdir.value = $$IDE_SOURCE_TREE/doc qtcdocsdir.value = $$IDE_SOURCE_TREE/doc
QT_TOOL_ENV = qtcver qtcvertag qtdocs qdocindex qtcdocsdir QDOC_ENV += qtcver qtcvertag qtdocs qdocindex qtcdocsdir
qtPrepareTool(QDOC, qdoc)
QT_TOOL_ENV =
!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 include(doc/doc_targets.pri)
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

View File

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

View File

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

View File

@@ -763,7 +763,7 @@ def qdump__QHostAddress(d, value):
(ipString, scopeId, a4, pad, a6, protocol, isParsed) \ (ipString, scopeId, a4, pad, a6, protocol, isParsed) \
= d.split('{QString}{QString}{quint32}I16sI{bool}', dd) = d.split('{QString}{QString}{quint32}I16sI{bool}', dd)
elif qtVersion >= 0x050600: # 5.6.0 at f3aabb42 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) \ (ipString, scopeId, a4, pad, a6, protocol, isParsed) \
= d.split('{QString}{QString}{quint32}I16sI{bool}', dd) = d.split('{QString}{QString}{quint32}I16sI{bool}', dd)
else: else:

View File

@@ -367,7 +367,7 @@ QImage QuickItemNodeInstance::renderImage() const
QRectF renderBoundingRect = boundingRect(); QRectF renderBoundingRect = boundingRect();
QSize size = renderBoundingRect.size().toSize(); 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; size *= devicePixelRatio;
QImage renderImage = designerSupport()->renderImageForItem(quickItem(), renderBoundingRect, size); QImage renderImage = designerSupport()->renderImageForItem(quickItem(), renderBoundingRect, size);

View File

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

View File

@@ -54,11 +54,21 @@ PyValue::PyValue(unsigned long index, CIDebugSymbolGroup *symbolGroup)
: m_index(index) : m_index(index)
, m_symbolGroup(symbolGroup) , m_symbolGroup(symbolGroup)
{ {
if (m_symbolGroup)
valuesForSymbolGroup[symbolGroup].push_back(this); 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() PyValue::~PyValue()
{ {
if (m_symbolGroup)
valuesForSymbolGroup[m_symbolGroup].remove(this); valuesForSymbolGroup[m_symbolGroup].remove(this);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -268,6 +268,19 @@ QStringList Environment::appendExeExtensions(const QString &executable) const
return execs; 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, FileName Environment::searchInPath(const QString &executable,
const QStringList &additionalDirs, const QStringList &additionalDirs,
bool (*func)(const QString &name)) const bool (*func)(const QString &name)) const

View File

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

View File

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

View File

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

View File

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

View File

@@ -54,30 +54,6 @@ TestConfiguration::~TestConfiguration()
m_testCases.clear(); 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) static bool isLocal(RunConfiguration *runConfiguration)
{ {
Target *target = runConfiguration ? runConfiguration->target() : 0; Target *target = runConfiguration ? runConfiguration->target() : 0;
@@ -93,106 +69,80 @@ void TestConfiguration::completeTestInformation(int runMode)
if (!project) if (!project)
return; 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(); Target *target = project->activeTarget();
if (!target) if (!target)
return; return;
BuildTargetInfoList appTargets = target->applicationTargets(); const auto cppMM = CppTools::CppModelManager::instance();
if (m_displayName.isEmpty()) { const QVector<CppTools::ProjectPart::Ptr> projectParts = cppMM->projectInfo(project).projectParts();
foreach (const BuildTargetInfo &bti, appTargets.list) { const QVector<CppTools::ProjectPart::Ptr> relevantParts
// some project manager store line/column information as well inside ProjectPart = Utils::filtered(projectParts, [this] (const CppTools::ProjectPart::Ptr &part) {
if (bti.isValid() && m_projectFile.startsWith(bti.projectFilePath.toString())) { return part->selectedForBuilding && part->projectFile == m_projectFile;
executable = bti.targetFilePath.toString(); });
if (Utils::HostOsInfo::isWindowsHost() && !executable.toLower().endsWith(".exe")) const QSet<QString> buildSystemTargets
executable = Utils::HostOsInfo::withExecutableSuffix(executable); = Utils::transform<QSet>(relevantParts, [] (const CppTools::ProjectPart::Ptr &part) {
targetName = bti.targetName; return part->buildSystemTarget;
});
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;
if (buildSystemTargets.contains(runConfig->buildSystemTarget())) {
Runnable runnable = runConfig->runnable();
if (!runnable.is<StandardRunnable>())
continue;
StandardRunnable stdRunnable = runnable.as<StandardRunnable>();
// 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; break;
} }
} }
} else { // CMake based projects have no specific pro file, but target name matches displayname // RunConfiguration for this target could be explicitly removed or not created at all
foreach (const BuildTargetInfo &bti, appTargets.list) { if (m_displayName.isEmpty() && !executable.isEmpty()) {
if (bti.isValid() && m_displayName == bti.targetName) { // we failed to find a valid runconfiguration - but we've got the executable already
// for CMake base projects targetFilePath has executable suffix already if (auto rc = target->activeRunConfiguration()) {
executable = bti.targetFilePath.toString(); if (isLocal(rc)) { // FIXME for now only Desktop support
targetName = m_displayName; Runnable runnable = rc->runnable();
break; 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);
}
} }
} }
} }
if (targetProject) {
if (auto buildConfig = target->activeBuildConfiguration()) { if (auto buildConfig = target->activeBuildConfiguration()) {
const QString buildBase = buildConfig->buildDirectory().toString(); const QString buildBase = buildConfig->buildDirectory().toString();
const QString projBase = targetProject->projectDirectory().toString(); const QString projBase = project->projectDirectory().toString();
if (m_projectFile.startsWith(projBase)) if (m_projectFile.startsWith(projBase))
buildDir = QFileInfo(buildBase + m_projectFile.mid(projBase.length())).absolutePath(); m_buildDir = QFileInfo(buildBase + m_projectFile.mid(projBase.length())).absolutePath();
}
} }
QList<RunConfiguration *> rcs = target->runConfigurations(); if (m_displayName.isEmpty()) // happens e.g. when guessing the TestConfiguration or error
foreach (RunConfiguration *rc, rcs) { m_displayName = buildSystemTargets.isEmpty() ? "unknown" : *buildSystemTargets.begin();
Runnable runnable = rc->runnable();
if (isLocal(rc) && runnable.is<StandardRunnable>()) {
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;
} }
}
}
// if we could not figure out the run configuration
// try to use the run configuration of the parent project
if (!hasDesktopTarget && targetProject && !executable.isEmpty()) {
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();
}
}
}
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);
}
}
/** /**
* @brief sets the test cases for this test configuration. * @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 TestSettings &settings)
{ {
const int timeout = settings.timeout; const int timeout = settings.timeout;
const bool omitRunConfigWarnings = settings.omitRunConfigWarn;
QEventLoop eventLoop; QEventLoop eventLoop;
int testCaseCount = 0; int testCaseCount = 0;
for (TestConfiguration *config : selectedTests) { for (TestConfiguration *config : selectedTests) {
config->completeTestInformation(TestRunner::Run); config->completeTestInformation(TestRunner::Run);
if (config->project()) { if (config->project()) {
testCaseCount += config->testCaseCount(); 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 { } else {
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageWarn, futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
TestRunner::tr("Project is null for \"%1\". Removing from test run.\n" TestRunner::tr("Project is null for \"%1\". Removing from test run.\n"
@@ -196,22 +203,12 @@ void TestRunner::prepareToRunTests(Mode mode)
return; return;
} }
const bool omitRunConfigWarnings = AutotestPlugin::instance()->settings()->omitRunConfigWarn;
m_executingTests = true; m_executingTests = true;
emit testRunStarted(); emit testRunStarted();
// clear old log and output pane // clear old log and output pane
TestResultsPane::instance()->clearContents(); 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()) { if (m_selectedTests.empty()) {
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageWarn, emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
tr("No tests selected. Canceling test run.")))); tr("No tests selected. Canceling test run."))));

View File

@@ -101,12 +101,6 @@ QString AutotoolsProject::defaultBuildDirectory(const QString &projectPath)
return QFileInfo(projectPath).absolutePath(); 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 // This function, is called at the very beginning, to
// restore the settings if there are some stored. // restore the settings if there are some stored.
Project::RestoreResult AutotoolsProject::fromMap(const QVariantMap &map, QString *errorMessage) Project::RestoreResult AutotoolsProject::fromMap(const QVariantMap &map, QString *errorMessage)

View File

@@ -58,7 +58,6 @@ public:
~AutotoolsProject() override; ~AutotoolsProject() override;
QString displayName() const override; QString displayName() const override;
QStringList files(FilesMode fileMode) const override;
static QString defaultBuildDirectory(const QString &projectPath); static QString defaultBuildDirectory(const QString &projectPath);
QStringList buildTargets() const; 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) void BareMetalDevice::providerUpdated(GdbServerProvider *provider)
{ {
GdbServerProvider *myProvider = GdbServerProviderManager::findProvider(m_gdbServerProviderId); GdbServerProvider *myProvider = GdbServerProviderManager::findProvider(m_gdbServerProviderId);

View File

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

View File

@@ -78,7 +78,7 @@ GdbServerProvider::~GdbServerProvider()
{ {
const QSet<BareMetalDevice *> devices = m_devices; const QSet<BareMetalDevice *> devices = m_devices;
for (BareMetalDevice *device : devices) for (BareMetalDevice *device : devices)
device->setGdbServerProviderId(QString()); device->unregisterProvider(this);
} }
QString GdbServerProvider::displayName() const 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()); auto clangAssistProposalModel = static_cast<ClangAssistProposalModel*>(model());
return clangAssistProposalModel->neededCorrection() return clangAssistProposalModel->neededCorrection()
== ClangBackEnd::CompletionCorrection::DotToArrowCorrection; == ClangBackEnd::CompletionCorrection::DotToArrowCorrection
&& editorWidget->textAt(basePosition() - 1, 1) == ".";
} }
void ClangAssistProposal::makeCorrection(TextEditor::TextEditorWidget *editorWidget) void ClangAssistProposal::makeCorrection(TextEditor::TextEditorWidget *editorWidget)

View File

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

View File

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

View File

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

View File

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

View File

@@ -185,7 +185,6 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
updateQmlJSCodeModel(); updateQmlJSCodeModel();
emit displayNameChanged();
emit fileListChanged(); emit fileListChanged();
emit bc->emitBuildTypeChanged(); emit bc->emitBuildTypeChanged();
@@ -307,21 +306,6 @@ QString CMakeProject::displayName() const
return root ? root->displayName() : projectDirectory().fileName(); 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) Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
{ {
RestoreResult result = Project::fromMap(map, errorMessage); RestoreResult result = Project::fromMap(map, errorMessage);

View File

@@ -88,7 +88,6 @@ public:
QString displayName() const final; QString displayName() const final;
QStringList files(FilesMode fileMode) const final;
QStringList buildTargetTitles(bool runnable = false) const; QStringList buildTargetTitles(bool runnable = false) const;
bool hasBuildTarget(const QString &title) 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, CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, Core::Id id, const QString &target,
const Utils::FileName &workingDirectory, const QString &title) : const Utils::FileName &workingDirectory, const QString &title) :
RunConfiguration(parent, id), RunConfiguration(parent, id),
m_buildTarget(target), m_buildSystemTarget(target),
m_executable(target),
m_title(title) m_title(title)
{ {
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier())); addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
@@ -78,7 +79,8 @@ CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, Core::Id id, const
CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, CMakeRunConfiguration *source) : CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, CMakeRunConfiguration *source) :
RunConfiguration(parent, 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_title(source->m_title),
m_enabled(source->m_enabled) m_enabled(source->m_enabled)
{ {
@@ -93,7 +95,7 @@ void CMakeRunConfiguration::ctor()
Runnable CMakeRunConfiguration::runnable() const Runnable CMakeRunConfiguration::runnable() const
{ {
StandardRunnable r; StandardRunnable r;
r.executable = m_buildTarget; r.executable = m_executable;
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments(); r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments();
r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString(); r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString();
r.environment = extraAspect<LocalEnvironmentAspect>()->environment(); r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
@@ -103,9 +105,9 @@ Runnable CMakeRunConfiguration::runnable() const
QString CMakeRunConfiguration::baseWorkingDirectory() const QString CMakeRunConfiguration::baseWorkingDirectory() const
{ {
const QString exe = m_buildTarget; const QString exe = m_executable;
if (!exe.isEmpty()) if (!exe.isEmpty())
return QFileInfo(m_buildTarget).absolutePath(); return QFileInfo(m_executable).absolutePath();
return QString(); return QString();
} }
@@ -116,7 +118,7 @@ QString CMakeRunConfiguration::title() const
void CMakeRunConfiguration::setExecutable(const QString &executable) void CMakeRunConfiguration::setExecutable(const QString &executable)
{ {
m_buildTarget = executable; m_executable = executable;
} }
void CMakeRunConfiguration::setBaseWorkingDirectory(const Utils::FileName &wd) void CMakeRunConfiguration::setBaseWorkingDirectory(const Utils::FileName &wd)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -458,7 +458,7 @@ public:
, m_replaceDotForArrow(static_cast<CppAssistProposalModel *>(model)->m_replaceDotForArrow) , 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; void makeCorrection(TextEditorWidget *editorWidget) override;
private: private:

View File

@@ -45,8 +45,6 @@ public:
QString displayName() const override { return m_name; } QString displayName() const override { return m_name; }
QStringList files(FilesMode fileMode) const override { Q_UNUSED(fileMode); return QStringList(); }
private: private:
QString m_name; 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; isFatalWinException(exception.exceptionCode) ? Task::Error : Task::Warning;
const FileName fileName = exception.file.isEmpty() const FileName fileName = exception.file.isEmpty()
? FileName() : FileName::fromUserInput(exception.file); ? 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, Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME,
fileName, exception.lineNumber); fileName, exception.lineNumber);
} }

View File

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

View File

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

View File

@@ -87,7 +87,8 @@ void GenericProjectPlugin::editFiles()
if (!genericProject) if (!genericProject)
return; return;
SelectableFilesDialogEditFiles sfd(genericProject->projectDirectory(), 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()); ICore::mainWindow());
if (sfd.exec() == QDialog::Accepted) if (sfd.exec() == QDialog::Accepted)
genericProject->setFiles(Utils::transform(sfd.selectedFiles(), &Utils::FileName::toString)); 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::dataChanged, this, &BranchDialog::resizeColumns);
connect(m_model, &QAbstractItemModel::rowsInserted, this, &BranchDialog::resizeColumns); connect(m_model, &QAbstractItemModel::rowsInserted, this, &BranchDialog::resizeColumns);
connect(m_model, &QAbstractItemModel::rowsRemoved, this, &BranchDialog::resizeColumns); connect(m_model, &QAbstractItemModel::rowsRemoved, this, &BranchDialog::resizeColumns);
connect(m_model, &QAbstractItemModel::modelReset, this, &BranchDialog::expandAndResize);
m_ui->branchView->selectionModel()->clear(); m_ui->branchView->selectionModel()->clear();
} }
@@ -111,7 +112,10 @@ void BranchDialog::refresh(const QString &repository, bool force)
QString errorMessage; QString errorMessage;
if (!m_model->refresh(m_repository, &errorMessage)) if (!m_model->refresh(m_repository, &errorMessage))
VcsOutputWindow::appendError(errorMessage); VcsOutputWindow::appendError(errorMessage);
}
void BranchDialog::expandAndResize()
{
m_ui->branchView->expandAll(); m_ui->branchView->expandAll();
resizeColumns(); resizeColumns();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -76,10 +76,10 @@ qtHaveModule(designercomponents_private) {
} }
DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER) 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 SUBDIRS += qmldesigner
} else { } else {
!qtHaveModule(quick) { !qtHaveModule(quick-private) {
warning("QmlDesigner plugin has been disabled since the Qt Quick module is not available.") warning("QmlDesigner plugin has been disabled since the Qt Quick module is not available.")
} else { } else {
warning("QmlDesigner plugin has been disabled since DO_NOT_BUILD_QMLDESIGNER is set.") 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: case Abi::VxWorks:
if (m_osFlavor != VxWorksFlavor) if (m_osFlavor != VxWorksFlavor)
m_osFlavor = VxWorksFlavor; m_osFlavor = VxWorksFlavor;
break;
case Abi::QnxOS: case Abi::QnxOS:
if (m_osFlavor != GenericQnxFlavor) if (m_osFlavor != GenericQnxFlavor)
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break;
} }
} }

View File

@@ -84,38 +84,6 @@ const char PLUGIN_SETTINGS_KEY[] = "ProjectExplorer.Project.PluginSettings";
namespace ProjectExplorer { 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 // Project
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -461,6 +429,14 @@ void Project::setRootProjectNode(ProjectNode *root)
if (d->m_rootProjectNode == root) if (d->m_rootProjectNode == root)
return; 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); ProjectTree::applyTreeManager(root);
ProjectNode *oldNode = d->m_rootProjectNode; ProjectNode *oldNode = d->m_rootProjectNode;
@@ -468,6 +444,7 @@ void Project::setRootProjectNode(ProjectNode *root)
if (root) if (root)
root->setParentFolderNode(&d->m_containerNode); root->setParentFolderNode(&d->m_containerNode);
ProjectTree::emitSubtreeChanged(root); ProjectTree::emitSubtreeChanged(root);
emit fileListChanged();
delete oldNode; delete oldNode;
} }
@@ -516,6 +493,25 @@ Project::RestoreResult Project::restoreSettings(QString *errorMessage)
return result; 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. Serializes all data into a QVariantMap.
@@ -573,7 +569,7 @@ ProjectNode *Project::rootProjectNode() const
return d->m_rootProjectNode; return d->m_rootProjectNode;
} }
ProjectNode *Project::containerNode() const ContainerNode *Project::containerNode() const
{ {
return &d->m_containerNode; return &d->m_containerNode;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -39,6 +39,8 @@
namespace Utils { class MimeType; } namespace Utils { class MimeType; }
namespace ProjectExplorer { namespace ProjectExplorer {
class Project;
class RunConfiguration; class RunConfiguration;
enum class NodeType : quint16 { enum class NodeType : quint16 {
@@ -92,6 +94,7 @@ enum ProjectAction {
class FileNode; class FileNode;
class FolderNode; class FolderNode;
class ProjectNode; class ProjectNode;
class ContainerNode;
// Documentation inside. // Documentation inside.
class PROJECTEXPLORER_EXPORT Node : public QObject class PROJECTEXPLORER_EXPORT Node : public QObject
@@ -115,8 +118,9 @@ public:
FolderNode *parentFolderNode() const; // parent folder or project FolderNode *parentFolderNode() const; // parent folder or project
ProjectNode *managingProject(); // project managing this node. ProjectNode *managingProject(); // project managing this node.
// result is nullptr if node is the SessionNode // result is the container's rootProject node if this is a project container node
// or node if node is a ProjectNode directly below SessionNode // (i.e. possibly null)
// or node if node is a top-level ProjectNode directly below a container
// or node->parentProjectNode() for all other cases. // or node->parentProjectNode() for all other cases.
const ProjectNode *managingProject() const; // see above. const ProjectNode *managingProject() const; // see above.
@@ -137,6 +141,8 @@ public:
virtual const FolderNode *asFolderNode() const { return nullptr; } virtual const FolderNode *asFolderNode() const { return nullptr; }
virtual ProjectNode *asProjectNode() { return nullptr; } virtual ProjectNode *asProjectNode() { return nullptr; }
virtual const ProjectNode *asProjectNode() const { 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); static bool sortByPath(const Node *a, const Node *b);
void setParentFolderNode(FolderNode *parentFolder); void setParentFolderNode(FolderNode *parentFolder);
@@ -297,6 +303,24 @@ protected:
explicit ProjectNode(const Utils::FileName &projectFilePath); 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 } // namespace ProjectExplorer
Q_DECLARE_METATYPE(ProjectExplorer::Node *) 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(); contextMenu = Core::ActionManager::actionContainer(Constants::M_SESSIONCONTEXT)->menu();
} else { } else {
switch (node->nodeType()) { switch (node->nodeType()) {
case NodeType::Project: case NodeType::Project: {
if (node->parentFolderNode()) if ((node->parentFolderNode() && node->parentFolderNode()->asContainerNode())
|| node->asContainerNode())
contextMenu = Core::ActionManager::actionContainer(Constants::M_PROJECTCONTEXT)->menu(); contextMenu = Core::ActionManager::actionContainer(Constants::M_PROJECTCONTEXT)->menu();
else else
contextMenu = Core::ActionManager::actionContainer(Constants::M_SUBPROJECTCONTEXT)->menu(); contextMenu = Core::ActionManager::actionContainer(Constants::M_SUBPROJECTCONTEXT)->menu();
break; break;
}
case NodeType::VirtualFolder: case NodeType::VirtualFolder:
case NodeType::Folder: case NodeType::Folder:
contextMenu = Core::ActionManager::actionContainer(Constants::M_FOLDERCONTEXT)->menu(); contextMenu = Core::ActionManager::actionContainer(Constants::M_FOLDERCONTEXT)->menu();

View File

@@ -56,6 +56,7 @@ using namespace Core;
using namespace Utils; using namespace Utils;
const int LINK_HEIGHT = 35; const int LINK_HEIGHT = 35;
const char PROJECT_BASE_ID[] = "Welcome.OpenRecentProject";
namespace ProjectExplorer { namespace ProjectExplorer {
namespace Internal { namespace Internal {
@@ -84,6 +85,12 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
return data.first; return data.first;
case PrettyFilePathRole: case PrettyFilePathRole:
return Utils::withTildeHomePath(data.first); 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: default:
return QVariant(); 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 Core::Id ProjectWelcomePage::id() const
{ {
return "Develop"; return "Develop";
@@ -131,6 +158,20 @@ 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);
}
/////////////////// ///////////////////
static QColor themeColor(Theme::Color role) static QColor themeColor(Theme::Color role)
@@ -160,6 +201,7 @@ protected:
{ {
return itemRect; return itemRect;
} }
virtual int shortcutRole() const = 0;
bool helpEvent(QHelpEvent *ev, QAbstractItemView *view, bool helpEvent(QHelpEvent *ev, QAbstractItemView *view,
const QStyleOptionViewItem &option, const QModelIndex &idx) final const QStyleOptionViewItem &option, const QModelIndex &idx) final
@@ -169,9 +211,7 @@ protected:
return false; return false;
} }
QString shortcut; QString shortcut = idx.data(shortcutRole()).toString();
if (idx.row() < m_shortcuts.size())
shortcut = m_shortcuts.at(idx.row());
QString name = idx.data(Qt::DisplayRole).toString(); QString name = idx.data(Qt::DisplayRole).toString();
QString tooltipText; QString tooltipText;
@@ -187,8 +227,6 @@ protected:
QToolTip::showText(ev->globalPos(), tooltipText, view); QToolTip::showText(ev->globalPos(), tooltipText, view);
return true; return true;
} }
QStringList m_shortcuts;
}; };
class SessionDelegate : public BaseDelegate class SessionDelegate : public BaseDelegate
@@ -202,31 +240,11 @@ protected:
const bool expanded = m_expandedSessions.contains(idx.data(Qt::DisplayRole).toString()); const bool expanded = m_expandedSessions.contains(idx.data(Qt::DisplayRole).toString());
return expanded ? itemRect.adjusted(0, 0, 0, -LINK_HEIGHT) : itemRect; return expanded ? itemRect.adjusted(0, 0, 0, -LINK_HEIGHT) : itemRect;
} }
int shortcutRole() const override { return SessionModel::ShortcutRole; }
public: 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 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); static const QPixmap sessionIcon = pixmap("session", Theme::Welcome_ForegroundSecondaryColor);
const QRect rc = option.rect; const QRect rc = option.rect;
@@ -236,17 +254,27 @@ public:
//const bool hovered = option.state & QStyle::State_MouseOver; //const bool hovered = option.state & QStyle::State_MouseOver;
const bool hovered = option.rect.contains(mousePos); const bool hovered = option.rect.contains(mousePos);
const bool expanded = m_expandedSessions.contains(sessionName); 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 x = rc.x();
const int x1 = x + 36; const int x1 = x + 36;
const int y = rc.y(); const int y = rc.y();
const int firstBase = y + 18; const int firstBase = y + 18;
painter->drawPixmap(x + 11, y + 5, sessionIcon); painter->drawPixmap(x + 11, y + 6, sessionIcon);
if (hovered || expanded) if (hovered && !expanded) {
painter->drawPixmap(rc.right() - 16, y + 5, expanded ? arrowDown : arrowUp); 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) { if (idx.row() < 9) {
painter->setPen(foregroundColor2); painter->setPen(foregroundColor2);
@@ -264,10 +292,10 @@ public:
if (isActiveSession && !isDefaultVirgin) if (isActiveSession && !isDefaultVirgin)
fullSessionName = ProjectWelcomePage::tr("%1 (current session)").arg(fullSessionName); 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); const bool switchActive = switchRect.contains(mousePos);
painter->setPen(linkColor); painter->setPen(linkColor);
painter->setFont(sizedFont(12, option.widget, switchActive)); painter->setFont(sizedFont(13, option.widget, switchActive));
painter->drawText(x1, firstBase, fullSessionName); painter->drawText(x1, firstBase, fullSessionName);
if (switchActive) if (switchActive)
m_activeSwitchToRect = switchRect; m_activeSwitchToRect = switchRect;
@@ -336,7 +364,7 @@ public:
{ {
if (ev->type() == QEvent::MouseButtonRelease) { if (ev->type() == QEvent::MouseButtonRelease) {
const QPoint pos = static_cast<QMouseEvent *>(ev)->pos(); 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(); const QString sessionName = idx.data(Qt::DisplayRole).toString();
if (rc.contains(pos)) { if (rc.contains(pos)) {
// The expand/collapse "button". // The expand/collapse "button".
@@ -385,41 +413,24 @@ private:
class ProjectDelegate : public BaseDelegate class ProjectDelegate : public BaseDelegate
{ {
QString entryType() override { return tr("project", "Appears in \"Open project <name>\""); } QString entryType() override { return tr("project", "Appears in \"Open project <name>\""); }
int shortcutRole() const override { return ProjectModel::ShortcutRole; }
public: 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 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const final
{ {
QRect rc = option.rect; QRect rc = option.rect;
const bool hovered = option.widget->isActiveWindow() && option.state & QStyle::State_MouseOver; const bool hovered = option.widget->isActiveWindow() && option.state & QStyle::State_MouseOver;
QColor color = themeColor(hovered ? Theme::Welcome_HoverColor : Theme::Welcome_BackgroundColor); if (hovered)
painter->fillRect(rc, color); painter->fillRect(rc, themeColor(Theme::Welcome_HoverColor));
const int x = rc.x(); const int x = rc.x();
const int y = rc.y(); const int y = rc.y();
const int firstBase = y + 15; const int firstBase = y + 18;
const int secondBase = firstBase + 15; 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 projectName = idx.data(Qt::DisplayRole).toString();
QString projectPath = idx.data(ProjectModel::FilePathRole).toString(); QString projectPath = idx.data(ProjectModel::FilePathRole).toString();
@@ -431,11 +442,11 @@ public:
painter->drawText(x + 3, firstBase, QString::number(idx.row() + 1)); painter->drawText(x + 3, firstBase, QString::number(idx.row() + 1));
painter->setPen(themeColor(Theme::Welcome_LinkColor)); 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->drawText(x + 36, firstBase, projectName);
painter->setPen(themeColor(Theme::Welcome_ForegroundPrimaryColor)); 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)); QString pathWithTilde = Utils::withTildeHomePath(QDir::toNativeSeparators(projectPath));
painter->drawText(x + 36, secondBase, pathWithTilde); painter->drawText(x + 36, secondBase, pathWithTilde);
} }
@@ -511,11 +522,11 @@ public:
openButton->setOnClicked([] { ProjectExplorerPlugin::openOpenProjectDialog(); }); openButton->setOnClicked([] { ProjectExplorerPlugin::openOpenProjectDialog(); });
auto sessionsLabel = new QLabel(this); auto sessionsLabel = new QLabel(this);
sessionsLabel->setFont(sizedFont(15, this)); sessionsLabel->setFont(sizedFont(16, this));
sessionsLabel->setText(ProjectWelcomePage::tr("Sessions")); sessionsLabel->setText(ProjectWelcomePage::tr("Sessions"));
auto recentProjectsLabel = new QLabel(this); auto recentProjectsLabel = new QLabel(this);
recentProjectsLabel->setFont(sizedFont(15, this)); recentProjectsLabel->setFont(sizedFont(16, this));
recentProjectsLabel->setText(ProjectWelcomePage::tr("Recent Projects")); recentProjectsLabel->setText(ProjectWelcomePage::tr("Recent Projects"));
auto sessionsList = new TreeView(this); auto sessionsList = new TreeView(this);
@@ -530,8 +541,6 @@ public:
projectsList->setItemDelegate(&m_projectDelegate); projectsList->setItemDelegate(&m_projectDelegate);
projectsList->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); projectsList->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
const int d = IWelcomePage::screenDependHeightDistance();
auto hbox11 = new QHBoxLayout; auto hbox11 = new QHBoxLayout;
hbox11->setContentsMargins(0, 0, 0, 0); hbox11->setContentsMargins(0, 0, 0, 0);
hbox11->addWidget(newButton); hbox11->addWidget(newButton);
@@ -546,23 +555,23 @@ public:
vbox1->setContentsMargins(0, 0, 0, 0); vbox1->setContentsMargins(0, 0, 0, 0);
vbox1->addStrut(200); vbox1->addStrut(200);
vbox1->addItem(hbox11); vbox1->addItem(hbox11);
vbox1->addSpacing(d); vbox1->addSpacing(16);
vbox1->addWidget(sessionsLabel); vbox1->addWidget(sessionsLabel);
vbox1->addSpacing(d + 5); vbox1->addSpacing(21);
vbox1->addWidget(sessionsList); vbox1->addWidget(sessionsList);
auto vbox2 = new QVBoxLayout; auto vbox2 = new QVBoxLayout;
vbox2->setContentsMargins(0, 0, 0, 0); vbox2->setContentsMargins(0, 0, 0, 0);
vbox2->addItem(hbox21); vbox2->addItem(hbox21);
vbox2->addSpacing(d); vbox2->addSpacing(16);
vbox2->addWidget(recentProjectsLabel); vbox2->addWidget(recentProjectsLabel);
vbox2->addSpacing(d + 5); vbox2->addSpacing(21);
vbox2->addWidget(projectsList); vbox2->addWidget(projectsList);
auto hbox = new QHBoxLayout(this); auto hbox = new QHBoxLayout(this);
hbox->setContentsMargins(30, 27, 0, 27); hbox->setContentsMargins(30, 27, 0, 27);
hbox->addItem(vbox1); hbox->addItem(vbox1);
hbox->addSpacing(d); hbox->addSpacing(16);
hbox->addItem(vbox2); hbox->addItem(vbox2);
hbox->setStretchFactor(vbox2, 2); hbox->setStretchFactor(vbox2, 2);
} }

View File

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

View File

@@ -28,6 +28,9 @@
#include "sessiondialog.h" #include "sessiondialog.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/id.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
@@ -35,6 +38,8 @@
#include <QFileInfo> #include <QFileInfo>
#include <QDir> #include <QDir>
using namespace Core;
namespace ProjectExplorer { namespace ProjectExplorer {
namespace Internal { namespace Internal {
@@ -146,6 +151,11 @@ QVariant SessionModel::data(const QModelIndex &index, int role) const
case ProjectsDisplayRole: case ProjectsDisplayRole:
result = pathsToBaseNames(SessionManager::projectsForSessionName(sessionName)); result = pathsToBaseNames(SessionManager::projectsForSessionName(sessionName));
break; 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) } // switch (role)
} }

View File

@@ -32,12 +32,21 @@
namespace ProjectExplorer { namespace ProjectExplorer {
namespace Internal { namespace Internal {
const char SESSION_BASE_ID[] = "Welcome.OpenSession";
class SessionModel : public QAbstractTableModel class SessionModel : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
public: 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); explicit SessionModel(QObject *parent = nullptr);

View File

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

View File

@@ -175,58 +175,6 @@ void QbsProject::projectLoaded()
m_parsingDelay.start(0); 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 QbsProject::filesGeneratedFrom(const QString &sourceFile) const
{ {
QStringList generated; QStringList generated;
@@ -312,7 +260,6 @@ bool QbsProject::addFilesToProduct(const QStringList &filePaths,
if (notAdded->count() != filePaths.count()) { if (notAdded->count() != filePaths.count()) {
m_projectData = m_qbsProject.projectData(); m_projectData = m_qbsProject.projectData();
setRootProjectNode(Internal::QbsNodeTreeBuilder::buildTree(this)); setRootProjectNode(Internal::QbsNodeTreeBuilder::buildTree(this));
emit fileListChanged();
} }
return notAdded->isEmpty(); return notAdded->isEmpty();
} }

View File

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

View File

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

View File

@@ -191,7 +191,6 @@ static QList<QmakeProject *> s_projects;
*/ */
QmakeProject::QmakeProject(const FileName &fileName) : QmakeProject::QmakeProject(const FileName &fileName) :
m_projectFiles(new QmakeProjectFiles),
m_qmakeVfs(new QMakeVfs), m_qmakeVfs(new QMakeVfs),
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this)) m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
{ {
@@ -230,7 +229,6 @@ QmakeProject::~QmakeProject()
setRootProjectNode(nullptr); setRootProjectNode(nullptr);
m_rootProFile.reset(); m_rootProFile.reset();
delete m_projectFiles;
m_cancelEvaluate = true; m_cancelEvaluate = true;
Q_ASSERT(m_qmakeGlobalsRefCnt == 0); Q_ASSERT(m_qmakeGlobalsRefCnt == 0);
delete m_qmakeVfs; delete m_qmakeVfs;
@@ -241,32 +239,6 @@ QmakeProFile *QmakeProject::rootProFile() const
return m_rootProFile.get(); 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) Project::RestoreResult QmakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
{ {
RestoreResult result = Project::fromMap(map, errorMessage); RestoreResult result = Project::fromMap(map, errorMessage);
@@ -576,7 +548,6 @@ void QmakeProject::decrementPendingEvaluateFutures()
setAllBuildConfigurationsEnabled(true); setAllBuildConfigurationsEnabled(true);
m_asyncUpdateState = Base; m_asyncUpdateState = Base;
updateFileList();
updateCodeModels(); updateCodeModels();
updateBuildSystemData(); updateBuildSystemData();
if (activeTarget()) if (activeTarget())
@@ -639,21 +610,6 @@ QString QmakeProject::displayName() const
return projectFilePath().toFileInfo().completeBaseName(); 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) // Find the folder that contains a file with a certain name (recurse down)
static FolderNode *folderOf(FolderNode *in, const FileName &fileName) static FolderNode *folderOf(FolderNode *in, const FileName &fileName)
{ {
@@ -1086,11 +1042,9 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
m_recursiveWatchedFolders += tmp; m_recursiveWatchedFolders += tmp;
} }
if (newOrRemovedFiles) { if (newOrRemovedFiles)
m_project->updateFileList();
m_project->updateCodeModels(); m_project->updateCodeModels();
} }
}
bool QmakeProject::needsConfiguration() const bool QmakeProject::needsConfiguration() const
{ {
@@ -1346,7 +1300,16 @@ void QmakeProject::testToolChain(ToolChain *tc, const Utils::FileName &path) con
return; return;
const Utils::FileName expected = tc->compilerCommand(); 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); const QPair<Utils::FileName, Utils::FileName> pair = qMakePair(expected, path);
if (!m_toolChainWarnings.contains(pair)) { if (!m_toolChainWarnings.contains(pair)) {
TaskHub::addTask(Task(Task::Warning, TaskHub::addTask(Task(Task::Warning,

View File

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

View File

@@ -318,9 +318,11 @@ void QmakeProjectManagerPlugin::updateContextActions()
{ {
Node *node = ProjectTree::currentNode(); Node *node = ProjectTree::currentNode();
Project *project = ProjectTree::currentProject(); 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()); QmakeProject *qmakeProject = qobject_cast<QmakeProject *>(QmakeManager::contextProject());
QmakeProFileNode *subProjectNode = nullptr; QmakeProFileNode *subProjectNode = nullptr;
if (node) { if (node) {

View File

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

View File

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

View File

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

View File

@@ -647,7 +647,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeAction( addDesignerAction(new ModelNodeAction(
raiseCommandId, raiseDisplayName, 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, raiseToolTip,
stackCategory, stackCategory,
QKeySequence(), QKeySequence(),
@@ -658,7 +658,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeAction( addDesignerAction(new ModelNodeAction(
lowerCommandId, lowerCommandId,
lowerDisplayName, 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, lowerToolTip,
stackCategory, stackCategory,
QKeySequence(), 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 <QTabBar>
#include <QImageReader> #include <QImageReader>
#include <QMimeData> #include <QMimeData>
#include <QMouseEvent>
#include <QWheelEvent> #include <QWheelEvent>
#include <QMenu> #include <QMenu>
#include <QApplication> #include <QApplication>
@@ -55,10 +56,6 @@
#include <QShortcut> #include <QShortcut>
#include <QQuickItem> #include <QQuickItem>
#include <private/qquickwidget_p.h> // mouse ungrabbing workaround on quickitems
#include <private/qquickwindow_p.h> // mouse ungrabbing workaround on quickitems
namespace QmlDesigner { namespace QmlDesigner {
ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
@@ -265,14 +262,7 @@ void ItemLibraryWidget::setResourcePath(const QString &resourcePath)
updateSearch(); updateSearch();
} }
static void ungrabMouseOnQMLWorldWorkAround(QQuickWidget *quickWidget) void ItemLibraryWidget::startDragAndDrop(QQuickItem *mouseArea, QVariant itemLibraryId)
{
const QQuickWidgetPrivate *widgetPrivate = QQuickWidgetPrivate::get(quickWidget);
if (widgetPrivate && widgetPrivate->offscreenWindow && widgetPrivate->offscreenWindow->mouseGrabberItem())
widgetPrivate->offscreenWindow->mouseGrabberItem()->ungrabMouse();
}
void ItemLibraryWidget::startDragAndDrop(QVariant itemLibraryId)
{ {
m_currentitemLibraryEntry = itemLibraryId.value<ItemLibraryEntry>(); m_currentitemLibraryEntry = itemLibraryId.value<ItemLibraryEntry>();
@@ -283,9 +273,14 @@ void ItemLibraryWidget::startDragAndDrop(QVariant itemLibraryId)
m_currentitemLibraryEntry.libraryEntryIconPath())); m_currentitemLibraryEntry.libraryEntryIconPath()));
drag->setMimeData(mimeData); 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) void ItemLibraryWidget::removeImport(const QString &name)

View File

@@ -84,7 +84,7 @@ public:
void setModel(Model *model); void setModel(Model *model);
Q_INVOKABLE void startDragAndDrop(QVariant itemLibId); Q_INVOKABLE void startDragAndDrop(QQuickItem *mouseArea, QVariant itemLibId);
protected: protected:
void removeImport(const QString &name); 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") { } else if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(name) == "qreal") {
bool ok; bool ok;
qreal realValue = value->expression().toFloat(&ok); qreal realValue = value->expression().toDouble(&ok);
if (ok) { if (ok) {
qmlObjectNode.setVariantProperty(name, realValue); qmlObjectNode.setVariantProperty(name, realValue);
transaction.commit(); //committing in the try block transaction.commit(); //committing in the try block

View File

@@ -28,7 +28,7 @@ QTabBar#centralTabBar::tab:selected {
color: creatorTheme.QmlDesignerTabDark; color: creatorTheme.QmlDesignerTabDark;
} }
QToolButton { QToolButton#centralTabBar {
background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate; background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate;
width: 08px; width: 08px;
height: 16px; 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>scrollbar.css</file>
<file>formeditorstylesheet.css</file> <file>formeditorstylesheet.css</file>
<file>centerwidget.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> </qresource>
</RCC> </RCC>

View File

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