Merge remote-tracking branch 'origin/4.3'

Conflicts:
	src/plugins/cmakeprojectmanager/servermodereader.cpp

Change-Id: I58e7b33d32c41cb48a24a5638ddb256212dd6107
This commit is contained in:
Eike Ziller
2017-03-30 13:59:12 +02:00
71 changed files with 798 additions and 739 deletions

215
dist/changes-4.3.0.md vendored Normal file
View File

@@ -0,0 +1,215 @@
Qt Creator version 4.3 contains bug fixes and new features.
The most important changes are listed in this document. For a complete
list of changes, see the Git log for the Qt Creator sources that
you can check out from the public Git repository. For example:
git clone git://code.qt.io/qt-creator/qt-creator.git
git log --cherry-pick --pretty=oneline origin/4.2..v4.3.0
General
* Added option to search `Files in File System` with Silver Searcher (`ag`)
(experimental `SilverSearcher` plugin)
* Added exclusion patterns to `Advanced Find` and custom locator filters
* Added navigation pane on right side of edit mode
Editing
* Added optional shortcut for duplicating current selection
All Projects
* Added support for `.qrc` files in project tree for all projects
* Added Qt Creator variable `CurrentRun:Runnable:FilePath`
* Added choice of build system to most project wizards (QTCREATORBUG-17308)
QMake Projects
* Fixed wrong warning when specifying absolute path to mkspec
(QTCREATORBUG-17237)
CMake Projects
* Added support for `server-mode` with CMake 3.7 or later
* Added products and targets to project tree
* Added option to build individual products and targets
* Removed the need for `CodeBlocks` extra generator
* Added header files to project tree, even if not listed explicitly in
project files
* Added import of configuration of existing builds
Generic Projects
* Added expansion of Qt Creator variables in project files
C++ Support
* Added support for `clang-query` in `Advanced Find` to experimental
`ClangRefactoring` plugin
* Added switching project and language context for parsing files to editor
toolbar
* Added support for `--gcctoolchain` option
* Improved performance of first completion in file on Windows
* Fixed handling of Objective-C/C++
* Fixed cursor position after correcting `.` to `->` (QTCREATORBUG-17697)
* Fixed that quotes were added when splitting raw string literals
(QTCREATORBUG-17717)
QML Support
* Added option to automatically format QML files on save
* Added menu item for adding expression evaluators from QML code editor
(QTCREATORBUG-17754)
Nim Support
* Added automatic reparsing when files are added to or removed from project
* Added Nim compiler setting to kits
* Fixed that loading projects blocked Qt Creator
* Fixed crash when opening empty projects
Debugging
* Added pretty printing of `unordered_multi(set|map)`
* Fixed that expression evaluators were not evaluated when added
(QTCREATORBUG-17763)
* QML
* Fixed accessing items by `id` in `Debugger Console` (QTCREATORBUG-17177)
* CDB
* Changed to Python based pretty printing backend, resulting in faster
startup and more, faster, and unified pretty printers
QML Profiler
* Added performance information to QML code editor (QTCREATORBUG-17757)
* Improved performance of rendering timeline and loading trace files
* Improved error and progress reporting for loading and saving trace files
* Fixed pixmap cache size information when loading profile
(QTCREATORBUG-17424)
Qt Quick Designer
* Added support for HiDPI
* Added text editor view
* Added tool bar for common actions
* Added changing type of item by changing type name in property editor
* Added support for `qsTranslate` (QTCREATORBUG-17714)
* Added actions for adding items, selecting visible item, and adding tab bar
to stacked containers
* Fixed that error messages could be shown twice
* Fixed handling of escaped unicode characters (QTCREATORBUG-12616)
Version Control Systems
* Git
* Added option to only show the first parent of merge commits in log
* Added action to skip a commit during rebase (QTCREATORBUG-17350)
* Added option to sign-off commits
* Fixed handling of already merged files in merge tool
* Gerrit
* Added detection of Gerrit remotes (SSH only)
* Added support for accessing Gerrit via HTTP(S)
Test Integration
* Removed `experimental` state
* Improved display of test results (QTCREATORBUG-17104)
* Added option to limit searching for tests to folders matching pattern
(QTCREATORBUG-16705)
* Fixed detection of inherited test methods (QTCREATORBUG-17522)
* Fixed missing update of test list when QML files are added or removed
(QTCREATORBUG-17805)
SCXML Editor
* Fixed adding elements to `else` case (QTCREATORBUG-17674)
* Fixed that copying and pasting state created invalid name
Beautifier
* Uncrustify
* Added option to select config file to use
Platform Specific
Windows
* Fixed that it was not possible to save files with arbitrary extension
(QTCREATORBUG-15862)
Android
* Improved package signing (QTCREATORBUG-17545, QTCREATORBUG-17304)
iOS
* Added option to select developer team and provisioning profile used for
signing (QTCREATORBUG-16936)
* Fixed that starting simulator blocked Qt Creator
Remote Linux
* Added incremental deployment to `tar` package deployment
QNX
* Added support for 64bit platforms
Credits for these changes go to:
Alessandro Portale
Alexander Drozdov
Alexandru Croitor
Andre Hartmann
Andreas Pakulat
André Pönitz
Arnold Dumas
BogDan Vatra
Christian Gagneraud
Christian Kandeler
Christian Stenger
Cristian Adam
Daniel Kamil Kozar
Daniel Trevitz
David Schulz
Eike Ziller
Filippo Cucchetto
Florian Apolloner
Francois Ferrand
Frank Meerkötter
Friedemann Kleint
Hugo Holgersson
Jake Petroules
James McDonnell
Jaroslaw Kobus
Jesus Fernandez
Juhapekka Piiroinen
Jörg Bornemann
Kari Oikarinen
Kavindra Palaraja
Konstantin Podsvirov
Leena Miettinen
Lorenz Haas
Lukas Holecek
Marco Benelli
Marco Bubke
Mathias Hasselmann
Max Blagay
Michael Dönnebrink
Michal Steller
Montel Laurent
Nikita Baryshnikov
Nikolai Kosjar
Oleg Yadrov
Orgad Shaneh
Oswald Buddenhagen
Przemyslaw Gorszkowski
Robert Löhning
Serhii Moroz
Tasuku Suzuki
Thiago Macieira
Thomas Hartmann
Tim Jenssen
Tobias Hunger
Ulf Hermann
Vikas Pachdha

View File

@@ -29,6 +29,7 @@
[ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2; [ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2;
app_path="$1" app_path="$1"
resource_path="$app_path/Contents/Resources"
bin_src="$2" bin_src="$2"
translation_src="$3" translation_src="$3"
plugin_src="$4" plugin_src="$4"
@@ -76,28 +77,28 @@ if [ -d "$quick2_src" ]; then
fi fi
# copy qt creator qt.conf # copy qt creator qt.conf
if [ ! -f "$app_path/Contents/Resources/qt.conf" ]; then if [ ! -f "$resource_path/qt.conf" ]; then
echo "- Copying qt.conf" echo "- Copying qt.conf"
cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qt.conf" "$app_path/Contents/Resources/qt.conf" || exit 1 cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qt.conf" "$resource_path/qt.conf" || exit 1
fi fi
# copy ios tools' qt.conf # copy ios tools' qt.conf
if [ ! -f "$app_path/Contents/Resources/ios/qt.conf" ]; then if [ ! -f "$resource_path/ios/qt.conf" ]; then
echo "- Copying ios/qt.conf" echo "- Copying ios/qt.conf"
cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$app_path/Contents/Resources/ios/qt.conf" || exit 1 cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$resource_path/ios/qt.conf" || exit 1
fi fi
# copy qml2puppet's qt.conf # copy qml2puppet's qt.conf
if [ ! -f "$app_path/Contents/Resources/qmldesigner/qt.conf" ]; then if [ ! -f "$resource_path/qmldesigner/qt.conf" ]; then
echo "- Copying qmldesigner/qt.conf" echo "- Copying qmldesigner/qt.conf"
cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qmldesigner_qt.conf" "$app_path/Contents/Resources/qmldesigner/qt.conf" || exit 1 cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qmldesigner_qt.conf" "$resource_path/qmldesigner/qt.conf" || exit 1
fi fi
# copy Qt translations # copy Qt translations
# check for known existing translation to avoid copying multiple times # check for known existing translation to avoid copying multiple times
if [ ! -f "$app_path/Contents/Resources/translations/qt_de.qm" ]; then if [ ! -f "$resource_path/translations/qt_de.qm" ]; then
echo "- Copying Qt translations" echo "- Copying Qt translations"
cp "$translation_src"/*.qm "$app_path/Contents/Resources/translations/" || exit 1 cp "$translation_src"/*.qm "$resource_path/translations/" || exit 1
fi fi
# copy libclang if needed # copy libclang if needed
@@ -106,32 +107,27 @@ if [ $LLVM_INSTALL_DIR ]; then
echo "- Copying libclang" echo "- Copying libclang"
mkdir -p "$app_path/Contents/Frameworks" || exit 1 mkdir -p "$app_path/Contents/Frameworks" || exit 1
# use recursive copy to make it copy symlinks as symlinks # use recursive copy to make it copy symlinks as symlinks
mkdir -p "$app_path/Contents/Resources/clang/bin" mkdir -p "$resource_path/clang/bin"
mkdir -p "$app_path/Contents/Resources/clang/lib" mkdir -p "$resource_path/clang/lib"
cp -Rf "$LLVM_INSTALL_DIR"/lib/libclang.*dylib "$app_path/Contents/Frameworks/" || exit 1 cp -Rf "$LLVM_INSTALL_DIR"/lib/libclang.*dylib "$app_path/Contents/Frameworks/" || exit 1
cp -Rf "$LLVM_INSTALL_DIR"/lib/clang "$app_path/Contents/Resources/clang/lib/" || exit 1 cp -Rf "$LLVM_INSTALL_DIR"/lib/clang "$resource_path/clang/lib/" || exit 1
clangsource="$LLVM_INSTALL_DIR"/bin/clang clangsource="$LLVM_INSTALL_DIR"/bin/clang
clanglinktarget="$(readlink "$clangsource")" clanglinktarget="$(readlink "$clangsource")"
cp -Rf "$clangsource" "$app_path/Contents/Resources/clang/bin/" || exit 1 cp -Rf "$clangsource" "$resource_path/clang/bin/" || exit 1
if [ $clanglinktarget ]; then if [ $clanglinktarget ]; then
cp -Rf "$(dirname "$clangsource")/$clanglinktarget" "$app_path/Contents/Resources/clang/bin/$clanglinktarget" || exit 1 cp -Rf "$(dirname "$clangsource")/$clanglinktarget" "$resource_path/clang/bin/$clanglinktarget" || exit 1
fi fi
fi fi
_CLANG_CODEMODEL_LIB="$app_path/Contents/PlugIns/libClangCodeModel_debug.dylib" clangbackendArgument="-executable=$resource_path/clangbackend"
if [ ! -f "$_CLANG_CODEMODEL_LIB" ]; then clangpchmanagerArgument="-executable=$resource_path/clangpchmanagerbackend"
_CLANG_CODEMODEL_LIB="$app_path/Contents/PlugIns/libClangCodeModel.dylib" clangrefactoringArgument="-executable=$resource_path/clangrefactoringbackend"
fi
# this will just fail when run a second time on libClangCodeModel
xcrun install_name_tool -delete_rpath "$LLVM_INSTALL_DIR/lib" "$_CLANG_CODEMODEL_LIB" || true
xcrun install_name_tool -add_rpath "@loader_path/../Frameworks" "$_CLANG_CODEMODEL_LIB" || true
clangbackendArgument="-executable=$app_path/Contents/Resources/clangbackend"
fi fi
#### macdeployqt #### macdeployqt
if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then
qml2puppetapp="$app_path/Contents/Resources/qmldesigner/qml2puppet" qml2puppetapp="$resource_path/qmldesigner/qml2puppet"
if [ -f "$qml2puppetapp" ]; then if [ -f "$qml2puppetapp" ]; then
qml2puppetArgument="-executable=$qml2puppetapp" qml2puppetArgument="-executable=$qml2puppetapp"
fi fi
@@ -141,12 +137,13 @@ if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then
echo "- Running macdeployqt ($(which macdeployqt))" echo "- Running macdeployqt ($(which macdeployqt))"
macdeployqt "$app_path" \ macdeployqt "$app_path" \
"-executable=$app_path/Contents/Resources/qtpromaker" \
"-executable=$app_path/Contents/Resources/sdktool" \
"-executable=$app_path/Contents/Resources/ios/iostool" \
"-executable=$app_path/Contents/Resources/buildoutputparser" \
"-executable=$app_path/Contents/Resources/cpaster" \
"-executable=$app_path/Contents/MacOS/qtdiag" \ "-executable=$app_path/Contents/MacOS/qtdiag" \
"-executable=$resource_path/qtpromaker" \
"-executable=$resource_path/sdktool" \
"-executable=$resource_path/ios/iostool" \
"-executable=$resource_path/buildoutputparser" \
"-executable=$resource_path/cpaster" \
"-executable=$resource_path/qbs_processlauncher" \
"-executable=$qbsapp" \ "-executable=$qbsapp" \
"-executable=$qbsapp-config" \ "-executable=$qbsapp-config" \
"-executable=$qbsapp-config-ui" \ "-executable=$qbsapp-config-ui" \
@@ -154,6 +151,8 @@ if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then
"-executable=$qbsapp-setup-android" \ "-executable=$qbsapp-setup-android" \
"-executable=$qbsapp-setup-qt" \ "-executable=$qbsapp-setup-qt" \
"-executable=$qbsapp-setup-toolchains" \ "-executable=$qbsapp-setup-toolchains" \
"$qml2puppetArgument" "$clangbackendArgument" || exit 1 "-executable=$qbsapp-create-project" \
"$qml2puppetArgument" \
"$clangbackendArgument" "$clangpchmanagerArgument" "$clangrefactoringArgument" || exit 1
fi fi

View File

@@ -124,6 +124,7 @@ class Dumper(DumperBase):
# read raw memory in case the integerString can not be interpreted # read raw memory in case the integerString can not be interpreted
pass pass
val.isBaseClass = val.name == val.type.name val.isBaseClass = val.name == val.type.name
val.nativeValue = nativeValue
val.lIsInScope = True val.lIsInScope = True
val.laddress = nativeValue.address() val.laddress = nativeValue.address()
return val return val
@@ -459,7 +460,37 @@ class Dumper(DumperBase):
return cdbext.parseAndEvaluate(exp) return cdbext.parseAndEvaluate(exp)
def nativeDynamicTypeName(self, address, baseType): def nativeDynamicTypeName(self, address, baseType):
return None # FIXME: Seems sufficient, no idea why. return None # Does not work with cdb
def nativeValueDereferenceReference(self, value):
return self.nativeValueDereferencePointer(value)
def nativeValueDereferencePointer(self, value):
def nativeVtCastValue(nativeValue):
# If we have a pointer to a derived instance of the pointer type cdb adds a
# synthetic '__vtcast_<derived type name>' member as the first child
if nativeValue.hasChildren():
vtcastCandidate = nativeValue.childFromIndex(0)
vtcastCandidateName = vtcastCandidate.name()
if vtcastCandidateName.startswith('__vtcast_'):
# found a __vtcast member
# make sure that it is not an actual field
for field in nativeValue.type().fields():
if field.name() == vtcastCandidateName:
return None
return vtcastCandidate
return None
nativeValue = value.nativeValue
castVal = nativeVtCastValue(nativeValue)
if castVal is not None:
val = self.fromNativeValue(castVal)
else:
val = self.Value(self)
val.laddress = value.pointer()
val.type = value.type.dereference()
return val
def callHelper(self, rettype, value, function, args): def callHelper(self, rettype, value, function, args):
raise Exception("cdb does not support calling functions") raise Exception("cdb does not support calling functions")

View File

@@ -3105,13 +3105,13 @@ class DumperBase:
val.laddress = self.laddress val.laddress = self.laddress
val.type = self.dumper.nativeDynamicType(val.laddress, self.type.dereference()) val.type = self.dumper.nativeDynamicType(val.laddress, self.type.dereference())
else: else:
val = self.dumper.nativeValueDereferenceReference(self.nativeValue) val = self.dumper.nativeValueDereferenceReference(self)
elif self.type.code == TypeCodePointer: elif self.type.code == TypeCodePointer:
if self.nativeValue is None: if self.nativeValue is None:
val.laddress = self.pointer() val.laddress = self.pointer()
val.type = self.dumper.nativeDynamicType(val.laddress, self.type.dereference()) val.type = self.dumper.nativeDynamicType(val.laddress, self.type.dereference())
else: else:
val = self.dumper.nativeValueDereferencePointer(self.nativeValue) val = self.dumper.nativeValueDereferencePointer(self)
else: else:
error("WRONG: %s" % self.type.code) error("WRONG: %s" % self.type.code)
#warn("DEREFERENCING FROM: %s" % self) #warn("DEREFERENCING FROM: %s" % self)

View File

@@ -1050,11 +1050,12 @@ class Dumper(DumperBase):
n = ("'%sQWidget'" % ns) if lenns else 'QWidget' n = ("'%sQWidget'" % ns) if lenns else 'QWidget'
self.reportResult('selected="0x%x",expr="(%s*)0x%x"' % (p, n, p), args) self.reportResult('selected="0x%x",expr="(%s*)0x%x"' % (p, n, p), args)
def nativeValueDereferencePointer(self, nativeValue): def nativeValueDereferencePointer(self, value):
deref = nativeValue.dereference() deref = value.nativeValue.dereference()
return self.fromNativeValue(deref.cast(deref.dynamic_type)) return self.fromNativeValue(deref.cast(deref.dynamic_type))
def nativeValueDereferenceReference(self, nativeValue): def nativeValueDereferenceReference(self, value):
nativeValue = value.nativeValue
return self.fromNativeValue(nativeValue.cast(nativeValue.type.target())) return self.fromNativeValue(nativeValue.cast(nativeValue.type.target()))
def nativeDynamicTypeName(self, address, baseType): def nativeDynamicTypeName(self, address, baseType):

View File

@@ -102,9 +102,13 @@ static PyObject *cdbext_parseAndEvaluate(PyObject *, PyObject *args) // -> Value
if (debugPyCdbextModule) if (debugPyCdbextModule)
DebugPrint() << "evaluate expression: " << expr; DebugPrint() << "evaluate expression: " << expr;
CIDebugControl *control = ExtensionCommandContext::instance()->control(); CIDebugControl *control = ExtensionCommandContext::instance()->control();
ULONG oldExpressionSyntax;
control->GetExpressionSyntax(&oldExpressionSyntax);
control->SetExpressionSyntax(DEBUG_EXPR_CPLUSPLUS); control->SetExpressionSyntax(DEBUG_EXPR_CPLUSPLUS);
DEBUG_VALUE value; DEBUG_VALUE value;
if (FAILED(control->Evaluate(expr, DEBUG_VALUE_INT64, &value, NULL))) HRESULT hr = control->Evaluate(expr, DEBUG_VALUE_INT64, &value, NULL);
control->SetExpressionSyntax(oldExpressionSyntax);
if (FAILED(hr))
Py_RETURN_NONE; Py_RETURN_NONE;
return Py_BuildValue("K", value.I64); return Py_BuildValue("K", value.I64);
} }

View File

@@ -68,6 +68,7 @@ ScrollView {
// switch to non-interactive ourselves, though. // switch to non-interactive ourselves, though.
property bool stayInteractive: true property bool stayInteractive: true
onStayInteractiveChanged: flick.interactive = stayInteractive onStayInteractiveChanged: flick.interactive = stayInteractive
onWidthChanged: scroll()
Flickable { Flickable {
id: flick id: flick
@@ -88,13 +89,12 @@ ScrollView {
recursionGuard = false; recursionGuard = false;
} }
onWidthChanged: scroll()
// Update the zoom control on scrolling. // Update the zoom control on scrolling.
onContentXChanged: guarded(function() { onContentXChanged: guarded(function() {
var newStartTime = contentX * zoomer.rangeDuration / width + zoomer.windowStart; var newStartTime = contentX * zoomer.rangeDuration / scroller.width
+ zoomer.windowStart;
if (isFinite(newStartTime) && Math.abs(newStartTime - zoomer.rangeStart) >= 1) { if (isFinite(newStartTime) && Math.abs(newStartTime - zoomer.rangeStart) >= 1) {
var newEndTime = (contentX + width) * zoomer.rangeDuration / width var newEndTime = (contentX + scroller.width) * zoomer.rangeDuration / scroller.width
+ zoomer.windowStart; + zoomer.windowStart;
if (isFinite(newEndTime)) if (isFinite(newEndTime))
zoomer.setRange(newStartTime, newEndTime); zoomer.setRange(newStartTime, newEndTime);
@@ -108,10 +108,10 @@ ScrollView {
contentWidth = 0; contentWidth = 0;
contentX = 0; contentX = 0;
} else { } else {
var newWidth = zoomer.windowDuration * width / zoomer.rangeDuration; var newWidth = zoomer.windowDuration * scroller.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) * width / var newStartX = (zoomer.rangeStart - zoomer.windowStart) * scroller.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;

View File

@@ -322,12 +322,14 @@ int TimelineModel::firstIndex(qint64 startTime) const
int TimelineModel::TimelineModelPrivate::firstIndexNoParents(qint64 startTime) const int TimelineModel::TimelineModelPrivate::firstIndexNoParents(qint64 startTime) const
{ {
// in the "endtime" list, find the first event that ends after startTime // in the "endtime" list, find the first event that ends after startTime
if (endTimes.isEmpty())
// lowerBound() cannot deal with empty lists, and it never finds the last element.
if (endTimes.isEmpty() || endTimes.last().end <= startTime)
return -1; return -1;
if (endTimes.count() == 1 || endTimes.first().end > startTime)
// lowerBound() never returns "invalid", so handle this manually.
if (endTimes.first().end > startTime)
return endTimes.first().startIndex; return endTimes.first().startIndex;
if (endTimes.last().end <= startTime)
return -1;
return endTimes[lowerBound(endTimes, startTime) + 1].startIndex; return endTimes[lowerBound(endTimes, startTime) + 1].startIndex;
} }
@@ -340,16 +342,55 @@ int TimelineModel::lastIndex(qint64 endTime) const
{ {
Q_D(const TimelineModel); Q_D(const TimelineModel);
// in the "starttime" list, find the last event that starts before endtime // in the "starttime" list, find the last event that starts before endtime
// lowerBound() never returns "invalid", so handle this manually.
if (d->ranges.isEmpty() || d->ranges.first().start >= endTime) if (d->ranges.isEmpty() || d->ranges.first().start >= endTime)
return -1; return -1;
if (d->ranges.count() == 1)
return 0; // lowerBound() never finds the last element.
if (d->ranges.last().start < endTime) if (d->ranges.last().start < endTime)
return d->ranges.count() - 1; return d->ranges.count() - 1;
return d->lowerBound(d->ranges, endTime); return d->lowerBound(d->ranges, endTime);
} }
/*!
Looks up a range between the last one that starts before, and the first one that ends after the
given timestamp. This might not be a range that covers the timestamp, even if one exists.
However, it's likely that the range is close to the given timestamp.
*/
int TimelineModel::bestIndex(qint64 timestamp) const
{
Q_D(const TimelineModel);
if (d->ranges.isEmpty())
return -1;
// Last range that starts before timestamp (without parents)
const int start = d->ranges.last().start < timestamp
? d->ranges.count() - 1 : d->lowerBound(d->ranges, timestamp);
int endTimeIndex;
if (d->endTimes.first().end >= timestamp)
endTimeIndex = 0;
else if (d->endTimes.last().end < timestamp)
endTimeIndex = d->endTimes.count() - 1;
else
endTimeIndex = d->lowerBound(d->endTimes, timestamp) + 1;
// First range that ends after
const int end = d->endTimes[endTimeIndex].startIndex;
// Best is probably between those
return (start + end) / 2;
}
int TimelineModel::parentIndex(int index) const
{
Q_D(const TimelineModel);
return d->ranges[index].parent;
}
QVariantMap TimelineModel::location(int index) const QVariantMap TimelineModel::location(int index) const
{ {
Q_UNUSED(index); Q_UNUSED(index);

View File

@@ -76,6 +76,8 @@ public:
int firstIndex(qint64 startTime) const; int firstIndex(qint64 startTime) const;
int lastIndex(qint64 endTime) const; int lastIndex(qint64 endTime) const;
int bestIndex(qint64 timestamp) const;
int parentIndex(int index) const;
bool expanded() const; bool expanded() const;
bool hidden() const; bool hidden() const;

View File

@@ -70,10 +70,8 @@ TimelineRenderer::TimelineRenderer(QQuickItem *parent) :
void TimelineRenderer::TimelineRendererPrivate::resetCurrentSelection() void TimelineRenderer::TimelineRendererPrivate::resetCurrentSelection()
{ {
currentSelection.startTime = -1; currentEventIndex = -1;
currentSelection.endTime = -1; currentRow = -1;
currentSelection.row = -1;
currentSelection.eventIndex = -1;
} }
TimelineRenderState *TimelineRenderer::TimelineRendererPrivate::findRenderState() TimelineRenderState *TimelineRenderer::TimelineRendererPrivate::findRenderState()
@@ -182,7 +180,7 @@ void TimelineRenderer::mouseReleaseEvent(QMouseEvent *event)
{ {
Q_D(TimelineRenderer); Q_D(TimelineRenderer);
d->findCurrentSelection(event->pos().x(), event->pos().y(), width()); d->findCurrentSelection(event->pos().x(), event->pos().y(), width());
setSelectedItem(d->currentSelection.eventIndex); setSelectedItem(d->currentEventIndex);
} }
void TimelineRenderer::mouseMoveEvent(QMouseEvent *event) void TimelineRenderer::mouseMoveEvent(QMouseEvent *event)
@@ -195,10 +193,10 @@ void TimelineRenderer::hoverMoveEvent(QHoverEvent *event)
Q_D(TimelineRenderer); Q_D(TimelineRenderer);
if (!d->selectionLocked) { if (!d->selectionLocked) {
d->findCurrentSelection(event->pos().x(), event->pos().y(), width()); d->findCurrentSelection(event->pos().x(), event->pos().y(), width());
if (d->currentSelection.eventIndex != -1) if (d->currentEventIndex != -1)
setSelectedItem(d->currentSelection.eventIndex); setSelectedItem(d->currentEventIndex);
} }
if (d->currentSelection.eventIndex == -1) if (d->currentEventIndex == -1)
event->setAccepted(false); event->setAccepted(false);
} }
@@ -229,6 +227,88 @@ void TimelineRenderer::wheelEvent(QWheelEvent *event)
} }
} }
TimelineRenderer::TimelineRendererPrivate::MatchResult
TimelineRenderer::TimelineRendererPrivate::checkMatch(MatchParameters *params, int index,
qint64 itemStart, qint64 itemEnd)
{
const qint64 offset = qAbs(itemEnd - params->exactTime) + qAbs(itemStart - params->exactTime);
if (offset >= params->bestOffset)
return NoMatch;
// match
params->bestOffset = offset;
currentEventIndex = index;
// Exact match. If we can get better than this, then we have multiple overlapping
// events in one row. There is no point in sorting those out as you cannot properly
// discern them anyway.
return (itemEnd >= params->exactTime && itemStart <= params->exactTime)
? ExactMatch : ApproximateMatch;
}
TimelineRenderer::TimelineRendererPrivate::MatchResult
TimelineRenderer::TimelineRendererPrivate::matchForward(MatchParameters *params, int index)
{
if (index < 0)
return NoMatch;
if (index >= model->count())
return Cutoff;
if (model->row(index) != currentRow)
return NoMatch;
const qint64 itemEnd = model->endTime(index);
if (itemEnd < params->startTime)
return NoMatch;
const qint64 itemStart = model->startTime(index);
if (itemStart > params->endTime)
return Cutoff;
// Further iteration will only increase the startOffset.
if (itemStart - params->exactTime >= params->bestOffset)
return Cutoff;
return checkMatch(params, index, itemStart, itemEnd);
}
TimelineRenderer::TimelineRendererPrivate::MatchResult
TimelineRenderer::TimelineRendererPrivate::matchBackward(MatchParameters *params, int index)
{
if (index < 0)
return Cutoff;
if (index >= model->count())
return NoMatch;
if (model->row(index) != currentRow)
return NoMatch;
const qint64 itemStart = model->startTime(index);
if (itemStart > params->endTime)
return NoMatch;
// There can be small events that don't reach the cursor position after large events
// that do but are in a different row. In that case, the parent index will be valid and will
// point to the large event. If that is also outside the range, we are really done.
const qint64 itemEnd = model->endTime(index);
if (itemEnd < params->startTime) {
const int parentIndex = model->parentIndex(index);
const qint64 parentEnd = parentIndex == -1 ? itemEnd : model->endTime(parentIndex);
return (parentEnd < params->startTime) ? Cutoff : NoMatch;
}
if (params->exactTime - itemStart >= params->bestOffset) {
// We cannot get better anymore as the startTimes are totally ordered.
// Thus, the startOffset will only get bigger and we're only adding a
// positive number (end offset) in checkMatch() when comparing with bestOffset.
return Cutoff;
}
return checkMatch(params, index, itemStart, itemEnd);
}
void TimelineRenderer::TimelineRendererPrivate::findCurrentSelection(int mouseX, int mouseY, void TimelineRenderer::TimelineRendererPrivate::findCurrentSelection(int mouseX, int mouseY,
int width) int width)
{ {
@@ -239,67 +319,48 @@ void TimelineRenderer::TimelineRendererPrivate::findCurrentSelection(int mouseX,
if (duration <= 0) if (duration <= 0)
return; return;
MatchParameters params;
// 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 / width + zoomer->windowStart(); params.startTime = (mouseX - 1) * duration / width + zoomer->windowStart();
qint64 endTime = (mouseX + 1) * duration / width + zoomer->windowStart(); params.endTime = (mouseX + 1) * duration / width + zoomer->windowStart();
qint64 exactTime = (startTime + endTime) / 2; params.exactTime = (params.startTime + params.endTime) / 2;
int row = rowFromPosition(mouseY); const int row = rowFromPosition(mouseY);
// already covered? Only make sure d->selectedItem is correct. // already covered? Only make sure d->selectedItem is correct.
if (currentSelection.eventIndex != -1 && if (currentEventIndex != -1 &&
exactTime >= currentSelection.startTime && params.exactTime >= model->startTime(currentEventIndex) &&
exactTime < currentSelection.endTime && params.exactTime < model->endTime(currentEventIndex) &&
row == currentSelection.row) { row == currentRow) {
return; return;
} }
// find if there's items in the time range currentRow = row;
int eventFrom = model->firstIndex(startTime); currentEventIndex = -1;
int eventTo = model->lastIndex(endTime);
currentSelection.eventIndex = -1; const int middle = model->bestIndex(params.exactTime);
if (eventFrom == -1 || eventTo < eventFrom || eventTo >= model->count()) if (middle == -1)
return; return;
// find if we are in the right column params.bestOffset = std::numeric_limits<qint64>::max();
qint64 bestOffset = std::numeric_limits<qint64>::max(); const qint64 itemStart = model->startTime(middle);
for (int i=eventTo; i>=eventFrom; --i) { const qint64 itemEnd = model->endTime(middle);
if (model->row(i) != row) if (model->row(middle) == row && itemEnd >= params.startTime && itemStart <= params.endTime) {
continue; if (checkMatch(&params, middle, itemStart, itemEnd) == ExactMatch)
return;
// There can be small events that don't reach the cursor position after large events
// that do but are in a different row.
qint64 itemEnd = model->endTime(i);
if (itemEnd < startTime)
continue;
qint64 itemStart = model->startTime(i);
qint64 startOffset = exactTime - itemStart;
if (startOffset >= bestOffset) {
// We cannot get better anymore as the startTimes are totally ordered and we're moving
// backwards. Thus, the startOffset will only get bigger and we're only adding a
// positive number (end offset) below when comparing with bestOffset.
break;
} }
qint64 offset = qAbs(itemEnd - exactTime) + qAbs(startOffset); MatchResult forward = NoMatch;
if (offset >= bestOffset) MatchResult backward = NoMatch;
continue; for (int offset = 1; forward != Cutoff || backward != Cutoff; ++offset) {
if (backward != Cutoff
// match && (backward = matchBackward(&params, middle - offset)) == ExactMatch) {
currentSelection.eventIndex = i; return;
currentSelection.startTime = itemStart; }
currentSelection.endTime = itemEnd; if (forward != Cutoff
currentSelection.row = row; && (forward = matchForward(&params, middle + offset)) == ExactMatch) {
return;
// Exact match. If we can get better than this, then we have multiple overlapping }
// events in one row. There is no point in sorting those out as you cannot properly
// discern them anyway.
if (itemEnd >= exactTime && itemStart <= exactTime)
break;
bestOffset = offset;
} }
} }

View File

@@ -33,12 +33,31 @@ namespace Timeline {
class TimelineRenderer::TimelineRendererPrivate : class TimelineRenderer::TimelineRendererPrivate :
public TimelineAbstractRenderer::TimelineAbstractRendererPrivate { public TimelineAbstractRenderer::TimelineAbstractRendererPrivate {
public: public:
enum MatchResult {
NoMatch,
Cutoff,
ApproximateMatch,
ExactMatch
};
struct MatchParameters {
qint64 startTime;
qint64 endTime;
qint64 exactTime;
qint64 bestOffset;
};
TimelineRendererPrivate(); TimelineRendererPrivate();
~TimelineRendererPrivate(); ~TimelineRendererPrivate();
void clear(); void clear();
int rowFromPosition(int y) const; int rowFromPosition(int y) const;
MatchResult checkMatch(MatchParameters *params, int index, qint64 itemStart, qint64 itemEnd);
MatchResult matchForward(MatchParameters *params, int index);
MatchResult matchBackward(MatchParameters *params, int index);
void findCurrentSelection(int mouseX, int mouseY, int width); void findCurrentSelection(int mouseX, int mouseY, int width);
static const int SafeFloatMax = 1 << 12; static const int SafeFloatMax = 1 << 12;
@@ -47,12 +66,8 @@ public:
TimelineRenderState *findRenderState(); TimelineRenderState *findRenderState();
struct { int currentEventIndex;
qint64 startTime; int currentRow;
qint64 endTime;
int row;
int eventIndex;
} currentSelection;
QVector<QHash<qint64, TimelineRenderState *> > renderStates; QVector<QHash<qint64, TimelineRenderState *> > renderStates;
TimelineRenderState *lastState; TimelineRenderState *lastState;

View File

@@ -108,9 +108,9 @@ public:
return m_size == 0; return m_size == 0;
} }
void fillWithZero() void initializeElements()
{ {
std::array<T, MaxSize>::fill(T(0)); std::array<T, MaxSize>::fill(T{});
} }
private: private:

View File

@@ -84,9 +84,13 @@ void TestConfiguration::completeTestInformation(int runMode)
return part->buildSystemTarget; return part->buildSystemTarget;
}); });
const Utils::FileName fn = Utils::FileName::fromString(m_projectFile);
const BuildTargetInfo targetInfo const BuildTargetInfo targetInfo
= Utils::findOrDefault(target->applicationTargets().list, [&buildSystemTargets] (const BuildTargetInfo &bti) { = Utils::findOrDefault(target->applicationTargets().list,
return buildSystemTargets.contains(bti.targetName); [&buildSystemTargets, &fn] (const BuildTargetInfo &bti) {
return Utils::anyOf(buildSystemTargets, [&fn, &bti](const QString &b) {
return b == bti.targetName || (b.contains(bti.targetName) && bti.projectFilePath == fn);
});
}); });
const Utils::FileName executable = targetInfo.targetFilePath; // empty if BTI is default created const Utils::FileName executable = targetInfo.targetFilePath; // empty if BTI is default created
for (RunConfiguration *runConfig : target->runConfigurations()) { for (RunConfiguration *runConfig : target->runConfigurations()) {

View File

@@ -140,8 +140,7 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
QString commandFilePath = testConfiguration->executableFilePath(); QString commandFilePath = testConfiguration->executableFilePath();
if (commandFilePath.isEmpty()) { if (commandFilePath.isEmpty()) {
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageFatal, futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
TestRunner::tr("Could not find command \"%1\". (%2)") TestRunner::tr("Executable path is empty. (%1)")
.arg(testConfiguration->executableFilePath())
.arg(testConfiguration->displayName())))); .arg(testConfiguration->displayName()))));
continue; continue;
} }

View File

@@ -29,7 +29,6 @@
#include "autotoolsbuildconfiguration.h" #include "autotoolsbuildconfiguration.h"
#include "autotoolsprojectconstants.h" #include "autotoolsprojectconstants.h"
#include "autotoolsprojectnode.h" #include "autotoolsprojectnode.h"
#include "autotoolsprojectfile.h"
#include "autotoolsopenprojectwizard.h" #include "autotoolsopenprojectwizard.h"
#include "makestep.h" #include "makestep.h"
#include "makefileparserthread.h" #include "makefileparserthread.h"
@@ -69,11 +68,11 @@ using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
AutotoolsProject::AutotoolsProject(const Utils::FileName &fileName) : AutotoolsProject::AutotoolsProject(const Utils::FileName &fileName) :
Project(Constants::MAKEFILE_MIMETYPE, fileName),
m_fileWatcher(new Utils::FileSystemWatcher(this)), m_fileWatcher(new Utils::FileSystemWatcher(this)),
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this)) m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
{ {
setId(Constants::AUTOTOOLS_PROJECT_ID); setId(Constants::AUTOTOOLS_PROJECT_ID);
setDocument(new AutotoolsProjectFile(fileName));
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT)); setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
} }

View File

@@ -1,43 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Openismus GmbH.
** Author: Peter Penz (ppenz@openismus.com)
** Author: Patricia Santana Cruz (patriciasantanacruz@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "autotoolsprojectfile.h"
#include "autotoolsproject.h"
#include "autotoolsprojectconstants.h"
namespace AutotoolsProjectManager {
namespace Internal {
AutotoolsProjectFile::AutotoolsProjectFile(const Utils::FileName &fileName)
{
setId("Autotools.ProjectFile");
setMimeType(QLatin1String(Constants::MAKEFILE_MIMETYPE));
setFilePath(fileName);
}
} // namespace Internal
} // namespace AutotoolsProjectManager

View File

@@ -1,52 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Openismus GmbH.
** Author: Peter Penz (ppenz@openismus.com)
** Author: Patricia Santana Cruz (patriciasantanacruz@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <coreplugin/idocument.h>
namespace AutotoolsProjectManager {
namespace Internal {
/**
* @brief Implementation of the Core::IDocument interface.
*
* Is used in AutotoolsProject and describes the root
* of a project. In the context of autotools the implementation
* is mostly empty, as the modification of a project is
* done by several Makefile.am files and the configure.ac file.
*
* @see AutotoolsProject
*/
class AutotoolsProjectFile : public Core::IDocument
{
public:
AutotoolsProjectFile(const Utils::FileName &fileName);
};
} // namespace Internal
} // namespace AutotoolsProjectManager

View File

@@ -2,7 +2,6 @@ include(../../qtcreatorplugin.pri)
HEADERS = autotoolsprojectplugin.h\ HEADERS = autotoolsprojectplugin.h\
autotoolsopenprojectwizard.h\ autotoolsopenprojectwizard.h\
autotoolsprojectfile.h\
autotoolsprojectnode.h\ autotoolsprojectnode.h\
autotoolsproject.h\ autotoolsproject.h\
autotoolsbuildsettingswidget.h\ autotoolsbuildsettingswidget.h\
@@ -16,7 +15,6 @@ HEADERS = autotoolsprojectplugin.h\
makefileparser.h makefileparser.h
SOURCES = autotoolsprojectplugin.cpp\ SOURCES = autotoolsprojectplugin.cpp\
autotoolsopenprojectwizard.cpp\ autotoolsopenprojectwizard.cpp\
autotoolsprojectfile.cpp\
autotoolsprojectnode.cpp\ autotoolsprojectnode.cpp\
autotoolsproject.cpp\ autotoolsproject.cpp\
autotoolsbuildsettingswidget.cpp\ autotoolsbuildsettingswidget.cpp\

View File

@@ -25,8 +25,6 @@ QtcPlugin {
"autotoolsproject.cpp", "autotoolsproject.cpp",
"autotoolsproject.h", "autotoolsproject.h",
"autotoolsprojectconstants.h", "autotoolsprojectconstants.h",
"autotoolsprojectfile.cpp",
"autotoolsprojectfile.h",
"autotoolsprojectnode.cpp", "autotoolsprojectnode.cpp",
"autotoolsprojectnode.h", "autotoolsprojectnode.h",
"autotoolsprojectplugin.cpp", "autotoolsprojectplugin.cpp",

View File

@@ -262,7 +262,7 @@ void MakeStepConfigWidget::updateDetails()
Utils::QtcProcess::addArgs(&arguments, m_makeStep->additionalArguments()); Utils::QtcProcess::addArgs(&arguments, m_makeStep->additionalArguments());
ProcessParameters param; ProcessParameters param;
param.setMacroExpander(bc->macroExpander()); param.setMacroExpander(m_makeStep->macroExpander());
param.setEnvironment(bc->environment()); param.setEnvironment(bc->environment());
param.setWorkingDirectory(bc->buildDirectory().toString()); param.setWorkingDirectory(bc->buildDirectory().toString());
param.setCommand(tcList.at(0)->makeCommand(bc->environment())); param.setCommand(tcList.at(0)->makeCommand(bc->environment()));

View File

@@ -52,7 +52,6 @@ UncrustifyOptionsPageWidget::UncrustifyOptionsPageWidget(UncrustifySettings *set
"HOME", QDir::toNativeSeparators(QDir::home().absolutePath()))); "HOME", QDir::toNativeSeparators(QDir::home().absolutePath())));
ui->uncrusifyFilePath->setExpectedKind(Utils::PathChooser::File); ui->uncrusifyFilePath->setExpectedKind(Utils::PathChooser::File);
ui->uncrusifyFilePath->setPromptDialogFilter(tr("Uncrustify file (*.cfg)")); ui->uncrusifyFilePath->setPromptDialogFilter(tr("Uncrustify file (*.cfg)"));
ui->uncrusifyFilePath->setFileName(Utils::FileName::fromString(QDir::toNativeSeparators(QDir::home().absoluteFilePath("uncrustify.cfg"))));
ui->command->setExpectedKind(Utils::PathChooser::ExistingCommand); ui->command->setExpectedKind(Utils::PathChooser::ExistingCommand);
ui->command->setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle( ui->command->setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle(

View File

@@ -133,15 +133,6 @@
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>mime</tabstop>
<tabstop>useOtherFiles</tabstop>
<tabstop>useSpecificFile</tabstop>
<tabstop>uncrusifyFilePath</tabstop>
<tabstop>useHomeFile</tabstop>
<tabstop>useCustomStyle</tabstop>
<tabstop>formatEntireFileFallback</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@@ -72,7 +72,7 @@ TextEditor::TextStyle toTextStyle(ClangBackEnd::HighlightingType type)
TextEditor::TextStyles toTextStyles(ClangBackEnd::HighlightingTypes types) TextEditor::TextStyles toTextStyles(ClangBackEnd::HighlightingTypes types)
{ {
TextEditor::TextStyles textStyles; TextEditor::TextStyles textStyles;
textStyles.mixinStyles.fillWithZero(); textStyles.mixinStyles.initializeElements();
textStyles.mainStyle = toTextStyle(types.mainHighlightingType); textStyles.mainStyle = toTextStyle(types.mainHighlightingType);

View File

@@ -73,14 +73,10 @@ using namespace Internal;
/*! /*!
\class CMakeProject \class CMakeProject
*/ */
CMakeProject::CMakeProject(const FileName &fileName) CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEMIMETYPE, fileName),
: m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this)) m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
{ {
setId(CMakeProjectManager::Constants::CMAKEPROJECT_ID); setId(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
auto doc = new TextEditor::TextDocument;
doc->setFilePath(fileName);
setDocument(doc);
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT)); setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
@@ -531,25 +527,36 @@ void CMakeProject::createGeneratedCodeModelSupport()
{ {
qDeleteAll(m_extraCompilers); qDeleteAll(m_extraCompilers);
m_extraCompilers.clear(); m_extraCompilers.clear();
QList<ExtraCompilerFactory *> factories = const QList<ExtraCompilerFactory *> factories =
ExtraCompilerFactory::extraCompilerFactories(); ExtraCompilerFactory::extraCompilerFactories();
const QSet<QString> fileExtensions
= Utils::transform<QSet>(factories, [](const ExtraCompilerFactory *f) { return f->sourceTag(); });
// Find all files generated by any of the extra compilers, in a rather crude way. // Find all files generated by any of the extra compilers, in a rather crude way.
foreach (const QString &file, files(SourceFiles)) { const QStringList fileList = files(SourceFiles, [&fileExtensions](const FileNode *fn) {
foreach (ExtraCompilerFactory *factory, factories) { const QString fp = fn->filePath().toString();
if (file.endsWith('.' + factory->sourceTag())) { const int pos = fp.lastIndexOf('.');
QStringList generated = filesGeneratedFrom(file); return pos >= 0 && fileExtensions.contains(fp.mid(pos + 1));
if (!generated.isEmpty()) {
const FileNameList fileNames = transform(generated,
[](const QString &s) {
return FileName::fromString(s);
}); });
// Generate the necessary information:
for (const QString &file : fileList) {
ExtraCompilerFactory *factory = Utils::findOrDefault(factories, [&file](const ExtraCompilerFactory *f) {
return file.endsWith('.' + f->sourceTag());
});
QTC_ASSERT(factory, continue);
QStringList generated = filesGeneratedFrom(file);
if (generated.isEmpty())
continue;
const FileNameList fileNames
= transform(generated,
[](const QString &s) { return FileName::fromString(s); });
m_extraCompilers.append(factory->create(this, FileName::fromString(file), m_extraCompilers.append(factory->create(this, FileName::fromString(file),
fileNames)); fileNames));
} }
}
}
}
CppTools::GeneratedCodeModelSupport::update(m_extraCompilers); CppTools::GeneratedCodeModelSupport::update(m_extraCompilers);
} }

View File

@@ -285,7 +285,10 @@ void ServerModeReader::generateProjectTree(CMakeProjectNode *root,
cmakeFilesSource, cmakeFilesBuild, cmakeFilesOther); cmakeFilesSource, cmakeFilesBuild, cmakeFilesOther);
QHash<Utils::FileName, ProjectNode *> cmakeListsNodes = addCMakeLists(root, cmakeLists); QHash<Utils::FileName, ProjectNode *> cmakeListsNodes = addCMakeLists(root, cmakeLists);
addProjects(cmakeListsNodes, m_projects, allFiles); QList<FileNode *> knownHeaders;
addProjects(cmakeListsNodes, m_projects, knownHeaders);
addHeaderNodes(root, knownHeaders, allFiles);
} }
void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps) void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps)
@@ -575,19 +578,12 @@ static ProjectNode *createProjectNode(const QHash<Utils::FileName, ProjectNode *
void ServerModeReader::addProjects(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes, void ServerModeReader::addProjects(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes,
const QList<Project *> &projects, const QList<Project *> &projects,
const QList<const FileNode *> &allFiles) QList<FileNode *> &knownHeaderNodes)
{ {
QHash<Utils::FileName, QList<const FileNode *>> includeFiles;
for (const FileNode *f : allFiles) {
if (f->fileType() != FileType::Header)
continue;
includeFiles[f->filePath().parentDir()].append(f);
}
for (const Project *p : projects) { for (const Project *p : projects) {
ProjectNode *pNode = createProjectNode(cmakeListsNodes, p->sourceDirectory, p->name); ProjectNode *pNode = createProjectNode(cmakeListsNodes, p->sourceDirectory, p->name);
QTC_ASSERT(pNode, qDebug() << p->sourceDirectory.toUserOutput() ; continue); QTC_ASSERT(pNode, qDebug() << p->sourceDirectory.toUserOutput() ; continue);
addTargets(cmakeListsNodes, p->targets, includeFiles); addTargets(cmakeListsNodes, p->targets, knownHeaderNodes);
} }
} }
@@ -609,15 +605,15 @@ static CMakeTargetNode *createTargetNode(const QHash<Utils::FileName, ProjectNod
return tn; return tn;
} }
void ServerModeReader::addTargets(const QHash<Utils::FileName, ProjectNode *> &cmakeListsNodes, void ServerModeReader::addTargets(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
const QList<ServerModeReader::Target *> &targets, const QList<Target *> &targets,
const QHash<FileName, QList<const FileNode *>> &headers) QList<ProjectExplorer::FileNode *> &knownHeaderNodes)
{ {
for (const Target *t : targets) { for (const Target *t : targets) {
CMakeTargetNode *tNode = createTargetNode(cmakeListsNodes, 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; continue);
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, knownHeaderNodes);
} }
} }
@@ -625,7 +621,7 @@ void ServerModeReader::addFileGroups(ProjectNode *targetRoot,
const Utils::FileName &sourceDirectory, const Utils::FileName &sourceDirectory,
const Utils::FileName &buildDirectory, const Utils::FileName &buildDirectory,
const QList<ServerModeReader::FileGroup *> &fileGroups, const QList<ServerModeReader::FileGroup *> &fileGroups,
const QHash<FileName, QList<const FileNode *>> &headers) QList<FileNode *> &knownHeaderNodes)
{ {
QList<FileNode *> toList; QList<FileNode *> toList;
QSet<Utils::FileName> alreadyListed; QSet<Utils::FileName> alreadyListed;
@@ -635,30 +631,14 @@ void ServerModeReader::addFileGroups(ProjectNode *targetRoot,
alreadyListed.insert(fn); alreadyListed.insert(fn);
return count != alreadyListed.count(); return count != alreadyListed.count();
}); });
const QList<FileNode *> newFileNodes = Utils::transform(newSources, [f](const Utils::FileName &fn) { const QList<FileNode *> newFileNodes
return new FileNode(fn, Node::fileTypeForFileName(fn), f->isGenerated); = Utils::transform(newSources, [f, &knownHeaderNodes](const Utils::FileName &fn) {
auto node = new FileNode(fn, Node::fileTypeForFileName(fn), f->isGenerated);
if (node->fileType() == FileType::Header)
knownHeaderNodes.append(node);
return node;
}); });
toList.append(newFileNodes); toList.append(newFileNodes);
// Add scanned header files:
const FileNameList headerPaths = headers.keys();
for (const IncludePath *i : f->includePaths) {
for (const FileName &hp : headerPaths) {
if (hp != i->path && hp != sourceDirectory && !hp.isChildOf(i->path))
continue;
const QList<const FileNode *> &headerFiles = headers.value(hp);
const QList<const FileNode *> unseenHeaders = Utils::filtered(headerFiles, [&alreadyListed](const FileNode *fn) {
const int count = alreadyListed.count();
alreadyListed.insert(fn->filePath());
return count != alreadyListed.count();
});
toList.append(Utils::transform(unseenHeaders, [](const FileNode *fn) {
auto copy = new FileNode(fn->filePath(), fn->fileType(), fn->isGenerated());
copy->setEnabled(false);
return copy;
}));
}
}
} }
// Split up files in groups (based on location): // Split up files in groups (based on location):
@@ -679,5 +659,29 @@ void ServerModeReader::addFileGroups(ProjectNode *targetRoot,
addCMakeVFolder(targetRoot, Utils::FileName(), 10, tr("<Other Locations>"), otherFileNodes); addCMakeVFolder(targetRoot, Utils::FileName(), 10, tr("<Other Locations>"), otherFileNodes);
} }
void ServerModeReader::addHeaderNodes(ProjectNode *root, const QList<FileNode *> knownHeaders,
const QList<const FileNode *> &allFiles)
{
auto headerNode = new VirtualFolderNode(root->filePath(), Node::DefaultPriority - 5);
headerNode->setDisplayName(tr("<Headers>"));
root->addNode(headerNode);
// knownHeaders are already listed in their targets:
QSet<Utils::FileName> seenHeaders = Utils::transform<QSet>(knownHeaders, &FileNode::filePath);
// Add scanned headers:
for (const FileNode *fn : allFiles) {
if (fn->fileType() != FileType::Header || !fn->filePath().isChildOf(root->filePath()))
continue;
const int count = seenHeaders.count();
seenHeaders.insert(fn->filePath());
if (seenHeaders.count() != count) {
auto node = new FileNode(*fn);
node->setEnabled(false);
headerNode->addNestedNode(node);
}
}
}
} // namespace Internal } // namespace Internal
} // namespace CMakeProjectManager } // namespace CMakeProjectManager

View File

@@ -117,15 +117,18 @@ private:
addCMakeLists(CMakeProjectNode *root, const QList<ProjectExplorer::FileNode *> &cmakeLists); addCMakeLists(CMakeProjectNode *root, const QList<ProjectExplorer::FileNode *> &cmakeLists);
void addProjects(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes, void addProjects(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
const QList<Project *> &projects, const QList<Project *> &projects,
const QList<const ProjectExplorer::FileNode *> &allFiles); QList<ProjectExplorer::FileNode *> &knownHeaderNodes);
void addTargets(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes, void addTargets(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
const QList<Target *> &targets, const QList<Target *> &targets,
const QHash<Utils::FileName, QList<const ProjectExplorer::FileNode *>> &headers); QList<ProjectExplorer::FileNode *> &knownHeaderNodes);
void addFileGroups(ProjectExplorer::ProjectNode *targetRoot, void addFileGroups(ProjectExplorer::ProjectNode *targetRoot,
const Utils::FileName &sourceDirectory, const Utils::FileName &sourceDirectory,
const Utils::FileName &buildDirectory, const Utils::FileName &buildDirectory, const QList<FileGroup *> &fileGroups,
const QList<FileGroup *> &fileGroups, QList<ProjectExplorer::FileNode *> &knowHeaderNodes);
const QHash<Utils::FileName, QList<const ProjectExplorer::FileNode *>> &headers);
void addHeaderNodes(ProjectExplorer::ProjectNode *root,
const QList<ProjectExplorer::FileNode *> knownHeaders,
const QList<const ProjectExplorer::FileNode *> &allFiles);
bool m_hasData = false; bool m_hasData = false;

View File

@@ -37,6 +37,7 @@ class CORE_EXPORT DiffService
public: public:
virtual ~DiffService() {} virtual ~DiffService() {}
virtual void diffFiles(const QString &leftFileName, const QString &rightFileName) = 0;
virtual void diffModifiedFiles(const QStringList &fileNames) = 0; virtual void diffModifiedFiles(const QStringList &fileNames) = 0;
}; };

View File

@@ -604,6 +604,9 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN
} }
} }
if (skipOpeningBigTextFile(fileName))
return nullptr;
IEditor *editor = 0; IEditor *editor = 0;
auto overrideCursor = Utils::OverrideCursor(QCursor(Qt::WaitCursor)); auto overrideCursor = Utils::OverrideCursor(QCursor(Qt::WaitCursor));
@@ -2618,9 +2621,6 @@ EditorManager::ExternalEditorList
IEditor *EditorManager::openEditor(const QString &fileName, Id editorId, IEditor *EditorManager::openEditor(const QString &fileName, Id editorId,
OpenEditorFlags flags, bool *newEditor) OpenEditorFlags flags, bool *newEditor)
{ {
if (EditorManagerPrivate::skipOpeningBigTextFile(fileName))
return 0;
if (flags & EditorManager::OpenInOtherSplit) if (flags & EditorManager::OpenInOtherSplit)
EditorManager::gotoOtherSplit(); EditorManager::gotoOtherSplit();
@@ -2631,9 +2631,6 @@ IEditor *EditorManager::openEditor(const QString &fileName, Id editorId,
IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int column, IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int column,
Id editorId, OpenEditorFlags flags, bool *newEditor) Id editorId, OpenEditorFlags flags, bool *newEditor)
{ {
if (EditorManagerPrivate::skipOpeningBigTextFile(fileName))
return 0;
if (flags & EditorManager::OpenInOtherSplit) if (flags & EditorManager::OpenInOtherSplit)
EditorManager::gotoOtherSplit(); EditorManager::gotoOtherSplit();

View File

@@ -36,7 +36,9 @@
using namespace CppTools::Internal; using namespace CppTools::Internal;
using namespace CppTools::Tests; using namespace CppTools::Tests;
TestProject::TestProject(const QString &name, QObject *parent) : m_name (name) TestProject::TestProject(const QString &name, QObject *parent) :
ProjectExplorer::Project("x-binary/foo", Utils::FileName()),
m_name(name)
{ {
setParent(parent); setParent(parent);
setId(Core::Id::fromString(name)); setId(Core::Id::fromString(name));

View File

@@ -138,7 +138,7 @@ static TextStyles mixinStyle(TextStyle main, TextStyle mixin)
{ {
TextStyles res; TextStyles res;
res.mainStyle = main; res.mainStyle = main;
res.mixinStyles.fillWithZero(); res.mixinStyles.initializeElements();
res.mixinStyles.push_back(mixin); res.mixinStyles.push_back(mixin);
return res; return res;
} }

View File

@@ -1210,7 +1210,7 @@ void CdbEngine::activateFrame(int index)
stackHandler()->setCurrentIndex(index); stackHandler()->setCurrentIndex(index);
gotoLocation(frame); gotoLocation(frame);
if (m_pythonVersion > 0x030000) if (m_pythonVersion > 0x030000)
runCommand({".frame " + QString::number(index), NoFlags}); runCommand({".frame 0x" + QString::number(index, 16), NoFlags});
updateLocals(); updateLocals();
} }

View File

@@ -426,6 +426,22 @@ DiffEditorServiceImpl::DiffEditorServiceImpl(QObject *parent) :
{ {
} }
void DiffEditorServiceImpl::diffFiles(const QString &leftFileName, const QString &rightFileName)
{
const QString documentId = Constants::DIFF_EDITOR_PLUGIN
+ QLatin1String(".DiffFiles.") + leftFileName + QLatin1Char('.') + rightFileName;
const QString title = tr("Diff Files");
auto const document = qobject_cast<DiffEditorDocument *>(
DiffEditorController::findOrCreateDocument(documentId, title));
if (!document)
return;
if (!DiffEditorController::controller(document))
new DiffExternalFilesController(document, leftFileName, rightFileName);
EditorManager::activateEditorForDocument(document);
document->reload();
}
void DiffEditorServiceImpl::diffModifiedFiles(const QStringList &fileNames) void DiffEditorServiceImpl::diffModifiedFiles(const QStringList &fileNames)
{ {
const QString documentId = Constants::DIFF_EDITOR_PLUGIN const QString documentId = Constants::DIFF_EDITOR_PLUGIN

View File

@@ -44,6 +44,7 @@ class DiffEditorServiceImpl : public QObject, public Core::DiffService
public: public:
explicit DiffEditorServiceImpl(QObject *parent = nullptr); explicit DiffEditorServiceImpl(QObject *parent = nullptr);
void diffFiles(const QString &leftFileName, const QString &rightFileName) override;
void diffModifiedFiles(const QStringList &fileNames) override; void diffModifiedFiles(const QStringList &fileNames) override;
}; };

View File

@@ -157,11 +157,11 @@ private:
// //
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
GenericProject::GenericProject(const Utils::FileName &fileName) GenericProject::GenericProject(const Utils::FileName &fileName) :
: m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this)) Project(Constants::GENERICMIMETYPE, fileName, [this]() { refresh(Everything); }),
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
{ {
setId(Constants::GENERICPROJECT_ID); setId(Constants::GENERICPROJECT_ID);
setDocument(new GenericProjectFile(this, fileName, GenericProject::Everything));
setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT)); setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
@@ -174,14 +174,15 @@ GenericProject::GenericProject(const Utils::FileName &fileName)
m_includesFileName = QFileInfo(dir, projectName + ".includes").absoluteFilePath(); m_includesFileName = QFileInfo(dir, projectName + ".includes").absoluteFilePath();
m_configFileName = QFileInfo(dir, projectName + ".config").absoluteFilePath(); m_configFileName = QFileInfo(dir, projectName + ".config").absoluteFilePath();
m_filesIDocument = new GenericProjectFile(this, FileName::fromString(m_filesFileName), GenericProject::Files); m_filesIDocument
m_includesIDocument = new GenericProjectFile(this, FileName::fromString(m_includesFileName), GenericProject::Configuration); = new ProjectDocument(Constants::GENERICMIMETYPE, FileName::fromString(m_filesFileName),
m_configIDocument = new GenericProjectFile(this, FileName::fromString(m_configFileName), GenericProject::Configuration); [this]() { refresh(Files); });
m_includesIDocument
DocumentManager::addDocument(document()); = new ProjectDocument(Constants::GENERICMIMETYPE, FileName::fromString(m_includesFileName),
DocumentManager::addDocument(m_filesIDocument); [this]() { refresh(Configuration); });
DocumentManager::addDocument(m_includesIDocument); m_configIDocument
DocumentManager::addDocument(m_configIDocument); = new ProjectDocument(Constants::GENERICMIMETYPE, FileName::fromString(m_configFileName),
[this]() { refresh(Configuration); });
} }
GenericProject::~GenericProject() GenericProject::~GenericProject()

View File

@@ -32,8 +32,6 @@ namespace CppTools { class CppProjectUpdater; }
namespace GenericProjectManager { namespace GenericProjectManager {
namespace Internal { namespace Internal {
class GenericProjectFile;
class GenericProject : public ProjectExplorer::Project class GenericProject : public ProjectExplorer::Project
{ {
Q_OBJECT Q_OBJECT
@@ -76,9 +74,9 @@ private:
QString m_filesFileName; QString m_filesFileName;
QString m_includesFileName; QString m_includesFileName;
QString m_configFileName; QString m_configFileName;
GenericProjectFile *m_filesIDocument; ProjectExplorer::ProjectDocument *m_filesIDocument;
GenericProjectFile *m_includesIDocument; ProjectExplorer::ProjectDocument *m_includesIDocument;
GenericProjectFile *m_configIDocument; ProjectExplorer::ProjectDocument *m_configIDocument;
QStringList m_rawFileList; QStringList m_rawFileList;
QStringList m_files; QStringList m_files;
QHash<QString, QString> m_rawListEntries; QHash<QString, QString> m_rawListEntries;

View File

@@ -52,9 +52,6 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QHelpEngine>
#include <QHelpSearchEngine>
#include <QHelpSearchQuery>
#include <QMenu> #include <QMenu>
#include <QPrinter> #include <QPrinter>
#include <QPrintDialog> #include <QPrintDialog>

View File

@@ -35,7 +35,6 @@
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QHelpEngine>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMenu> #include <QMenu>
#include <QScrollBar> #include <QScrollBar>

View File

@@ -54,12 +54,9 @@ namespace Nim {
const int MIN_TIME_BETWEEN_PROJECT_SCANS = 4500; const int MIN_TIME_BETWEEN_PROJECT_SCANS = 4500;
NimProject::NimProject(const FileName &fileName) NimProject::NimProject(const FileName &fileName) : Project(Constants::C_NIM_MIMETYPE, fileName)
{ {
setId(Constants::C_NIMPROJECT_ID); setId(Constants::C_NIMPROJECT_ID);
auto doc = new TextEditor::TextDocument;
doc->setFilePath(fileName);
setDocument(doc);
m_projectScanTimer.setSingleShot(true); m_projectScanTimer.setSingleShot(true);
connect(&m_projectScanTimer, &QTimer::timeout, this, &NimProject::collectProjectFiles); connect(&m_projectScanTimer, &QTimer::timeout, this, &NimProject::collectProjectFiles);

View File

@@ -115,6 +115,7 @@ BuildStep::BuildStep(BuildStepList *bsl, Core::Id id) :
ProjectConfiguration(bsl, id), m_enabled(true) ProjectConfiguration(bsl, id), m_enabled(true)
{ {
Q_ASSERT(bsl); Q_ASSERT(bsl);
ctor();
} }
BuildStep::BuildStep(BuildStepList *bsl, BuildStep *bs) : BuildStep::BuildStep(BuildStepList *bsl, BuildStep *bs) :
@@ -122,6 +123,15 @@ BuildStep::BuildStep(BuildStepList *bsl, BuildStep *bs) :
{ {
Q_ASSERT(bsl); Q_ASSERT(bsl);
setDisplayName(bs->displayName()); setDisplayName(bs->displayName());
ctor();
}
void BuildStep::ctor()
{
Utils::MacroExpander *expander = macroExpander();
expander->setDisplayName(tr("Build Step"));
expander->setAccumulating(true);
expander->registerSubProvider([this] { return projectConfiguration()->macroExpander(); });
} }
bool BuildStep::fromMap(const QVariantMap &map) bool BuildStep::fromMap(const QVariantMap &map)

View File

@@ -95,6 +95,8 @@ signals:
void enabledChanged(); void enabledChanged();
private: private:
void ctor();
bool m_enabled; bool m_enabled;
}; };

View File

@@ -30,6 +30,8 @@
#include "target.h" #include "target.h"
#include "kit.h" #include "kit.h"
#include <coreplugin/variablechooser.h>
#include <utils/macroexpander.h> #include <utils/macroexpander.h>
#include <QDebug> #include <QDebug>
@@ -204,6 +206,7 @@ ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step) :
connect(m_ui.commandArgumentsLineEdit, &QLineEdit::textEdited, connect(m_ui.commandArgumentsLineEdit, &QLineEdit::textEdited,
this, &ProcessStepConfigWidget::commandArgumentsLineEditTextEdited); this, &ProcessStepConfigWidget::commandArgumentsLineEditTextEdited);
Core::VariableChooser::addSupportForChildWidgets(this, m_step->macroExpander());
} }
void ProcessStepConfigWidget::updateDetails() void ProcessStepConfigWidget::updateDetails()

View File

@@ -37,6 +37,7 @@
#include "settingsaccessor.h" #include "settingsaccessor.h"
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <coreplugin/documentmanager.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/iversioncontrol.h> #include <coreplugin/iversioncontrol.h>
@@ -84,19 +85,54 @@ const char PLUGIN_SETTINGS_KEY[] = "ProjectExplorer.Project.PluginSettings";
namespace ProjectExplorer { namespace ProjectExplorer {
// --------------------------------------------------------------------
// ProjectDocument:
// --------------------------------------------------------------------
ProjectDocument::ProjectDocument(const QString &mimeType, const Utils::FileName &fileName,
const ProjectDocument::ProjectCallback &callback) :
m_callback(callback)
{
setFilePath(fileName);
setMimeType(mimeType);
if (m_callback)
Core::DocumentManager::addDocument(this);
}
Core::IDocument::ReloadBehavior
ProjectDocument::reloadBehavior(Core::IDocument::ChangeTrigger state,
Core::IDocument::ChangeType type) const
{
Q_UNUSED(state);
Q_UNUSED(type);
return BehaviorSilent;
}
bool ProjectDocument::reload(QString *errorString, Core::IDocument::ReloadFlag flag,
Core::IDocument::ChangeType type)
{
Q_UNUSED(errorString);
Q_UNUSED(flag);
Q_UNUSED(type);
if (m_callback)
m_callback();
return true;
}
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Project // Project
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
class ProjectPrivate class ProjectPrivate
{ {
public: public:
ProjectPrivate(Project *owner) : m_containerNode(owner) {} ProjectPrivate(Core::IDocument *document) : m_document(document) { }
~ProjectPrivate(); ~ProjectPrivate();
Core::Id m_id; Core::Id m_id;
Core::IDocument *m_document = nullptr; Core::IDocument *m_document = nullptr;
ProjectNode *m_rootProjectNode = nullptr; ProjectNode *m_rootProjectNode = nullptr;
ContainerNode m_containerNode; ContainerNode *m_containerNode = nullptr;
QList<Target *> m_targets; QList<Target *> m_targets;
Target *m_activeTarget = nullptr; Target *m_activeTarget = nullptr;
EditorConfiguration m_editorConfiguration; EditorConfiguration m_editorConfiguration;
@@ -118,15 +154,22 @@ ProjectPrivate::~ProjectPrivate()
m_rootProjectNode = nullptr; m_rootProjectNode = nullptr;
delete oldNode; delete oldNode;
delete m_containerNode;
delete m_document; delete m_document;
delete m_accessor; delete m_accessor;
} }
Project::Project() : d(new ProjectPrivate(this)) Project::Project(const QString &mimeType, const Utils::FileName &fileName,
const ProjectDocument::ProjectCallback &callback) :
d(new ProjectPrivate(new ProjectDocument(mimeType, fileName, callback)))
{ {
d->m_macroExpander.setDisplayName(tr("Project")); d->m_macroExpander.setDisplayName(tr("Project"));
d->m_macroExpander.registerVariable("Project:Name", tr("Project Name"), d->m_macroExpander.registerVariable("Project:Name", tr("Project Name"),
[this] { return displayName(); }); [this] { return displayName(); });
// Only set up containernode after d is set so that it will find the project directory!
d->m_containerNode = new ContainerNode(this);
} }
Project::~Project() Project::~Project()
@@ -417,13 +460,6 @@ void Project::setId(Core::Id id)
d->m_id = id; d->m_id = id;
} }
void Project::setDocument(Core::IDocument *doc)
{
QTC_ASSERT(doc, return);
QTC_ASSERT(!d->m_document, return);
d->m_document = doc;
}
void Project::setRootProjectNode(ProjectNode *root) void Project::setRootProjectNode(ProjectNode *root)
{ {
if (d->m_rootProjectNode == root) if (d->m_rootProjectNode == root)
@@ -442,7 +478,7 @@ void Project::setRootProjectNode(ProjectNode *root)
ProjectNode *oldNode = d->m_rootProjectNode; ProjectNode *oldNode = d->m_rootProjectNode;
d->m_rootProjectNode = root; d->m_rootProjectNode = root;
if (root) if (root)
root->setParentFolderNode(&d->m_containerNode); root->setParentFolderNode(d->m_containerNode);
ProjectTree::emitSubtreeChanged(root); ProjectTree::emitSubtreeChanged(root);
emit fileListChanged(); emit fileListChanged();
@@ -571,7 +607,7 @@ ProjectNode *Project::rootProjectNode() const
ContainerNode *Project::containerNode() const ContainerNode *Project::containerNode() const
{ {
return &d->m_containerNode; return d->m_containerNode;
} }
Project::RestoreResult Project::fromMap(const QVariantMap &map, QString *errorMessage) Project::RestoreResult Project::fromMap(const QVariantMap &map, QString *errorMessage)

View File

@@ -30,6 +30,7 @@
#include "kit.h" #include "kit.h"
#include <coreplugin/id.h> #include <coreplugin/id.h>
#include <coreplugin/idocument.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
@@ -38,11 +39,7 @@
#include <functional> #include <functional>
namespace Core { namespace Core { class Context; }
class IDocument;
class Context;
}
namespace Utils { class MacroExpander; } namespace Utils { class MacroExpander; }
namespace ProjectExplorer { namespace ProjectExplorer {
@@ -58,6 +55,24 @@ class ProjectPrivate;
class Session; class Session;
class Target; class Target;
// Auto-registers with the DocumentManager if a callback is set!
class PROJECTEXPLORER_EXPORT ProjectDocument : public Core::IDocument
{
public:
using ProjectCallback = std::function<void()>;
ProjectDocument(const QString &mimeType, const Utils::FileName &fileName,
const ProjectCallback &callback = {});
Core::IDocument::ReloadBehavior reloadBehavior(Core::IDocument::ChangeTrigger state,
Core::IDocument::ChangeType type) const final;
bool reload(QString *errorString, Core::IDocument::ReloadFlag flag,
Core::IDocument::ChangeType type) final;
private:
ProjectCallback m_callback;
};
// Documentation inside. // Documentation inside.
class PROJECTEXPLORER_EXPORT Project : public QObject class PROJECTEXPLORER_EXPORT Project : public QObject
{ {
@@ -73,7 +88,8 @@ public:
EnabledRole EnabledRole
}; };
Project(); Project(const QString &mimeType, const Utils::FileName &fileName,
const ProjectDocument::ProjectCallback &callback = {});
~Project() override; ~Project() override;
virtual QString displayName() const = 0; virtual QString displayName() const = 0;
@@ -116,7 +132,7 @@ public:
GeneratedFiles = 0x2, GeneratedFiles = 0x2,
AllFiles = SourceFiles | GeneratedFiles AllFiles = SourceFiles | GeneratedFiles
}; };
virtual QStringList files(FilesMode fileMode, QStringList files(FilesMode fileMode,
const std::function<bool(const FileNode *)> &filter = {}) const; const std::function<bool(const FileNode *)> &filter = {}) const;
virtual QStringList filesGeneratedFrom(const QString &sourceFile) const; virtual QStringList filesGeneratedFrom(const QString &sourceFile) const;
@@ -178,7 +194,6 @@ protected:
void setPreferredKitPredicate(const Kit::Predicate &predicate); void setPreferredKitPredicate(const Kit::Predicate &predicate);
void setId(Core::Id id); void setId(Core::Id id);
void setDocument(Core::IDocument *doc); // takes ownership!
void setRootProjectNode(ProjectNode *root); // takes ownership! void setRootProjectNode(ProjectNode *root); // takes ownership!
void setProjectContext(Core::Context context); void setProjectContext(Core::Context context);
void setProjectLanguages(Core::Context language); void setProjectLanguages(Core::Context language);

View File

@@ -115,7 +115,10 @@
#include <coreplugin/iversioncontrol.h> #include <coreplugin/iversioncontrol.h>
#include <coreplugin/fileutils.h> #include <coreplugin/fileutils.h>
#include <coreplugin/removefiledialog.h> #include <coreplugin/removefiledialog.h>
#include <coreplugin/diffservice.h>
#include <texteditor/findinfiles.h> #include <texteditor/findinfiles.h>
#include <texteditor/textdocument.h>
#include <texteditor/texteditorconstants.h>
#include <ssh/sshconnection.h> #include <ssh/sshconnection.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
@@ -211,6 +214,7 @@ const char REMOVEFILE[] = "ProjectExplorer.RemoveFile";
const char DUPLICATEFILE[] = "ProjectExplorer.DuplicateFile"; const char DUPLICATEFILE[] = "ProjectExplorer.DuplicateFile";
const char DELETEFILE[] = "ProjectExplorer.DeleteFile"; const char DELETEFILE[] = "ProjectExplorer.DeleteFile";
const char RENAMEFILE[] = "ProjectExplorer.RenameFile"; const char RENAMEFILE[] = "ProjectExplorer.RenameFile";
const char DIFFFILE[] = "ProjectExplorer.DiffFile";
const char SETSTARTUP[] = "ProjectExplorer.SetStartup"; const char SETSTARTUP[] = "ProjectExplorer.SetStartup";
const char PROJECTTREE_COLLAPSE_ALL[] = "ProjectExplorer.CollapseAll"; const char PROJECTTREE_COLLAPSE_ALL[] = "ProjectExplorer.CollapseAll";
@@ -255,6 +259,17 @@ static Kit *currentKit()
return target ? target->kit() : nullptr; return target ? target->kit() : nullptr;
} }
static bool isTextFile(const QString &fileName)
{
return Utils::mimeTypeForFile(fileName).inherits(
TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT);
}
static bool isDiffServiceAvailable()
{
return ExtensionSystem::PluginManager::getObject<DiffService>();
}
class ProjectExplorerPluginPrivate : public QObject class ProjectExplorerPluginPrivate : public QObject
{ {
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::ProjectExplorerPlugin) Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::ProjectExplorerPlugin)
@@ -303,6 +318,7 @@ public:
void duplicateFile(); void duplicateFile();
void deleteFile(); void deleteFile();
void handleRenameFile(); void handleRenameFile();
void handleDiffFile();
void handleSetStartupProject(); void handleSetStartupProject();
void setStartupProject(ProjectExplorer::Project *project); void setStartupProject(ProjectExplorer::Project *project);
@@ -375,6 +391,7 @@ public:
QAction *m_removeProjectAction; QAction *m_removeProjectAction;
QAction *m_deleteFileAction; QAction *m_deleteFileAction;
QAction *m_renameFileAction; QAction *m_renameFileAction;
QAction *m_diffFileAction;
QAction *m_openFileAction; QAction *m_openFileAction;
QAction *m_projectTreeCollapseAllAction; QAction *m_projectTreeCollapseAllAction;
QAction *m_searchOnFileSystem; QAction *m_searchOnFileSystem;
@@ -1063,6 +1080,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
cmd = ActionManager::registerAction(dd->m_renameFileAction, Constants::RENAMEFILE, cmd = ActionManager::registerAction(dd->m_renameFileAction, Constants::RENAMEFILE,
projecTreeContext); projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
// diff file action
dd->m_diffFileAction = new QAction(tr("Diff Against Current File"), this);
cmd = ActionManager::registerAction(dd->m_diffFileAction, Constants::DIFFFILE, projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
// Not yet used by anyone, so hide for now // Not yet used by anyone, so hide for now
// mfolder->addAction(cmd, Constants::G_FOLDER_FILES); // mfolder->addAction(cmd, Constants::G_FOLDER_FILES);
// msubProject->addAction(cmd, Constants::G_FOLDER_FILES); // msubProject->addAction(cmd, Constants::G_FOLDER_FILES);
@@ -1302,6 +1325,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
dd, &ProjectExplorerPluginPrivate::deleteFile); dd, &ProjectExplorerPluginPrivate::deleteFile);
connect(dd->m_renameFileAction, &QAction::triggered, connect(dd->m_renameFileAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleRenameFile); dd, &ProjectExplorerPluginPrivate::handleRenameFile);
connect(dd->m_diffFileAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleDiffFile);
connect(dd->m_setStartupProjectAction, &QAction::triggered, connect(dd->m_setStartupProjectAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::handleSetStartupProject); dd, &ProjectExplorerPluginPrivate::handleSetStartupProject);
connect(dd->m_projectTreeCollapseAllAction, &QAction::triggered, connect(dd->m_projectTreeCollapseAllAction, &QAction::triggered,
@@ -2097,7 +2122,7 @@ static QString pathOrDirectoryFor(Node *node, bool dir)
while ((!fi.exists() || !fi.isDir()) && !fi.isRoot()) while ((!fi.exists() || !fi.isDir()) && !fi.isRoot())
fi.setFile(fi.absolutePath()); fi.setFile(fi.absolutePath());
location = fi.absoluteFilePath(); location = fi.absoluteFilePath();
} else { } else if (!path.isEmpty()) {
QFileInfo fi = path.toFileInfo(); QFileInfo fi = path.toFileInfo();
// remove any /suffixes, which e.g. ResourceNode uses // remove any /suffixes, which e.g. ResourceNode uses
// Note this should be removed again by making node->path() a true path again // Note this should be removed again by making node->path() a true path again
@@ -2884,6 +2909,7 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
m_duplicateFileAction->setEnabled(false); m_duplicateFileAction->setEnabled(false);
m_deleteFileAction->setEnabled(false); m_deleteFileAction->setEnabled(false);
m_renameFileAction->setEnabled(false); m_renameFileAction->setEnabled(false);
m_diffFileAction->setEnabled(false);
m_addExistingFilesAction->setVisible(true); m_addExistingFilesAction->setVisible(true);
m_addExistingDirectoryAction->setVisible(true); m_addExistingDirectoryAction->setVisible(true);
@@ -2894,6 +2920,7 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
m_duplicateFileAction->setVisible(false); m_duplicateFileAction->setVisible(false);
m_deleteFileAction->setVisible(true); m_deleteFileAction->setVisible(true);
m_runActionContextMenu->setVisible(false); m_runActionContextMenu->setVisible(false);
m_diffFileAction->setVisible(isDiffServiceAvailable());
m_openTerminalHere->setVisible(true); m_openTerminalHere->setVisible(true);
m_showInGraphicalShell->setVisible(true); m_showInGraphicalShell->setVisible(true);
@@ -2961,6 +2988,10 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
m_removeFileAction->setVisible(!enableDelete || enableRemove); m_removeFileAction->setVisible(!enableDelete || enableRemove);
m_renameFileAction->setEnabled(actions.contains(Rename)); m_renameFileAction->setEnabled(actions.contains(Rename));
const bool currentNodeIsTextFile = isTextFile(
ProjectTree::currentNode()->filePath().toString());
m_diffFileAction->setEnabled(isDiffServiceAvailable()
&& currentNodeIsTextFile && TextEditor::TextDocument::currentTextDocument());
m_duplicateFileAction->setVisible(actions.contains(DuplicateFile)); m_duplicateFileAction->setVisible(actions.contains(DuplicateFile));
m_duplicateFileAction->setEnabled(actions.contains(DuplicateFile)); m_duplicateFileAction->setEnabled(actions.contains(DuplicateFile));
@@ -3244,6 +3275,39 @@ void ProjectExplorerPluginPrivate::handleRenameFile()
} }
} }
void ProjectExplorerPluginPrivate::handleDiffFile()
{
// current editor's file
auto textDocument = TextEditor::TextDocument::currentTextDocument();
if (!textDocument)
return;
const QString leftFileName = textDocument->filePath().toString();
if (leftFileName.isEmpty())
return;
// current item's file
Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode && currentNode->nodeType() == NodeType::File, return);
FileNode *fileNode = currentNode->asFileNode();
if (!fileNode)
return;
const QString rightFileName = currentNode->filePath().toString();
if (rightFileName.isEmpty())
return;
if (!isTextFile(rightFileName))
return;
if (auto diffService = ExtensionSystem::PluginManager::getObject<DiffService>())
diffService->diffFiles(leftFileName, rightFileName);
}
void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath) void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath)
{ {
const QString oldFilePath = node->filePath().toFileInfo().absoluteFilePath(); const QString oldFilePath = node->filePath().toFileInfo().absoluteFilePath();

View File

@@ -266,7 +266,8 @@ FileType Node::fileTypeForMimeType(const Utils::MimeType &mt)
FileType Node::fileTypeForFileName(const Utils::FileName &file) FileType Node::fileTypeForFileName(const Utils::FileName &file)
{ {
return fileTypeForMimeType(Utils::mimeTypeForFile(file.toString())); return fileTypeForMimeType(Utils::mimeTypeForFile(file.toString(),
Utils::MimeMatchMode::MatchExtension));
} }
/*! /*!
@@ -793,7 +794,7 @@ bool FolderNode::isEmpty() const
} }
ContainerNode::ContainerNode(Project *project) ContainerNode::ContainerNode(Project *project)
: FolderNode(Utils::FileName(), NodeType::Project), m_project(project) : FolderNode(project->projectDirectory(), NodeType::Project), m_project(project)
{} {}
QString ContainerNode::displayName() const QString ContainerNode::displayName() const

View File

@@ -116,37 +116,6 @@ private:
QHash<QString, QString> m_rawListEntries; QHash<QString, QString> m_rawListEntries;
}; };
class PythonProjectFile : public Core::IDocument
{
public:
PythonProjectFile(PythonProject *parent, const FileName &fileName) : m_project(parent)
{
setId("Generic.ProjectFile");
setMimeType(PythonMimeType);
setFilePath(fileName);
}
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override
{
Q_UNUSED(state)
Q_UNUSED(type)
return BehaviorSilent;
}
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override
{
Q_UNUSED(errorString)
Q_UNUSED(flag)
if (type == TypePermissions)
return true;
m_project->refresh();
return true;
}
private:
PythonProject *m_project;
};
class PythonProjectNode : public ProjectNode class PythonProjectNode : public ProjectNode
{ {
public: public:
@@ -406,12 +375,10 @@ private:
} }
}; };
PythonProject::PythonProject(const FileName &fileName) PythonProject::PythonProject(const FileName &fileName) :
Project(Constants::C_PY_MIMETYPE, fileName, [this]() { refresh(); })
{ {
setId(PythonProjectId); setId(PythonProjectId);
setDocument(new PythonProjectFile(this, fileName));
DocumentManager::addDocument(document());
setProjectContext(Context(PythonProjectContext)); setProjectContext(Context(PythonProjectContext));
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
} }

View File

@@ -28,7 +28,6 @@
#include "qbsbuildconfiguration.h" #include "qbsbuildconfiguration.h"
#include "qbslogsink.h" #include "qbslogsink.h"
#include "qbspmlogging.h" #include "qbspmlogging.h"
#include "qbsprojectfile.h"
#include "qbsprojectparser.h" #include "qbsprojectparser.h"
#include "qbsprojectmanagerconstants.h" #include "qbsprojectmanagerconstants.h"
#include "qbsnodes.h" #include "qbsnodes.h"
@@ -117,6 +116,7 @@ private:
// -------------------------------------------------------------------- // --------------------------------------------------------------------
QbsProject::QbsProject(const FileName &fileName) : QbsProject::QbsProject(const FileName &fileName) :
Project(Constants::MIME_TYPE, fileName, [this]() { delayParsing(); }),
m_qbsProjectParser(0), m_qbsProjectParser(0),
m_qbsUpdateFutureInterface(0), m_qbsUpdateFutureInterface(0),
m_parsingScheduled(false), m_parsingScheduled(false),
@@ -128,8 +128,6 @@ QbsProject::QbsProject(const FileName &fileName) :
m_parsingDelay.setInterval(1000); // delay parsing by 1s. m_parsingDelay.setInterval(1000); // delay parsing by 1s.
setId(Constants::PROJECT_ID); setId(Constants::PROJECT_ID);
setDocument(new QbsProjectFile(this, fileName));
DocumentManager::addDocument(document());
setProjectContext(Context(Constants::PROJECT_ID)); setProjectContext(Context(Constants::PROJECT_ID));
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
@@ -710,9 +708,9 @@ void QbsProject::updateDocuments(const QSet<QString> &files)
} }
QSet<IDocument *> toAdd; QSet<IDocument *> toAdd;
foreach (const QString &f, filesToAdd) foreach (const QString &f, filesToAdd)
toAdd.insert(new QbsProjectFile(this, FileName::fromString(f))); toAdd.insert(new ProjectDocument(Constants::MIME_TYPE, FileName::fromString(f),
[this]() { delayParsing(); }));
DocumentManager::addDocuments(toAdd.toList());
m_qbsDocuments.unite(toAdd); m_qbsDocuments.unite(toAdd);
} }

View File

@@ -1,61 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "qbsprojectfile.h"
#include "qbsproject.h"
#include "qbsprojectmanagerconstants.h"
namespace QbsProjectManager {
namespace Internal {
QbsProjectFile::QbsProjectFile(QbsProject *parent, const Utils::FileName &fileName) : Core::IDocument(parent),
m_project(parent)
{
setId("Qbs.ProjectFile");
setMimeType(Constants::MIME_TYPE);
setFilePath(fileName);
}
Core::IDocument::ReloadBehavior QbsProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
{
Q_UNUSED(state);
Q_UNUSED(type);
return BehaviorSilent;
}
bool QbsProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
{
Q_UNUSED(errorString)
Q_UNUSED(flag)
if (type == TypePermissions)
return true;
m_project->delayParsing();
return true;
}
} // namespace Internal
} // namespace QbsProjectManager

View File

@@ -1,48 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <coreplugin/idocument.h>
namespace QbsProjectManager {
namespace Internal {
class QbsProject;
class QbsProjectFile : public Core::IDocument
{
public:
QbsProjectFile(QbsProject *parent, const Utils::FileName &fileName);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
private:
QbsProject *m_project;
};
} // namespace Internal
} // namespace QbsProjectManager

View File

@@ -34,7 +34,6 @@ HEADERS = \
qbspmlogging.h \ qbspmlogging.h \
qbsprofilessettingspage.h \ qbsprofilessettingspage.h \
qbsproject.h \ qbsproject.h \
qbsprojectfile.h \
qbsprojectmanager.h \ qbsprojectmanager.h \
qbsprojectmanager_global.h \ qbsprojectmanager_global.h \
qbsprojectmanagerconstants.h \ qbsprojectmanagerconstants.h \
@@ -59,7 +58,6 @@ SOURCES = \
qbspmlogging.cpp \ qbspmlogging.cpp \
qbsprofilessettingspage.cpp \ qbsprofilessettingspage.cpp \
qbsproject.cpp \ qbsproject.cpp \
qbsprojectfile.cpp \
qbsprojectmanager.cpp \ qbsprojectmanager.cpp \
qbsprojectmanagerplugin.cpp \ qbsprojectmanagerplugin.cpp \
qbsprojectmanagersettings.cpp \ qbsprojectmanagersettings.cpp \

View File

@@ -94,8 +94,6 @@ QtcPlugin {
"qbsprofilessettingswidget.ui", "qbsprofilessettingswidget.ui",
"qbsproject.cpp", "qbsproject.cpp",
"qbsproject.h", "qbsproject.h",
"qbsprojectfile.cpp",
"qbsprojectfile.h",
"qbsprojectmanager.cpp", "qbsprojectmanager.cpp",
"qbsprojectmanager.h", "qbsprojectmanager.h",
"qbsprojectmanager.qrc", "qbsprojectmanager.qrc",

View File

@@ -32,6 +32,7 @@
#include "qmakebuildconfiguration.h" #include "qmakebuildconfiguration.h"
#include "qmakeprojectmanagerconstants.h" #include "qmakeprojectmanagerconstants.h"
#include <coreplugin/variablechooser.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
@@ -357,6 +358,8 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged, connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
this, &MakeStepConfigWidget::updateDetails); this, &MakeStepConfigWidget::updateDetails);
connect(m_makeStep->target(), &Target::kitChanged, this, &MakeStepConfigWidget::updateDetails); connect(m_makeStep->target(), &Target::kitChanged, this, &MakeStepConfigWidget::updateDetails);
Core::VariableChooser::addSupportForChildWidgets(this, m_makeStep->macroExpander());
} }
void MakeStepConfigWidget::activeBuildConfigurationChanged() void MakeStepConfigWidget::activeBuildConfigurationChanged()

View File

@@ -218,15 +218,6 @@ QSet<FileName> QmakePriFile::files(const FileType &type) const
return m_files.value(type); return m_files.value(type);
} }
bool QmakePriFile::buildsFile(const FileName &fn) const
{
for (auto it = m_files.constBegin(); it != m_files.constEnd(); ++it) {
if (it.value().contains(fn))
return true;
}
return false;
}
QmakePriFile::~QmakePriFile() QmakePriFile::~QmakePriFile()
{ {
watchFolders( {} ); watchFolders( {} );

View File

@@ -127,7 +127,6 @@ public:
void makeEmpty(); void makeEmpty();
QSet<Utils::FileName> files(const ProjectExplorer::FileType &type) const; QSet<Utils::FileName> files(const ProjectExplorer::FileType &type) const;
bool buildsFile(const Utils::FileName &fn) const;
void update(const Internal::QmakePriFileEvalResult &result); void update(const Internal::QmakePriFileEvalResult &result);

View File

@@ -74,15 +74,6 @@ using namespace Utils;
namespace QmakeProjectManager { namespace QmakeProjectManager {
namespace Internal { namespace Internal {
class QmakeProjectFile : public Core::IDocument
{
public:
explicit QmakeProjectFile(const FileName &fileName);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
};
/// Watches folders for QmakePriFile nodes /// Watches folders for QmakePriFile nodes
/// use one file system watcher to watch all folders /// use one file system watcher to watch all folders
/// such minimizing system ressouce usage /// such minimizing system ressouce usage
@@ -156,30 +147,6 @@ QDebug operator<<(QDebug d, const QmakeProjectFiles &f)
return d; return d;
} }
// ----------- QmakeProjectFile
QmakeProjectFile::QmakeProjectFile(const FileName &fileName)
{
setId("Qmake.ProFile");
setMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
setFilePath(fileName);
}
Core::IDocument::ReloadBehavior QmakeProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
{
Q_UNUSED(state)
Q_UNUSED(type)
return BehaviorSilent;
}
bool QmakeProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
{
Q_UNUSED(errorString)
Q_UNUSED(flag)
Q_UNUSED(type)
return true;
}
static QList<QmakeProject *> s_projects; static QList<QmakeProject *> s_projects;
} // namespace Internal } // namespace Internal
@@ -191,12 +158,12 @@ static QList<QmakeProject *> s_projects;
*/ */
QmakeProject::QmakeProject(const FileName &fileName) : QmakeProject::QmakeProject(const FileName &fileName) :
Project(QmakeProjectManager::Constants::PROFILE_MIMETYPE, fileName),
m_qmakeVfs(new QMakeVfs), m_qmakeVfs(new QMakeVfs),
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this)) m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
{ {
s_projects.append(this); s_projects.append(this);
setId(Constants::QMAKEPROJECT_ID); setId(Constants::QMAKEPROJECT_ID);
setDocument(new QmakeProjectFile(fileName));
setProjectContext(Core::Context(QmakeProjectManager::Constants::PROJECT_ID)); setProjectContext(Core::Context(QmakeProjectManager::Constants::PROJECT_ID));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
setRequiredKitPredicate(QtSupport::QtKitInformation::qtVersionPredicate()); setRequiredKitPredicate(QtSupport::QtKitInformation::qtVersionPredicate());
@@ -1309,7 +1276,7 @@ void QmakeProject::testToolChain(ToolChain *tc, const Utils::FileName &path) con
t->kit()->addToEnvironment(env); t->kit()->addToEnvironment(env);
} }
if (env.isSameExecutable(path.toString(), expected.toString())) { 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,
@@ -1345,9 +1312,9 @@ QString QmakeProject::executableFor(const QmakeProFile *file)
TargetInformation ti = file->targetInformation(); TargetInformation ti = file->targetInformation();
QString target; QString target;
if (tc->targetAbi().os() == Abi::DarwinOS) { if (tc->targetAbi().os() == Abi::DarwinOS
if (file->variableValue(Variable::Config).contains(QLatin1String("app_bundle"))) && file->variableValue(Variable::Config).contains("app_bundle")) {
target = ti.target + QLatin1String(".app/Contents/MacOS/") + ti.target; target = ti.target + ".app/Contents/MacOS/" + ti.target;
} else { } else {
QString extension = file->singleVariableValue(Variable::TargetExt); QString extension = file->singleVariableValue(Variable::TargetExt);
target = ti.target + extension; target = ti.target + extension;

View File

@@ -43,6 +43,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <coreplugin/variablechooser.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtversionmanager.h> #include <qtsupport/qtversionmanager.h>
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>
@@ -634,6 +635,9 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
connect(step->target(), &Target::kitChanged, this, &QMakeStepConfigWidget::qtVersionChanged); connect(step->target(), &Target::kitChanged, this, &QMakeStepConfigWidget::qtVersionChanged);
connect(QtVersionManager::instance(), &QtVersionManager::dumpUpdatedFor, connect(QtVersionManager::instance(), &QtVersionManager::dumpUpdatedFor,
this, &QMakeStepConfigWidget::qtVersionChanged); this, &QMakeStepConfigWidget::qtVersionChanged);
auto chooser = new Core::VariableChooser(m_ui->qmakeAdditonalArgumentsLineEdit);
chooser->addMacroExpanderProvider([step] { return step->macroExpander(); });
chooser->addSupportedWidget(m_ui->qmakeAdditonalArgumentsLineEdit);
} }
QMakeStepConfigWidget::~QMakeStepConfigWidget() QMakeStepConfigWidget::~QMakeStepConfigWidget()

View File

@@ -208,11 +208,8 @@ QString QmlObjectNode::stripedTranslatableText(const PropertyName &name) const
if (regularExpressionPatter.exactMatch(modelNode().bindingProperty(name).expression())) if (regularExpressionPatter.exactMatch(modelNode().bindingProperty(name).expression()))
return regularExpressionPatter.cap(2); return regularExpressionPatter.cap(2);
return instanceValue(name).toString(); return instanceValue(name).toString();
} else {
return modelNode().variantProperty(name).value().toString();
} }
return modelNode().variantProperty(name).value().toString();
return QString();
} }
QString QmlObjectNode::expression(const PropertyName &name) const QString QmlObjectNode::expression(const PropertyName &name) const

View File

@@ -199,7 +199,7 @@ void DesignModeWidget::enableWidgets()
{ {
if (debug) if (debug)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
hideWarningWidget();
viewManager().enableWidgets(); viewManager().enableWidgets();
m_isDisabled = false; m_isDisabled = false;
} }
@@ -221,20 +221,6 @@ void DesignModeWidget::switchTextOrForm()
m_centralTabWidget->switchTo(viewManager().widget("TextEditor")); m_centralTabWidget->switchTo(viewManager().widget("TextEditor"));
} }
void DesignModeWidget::showWarningMessageBox(const QList<DocumentMessage> &warnings)
{
Q_ASSERT(!warnings.isEmpty());
warningWidget()->setWarnings(warnings);
warningWidget()->setVisible(true);
}
bool DesignModeWidget::gotoCodeWasClicked()
{
if (m_warningWidget)
return warningWidget()->gotoCodeWasClicked();
return false;
}
static void hideToolButtons(QList<QToolButton*> &buttons) static void hideToolButtons(QList<QToolButton*> &buttons)
{ {
foreach (QToolButton *button, buttons) foreach (QToolButton *button, buttons)
@@ -528,28 +514,6 @@ QWidget *DesignModeWidget::createCrumbleBarFrame()
return frame; return frame;
} }
DocumentWarningWidget *DesignModeWidget::warningWidget()
{
if (m_warningWidget.isNull()) {
m_warningWidget = new DocumentWarningWidget(this);
connect(m_warningWidget.data(), &DocumentWarningWidget::gotoCodeClicked, [=]
(const QString &filePath, int codeLine, int codeColumn) {
Q_UNUSED(filePath);
if (currentDesignDocument() && currentDesignDocument()->textEditor())
currentDesignDocument()->textEditor()->gotoLine(codeLine, codeColumn);
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
});
}
return m_warningWidget;
}
void DesignModeWidget::hideWarningWidget()
{
if (m_warningWidget)
m_warningWidget->setVisible(false);
}
CrumbleBar *DesignModeWidget::crumbleBar() const CrumbleBar *DesignModeWidget::crumbleBar() const
{ {
return m_crumbleBar; return m_crumbleBar;

View File

@@ -78,9 +78,6 @@ public:
void disableWidgets(); void disableWidgets();
void switchTextOrForm(); void switchTextOrForm();
void showWarningMessageBox(const QList<DocumentMessage> &warnings);
bool gotoCodeWasClicked();
CrumbleBar* crumbleBar() const; CrumbleBar* crumbleBar() const;
void showInternalTextEditor(); void showInternalTextEditor();
@@ -100,12 +97,9 @@ private: // functions
void addNavigatorHistoryEntry(const Utils::FileName &fileName); void addNavigatorHistoryEntry(const Utils::FileName &fileName);
QWidget *createCenterWidget(); QWidget *createCenterWidget();
QWidget *createCrumbleBarFrame(); QWidget *createCrumbleBarFrame();
DocumentWarningWidget *warningWidget();
void hideWarningWidget();
private: // variables private: // variables
QSplitter *m_mainSplitter = nullptr; QSplitter *m_mainSplitter = nullptr;
QPointer<DocumentWarningWidget> m_warningWidget;
SwitchSplitTabWidget* m_centralTabWidget = nullptr; SwitchSplitTabWidget* m_centralTabWidget = nullptr;
QScopedPointer<Core::SideBar> m_leftSideBar; QScopedPointer<Core::SideBar> m_leftSideBar;

View File

@@ -138,11 +138,6 @@ static bool warningsForQmlFilesInsteadOfUiQmlEnabled()
return DesignerSettings::getValue(DesignerSettingsKey::WARNING_FOR_QML_FILES_INSTEAD_OF_UIQML_FILES).toBool(); return DesignerSettings::getValue(DesignerSettingsKey::WARNING_FOR_QML_FILES_INSTEAD_OF_UIQML_FILES).toBool();
} }
static bool showWarningsForFeaturesInDesigner()
{
return DesignerSettings::getValue(DesignerSettingsKey::WARNING_FOR_FEATURES_IN_DESIGNER).toBool();
}
QmlDesignerPlugin::QmlDesignerPlugin() QmlDesignerPlugin::QmlDesignerPlugin()
{ {
m_instance = this; m_instance = this;
@@ -329,13 +324,7 @@ void QmlDesignerPlugin::showDesigner()
void QmlDesignerPlugin::hideDesigner() void QmlDesignerPlugin::hideDesigner()
{ {
if (currentDesignDocument() && currentModel()) {
// the message box handle the cursor jump itself
}
if (d->documentManager.hasCurrentDesignDocument()) { if (d->documentManager.hasCurrentDesignDocument()) {
if (currentModel() && !mainWidget()->gotoCodeWasClicked())
jumpTextCursorToSelectedModelNode();
deactivateAutoSynchronization(); deactivateAutoSynchronization();
d->mainWidget->saveSettings(); d->mainWidget->saveSettings();
} }
@@ -417,8 +406,6 @@ void QmlDesignerPlugin::activateAutoSynchronization()
selectModelNodeUnderTextCursor(); selectModelNodeUnderTextCursor();
d->mainWidget->setupNavigatorHistory(currentDesignDocument()->textEditor()); d->mainWidget->setupNavigatorHistory(currentDesignDocument()->textEditor());
if (showWarningsForFeaturesInDesigner() && currentDesignDocument()->hasQmlParseWarnings())
d->mainWidget->showWarningMessageBox(currentDesignDocument()->qmlParseWarnings());
currentDesignDocument()->updateSubcomponentManager(); currentDesignDocument()->updateSubcomponentManager();
} }

View File

@@ -511,7 +511,6 @@ void QmlProfilerModelManager::processingDone()
++d->numFinishedFinalizers; ++d->numFinishedFinalizers;
} }
d->notesModel->loadData();
setState(Done); setState(Done);
} }

View File

@@ -108,6 +108,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
case QmlProfilerModelManager::Empty: case QmlProfilerModelManager::Empty:
d->m_modelProxy->setModels(d->m_suspendedModels); d->m_modelProxy->setModels(d->m_suspendedModels);
d->m_suspendedModels.clear(); d->m_suspendedModels.clear();
d->m_modelManager->notesModel()->loadData();
break; break;
case QmlProfilerModelManager::ProcessingData: case QmlProfilerModelManager::ProcessingData:
break; break;

View File

@@ -24,7 +24,6 @@
****************************************************************************/ ****************************************************************************/
#include "qmlproject.h" #include "qmlproject.h"
#include "qmlprojectfile.h"
#include "fileformat/qmlprojectfileformat.h" #include "fileformat/qmlprojectfileformat.h"
#include "fileformat/qmlprojectitem.h" #include "fileformat/qmlprojectitem.h"
#include "qmlprojectrunconfiguration.h" #include "qmlprojectrunconfiguration.h"
@@ -56,12 +55,10 @@ using namespace ProjectExplorer;
namespace QmlProjectManager { namespace QmlProjectManager {
QmlProject::QmlProject(const Utils::FileName &fileName) : QmlProject::QmlProject(const Utils::FileName &fileName) :
Project(QString::fromLatin1(Constants::QMLPROJECT_MIMETYPE), fileName, [this]() { refreshProjectFile(); }),
m_defaultImport(UnknownImport) m_defaultImport(UnknownImport)
{ {
setId("QmlProjectManager.QmlProject"); setId("QmlProjectManager.QmlProject");
setDocument(new Internal::QmlProjectFile(this, fileName));
DocumentManager::addDocument(document(), true);
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT)); setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Context(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID)); setProjectLanguages(Context(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID));
} }

View File

@@ -1,63 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "qmlprojectfile.h"
#include "qmlproject.h"
#include "qmlprojectconstants.h"
#include <utils/qtcassert.h>
namespace QmlProjectManager {
namespace Internal {
QmlProjectFile::QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName) :
m_project(parent)
{
QTC_CHECK(m_project);
QTC_CHECK(!fileName.isEmpty());
setId("Qml.ProjectFile");
setMimeType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
setFilePath(fileName);
}
Core::IDocument::ReloadBehavior QmlProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
{
Q_UNUSED(state)
Q_UNUSED(type)
return BehaviorSilent;
}
bool QmlProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
{
Q_UNUSED(errorString)
Q_UNUSED(flag)
if (type == TypeContents)
m_project->refreshProjectFile();
return true;
}
} // namespace Internal
} // namespace QmlProjectManager

View File

@@ -1,49 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <coreplugin/idocument.h>
namespace QmlProjectManager {
class QmlProject;
namespace Internal {
class QmlProjectFile : public Core::IDocument
{
public:
QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
private:
QmlProject *m_project;
};
} // namespace Internal
} // namespace QmlProjectManager

View File

@@ -9,7 +9,6 @@ HEADERS += qmlproject.h \
qmlprojectplugin.h \ qmlprojectplugin.h \
qmlprojectconstants.h \ qmlprojectconstants.h \
qmlprojectnodes.h \ qmlprojectnodes.h \
qmlprojectfile.h \
qmlprojectrunconfiguration.h \ qmlprojectrunconfiguration.h \
qmlprojectrunconfigurationfactory.h \ qmlprojectrunconfigurationfactory.h \
qmlprojectmanager_global.h \ qmlprojectmanager_global.h \
@@ -20,7 +19,6 @@ SOURCES += qmlproject.cpp \
qmlprojectenvironmentaspect.cpp \ qmlprojectenvironmentaspect.cpp \
qmlprojectplugin.cpp \ qmlprojectplugin.cpp \
qmlprojectnodes.cpp \ qmlprojectnodes.cpp \
qmlprojectfile.cpp \
qmlprojectrunconfiguration.cpp \ qmlprojectrunconfiguration.cpp \
qmlprojectrunconfigurationfactory.cpp \ qmlprojectrunconfigurationfactory.cpp \
qmlprojectrunconfigurationwidget.cpp qmlprojectrunconfigurationwidget.cpp

View File

@@ -18,7 +18,6 @@ QtcPlugin {
"qmlproject.qrc", "qmlproject.qrc",
"qmlprojectconstants.h", "qmlprojectconstants.h",
"qmlprojectenvironmentaspect.cpp", "qmlprojectenvironmentaspect.h", "qmlprojectenvironmentaspect.cpp", "qmlprojectenvironmentaspect.h",
"qmlprojectfile.cpp", "qmlprojectfile.h",
"qmlprojectmanager_global.h", "qmlprojectmanager_global.h",
"qmlprojectmanagerconstants.h", "qmlprojectmanagerconstants.h",
"qmlprojectnodes.cpp", "qmlprojectnodes.h", "qmlprojectnodes.cpp", "qmlprojectnodes.h",

View File

@@ -291,6 +291,11 @@ QMap<QString, QTextCodec *> TextDocument::openedTextDocumentEncodings()
return workingCopy; return workingCopy;
} }
TextDocument *TextDocument::currentTextDocument()
{
return qobject_cast<TextDocument *>(EditorManager::currentDocument());
}
QString TextDocument::plainText() const QString TextDocument::plainText() const
{ {
return document()->toPlainText(); return document()->toPlainText();

View File

@@ -65,6 +65,7 @@ public:
static QMap<QString, QString> openedTextDocumentContents(); static QMap<QString, QString> openedTextDocumentContents();
static QMap<QString, QTextCodec *> openedTextDocumentEncodings(); static QMap<QString, QTextCodec *> openedTextDocumentEncodings();
static TextDocument *currentTextDocument();
virtual QString plainText() const; virtual QString plainText() const;
virtual QString textAt(int pos, int length) const; virtual QString textAt(int pos, int length) const;

View File

@@ -6152,7 +6152,6 @@ void tst_Dumpers::dumper_data()
"Derived d;\n" "Derived d;\n"
"Base *b = &d;\n" "Base *b = &d;\n"
"unused(&d, &b);\n") "unused(&d, &b);\n")
+ NoCdbEngine // FIXME
+ Check("b.@1.a", "a", "21", "int") + Check("b.@1.a", "a", "21", "int")
+ Check("b.b", "b", "42", "int"); + Check("b.b", "b", "42", "int");
@@ -6185,8 +6184,6 @@ void tst_Dumpers::dumper_data()
"unused(&c);\n" "unused(&c);\n"
"Base2 *b2 = &d; // This has the right address\n" "Base2 *b2 = &d; // This has the right address\n"
"unused(&b2);\n") "unused(&b2);\n")
+ NoCdbEngine // FIXME
+ Check("c.b2.@1.foo", "42", "int") + Check("c.b2.@1.foo", "42", "int")
+ Check("c.b2.@2.bar", "43", "int") + Check("c.b2.@2.bar", "43", "int")
+ Check("c.b2.baz", "84", "int") + Check("c.b2.baz", "84", "int")

View File

@@ -137,16 +137,16 @@ void tst_TimelineRenderer::mouseEvents()
model.loadData(); model.loadData();
testMouseEvents(&renderer, 1, 1); testMouseEvents(&renderer, 1, 1);
QCOMPARE(renderer.selectedItem(), 3); QCOMPARE(renderer.selectedItem(), 2);
QCOMPARE(renderer.selectionLocked(), true); QCOMPARE(renderer.selectionLocked(), true);
model.setExpanded(true); model.setExpanded(true);
testMouseEvents(&renderer, 1, 1); testMouseEvents(&renderer, 1, 1);
QCOMPARE(renderer.selectedItem(), 3); QCOMPARE(renderer.selectedItem(), 2);
QCOMPARE(renderer.selectionLocked(), true); // Don't toggle locked status by clicking same item QCOMPARE(renderer.selectionLocked(), true); // Don't toggle locked status by clicking same item
renderer.setSelectionLocked(false); renderer.setSelectionLocked(false);
testMouseEvents(&renderer, 1, 1); testMouseEvents(&renderer, 1, 1);
QCOMPARE(renderer.selectedItem(), 3); QCOMPARE(renderer.selectedItem(), 2);
QCOMPARE(renderer.selectionLocked(), false); QCOMPARE(renderer.selectionLocked(), false);
renderer.setSelectionLocked(true); renderer.setSelectionLocked(true);
testMouseEvents(&renderer, 1, 40); testMouseEvents(&renderer, 1, 40);
@@ -157,7 +157,7 @@ void tst_TimelineRenderer::mouseEvents()
QCOMPARE(renderer.selectedItem(), -1); QCOMPARE(renderer.selectedItem(), -1);
QCOMPARE(renderer.selectionLocked(), false); QCOMPARE(renderer.selectionLocked(), false);
testMouseEvents(&renderer, 10, 1); testMouseEvents(&renderer, 10, 1);
QCOMPARE(renderer.selectedItem(), 19); QCOMPARE(renderer.selectedItem(), 14);
QCOMPARE(renderer.selectionLocked(), false); QCOMPARE(renderer.selectionLocked(), false);
renderer.setSelectionLocked(true); renderer.setSelectionLocked(true);