forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.8'
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 14 KiB |
BIN
doc/images/qmldesigner-snap-to-anchors-button.png
Normal file
BIN
doc/images/qmldesigner-snap-to-anchors-button.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -494,23 +494,26 @@
|
||||
coordinates of an item, or \l{Setting Anchors and Margins}{anchor} it to
|
||||
its parent and sibling items.
|
||||
|
||||
\section2 Snap to Margins
|
||||
\section2 Snapping to Parent and Sibling Items
|
||||
|
||||
When you are working on a design, you can use snap and guides to align
|
||||
When you are working on a design, you can use snapping to align
|
||||
items on the canvas. Click the
|
||||
\inlineimage qmldesigner-snap-to-guides-button.png
|
||||
button to have the items snap to the guides.
|
||||
button to have the items snap to their parent or sibling items. Snapping
|
||||
lines automatically appear to help you position the items.
|
||||
Click the \inlineimage qmldesigner-snap-to-anchors-button.png
|
||||
button to anchor the item to the items that you snap to.
|
||||
|
||||
Choose \gui {Tools > Options > Qt Quick > Qt Quick Designer} to specify
|
||||
settings for snap to
|
||||
margins. In the \gui {Snap margin} field, specify the position of the guides
|
||||
as pixels from the edge of the canvas. In the \gui {Item spacing} field,
|
||||
specify the space in pixels to leave between items on the screen.
|
||||
settings for snapping. In the \gui {Parent item padding} field, specify the
|
||||
distance in pixels between the parent item and the snapping lines. In the
|
||||
\gui {Sibling item spacing} field, specify the distance in pixels between
|
||||
sibling items and the snapping lines.
|
||||
|
||||
The following image shows the position of the guides when \gui {Snap margin}
|
||||
The following image shows the snapping lines when \gui {Parent item padding}
|
||||
is set to 5 pixels.
|
||||
|
||||
\image qmldesigner-snap-margins.png "Snap margins on canvas"
|
||||
\image qmldesigner-snap-margins.png "Snapping lines on canvas"
|
||||
|
||||
\section2 Hiding Item Boundaries
|
||||
|
||||
|
||||
@@ -1507,6 +1507,13 @@ class Dumper:
|
||||
|
||||
#print('data=[' + locals + sep + watchers + ']\n')
|
||||
|
||||
|
||||
def templateArgument(self, typeobj, position):
|
||||
return templateArgument(typeobj, position)
|
||||
|
||||
def numericTemplateArgument(self, typeobj, position):
|
||||
return numericTemplateArgument(typeobj, position)
|
||||
|
||||
def lookupType(self, typeName):
|
||||
return lookupType(typeName)
|
||||
|
||||
|
||||
@@ -3,29 +3,22 @@ import atexit
|
||||
import binascii
|
||||
import inspect
|
||||
import os
|
||||
import platform
|
||||
import threading
|
||||
import select
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
||||
uname = platform.uname()[0]
|
||||
if uname == 'Linux':
|
||||
# /data/dev/llvm-git-2/build/lib/python2.7/site-packages
|
||||
proc = subprocess.Popen(args=[sys.argv[1], "-P"], stdout=subprocess.PIPE)
|
||||
path = proc.stdout.read().strip()
|
||||
sys.path.append(path)
|
||||
else:
|
||||
base = '/Applications/Xcode.app/Contents/'
|
||||
sys.path.append(base + 'SharedFrameworks/LLDB.framework/Resources/Python')
|
||||
sys.path.append(base + 'Library/PrivateFrameworks/LLDB.framework/Resources/Python')
|
||||
proc = subprocess.Popen(args=[sys.argv[1], "-P"], stdout=subprocess.PIPE)
|
||||
path = proc.stdout.read().strip()
|
||||
#sys.path.append(path)
|
||||
sys.path.insert(1, path)
|
||||
|
||||
import lldb
|
||||
|
||||
cdbLoaded = False
|
||||
lldbLoaded = True
|
||||
gdbLoaded = False
|
||||
lldbLoaded = True
|
||||
|
||||
# Encodings. Keep that synchronized with DebuggerEncoding in watchutils.h
|
||||
Unencoded8Bit, \
|
||||
@@ -95,9 +88,6 @@ qqEditable = {}
|
||||
# This keeps canonical forms of the typenames, without array indices etc.
|
||||
qqStripForFormat = {}
|
||||
|
||||
def templateArgument(typeobj, index):
|
||||
return typeobj.GetTemplateArgumentType(index)
|
||||
|
||||
def directBaseClass(typeobj, index = 0):
|
||||
return typeobj.GetDirectBaseClassAtIndex(index)
|
||||
|
||||
@@ -275,7 +265,7 @@ def impl_SBValue__add__(self, offset):
|
||||
pass
|
||||
else:
|
||||
offset = offset.GetValueAsSigned()
|
||||
itemsize = self.GetType().GetDereferencedType().GetByteSize()
|
||||
itemsize = self.GetType().GetPointeeType().GetByteSize()
|
||||
address = self.GetValueAsUnsigned() + offset * itemsize
|
||||
address = address & 0xFFFFFFFFFFFFFFFF # Force unsigned
|
||||
return createPointerValue(self, address, self.GetType().GetPointeeType())
|
||||
@@ -289,8 +279,8 @@ def impl_SBValue__sub__(self, other):
|
||||
address = address & 0xFFFFFFFFFFFFFFFF # Force unsigned
|
||||
return self.CreateValueFromAddress(None, address, self.GetType())
|
||||
if other.GetType().IsPointerType():
|
||||
itemsize = self.GetType().GetDereferencedType().GetByteSize()
|
||||
return (int(self) - int(other)) / itemsize
|
||||
itemsize = self.GetType().GetPointeeType().GetByteSize()
|
||||
return (self.GetValueAsUnsigned() - other.GetValueAsUnsigned()) / itemsize
|
||||
raise RuntimeError("SBValue.__sub__ not implemented: %s" % self.GetType())
|
||||
return NotImplemented
|
||||
|
||||
@@ -440,8 +430,14 @@ class Children:
|
||||
class SubItem:
|
||||
def __init__(self, d, component):
|
||||
self.d = d
|
||||
self.iname = "%s.%s" % (d.currentIName, component)
|
||||
if isinstance(component, lldb.SBValue):
|
||||
# Avoid $$__synth__ suffix on Mac.
|
||||
value = component
|
||||
value.SetPreferSyntheticValue(False)
|
||||
self.name = value.GetName()
|
||||
else:
|
||||
self.name = component
|
||||
self.iname = "%s.%s" % (d.currentIName, self.name)
|
||||
|
||||
def __enter__(self):
|
||||
self.d.put('{')
|
||||
@@ -527,6 +523,45 @@ class Dumper:
|
||||
self.charPtrType_ = None
|
||||
self.voidType_ = None
|
||||
|
||||
def extractTemplateArgument(self, typename, index):
|
||||
level = 0
|
||||
skipSpace = False
|
||||
inner = ""
|
||||
for c in typename[typename.find('<') + 1 : -1]:
|
||||
if c == '<':
|
||||
inner += c
|
||||
level += 1
|
||||
elif c == '>':
|
||||
level -= 1
|
||||
inner += c
|
||||
elif c == ',':
|
||||
if level == 0:
|
||||
if index == 0:
|
||||
return inner
|
||||
index -= 1
|
||||
inner = ""
|
||||
else:
|
||||
inner += c
|
||||
skipSpace = True
|
||||
else:
|
||||
if skipSpace and c == ' ':
|
||||
pass
|
||||
else:
|
||||
inner += c
|
||||
skipSpace = False
|
||||
return inner
|
||||
|
||||
def templateArgument(self, typeobj, index):
|
||||
type = typeobj.GetTemplateArgumentType(index)
|
||||
if len(type.GetName()):
|
||||
return type
|
||||
inner = self.extractTemplateArgument(typeobj.GetName(), index)
|
||||
return self.lookupType(inner)
|
||||
|
||||
def numericTemplateArgument(self, typeobj, index):
|
||||
inner = self.extractTemplateArgument(typeobj.GetName(), index)
|
||||
return int(inner)
|
||||
|
||||
def intType(self):
|
||||
if self.intType_ is None:
|
||||
self.intType_ = self.target.GetModuleAtIndex(0).FindFirstType('int')
|
||||
@@ -692,15 +727,14 @@ class Dumper:
|
||||
self.report(self.describeError(error))
|
||||
|
||||
def currentThread(self):
|
||||
#return self.process.GetSelectedThread()
|
||||
return self.process.GetThreadAtIndex(0)
|
||||
return self.process.GetSelectedThread()
|
||||
|
||||
def currentFrame(self):
|
||||
return self.currentThread().GetSelectedFrame()
|
||||
|
||||
def reportLocation(self):
|
||||
thread = self.currentThread()
|
||||
frame = thread.GetFrameAtIndex(0)
|
||||
frame = thread.GetSelectedFrame()
|
||||
file = fileName(frame.line_entry.file)
|
||||
line = frame.line_entry.line
|
||||
self.report('location={file="%s",line="%s",addr="%s"}' % (file, line, frame.pc))
|
||||
@@ -732,7 +766,9 @@ class Dumper:
|
||||
self.report('msg="No process"')
|
||||
else:
|
||||
thread = self.currentThread()
|
||||
result = 'stack={current-thread="%s",frames=[' % thread.GetThreadID()
|
||||
result = 'stack={current-frame="%s"' % thread.GetSelectedFrame().GetFrameID()
|
||||
result += ',current-thread="%s"' % thread.GetThreadID()
|
||||
result += ',frames=['
|
||||
n = thread.GetNumFrames()
|
||||
if n > 4:
|
||||
n = 4
|
||||
@@ -742,7 +778,7 @@ class Dumper:
|
||||
result += '{pc="0x%x"' % frame.GetPC()
|
||||
result += ',level="%d"' % frame.idx
|
||||
result += ',addr="0x%x"' % frame.GetPCAddress().GetLoadAddress(self.target)
|
||||
result += ',func="%s"' % frame.GetFunction().GetName()
|
||||
result += ',func="%s"' % frame.GetFunctionName()
|
||||
result += ',line="%d"' % lineEntry.GetLine()
|
||||
result += ',fullname="%s"' % fileName(lineEntry.file)
|
||||
result += ',usable="1"'
|
||||
@@ -825,9 +861,7 @@ class Dumper:
|
||||
typeName = value.GetTypeName()
|
||||
|
||||
# Handle build-in LLDB visualizers if wanted.
|
||||
hasSynth = hasattr(value, 'SetPreferSyntheticValue')
|
||||
|
||||
if self.useLldbDumpers and hasSynth and value.GetTypeSynthetic().IsValid():
|
||||
if self.useLldbDumpers and value.GetTypeSynthetic().IsValid():
|
||||
# FIXME: print "official" summary?
|
||||
summary = value.GetTypeSummary()
|
||||
if summary.IsValid():
|
||||
@@ -852,7 +886,6 @@ class Dumper:
|
||||
return
|
||||
|
||||
# Our turf now.
|
||||
if hasSynth:
|
||||
value.SetPreferSyntheticValue(False)
|
||||
|
||||
# References
|
||||
@@ -897,7 +930,7 @@ class Dumper:
|
||||
n = 10000
|
||||
for i in xrange(n):
|
||||
child = value.GetChildAtIndex(i)
|
||||
with SubItem(self, child.GetName()):
|
||||
with SubItem(self, child):
|
||||
self.putItem(child)
|
||||
|
||||
def reportVariables(self, _ = None):
|
||||
@@ -905,7 +938,7 @@ class Dumper:
|
||||
self.currentIName = "local"
|
||||
self.put('data=[')
|
||||
for value in frame.GetVariables(True, True, False, False):
|
||||
with SubItem(self, value.GetName()):
|
||||
with SubItem(self, value):
|
||||
self.put('iname="%s",' % self.currentIName)
|
||||
self.putItem(value)
|
||||
self.put(']')
|
||||
@@ -1136,7 +1169,7 @@ class Dumper:
|
||||
self.currentThread().StepOver()
|
||||
|
||||
def executeNextI(self, _ = None):
|
||||
self.currentThread().StepOver()
|
||||
self.currentThread().StepInstruction(lldb.eOnlyThisThread)
|
||||
|
||||
def executeStep(self, _ = None):
|
||||
self.currentThread().StepInto()
|
||||
@@ -1145,10 +1178,10 @@ class Dumper:
|
||||
self.debugger.Terminate()
|
||||
|
||||
def executeStepI(self, _ = None):
|
||||
self.currentThread().StepInstOver()
|
||||
self.currentThread().StepInstruction(lldb.eOnlyThisThread)
|
||||
|
||||
def executeStepOut(self, _ = None):
|
||||
self.debugger.HandleCommand("thread step-out")
|
||||
self.currentThread().StepOut()
|
||||
|
||||
def executeRunToLine(self, args):
|
||||
file = args['file']
|
||||
@@ -1165,8 +1198,9 @@ class Dumper:
|
||||
self.report('success="%d",output="%s",error="%s"'
|
||||
% (result.Succeeded(), result.GetOutput(), result.GetError()))
|
||||
|
||||
def activateFrame(self, frame):
|
||||
self.handleCommand("frame select " + frame)
|
||||
def activateFrame(self, args):
|
||||
self.currentThread().SetSelectedFrame(args['index'])
|
||||
self.reportData()
|
||||
|
||||
def selectThread(self, thread):
|
||||
self.handleCommand("thread select " + thread)
|
||||
|
||||
@@ -439,7 +439,7 @@ def qdump__QFiniteStack(d, value):
|
||||
d.putItemCount(size)
|
||||
d.putNumChild(size)
|
||||
if d.isExpanded():
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
d.putArrayData(innerType, value["_array"], size)
|
||||
|
||||
# Stock gdb 7.2 seems to have a problem with types here:
|
||||
@@ -467,7 +467,7 @@ def qdump__QFiniteStack(d, value):
|
||||
def qdump__QFlags(d, value):
|
||||
i = value["i"]
|
||||
try:
|
||||
enumType = templateArgument(value.type.unqualified(), 0)
|
||||
enumType = d.templateArgument(value.type.unqualified(), 0)
|
||||
d.putValue("%s (%s)" % (i.cast(enumType), i))
|
||||
except:
|
||||
d.putValue("%s" % i)
|
||||
@@ -506,8 +506,8 @@ def qdump__QHash(d, value):
|
||||
bucket += 1
|
||||
return node
|
||||
|
||||
keyType = templateArgument(value.type, 0)
|
||||
valueType = templateArgument(value.type, 1)
|
||||
keyType = d.templateArgument(value.type, 0)
|
||||
valueType = d.templateArgument(value.type, 1)
|
||||
|
||||
d_ptr = value["d"]
|
||||
e_ptr = value["e"]
|
||||
@@ -542,8 +542,8 @@ def qdump__QHash(d, value):
|
||||
|
||||
|
||||
def qdump__QHashNode(d, value):
|
||||
keyType = templateArgument(value.type, 0)
|
||||
valueType = templateArgument(value.type, 1)
|
||||
keyType = d.templateArgument(value.type, 0)
|
||||
valueType = d.templateArgument(value.type, 1)
|
||||
key = value["key"]
|
||||
val = value["value"]
|
||||
|
||||
@@ -563,8 +563,8 @@ def qdump__QHashNode(d, value):
|
||||
def qHashIteratorHelper(d, value):
|
||||
typeName = str(value.type)
|
||||
hashType = d.lookupType(typeName[0:typeName.rfind("::")])
|
||||
keyType = templateArgument(hashType, 0)
|
||||
valueType = templateArgument(hashType, 1)
|
||||
keyType = d.templateArgument(hashType, 0)
|
||||
valueType = d.templateArgument(hashType, 1)
|
||||
d.putNumChild(1)
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
@@ -608,7 +608,7 @@ def qdump__QList(d, value):
|
||||
check(size >= 0)
|
||||
checkRef(private["ref"])
|
||||
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
|
||||
d.putItemCount(size)
|
||||
d.putNumChild(size)
|
||||
@@ -702,7 +702,7 @@ def qdump__QLinkedList(d, value):
|
||||
d.putItemCount(n)
|
||||
d.putNumChild(n)
|
||||
if d.isExpanded():
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
with Children(d, n, maxNumChild=1000, childType=innerType):
|
||||
p = e_ptr["n"]
|
||||
for i in d.childRange():
|
||||
@@ -772,8 +772,8 @@ def qdumpHelper__Qt4_QMap(d, value, forceLong):
|
||||
if n > 10000:
|
||||
n = 10000
|
||||
|
||||
keyType = templateArgument(value.type, 0)
|
||||
valueType = templateArgument(value.type, 1)
|
||||
keyType = d.templateArgument(value.type, 0)
|
||||
valueType = d.templateArgument(value.type, 1)
|
||||
isCompact = mapCompact(d.currentItemFormat(), keyType, valueType)
|
||||
|
||||
it = e_ptr["forward"].dereference()
|
||||
@@ -820,8 +820,8 @@ def qdumpHelper__Qt5_QMap(d, value, forceLong):
|
||||
if n > 10000:
|
||||
n = 10000
|
||||
|
||||
keyType = templateArgument(value.type, 0)
|
||||
valueType = templateArgument(value.type, 1)
|
||||
keyType = d.templateArgument(value.type, 0)
|
||||
valueType = d.templateArgument(value.type, 1)
|
||||
isCompact = mapCompact(d.currentItemFormat(), keyType, valueType)
|
||||
nodeType = d.lookupType(d.ns + "QMapNode<%s, %s>" % (keyType, valueType))
|
||||
if isCompact:
|
||||
@@ -1110,7 +1110,7 @@ def qdump__QObject(d, value):
|
||||
pp = 0
|
||||
with Children(d):
|
||||
vectorType = connections.type.target().fields()[0].type
|
||||
innerType = templateArgument(vectorType, 0)
|
||||
innerType = d.templateArgument(vectorType, 0)
|
||||
# Should check: innerType == ns::QObjectPrivate::ConnectionList
|
||||
p = gdb.Value(connections["p"]["array"]).cast(innerType.pointer())
|
||||
for i in xrange(connectionListCount):
|
||||
@@ -1459,7 +1459,7 @@ def qdump__QSet(d, value):
|
||||
bucket += 1
|
||||
return node
|
||||
|
||||
keyType = templateArgument(value.type, 0)
|
||||
keyType = d.templateArgument(value.type, 0)
|
||||
|
||||
d_ptr = value["q_hash"]["d"]
|
||||
e_ptr = value["q_hash"]["e"]
|
||||
@@ -1505,7 +1505,7 @@ def qdump__QSharedDataPointer(d, value):
|
||||
# This replaces the pointer by the pointee, making the
|
||||
# pointer transparent.
|
||||
try:
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
except:
|
||||
d.putValue(d_ptr)
|
||||
d.putPlainChildren(value)
|
||||
@@ -1851,7 +1851,7 @@ def qedit__QVector(expr, value):
|
||||
ob = gdb.parse_and_eval(expr)
|
||||
cmd = "call (%s).resize(%d)" % (expr, len(values))
|
||||
gdb.execute(cmd)
|
||||
innerType = templateArgument(ob.type, 0)
|
||||
innerType = d.templateArgument(ob.type, 0)
|
||||
ptr = ob["p"]["array"].cast(d.voidPtrType())
|
||||
cmd = "set {%s[%d]}%s={%s}" % (innerType, len(values), long(ptr), value)
|
||||
gdb.execute(cmd)
|
||||
@@ -1866,7 +1866,7 @@ def qdump__QVector(d, value):
|
||||
checkRef(private["ref"])
|
||||
alloc = int(private["alloc"])
|
||||
size = int(private["size"])
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
try:
|
||||
# Qt 5. Will fail on Qt 4 due to the missing 'offset' member.
|
||||
offset = private["offset"]
|
||||
@@ -1909,7 +1909,7 @@ def qdump__QWeakPointer(d, value):
|
||||
d.putNumChild(3)
|
||||
if d.isExpanded():
|
||||
with Children(d):
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
d.putSubItem("data", val.dereference().cast(innerType))
|
||||
d.putIntItem("weakref", weakref)
|
||||
d.putIntItem("strongref", strongref)
|
||||
@@ -1962,16 +1962,16 @@ def qdump____c_style_array__(d, value):
|
||||
|
||||
|
||||
def qdump__std__array(d, value):
|
||||
size = numericTemplateArgument(value.type, 1)
|
||||
size = d.numericTemplateArgument(value.type, 1)
|
||||
d.putItemCount(size)
|
||||
d.putNumChild(size)
|
||||
if d.isExpanded():
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
d.putArrayData(innerType, value.address, size)
|
||||
|
||||
|
||||
def qdump__std__complex(d, value):
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
base = value.address.cast(innerType.pointer())
|
||||
real = base.dereference()
|
||||
imag = (base + 1).dereference()
|
||||
@@ -2032,7 +2032,7 @@ def qdump__std__list(d, value):
|
||||
|
||||
if d.isExpanded():
|
||||
p = node["_M_next"]
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
with Children(d, size, maxNumChild=1000, childType=innerType):
|
||||
for i in d.childRange():
|
||||
innerPointer = innerType.pointer()
|
||||
@@ -2051,16 +2051,16 @@ def qdump__std__map(d, value):
|
||||
d.putNumChild(size)
|
||||
|
||||
if d.isExpanded():
|
||||
keyType = templateArgument(value.type, 0)
|
||||
valueType = templateArgument(value.type, 1)
|
||||
keyType = d.templateArgument(value.type, 0)
|
||||
valueType = d.templateArgument(value.type, 1)
|
||||
try:
|
||||
# Does not work on gcc 4.4, the allocator type (fourth template
|
||||
# argument) seems not to be available.
|
||||
pairType = templateArgument(templateArgument(value.type, 3), 0)
|
||||
pairType = d.templateArgument(d.templateArgument(value.type, 3), 0)
|
||||
pairPointer = pairType.pointer()
|
||||
except:
|
||||
# So use this as workaround:
|
||||
pairType = templateArgument(impl.type, 1)
|
||||
pairType = d.templateArgument(impl.type, 1)
|
||||
pairPointer = pairType.pointer()
|
||||
isCompact = mapCompact(d.currentItemFormat(), keyType, valueType)
|
||||
innerType = pairType
|
||||
@@ -2106,7 +2106,7 @@ def stdTreeIteratorHelper(d, value):
|
||||
d.putNumChild(1)
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
dataType = templateArgument(value.type, 0)
|
||||
dataType = d.templateArgument(value.type, 0)
|
||||
nodeType = d.lookupType("std::_Rb_tree_node<%s>" % dataType)
|
||||
data = pnode.cast(nodeType.pointer()).dereference()["_M_value_field"]
|
||||
with Children(d):
|
||||
@@ -2154,7 +2154,7 @@ def qdump__std__set(d, value):
|
||||
d.putItemCount(size)
|
||||
d.putNumChild(size)
|
||||
if d.isExpanded():
|
||||
valueType = templateArgument(value.type, 0)
|
||||
valueType = d.templateArgument(value.type, 0)
|
||||
node = impl["_M_header"]["_M_left"]
|
||||
with Children(d, size, maxNumChild=1000, childType=valueType):
|
||||
for i in d.childRange():
|
||||
@@ -2182,7 +2182,7 @@ def qform__std__string():
|
||||
def qdump__std__string(d, value):
|
||||
data = value["_M_dataplus"]["_M_p"]
|
||||
baseType = value.type.strip_typedefs()
|
||||
charSize = templateArgument(baseType, 0).sizeof
|
||||
charSize = d.templateArgument(baseType, 0).sizeof
|
||||
# We can't lookup the std::string::_Rep type without crashing LLDB,
|
||||
# so hard-code assumption on member position
|
||||
# struct { size_type _M_length, size_type _M_capacity, int _M_refcount; }
|
||||
@@ -2225,7 +2225,7 @@ def qdump__std__shared_ptr(d, value):
|
||||
d.putNumChild(0)
|
||||
return
|
||||
|
||||
if isSimpleType(templateArgument(value.type, 0)):
|
||||
if isSimpleType(d.templateArgument(value.type, 0)):
|
||||
d.putValue("%s @0x%x" % (i.dereference(), long(i)))
|
||||
else:
|
||||
i = expensiveDowncast(i)
|
||||
@@ -2246,7 +2246,7 @@ def qdump__std__unique_ptr(d, value):
|
||||
d.putNumChild(0)
|
||||
return
|
||||
|
||||
if isSimpleType(templateArgument(value.type, 0)):
|
||||
if isSimpleType(d.templateArgument(value.type, 0)):
|
||||
d.putValue("%s @0x%x" % (i.dereference(), long(i)))
|
||||
else:
|
||||
i = expensiveDowncast(i)
|
||||
@@ -2261,7 +2261,7 @@ def qedit__std__vector(expr, value):
|
||||
values = value.split(',')
|
||||
n = len(values)
|
||||
ob = gdb.parse_and_eval(expr)
|
||||
innerType = templateArgument(ob.type, 0)
|
||||
innerType = d.templateArgument(ob.type, 0)
|
||||
cmd = "set $d = (%s*)calloc(sizeof(%s)*%s,1)" % (innerType, innerType, n)
|
||||
gdb.execute(cmd)
|
||||
cmd = "set {void*[3]}%s = {$d, $d+%s, $d+%s}" % (ob.address, n, n)
|
||||
@@ -2271,7 +2271,7 @@ def qedit__std__vector(expr, value):
|
||||
|
||||
def qdump__std__vector(d, value):
|
||||
impl = value["_M_impl"]
|
||||
type = templateArgument(value.type, 0)
|
||||
type = d.templateArgument(value.type, 0)
|
||||
alloc = impl["_M_end_of_storage"]
|
||||
isBool = str(type) == 'bool'
|
||||
if isBool:
|
||||
@@ -2332,7 +2332,7 @@ def qdump____gnu_cxx__hash_set(d, value):
|
||||
check(0 <= size and size <= 1000 * 1000 * 1000)
|
||||
d.putItemCount(size)
|
||||
d.putNumChild(size)
|
||||
type = templateArgument(value.type, 0)
|
||||
type = d.templateArgument(value.type, 0)
|
||||
d.putType("__gnu__cxx::hash_set<%s>" % type)
|
||||
if d.isExpanded():
|
||||
with Children(d, size, maxNumChild=1000, childType=type):
|
||||
@@ -2359,8 +2359,8 @@ def qdump____gnu_cxx__hash_set(d, value):
|
||||
#######################################################################
|
||||
|
||||
def qdump__boost__bimaps__bimap(d, value):
|
||||
leftType = templateArgument(value.type, 0)
|
||||
rightType = templateArgument(value.type, 1)
|
||||
leftType = d.templateArgument(value.type, 0)
|
||||
rightType = d.templateArgument(value.type, 1)
|
||||
size = value["core"]["node_count"]
|
||||
d.putItemCount(size)
|
||||
d.putNumChild(size)
|
||||
@@ -2374,7 +2374,7 @@ def qdump__boost__optional(d, value):
|
||||
d.putNumChild(0)
|
||||
else:
|
||||
d.putBetterType(value.type)
|
||||
type = templateArgument(value.type, 0)
|
||||
type = d.templateArgument(value.type, 0)
|
||||
storage = value["m_storage"]
|
||||
if type.code == ReferenceCode:
|
||||
d.putItem(storage.cast(type.target().pointer()).dereference())
|
||||
@@ -2717,12 +2717,12 @@ def qdump__CPlusPlus__Internal__PPToken(d, value):
|
||||
# return "Transposed"
|
||||
|
||||
def qdump__Eigen__Matrix(d, value):
|
||||
innerType = templateArgument(value.type, 0)
|
||||
innerType = d.templateArgument(value.type, 0)
|
||||
storage = value["m_storage"]
|
||||
options = numericTemplateArgument(value.type, 3)
|
||||
options = d.numericTemplateArgument(value.type, 3)
|
||||
rowMajor = (int(options) & 0x1)
|
||||
argRow = numericTemplateArgument(value.type, 1)
|
||||
argCol = numericTemplateArgument(value.type, 2)
|
||||
argRow = d.numericTemplateArgument(value.type, 1)
|
||||
argCol = d.numericTemplateArgument(value.type, 2)
|
||||
nrows = value["m_storage"]["m_rows"] if argRow == -1 else int(argRow)
|
||||
ncols = value["m_storage"]["m_cols"] if argCol == -1 else int(argCol)
|
||||
p = storage["m_data"]
|
||||
|
||||
@@ -52,6 +52,24 @@ QObject *QuickWindowNodeInstance::parent() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
QImage QuickWindowNodeInstance::renderImage() const
|
||||
{
|
||||
/*
|
||||
Since the content item transucient
|
||||
we just fill an image with the window color
|
||||
*/
|
||||
|
||||
QRectF renderBoundingRect = boundingRect();
|
||||
|
||||
QImage renderImage(renderBoundingRect.size().toSize(), QImage::Format_ARGB32_Premultiplied);
|
||||
|
||||
QPalette palette;
|
||||
|
||||
renderImage.fill(palette.color(QPalette::Window).rgba());
|
||||
|
||||
return renderImage;
|
||||
}
|
||||
|
||||
QuickWindowNodeInstance::Pointer QuickWindowNodeInstance::create(QObject *object)
|
||||
{
|
||||
QQuickWindow *quickWindow = qobject_cast<QQuickWindow*>(object);
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
bool isAnchoredBySibling() const Q_DECL_OVERRIDE;
|
||||
|
||||
|
||||
QImage renderImage() const Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
QuickWindowNodeInstance(QQuickWindow*);
|
||||
|
||||
@@ -33,9 +33,13 @@ import Bauhaus 1.0
|
||||
QFrame {
|
||||
styleSheetFile: "switch.css";
|
||||
property variant specialModeIcon;
|
||||
property bool showLayoutModeButton: true
|
||||
property bool showExtendedModeButton: true
|
||||
|
||||
specialModeIcon: "images/standard.png";
|
||||
maximumWidth: 300;
|
||||
minimumWidth: 300;
|
||||
|
||||
layout: QHBoxLayout {
|
||||
topMargin: 0;
|
||||
bottomMargin: 0;
|
||||
@@ -58,6 +62,9 @@ QFrame {
|
||||
extendedPane.visible = false;
|
||||
layoutPane.visible = false;
|
||||
}
|
||||
Component.onCompleted: {
|
||||
standardMode.checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
@@ -66,6 +73,7 @@ QFrame {
|
||||
checked: false;
|
||||
toolTip: qsTr("Layout");
|
||||
text: qsTr("Layout");
|
||||
visible: showLayoutModeButton
|
||||
onClicked: {
|
||||
extendedMode.checked = false;
|
||||
standardMode.checked = false;
|
||||
@@ -82,6 +90,7 @@ QFrame {
|
||||
checkable: true;
|
||||
checked: false;
|
||||
text: qsTr("Advanced")
|
||||
visible: showExtendedModeButton
|
||||
onClicked: {
|
||||
standardMode.checked = false;
|
||||
layoutMode.checked = false;
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 1.0
|
||||
import Bauhaus 1.0
|
||||
import HelperWidgets 1.0
|
||||
|
||||
PropertyFrame {
|
||||
id: frame;
|
||||
x: 0
|
||||
y: 0
|
||||
|
||||
ExpressionEditor {
|
||||
id: expressionEdit
|
||||
}
|
||||
layout: QVBoxLayout {
|
||||
topMargin: 0;
|
||||
bottomMargin: 0;
|
||||
leftMargin: 0;
|
||||
rightMargin: 0;
|
||||
spacing: 0;
|
||||
|
||||
Type {
|
||||
}
|
||||
|
||||
Geometry {
|
||||
}
|
||||
|
||||
HorizontalWhiteLine {
|
||||
maximumHeight: 4;
|
||||
styleSheet: "QLineEdit {border: 2px solid #707070; min-height: 0px; max-height: 0px;}";
|
||||
}
|
||||
|
||||
HorizontalWhiteLine {
|
||||
}
|
||||
|
||||
Switches {
|
||||
showLayoutModeButton: false
|
||||
showExtendedModeButton: false
|
||||
}
|
||||
|
||||
ScrollArea {
|
||||
styleSheetFile: ":/qmldesigner/scrollbar.css";
|
||||
widgetResizable: true;
|
||||
|
||||
finished: finishedNotify;
|
||||
|
||||
horizontalScrollBarPolicy: "Qt::ScrollBarAlwaysOff";
|
||||
id: standardPane;
|
||||
QFrame {
|
||||
//minimumHeight: 1100
|
||||
id: properyEditorStandard
|
||||
layout: QVBoxLayout {
|
||||
topMargin: 0;
|
||||
bottomMargin: 0;
|
||||
leftMargin: 0;
|
||||
rightMargin: 0;
|
||||
spacing: 0;
|
||||
|
||||
QWidget {
|
||||
layout: QVBoxLayout {
|
||||
topMargin: 0
|
||||
bottomMargin: 0
|
||||
leftMargin: 0
|
||||
rightMargin: 0
|
||||
spacing: 0
|
||||
GroupBox {
|
||||
finished: finishedNotify;
|
||||
caption: qsTr("Window")
|
||||
layout: VerticalLayout {
|
||||
// Qt namespace enums not supported by the rewriter
|
||||
// QWidget {
|
||||
// layout: HorizontalLayout {
|
||||
// Label {
|
||||
// text: qsTr("Modality")
|
||||
// }
|
||||
|
||||
// ComboBox {
|
||||
// baseStateFlag: isBaseState
|
||||
// items : { ["Qt.NonModal", "Qt.WindowModal", "Qt.ApplicationModal"] }
|
||||
// currentText: backendValues.modality.value;
|
||||
// onItemsChanged: {
|
||||
// currentText = backendValues.modality.value;
|
||||
// }
|
||||
// backendValue: backendValues.modality
|
||||
// }
|
||||
// }
|
||||
// } //QWidget
|
||||
QWidget {
|
||||
layout: HorizontalLayout {
|
||||
Label {
|
||||
text: qsTr("Title")
|
||||
}
|
||||
LineEdit {
|
||||
backendValue: backendValues.title
|
||||
baseStateFlag: isBaseState;
|
||||
translation: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QScrollArea {
|
||||
}
|
||||
} // layout
|
||||
} //QWidget
|
||||
} //QScrollArea
|
||||
|
||||
ScrollArea {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import QtQuick.Controls 1.0
|
||||
import QtQuick.Window 2.0
|
||||
|
||||
ApplicationWindow {
|
||||
title: qsTr("Hello World")
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
|
||||
@@ -175,6 +175,14 @@ protected:
|
||||
virtual bool visit(Block *symbol)
|
||||
{ return process(symbol); }
|
||||
|
||||
virtual bool visit(Template *symbol)
|
||||
{
|
||||
if (symbol->declaration() && symbol->declaration()->isFunction())
|
||||
return process(symbol);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
// Objective-C
|
||||
virtual bool visit(ObjCBaseClass *) { return false; }
|
||||
virtual bool visit(ObjCBaseProtocol *) { return false; }
|
||||
|
||||
@@ -249,8 +249,9 @@ QList<LookupItem> LookupContext::lookupByUsing(const Name *name, Scope *scope) c
|
||||
if (name->isNameId()) {
|
||||
for (unsigned i = 0, count = scope->memberCount(); i < count; ++i) {
|
||||
if (UsingDeclaration *u = scope->memberAt(i)->asUsingDeclaration()) {
|
||||
if (const QualifiedNameId *q = u->name()->asQualifiedNameId()) {
|
||||
if (q->name()->isEqualTo(name)) {
|
||||
if (const Name *usingDeclarationName = u->name()) {
|
||||
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) {
|
||||
if (q->name() && q->name()->isEqualTo(name)) {
|
||||
candidates = bindings()->globalNamespace()->find(q);
|
||||
|
||||
// if it is not a global scope(scope of scope is not equal 0)
|
||||
@@ -266,6 +267,7 @@ QList<LookupItem> LookupContext::lookupByUsing(const Name *name, Scope *scope) c
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return candidates;
|
||||
}
|
||||
|
||||
@@ -328,11 +330,13 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
||||
}
|
||||
} else if (UsingDeclaration *ud = m->asUsingDeclaration()) {
|
||||
if (name->isNameId()) {
|
||||
if (const QualifiedNameId *q = ud->name()->asQualifiedNameId()) {
|
||||
if (q->name()->isEqualTo(name)) {
|
||||
if (const Name *usingDeclarationName = ud->name()) {
|
||||
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) {
|
||||
if (q->name() && q->name()->isEqualTo(name)) {
|
||||
return bindings()->globalNamespace()->lookupType(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -688,6 +692,16 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
|
||||
item.setType(ty); // override the type.
|
||||
}
|
||||
|
||||
// instantiate function template
|
||||
if (name->isTemplateNameId() && s->isTemplate() && s->asTemplate()->declaration()
|
||||
&& s->asTemplate()->declaration()->isFunction()) {
|
||||
const TemplateNameId *instantiation = name->asTemplateNameId();
|
||||
Template *specialization = s->asTemplate();
|
||||
Symbol *instantiatedFunctionTemplate = instantiateTemplateFunction(instantiation,
|
||||
specialization);
|
||||
item.setType(instantiatedFunctionTemplate->type()); // override the type.
|
||||
}
|
||||
|
||||
result->append(item);
|
||||
}
|
||||
}
|
||||
@@ -1599,3 +1613,29 @@ bool CreateBindings::visit(ObjCMethod *)
|
||||
return false;
|
||||
}
|
||||
|
||||
Symbol *CreateBindings::instantiateTemplateFunction(const TemplateNameId *instantiation,
|
||||
Template *specialization) const
|
||||
{
|
||||
const unsigned argumentCountOfInitialization = instantiation->templateArgumentCount();
|
||||
const unsigned argumentCountOfSpecialization = specialization->templateParameterCount();
|
||||
|
||||
Clone cloner(_control.data());
|
||||
Subst subst(_control.data());
|
||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||
const TypenameArgument *tParam
|
||||
= specialization->templateParameterAt(i)->asTypenameArgument();
|
||||
if (!tParam)
|
||||
continue;
|
||||
const Name *name = tParam->name();
|
||||
if (!name)
|
||||
continue;
|
||||
|
||||
FullySpecifiedType ty = (i < argumentCountOfInitialization) ?
|
||||
instantiation->templateArgumentAt(i):
|
||||
cloner.type(tParam->type(), &subst);
|
||||
|
||||
subst.bind(cloner.name(name, &subst), ty);
|
||||
}
|
||||
return cloner.symbol(specialization, &subst);
|
||||
}
|
||||
|
||||
|
||||
@@ -253,6 +253,9 @@ protected:
|
||||
virtual bool visit(ObjCMethod *);
|
||||
|
||||
private:
|
||||
Symbol *instantiateTemplateFunction(const TemplateNameId *instantiation,
|
||||
Template *specialization) const;
|
||||
|
||||
Snapshot _snapshot;
|
||||
QSharedPointer<Control> _control;
|
||||
QSet<Namespace *> _processed;
|
||||
|
||||
@@ -697,6 +697,14 @@ bool ResolveExpression::visit(CallAST *ast)
|
||||
// Constructor call
|
||||
FullySpecifiedType ctorTy = control()->namedType(classTy->name());
|
||||
addResult(ctorTy, scope);
|
||||
} else if (Template *templateTy = ty->asTemplateType()) {
|
||||
// template function
|
||||
if (Symbol *declaration = templateTy->declaration()) {
|
||||
if (Function *funTy = declaration->asFunction()) {
|
||||
if (maybeValidPrototype(funTy, actualArgumentCount))
|
||||
addResult(funTy->returnType().simplified(), scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,6 +946,18 @@ private:
|
||||
ClassOrNamespace *_binding;
|
||||
};
|
||||
|
||||
static bool isTypeTypedefed(const FullySpecifiedType &originalTy,
|
||||
const FullySpecifiedType &typedefedTy)
|
||||
{
|
||||
return ! originalTy.isEqualTo(typedefedTy);
|
||||
}
|
||||
|
||||
static bool areOriginalAndTypedefedTypePointer(const FullySpecifiedType &originalTy,
|
||||
const FullySpecifiedType &typedefedTy)
|
||||
{
|
||||
return originalTy->isPointerType() && typedefedTy->isPointerType();
|
||||
}
|
||||
|
||||
ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &baseResults,
|
||||
int accessOp,
|
||||
bool *replacedDotOperator) const
|
||||
@@ -1027,23 +1047,12 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
}
|
||||
} else if (accessOp == T_DOT) {
|
||||
if (replacedDotOperator) {
|
||||
if (! isTypeTypedefed(originalType, ty)
|
||||
|| ! areOriginalAndTypedefedTypePointer(originalType, ty)) {
|
||||
*replacedDotOperator = originalType->isPointerType() || ty->isPointerType();
|
||||
// replace . with ->
|
||||
if (PointerType *ptrTy = originalType->asPointerType()) {
|
||||
// case when original type is a pointer and
|
||||
// typedef is for type
|
||||
// e.g.:
|
||||
// typedef S SType;
|
||||
// SType *p;
|
||||
if (PointerType *ptrTy = ty->asPointerType()) {
|
||||
ty = ptrTy->elementType();
|
||||
}
|
||||
else if (PointerType *ptrTy = ty->asPointerType()) {
|
||||
// case when original type is a type and
|
||||
// typedef is for pointer of type
|
||||
// e.g.:
|
||||
// typedef S* SPTR;
|
||||
// SPTR p;
|
||||
ty = ptrTy->elementType();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ protected:
|
||||
|
||||
private:
|
||||
Scope *_scope;
|
||||
LookupContext _context;
|
||||
const LookupContext& _context;
|
||||
Bind bind;
|
||||
QList<LookupItem> _results;
|
||||
bool _reference;
|
||||
|
||||
@@ -190,16 +190,18 @@ void AndroidDeployStep::cleanLibsOnDevice()
|
||||
+ arguments.join(QLatin1String(" ")),
|
||||
Core::MessageManager::NoModeSwitch);
|
||||
process->start(adb, arguments);
|
||||
if (!process->waitForStarted(500))
|
||||
delete process;
|
||||
}
|
||||
|
||||
void AndroidDeployStep::cleanLibsFinished()
|
||||
{
|
||||
QProcess *process = qobject_cast<QProcess *>(sender());
|
||||
if (!process)
|
||||
return;
|
||||
QTC_ASSERT(process, return);
|
||||
Core::MessageManager::instance()->printToOutputPane(QString::fromLocal8Bit(process->readAll()), Core::MessageManager::NoModeSwitch);
|
||||
Core::MessageManager::instance()->printToOutputPane(tr("adb finished with exit code %1.").arg(process->exitCode()),
|
||||
Core::MessageManager::NoModeSwitch);
|
||||
process->deleteLater();
|
||||
}
|
||||
|
||||
void AndroidDeployStep::setDeployAction(AndroidDeployStep::AndroidDeployAction deploy)
|
||||
|
||||
@@ -757,7 +757,7 @@ QStringList AndroidManager::availablePrebundledLibs(ProjectExplorer::Target *tar
|
||||
|
||||
foreach (Qt4ProjectManager::Qt4ProFileNode *node, qt4Project->allProFiles())
|
||||
if (node->projectType() == Qt4ProjectManager::LibraryTemplate)
|
||||
libs << QLatin1String("lib") + node->targetInformation().target + QLatin1String(".so");
|
||||
libs << node->targetInformation().target;
|
||||
return libs;
|
||||
}
|
||||
|
||||
|
||||
@@ -290,14 +290,6 @@ void AndroidPackageCreationStep::checkRequiredLibraries()
|
||||
parseSharedLibs(readelfProc.readAll(), &libs);
|
||||
AndroidManager::setQtLibs(target(), requiredLibraries(AndroidManager::availableQtLibsWithDependencies(target()),
|
||||
AndroidManager::qtLibs(target()), libs));
|
||||
|
||||
QStringList checkedLibs = AndroidManager::prebundledLibs(target());
|
||||
QStringList prebundledLibraries;
|
||||
foreach (const QString &qtLib, AndroidManager::availableQtLibs(target())) {
|
||||
if (libs.contains(qtLib) || checkedLibs.contains(qtLib))
|
||||
prebundledLibraries << qtLib;
|
||||
}
|
||||
AndroidManager::setPrebundledLibs(target(), prebundledLibraries);
|
||||
emit updateRequiredLibrariesModels();
|
||||
}
|
||||
|
||||
@@ -348,14 +340,6 @@ void AndroidPackageCreationStep::checkRequiredLibrariesForRun()
|
||||
|
||||
QMetaObject::invokeMethod(this, "getBundleInformation");
|
||||
|
||||
QStringList prebundledLibraries;
|
||||
foreach (const AndroidManager::Library &qtLib, m_availableQtLibs) {
|
||||
if (libs.contains(qtLib.name) || m_prebundledLibs.contains(qtLib.name))
|
||||
prebundledLibraries << qtLib.name;
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(this, "setPrebundledLibs", Qt::BlockingQueuedConnection,
|
||||
Q_ARG(QStringList, prebundledLibraries));
|
||||
emit updateRequiredLibrariesModels();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,34 +70,23 @@ using namespace Bazaar::Internal;
|
||||
using namespace Bazaar;
|
||||
|
||||
static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
|
||||
{
|
||||
VcsBase::RegularCommandOutput, //type
|
||||
Constants::COMMANDLOG_ID, // id
|
||||
Constants::COMMANDLOG_DISPLAY_NAME, // display name
|
||||
Constants::COMMANDLOG, // context
|
||||
Constants::COMMANDAPP, // mime type
|
||||
Constants::COMMANDEXT}, //extension
|
||||
|
||||
{ VcsBase::LogOutput,
|
||||
Constants::FILELOG_ID,
|
||||
Constants::FILELOG_DISPLAY_NAME,
|
||||
Constants::FILELOG,
|
||||
Constants::LOGAPP,
|
||||
Constants::LOGEXT},
|
||||
{ VcsBase::LogOutput, // type
|
||||
Constants::FILELOG_ID, // id
|
||||
Constants::FILELOG_DISPLAY_NAME, // display name
|
||||
Constants::FILELOG, // context
|
||||
Constants::LOGAPP}, // mime type
|
||||
|
||||
{ VcsBase::AnnotateOutput,
|
||||
Constants::ANNOTATELOG_ID,
|
||||
Constants::ANNOTATELOG_DISPLAY_NAME,
|
||||
Constants::ANNOTATELOG,
|
||||
Constants::ANNOTATEAPP,
|
||||
Constants::ANNOTATEEXT},
|
||||
Constants::ANNOTATEAPP},
|
||||
|
||||
{ VcsBase::DiffOutput,
|
||||
Constants::DIFFLOG_ID,
|
||||
Constants::DIFFLOG_DISPLAY_NAME,
|
||||
Constants::DIFFLOG,
|
||||
Constants::DIFFAPP,
|
||||
Constants::DIFFEXT}
|
||||
Constants::DIFFAPP}
|
||||
};
|
||||
|
||||
static const VcsBase::VcsBaseSubmitEditorParameters submitEditorParameters = {
|
||||
|
||||
@@ -46,34 +46,25 @@ const char CHANGESET_ID_EXACT[] = "([.0-9]+)";
|
||||
const char ANNOTATE_CHANGESET_ID[] = "([.0-9]+)";
|
||||
|
||||
// Base editor parameters
|
||||
const char COMMANDLOG_ID[] = "Bazaar Command Log Editor";
|
||||
const char COMMANDLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar Command Log Editor");
|
||||
const char COMMANDLOG[] = "Bazaar Command Log Editor";
|
||||
const char COMMANDAPP[] = "application/vnd.nokia.text.scs_bazaar_commandlog";
|
||||
const char COMMANDEXT[] = "vcsBazaarCommand";
|
||||
|
||||
const char FILELOG_ID[] = "Bazaar File Log Editor";
|
||||
const char FILELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar File Log Editor");
|
||||
const char FILELOG[] = "Bazaar File Log Editor";
|
||||
const char LOGAPP[] = "application/vnd.nokia.text.scs_bazaar_log";
|
||||
const char LOGEXT[] = "vcsBazaarLog";
|
||||
const char LOGAPP[] = "text/vnd.qtcreator.bazaar.log";
|
||||
|
||||
const char ANNOTATELOG_ID[] = "Bazaar Annotation Editor";
|
||||
const char ANNOTATELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar Annotation Editor");
|
||||
const char ANNOTATELOG[] = "Bazaar Annotation Editor";
|
||||
const char ANNOTATEAPP[] = "application/vnd.nokia.text.scs_bazaar_annotatelog";
|
||||
const char ANNOTATEEXT[] = "vcsBazaarAnnotate";
|
||||
const char ANNOTATEAPP[] = "text/vnd.qtcreator.bazaar.annotation";
|
||||
|
||||
const char DIFFLOG_ID[] = "Bazaar Diff Editor";
|
||||
const char DIFFLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar Diff Editor");
|
||||
const char DIFFLOG[] = "Bazaar Diff Editor";
|
||||
const char DIFFAPP[] = "text/x-patch";
|
||||
const char DIFFEXT[] = "diff";
|
||||
|
||||
// Submit editor parameters
|
||||
const char COMMIT_ID[] = "Bazaar Commit Log Editor";
|
||||
const char COMMIT_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Bazaar Commit Log Editor");
|
||||
const char COMMITMIMETYPE[] = "application/vnd.nokia.text.scs_bazaar_commitlog";
|
||||
const char COMMITMIMETYPE[] = "text/vnd.qtcreator.bazaar.commit";
|
||||
|
||||
// Menu items
|
||||
// File menu actions
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace ClearCase {
|
||||
namespace Constants {
|
||||
|
||||
const char VCS_ID_CLEARCASE[] = "E.ClearCase";
|
||||
const char CLEARCASE_SUBMIT_MIMETYPE[] = "application/vnd.audc.text.clearcase.submit";
|
||||
const char CLEARCASE_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.clearcase.submit";
|
||||
const char CLEARCASECHECKINEDITOR[] = "ClearCase Check In Editor";
|
||||
const char CLEARCASECHECKINEDITOR_ID[] = "ClearCase Check In Editor";
|
||||
const char CLEARCASECHECKINEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "ClearCase Check In Editor");
|
||||
|
||||
@@ -121,29 +121,21 @@ static const char CMD_ID_STATUS[] = "ClearCase.Status";
|
||||
|
||||
static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
|
||||
{
|
||||
VcsBase::RegularCommandOutput,
|
||||
"ClearCase Command Log Editor", // id
|
||||
QT_TRANSLATE_NOOP("VCS", "ClearCase Command Log Editor"), // display name
|
||||
"ClearCase Command Log Editor", // context
|
||||
"application/vnd.audc.text.scs_cc_commandlog",
|
||||
"scslog"},
|
||||
{ VcsBase::LogOutput,
|
||||
VcsBase::LogOutput,
|
||||
"ClearCase File Log Editor", // id
|
||||
QT_TRANSLATE_NOOP("VCS", "ClearCase File Log Editor"), // display_name
|
||||
"ClearCase File Log Editor", // context
|
||||
"application/vnd.audc.text.scs_cc_filelog",
|
||||
"scsfilelog"},
|
||||
"text/vnd.qtcreator.clearcase.log"},
|
||||
{ VcsBase::AnnotateOutput,
|
||||
"ClearCase Annotation Editor", // id
|
||||
QT_TRANSLATE_NOOP("VCS", "ClearCase Annotation Editor"), // display_name
|
||||
"ClearCase Annotation Editor", // context
|
||||
"application/vnd.audc.text.scs_cc_annotation",
|
||||
"scsannotate"},
|
||||
"text/vnd.qtcreator.clearcase.annotation"},
|
||||
{ VcsBase::DiffOutput,
|
||||
"ClearCase Diff Editor", // id
|
||||
QT_TRANSLATE_NOOP("VCS", "ClearCase Diff Editor"), // display_name
|
||||
"ClearCase Diff Editor", // context
|
||||
"text/x-patch","diff"}
|
||||
"text/x-patch"}
|
||||
};
|
||||
|
||||
// Utility to find a parameter set by type
|
||||
|
||||
@@ -178,6 +178,9 @@ QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, N
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||
if (!tc)
|
||||
return results;
|
||||
Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k);
|
||||
if (deviceType != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||
return results;
|
||||
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
||||
if (n != ForceNinja) {
|
||||
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
||||
|
||||
@@ -149,15 +149,12 @@ EditorManagerPlaceHolder::~EditorManagerPlaceHolder()
|
||||
|
||||
void EditorManagerPlaceHolder::currentModeChanged(Core::IMode *mode)
|
||||
{
|
||||
if (m_current == this) {
|
||||
m_current = 0;
|
||||
EditorManager::instance()->setParent(0);
|
||||
EditorManager::instance()->hide();
|
||||
}
|
||||
if (m_mode == mode) {
|
||||
m_current = this;
|
||||
layout()->addWidget(EditorManager::instance());
|
||||
EditorManager::instance()->show();
|
||||
} else if (m_current == this) {
|
||||
m_current = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -898,11 +895,11 @@ void EditorManager::rootDestroyed(QObject *root)
|
||||
for (int i = 0; i < d->m_root.size(); ++i) {
|
||||
SplitterOrView *r = d->m_root.at(i);
|
||||
if (r == root) {
|
||||
d->m_root.removeAll(r);
|
||||
IContext *context = d->m_rootContext.at(i);
|
||||
d->m_root.removeAt(i);
|
||||
IContext *context = d->m_rootContext.takeAt(i);
|
||||
ICore::removeContextObject(context);
|
||||
delete context;
|
||||
|
||||
--i; // we removed the current one
|
||||
} else if (r->window() == activeWin) {
|
||||
newActiveRoot = r;
|
||||
}
|
||||
@@ -2065,12 +2062,27 @@ void EditorManager::showPopupOrSelectDocument() const
|
||||
if (QApplication::keyboardModifiers() == Qt::NoModifier) {
|
||||
windowPopup()->selectAndHide();
|
||||
} else {
|
||||
// EditorManager is invisible when invoked from Design Mode.
|
||||
const QPoint p = isVisible() ?
|
||||
mapToGlobal(QPoint(0, 0)) :
|
||||
ICore::mainWindow()->mapToGlobal(QPoint(0, 0));
|
||||
windowPopup()->move((width()-d->m_windowPopup->width())/2 + p.x(),
|
||||
(height()-d->m_windowPopup->height())/2 + p.y());
|
||||
QWidget *activeWindow = qApp->activeWindow();
|
||||
// decide where to show the popup
|
||||
// if the active window has editors, we want that root as a reference
|
||||
SplitterOrView *activeRoot = 0;
|
||||
foreach (SplitterOrView *root, d->m_root) {
|
||||
if (root->window() == activeWindow) {
|
||||
activeRoot = root;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// otherwise we take the "current" root
|
||||
if (!activeRoot)
|
||||
activeRoot = findRoot(currentEditorView());
|
||||
QTC_ASSERT(activeRoot, activeRoot = d->m_root.first());
|
||||
|
||||
// root in main window is invisible when invoked from Design Mode.
|
||||
QWidget *referenceWidget = activeRoot->isVisible() ? activeRoot : activeRoot->window();
|
||||
QTC_CHECK(referenceWidget->isVisible());
|
||||
const QPoint p = referenceWidget->mapToGlobal(QPoint(0, 0));
|
||||
windowPopup()->move((referenceWidget->width() - d->m_windowPopup->width()) / 2 + p.x(),
|
||||
(referenceWidget->height() - d->m_windowPopup->height()) / 2 + p.y());
|
||||
windowPopup()->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ bool MimeGlobPattern::matches(const QString &fileName) const
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<!-- Mime types must match the desktop file associations -->
|
||||
<mime-type type="application/vnd.nokia.qt.qmakeprofile">
|
||||
<mime-type type="application/vnd.qt.qmakeprofile">
|
||||
<comment xml:lang="en">Qt qmake Profile</comment>
|
||||
<glob pattern="*.pro" weight="50"/>
|
||||
</mime-type>
|
||||
|
||||
@@ -562,8 +562,12 @@ CPPEditorWidget::CPPEditorWidget(QWidget *parent)
|
||||
|
||||
CPPEditorWidget::~CPPEditorWidget()
|
||||
{
|
||||
if (m_modelManager)
|
||||
m_modelManager->deleteEditorSupport(editor());
|
||||
|
||||
++numberOfClosedEditors;
|
||||
if (numberOfClosedEditors == 5) {
|
||||
if (m_modelManager)
|
||||
m_modelManager->GC();
|
||||
numberOfClosedEditors = 0;
|
||||
}
|
||||
@@ -1876,10 +1880,11 @@ Core::Id CPPEditor::id() const
|
||||
|
||||
bool CPPEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||
{
|
||||
bool b = TextEditor::BaseTextEditor::open(errorString, fileName, realFileName);
|
||||
if (!TextEditor::BaseTextEditor::open(errorString, fileName, realFileName))
|
||||
return false;
|
||||
editorWidget()->setMimeType(
|
||||
Core::ICore::mimeDatabase()->findByFile(QFileInfo(fileName)).type());
|
||||
return b;
|
||||
return true;
|
||||
}
|
||||
|
||||
const Utils::CommentDefinition *CPPEditor::commentDefinition() const
|
||||
|
||||
@@ -158,6 +158,7 @@ private slots:
|
||||
void test_quickfix_InsertDefFromDecl_freeFunction();
|
||||
void test_quickfix_InsertDefFromDecl_insideClass();
|
||||
void test_quickfix_InsertDefFromDecl_notTriggeringWhenDefinitionExists();
|
||||
void test_quickfix_InsertDefFromDecl_notTriggeringStatement();
|
||||
|
||||
void test_quickfix_InsertDeclFromDef();
|
||||
|
||||
@@ -199,6 +200,7 @@ private slots:
|
||||
void test_quickfix_AssignToLocalVariable_noFunctionInExpression();
|
||||
void test_quickfix_AssignToLocalVariable_noReturnClass();
|
||||
void test_quickfix_AssignToLocalVariable_noReturnFunc();
|
||||
void test_quickfix_AssignToLocalVariable_noSignatureMatch();
|
||||
|
||||
void test_quickfix_InsertVirtualMethods_onlyDecl();
|
||||
void test_quickfix_InsertVirtualMethods_onlyDeclWithoutVirtual();
|
||||
@@ -211,6 +213,7 @@ private slots:
|
||||
void test_quickfix_InsertVirtualMethods_outside();
|
||||
void test_quickfix_InsertVirtualMethods_implementationFile();
|
||||
void test_quickfix_InsertVirtualMethods_notrigger_allImplemented();
|
||||
void test_quickfix_InsertVirtualMethods_BaseClassInNamespace();
|
||||
|
||||
// The following tests depend on the projects that are loaded on startup
|
||||
// and will be skipped in case no projects are loaded.
|
||||
|
||||
@@ -908,6 +908,24 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_notTriggeringWhenDefinitio
|
||||
data.run(&factory, 1);
|
||||
}
|
||||
|
||||
/// Check not triggering when it is a statement
|
||||
void CppEditorPlugin::test_quickfix_InsertDefFromDecl_notTriggeringStatement()
|
||||
{
|
||||
const QByteArray original =
|
||||
"class Foo {\n"
|
||||
"public:\n"
|
||||
" Foo() {}\n"
|
||||
"};\n"
|
||||
"void freeFunc() {\n"
|
||||
" Foo @f();"
|
||||
"}\n";
|
||||
const QByteArray expected = original + "\n";
|
||||
|
||||
InsertDefFromDecl factory;
|
||||
TestCase data(original, expected);
|
||||
data.run(&factory);
|
||||
}
|
||||
|
||||
// Function for one of InsertDeclDef section cases
|
||||
void insertToSectionDeclFromDef(const QByteArray §ion, int sectionIndex)
|
||||
{
|
||||
@@ -2026,6 +2044,23 @@ void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noReturnFunc()
|
||||
data.run(&factory);
|
||||
}
|
||||
|
||||
/// Check: No trigger for functions which does not match in signature.
|
||||
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_noSignatureMatch()
|
||||
{
|
||||
const QByteArray original =
|
||||
"int someFunc(int);\n"
|
||||
"\n"
|
||||
"void f()\n"
|
||||
"{\n"
|
||||
" some@Func();\n"
|
||||
"}";
|
||||
const QByteArray expected = original + "\n";
|
||||
|
||||
AssignToLocalVariable factory;
|
||||
TestCase data(original, expected);
|
||||
data.run(&factory);
|
||||
}
|
||||
|
||||
/// Test dialog for insert virtual functions
|
||||
class InsertVirtualMethodsDialogTest : public InsertVirtualMethodsDialog
|
||||
{
|
||||
@@ -2442,3 +2477,56 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_notrigger_allImplemente
|
||||
TestCase data(original, expected);
|
||||
data.run(&factory);
|
||||
}
|
||||
|
||||
/// Check: Qualified names.
|
||||
void CppEditorPlugin::test_quickfix_InsertVirtualMethods_BaseClassInNamespace()
|
||||
{
|
||||
QList<TestDocumentPtr> testFiles;
|
||||
QByteArray original;
|
||||
QByteArray expected;
|
||||
|
||||
// Header File
|
||||
original =
|
||||
"namespace BaseNS {enum BaseEnum {EnumA = 1};}\n"
|
||||
"namespace BaseNS {\n"
|
||||
"class Base {\n"
|
||||
"public:\n"
|
||||
" virtual BaseEnum a(BaseEnum e);\n"
|
||||
"};\n"
|
||||
"}\n"
|
||||
"class Deri@ved : public BaseNS::Base {\n"
|
||||
"public:\n"
|
||||
" Derived();\n"
|
||||
"};";
|
||||
expected =
|
||||
"namespace BaseNS {enum BaseEnum {EnumA = 1};}\n"
|
||||
"namespace BaseNS {\n"
|
||||
"class Base {\n"
|
||||
"public:\n"
|
||||
" virtual BaseEnum a(BaseEnum e);\n"
|
||||
"};\n"
|
||||
"}\n"
|
||||
"class Deri@ved : public BaseNS::Base {\n"
|
||||
"public:\n"
|
||||
" Derived();\n"
|
||||
"\n"
|
||||
" // Base interface\n"
|
||||
"public:\n"
|
||||
" virtual BaseNS::BaseEnum a(BaseNS::BaseEnum e);\n"
|
||||
"};\n";
|
||||
testFiles << TestDocument::create(original, expected, QLatin1String("file.h"));
|
||||
|
||||
// Source File
|
||||
original = "#include \"file.h\"\n";
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n\n"
|
||||
"BaseNS::BaseEnum Derived::a(BaseNS::BaseEnum e)\n"
|
||||
"{\n}\n";
|
||||
testFiles << TestDocument::create(original, expected, QLatin1String("file.cpp"));
|
||||
|
||||
InsertVirtualMethods factory(new InsertVirtualMethodsDialogTest(
|
||||
InsertVirtualMethodsDialog::ModeImplementationFile, true));
|
||||
TestCase data(testFiles);
|
||||
data.run(&factory);
|
||||
}
|
||||
|
||||
@@ -2609,6 +2609,8 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
for (; idx >= 0; --idx) {
|
||||
AST *node = path.at(idx);
|
||||
if (SimpleDeclarationAST *simpleDecl = node->asSimpleDeclaration()) {
|
||||
if (idx > 0 && path.at(idx - 1)->asStatement())
|
||||
return;
|
||||
if (simpleDecl->symbols && ! simpleDecl->symbols->next) {
|
||||
if (Symbol *symbol = simpleDecl->symbols->value) {
|
||||
if (Declaration *decl = symbol->asDeclaration()) {
|
||||
@@ -4279,13 +4281,21 @@ void AssignToLocalVariable::match(const CppQuickFixInterface &interface, QuickFi
|
||||
TypeOfExpression typeOfExpression;
|
||||
typeOfExpression.init(interface->semanticInfo().doc, interface->snapshot(),
|
||||
interface->context().bindings());
|
||||
|
||||
// If items are empty, AssignToLocalVariableOperation will fail.
|
||||
items = typeOfExpression(file->textOf(outerAST).toUtf8(),
|
||||
file->scopeAt(outerAST->firstToken()),
|
||||
TypeOfExpression::Preprocess);
|
||||
if (items.isEmpty())
|
||||
return;
|
||||
|
||||
if (CallAST *callAST = outerAST->asCall()) {
|
||||
Scope *scope = file->scopeAt(callAST->base_expression->firstToken());
|
||||
items = typeOfExpression(file->textOf(callAST->base_expression).toUtf8(), scope,
|
||||
items = typeOfExpression(file->textOf(callAST->base_expression).toUtf8(),
|
||||
file->scopeAt(callAST->base_expression->firstToken()),
|
||||
TypeOfExpression::Preprocess);
|
||||
} else {
|
||||
Scope *scope = file->scopeAt(nameAST->firstToken());
|
||||
items = typeOfExpression(file->textOf(nameAST).toUtf8(), scope,
|
||||
items = typeOfExpression(file->textOf(nameAST).toUtf8(),
|
||||
file->scopeAt(nameAST->firstToken()),
|
||||
TypeOfExpression::Preprocess);
|
||||
}
|
||||
|
||||
@@ -4400,6 +4410,10 @@ public:
|
||||
itemBase->setData(qVariantFromValue((void *) clazz),
|
||||
InsertVirtualMethodsDialog::ClassOrFunction);
|
||||
const QString baseClassName = printer.prettyName(clazz->name());
|
||||
const Qt::CheckState funcItemsCheckState = (baseClassName != QLatin1String("QObject")
|
||||
&& baseClassName != QLatin1String("QWidget")
|
||||
&& baseClassName != QLatin1String("QPaintDevice"))
|
||||
? Qt::Checked : Qt::Unchecked;
|
||||
for (Scope::iterator it = clazz->firstMember(); it != clazz->lastMember(); ++it) {
|
||||
if (const Function *func = (*it)->type()->asFunctionType()) {
|
||||
if (!func->isVirtual())
|
||||
@@ -4482,6 +4496,7 @@ public:
|
||||
funcItem->setData(isPureVirtual, InsertVirtualMethodsDialog::PureVirtual);
|
||||
funcItem->setData(acessSpec(*it), InsertVirtualMethodsDialog::AccessSpec);
|
||||
funcItem->setData(funcExistsInClass, InsertVirtualMethodsDialog::Implemented);
|
||||
funcItem->setCheckState(funcItemsCheckState);
|
||||
|
||||
itemBase->appendRow(funcItem);
|
||||
|
||||
@@ -4495,13 +4510,17 @@ public:
|
||||
if (itemBase->hasChildren()) {
|
||||
for (int i = 0; i < itemBase->rowCount(); ++i) {
|
||||
if (itemBase->child(i, 0)->isCheckable()) {
|
||||
if (!itemBase->isCheckable()) {
|
||||
itemBase->setCheckable(true);
|
||||
itemBase->setTristate(true);
|
||||
itemBase->setCheckState(Qt::Checked);
|
||||
itemBase->setData(false, InsertVirtualMethodsDialog::Implemented);
|
||||
}
|
||||
if (itemBase->child(i, 0)->checkState() == Qt::Checked) {
|
||||
itemBase->setCheckState(Qt::Checked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_factory->classFunctionModel->invisibleRootItem()->appendRow(itemBase);
|
||||
}
|
||||
}
|
||||
@@ -4575,12 +4594,23 @@ public:
|
||||
QLatin1String("QuickFix/InsertVirtualMethods/hideReimplementedFunctions"),
|
||||
m_factory->hideReimplementedFunctions());
|
||||
|
||||
// Insert declarations (and definition if InsideClass)
|
||||
// Insert declarations (and definition if Inside-/OutsideClass)
|
||||
Overview printer = CppCodeStyleSettings::currentProjectCodeStyleOverview();
|
||||
printer.showFunctionSignatures = true;
|
||||
printer.showReturnTypes = true;
|
||||
printer.showArgumentNames = true;
|
||||
ChangeSet headerChangeSet;
|
||||
const CppRefactoringChanges refactoring(assistInterface()->snapshot());
|
||||
const QString filename = assistInterface()->currentFile()->fileName();
|
||||
const CppRefactoringFilePtr headerFile = refactoring.file(filename);
|
||||
const LookupContext targetContext(headerFile->cppDocument(), assistInterface()->snapshot());
|
||||
|
||||
const Class *targetClass = m_classAST->symbol;
|
||||
ClassOrNamespace *targetCoN = targetContext.lookupType(targetClass->scope());
|
||||
if (!targetCoN)
|
||||
targetCoN = targetContext.globalNamespace();
|
||||
UseMinimalNames useMinimalNames(targetCoN);
|
||||
Control *control = assistInterface()->context().bindings()->control().data();
|
||||
for (int i = 0; i < m_factory->classFunctionModel->rowCount(); ++i) {
|
||||
const QStandardItem *parent =
|
||||
m_factory->classFunctionModel->invisibleRootItem()->child(i, 0);
|
||||
@@ -4604,11 +4634,23 @@ public:
|
||||
item->data(InsertVirtualMethodsDialog::ClassOrFunction).value<void *>();
|
||||
|
||||
// Construct declaration
|
||||
QString declaration = InsertDeclOperation::generateDeclaration(func);
|
||||
// setup rewriting to get minimally qualified names
|
||||
SubstitutionEnvironment env;
|
||||
env.setContext(assistInterface()->context());
|
||||
env.switchScope(clazz->enclosingScope());
|
||||
env.enter(&useMinimalNames);
|
||||
|
||||
QString declaration;
|
||||
const FullySpecifiedType tn = rewriteType(func->type(), &env, control);
|
||||
declaration += printer.prettyType(tn, func->unqualifiedName());
|
||||
|
||||
if (m_factory->insertKeywordVirtual())
|
||||
declaration = QLatin1String("virtual ") + declaration;
|
||||
if (m_factory->implementationMode() & InsertVirtualMethodsDialog::ModeInsideClass)
|
||||
declaration.replace(declaration.size() - 2, 2, QLatin1String("\n{\n}\n"));
|
||||
declaration += QLatin1String("\n{\n}\n");
|
||||
else
|
||||
declaration += QLatin1String(";\n");
|
||||
|
||||
const InsertionPointLocator::AccessSpec spec =
|
||||
static_cast<InsertionPointLocator::AccessSpec>(
|
||||
item->data(InsertVirtualMethodsDialog::AccessSpec).toInt());
|
||||
@@ -4620,54 +4662,12 @@ public:
|
||||
lastAccessSpecString = accessSpecString;
|
||||
}
|
||||
headerChangeSet.insert(m_insertPosDecl, declaration);
|
||||
}
|
||||
}
|
||||
|
||||
// Insert outside class
|
||||
const QString filename = assistInterface()->currentFile()->fileName();
|
||||
const CppRefactoringChanges refactoring(assistInterface()->snapshot());
|
||||
const CppRefactoringFilePtr headerFile = refactoring.file(filename);
|
||||
const Document::Ptr headerDoc = headerFile->cppDocument();
|
||||
Class *targetClass = m_classAST->symbol;
|
||||
// Insert definition outside class
|
||||
if (m_factory->implementationMode() & InsertVirtualMethodsDialog::ModeOutsideClass) {
|
||||
// make target lookup context
|
||||
unsigned line, column;
|
||||
headerDoc->translationUnit()->getPosition(m_insertPosOutside, &line, &column);
|
||||
Scope *targetScope = headerDoc->scopeAt(line, column);
|
||||
const LookupContext targetContext(headerDoc, assistInterface()->snapshot());
|
||||
ClassOrNamespace *targetCoN = targetContext.lookupType(targetScope);
|
||||
if (!targetCoN)
|
||||
targetCoN = targetContext.globalNamespace();
|
||||
|
||||
// setup rewriting to get minimally qualified names
|
||||
SubstitutionEnvironment env;
|
||||
env.setContext(assistInterface()->context());
|
||||
env.switchScope(targetClass);
|
||||
UseMinimalNames q(targetCoN);
|
||||
env.enter(&q);
|
||||
Control *control = assistInterface()->context().bindings()->control().data();
|
||||
const QString fullClassName = printer.prettyName(LookupContext::minimalName(
|
||||
targetClass, targetCoN, control));
|
||||
|
||||
for (int i = 0; i < m_factory->classFunctionModel->rowCount(); ++i) {
|
||||
const QStandardItem *parent =
|
||||
m_factory->classFunctionModel->invisibleRootItem()->child(i, 0);
|
||||
if (!parent->isCheckable() || parent->checkState() == Qt::Unchecked)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < parent->rowCount(); ++j) {
|
||||
const QStandardItem *item = parent->child(j, 0);
|
||||
if (!item->isCheckable() || item->checkState() == Qt::Unchecked)
|
||||
continue;
|
||||
const Function *func = (const Function *)
|
||||
item->data(InsertVirtualMethodsDialog::ClassOrFunction).value<void *>();
|
||||
|
||||
// rewrite the function type and name
|
||||
const FullySpecifiedType tn = rewriteType(func->type(), &env, control);
|
||||
const QString name = fullClassName + QLatin1String("::") +
|
||||
printer.prettyName(func->name());
|
||||
const QString name = printer.prettyName(targetClass->name()) +
|
||||
QLatin1String("::") + printer.prettyName(func->name());
|
||||
const QString defText = printer.prettyType(tn, name) + QLatin1String("\n{\n}");
|
||||
|
||||
headerChangeSet.insert(m_insertPosOutside, QLatin1String("\n\n") + defText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,6 +408,14 @@ Scope *CheckSymbols::enclosingScope() const
|
||||
if (funDef->symbol)
|
||||
return funDef->symbol;
|
||||
|
||||
} else if (TemplateDeclarationAST *templateDeclaration = ast->asTemplateDeclaration()) {
|
||||
if (DeclarationAST *decl = templateDeclaration->declaration) {
|
||||
if (FunctionDefinitionAST *funDef = decl->asFunctionDefinition()) {
|
||||
if (funDef->symbol)
|
||||
return funDef->symbol;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (CompoundStatementAST *blockStmt = ast->asCompoundStatement()) {
|
||||
if (blockStmt->symbol)
|
||||
return blockStmt->symbol;
|
||||
@@ -869,7 +877,12 @@ ClassOrNamespace *CheckSymbols::checkNestedName(QualifiedNameAST *ast)
|
||||
|
||||
const Name *name = class_or_namespace_name->name;
|
||||
binding = _context.lookupType(name, enclosingScope());
|
||||
if (binding)
|
||||
addType(binding, class_or_namespace_name);
|
||||
else
|
||||
// for the case when we use template parameter as qualifier
|
||||
// e.g.: template <typename T> void fun() { T::type type; }
|
||||
accept(nested_name_specifier->class_or_namespace_name);
|
||||
|
||||
for (it = it->next; it; it = it->next) {
|
||||
NestedNameSpecifierAST *nested_name_specifier = it->value;
|
||||
|
||||
@@ -1473,7 +1473,61 @@ void CppToolsPlugin::test_completion_member_access_operator_1()
|
||||
QVERIFY(replaceAccessOperator);
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_typedef_of_type_and_replace_access_operator()
|
||||
void CppToolsPlugin::test_completion_typedef_of_type_and_decl_of_type_no_replace_access_operator()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText = "\n"
|
||||
"struct S { int m; };\n"
|
||||
"typedef S SType;\n"
|
||||
"SType p;\n"
|
||||
"@\n"
|
||||
"}\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("p.");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
bool replaceAccessOperator = false;
|
||||
QStringList completions = getCompletions(data, &replaceAccessOperator);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("S")));
|
||||
QVERIFY(completions.contains(QLatin1String("m")));
|
||||
QVERIFY(! replaceAccessOperator);
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_typedef_of_pointer_and_decl_of_pointer_no_replace_access_operator()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText = "\n"
|
||||
"struct S { int m; };\n"
|
||||
"typedef S *SType;\n"
|
||||
"SType *p;\n"
|
||||
"@\n"
|
||||
"}\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("p.");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
bool replaceAccessOperator = false;
|
||||
QStringList completions = getCompletions(data, &replaceAccessOperator);
|
||||
|
||||
QCOMPARE(completions.size(), 0);
|
||||
QVERIFY(! replaceAccessOperator);
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_typedef_of_type_and_decl_of_pointer_replace_access_operator()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText = "\n"
|
||||
@@ -1501,7 +1555,7 @@ void CppToolsPlugin::test_completion_typedef_of_type_and_replace_access_operator
|
||||
QVERIFY(replaceAccessOperator);
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_typedef_of_pointer_of_type_and_replace_access_operator()
|
||||
void CppToolsPlugin::test_completion_typedef_of_pointer_and_decl_of_type_replace_access_operator()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText = "\n"
|
||||
@@ -1529,6 +1583,116 @@ void CppToolsPlugin::test_completion_typedef_of_pointer_of_type_and_replace_acce
|
||||
QVERIFY(replaceAccessOperator);
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_predecl_typedef_of_type_and_decl_of_pointer_replace_access_operator()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText = "\n"
|
||||
"typedef struct S SType;\n"
|
||||
"struct S { int m; };\n"
|
||||
"SType *p;\n"
|
||||
"@\n"
|
||||
"}\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("p.");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
bool replaceAccessOperator = false;
|
||||
QStringList completions = getCompletions(data, &replaceAccessOperator);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("S")));
|
||||
QVERIFY(completions.contains(QLatin1String("m")));
|
||||
QVERIFY(replaceAccessOperator);
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_predecl_typedef_of_type_and_decl_type_no_replace_access_operator()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText = "\n"
|
||||
"typedef struct S SType;\n"
|
||||
"struct S { int m; };\n"
|
||||
"SType p;\n"
|
||||
"@\n"
|
||||
"}\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("p.");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
bool replaceAccessOperator = false;
|
||||
QStringList completions = getCompletions(data, &replaceAccessOperator);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("S")));
|
||||
QVERIFY(completions.contains(QLatin1String("m")));
|
||||
QVERIFY(! replaceAccessOperator);
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_predecl_typedef_of_pointer_and_decl_of_pointer_no_replace_access_operator()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText = "\n"
|
||||
"typedef struct S *SType;\n"
|
||||
"struct S { int m; };\n"
|
||||
"SType *p;\n"
|
||||
"@\n"
|
||||
"}\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("p.");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
bool replaceAccessOperator = false;
|
||||
QStringList completions = getCompletions(data, &replaceAccessOperator);
|
||||
|
||||
QCOMPARE(completions.size(), 0);
|
||||
QVERIFY(! replaceAccessOperator);
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_predecl_typedef_of_pointer_and_decl_of_type_replace_access_operator()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText = "\n"
|
||||
"typedef struct S *SType;\n"
|
||||
"struct S { int m; };\n"
|
||||
"SType p;\n"
|
||||
"@\n"
|
||||
"}\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("p.");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
bool replaceAccessOperator = false;
|
||||
QStringList completions = getCompletions(data, &replaceAccessOperator);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("S")));
|
||||
QVERIFY(completions.contains(QLatin1String("m")));
|
||||
QVERIFY(replaceAccessOperator);
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_typedef_of_pointer()
|
||||
{
|
||||
TestData data;
|
||||
@@ -1744,7 +1908,6 @@ void CppToolsPlugin::test_completion_typedef_using_templates1()
|
||||
QVERIFY(completions.contains(QLatin1String("bar")));
|
||||
}
|
||||
|
||||
|
||||
void CppToolsPlugin::test_completion_typedef_using_templates2()
|
||||
{
|
||||
TestData data;
|
||||
@@ -2047,3 +2210,66 @@ void CppToolsPlugin::test_completion_instantiate_template_with_anonymous_class()
|
||||
QCOMPARE(completions.size(), 1);
|
||||
QVERIFY(completions.contains(QLatin1String("S")));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_instantiate_template_function()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText =
|
||||
"template <typename T>\n"
|
||||
"T* templateFunction() { return 0; }\n"
|
||||
"struct A { int a; };\n"
|
||||
"void foo()\n"
|
||||
"{\n"
|
||||
" @\n"
|
||||
" // padding so we get the scope right\n"
|
||||
"}\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("templateFunction<A>()->");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
QStringList completions = getCompletions(data);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("A")));
|
||||
QVERIFY(completions.contains(QLatin1String("a")));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_crash_cloning_template_class_QTCREATORBUG9329()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText =
|
||||
"struct A {};\n"
|
||||
"template <typename T>\n"
|
||||
"struct Templ {};\n"
|
||||
"struct B : A, Templ<A>\n"
|
||||
"{\n"
|
||||
" int f()\n"
|
||||
" {\n"
|
||||
" @\n"
|
||||
" // padding so we get the scope right\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("this->");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
QStringList completions = getCompletions(data);
|
||||
|
||||
QCOMPARE(completions.size(), 4);
|
||||
QVERIFY(completions.contains(QLatin1String("A")));
|
||||
QVERIFY(completions.contains(QLatin1String("B")));
|
||||
QVERIFY(completions.contains(QLatin1String("Templ")));
|
||||
QVERIFY(completions.contains(QLatin1String("f")));
|
||||
}
|
||||
|
||||
@@ -245,10 +245,6 @@ CppModelManager::CppModelManager(QObject *parent)
|
||||
|
||||
qRegisterMetaType<CPlusPlus::Document::Ptr>("CPlusPlus::Document::Ptr");
|
||||
|
||||
// Listen for editor closed events so that we can keep track of changing files
|
||||
connect(Core::ICore::editorManager(), SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
||||
|
||||
m_completionFallback = new InternalCompletionAssistProvider;
|
||||
m_completionAssistProvider = m_completionFallback;
|
||||
ExtensionSystem::PluginManager::addObject(m_completionAssistProvider);
|
||||
@@ -602,14 +598,13 @@ QList<ProjectPart::Ptr> CppModelManager::projectPart(const QString &fileName) co
|
||||
}
|
||||
|
||||
/// \brief Removes the CppEditorSupport for the closed editor.
|
||||
void CppModelManager::editorAboutToClose(Core::IEditor *editor)
|
||||
void CppModelManager::deleteEditorSupport(TextEditor::BaseTextEditor *textEditor)
|
||||
{
|
||||
if (!isCppEditor(editor))
|
||||
return;
|
||||
|
||||
TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor);
|
||||
QTC_ASSERT(textEditor, return);
|
||||
|
||||
if (!isCppEditor(textEditor))
|
||||
return;
|
||||
|
||||
QMutexLocker locker(&m_editorSupportMutex);
|
||||
CppEditorSupport *editorSupport = m_editorSupport.value(textEditor, 0);
|
||||
m_editorSupport.remove(textEditor);
|
||||
|
||||
@@ -87,6 +87,7 @@ public:
|
||||
virtual void addEditorSupport(AbstractEditorSupport *editorSupport);
|
||||
virtual void removeEditorSupport(AbstractEditorSupport *editorSupport);
|
||||
virtual CppEditorSupport *cppEditorSupport(TextEditor::BaseTextEditor *editor);
|
||||
virtual void deleteEditorSupport(TextEditor::BaseTextEditor *textEditor);
|
||||
|
||||
virtual QList<int> references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
|
||||
|
||||
@@ -139,7 +140,6 @@ Q_SIGNALS:
|
||||
void aboutToRemoveFiles(const QStringList &files);
|
||||
|
||||
public Q_SLOTS:
|
||||
void editorAboutToClose(Core::IEditor *editor);
|
||||
virtual void updateModifiedSourceFiles();
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
@@ -32,8 +32,9 @@
|
||||
#include "cpppreprocessor.h"
|
||||
#include "modelmanagertesthelper.h"
|
||||
|
||||
#include <QtTest>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QtTest>
|
||||
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
@@ -44,31 +45,57 @@ typedef CppTools::ProjectFile ProjectFile;
|
||||
typedef ProjectExplorer::Project Project;
|
||||
|
||||
namespace {
|
||||
QString testDataDir(const QString& subdir, bool cleaned = true)
|
||||
|
||||
class TestDataDirectory
|
||||
{
|
||||
QString path = QLatin1String(SRCDIR "/../../../tests/cppmodelmanager/testdata");
|
||||
public:
|
||||
TestDataDirectory(const QString &testDataDirectory)
|
||||
: m_testDataDirectory(QLatin1String(SRCDIR "/../../../tests/cppmodelmanager/")
|
||||
+ testDataDirectory)
|
||||
{
|
||||
QFileInfo testDataDir(m_testDataDirectory);
|
||||
QVERIFY(testDataDir.exists());
|
||||
QVERIFY(testDataDir.isDir());
|
||||
}
|
||||
|
||||
|
||||
QString includeDir(bool cleaned = true) const
|
||||
{
|
||||
return testDataDir(QLatin1String("include"), cleaned);
|
||||
}
|
||||
|
||||
QString frameworksDir(bool cleaned = true) const
|
||||
{
|
||||
return testDataDir(QLatin1String("frameworks"), cleaned);
|
||||
}
|
||||
|
||||
QString fileFromSourcesDir(const QString &fileName) const
|
||||
{
|
||||
return testDataDir(QLatin1String("sources")) + fileName;
|
||||
}
|
||||
|
||||
/// File from the test data directory (top leve)
|
||||
QString file(const QString &fileName) const
|
||||
{
|
||||
return testDataDir(QString()) + fileName;
|
||||
}
|
||||
|
||||
private:
|
||||
QString testDataDir(const QString& subdir, bool cleaned = true) const
|
||||
{
|
||||
QString path = m_testDataDirectory;
|
||||
if (!subdir.isEmpty())
|
||||
path += QLatin1String("/") + subdir;
|
||||
if (cleaned)
|
||||
return CppPreprocessor::cleanPath(path);
|
||||
else
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
QString testIncludeDir(bool cleaned = true)
|
||||
{
|
||||
return testDataDir(QLatin1String("include"), cleaned);
|
||||
}
|
||||
private:
|
||||
const QString m_testDataDirectory;
|
||||
};
|
||||
|
||||
QString testFrameworksDir(bool cleaned = true)
|
||||
{
|
||||
return testDataDir(QLatin1String("frameworks"), cleaned);
|
||||
}
|
||||
|
||||
QString testSource(const QString &fileName)
|
||||
{
|
||||
return testDataDir(QLatin1String("sources")) + fileName;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
void CppToolsPlugin::test_modelmanager_paths()
|
||||
@@ -76,6 +103,8 @@ void CppToolsPlugin::test_modelmanager_paths()
|
||||
ModelManagerTestHelper helper;
|
||||
CppModelManager *mm = CppModelManager::instance();
|
||||
|
||||
const TestDataDirectory testDataDir(QLatin1String("testdata"));
|
||||
|
||||
Project *project = helper.createProject(QLatin1String("test_modelmanager_paths"));
|
||||
ProjectInfo pi = mm->projectInfo(project);
|
||||
QCOMPARE(pi.project().data(), project);
|
||||
@@ -85,18 +114,18 @@ void CppToolsPlugin::test_modelmanager_paths()
|
||||
part->cxxVersion = ProjectPart::CXX98;
|
||||
part->qtVersion = ProjectPart::Qt5;
|
||||
part->defines = QByteArray("#define OH_BEHAVE -1\n");
|
||||
part->includePaths = QStringList() << testIncludeDir(false);
|
||||
part->frameworkPaths = QStringList() << testFrameworksDir(false);
|
||||
part->includePaths = QStringList() << testDataDir.includeDir(false);
|
||||
part->frameworkPaths = QStringList() << testDataDir.frameworksDir(false);
|
||||
|
||||
mm->updateProjectInfo(pi);
|
||||
|
||||
QStringList includePaths = mm->includePaths();
|
||||
QCOMPARE(includePaths.size(), 1);
|
||||
QVERIFY(includePaths.contains(testIncludeDir()));
|
||||
QVERIFY(includePaths.contains(testDataDir.includeDir()));
|
||||
|
||||
QStringList frameworkPaths = mm->frameworkPaths();
|
||||
QCOMPARE(frameworkPaths.size(), 1);
|
||||
QVERIFY(frameworkPaths.contains(testFrameworksDir()));
|
||||
QVERIFY(frameworkPaths.contains(testDataDir.frameworksDir()));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_modelmanager_framework_headers()
|
||||
@@ -104,6 +133,8 @@ void CppToolsPlugin::test_modelmanager_framework_headers()
|
||||
ModelManagerTestHelper helper;
|
||||
CppModelManager *mm = CppModelManager::instance();
|
||||
|
||||
const TestDataDirectory testDataDir(QLatin1String("testdata"));
|
||||
|
||||
Project *project = helper.createProject(QLatin1String("test_modelmanager_framework_headers"));
|
||||
ProjectInfo pi = mm->projectInfo(project);
|
||||
QCOMPARE(pi.project().data(), project);
|
||||
@@ -113,9 +144,10 @@ void CppToolsPlugin::test_modelmanager_framework_headers()
|
||||
part->cxxVersion = ProjectPart::CXX98;
|
||||
part->qtVersion = ProjectPart::Qt5;
|
||||
part->defines = QByteArray("#define OH_BEHAVE -1\n");
|
||||
part->includePaths << testIncludeDir();
|
||||
part->frameworkPaths << testFrameworksDir();
|
||||
const QString &source = testSource(QLatin1String("test_modelmanager_framework_headers.cpp"));
|
||||
part->includePaths << testDataDir.includeDir();
|
||||
part->frameworkPaths << testDataDir.frameworksDir();
|
||||
const QString &source = testDataDir.fileFromSourcesDir(
|
||||
QLatin1String("test_modelmanager_framework_headers.cpp"));
|
||||
part->files << ProjectFile(source, ProjectFile::CXXSource);
|
||||
|
||||
mm->updateProjectInfo(pi);
|
||||
@@ -140,15 +172,19 @@ void CppToolsPlugin::test_modelmanager_framework_headers()
|
||||
}
|
||||
|
||||
/// QTCREATORBUG-9056
|
||||
void CppToolsPlugin::test_modelmanager_refresh()
|
||||
void CppToolsPlugin::test_modelmanager_refresh_1()
|
||||
{
|
||||
ModelManagerTestHelper helper;
|
||||
CppModelManager *mm = CppModelManager::instance();
|
||||
|
||||
const QString testCpp(testSource(QLatin1String("test_modelmanager_refresh.cpp")));
|
||||
const QString testHeader(testSource(QLatin1String("test_modelmanager_refresh.h")));
|
||||
const TestDataDirectory testDataDir(QLatin1String("testdata"));
|
||||
|
||||
Project *project = helper.createProject(QLatin1String("test_modelmanager_refresh"));
|
||||
const QString testCpp(testDataDir.fileFromSourcesDir(
|
||||
QLatin1String("test_modelmanager_refresh.cpp")));
|
||||
const QString testHeader(testDataDir.fileFromSourcesDir(
|
||||
QLatin1String("test_modelmanager_refresh.h")));
|
||||
|
||||
Project *project = helper.createProject(QLatin1String("test_modelmanager_refresh_1"));
|
||||
ProjectInfo pi = mm->projectInfo(project);
|
||||
QCOMPARE(pi.project().data(), project);
|
||||
|
||||
@@ -157,7 +193,7 @@ void CppToolsPlugin::test_modelmanager_refresh()
|
||||
part->cxxVersion = ProjectPart::CXX98;
|
||||
part->qtVersion = ProjectPart::Qt5;
|
||||
part->defines = QByteArray("#define OH_BEHAVE -1\n");
|
||||
part->includePaths = QStringList() << testIncludeDir(false);
|
||||
part->includePaths = QStringList() << testDataDir.includeDir(false);
|
||||
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
|
||||
|
||||
mm->updateProjectInfo(pi);
|
||||
@@ -186,3 +222,59 @@ void CppToolsPlugin::test_modelmanager_refresh()
|
||||
QVERIFY(snapshot.contains(testHeader));
|
||||
QVERIFY(snapshot.contains(testCpp));
|
||||
}
|
||||
|
||||
/// QTCREATORBUG-9205
|
||||
void CppToolsPlugin::test_modelmanager_refresh_2()
|
||||
{
|
||||
ModelManagerTestHelper helper;
|
||||
CppModelManager *mm = CppModelManager::instance();
|
||||
|
||||
const TestDataDirectory testDataDir(QLatin1String("testdata_refresh"));
|
||||
|
||||
const QString testHeader1(testDataDir.file(QLatin1String("defines.h")));
|
||||
const QString testHeader2(testDataDir.file(QLatin1String("header.h")));
|
||||
const QString testCpp(testDataDir.file(QLatin1String("source.cpp")));
|
||||
|
||||
Project *project = helper.createProject(QLatin1String("test_modelmanager_refresh_2"));
|
||||
ProjectInfo pi = mm->projectInfo(project);
|
||||
QCOMPARE(pi.project().data(), project);
|
||||
|
||||
ProjectPart::Ptr part(new ProjectPart);
|
||||
pi.appendProjectPart(part);
|
||||
part->cxxVersion = ProjectPart::CXX98;
|
||||
part->qtVersion = ProjectPart::Qt5;
|
||||
part->files.append(ProjectFile(testHeader1, ProjectFile::CXXHeader));
|
||||
part->files.append(ProjectFile(testHeader2, ProjectFile::CXXHeader));
|
||||
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
|
||||
|
||||
mm->updateProjectInfo(pi);
|
||||
|
||||
CPlusPlus::Snapshot snapshot;
|
||||
QStringList refreshedFiles;
|
||||
CPlusPlus::Document::Ptr document;
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
mm->updateSourceFiles(QStringList() << testHeader1 << testHeader2 << testCpp);
|
||||
refreshedFiles = helper.waitForRefreshedSourceFiles();
|
||||
|
||||
QCOMPARE(refreshedFiles.size(), 3);
|
||||
QVERIFY(refreshedFiles.contains(testHeader1));
|
||||
QVERIFY(refreshedFiles.contains(testHeader2));
|
||||
QVERIFY(refreshedFiles.contains(testCpp));
|
||||
|
||||
snapshot = mm->snapshot();
|
||||
QVERIFY(snapshot.contains(testHeader1));
|
||||
QVERIFY(snapshot.contains(testHeader2));
|
||||
QVERIFY(snapshot.contains(testCpp));
|
||||
|
||||
// No diagnostic messages expected
|
||||
document = snapshot.document(testHeader1);
|
||||
QVERIFY(document->diagnosticMessages().isEmpty());
|
||||
|
||||
document = snapshot.document(testHeader2);
|
||||
QVERIFY(document->diagnosticMessages().isEmpty());
|
||||
|
||||
document = snapshot.document(testCpp);
|
||||
QVERIFY(document->diagnosticMessages().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +215,7 @@ public:
|
||||
virtual void addEditorSupport(CppTools::AbstractEditorSupport *editorSupport) = 0;
|
||||
virtual void removeEditorSupport(CppTools::AbstractEditorSupport *editorSupport) = 0;
|
||||
virtual CppEditorSupport *cppEditorSupport(TextEditor::BaseTextEditor *editor) = 0;
|
||||
virtual void deleteEditorSupport(TextEditor::BaseTextEditor *textEditor) = 0;
|
||||
|
||||
virtual QList<int> references(CPlusPlus::Symbol *symbol,
|
||||
const CPlusPlus::LookupContext &context) = 0;
|
||||
|
||||
@@ -138,6 +138,7 @@ void CppPreprocessor::resetEnvironment()
|
||||
{
|
||||
m_env.reset();
|
||||
m_processed.clear();
|
||||
m_included.clear();
|
||||
}
|
||||
|
||||
void CppPreprocessor::getFileContents(const QString &absoluteFilePath,
|
||||
|
||||
@@ -113,8 +113,17 @@ private slots:
|
||||
void test_completion_instantiate_template_with_default_argument_type();
|
||||
void test_completion_instantiate_template_with_default_argument_type_as_template();
|
||||
void test_completion_member_access_operator_1();
|
||||
void test_completion_typedef_of_type_and_replace_access_operator();
|
||||
void test_completion_typedef_of_pointer_of_type_and_replace_access_operator();
|
||||
|
||||
void test_completion_typedef_of_type_and_decl_of_type_no_replace_access_operator();
|
||||
void test_completion_typedef_of_pointer_and_decl_of_pointer_no_replace_access_operator();
|
||||
void test_completion_typedef_of_type_and_decl_of_pointer_replace_access_operator();
|
||||
void test_completion_typedef_of_pointer_and_decl_of_type_replace_access_operator();
|
||||
|
||||
void test_completion_predecl_typedef_of_type_and_decl_of_pointer_replace_access_operator();
|
||||
void test_completion_predecl_typedef_of_type_and_decl_type_no_replace_access_operator();
|
||||
void test_completion_predecl_typedef_of_pointer_and_decl_of_pointer_no_replace_access_operator();
|
||||
void test_completion_predecl_typedef_of_pointer_and_decl_of_type_replace_access_operator();
|
||||
|
||||
void test_completion_typedef_of_pointer();
|
||||
void test_completion_typedef_of_pointer_inside_function();
|
||||
void test_completion_typedef_is_inside_function_before_declaration_block();
|
||||
@@ -127,6 +136,8 @@ private slots:
|
||||
void test_completion_type_and_using_declaration();
|
||||
void test_completion_type_and_using_declaration_data();
|
||||
void test_completion_instantiate_template_with_anonymous_class();
|
||||
void test_completion_instantiate_template_function();
|
||||
void test_completion_crash_cloning_template_class_QTCREATORBUG9329();
|
||||
|
||||
void test_format_pointerdeclaration_in_simpledeclarations();
|
||||
void test_format_pointerdeclaration_in_simpledeclarations_data();
|
||||
@@ -141,7 +152,8 @@ private slots:
|
||||
|
||||
void test_modelmanager_paths();
|
||||
void test_modelmanager_framework_headers();
|
||||
void test_modelmanager_refresh();
|
||||
void test_modelmanager_refresh_1();
|
||||
void test_modelmanager_refresh_2();
|
||||
|
||||
private:
|
||||
void test_completion();
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
namespace Cvs {
|
||||
namespace Constants {
|
||||
|
||||
const char CVS_SUBMIT_MIMETYPE[] = "application/vnd.nokia.text.cvs.submit";
|
||||
const char CVS_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.cvs.submit";
|
||||
const char CVSCOMMITEDITOR[] = "CVS Commit Editor";
|
||||
const char CVSCOMMITEDITOR_ID[] = "CVS Commit Editor";
|
||||
const char CVSCOMMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "CVS Commit Editor");
|
||||
|
||||
@@ -101,7 +101,7 @@ QString CvsEditor::changeUnderCursor(const QTextCursor &c) const
|
||||
// Check if we are at the beginning of a line within a reasonable offset.
|
||||
// 2) Log: check for lines like "revision 1.1", cursor past "revision"
|
||||
switch (contentType()) {
|
||||
case VcsBase::RegularCommandOutput:
|
||||
case VcsBase::OtherContent:
|
||||
case VcsBase::DiffOutput:
|
||||
break;
|
||||
case VcsBase::AnnotateOutput: {
|
||||
|
||||
@@ -116,29 +116,26 @@ static const char CMD_ID_REPOSITORYUPDATE[] = "CVS.RepositoryUpdate";
|
||||
|
||||
static const VcsBaseEditorParameters editorParameters[] = {
|
||||
{
|
||||
RegularCommandOutput,
|
||||
OtherContent,
|
||||
"CVS Command Log Editor", // id
|
||||
QT_TRANSLATE_NOOP("VCS", "CVS Command Log Editor"), // display name
|
||||
"CVS Command Log Editor", // context
|
||||
"application/vnd.nokia.text.scs_cvs_commandlog",
|
||||
"scslog"},
|
||||
"text/vnd.qtcreator.cvs.commandlog"},
|
||||
{ LogOutput,
|
||||
"CVS File Log Editor", // id
|
||||
QT_TRANSLATE_NOOP("VCS", "CVS File Log Editor"), // display name
|
||||
"CVS File Log Editor", // context
|
||||
"application/vnd.nokia.text.scs_cvs_filelog",
|
||||
"scsfilelog"},
|
||||
"text/vnd.qtcreator.cvs.log"},
|
||||
{ AnnotateOutput,
|
||||
"CVS Annotation Editor", // id
|
||||
QT_TRANSLATE_NOOP("VCS", "CVS Annotation Editor"), // display name
|
||||
"CVS Annotation Editor", // context
|
||||
"application/vnd.nokia.text.scs_cvs_annotation",
|
||||
"scsannotate"},
|
||||
"text/vnd.qtcreator.cvs.annotation"},
|
||||
{ DiffOutput,
|
||||
"CVS Diff Editor", // id
|
||||
QT_TRANSLATE_NOOP("VCS", "CVS Diff Editor"), // display name
|
||||
"CVS Diff Editor", // context
|
||||
"text/x-patch","diff"}
|
||||
"text/x-patch"}
|
||||
};
|
||||
|
||||
// Utility to find a parameter set by type
|
||||
@@ -1025,7 +1022,7 @@ bool CvsPlugin::status(const QString &topLevel, const QStringList &files, const
|
||||
runCvs(topLevel, args, m_settings.timeOutMS(), 0);
|
||||
const bool ok = response.result == CvsResponse::Ok;
|
||||
if (ok)
|
||||
showOutputInEditor(title, response.stdOut, RegularCommandOutput, topLevel, 0);
|
||||
showOutputInEditor(title, response.stdOut, OtherContent, topLevel, 0);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,8 @@ public:
|
||||
QByteArray toString(bool multiline = false, int indent = 0) const;
|
||||
qulonglong toAddress() const;
|
||||
int toInt() const { return m_data.toInt(); }
|
||||
QString toUtf8() const { return QString::fromUtf8(m_data); }
|
||||
QString toLatin1() const { return QString::fromLatin1(m_data); }
|
||||
void fromString(const QByteArray &str);
|
||||
void fromStringMultiple(const QByteArray &str);
|
||||
|
||||
|
||||
@@ -2546,35 +2546,6 @@ QString GdbEngine::breakLocation(const QString &file) const
|
||||
return where;
|
||||
}
|
||||
|
||||
BreakpointPathUsage GdbEngine::defaultEngineBreakpointPathUsage() const
|
||||
{
|
||||
// e.g. MinGW gdb 70200 (part of Nokia Qt SDK)
|
||||
// fails to set breakpoints with absolute paths if
|
||||
// the source path isn't canonical
|
||||
if (m_gdbVersion < 70300)
|
||||
return BreakpointUseShortPath;
|
||||
// Use short path for file systems with symbolic links. On Windows, main.cpp
|
||||
// is potentially ambiguous (ANGLE, DLL).
|
||||
if (startParameters().toolChainAbi.os() != ProjectExplorer::Abi::WindowsOS)
|
||||
return BreakpointUseShortPath;
|
||||
|
||||
//don't set absolute breakpoints for remote targets
|
||||
switch (startMode()) {
|
||||
case AttachToRemoteServer:
|
||||
case AttachToRemoteProcess:
|
||||
case LoadRemoteCore:
|
||||
case StartRemoteProcess:
|
||||
case StartRemoteGdb:
|
||||
case StartRemoteEngine:
|
||||
return BreakpointUseShortPath;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return BreakpointUseFullPath;
|
||||
}
|
||||
|
||||
QByteArray GdbEngine::breakpointLocation(BreakpointModelId id)
|
||||
{
|
||||
BreakHandler *handler = breakHandler();
|
||||
@@ -2596,7 +2567,7 @@ QByteArray GdbEngine::breakpointLocation(BreakpointModelId id)
|
||||
|
||||
BreakpointPathUsage usage = data.pathUsage;
|
||||
if (usage == BreakpointPathUsageEngineDefault)
|
||||
usage = defaultEngineBreakpointPathUsage();
|
||||
usage = BreakpointUseShortPath;
|
||||
|
||||
const QString fileName = usage == BreakpointUseFullPath
|
||||
? data.fileName : breakLocation(data.fileName);
|
||||
@@ -2614,7 +2585,7 @@ QByteArray GdbEngine::breakpointLocation2(BreakpointModelId id)
|
||||
|
||||
BreakpointPathUsage usage = data.pathUsage;
|
||||
if (usage == BreakpointPathUsageEngineDefault)
|
||||
usage = defaultEngineBreakpointPathUsage();
|
||||
usage = BreakpointUseShortPath;
|
||||
|
||||
const QString fileName = usage == BreakpointUseFullPath
|
||||
? data.fileName : breakLocation(data.fileName);
|
||||
@@ -3778,7 +3749,7 @@ void GdbEngine::handleThreadInfo(const GdbResponse &response)
|
||||
selectThread(other);
|
||||
}
|
||||
updateViews(); // Adjust Threads combobox.
|
||||
if (false && m_hasInferiorThreadList && debuggerCore()->boolSetting(ShowThreadNames)) {
|
||||
if (m_hasInferiorThreadList && debuggerCore()->boolSetting(ShowThreadNames)) {
|
||||
postCommand("threadnames " +
|
||||
debuggerCore()->action(MaximalStackDepth)->value().toByteArray(),
|
||||
Discardable, CB(handleThreadNames));
|
||||
|
||||
@@ -456,7 +456,6 @@ private: ////////// View & Data Stuff //////////
|
||||
void handleInfoLine(const GdbResponse &response);
|
||||
void extractDataFromInfoBreak(const QString &output, BreakpointModelId);
|
||||
void updateResponse(BreakpointResponse &response, const GdbMi &bkpt);
|
||||
BreakpointPathUsage defaultEngineBreakpointPathUsage() const;
|
||||
QByteArray breakpointLocation(BreakpointModelId id); // For gdb/MI.
|
||||
QByteArray breakpointLocation2(BreakpointModelId id); // For gdb/CLI fallback.
|
||||
QString breakLocation(const QString &file) const;
|
||||
|
||||
@@ -427,18 +427,18 @@ void LldbEngine::updateBreakpointData(const GdbMi &bkpt, bool added)
|
||||
const int numChild = locations.children().size();
|
||||
if (numChild > 1) {
|
||||
foreach (const GdbMi &location, locations.children()) {
|
||||
const int locid = location["locid"].data().toUShort();
|
||||
const int locid = location["locid"].toInt();
|
||||
BreakpointResponse sub;
|
||||
sub.id = BreakpointResponseId(rid.majorPart(), locid);
|
||||
sub.type = response.type;
|
||||
sub.address = location["addr"].toAddress();
|
||||
sub.functionName = QString::fromUtf8(location["func"].data());
|
||||
sub.functionName = location["func"].toUtf8();
|
||||
handler->insertSubBreakpoint(id, sub);
|
||||
}
|
||||
} else if (numChild == 1) {
|
||||
const GdbMi location = locations.childAt(0);
|
||||
response.address = location["addr"].toAddress();
|
||||
response.functionName = QString::fromUtf8(location["func"].data());
|
||||
response.functionName = location["func"].toUtf8();
|
||||
} else {
|
||||
QTC_CHECK(false);
|
||||
}
|
||||
@@ -460,11 +460,10 @@ void LldbEngine::refreshDisassembly(const GdbMi &data)
|
||||
if (!agent.isNull()) {
|
||||
foreach (const GdbMi &line, data["lines"].children()) {
|
||||
DisassemblerLine dl;
|
||||
QByteArray address = line["address"].data();
|
||||
dl.address = address.toULongLong(0, 0);
|
||||
dl.data = _(line["inst"].data());
|
||||
dl.function = _(line["func-name"].data());
|
||||
dl.offset = line["offset"].data().toUInt();
|
||||
dl.address = line["address"].toAddress();
|
||||
dl.data = line["inst"].toUtf8();
|
||||
dl.function = line["func-name"].toUtf8();
|
||||
dl.offset = line["offset"].toInt();
|
||||
result.appendLine(dl);
|
||||
}
|
||||
agent->setContents(result);
|
||||
@@ -474,7 +473,7 @@ void LldbEngine::refreshDisassembly(const GdbMi &data)
|
||||
void LldbEngine::refreshMemory(const GdbMi &data)
|
||||
{
|
||||
int cookie = data["cookie"].toInt();
|
||||
qulonglong addr = data["address"].toInt();
|
||||
qulonglong addr = data["address"].toAddress();
|
||||
QPointer<MemoryAgent> agent = m_memoryAgents.key(cookie);
|
||||
if (!agent.isNull()) {
|
||||
QPointer<QObject> token = m_memoryAgentTokens.value(cookie);
|
||||
@@ -524,8 +523,8 @@ void LldbEngine::refreshModules(const GdbMi &modules)
|
||||
Modules mods;
|
||||
foreach (const GdbMi &item, modules.children()) {
|
||||
Module module;
|
||||
module.modulePath = QString::fromUtf8(item["file"].data());
|
||||
module.moduleName = QString::fromUtf8(item["name"].data());
|
||||
module.modulePath = item["file"].toUtf8();
|
||||
module.moduleName = item["name"].toUtf8();
|
||||
module.symbolsRead = Module::UnknownReadState;
|
||||
module.startAddress = item["loaded_addr"].toAddress();
|
||||
module.endAddress = 0; // FIXME: End address not easily available.
|
||||
@@ -541,15 +540,15 @@ void LldbEngine::requestModuleSymbols(const QString &moduleName)
|
||||
|
||||
void LldbEngine::refreshSymbols(const GdbMi &symbols)
|
||||
{
|
||||
QString moduleName = QString::fromUtf8(symbols["module"].data());
|
||||
QString moduleName = symbols["module"].toUtf8();
|
||||
Symbols syms;
|
||||
foreach (const GdbMi &item, symbols["symbols"].children()) {
|
||||
Symbol symbol;
|
||||
symbol.address = _(item["address"].data());
|
||||
symbol.name = _(item["name"].data());
|
||||
symbol.state = _(item["state"].data());
|
||||
symbol.section = _(item["section"].data());
|
||||
symbol.demangled = _(item["demangled"].data());
|
||||
symbol.address = item["address"].toUtf8();
|
||||
symbol.name = item["name"].toUtf8();
|
||||
symbol.state = item["state"].toUtf8();
|
||||
symbol.section = item["section"].toUtf8();
|
||||
symbol.demangled = item["demangled"].toUtf8();
|
||||
syms.append(symbol);
|
||||
}
|
||||
debuggerCore()->showModuleSymbols(moduleName, syms);
|
||||
@@ -828,7 +827,7 @@ void LldbEngine::refreshLocals(const GdbMi &vars)
|
||||
dummy.name = decodeData(wname.data(), Base64Encoded8Bit);
|
||||
dummy.exp = dummy.name.toUtf8();
|
||||
} else {
|
||||
dummy.name = _(child["name"].data());
|
||||
dummy.name = child["name"].toUtf8();
|
||||
}
|
||||
parseWatchData(handler->expandedINames(), dummy, child, &list);
|
||||
}
|
||||
@@ -844,9 +843,9 @@ void LldbEngine::refreshStack(const GdbMi &stack)
|
||||
foreach (const GdbMi &item, stack["frames"].children()) {
|
||||
StackFrame frame;
|
||||
frame.level = item["level"].toInt();
|
||||
frame.file = QString::fromLatin1(item["file"].data());
|
||||
frame.function = QString::fromLatin1(item["func"].data());
|
||||
frame.from = QString::fromLatin1(item["func"].data());
|
||||
frame.file = item["file"].toUtf8();
|
||||
frame.function = item["func"].toUtf8();
|
||||
frame.from = item["func"].toUtf8();
|
||||
frame.line = item["line"].toInt();
|
||||
frame.address = item["addr"].toAddress();
|
||||
frame.usable = QFileInfo(frame.file).isReadable();
|
||||
@@ -855,6 +854,9 @@ void LldbEngine::refreshStack(const GdbMi &stack)
|
||||
bool canExpand = stack["hasmore"].toInt();
|
||||
debuggerCore()->action(ExpandStack)->setEnabled(canExpand);
|
||||
handler->setFrames(frames);
|
||||
|
||||
int index = stack["current-frame"].toInt();
|
||||
handler->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void LldbEngine::refreshRegisters(const GdbMi ®isters)
|
||||
@@ -929,9 +931,9 @@ void LldbEngine::refreshState(const GdbMi &reportedState)
|
||||
|
||||
void LldbEngine::refreshLocation(const GdbMi &reportedLocation)
|
||||
{
|
||||
QByteArray file = reportedLocation["file"].data();
|
||||
QString file = reportedLocation["file"].toUtf8();
|
||||
int line = reportedLocation["line"].toInt();
|
||||
gotoLocation(Location(QString::fromUtf8(file), line));
|
||||
gotoLocation(Location(file, line));
|
||||
}
|
||||
|
||||
void LldbEngine::reloadRegisters()
|
||||
@@ -1035,16 +1037,31 @@ DebuggerEngine *createLldbEngine(const DebuggerStartParameters &startParameters)
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
const LldbEngine::Command &LldbEngine::Command::arg(const char *name, int value) const
|
||||
const LldbEngine::Command &LldbEngine::Command::argHelper(const char *name, const QByteArray &data) const
|
||||
{
|
||||
args.append('\'');
|
||||
args.append(name);
|
||||
args.append("':");
|
||||
args.append(QByteArray::number(value));
|
||||
args.append(',');
|
||||
args.append(data);
|
||||
args.append(",");
|
||||
return *this;
|
||||
}
|
||||
|
||||
const LldbEngine::Command &LldbEngine::Command::arg(const char *name, int value) const
|
||||
{
|
||||
return argHelper(name, QByteArray::number(value));
|
||||
}
|
||||
|
||||
const LldbEngine::Command &LldbEngine::Command::arg(const char *name, qlonglong value) const
|
||||
{
|
||||
return argHelper(name, QByteArray::number(value));
|
||||
}
|
||||
|
||||
const LldbEngine::Command &LldbEngine::Command::arg(const char *name, qulonglong value) const
|
||||
{
|
||||
return argHelper(name, QByteArray::number(value));
|
||||
}
|
||||
|
||||
const LldbEngine::Command &LldbEngine::Command::arg(const char *name, const QString &value) const
|
||||
{
|
||||
return arg(name, value.toUtf8().data());
|
||||
|
||||
@@ -68,6 +68,8 @@ private:
|
||||
Command(const char *f) : function(f) {}
|
||||
|
||||
const Command &arg(const char *name, int value) const;
|
||||
const Command &arg(const char *name, qlonglong value) const;
|
||||
const Command &arg(const char *name, qulonglong value) const;
|
||||
const Command &arg(const char *name, const QString &value) const;
|
||||
const Command &arg(const char *name, const QByteArray &value) const;
|
||||
const Command &arg(const char *name, const char *value) const;
|
||||
@@ -78,6 +80,8 @@ private:
|
||||
|
||||
QByteArray function;
|
||||
mutable QByteArray args;
|
||||
private:
|
||||
const Command &argHelper(const char *name, const QByteArray &value) const;
|
||||
};
|
||||
|
||||
// DebuggerEngine implementation
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
#include <QStyle>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QToolBar>
|
||||
#include <QComboBox>
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace DiffEditor {
|
||||
|
||||
@@ -48,9 +51,12 @@ DiffEditorEditable::DiffEditorEditable(DiffEditorWidget *editorWidget)
|
||||
: IEditor(0),
|
||||
m_file(new Internal::DiffEditorFile(QLatin1String(Constants::DIFF_EDITOR_MIMETYPE), this)),
|
||||
m_editorWidget(editorWidget),
|
||||
m_toolWidget(0)
|
||||
m_toolWidget(0),
|
||||
m_entriesComboBox(0)
|
||||
{
|
||||
setWidget(editorWidget);
|
||||
connect(m_editorWidget, SIGNAL(navigatedToDiffFile(int)),
|
||||
this, SLOT(activateEntry(int)));
|
||||
}
|
||||
|
||||
DiffEditorEditable::~DiffEditorEditable()
|
||||
@@ -115,7 +121,6 @@ static QToolBar *createToolBar(const QWidget *someWidget)
|
||||
toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
const int size = someWidget->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
toolBar->setIconSize(QSize(size, size));
|
||||
toolBar->addSeparator();
|
||||
|
||||
return toolBar;
|
||||
}
|
||||
@@ -128,12 +133,15 @@ QWidget *DiffEditorEditable::toolBar()
|
||||
// Create
|
||||
m_toolWidget = createToolBar(m_editorWidget);
|
||||
|
||||
QWidget *spacerWidget = new QWidget();
|
||||
QLayout *spacerLayout = new QHBoxLayout();
|
||||
spacerLayout->setMargin(0);
|
||||
spacerLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||
spacerWidget->setLayout(spacerLayout);
|
||||
m_toolWidget->addWidget(spacerWidget);
|
||||
m_entriesComboBox = new QComboBox;
|
||||
m_entriesComboBox->setMinimumContentsLength(20);
|
||||
// Make the combo box prefer to expand
|
||||
QSizePolicy policy = m_entriesComboBox->sizePolicy();
|
||||
policy.setHorizontalPolicy(QSizePolicy::Expanding);
|
||||
m_entriesComboBox->setSizePolicy(policy);
|
||||
connect(m_entriesComboBox, SIGNAL(activated(int)),
|
||||
this, SLOT(entryActivated(int)));
|
||||
m_toolWidget->addWidget(m_entriesComboBox);
|
||||
|
||||
QToolButton *whitespaceButton = new QToolButton(m_toolWidget);
|
||||
whitespaceButton->setText(tr("Ignore Whitespace"));
|
||||
@@ -156,6 +164,78 @@ QWidget *DiffEditorEditable::toolBar()
|
||||
return m_toolWidget;
|
||||
}
|
||||
|
||||
void DiffEditorEditable::setDiff(const QList<DiffEditorWidget::DiffFilesContents> &diffFileList,
|
||||
const QString &workingDirectory)
|
||||
{
|
||||
m_entriesComboBox->clear();
|
||||
const int count = diffFileList.count();
|
||||
for (int i = 0; i < count; i++) {
|
||||
const DiffEditorWidget::DiffFileInfo leftEntry = diffFileList.at(i).leftFileInfo;
|
||||
const DiffEditorWidget::DiffFileInfo rightEntry = diffFileList.at(i).rightFileInfo;
|
||||
const QString leftShortFileName = QFileInfo(leftEntry.fileName).fileName();
|
||||
const QString rightShortFileName = QFileInfo(rightEntry.fileName).fileName();
|
||||
QString itemText;
|
||||
QString itemToolTip;
|
||||
if (leftEntry.fileName == rightEntry.fileName) {
|
||||
itemText = leftShortFileName;
|
||||
|
||||
if (leftEntry.typeInfo.isEmpty() && rightEntry.typeInfo.isEmpty()) {
|
||||
itemToolTip = leftEntry.fileName;
|
||||
} else {
|
||||
itemToolTip = tr("[%1] vs. [%2] %3")
|
||||
.arg(leftEntry.typeInfo, rightEntry.typeInfo, leftEntry.fileName);
|
||||
}
|
||||
} else {
|
||||
if (leftShortFileName == rightShortFileName) {
|
||||
itemText = leftShortFileName;
|
||||
} else {
|
||||
itemText = tr("%1 vs. %2")
|
||||
.arg(leftShortFileName, rightShortFileName);
|
||||
}
|
||||
|
||||
if (leftEntry.typeInfo.isEmpty() && rightEntry.typeInfo.isEmpty()) {
|
||||
itemToolTip = tr("%1 vs. %2")
|
||||
.arg(leftEntry.fileName, rightEntry.fileName);
|
||||
} else {
|
||||
itemToolTip = tr("[%1] %2 vs. [%3] %4")
|
||||
.arg(leftEntry.typeInfo, leftEntry.fileName, rightEntry.typeInfo, rightEntry.fileName);
|
||||
}
|
||||
}
|
||||
m_entriesComboBox->addItem(itemText);
|
||||
m_entriesComboBox->setItemData(m_entriesComboBox->count() - 1, itemToolTip, Qt::ToolTipRole);
|
||||
}
|
||||
updateEntryToolTip();
|
||||
m_editorWidget->setDiff(diffFileList, workingDirectory);
|
||||
}
|
||||
|
||||
void DiffEditorEditable::clear(const QString &message)
|
||||
{
|
||||
m_entriesComboBox->clear();
|
||||
updateEntryToolTip();
|
||||
m_editorWidget->clear(message);
|
||||
}
|
||||
|
||||
void DiffEditorEditable::updateEntryToolTip()
|
||||
{
|
||||
const QString &toolTip = m_entriesComboBox->itemData(
|
||||
m_entriesComboBox->currentIndex(), Qt::ToolTipRole).toString();
|
||||
m_entriesComboBox->setToolTip(toolTip);
|
||||
}
|
||||
|
||||
void DiffEditorEditable::entryActivated(int index)
|
||||
{
|
||||
updateEntryToolTip();
|
||||
m_editorWidget->navigateToDiffFile(index);
|
||||
}
|
||||
|
||||
void DiffEditorEditable::activateEntry(int index)
|
||||
{
|
||||
m_entriesComboBox->blockSignals(true);
|
||||
m_entriesComboBox->setCurrentIndex(index);
|
||||
m_entriesComboBox->blockSignals(false);
|
||||
updateEntryToolTip();
|
||||
}
|
||||
|
||||
QByteArray DiffEditorEditable::saveState() const
|
||||
{
|
||||
return QByteArray();
|
||||
|
||||
@@ -31,16 +31,18 @@
|
||||
#define DIFFEDITOREDITABLE_H
|
||||
|
||||
#include "diffeditor_global.h"
|
||||
#include "diffeditorwidget.h"
|
||||
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <QToolBar>
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QToolBar;
|
||||
class QComboBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace DiffEditor {
|
||||
|
||||
class DiffEditorWidget;
|
||||
|
||||
namespace Internal {
|
||||
class DiffEditorFile;
|
||||
}
|
||||
@@ -53,6 +55,10 @@ public:
|
||||
virtual ~DiffEditorEditable();
|
||||
|
||||
public:
|
||||
void setDiff(const QList<DiffEditorWidget::DiffFilesContents> &diffFileList,
|
||||
const QString &workingDirectory = QString());
|
||||
void clear(const QString &message);
|
||||
|
||||
// Core::IEditor
|
||||
bool createNew(const QString &contents);
|
||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
@@ -69,11 +75,19 @@ public:
|
||||
|
||||
QByteArray saveState() const;
|
||||
bool restoreState(const QByteArray &state);
|
||||
public slots:
|
||||
void activateEntry(int index);
|
||||
|
||||
private slots:
|
||||
void entryActivated(int index);
|
||||
|
||||
private:
|
||||
void updateEntryToolTip();
|
||||
|
||||
Internal::DiffEditorFile *m_file;
|
||||
DiffEditorWidget *m_editorWidget;
|
||||
QToolBar *m_toolWidget;
|
||||
QComboBox *m_entriesComboBox;
|
||||
mutable QString m_displayName;
|
||||
};
|
||||
|
||||
|
||||
@@ -136,11 +136,16 @@ void DiffEditorPlugin::diff()
|
||||
const Core::Id editorId = Constants::DIFF_EDITOR_ID;
|
||||
//: Editor title
|
||||
QString title = tr("Diff \"%1\", \"%2\"").arg(fileName1).arg(fileName2);
|
||||
Core::IEditor *outputEditor = Core::EditorManager::openEditorWithContents(editorId, &title, QString());
|
||||
Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
|
||||
DiffEditorEditable *editorEditable = qobject_cast<DiffEditorEditable *>
|
||||
(Core::EditorManager::openEditorWithContents(editorId, &title, QString()));
|
||||
|
||||
if (!editorEditable)
|
||||
return;
|
||||
|
||||
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch);
|
||||
|
||||
DiffEditorWidget *editorWidget = editorEditable->editorWidget();
|
||||
|
||||
DiffEditorWidget *editorWidget = getDiffEditorWidget(outputEditor);
|
||||
if (editorWidget) {
|
||||
const QString text1 = getFileContents(fileName1, editorWidget->codec());
|
||||
const QString text2 = getFileContents(fileName2, editorWidget->codec());
|
||||
|
||||
@@ -152,15 +157,7 @@ void DiffEditorPlugin::diff()
|
||||
QList<DiffEditorWidget::DiffFilesContents> list;
|
||||
list.append(dfc);
|
||||
|
||||
editorWidget->setDiff(list);
|
||||
}
|
||||
}
|
||||
|
||||
DiffEditorWidget *DiffEditorPlugin::getDiffEditorWidget(const Core::IEditor *editor) const
|
||||
{
|
||||
if (const DiffEditorEditable *de = qobject_cast<const DiffEditorEditable *>(editor))
|
||||
return de->editorWidget();
|
||||
return 0;
|
||||
editorEditable->setDiff(list);
|
||||
}
|
||||
|
||||
QString DiffEditorPlugin::getFileContents(const QString &fileName, QTextCodec *codec) const
|
||||
|
||||
@@ -66,7 +66,6 @@ private slots:
|
||||
void diff();
|
||||
|
||||
private:
|
||||
DiffEditorWidget *getDiffEditorWidget(const Core::IEditor *editor) const;
|
||||
QString getFileContents(const QString &fileName, QTextCodec *codec) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <QScrollBar>
|
||||
#include <QPainter>
|
||||
#include <QDir>
|
||||
#include <QToolButton>
|
||||
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <texteditor/snippets/snippeteditor.h>
|
||||
@@ -130,6 +131,8 @@ public:
|
||||
void setSkippedLines(int blockNumber, int skippedLines) { m_skippedLines[blockNumber] = skippedLines; setSeparator(blockNumber, true); }
|
||||
void setSeparator(int blockNumber, bool separator) { m_separators[blockNumber] = separator; }
|
||||
bool isFileLine(int blockNumber) const { return m_fileInfo.contains(blockNumber); }
|
||||
int blockNumberForFileIndex(int fileIndex) const;
|
||||
int fileIndexForBlockNumber(int blockNumber) const;
|
||||
bool isChunkLine(int blockNumber) const { return m_skippedLines.contains(blockNumber); }
|
||||
void clearAll();
|
||||
void clearAll(const QString &message);
|
||||
@@ -242,6 +245,36 @@ void DiffViewEditorWidget::setLineNumber(int blockNumber, int lineNumber)
|
||||
m_lineNumberDigits = qMax(m_lineNumberDigits, lineNumberString.count());
|
||||
}
|
||||
|
||||
int DiffViewEditorWidget::blockNumberForFileIndex(int fileIndex) const
|
||||
{
|
||||
if (fileIndex < 0 || fileIndex >= m_fileInfo.count())
|
||||
return -1;
|
||||
|
||||
QMap<int, DiffEditorWidget::DiffFileInfo>::const_iterator it
|
||||
= m_fileInfo.constBegin();
|
||||
for (int i = 0; i < fileIndex; i++)
|
||||
++it;
|
||||
|
||||
return it.key();
|
||||
}
|
||||
|
||||
int DiffViewEditorWidget::fileIndexForBlockNumber(int blockNumber) const
|
||||
{
|
||||
QMap<int, DiffEditorWidget::DiffFileInfo>::const_iterator it
|
||||
= m_fileInfo.constBegin();
|
||||
QMap<int, DiffEditorWidget::DiffFileInfo>::const_iterator itEnd
|
||||
= m_fileInfo.constEnd();
|
||||
|
||||
int i = -1;
|
||||
while (it != itEnd) {
|
||||
if (it.key() > blockNumber)
|
||||
break;
|
||||
++it;
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void DiffViewEditorWidget::clearAll()
|
||||
{
|
||||
clearAll(tr("No difference"));
|
||||
@@ -477,10 +510,20 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_contextLinesNumber(3),
|
||||
m_ignoreWhitespaces(true),
|
||||
m_syncScrollBars(true),
|
||||
m_foldingBlocker(false)
|
||||
{
|
||||
TextEditor::TextEditorSettings *settings = TextEditorSettings::instance();
|
||||
|
||||
QToolButton *toggleSync = new QToolButton();
|
||||
toggleSync = new QToolButton;
|
||||
toggleSync->setText(QLatin1String("S"));
|
||||
toggleSync->setCheckable(true);
|
||||
toggleSync->setChecked(m_syncScrollBars);
|
||||
toggleSync->setToolTip(tr("Synchronize Horizontal Scroll Bars"));
|
||||
toggleSync->setAutoRaise(true);
|
||||
connect(toggleSync, SIGNAL(clicked(bool)), this, SLOT(toggleScrollBarSynchronization(bool)));
|
||||
|
||||
m_leftEditor = new DiffViewEditorWidget(this);
|
||||
m_leftEditor->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_leftEditor->setReadOnly(true);
|
||||
@@ -490,6 +533,7 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
|
||||
m_leftEditor->setCodeStyle(settings->codeStyle());
|
||||
|
||||
m_rightEditor = new DiffViewEditorWidget(this);
|
||||
m_rightEditor->setCornerWidget(toggleSync);
|
||||
m_rightEditor->setReadOnly(true);
|
||||
m_rightEditor->setHighlightCurrentLine(false);
|
||||
m_rightEditor->setWordWrapMode(QTextOption::NoWrap);
|
||||
@@ -497,19 +541,32 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
|
||||
m_rightEditor->setCodeStyle(settings->codeStyle());
|
||||
|
||||
connect(m_leftEditor->verticalScrollBar(), SIGNAL(valueChanged(int)),
|
||||
this, SLOT(leftSliderChanged()));
|
||||
this, SLOT(leftVSliderChanged()));
|
||||
connect(m_leftEditor->verticalScrollBar(), SIGNAL(actionTriggered(int)),
|
||||
this, SLOT(leftSliderChanged()));
|
||||
this, SLOT(leftVSliderChanged()));
|
||||
|
||||
connect(m_leftEditor->horizontalScrollBar(), SIGNAL(valueChanged(int)),
|
||||
this, SLOT(leftHSliderChanged()));
|
||||
connect(m_leftEditor->horizontalScrollBar(), SIGNAL(actionTriggered(int)),
|
||||
this, SLOT(leftHSliderChanged()));
|
||||
|
||||
connect(m_leftEditor, SIGNAL(cursorPositionChanged()),
|
||||
this, SLOT(leftSliderChanged()));
|
||||
this, SLOT(leftCursorPositionChanged()));
|
||||
connect(m_leftEditor->document()->documentLayout(), SIGNAL(documentSizeChanged(QSizeF)),
|
||||
this, SLOT(leftDocumentSizeChanged()));
|
||||
|
||||
connect(m_rightEditor->verticalScrollBar(), SIGNAL(valueChanged(int)),
|
||||
this, SLOT(rightSliderChanged()));
|
||||
this, SLOT(rightVSliderChanged()));
|
||||
connect(m_rightEditor->verticalScrollBar(), SIGNAL(actionTriggered(int)),
|
||||
this, SLOT(rightSliderChanged()));
|
||||
this, SLOT(rightVSliderChanged()));
|
||||
|
||||
connect(m_rightEditor->horizontalScrollBar(), SIGNAL(valueChanged(int)),
|
||||
this, SLOT(rightHSliderChanged()));
|
||||
connect(m_rightEditor->horizontalScrollBar(), SIGNAL(actionTriggered(int)),
|
||||
this, SLOT(rightHSliderChanged()));
|
||||
|
||||
connect(m_rightEditor, SIGNAL(cursorPositionChanged()),
|
||||
this, SLOT(rightSliderChanged()));
|
||||
this, SLOT(rightCursorPositionChanged()));
|
||||
connect(m_rightEditor->document()->documentLayout(), SIGNAL(documentSizeChanged(QSizeF)),
|
||||
this, SLOT(rightDocumentSizeChanged()));
|
||||
|
||||
@@ -517,6 +574,7 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
|
||||
m_splitter->addWidget(m_leftEditor);
|
||||
m_splitter->addWidget(m_rightEditor);
|
||||
QVBoxLayout *l = new QVBoxLayout(this);
|
||||
l->setMargin(0);
|
||||
l->addWidget(m_splitter);
|
||||
|
||||
clear();
|
||||
@@ -600,6 +658,24 @@ void DiffEditorWidget::setIgnoreWhitespaces(bool ignore)
|
||||
setDiff(m_diffList);
|
||||
}
|
||||
|
||||
void DiffEditorWidget::navigateToDiffFile(int diffFileIndex)
|
||||
{
|
||||
const int blockNumber = m_leftEditor->blockNumberForFileIndex(diffFileIndex);
|
||||
|
||||
QTextBlock leftBlock = m_leftEditor->document()->findBlockByNumber(blockNumber);
|
||||
QTextCursor leftCursor = m_leftEditor->textCursor();
|
||||
leftCursor.setPosition(leftBlock.position());
|
||||
m_leftEditor->setTextCursor(leftCursor);
|
||||
|
||||
QTextBlock rightBlock = m_rightEditor->document()->findBlockByNumber(blockNumber);
|
||||
QTextCursor rightCursor = m_rightEditor->textCursor();
|
||||
rightCursor.setPosition(rightBlock.position());
|
||||
m_rightEditor->setTextCursor(rightCursor);
|
||||
|
||||
m_leftEditor->centerCursor();
|
||||
m_rightEditor->centerCursor();
|
||||
}
|
||||
|
||||
QTextCodec *DiffEditorWidget::codec() const
|
||||
{
|
||||
return const_cast<QTextCodec *>(m_leftEditor->codec());
|
||||
@@ -1277,16 +1353,42 @@ void DiffEditorWidget::colorDiff(const QList<FileData> &fileDataList)
|
||||
+ rightSelections);
|
||||
}
|
||||
|
||||
void DiffEditorWidget::leftSliderChanged()
|
||||
void DiffEditorWidget::leftVSliderChanged()
|
||||
{
|
||||
m_rightEditor->verticalScrollBar()->setValue(m_leftEditor->verticalScrollBar()->value());
|
||||
}
|
||||
|
||||
void DiffEditorWidget::rightSliderChanged()
|
||||
void DiffEditorWidget::rightVSliderChanged()
|
||||
{
|
||||
m_leftEditor->verticalScrollBar()->setValue(m_rightEditor->verticalScrollBar()->value());
|
||||
}
|
||||
|
||||
void DiffEditorWidget::leftHSliderChanged()
|
||||
{
|
||||
if (m_syncScrollBars)
|
||||
m_rightEditor->horizontalScrollBar()->setValue(m_leftEditor->horizontalScrollBar()->value());
|
||||
}
|
||||
|
||||
void DiffEditorWidget::rightHSliderChanged()
|
||||
{
|
||||
if (m_syncScrollBars)
|
||||
m_leftEditor->horizontalScrollBar()->setValue(m_rightEditor->horizontalScrollBar()->value());
|
||||
}
|
||||
|
||||
void DiffEditorWidget::leftCursorPositionChanged()
|
||||
{
|
||||
leftVSliderChanged();
|
||||
leftHSliderChanged();
|
||||
emit navigatedToDiffFile(m_leftEditor->fileIndexForBlockNumber(m_leftEditor->textCursor().blockNumber()));
|
||||
}
|
||||
|
||||
void DiffEditorWidget::rightCursorPositionChanged()
|
||||
{
|
||||
rightVSliderChanged();
|
||||
rightHSliderChanged();
|
||||
emit navigatedToDiffFile(m_rightEditor->fileIndexForBlockNumber(m_rightEditor->textCursor().blockNumber()));
|
||||
}
|
||||
|
||||
void DiffEditorWidget::leftDocumentSizeChanged()
|
||||
{
|
||||
synchronizeFoldings(m_leftEditor, m_rightEditor);
|
||||
@@ -1297,6 +1399,11 @@ void DiffEditorWidget::rightDocumentSizeChanged()
|
||||
synchronizeFoldings(m_rightEditor, m_leftEditor);
|
||||
}
|
||||
|
||||
void DiffEditorWidget::toggleScrollBarSynchronization(bool on)
|
||||
{
|
||||
m_syncScrollBars = on;
|
||||
}
|
||||
|
||||
/* Special version of that method (original: TextEditor::BaseTextDocumentLayout::doFoldOrUnfold())
|
||||
The hack lies in fact, that when unfolding all direct sub-blocks are made visible,
|
||||
while some of them need to stay invisible (i.e. unfolded chunk lines)
|
||||
|
||||
@@ -86,16 +86,25 @@ public:
|
||||
public slots:
|
||||
void setContextLinesNumber(int lines);
|
||||
void setIgnoreWhitespaces(bool ignore);
|
||||
void navigateToDiffFile(int diffFileIndex);
|
||||
|
||||
signals:
|
||||
void navigatedToDiffFile(int diffFileIndex);
|
||||
|
||||
protected:
|
||||
TextEditor::SnippetEditorWidget *leftEditor() const;
|
||||
TextEditor::SnippetEditorWidget *rightEditor() const;
|
||||
|
||||
private slots:
|
||||
void leftSliderChanged();
|
||||
void rightSliderChanged();
|
||||
void leftVSliderChanged();
|
||||
void rightVSliderChanged();
|
||||
void leftHSliderChanged();
|
||||
void rightHSliderChanged();
|
||||
void leftCursorPositionChanged();
|
||||
void rightCursorPositionChanged();
|
||||
void leftDocumentSizeChanged();
|
||||
void rightDocumentSizeChanged();
|
||||
void toggleScrollBarSynchronization(bool on);
|
||||
|
||||
private:
|
||||
struct DiffList {
|
||||
@@ -130,6 +139,7 @@ private:
|
||||
QList<FileData> m_contextFileData; // ultimate data to be shown, contextLinesNumber taken into account
|
||||
int m_contextLinesNumber;
|
||||
bool m_ignoreWhitespaces;
|
||||
bool m_syncScrollBars;
|
||||
|
||||
bool m_foldingBlocker;
|
||||
};
|
||||
|
||||
@@ -40,9 +40,9 @@ const char GENERICMIMETYPE[] = "text/x-generic-project"; // ### FIXME
|
||||
const char C_FILESEDITOR[] = ".files Editor";
|
||||
const char FILES_EDITOR_ID[] = "QT4.FilesEditor";
|
||||
|
||||
const char FILES_MIMETYPE[] = "application/vnd.nokia.qt.generic.files";
|
||||
const char INCLUDES_MIMETYPE[] = "application/vnd.nokia.qt.generic.includes";
|
||||
const char CONFIG_MIMETYPE[] = "application/vnd.nokia.qt.generic.config";
|
||||
const char FILES_MIMETYPE[] = "application/vnd.qtcreator.generic.files";
|
||||
const char INCLUDES_MIMETYPE[] = "application/vnd.qtcreator.generic.includes";
|
||||
const char CONFIG_MIMETYPE[] = "application/vnd.qtcreator.generic.config";
|
||||
|
||||
// Project
|
||||
const char GENERICPROJECT_ID[] = "GenericProjectManager.GenericProject";
|
||||
|
||||
9
src/plugins/git/Git.mimetypes.xml
Normal file
9
src/plugins/git/Git.mimetypes.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||
<mime-type type="text/vnd.qtcreator.git.commit">
|
||||
<sub-class-of type="text/plain"/>
|
||||
<comment>Git Commit File</comment>
|
||||
<glob pattern="COMMIT_MSG"/>
|
||||
<glob pattern="COMMIT_EDITMSG"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
@@ -62,4 +62,6 @@ include(gitorious/gitorious.pri)
|
||||
RESOURCES += \
|
||||
git.qrc
|
||||
|
||||
OTHER_FILES += Git.mimetypes.xml
|
||||
|
||||
include(gerrit/gerrit.pri)
|
||||
|
||||
@@ -14,6 +14,7 @@ QtcPlugin {
|
||||
Depends { name: "Locator" }
|
||||
|
||||
files: [
|
||||
"Git.mimetypes.xml",
|
||||
"annotationhighlighter.cpp",
|
||||
"annotationhighlighter.h",
|
||||
"branchadddialog.cpp",
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
<qresource prefix="/git">
|
||||
<file>images/git.png</file>
|
||||
<file>images/gitorious.png</file>
|
||||
<file>Git.mimetypes.xml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -75,6 +75,8 @@
|
||||
|
||||
static const char GIT_DIRECTORY[] = ".git";
|
||||
static const char graphLogFormatC[] = "%h %d %an %s %ci";
|
||||
static const char HEAD[] = "HEAD";
|
||||
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
@@ -84,10 +86,32 @@ class GitDiffHandler : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GitDiffHandler(const QString &gitPath,
|
||||
enum RevisionType {
|
||||
WorkingTree,
|
||||
Index,
|
||||
Other
|
||||
};
|
||||
|
||||
struct Revision {
|
||||
Revision() : type(WorkingTree) { }
|
||||
Revision(RevisionType t) : type(t) { }
|
||||
Revision(RevisionType t, const QString &i) : type(t), id(i) { }
|
||||
RevisionType type;
|
||||
QString id; // can be sha or HEAD
|
||||
QString infoText() const
|
||||
{
|
||||
switch (type) {
|
||||
case WorkingTree: return tr("Working tree");
|
||||
case Index: return tr("Index");
|
||||
default: return id;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GitDiffHandler(DiffEditor::DiffEditorEditable *editor,
|
||||
const QString &gitPath,
|
||||
const QString &workingDirectory,
|
||||
const QProcessEnvironment &environment,
|
||||
DiffEditor::DiffEditorWidget *editor,
|
||||
int timeout);
|
||||
|
||||
// index -> working tree
|
||||
@@ -99,6 +123,10 @@ public:
|
||||
void diffProjects(const QStringList &projectPaths);
|
||||
// index -> working tree
|
||||
void diffRepository();
|
||||
// branch HEAD -> working tree
|
||||
void diffBranch(const QString &branchName);
|
||||
// id^ -> id
|
||||
void show(const QString &id);
|
||||
|
||||
private slots:
|
||||
void slotFileListReceived(const QByteArray &data);
|
||||
@@ -106,42 +134,51 @@ private slots:
|
||||
|
||||
private:
|
||||
void collectFilesList(const QStringList &additionalArguments);
|
||||
void prepareForCollection();
|
||||
void collectFilesContents();
|
||||
void feedEditor();
|
||||
QString workingTreeContents(const QString &fileName) const;
|
||||
|
||||
QPointer<DiffEditor::DiffEditorEditable> m_editor;
|
||||
const QString m_gitPath;
|
||||
const QString m_workingDirectory;
|
||||
const QProcessEnvironment m_processEnvironment;
|
||||
QWeakPointer<DiffEditor::DiffEditorWidget> m_editor;
|
||||
const int m_timeout;
|
||||
const QString m_waitMessage;
|
||||
|
||||
enum RevisionType {
|
||||
Head = 0x01,
|
||||
Index = 0x02,
|
||||
WorkingTree = 0x04
|
||||
struct RevisionRange {
|
||||
RevisionRange() { }
|
||||
RevisionRange(const Revision &b, const Revision &e) : begin(b), end(e) { }
|
||||
Revision begin;
|
||||
Revision end;
|
||||
};
|
||||
|
||||
QStringList m_requestedHeadFileNames;
|
||||
QStringList m_requestedIndexFileNames;
|
||||
// filename, revision range
|
||||
QMap<QString, QList<RevisionRange> > m_requestedRevisionRanges;
|
||||
// filename, revision, dummy
|
||||
QMap<QString, QMap<Revision, bool> > m_pendingRevisions;
|
||||
// filename, revision, contents
|
||||
QMap<QString, QMap<Revision, QString> > m_collectedRevisions;
|
||||
|
||||
QStringList m_headFileNames;
|
||||
QStringList m_indexFileNames;
|
||||
|
||||
QStringList m_headContents;
|
||||
QStringList m_indexContents;
|
||||
RevisionRange m_requestedRevisionRange;
|
||||
};
|
||||
|
||||
GitDiffHandler::GitDiffHandler(const QString &gitPath,
|
||||
inline bool operator<(const GitDiffHandler::Revision &rev1, const GitDiffHandler::Revision &rev2)
|
||||
{
|
||||
if (rev1.type != rev2.type)
|
||||
return rev1.type < rev2.type;
|
||||
return rev1.id < rev2.id;
|
||||
}
|
||||
|
||||
GitDiffHandler::GitDiffHandler(DiffEditor::DiffEditorEditable *editor,
|
||||
const QString &gitPath,
|
||||
const QString &workingDirectory,
|
||||
const QProcessEnvironment &environment,
|
||||
DiffEditor::DiffEditorWidget *editor,
|
||||
int timeout)
|
||||
: m_gitPath(gitPath),
|
||||
: m_editor(editor),
|
||||
m_gitPath(gitPath),
|
||||
m_workingDirectory(workingDirectory),
|
||||
m_processEnvironment(environment),
|
||||
m_editor(editor),
|
||||
m_timeout(timeout),
|
||||
m_waitMessage(tr("Waiting for data..."))
|
||||
{
|
||||
@@ -149,40 +186,71 @@ GitDiffHandler::GitDiffHandler(const QString &gitPath,
|
||||
|
||||
void GitDiffHandler::diffFile(const QString &fileName)
|
||||
{
|
||||
m_requestedIndexFileNames << fileName;
|
||||
collectFilesList(QStringList() << QLatin1String("--") << m_requestedIndexFileNames);
|
||||
m_requestedRevisionRange = RevisionRange(
|
||||
Revision(Other, QLatin1String(HEAD)),
|
||||
Revision(WorkingTree));
|
||||
|
||||
collectFilesList(QStringList() << QLatin1String("--") << fileName);
|
||||
}
|
||||
|
||||
void GitDiffHandler::diffFiles(const QStringList &stagedFileNames, const QStringList &unstagedFileNames)
|
||||
{
|
||||
m_requestedHeadFileNames = stagedFileNames;
|
||||
m_requestedHeadFileNames.removeDuplicates();
|
||||
m_requestedIndexFileNames = unstagedFileNames;
|
||||
m_requestedIndexFileNames.removeDuplicates();
|
||||
RevisionRange stagedRange = RevisionRange(
|
||||
Revision(Other, QLatin1String(HEAD)),
|
||||
Revision(WorkingTree));
|
||||
RevisionRange unstagedRange = RevisionRange(
|
||||
Revision(Index),
|
||||
Revision(WorkingTree));
|
||||
|
||||
m_headFileNames = m_requestedHeadFileNames;
|
||||
m_indexFileNames = m_requestedIndexFileNames;
|
||||
for (int i = 0; i < m_headFileNames.count(); i++) {
|
||||
const QString headFileName = m_headFileNames.at(i);
|
||||
if (!m_indexFileNames.contains(headFileName))
|
||||
m_indexFileNames.append(headFileName);
|
||||
}
|
||||
for (int i = 0; i < stagedFileNames.count(); i++)
|
||||
m_requestedRevisionRanges[stagedFileNames.at(i)].append(stagedRange);
|
||||
|
||||
for (int i = 0; i < unstagedFileNames.count(); i++)
|
||||
m_requestedRevisionRanges[unstagedFileNames.at(i)].append(unstagedRange);
|
||||
|
||||
prepareForCollection();
|
||||
collectFilesContents();
|
||||
}
|
||||
|
||||
void GitDiffHandler::diffProjects(const QStringList &projectPaths)
|
||||
{
|
||||
m_requestedRevisionRange = RevisionRange(
|
||||
Revision(Other, QLatin1String(HEAD)),
|
||||
Revision(WorkingTree));
|
||||
|
||||
collectFilesList(QStringList() << QLatin1String("--") << projectPaths);
|
||||
}
|
||||
|
||||
void GitDiffHandler::diffRepository()
|
||||
{
|
||||
m_requestedRevisionRange = RevisionRange(
|
||||
Revision(Other, QLatin1String(HEAD)),
|
||||
Revision(WorkingTree));
|
||||
|
||||
collectFilesList(QStringList());
|
||||
}
|
||||
|
||||
void GitDiffHandler::diffBranch(const QString &branchName)
|
||||
{
|
||||
m_requestedRevisionRange = RevisionRange(
|
||||
Revision(Other, branchName),
|
||||
Revision(WorkingTree));
|
||||
|
||||
collectFilesList(QStringList() << branchName);
|
||||
}
|
||||
|
||||
void GitDiffHandler::show(const QString &id)
|
||||
{
|
||||
Revision begin(Other, id + QLatin1Char('^'));
|
||||
Revision end(Other, id);
|
||||
m_requestedRevisionRange = RevisionRange(begin, end);
|
||||
|
||||
collectFilesList(QStringList() << begin.id << end.id);
|
||||
}
|
||||
|
||||
void GitDiffHandler::collectFilesList(const QStringList &additionalArguments)
|
||||
{
|
||||
m_editor.data()->clear(m_waitMessage);
|
||||
m_editor->clear(m_waitMessage);
|
||||
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
|
||||
connect(command, SIGNAL(outputData(QByteArray)), this, SLOT(slotFileListReceived(QByteArray)));
|
||||
QStringList arguments;
|
||||
@@ -196,38 +264,79 @@ void GitDiffHandler::slotFileListReceived(const QByteArray &data)
|
||||
if (m_editor.isNull())
|
||||
return;
|
||||
|
||||
const QString fileList = m_editor.data()->codec()->toUnicode(data);
|
||||
m_requestedIndexFileNames = fileList.split(QLatin1Char('\n'), QString::SkipEmptyParts);
|
||||
m_requestedIndexFileNames.removeDuplicates();
|
||||
m_indexFileNames = m_requestedIndexFileNames;
|
||||
const QString fileList = m_editor->editorWidget()->codec()->toUnicode(data);
|
||||
QStringList fileNames = fileList.split(QLatin1Char('\n'), QString::SkipEmptyParts);
|
||||
fileNames.removeDuplicates();
|
||||
|
||||
for (int i = 0; i < fileNames.count(); i++)
|
||||
m_requestedRevisionRanges[fileNames.at(i)].append(m_requestedRevisionRange);
|
||||
|
||||
prepareForCollection();
|
||||
collectFilesContents();
|
||||
}
|
||||
|
||||
void GitDiffHandler::prepareForCollection()
|
||||
{
|
||||
QMap<QString, QList<RevisionRange> >::const_iterator it
|
||||
= m_requestedRevisionRanges.constBegin();
|
||||
QMap<QString, QList<RevisionRange> >::const_iterator itEnd
|
||||
= m_requestedRevisionRanges.constEnd();
|
||||
while (it != itEnd) {
|
||||
const QString fileName = it.key();
|
||||
const QList<RevisionRange> &ranges = it.value();
|
||||
for (int i = 0; i < ranges.count(); i++) {
|
||||
const RevisionRange &range = ranges.at(i);
|
||||
m_pendingRevisions[fileName][range.begin] = false;
|
||||
m_pendingRevisions[fileName][range.end] = false;
|
||||
}
|
||||
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
void GitDiffHandler::collectFilesContents()
|
||||
{
|
||||
const int headFilesReceived = m_headContents.count();
|
||||
const int indexFilesReceived = m_indexContents.count();
|
||||
QMap<QString, QMap<Revision, bool> >::iterator itFile
|
||||
= m_pendingRevisions.begin();
|
||||
QMap<QString, QMap<Revision, bool> >::iterator itFileEnd
|
||||
= m_pendingRevisions.end();
|
||||
while (itFile != itFileEnd) {
|
||||
const QString fileName = itFile.key();
|
||||
QMap<Revision, bool> &revisions = itFile.value();
|
||||
QMap<Revision, bool>::iterator itRev
|
||||
= revisions.begin();
|
||||
QMap<Revision, bool>::iterator itRevEnd
|
||||
= revisions.end();
|
||||
while (itRev != itRevEnd) {
|
||||
const Revision revision = itRev.key();
|
||||
if (revision.type == WorkingTree) {
|
||||
// collect file here
|
||||
|
||||
if (headFilesReceived < m_headFileNames.count()) {
|
||||
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
|
||||
connect(command, SIGNAL(outputData(QByteArray)), this, SLOT(slotFileContentsReceived(QByteArray)));
|
||||
m_collectedRevisions[fileName][revision] = workingTreeContents(fileName);
|
||||
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("show") << QLatin1String("HEAD:./") + m_headFileNames.at(headFilesReceived);
|
||||
command->addJob(arguments, m_timeout);
|
||||
command->execute();
|
||||
} else if (indexFilesReceived < m_indexFileNames.count()) {
|
||||
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
|
||||
connect(command, SIGNAL(outputData(QByteArray)), this, SLOT(slotFileContentsReceived(QByteArray)));
|
||||
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("show") << QLatin1String(":./") + m_indexFileNames.at(indexFilesReceived);
|
||||
command->addJob(arguments, m_timeout);
|
||||
command->execute();
|
||||
itRev = revisions.erase(itRev); // iterate to the next revision
|
||||
} else {
|
||||
feedEditor();
|
||||
// prepare job here
|
||||
|
||||
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
|
||||
connect(command, SIGNAL(outputData(QByteArray)), this, SLOT(slotFileContentsReceived(QByteArray)));
|
||||
|
||||
QString revisionArgument = (revision.type == Other)
|
||||
? revision.id : QString();
|
||||
revisionArgument += QLatin1String(":./");
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("show") << revisionArgument + fileName;
|
||||
command->addJob(arguments, m_timeout);
|
||||
command->execute();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
itFile = m_pendingRevisions.erase(itFile); // iterate to the next file
|
||||
}
|
||||
|
||||
feedEditor();
|
||||
}
|
||||
|
||||
void GitDiffHandler::slotFileContentsReceived(const QByteArray &data)
|
||||
@@ -235,13 +344,26 @@ void GitDiffHandler::slotFileContentsReceived(const QByteArray &data)
|
||||
if (m_editor.isNull())
|
||||
return;
|
||||
|
||||
const int headFilesReceived = m_headContents.count();
|
||||
const int indexFilesReceived = m_indexContents.count();
|
||||
const QString contents = m_editor.data()->codec()->toUnicode(data);
|
||||
if (headFilesReceived < m_headFileNames.count())
|
||||
m_headContents.append(contents);
|
||||
else if (indexFilesReceived < m_indexFileNames.count())
|
||||
m_indexContents.append(contents);
|
||||
QMap<QString, QMap<Revision, bool> >::iterator itFile
|
||||
= m_pendingRevisions.begin();
|
||||
QMap<QString, QMap<Revision, bool> >::iterator itFileEnd
|
||||
= m_pendingRevisions.end();
|
||||
if (itFile != itFileEnd) {
|
||||
const QString fileName = itFile.key();
|
||||
QMap<Revision, bool> &revisions = itFile.value();
|
||||
QMap<Revision, bool>::iterator itRev
|
||||
= revisions.begin();
|
||||
QMap<Revision, bool>::iterator itRevEnd
|
||||
= revisions.end();
|
||||
if (itRev != itRevEnd) {
|
||||
const QString contents = m_editor->editorWidget()->codec()->toUnicode(data);
|
||||
m_collectedRevisions[fileName][itRev.key()] = contents;
|
||||
|
||||
itRev = revisions.erase(itRev);
|
||||
if (revisions.isEmpty())
|
||||
m_pendingRevisions.erase(itFile);
|
||||
}
|
||||
}
|
||||
|
||||
collectFilesContents();
|
||||
}
|
||||
@@ -250,36 +372,29 @@ void GitDiffHandler::feedEditor()
|
||||
{
|
||||
QList<DiffEditor::DiffEditorWidget::DiffFilesContents> list;
|
||||
|
||||
for (int i = 0; i < m_requestedHeadFileNames.count(); i++) {
|
||||
const QString fileName = m_requestedHeadFileNames.at(i);
|
||||
const QString original = m_headContents.at(i);
|
||||
const int idx = m_indexFileNames.indexOf(fileName);
|
||||
if (idx >= 0) {
|
||||
const QString modified = m_indexContents.at(idx);
|
||||
if (original != modified) {
|
||||
QMap<QString, QList<RevisionRange> >::const_iterator itFile
|
||||
= m_requestedRevisionRanges.constBegin();
|
||||
QMap<QString, QList<RevisionRange> >::const_iterator itFileEnd
|
||||
= m_requestedRevisionRanges.constEnd();
|
||||
while (itFile != itFileEnd) {
|
||||
const QString fileName = itFile.key();
|
||||
const QList<RevisionRange> &ranges = itFile.value();
|
||||
for (int i = 0; i < ranges.count(); i++) {
|
||||
const Revision leftRevision = ranges.at(i).begin;
|
||||
const Revision rightRevision = ranges.at(i).end;
|
||||
|
||||
DiffEditor::DiffEditorWidget::DiffFilesContents dfc;
|
||||
dfc.leftFileInfo = DiffEditor::DiffEditorWidget::DiffFileInfo(fileName, tr("Head"));
|
||||
dfc.leftText = original;
|
||||
dfc.rightFileInfo = DiffEditor::DiffEditorWidget::DiffFileInfo(fileName, tr("Index"));
|
||||
dfc.rightText = modified;
|
||||
dfc.leftFileInfo = DiffEditor::DiffEditorWidget::DiffFileInfo(fileName, leftRevision.infoText());
|
||||
dfc.leftText = m_collectedRevisions[fileName][leftRevision];
|
||||
dfc.rightFileInfo = DiffEditor::DiffEditorWidget::DiffFileInfo(fileName, rightRevision.infoText());
|
||||
dfc.rightText = m_collectedRevisions[fileName][rightRevision];
|
||||
list.append(dfc);
|
||||
}
|
||||
|
||||
++itFile;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_requestedIndexFileNames.count(); i++) {
|
||||
const QString fileName = m_requestedIndexFileNames.at(i);
|
||||
const QString original = m_indexContents.at(i);
|
||||
const QString modified = workingTreeContents(fileName);
|
||||
if (original != modified) {
|
||||
DiffEditor::DiffEditorWidget::DiffFilesContents dfc;
|
||||
dfc.leftFileInfo = DiffEditor::DiffEditorWidget::DiffFileInfo(fileName, tr("Index"));
|
||||
dfc.leftText = original;
|
||||
dfc.rightFileInfo = DiffEditor::DiffEditorWidget::DiffFileInfo(fileName, tr("Working tree"));
|
||||
dfc.rightText = modified;
|
||||
list.append(dfc);
|
||||
}
|
||||
}
|
||||
m_editor.data()->setDiff(list, m_workingDirectory);
|
||||
|
||||
m_editor->setDiff(list, m_workingDirectory);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
@@ -290,7 +405,7 @@ QString GitDiffHandler::workingTreeContents(const QString &fileName) const
|
||||
|
||||
QFile file(absoluteFileName);
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
return m_editor.data()->codec()->toUnicode(file.readAll());
|
||||
return m_editor->editorWidget()->codec()->toUnicode(file.readAll());
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
@@ -728,10 +843,9 @@ VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *regis
|
||||
return rc;
|
||||
}
|
||||
|
||||
DiffEditor::DiffEditorWidget *GitClient::findExistingDiffEditor(const char *registerDynamicProperty,
|
||||
DiffEditor::DiffEditorEditable *GitClient::findExistingDiffEditor(const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue) const
|
||||
{
|
||||
DiffEditor::DiffEditorWidget *editorWidget = 0;
|
||||
Core::IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue);
|
||||
if (!outputEditor)
|
||||
return 0;
|
||||
@@ -739,9 +853,8 @@ DiffEditor::DiffEditorWidget *GitClient::findExistingDiffEditor(const char *regi
|
||||
// Exists already
|
||||
Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
|
||||
outputEditor->createNew(m_msgWait);
|
||||
editorWidget = diffEditorWidget(outputEditor);
|
||||
|
||||
return editorWidget;
|
||||
return qobject_cast<DiffEditor::DiffEditorEditable *>(outputEditor);
|
||||
}
|
||||
|
||||
/* Create an editor associated to VCS output of a source file/directory
|
||||
@@ -787,13 +900,6 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id,
|
||||
return rc;
|
||||
}
|
||||
|
||||
DiffEditor::DiffEditorWidget *GitClient::diffEditorWidget(const Core::IEditor *editor) const
|
||||
{
|
||||
if (const DiffEditor::DiffEditorEditable *de = qobject_cast<const DiffEditor::DiffEditorEditable *>(editor))
|
||||
return de->editorWidget();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GitClient::diff(const QString &workingDirectory,
|
||||
const QStringList &diffArgs,
|
||||
const QStringList &unstagedFileNames,
|
||||
@@ -803,31 +909,28 @@ void GitClient::diff(const QString &workingDirectory,
|
||||
const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID;
|
||||
QString title = tr("Git Diff");
|
||||
|
||||
DiffEditor::DiffEditorWidget *editorWidget = findExistingDiffEditor("originalFileName", workingDirectory);
|
||||
DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("originalFileName", workingDirectory);
|
||||
|
||||
if (!editorWidget) {
|
||||
Core::IEditor *outputEditor = Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait);
|
||||
outputEditor->document()->setProperty("originalFileName", workingDirectory);
|
||||
Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch); // should probably go outside this block
|
||||
|
||||
editorWidget = diffEditorWidget(outputEditor);
|
||||
if (!editorEditable) {
|
||||
editorEditable = qobject_cast<DiffEditor::DiffEditorEditable *>(
|
||||
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait));
|
||||
editorEditable->document()->setProperty("originalFileName", workingDirectory);
|
||||
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); // should probably go outside this block
|
||||
}
|
||||
|
||||
int timeout = settings()->intValue(GitSettings::timeoutKey);
|
||||
GitDiffHandler *handler = new GitDiffHandler(gitBinaryPath(), workingDirectory, processEnvironment(), editorWidget, timeout);
|
||||
GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), workingDirectory, processEnvironment(), timeout);
|
||||
|
||||
if (unstagedFileNames.empty() && stagedFileNames.empty()) {
|
||||
// local repository diff
|
||||
handler->diffRepository();
|
||||
} else {
|
||||
if (!stagedFileNames.empty()) {
|
||||
} else if (!stagedFileNames.empty()) {
|
||||
// diff of selected files only with --cached option, used in commit editor
|
||||
handler->diffFiles(stagedFileNames, unstagedFileNames);
|
||||
} else if (!unstagedFileNames.empty()) {
|
||||
} else {
|
||||
// current project diff
|
||||
handler->diffProjects(unstagedFileNames);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const QString binary = settings()->stringValue(GitSettings::binaryPathKey);
|
||||
const Core::Id editorId = Git::Constants::GIT_DIFF_EDITOR_ID;
|
||||
@@ -894,18 +997,17 @@ void GitClient::diff(const QString &workingDirectory,
|
||||
QString title = tr("Git Diff \"%1\"").arg(fileName);
|
||||
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, fileName);
|
||||
|
||||
DiffEditor::DiffEditorWidget *editorWidget = findExistingDiffEditor("originalFileName", sourceFile);
|
||||
if (!editorWidget) {
|
||||
Core::IEditor *outputEditor = Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait);
|
||||
outputEditor->document()->setProperty("originalFileName", sourceFile);
|
||||
Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
|
||||
|
||||
editorWidget = diffEditorWidget(outputEditor);
|
||||
DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("originalFileName", sourceFile);
|
||||
if (!editorEditable) {
|
||||
editorEditable = qobject_cast<DiffEditor::DiffEditorEditable *>(
|
||||
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait));
|
||||
editorEditable->document()->setProperty("originalFileName", sourceFile);
|
||||
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch);
|
||||
}
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
int timeout = settings()->intValue(GitSettings::timeoutKey);
|
||||
GitDiffHandler *handler = new GitDiffHandler(gitBinaryPath(), workingDirectory, processEnvironment(), editorWidget, timeout);
|
||||
GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), workingDirectory, processEnvironment(), timeout);
|
||||
handler->diffFile(fileName);
|
||||
}
|
||||
} else {
|
||||
@@ -940,6 +1042,22 @@ void GitClient::diffBranch(const QString &workingDirectory,
|
||||
const QStringList &diffArgs,
|
||||
const QString &branchName)
|
||||
{
|
||||
if (settings()->boolValue(GitSettings::useDiffEditorKey)) {
|
||||
const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID;
|
||||
QString title = tr("Git Diff Branch \"%1\"").arg(branchName);
|
||||
|
||||
DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("BranchName", branchName);
|
||||
if (!editorEditable) {
|
||||
editorEditable = qobject_cast<DiffEditor::DiffEditorEditable *>(
|
||||
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait));
|
||||
editorEditable->document()->setProperty("BranchName", branchName);
|
||||
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch);
|
||||
}
|
||||
|
||||
int timeout = settings()->intValue(GitSettings::timeoutKey);
|
||||
GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), workingDirectory, processEnvironment(), timeout);
|
||||
handler->diffBranch(branchName);
|
||||
} else {
|
||||
const Core::Id editorId = Git::Constants::GIT_DIFF_EDITOR_ID;
|
||||
const QString title = tr("Git Diff Branch \"%1\"").arg(branchName);
|
||||
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, QStringList());
|
||||
@@ -959,6 +1077,7 @@ void GitClient::diffBranch(const QString &workingDirectory,
|
||||
<< userDiffArgs << branchName;
|
||||
|
||||
executeGit(workingDirectory, cmdArgs, editor);
|
||||
}
|
||||
}
|
||||
|
||||
void GitClient::merge(const QString &workingDirectory, const QStringList &unmergedFileNames)
|
||||
@@ -1037,6 +1156,23 @@ void GitClient::show(const QString &source, const QString &id, const QStringList
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings()->boolValue(GitSettings::useDiffEditorKey)) {
|
||||
QString title = tr("Git Show \"%1\"").arg(id);
|
||||
const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID;
|
||||
|
||||
DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("show", id);
|
||||
|
||||
if (!editorEditable) {
|
||||
editorEditable = qobject_cast<DiffEditor::DiffEditorEditable *>(
|
||||
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait));
|
||||
editorEditable->document()->setProperty("show", id);
|
||||
Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); // should probably go outside this block
|
||||
}
|
||||
|
||||
int timeout = settings()->intValue(GitSettings::timeoutKey);
|
||||
GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), source, processEnvironment(), timeout);
|
||||
handler->show(id);
|
||||
} else {
|
||||
const QString title = tr("Git Show \"%1\"").arg(id);
|
||||
const Core::Id editorId = Git::Constants::GIT_DIFF_EDITOR_ID;
|
||||
VcsBase::VcsBaseEditorWidget *editor = findExistingVCSEditor("show", id);
|
||||
@@ -1057,6 +1193,7 @@ void GitClient::show(const QString &source, const QString &id, const QStringList
|
||||
const QString workDir = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath();
|
||||
editor->setDiffBaseDirectory(workDir);
|
||||
executeGit(workDir, arguments, editor);
|
||||
}
|
||||
}
|
||||
|
||||
void GitClient::saveSettings()
|
||||
@@ -1275,7 +1412,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
|
||||
if (files.isEmpty())
|
||||
arguments << QLatin1String("--hard");
|
||||
else
|
||||
arguments << QLatin1String("HEAD") << QLatin1String("--") << files;
|
||||
arguments << QLatin1String(HEAD) << QLatin1String("--") << files;
|
||||
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
||||
const QString output = commandOutputFromLocal8Bit(outputText);
|
||||
outputWindow()->append(output);
|
||||
@@ -1327,7 +1464,7 @@ bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory,
|
||||
bool revertStaging /* = true */)
|
||||
{
|
||||
if (revertStaging && revision.isEmpty())
|
||||
revision = QLatin1String("HEAD");
|
||||
revision = QLatin1String(HEAD);
|
||||
if (files.isEmpty())
|
||||
files = QStringList(QString(QLatin1Char('.')));
|
||||
QByteArray outputText;
|
||||
@@ -1421,7 +1558,7 @@ bool GitClient::synchronousParentRevisions(const QString &workingDirectory,
|
||||
QString errorText;
|
||||
QStringList arguments;
|
||||
if (parents && !isValidRevision(revision)) { // Not Committed Yet
|
||||
*parents = QStringList(QLatin1String("HEAD"));
|
||||
*parents = QStringList(QLatin1String(HEAD));
|
||||
return true;
|
||||
}
|
||||
arguments << QLatin1String("--parents") << QLatin1String("--max-count=1") << revision;
|
||||
@@ -1467,7 +1604,7 @@ QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory
|
||||
{
|
||||
QByteArray outputTextData;
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("symbolic-ref") << QLatin1String("HEAD");
|
||||
arguments << QLatin1String("symbolic-ref") << QLatin1String(HEAD);
|
||||
if (fullySynchronousGit(workingDirectory, arguments, &outputTextData, 0, false)) {
|
||||
QString branch = commandOutputFromLocal8Bit(outputTextData.trimmed());
|
||||
const QString refsHeadsPrefix = QLatin1String("refs/heads/");
|
||||
@@ -1597,7 +1734,7 @@ QString GitClient::synchronousTopRevision(const QString &workingDirectory, QStri
|
||||
QStringList arguments;
|
||||
QString errorMessage;
|
||||
// get revision
|
||||
arguments << QLatin1String("rev-parse") << QLatin1String("HEAD");
|
||||
arguments << QLatin1String("rev-parse") << QLatin1String(HEAD);
|
||||
if (!fullySynchronousGit(workingDirectory, arguments, &outputTextData, &errorText, false)) {
|
||||
errorMessage = tr("Cannot retrieve top revision of \"%1\": %2")
|
||||
.arg(QDir::toNativeSeparators(workingDirectory), commandOutputFromLocal8Bit(errorText));
|
||||
@@ -2217,7 +2354,7 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory,
|
||||
QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryURL)
|
||||
{
|
||||
QStringList arguments(QLatin1String("ls-remote"));
|
||||
arguments << repositoryURL << QLatin1String("HEAD") << QLatin1String("refs/heads/*");
|
||||
arguments << repositoryURL << QLatin1String(HEAD) << QLatin1String("refs/heads/*");
|
||||
const unsigned flags =
|
||||
VcsBase::VcsBasePlugin::SshPasswordPrompt|
|
||||
VcsBase::VcsBasePlugin::SuppressStdErrInLogWindow|
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Utils {
|
||||
}
|
||||
|
||||
namespace DiffEditor {
|
||||
class DiffEditorWidget;
|
||||
class DiffEditorEditable;
|
||||
}
|
||||
|
||||
namespace Git {
|
||||
@@ -69,7 +69,6 @@ namespace Internal {
|
||||
|
||||
class GitPlugin;
|
||||
class GitOutputWindow;
|
||||
class GitDiffEditorWidget;
|
||||
class CommitData;
|
||||
struct GitSubmitEditorPanelData;
|
||||
class Stash;
|
||||
@@ -133,8 +132,6 @@ public:
|
||||
QString findRepositoryForDirectory(const QString &dir);
|
||||
QString findGitDirForRepository(const QString &repositoryDir) const;
|
||||
|
||||
DiffEditor::DiffEditorWidget *diffEditorWidget(const Core::IEditor *editor) const;
|
||||
|
||||
void diff(const QString &workingDirectory, const QStringList &diffArgs, const QString &fileName);
|
||||
void diff(const QString &workingDirectory, const QStringList &diffArgs,
|
||||
const QStringList &unstagedFileNames, const QStringList &stagedFileNames= QStringList());
|
||||
@@ -326,7 +323,7 @@ private:
|
||||
QTextCodec *getSourceCodec(const QString &file) const;
|
||||
VcsBase::VcsBaseEditorWidget *findExistingVCSEditor(const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue) const;
|
||||
DiffEditor::DiffEditorWidget *findExistingDiffEditor(const char *registerDynamicProperty,
|
||||
DiffEditor::DiffEditorEditable *findExistingDiffEditor(const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue) const;
|
||||
|
||||
enum CodecType { CodecSource, CodecLogOutput, CodecNone };
|
||||
|
||||
@@ -47,13 +47,17 @@ const char C_GIT_BLAME_EDITOR[] = "Git Annotation Editor";
|
||||
const char GIT_DIFF_EDITOR_ID[] = "Git Diff Editor";
|
||||
const char GIT_DIFF_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Diff Editor");
|
||||
const char C_GIT_DIFF_EDITOR[] = "Git Diff Editor";
|
||||
const char GIT_COMMIT_TEXT_EDITOR_ID[] = "Git Commit Editor";
|
||||
const char GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Commit Editor");
|
||||
const char C_GIT_COMMIT_TEXT_EDITOR[] = "Git Commit Editor";
|
||||
|
||||
const char C_GITSUBMITEDITOR[] = "Git Submit Editor";
|
||||
const char GITSUBMITEDITOR_ID[] = "Git Submit Editor";
|
||||
const char GITSUBMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Submit Editor");
|
||||
const char SUBMIT_CURRENT[] = "Git.SubmitCurrentLog";
|
||||
const char DIFF_SELECTED[] = "Git.DiffSelectedFilesInLog";
|
||||
const char SUBMIT_MIMETYPE[] = "application/vnd.nokia.text.git.submit";
|
||||
const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.git.submit";
|
||||
const char C_GITEDITORID[] = "Git Editor";
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace Git
|
||||
|
||||
@@ -33,9 +33,12 @@
|
||||
#include "gitplugin.h"
|
||||
#include "gitclient.h"
|
||||
#include "gitsettings.h"
|
||||
#include "gitsubmiteditorwidget.h"
|
||||
#include "gitconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
#include <texteditor/basetextdocument.h>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QRegExp>
|
||||
@@ -225,6 +228,13 @@ void GitEditor::revertChange()
|
||||
GitPlugin::instance()->gitClient()->synchronousRevert(workingDirectory, m_currentChange);
|
||||
}
|
||||
|
||||
void GitEditor::init()
|
||||
{
|
||||
VcsBase::VcsBaseEditorWidget::init();
|
||||
if (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
|
||||
new GitSubmitHighlighter(baseTextDocument().data());
|
||||
}
|
||||
|
||||
QString GitEditor::decorateVersion(const QString &revision) const
|
||||
{
|
||||
const QFileInfo fi(source());
|
||||
|
||||
@@ -59,6 +59,7 @@ private slots:
|
||||
void revertChange();
|
||||
|
||||
private:
|
||||
void init();
|
||||
QSet<QString> annotationChanges() const;
|
||||
QString changeUnderCursor(const QTextCursor &) const;
|
||||
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes, const QColor &bg) const;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/parameteraction.h>
|
||||
@@ -81,32 +82,35 @@
|
||||
#include <QScopedPointer>
|
||||
|
||||
static const unsigned minimumRequiredVersion = 0x010702;
|
||||
static const char RC_GIT_MIME_XML[] = ":/git/Git.mimetypes.xml";
|
||||
|
||||
static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
|
||||
{
|
||||
VcsBase::RegularCommandOutput,
|
||||
VcsBase::OtherContent,
|
||||
Git::Constants::GIT_COMMAND_LOG_EDITOR_ID,
|
||||
Git::Constants::GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME,
|
||||
Git::Constants::C_GIT_COMMAND_LOG_EDITOR,
|
||||
"application/vnd.nokia.text.scs_git_commandlog",
|
||||
"gitlog"},
|
||||
"text/vnd.qtcreator.git.commandlog"},
|
||||
{ VcsBase::LogOutput,
|
||||
Git::Constants::GIT_LOG_EDITOR_ID,
|
||||
Git::Constants::GIT_LOG_EDITOR_DISPLAY_NAME,
|
||||
Git::Constants::C_GIT_LOG_EDITOR,
|
||||
"application/vnd.nokia.text.scs_git_filelog",
|
||||
"gitfilelog"},
|
||||
"text/vnd.qtcreator.git.log"},
|
||||
{ VcsBase::AnnotateOutput,
|
||||
Git::Constants::GIT_BLAME_EDITOR_ID,
|
||||
Git::Constants::GIT_BLAME_EDITOR_DISPLAY_NAME,
|
||||
Git::Constants::C_GIT_BLAME_EDITOR,
|
||||
"application/vnd.nokia.text.scs_git_annotation",
|
||||
"gitsannotate"},
|
||||
"text/vnd.qtcreator.git.annotation"},
|
||||
{ VcsBase::DiffOutput,
|
||||
Git::Constants::GIT_DIFF_EDITOR_ID,
|
||||
Git::Constants::GIT_DIFF_EDITOR_DISPLAY_NAME,
|
||||
Git::Constants::C_GIT_DIFF_EDITOR,
|
||||
"text/x-patch","diff"}
|
||||
"text/x-patch"},
|
||||
{ VcsBase::DiffOutput,
|
||||
Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID,
|
||||
Git::Constants::GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME,
|
||||
Git::Constants::C_GIT_COMMIT_TEXT_EDITOR,
|
||||
"text/vnd.qtcreator.git.commit"},
|
||||
};
|
||||
|
||||
// Utility to find a parameter set by type
|
||||
@@ -266,7 +270,6 @@ ActionCommandPair
|
||||
bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
{
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(errorMessage)
|
||||
|
||||
m_settings.readSettings(Core::ICore::settings());
|
||||
|
||||
@@ -659,6 +662,9 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
command = Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, submitContext);
|
||||
|
||||
|
||||
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(RC_GIT_MIME_XML), errorMessage))
|
||||
return false;
|
||||
|
||||
/* "Gerrit" */
|
||||
m_gerritPlugin = new Gerrit::Internal::GerritPlugin(this);
|
||||
const bool ok = m_gerritPlugin->initialize(remoteRepositoryMenu);
|
||||
|
||||
@@ -55,28 +55,23 @@ static QTextCharFormat commentFormat()
|
||||
return settings.toTextCharFormat(TextEditor::C_COMMENT);
|
||||
}
|
||||
|
||||
// Highlighter for git submit messages. Make the first line bold, indicates
|
||||
// comments as such (retrieving the format from the text editor) and marks up
|
||||
// keywords (words in front of a colon as in 'Task: <bla>').
|
||||
|
||||
class GitSubmitHighlighter : QSyntaxHighlighter {
|
||||
public:
|
||||
explicit GitSubmitHighlighter(QTextEdit *parent);
|
||||
void highlightBlock(const QString &text);
|
||||
|
||||
private:
|
||||
enum State { None = -1, Header, Other };
|
||||
const QTextCharFormat m_commentFormat;
|
||||
QRegExp m_keywordPattern;
|
||||
const QChar m_hashChar;
|
||||
};
|
||||
|
||||
GitSubmitHighlighter::GitSubmitHighlighter(QTextEdit * parent) :
|
||||
QSyntaxHighlighter(parent),
|
||||
m_commentFormat(commentFormat()),
|
||||
m_keywordPattern(QLatin1String("^[\\w-]+:")),
|
||||
m_hashChar(QLatin1Char('#'))
|
||||
TextEditor::SyntaxHighlighter(parent)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
GitSubmitHighlighter::GitSubmitHighlighter(TextEditor::BaseTextDocument *parent) :
|
||||
TextEditor::SyntaxHighlighter(parent)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
void GitSubmitHighlighter::initialize()
|
||||
{
|
||||
m_commentFormat = commentFormat();
|
||||
m_keywordPattern.setPattern(QLatin1String("^[\\w-]+:"));
|
||||
m_hashChar = QLatin1Char('#');
|
||||
QTC_CHECK(m_keywordPattern.isValid());
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,12 @@
|
||||
#include "ui_gitsubmitpanel.h"
|
||||
#include "gitsettings.h"
|
||||
|
||||
#include <texteditor/syntaxhighlighter.h>
|
||||
#include <vcsbase/submiteditorwidget.h>
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QSyntaxHighlighter>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QValidator;
|
||||
QT_END_NAMESPACE
|
||||
@@ -89,6 +93,25 @@ private:
|
||||
bool m_isInitialized;
|
||||
};
|
||||
|
||||
// Highlighter for git submit messages. Make the first line bold, indicates
|
||||
// comments as such (retrieving the format from the text editor) and marks up
|
||||
// keywords (words in front of a colon as in 'Task: <bla>').
|
||||
|
||||
class GitSubmitHighlighter : public TextEditor::SyntaxHighlighter
|
||||
{
|
||||
public:
|
||||
explicit GitSubmitHighlighter(QTextEdit *parent);
|
||||
explicit GitSubmitHighlighter(TextEditor::BaseTextDocument *parent);
|
||||
void highlightBlock(const QString &text);
|
||||
|
||||
void initialize();
|
||||
private:
|
||||
enum State { None = -1, Header, Other };
|
||||
QTextCharFormat m_commentFormat;
|
||||
QRegExp m_keywordPattern;
|
||||
QChar m_hashChar;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
|
||||
|
||||
@@ -46,34 +46,25 @@ const char CHANGEIDEXACT40[] = "[a-f0-9]{40,40}";
|
||||
const char DIFFIDENTIFIER[] = "^(?:diff --git a/|[+-]{3} (?:/dev/null|[ab]/(.+$)))";
|
||||
|
||||
// Base editor parameters
|
||||
const char COMMANDLOG_ID[] = "Mercurial Command Log Editor";
|
||||
const char COMMANDLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Command Log Editor");
|
||||
const char COMMANDLOG[] = "Mercurial Command Log Editor";
|
||||
const char COMMANDAPP[] = "application/vnd.nokia.text.scs_mercurial_commandlog";
|
||||
const char COMMANDEXT[] = "vcsMercurialCommand";
|
||||
|
||||
const char FILELOG_ID[] = "Mercurial File Log Editor";
|
||||
const char FILELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial File Log Editor");
|
||||
const char FILELOG[] = "Mercurial File Log Editor";
|
||||
const char LOGAPP[] = "application/vnd.nokia.text.scs_mercurial_log";
|
||||
const char LOGEXT[] = "vcsMercurialLog";
|
||||
const char LOGAPP[] = "text/vnd.qtcreator.mercurial.log";
|
||||
|
||||
const char ANNOTATELOG_ID[] = "Mercurial Annotation Editor";
|
||||
const char ANNOTATELOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Annotation Editor");
|
||||
const char ANNOTATELOG[] = "Mercurial Annotation Editor";
|
||||
const char ANNOTATEAPP[] = "application/vnd.nokia.text.scs_mercurial_annotatelog";
|
||||
const char ANNOTATEEXT[] = "vcsMercurialAnnotate";
|
||||
const char ANNOTATEAPP[] = "text/vnd.qtcreator.mercurial.annotation";
|
||||
|
||||
const char DIFFLOG_ID[] = "Mercurial Diff Editor";
|
||||
const char DIFFLOG_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Diff Editor");
|
||||
const char DIFFLOG[] = "Mercurial Diff Editor";
|
||||
const char DIFFAPP[] = "text/x-patch";
|
||||
const char DIFFEXT[] = "diff";
|
||||
|
||||
// Submit editor parameters
|
||||
const char COMMIT_ID[] = "Mercurial Commit Log Editor";
|
||||
const char COMMIT_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Mercurial Commit Log Editor");
|
||||
const char COMMITMIMETYPE[] = "application/vnd.nokia.text.scs_mercurial_commitlog";
|
||||
const char COMMITMIMETYPE[] = "text/vnd.qtcreator.mercurial.commit";
|
||||
|
||||
// File menu actions
|
||||
const char ADD[] = "Mercurial.AddSingleFile";
|
||||
|
||||
@@ -75,33 +75,23 @@ using namespace Utils;
|
||||
|
||||
static const VcsBaseEditorParameters editorParameters[] = {
|
||||
{
|
||||
RegularCommandOutput, //type
|
||||
Constants::COMMANDLOG_ID, // id
|
||||
Constants::COMMANDLOG_DISPLAY_NAME, // display name
|
||||
Constants::COMMANDLOG, // context
|
||||
Constants::COMMANDAPP, // mime type
|
||||
Constants::COMMANDEXT}, //extension
|
||||
|
||||
{ LogOutput,
|
||||
LogOutput,
|
||||
Constants::FILELOG_ID,
|
||||
Constants::FILELOG_DISPLAY_NAME,
|
||||
Constants::FILELOG,
|
||||
Constants::LOGAPP,
|
||||
Constants::LOGEXT},
|
||||
Constants::LOGAPP},
|
||||
|
||||
{ AnnotateOutput,
|
||||
Constants::ANNOTATELOG_ID,
|
||||
Constants::ANNOTATELOG_DISPLAY_NAME,
|
||||
Constants::ANNOTATELOG,
|
||||
Constants::ANNOTATEAPP,
|
||||
Constants::ANNOTATEEXT},
|
||||
Constants::ANNOTATEAPP},
|
||||
|
||||
{ DiffOutput,
|
||||
Constants::DIFFLOG_ID,
|
||||
Constants::DIFFLOG_DISPLAY_NAME,
|
||||
Constants::DIFFLOG,
|
||||
Constants::DIFFAPP,
|
||||
Constants::DIFFEXT}
|
||||
Constants::DIFFAPP}
|
||||
};
|
||||
|
||||
static const VcsBaseSubmitEditorParameters submitEditorParameters = {
|
||||
|
||||
@@ -39,10 +39,6 @@ const char PERFORCE_SUBMIT_EDITOR_ID[] = "Perforce.SubmitEditor";
|
||||
const char PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce.SubmitEditor");
|
||||
const char PERFORCESUBMITEDITOR_CONTEXT[] = "Perforce Submit Editor";
|
||||
|
||||
const char PERFORCE_COMMANDLOG_EDITOR_ID[] = "Perfoirce.CommandLogEditor";
|
||||
const char PERFORCE_COMMANDLOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce CommandLog Editor");
|
||||
const char PERFORCE_COMMANDLOG_EDITOR_CONTEXT[] = "Perforce Command Log Editor";
|
||||
|
||||
const char PERFORCE_LOG_EDITOR_ID[] = "Perforce.LogEditor";
|
||||
const char PERFORCE_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce Log Editor");
|
||||
const char PERFORCE_LOG_EDITOR_CONTEXT[] = "Perforce Log Editor";
|
||||
@@ -57,7 +53,7 @@ const char PERFORCE_ANNOTATION_EDITOR_CONTEXT[] = "Perforce Annotation Editor";
|
||||
|
||||
const char SUBMIT_CURRENT[] = "Perforce.SubmitCurrentLog";
|
||||
const char DIFF_SELECTED[] = "Perforce.DiffSelectedFilesInLog";
|
||||
const char SUBMIT_MIMETYPE[] = "application/vnd.nokia.text.p4.submit";
|
||||
const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.p4.submit";
|
||||
|
||||
enum { debug = 0 };
|
||||
|
||||
|
||||
@@ -74,29 +74,21 @@
|
||||
|
||||
static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
|
||||
{
|
||||
VcsBase::RegularCommandOutput,
|
||||
Perforce::Constants::PERFORCE_COMMANDLOG_EDITOR_ID,
|
||||
Perforce::Constants::PERFORCE_COMMANDLOG_EDITOR_DISPLAY_NAME,
|
||||
Perforce::Constants::PERFORCE_COMMANDLOG_EDITOR_CONTEXT,
|
||||
"application/vnd.nokia.text.scs_commandlog",
|
||||
"scslog"},
|
||||
{ VcsBase::LogOutput,
|
||||
VcsBase::LogOutput,
|
||||
Perforce::Constants::PERFORCE_LOG_EDITOR_ID,
|
||||
Perforce::Constants::PERFORCE_LOG_EDITOR_DISPLAY_NAME,
|
||||
Perforce::Constants::PERFORCE_LOG_EDITOR_CONTEXT,
|
||||
"application/vnd.nokia.text.scs_filelog",
|
||||
"scsfilelog"},
|
||||
"text/vnd.qtcreator.p4.log"},
|
||||
{ VcsBase::AnnotateOutput,
|
||||
Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_ID,
|
||||
Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME,
|
||||
Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_CONTEXT,
|
||||
"application/vnd.nokia.text.scs_annotation",
|
||||
"scsannotate"},
|
||||
"text/vnd.qtcreator.p4.annotation"},
|
||||
{ VcsBase::DiffOutput,
|
||||
Perforce::Constants::PERFORCE_DIFF_EDITOR_ID,
|
||||
Perforce::Constants::PERFORCE_DIFF_EDITOR_DISPLAY_NAME,
|
||||
Perforce::Constants::PERFORCE_DIFF_EDITOR_CONTEXT,
|
||||
"text/x-patch","diff"}
|
||||
"text/x-patch"}
|
||||
};
|
||||
|
||||
// Utility to find a parameter set by type
|
||||
|
||||
@@ -850,14 +850,13 @@ bool replaceFieldHelper(ValueStringTransformation transform,
|
||||
int nextPos = s->indexOf(delimiter, pos + 1);
|
||||
if (nextPos == -1)
|
||||
break;
|
||||
nextPos++; // Point past 2nd delimiter
|
||||
if (nextPos == pos + 2) {
|
||||
if (nextPos == pos + 1) {
|
||||
pos = nextPos; // Skip '%%'
|
||||
continue;
|
||||
}
|
||||
// Evaluate field specification for modifiers
|
||||
// "%field:l%"
|
||||
QString fieldSpec = s->mid(pos + 1, nextPos - pos - 2);
|
||||
QString fieldSpec = s->mid(pos + 1, nextPos - pos - 1);
|
||||
const int fieldSpecSize = fieldSpec.size();
|
||||
char modifier = '\0';
|
||||
if (fieldSpecSize >= 3 && fieldSpec.at(fieldSpecSize - 2) == modifierDelimiter) {
|
||||
|
||||
@@ -171,7 +171,7 @@ const char CPP_SOURCE_MIMETYPE[] = "text/x-c++src";
|
||||
const char CPP_HEADER_MIMETYPE[] = "text/x-c++hdr";
|
||||
const char FORM_MIMETYPE[] = "application/x-designer";
|
||||
const char QML_MIMETYPE[] = "application/x-qml"; // separate def also in qmljstoolsconstants.h
|
||||
const char RESOURCE_MIMETYPE[] = "application/vnd.nokia.xml.qt.resource";
|
||||
const char RESOURCE_MIMETYPE[] = "application/vnd.qt.xml.resource";
|
||||
|
||||
// Settings page
|
||||
const char PROJECTEXPLORER_SETTINGS_CATEGORY[] = "K.ProjectExplorer";
|
||||
|
||||
@@ -241,21 +241,21 @@ public:
|
||||
|
||||
bool isEnabled() const { return true; }
|
||||
|
||||
protected:
|
||||
// this is just the in-memory representation, a subclass
|
||||
// will add the persistent stuff
|
||||
explicit ProjectNode(const QString &projectFilePath);
|
||||
void addFolderNodes(const QList<FolderNode*> &subFolders, FolderNode *parentFolder);
|
||||
void removeFolderNodes(const QList<FolderNode*> &subFolders, FolderNode *parentFolder);
|
||||
|
||||
void addFileNodes(const QList<FileNode*> &files, FolderNode *parentFolder);
|
||||
void removeFileNodes(const QList<FileNode*> &files, FolderNode *parentFolder);
|
||||
|
||||
// to be called in implementation of
|
||||
// the corresponding public methods
|
||||
void addProjectNodes(const QList<ProjectNode*> &subProjects);
|
||||
void removeProjectNodes(const QList<ProjectNode*> &subProjects);
|
||||
|
||||
void addFolderNodes(const QList<FolderNode*> &subFolders, FolderNode *parentFolder);
|
||||
void removeFolderNodes(const QList<FolderNode*> &subFolders, FolderNode *parentFolder);
|
||||
|
||||
void addFileNodes(const QList<FileNode*> &files, FolderNode *parentFolder);
|
||||
void removeFileNodes(const QList<FileNode*> &files, FolderNode *parentFolder);
|
||||
protected:
|
||||
// this is just the in-memory representation, a subclass
|
||||
// will add the persistent stuff
|
||||
explicit ProjectNode(const QString &projectFilePath);
|
||||
|
||||
private slots:
|
||||
void watcherDestroyed(QObject *watcher);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
include(../../qtcreatorplugin.pri)
|
||||
include(pythoneditor_dependencies.pri)
|
||||
|
||||
DEFINES += \
|
||||
PYTHONEDITOR_LIBRARY
|
||||
|
||||
@@ -116,7 +116,7 @@ void QbsBuildStep::run(QFutureInterface<bool> &fi)
|
||||
|
||||
QbsProject *pro = static_cast<QbsProject *>(project());
|
||||
qbs::BuildOptions options(m_qbsBuildOptions);
|
||||
options.changedFiles = m_changedFiles;
|
||||
options.setChangedFiles(m_changedFiles);
|
||||
|
||||
m_job = pro->build(options);
|
||||
|
||||
@@ -179,18 +179,18 @@ void QbsBuildStep::setQbsConfiguration(const QVariantMap &config)
|
||||
|
||||
bool QbsBuildStep::dryRun() const
|
||||
{
|
||||
return m_qbsBuildOptions.dryRun;
|
||||
return m_qbsBuildOptions.dryRun();
|
||||
}
|
||||
|
||||
bool QbsBuildStep::keepGoing() const
|
||||
{
|
||||
return m_qbsBuildOptions.keepGoing;
|
||||
return m_qbsBuildOptions.keepGoing();
|
||||
}
|
||||
|
||||
int QbsBuildStep::maxJobs() const
|
||||
{
|
||||
if (m_qbsBuildOptions.maxJobCount > 0)
|
||||
return m_qbsBuildOptions.maxJobCount;
|
||||
if (m_qbsBuildOptions.maxJobCount() > 0)
|
||||
return m_qbsBuildOptions.maxJobCount();
|
||||
return qbs::BuildOptions::defaultMaxJobCount();
|
||||
}
|
||||
|
||||
@@ -200,9 +200,9 @@ bool QbsBuildStep::fromMap(const QVariantMap &map)
|
||||
return false;
|
||||
|
||||
setQbsConfiguration(map.value(QLatin1String(QBS_CONFIG)).toMap());
|
||||
m_qbsBuildOptions.dryRun = map.value(QLatin1String(QBS_DRY_RUN)).toBool();
|
||||
m_qbsBuildOptions.keepGoing = map.value(QLatin1String(QBS_KEEP_GOING)).toBool();
|
||||
m_qbsBuildOptions.maxJobCount = map.value(QLatin1String(QBS_MAXJOBCOUNT)).toInt();
|
||||
m_qbsBuildOptions.setDryRun(map.value(QLatin1String(QBS_DRY_RUN)).toBool());
|
||||
m_qbsBuildOptions.setKeepGoing(map.value(QLatin1String(QBS_KEEP_GOING)).toBool());
|
||||
m_qbsBuildOptions.setMaxJobCount(map.value(QLatin1String(QBS_MAXJOBCOUNT)).toInt());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -210,9 +210,9 @@ QVariantMap QbsBuildStep::toMap() const
|
||||
{
|
||||
QVariantMap map = ProjectExplorer::BuildStep::toMap();
|
||||
map.insert(QLatin1String(QBS_CONFIG), m_qbsConfiguration);
|
||||
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsBuildOptions.dryRun);
|
||||
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsBuildOptions.keepGoing);
|
||||
map.insert(QLatin1String(QBS_MAXJOBCOUNT), m_qbsBuildOptions.maxJobCount);
|
||||
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsBuildOptions.dryRun());
|
||||
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsBuildOptions.keepGoing());
|
||||
map.insert(QLatin1String(QBS_MAXJOBCOUNT), m_qbsBuildOptions.maxJobCount());
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ void QbsBuildStep::buildingDone(bool success)
|
||||
// Report errors:
|
||||
foreach (const qbs::ErrorData &data, m_job->error().entries())
|
||||
createTaskAndOutput(ProjectExplorer::Task::Error, data.description(),
|
||||
data.codeLocation().fileName, data.codeLocation().line);
|
||||
data.codeLocation().fileName(), data.codeLocation().line());
|
||||
|
||||
QTC_ASSERT(m_fi, return);
|
||||
m_fi->reportResult(success);
|
||||
@@ -251,7 +251,7 @@ void QbsBuildStep::handleWarningReport(const qbs::Error &error)
|
||||
{
|
||||
foreach (const qbs::ErrorData &data, error.entries()) {
|
||||
createTaskAndOutput(ProjectExplorer::Task::Warning, data.description(),
|
||||
data.codeLocation().fileName, data.codeLocation().line);
|
||||
data.codeLocation().fileName(), data.codeLocation().line());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,21 +263,21 @@ void QbsBuildStep::handleCommandDescriptionReport(const QString &highlight, cons
|
||||
|
||||
void QbsBuildStep::handleProcessResultReport(const qbs::ProcessResult &result)
|
||||
{
|
||||
bool hasOutput = !result.stdOut.isEmpty() || !result.stdErr.isEmpty();
|
||||
bool hasOutput = !result.stdOut().isEmpty() || !result.stdErr().isEmpty();
|
||||
|
||||
if (result.success && !hasOutput)
|
||||
if (result.success() && !hasOutput)
|
||||
return;
|
||||
|
||||
m_parser->setWorkingDirectory(result.workingDirectory);
|
||||
m_parser->setWorkingDirectory(result.workingDirectory());
|
||||
|
||||
QString commandline = result.binary + QLatin1Char(' ') + result.arguments.join(QLatin1String(" "));
|
||||
QString commandline = result.executableFilePath() + QLatin1Char(' ') + result.arguments().join(QLatin1String(" "));
|
||||
addOutput(commandline, NormalOutput);
|
||||
|
||||
foreach (const QString &line, result.stdErr) {
|
||||
foreach (const QString &line, result.stdErr()) {
|
||||
m_parser->stdError(line);
|
||||
addOutput(line, ErrorOutput);
|
||||
}
|
||||
foreach (const QString &line, result.stdOut) {
|
||||
foreach (const QString &line, result.stdOut()) {
|
||||
m_parser->stdOutput(line);
|
||||
addOutput(line, NormalOutput);
|
||||
}
|
||||
@@ -312,25 +312,25 @@ QString QbsBuildStep::profile() const
|
||||
|
||||
void QbsBuildStep::setDryRun(bool dr)
|
||||
{
|
||||
if (m_qbsBuildOptions.dryRun == dr)
|
||||
if (m_qbsBuildOptions.dryRun() == dr)
|
||||
return;
|
||||
m_qbsBuildOptions.dryRun = dr;
|
||||
m_qbsBuildOptions.setDryRun(dr);
|
||||
emit qbsBuildOptionsChanged();
|
||||
}
|
||||
|
||||
void QbsBuildStep::setKeepGoing(bool kg)
|
||||
{
|
||||
if (m_qbsBuildOptions.keepGoing == kg)
|
||||
if (m_qbsBuildOptions.keepGoing() == kg)
|
||||
return;
|
||||
m_qbsBuildOptions.keepGoing = kg;
|
||||
m_qbsBuildOptions.setKeepGoing(kg);
|
||||
emit qbsBuildOptionsChanged();
|
||||
}
|
||||
|
||||
void QbsBuildStep::setMaxJobs(int jobcount)
|
||||
{
|
||||
if (m_qbsBuildOptions.maxJobCount == jobcount)
|
||||
if (m_qbsBuildOptions.maxJobCount() == jobcount)
|
||||
return;
|
||||
m_qbsBuildOptions.maxJobCount = jobcount;
|
||||
m_qbsBuildOptions.setMaxJobCount(jobcount);
|
||||
emit qbsBuildOptionsChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -134,12 +134,12 @@ void QbsCleanStep::cancel()
|
||||
|
||||
bool QbsCleanStep::dryRun() const
|
||||
{
|
||||
return m_qbsCleanOptions.dryRun;
|
||||
return m_qbsCleanOptions.dryRun();
|
||||
}
|
||||
|
||||
bool QbsCleanStep::keepGoing() const
|
||||
{
|
||||
return m_qbsCleanOptions.keepGoing;
|
||||
return m_qbsCleanOptions.keepGoing();
|
||||
}
|
||||
|
||||
int QbsCleanStep::maxJobs() const
|
||||
@@ -149,7 +149,7 @@ int QbsCleanStep::maxJobs() const
|
||||
|
||||
bool QbsCleanStep::cleanAll() const
|
||||
{
|
||||
return m_qbsCleanOptions.cleanType == qbs::CleanOptions::CleanupAll;
|
||||
return m_qbsCleanOptions.cleanType() == qbs::CleanOptions::CleanupAll;
|
||||
}
|
||||
|
||||
bool QbsCleanStep::fromMap(const QVariantMap &map)
|
||||
@@ -157,10 +157,10 @@ bool QbsCleanStep::fromMap(const QVariantMap &map)
|
||||
if (!ProjectExplorer::BuildStep::fromMap(map))
|
||||
return false;
|
||||
|
||||
m_qbsCleanOptions.dryRun = map.value(QLatin1String(QBS_DRY_RUN)).toBool();
|
||||
m_qbsCleanOptions.keepGoing = map.value(QLatin1String(QBS_KEEP_GOING)).toBool();
|
||||
m_qbsCleanOptions.cleanType = map.value(QLatin1String(QBS_CLEAN_ALL)).toBool()
|
||||
? qbs::CleanOptions::CleanupAll : qbs::CleanOptions::CleanupTemporaries;
|
||||
m_qbsCleanOptions.setDryRun(map.value(QLatin1String(QBS_DRY_RUN)).toBool());
|
||||
m_qbsCleanOptions.setKeepGoing(map.value(QLatin1String(QBS_KEEP_GOING)).toBool());
|
||||
m_qbsCleanOptions.setCleanType(map.value(QLatin1String(QBS_CLEAN_ALL)).toBool()
|
||||
? qbs::CleanOptions::CleanupAll : qbs::CleanOptions::CleanupTemporaries);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -168,10 +168,10 @@ bool QbsCleanStep::fromMap(const QVariantMap &map)
|
||||
QVariantMap QbsCleanStep::toMap() const
|
||||
{
|
||||
QVariantMap map = ProjectExplorer::BuildStep::toMap();
|
||||
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsCleanOptions.dryRun);
|
||||
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsCleanOptions.keepGoing);
|
||||
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsCleanOptions.dryRun());
|
||||
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsCleanOptions.keepGoing());
|
||||
map.insert(QLatin1String(QBS_CLEAN_ALL),
|
||||
m_qbsCleanOptions.cleanType == qbs::CleanOptions::CleanupAll);
|
||||
m_qbsCleanOptions.cleanType() == qbs::CleanOptions::CleanupAll);
|
||||
|
||||
return map;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ void QbsCleanStep::cleaningDone(bool success)
|
||||
// Report errors:
|
||||
foreach (const qbs::ErrorData &data, m_job->error().entries()) {
|
||||
createTaskAndOutput(ProjectExplorer::Task::Error, data.description(),
|
||||
data.codeLocation().fileName, data.codeLocation().line);
|
||||
data.codeLocation().fileName(), data.codeLocation().line());
|
||||
}
|
||||
|
||||
QTC_ASSERT(m_fi, return);
|
||||
@@ -217,17 +217,17 @@ void QbsCleanStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, con
|
||||
|
||||
void QbsCleanStep::setDryRun(bool dr)
|
||||
{
|
||||
if (m_qbsCleanOptions.dryRun == dr)
|
||||
if (m_qbsCleanOptions.dryRun() == dr)
|
||||
return;
|
||||
m_qbsCleanOptions.dryRun = dr;
|
||||
m_qbsCleanOptions.setDryRun(dr);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QbsCleanStep::setKeepGoing(bool kg)
|
||||
{
|
||||
if (m_qbsCleanOptions.keepGoing == kg)
|
||||
if (m_qbsCleanOptions.keepGoing() == kg)
|
||||
return;
|
||||
m_qbsCleanOptions.keepGoing = kg;
|
||||
m_qbsCleanOptions.setKeepGoing(kg);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
@@ -241,9 +241,9 @@ void QbsCleanStep::setCleanAll(bool ca)
|
||||
{
|
||||
qbs::CleanOptions::CleanType newType = ca
|
||||
? qbs::CleanOptions::CleanupAll : qbs::CleanOptions::CleanupTemporaries;
|
||||
if (m_qbsCleanOptions.cleanType == newType)
|
||||
if (m_qbsCleanOptions.cleanType() == newType)
|
||||
return;
|
||||
m_qbsCleanOptions.cleanType = newType;
|
||||
m_qbsCleanOptions.setCleanType(newType);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
@@ -126,8 +126,8 @@ void QbsInstallStep::cancel()
|
||||
|
||||
QString QbsInstallStep::installRoot() const
|
||||
{
|
||||
if (!m_qbsInstallOptions.installRoot.isEmpty())
|
||||
return m_qbsInstallOptions.installRoot;
|
||||
if (!m_qbsInstallOptions.installRoot().isEmpty())
|
||||
return m_qbsInstallOptions.installRoot();
|
||||
|
||||
return qbs::InstallOptions::defaultInstallRoot();
|
||||
}
|
||||
@@ -143,17 +143,17 @@ QString QbsInstallStep::absoluteInstallRoot() const
|
||||
|
||||
bool QbsInstallStep::removeFirst() const
|
||||
{
|
||||
return m_qbsInstallOptions.removeFirst;
|
||||
return m_qbsInstallOptions.removeExistingInstallation();
|
||||
}
|
||||
|
||||
bool QbsInstallStep::dryRun() const
|
||||
{
|
||||
return m_qbsInstallOptions.dryRun;
|
||||
return m_qbsInstallOptions.dryRun();
|
||||
}
|
||||
|
||||
bool QbsInstallStep::keepGoing() const
|
||||
{
|
||||
return m_qbsInstallOptions.keepGoing;
|
||||
return m_qbsInstallOptions.keepGoing();
|
||||
}
|
||||
|
||||
bool QbsInstallStep::fromMap(const QVariantMap &map)
|
||||
@@ -162,9 +162,9 @@ bool QbsInstallStep::fromMap(const QVariantMap &map)
|
||||
return false;
|
||||
|
||||
setInstallRoot(map.value(QLatin1String(QBS_INSTALL_ROOT)).toString());
|
||||
m_qbsInstallOptions.removeFirst = map.value(QLatin1String(QBS_REMOVE_FIRST), false).toBool();
|
||||
m_qbsInstallOptions.dryRun = map.value(QLatin1String(QBS_DRY_RUN), false).toBool();
|
||||
m_qbsInstallOptions.keepGoing = map.value(QLatin1String(QBS_KEEP_GOING), false).toBool();
|
||||
m_qbsInstallOptions.setRemoveExistingInstallation(map.value(QLatin1String(QBS_REMOVE_FIRST), false).toBool());
|
||||
m_qbsInstallOptions.setDryRun(map.value(QLatin1String(QBS_DRY_RUN), false).toBool());
|
||||
m_qbsInstallOptions.setKeepGoing(map.value(QLatin1String(QBS_KEEP_GOING), false).toBool());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -172,20 +172,25 @@ bool QbsInstallStep::fromMap(const QVariantMap &map)
|
||||
QVariantMap QbsInstallStep::toMap() const
|
||||
{
|
||||
QVariantMap map = ProjectExplorer::BuildStep::toMap();
|
||||
map.insert(QLatin1String(QBS_INSTALL_ROOT), m_qbsInstallOptions.installRoot);
|
||||
map.insert(QLatin1String(QBS_REMOVE_FIRST), m_qbsInstallOptions.removeFirst);
|
||||
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsInstallOptions.dryRun);
|
||||
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsInstallOptions.keepGoing);
|
||||
map.insert(QLatin1String(QBS_INSTALL_ROOT), m_qbsInstallOptions.installRoot());
|
||||
map.insert(QLatin1String(QBS_REMOVE_FIRST), m_qbsInstallOptions.removeExistingInstallation());
|
||||
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsInstallOptions.dryRun());
|
||||
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsInstallOptions.keepGoing());
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
qbs::InstallOptions QbsInstallStep::installOptions() const
|
||||
{
|
||||
return m_qbsInstallOptions;
|
||||
}
|
||||
|
||||
void QbsInstallStep::installDone(bool success)
|
||||
{
|
||||
// Report errors:
|
||||
foreach (const qbs::ErrorData &data, m_job->error().entries()) {
|
||||
createTaskAndOutput(ProjectExplorer::Task::Error, data.description(),
|
||||
data.codeLocation().fileName, data.codeLocation().line);
|
||||
data.codeLocation().fileName(), data.codeLocation().line());
|
||||
}
|
||||
|
||||
QTC_ASSERT(m_fi, return);
|
||||
@@ -222,33 +227,33 @@ void QbsInstallStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type,
|
||||
|
||||
void QbsInstallStep::setInstallRoot(const QString &ir)
|
||||
{
|
||||
if (m_qbsInstallOptions.installRoot == ir)
|
||||
if (m_qbsInstallOptions.installRoot() == ir)
|
||||
return;
|
||||
m_qbsInstallOptions.installRoot = ir;
|
||||
m_qbsInstallOptions.installRoot() = ir;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QbsInstallStep::setRemoveFirst(bool rf)
|
||||
{
|
||||
if (m_qbsInstallOptions.removeFirst == rf)
|
||||
if (m_qbsInstallOptions.removeExistingInstallation() == rf)
|
||||
return;
|
||||
m_qbsInstallOptions.removeFirst = rf;
|
||||
m_qbsInstallOptions.setRemoveExistingInstallation(rf);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QbsInstallStep::setDryRun(bool dr)
|
||||
{
|
||||
if (m_qbsInstallOptions.dryRun == dr)
|
||||
if (m_qbsInstallOptions.dryRun() == dr)
|
||||
return;
|
||||
m_qbsInstallOptions.dryRun = dr;
|
||||
m_qbsInstallOptions.setDryRun(dr);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QbsInstallStep::setKeepGoing(bool kg)
|
||||
{
|
||||
if (m_qbsInstallOptions.keepGoing == kg)
|
||||
if (m_qbsInstallOptions.keepGoing() == kg)
|
||||
return;
|
||||
m_qbsInstallOptions.keepGoing = kg;
|
||||
m_qbsInstallOptions.setKeepGoing(kg);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
bool fromMap(const QVariantMap &map);
|
||||
QVariantMap toMap() const;
|
||||
|
||||
qbs::InstallOptions installOptions() const;
|
||||
QString installRoot() const;
|
||||
QString absoluteInstallRoot() const;
|
||||
bool removeFirst() const;
|
||||
|
||||
@@ -48,10 +48,20 @@
|
||||
// Helpers:
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
static QString displayNameFromPath(const QString &path, const QString &base)
|
||||
{
|
||||
QString dir = base;
|
||||
if (!base.endsWith(QLatin1Char('/')))
|
||||
dir.append(QLatin1Char('/'));
|
||||
|
||||
QIcon generateIcon()
|
||||
QString name = path;
|
||||
if (name.startsWith(dir))
|
||||
name = name.mid(dir.count());
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static QIcon generateIcon()
|
||||
{
|
||||
const QSize desiredSize = QSize(16, 16);
|
||||
const QIcon projectBaseIcon(QString::fromLatin1(QtSupport::Constants::ICON_QT_PROJECT));
|
||||
@@ -65,13 +75,16 @@ QIcon generateIcon()
|
||||
return result;
|
||||
}
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
QIcon QbsProjectNode::m_projectIcon = generateIcon();
|
||||
QIcon QbsProductNode::m_productIcon = generateIcon();
|
||||
QIcon QbsGroupNode::m_groupIcon = generateIcon();
|
||||
|
||||
class FileTreeNode {
|
||||
public:
|
||||
FileTreeNode(const QString &n, FileTreeNode *p = 0) :
|
||||
explicit FileTreeNode(const QString &n = QString(), FileTreeNode *p = 0) :
|
||||
parent(p), name(n)
|
||||
{
|
||||
if (p)
|
||||
@@ -127,6 +140,33 @@ public:
|
||||
reorder(n, basedir, root);
|
||||
}
|
||||
|
||||
static void moveChildrenUp(FileTreeNode *node)
|
||||
{
|
||||
if (!node || !node->parent)
|
||||
return;
|
||||
|
||||
FileTreeNode *newParent = node->parent;
|
||||
|
||||
// disconnect node and parent:
|
||||
node->parent = 0;
|
||||
newParent->children.removeOne(node);
|
||||
|
||||
foreach (FileTreeNode *c, node->children) {
|
||||
// update path, make sure there will be no / before "C:" on windows:
|
||||
if (Utils::HostOsInfo::isWindowsHost() && node->name.isEmpty())
|
||||
c->name = node->name;
|
||||
else
|
||||
c->name = node->name + QLatin1Char('/') + c->name;
|
||||
|
||||
newParent->children.append(c);
|
||||
c->parent = newParent;
|
||||
}
|
||||
|
||||
// Delete node
|
||||
node->children.clear();
|
||||
delete node;
|
||||
}
|
||||
|
||||
static void simplify(FileTreeNode *node)
|
||||
{
|
||||
foreach (FileTreeNode *c, node->children)
|
||||
@@ -135,24 +175,23 @@ public:
|
||||
if (!node->parent)
|
||||
return;
|
||||
|
||||
if (node->children.count() == 1) {
|
||||
FileTreeNode *child = node->children.at(0);
|
||||
if (child->isFile())
|
||||
return;
|
||||
|
||||
if (!Utils::HostOsInfo::isWindowsHost() || !node->name.isEmpty())
|
||||
node->name = node->name + QLatin1Char('/') + child->name;
|
||||
else
|
||||
node->name = child->name;
|
||||
node->children = child->children;
|
||||
|
||||
foreach (FileTreeNode *tmpChild, node->children)
|
||||
tmpChild->parent = node;
|
||||
|
||||
child->children.clear();
|
||||
child->parent = 0;
|
||||
delete child;
|
||||
if (node->children.count() == 1 && !node->children.at(0)->isFile())
|
||||
moveChildrenUp(node->children.at(0));
|
||||
}
|
||||
|
||||
static void moveBaseFolderContents(FileTreeNode *root, const QString &baseDir)
|
||||
{
|
||||
// Move files/folders found in the base folder up one level. The baseDir must be a child of
|
||||
// the root of the FileNodeTree.
|
||||
FileTreeNode *baseDirNode = 0;
|
||||
foreach (FileTreeNode *c, root->children) {
|
||||
if (c->path() == baseDir) {
|
||||
baseDirNode = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
moveChildrenUp(baseDirNode);
|
||||
}
|
||||
|
||||
QString path()
|
||||
@@ -273,7 +312,13 @@ QbsGroupNode::QbsGroupNode(const qbs::GroupData *grp, const QString &productPath
|
||||
m_qbsGroupData(0)
|
||||
{
|
||||
setIcon(m_groupIcon);
|
||||
setQbsGroupData(grp, productPath);
|
||||
|
||||
QbsFileNode *idx = new QbsFileNode(grp->location().fileName(),
|
||||
ProjectExplorer::ProjectFileType, false,
|
||||
grp->location().line());
|
||||
addFileNodes(QList<ProjectExplorer::FileNode *>() << idx, this);
|
||||
|
||||
updateQbsGroupData(grp, productPath);
|
||||
}
|
||||
|
||||
bool QbsGroupNode::isEnabled() const
|
||||
@@ -281,81 +326,80 @@ bool QbsGroupNode::isEnabled() const
|
||||
return static_cast<QbsProductNode *>(parentFolderNode())->isEnabled() && qbsGroupData()->isEnabled();
|
||||
}
|
||||
|
||||
void QbsGroupNode::setQbsGroupData(const qbs::GroupData *group, const QString &productPath)
|
||||
void QbsGroupNode::updateQbsGroupData(const qbs::GroupData *grp, const QString &productPath)
|
||||
{
|
||||
if (group == m_qbsGroupData && productPath == m_productPath)
|
||||
if (grp == m_qbsGroupData && productPath == m_productPath)
|
||||
return;
|
||||
|
||||
m_productPath = productPath;
|
||||
m_qbsGroupData = grp;
|
||||
|
||||
// Set Product file node used to jump to the product
|
||||
setPath(group->location().fileName);
|
||||
setDisplayName(group->name());
|
||||
setPath(grp->location().fileName());
|
||||
setDisplayName(grp->name());
|
||||
|
||||
// set up file node...
|
||||
QbsFileNode *indexFile = 0;
|
||||
if (!m_qbsGroupData) {
|
||||
indexFile = new QbsFileNode(group->location().fileName,
|
||||
ProjectExplorer::ProjectFileType, false,
|
||||
group->location().line);
|
||||
addFileNodes(QList<ProjectExplorer::FileNode *>() << indexFile, this);
|
||||
} else {
|
||||
indexFile = static_cast<QbsFileNode *>(fileNodes().first());
|
||||
indexFile->setPath(group->location().fileName);
|
||||
indexFile->setLine(group->location().line);
|
||||
indexFile->emitNodeUpdated();
|
||||
QbsFileNode *idx = 0;
|
||||
foreach (ProjectExplorer::FileNode *fn, fileNodes()) {
|
||||
idx = qobject_cast<QbsFileNode *>(fn);
|
||||
if (idx)
|
||||
break;
|
||||
}
|
||||
|
||||
m_qbsGroupData = group;
|
||||
// idx not found, which should never happen!
|
||||
Q_ASSERT(idx);
|
||||
idx->setPath(grp->location().fileName());
|
||||
idx->setLine(grp->location().line());
|
||||
|
||||
setQbsGroupData(this, group, productPath, QList<ProjectExplorer::Node *>() << indexFile);
|
||||
setupFiles(this, grp->allFilePaths(), m_productPath);
|
||||
emitNodeUpdated();
|
||||
}
|
||||
|
||||
void QbsGroupNode::setQbsGroupData(QbsBaseProjectNode *root, const qbs::GroupData *group,
|
||||
const QString &productPath, QList<ProjectExplorer::Node *> keepers)
|
||||
void QbsGroupNode::setupFiles(QbsBaseProjectNode *root, const QStringList &files,
|
||||
const QString &productPath)
|
||||
{
|
||||
// Build up a tree of nodes:
|
||||
FileTreeNode *tree = new FileTreeNode(QString());
|
||||
FileTreeNode tree;
|
||||
|
||||
foreach (const QString &path, group->allFilePaths()) {
|
||||
foreach (const QString &path, files) {
|
||||
QStringList pathSegments = path.split(QLatin1Char('/'), QString::SkipEmptyParts);
|
||||
|
||||
FileTreeNode *root = tree;
|
||||
FileTreeNode *root = &tree;
|
||||
while (!pathSegments.isEmpty())
|
||||
root = root->addPart(pathSegments.takeFirst());
|
||||
}
|
||||
|
||||
FileTreeNode::reorder(tree, productPath, tree);
|
||||
FileTreeNode::simplify(tree);
|
||||
setupFolders(root, root, tree, productPath, keepers);
|
||||
delete tree;
|
||||
FileTreeNode::reorder(&tree, productPath, &tree);
|
||||
FileTreeNode::simplify(&tree);
|
||||
FileTreeNode::moveBaseFolderContents(&tree, productPath);
|
||||
|
||||
setupFolder(root, &tree, productPath);
|
||||
}
|
||||
|
||||
void QbsGroupNode::setupFolders(QbsBaseProjectNode *topLevel, ProjectExplorer::FolderNode *root,
|
||||
FileTreeNode *node, const QString &baseDirPath,
|
||||
QList<ProjectExplorer::Node *> keepers)
|
||||
void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
|
||||
const FileTreeNode *fileTree, const QString &baseDir)
|
||||
{
|
||||
// We only need to care about FileNodes and FolderNodes here. Everything else is
|
||||
// handled elsewhere.
|
||||
// QbsGroupNodes are managed by the QbsProductNode.
|
||||
// The buildsystem file is either managed by QbsProductNode or by updateQbsGroupData(...).
|
||||
|
||||
QList<ProjectExplorer::FileNode *> filesToRemove;
|
||||
foreach (ProjectExplorer::FileNode *fn, root->fileNodes()) {
|
||||
ProjectExplorer::Node *n = static_cast<ProjectExplorer::Node *>(fn);
|
||||
if (!keepers.contains(n))
|
||||
filesToRemove.append(fn);
|
||||
if (!qobject_cast<QbsFileNode *>(fn))
|
||||
filesToRemove << fn;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::FileNode *> filesToAdd;
|
||||
|
||||
QList<ProjectExplorer::Node *> foldersToKeep = keepers;
|
||||
QList<ProjectExplorer::FolderNode *> foldersToRemove;
|
||||
foreach (ProjectExplorer::FolderNode *fn, root->subFolderNodes()) {
|
||||
ProjectExplorer::Node *n = static_cast<ProjectExplorer::Node *>(fn);
|
||||
if (!keepers.contains(n))
|
||||
if (fn->nodeType() == ProjectExplorer::ProjectNodeType)
|
||||
continue; // Skip ProjectNodes mixed into the folders...
|
||||
foldersToRemove.append(fn);
|
||||
}
|
||||
|
||||
// insert subfolders
|
||||
foreach (FileTreeNode *c, node->children) {
|
||||
foreach (FileTreeNode *c, fileTree->children) {
|
||||
QString path = c->path();
|
||||
|
||||
// Handle files:
|
||||
if (c->isFile()) {
|
||||
ProjectExplorer::FileNode *fn = root->findFile(path);
|
||||
if (fn) {
|
||||
@@ -366,30 +410,22 @@ void QbsGroupNode::setupFolders(QbsBaseProjectNode *topLevel, ProjectExplorer::F
|
||||
filesToAdd.append(fn);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
ProjectExplorer::FolderNode *fn = root->findSubFolder(path);
|
||||
if (path == baseDirPath) {
|
||||
setupFolders(topLevel, root, c, c->path(), foldersToKeep);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (path.startsWith(baseDirPath + QLatin1Char('/')))
|
||||
path = path.mid(baseDirPath.length() + 1); // remove common prefix
|
||||
|
||||
if (fn) {
|
||||
fn->emitNodeUpdated(); // enabled might have changed
|
||||
foldersToRemove.removeOne(fn);
|
||||
} else {
|
||||
fn = new ProjectExplorer::FolderNode(path);
|
||||
topLevel->addFolderNodes(QList<ProjectExplorer::FolderNode *>() << fn, root);
|
||||
FolderNode *fn = root->findSubFolder(c->path());
|
||||
if (!fn) {
|
||||
fn = new FolderNode(c->path());
|
||||
root->projectNode()->addFolderNodes(QList<FolderNode *>() << fn, root);
|
||||
} else {
|
||||
foldersToRemove.removeOne(fn);
|
||||
}
|
||||
foldersToKeep.append(fn);
|
||||
setupFolders(topLevel, fn, c, c->path());
|
||||
fn->setDisplayName(displayNameFromPath(c->path(), baseDir));
|
||||
|
||||
setupFolder(fn, c, c->path());
|
||||
}
|
||||
topLevel->removeFileNodes(filesToRemove, root);
|
||||
topLevel->removeFolderNodes(foldersToRemove, root);
|
||||
topLevel->addFileNodes(filesToAdd, root);
|
||||
}
|
||||
root->projectNode()->removeFileNodes(filesToRemove, root);
|
||||
root->projectNode()->removeFolderNodes(foldersToRemove, root);
|
||||
root->projectNode()->addFileNodes(filesToAdd, root);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -397,7 +433,7 @@ void QbsGroupNode::setupFolders(QbsBaseProjectNode *topLevel, ProjectExplorer::F
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QbsProductNode::QbsProductNode(const qbs::ProductData *prd) :
|
||||
QbsBaseProjectNode(prd->location().fileName),
|
||||
QbsBaseProjectNode(prd->location().fileName()),
|
||||
m_qbsProductData(0)
|
||||
{
|
||||
setIcon(m_productIcon);
|
||||
@@ -415,23 +451,27 @@ void QbsProductNode::setQbsProductData(const qbs::ProductData *prd)
|
||||
return;
|
||||
|
||||
setDisplayName(prd->name());
|
||||
setPath(prd->location().fileName);
|
||||
const QString &productPath = QFileInfo(prd->location().fileName).absolutePath();
|
||||
setPath(prd->location().fileName());
|
||||
const QString &productPath = QFileInfo(prd->location().fileName()).absolutePath();
|
||||
|
||||
// Set Product file node used to jump to the product
|
||||
QList<ProjectExplorer::FileNode *> files = fileNodes();
|
||||
QList<ProjectExplorer::Node *> toKeep;
|
||||
QbsFileNode *idx = 0;
|
||||
if (files.isEmpty()) {
|
||||
QbsFileNode *idx = new QbsFileNode(prd->location().fileName,
|
||||
idx = new QbsFileNode(prd->location().fileName(),
|
||||
ProjectExplorer::ProjectFileType, false,
|
||||
prd->location().line);
|
||||
prd->location().line());
|
||||
addFileNodes(QList<ProjectExplorer::FileNode *>() << idx, this);
|
||||
toKeep.append(idx);
|
||||
} else {
|
||||
QbsFileNode *idx = static_cast<QbsFileNode *>(files.at(0));
|
||||
idx->setPath(prd->location().fileName);
|
||||
idx->setLine(prd->location().line);
|
||||
toKeep.append(idx);
|
||||
// Find the QbsFileNode we added earlier:
|
||||
foreach (ProjectExplorer::FileNode *fn, files) {
|
||||
idx = qobject_cast<QbsFileNode *>(fn);
|
||||
if (idx) {
|
||||
idx->setPath(prd->location().fileName());
|
||||
idx->setLine(prd->location().line());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::ProjectNode *> toAdd;
|
||||
@@ -440,18 +480,16 @@ void QbsProductNode::setQbsProductData(const qbs::ProductData *prd)
|
||||
foreach (const qbs::GroupData &grp, prd->groups()) {
|
||||
if (grp.name() == prd->name() && grp.location() == prd->location()) {
|
||||
// Set implicit product group right onto this node:
|
||||
QbsGroupNode::setQbsGroupData(this, &grp, productPath, toKeep);
|
||||
QbsGroupNode::setupFiles(this, grp.allFilePaths(), productPath);
|
||||
continue;
|
||||
}
|
||||
QbsGroupNode *qn = findGroupNode(grp.name());
|
||||
if (qn) {
|
||||
toRemove.removeAll(qn);
|
||||
toKeep.append(qn);
|
||||
qn->setQbsGroupData(&grp, productPath);
|
||||
QbsGroupNode *gn = findGroupNode(grp.name());
|
||||
if (gn) {
|
||||
toRemove.removeOne(gn);
|
||||
gn->updateQbsGroupData(&grp, productPath);
|
||||
} else {
|
||||
qn = new QbsGroupNode(&grp, productPath);
|
||||
toAdd.append(qn);
|
||||
toKeep.append(qn);
|
||||
gn = new QbsGroupNode(&grp, productPath);
|
||||
toAdd.append(gn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,8 +505,10 @@ QList<ProjectExplorer::RunConfiguration *> QbsProductNode::runConfigurationsFor(
|
||||
Q_UNUSED(node);
|
||||
QList<ProjectExplorer::RunConfiguration *> result;
|
||||
QbsProjectNode *pn = qobject_cast<QbsProjectNode *>(projectNode());
|
||||
if (!isEnabled() || !pn || pn->qbsProject()->targetExecutable(*m_qbsProductData).isEmpty())
|
||||
if (!isEnabled() || !pn || pn->qbsProject()->targetExecutable(*m_qbsProductData,
|
||||
qbs::InstallOptions()).isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
foreach (ProjectExplorer::RunConfiguration *rc, pn->project()->activeTarget()->runConfigurations()) {
|
||||
QbsRunConfiguration *qbsRc = qobject_cast<QbsRunConfiguration *>(rc);
|
||||
|
||||
@@ -116,19 +116,18 @@ public:
|
||||
QbsGroupNode(const qbs::GroupData *grp, const QString &productPath);
|
||||
|
||||
bool isEnabled() const;
|
||||
void setQbsGroupData(const qbs::GroupData *qbsGroupData, const QString &productPath);
|
||||
void updateQbsGroupData(const qbs::GroupData *grp, const QString &productPath);
|
||||
|
||||
const qbs::GroupData *qbsGroupData() const { return m_qbsGroupData; }
|
||||
|
||||
QString productPath() const;
|
||||
|
||||
static void setQbsGroupData(QbsBaseProjectNode *root, const qbs::GroupData *qbsGroupData,
|
||||
const QString &productPath, QList<Node *> keepers);
|
||||
static void setupFiles(QbsBaseProjectNode *root, const QStringList &files,
|
||||
const QString &productPath);
|
||||
|
||||
private:
|
||||
static void setupFolders(QbsBaseProjectNode *topLevel, FolderNode *root, FileTreeNode *node,
|
||||
const QString &baseDirPath,
|
||||
QList<ProjectExplorer::Node *> keepers = QList<ProjectExplorer::Node *>());
|
||||
|
||||
static void setupFolder(ProjectExplorer::FolderNode *folder,
|
||||
const FileTreeNode *subFileTree, const QString &baseDir);
|
||||
const qbs::GroupData *m_qbsGroupData;
|
||||
QString m_productPath;
|
||||
|
||||
|
||||
@@ -163,11 +163,11 @@ QStringList QbsProject::files(ProjectExplorer::Project::FilesMode fileMode) cons
|
||||
foreach (const qbs::GroupData &grp, prd.groups()) {
|
||||
foreach (const QString &file, grp.allFilePaths())
|
||||
result.insert(file);
|
||||
result.insert(grp.location().fileName);
|
||||
result.insert(grp.location().fileName());
|
||||
}
|
||||
result.insert(prd.location().fileName);
|
||||
result.insert(prd.location().fileName());
|
||||
}
|
||||
result.insert(m_rootProjectNode->qbsProjectData()->location().fileName);
|
||||
result.insert(m_rootProjectNode->qbsProjectData()->location().fileName());
|
||||
}
|
||||
return result.toList();
|
||||
}
|
||||
@@ -356,8 +356,8 @@ void QbsProject::generateErrors(const qbs::Error &e)
|
||||
foreach (const qbs::ErrorData &data, e.entries())
|
||||
taskHub()->addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error,
|
||||
data.description(),
|
||||
Utils::FileName::fromString(data.codeLocation().fileName),
|
||||
data.codeLocation().line,
|
||||
Utils::FileName::fromString(data.codeLocation().fileName()),
|
||||
data.codeLocation().line(),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
|
||||
@@ -370,14 +370,14 @@ void QbsProject::parse(const QVariantMap &config, const QString &dir)
|
||||
|
||||
QTC_ASSERT(!m_qbsSetupProjectJob, return);
|
||||
qbs::SetupProjectParameters params;
|
||||
params.buildConfiguration = m_qbsBuildConfig;
|
||||
params.buildRoot = m_qbsBuildRoot;
|
||||
params.projectFilePath = m_fileName;
|
||||
params.ignoreDifferentProjectFilePath = false;
|
||||
params.setBuildConfiguration(m_qbsBuildConfig);
|
||||
params.setBuildRoot(m_qbsBuildRoot);
|
||||
params.setProjectFilePath(m_fileName);
|
||||
params.setIgnoreDifferentProjectFilePath(false);
|
||||
qbs::Preferences *prefs = QbsManager::preferences();
|
||||
const QString buildDir = qbsBuildDir();
|
||||
params.searchPaths = prefs->searchPaths(buildDir);
|
||||
params.pluginPaths = prefs->pluginPaths(buildDir);
|
||||
params.setSearchPaths(prefs->searchPaths(buildDir));
|
||||
params.setPluginPaths(prefs->pluginPaths(buildDir));
|
||||
|
||||
m_qbsSetupProjectJob
|
||||
= qbs::Project::setupProject(params, m_manager->settings(), m_manager->logSink(), 0);
|
||||
@@ -417,9 +417,9 @@ void QbsProject::updateDocuments(const qbs::ProjectData *prj)
|
||||
newFiles.insert(m_fileName); // make sure we always have the project file...
|
||||
|
||||
if (prj) {
|
||||
newFiles.insert(prj->location().fileName);
|
||||
newFiles.insert(prj->location().fileName());
|
||||
foreach (const qbs::ProductData &prd, prj->products())
|
||||
newFiles.insert(prd.location().fileName);
|
||||
newFiles.insert(prd.location().fileName());
|
||||
}
|
||||
QSet<QString> oldFiles;
|
||||
foreach (Core::IDocument *doc, m_qbsDocuments)
|
||||
|
||||
@@ -202,7 +202,7 @@ QString QbsRunConfiguration::executable() const
|
||||
if (!product)
|
||||
return QString();
|
||||
|
||||
return pro->qbsProject()->targetExecutable(*product, installRoot());
|
||||
return pro->qbsProject()->targetExecutable(*product, installOptions());
|
||||
}
|
||||
|
||||
ProjectExplorer::LocalApplicationRunConfiguration::RunMode QbsRunConfiguration::runMode() const
|
||||
@@ -306,6 +306,13 @@ QString QbsRunConfiguration::defaultDisplayName()
|
||||
return defaultName;
|
||||
}
|
||||
|
||||
qbs::InstallOptions QbsRunConfiguration::installOptions() const
|
||||
{
|
||||
if (m_currentInstallStep)
|
||||
return m_currentInstallStep->installOptions();
|
||||
return qbs::InstallOptions();
|
||||
}
|
||||
|
||||
QString QbsRunConfiguration::installRoot() const
|
||||
{
|
||||
if (m_currentInstallStep)
|
||||
@@ -362,8 +369,6 @@ QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QW
|
||||
|
||||
m_workingDirectoryEdit = new Utils::PathChooser(this);
|
||||
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_workingDirectoryEdit->setPath(m_rc->baseWorkingDirectory());
|
||||
m_workingDirectoryEdit->setBaseDirectory(m_rc->target()->project()->projectDirectory());
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= m_rc->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
if (aspect) {
|
||||
@@ -392,7 +397,6 @@ QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QW
|
||||
toplayout->addRow(QString(), innerBox);
|
||||
|
||||
runConfigurationEnabledChange();
|
||||
targetInformationHasChanged();
|
||||
|
||||
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
|
||||
this, SLOT(workDirectoryEdited()));
|
||||
@@ -433,6 +437,7 @@ void QbsRunConfigurationWidget::runConfigurationEnabledChange()
|
||||
m_disabledIcon->setVisible(!enabled);
|
||||
m_disabledReason->setVisible(!enabled);
|
||||
m_disabledReason->setText(m_rc->disabledReason());
|
||||
targetInformationHasChanged();
|
||||
}
|
||||
|
||||
void QbsRunConfigurationWidget::workDirectoryEdited()
|
||||
@@ -470,6 +475,9 @@ void QbsRunConfigurationWidget::targetInformationHasChanged()
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_executableLineEdit->setText(m_rc->executable());
|
||||
|
||||
m_workingDirectoryEdit->setPath(m_rc->baseWorkingDirectory());
|
||||
m_workingDirectoryEdit->setBaseDirectory(m_rc->target()->project()->projectDirectory());
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
@@ -558,7 +566,7 @@ QList<Core::Id> QbsRunConfigurationFactory::availableCreationIds(ProjectExplorer
|
||||
return result;
|
||||
|
||||
foreach (const qbs::ProductData &product, project->qbsProjectData()->products()) {
|
||||
if (!project->qbsProject()->targetExecutable(product, QString()).isEmpty())
|
||||
if (!project->qbsProject()->targetExecutable(product, qbs::InstallOptions()).isEmpty())
|
||||
result << Core::Id::fromString(QString::fromLatin1(QBS_RC_PREFIX) + product.name());
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -43,6 +43,10 @@ class QRadioButton;
|
||||
class QComboBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace qbs {
|
||||
class InstallOptions;
|
||||
}
|
||||
|
||||
namespace Utils {
|
||||
class PathChooser;
|
||||
class DetailsWidget;
|
||||
@@ -112,6 +116,7 @@ private:
|
||||
void setCommandLineArguments(const QString &argumentsString);
|
||||
QString rawCommandLineArguments() const;
|
||||
QString defaultDisplayName();
|
||||
qbs::InstallOptions installOptions() const;
|
||||
QString installRoot() const;
|
||||
|
||||
void ctor();
|
||||
|
||||
@@ -65,7 +65,7 @@ QbsStep::QbsStep(ProjectExplorer::BuildStepList *bsl, Core::Id id) :
|
||||
ProjectExplorer::BuildStep(bsl, id),
|
||||
m_job(0)
|
||||
{
|
||||
m_qbsBuildOptions.maxJobCount = QbsManager::preferences()->jobs();
|
||||
m_qbsBuildOptions.setMaxJobCount(QbsManager::preferences()->jobs());
|
||||
}
|
||||
|
||||
QbsStep::QbsStep(ProjectExplorer::BuildStepList *bsl, const QbsStep *other) :
|
||||
@@ -137,17 +137,17 @@ void QbsStep::cancel()
|
||||
|
||||
bool QbsStep::dryRun() const
|
||||
{
|
||||
return m_qbsBuildOptions.dryRun;
|
||||
return m_qbsBuildOptions.dryRun();
|
||||
}
|
||||
|
||||
bool QbsStep::keepGoing() const
|
||||
{
|
||||
return m_qbsBuildOptions.keepGoing;
|
||||
return m_qbsBuildOptions.keepGoing();
|
||||
}
|
||||
|
||||
int QbsStep::maxJobs() const
|
||||
{
|
||||
return m_qbsBuildOptions.maxJobCount;
|
||||
return m_qbsBuildOptions.maxJobCount();
|
||||
}
|
||||
|
||||
bool QbsStep::fromMap(const QVariantMap &map)
|
||||
@@ -155,12 +155,12 @@ bool QbsStep::fromMap(const QVariantMap &map)
|
||||
if (!ProjectExplorer::BuildStep::fromMap(map))
|
||||
return false;
|
||||
|
||||
m_qbsBuildOptions.dryRun = map.value(QLatin1String(QBS_DRY_RUN)).toBool();
|
||||
m_qbsBuildOptions.keepGoing = map.value(QLatin1String(QBS_KEEP_GOING)).toBool();
|
||||
m_qbsBuildOptions.maxJobCount = map.value(QLatin1String(QBS_MAXJOBCOUNT)).toInt();
|
||||
m_qbsBuildOptions.setDryRun(map.value(QLatin1String(QBS_DRY_RUN)).toBool());
|
||||
m_qbsBuildOptions.setKeepGoing(map.value(QLatin1String(QBS_KEEP_GOING)).toBool());
|
||||
m_qbsBuildOptions.setMaxJobCount(map.value(QLatin1String(QBS_MAXJOBCOUNT)).toInt());
|
||||
|
||||
if (m_qbsBuildOptions.maxJobCount <= 0)
|
||||
m_qbsBuildOptions.maxJobCount = QbsManager::preferences()->jobs();
|
||||
if (m_qbsBuildOptions.maxJobCount() <= 0)
|
||||
m_qbsBuildOptions.setMaxJobCount(QbsManager::preferences()->jobs());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -168,9 +168,9 @@ bool QbsStep::fromMap(const QVariantMap &map)
|
||||
QVariantMap QbsStep::toMap() const
|
||||
{
|
||||
QVariantMap map = ProjectExplorer::BuildStep::toMap();
|
||||
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsBuildOptions.dryRun);
|
||||
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsBuildOptions.keepGoing);
|
||||
map.insert(QLatin1String(QBS_MAXJOBCOUNT), m_qbsBuildOptions.maxJobCount);
|
||||
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsBuildOptions.dryRun());
|
||||
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsBuildOptions.keepGoing());
|
||||
map.insert(QLatin1String(QBS_MAXJOBCOUNT), m_qbsBuildOptions.maxJobCount());
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ void QbsStep::jobDone(bool success)
|
||||
if (m_job) {
|
||||
foreach (const qbs::ErrorData &data, m_job->error().entries())
|
||||
createTaskAndOutput(ProjectExplorer::Task::Error, data.description(),
|
||||
data.codeLocation().fileName, data.codeLocation().line);
|
||||
data.codeLocation().fileName(), data.codeLocation().line());
|
||||
m_job->deleteLater();
|
||||
m_job = 0;
|
||||
}
|
||||
@@ -218,25 +218,25 @@ void QbsStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QS
|
||||
|
||||
void QbsStep::setDryRun(bool dr)
|
||||
{
|
||||
if (m_qbsBuildOptions.dryRun == dr)
|
||||
if (m_qbsBuildOptions.dryRun() == dr)
|
||||
return;
|
||||
m_qbsBuildOptions.dryRun = dr;
|
||||
m_qbsBuildOptions.setDryRun(dr);
|
||||
emit qbsBuildOptionsChanged();
|
||||
}
|
||||
|
||||
void QbsStep::setKeepGoing(bool kg)
|
||||
{
|
||||
if (m_qbsBuildOptions.keepGoing == kg)
|
||||
if (m_qbsBuildOptions.keepGoing() == kg)
|
||||
return;
|
||||
m_qbsBuildOptions.keepGoing = kg;
|
||||
m_qbsBuildOptions.setKeepGoing(kg);
|
||||
emit qbsBuildOptionsChanged();
|
||||
}
|
||||
|
||||
void QbsStep::setMaxJobs(int jobcount)
|
||||
{
|
||||
if (m_qbsBuildOptions.maxJobCount == jobcount)
|
||||
if (m_qbsBuildOptions.maxJobCount() == jobcount)
|
||||
return;
|
||||
m_qbsBuildOptions.maxJobCount = jobcount;
|
||||
m_qbsBuildOptions.setMaxJobCount(jobcount);
|
||||
emit qbsBuildOptionsChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -556,9 +556,9 @@ void FormEditorView::rewriterEndTransaction()
|
||||
m_transactionCounter--;
|
||||
}
|
||||
|
||||
double FormEditorView::margins() const
|
||||
double FormEditorView::containerPadding() const
|
||||
{
|
||||
return m_formEditorWidget->margins();
|
||||
return m_formEditorWidget->containerPadding();
|
||||
}
|
||||
|
||||
double FormEditorView::spacing() const
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
void rewriterBeginTransaction() QTC_OVERRIDE;
|
||||
void rewriterEndTransaction() QTC_OVERRIDE;
|
||||
|
||||
double margins() const;
|
||||
double containerPadding() const;
|
||||
double spacing() const;
|
||||
void deActivateItemCreator();
|
||||
|
||||
|
||||
@@ -70,14 +70,14 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
|
||||
m_noSnappingAction->setChecked(true);
|
||||
m_noSnappingAction->setIcon(QPixmap(":/icon/layout/no_snapping.png"));
|
||||
|
||||
m_snappingAndAnchoringAction = layoutActionGroup->addAction(tr("Snapping with anchoring (W)."));
|
||||
m_snappingAndAnchoringAction = layoutActionGroup->addAction(tr("Snap to parent or sibling items and generate anchors (W)."));
|
||||
m_snappingAndAnchoringAction->setShortcut(Qt::Key_W);
|
||||
m_snappingAndAnchoringAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
m_snappingAndAnchoringAction->setCheckable(true);
|
||||
m_snappingAndAnchoringAction->setChecked(true);
|
||||
m_snappingAndAnchoringAction->setIcon(QPixmap(":/icon/layout/snapping_and_anchoring.png"));
|
||||
|
||||
m_snappingAction = layoutActionGroup->addAction(tr("Snap to guides (E)."));
|
||||
m_snappingAction = layoutActionGroup->addAction(tr("Snap to parent or sibling items but do not generate anchors (E)."));
|
||||
m_snappingAction->setShortcut(Qt::Key_E);
|
||||
m_snappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
m_snappingAction->setCheckable(true);
|
||||
@@ -290,10 +290,10 @@ double FormEditorWidget::spacing() const
|
||||
return settings.itemSpacing;
|
||||
}
|
||||
|
||||
double FormEditorWidget::margins() const
|
||||
double FormEditorWidget::containerPadding() const
|
||||
{
|
||||
DesignerSettings settings = QmlDesignerPlugin::instance()->settings();
|
||||
return settings.snapMargin;
|
||||
return settings.containerPadding;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
ToolBox *toolBox() const;
|
||||
|
||||
double spacing() const;
|
||||
double margins() const;
|
||||
double containerPadding() const;
|
||||
|
||||
QString contextHelpId() const;
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ SnappingLineCreator::SnappingLineCreator(FormEditorItem *formEditorItem)
|
||||
m_bottomOffset(formEditorItem->formEditorView()->spacing()),
|
||||
m_leftOffset(formEditorItem->formEditorView()->spacing()),
|
||||
m_rightOffset(formEditorItem->formEditorView()->spacing()),
|
||||
m_topMargin(formEditorItem->formEditorView()->margins()),
|
||||
m_bottomMargin(formEditorItem->formEditorView()->margins()),
|
||||
m_leftMargin(formEditorItem->formEditorView()->margins()),
|
||||
m_rightMargin(formEditorItem->formEditorView()->margins())
|
||||
m_topPadding(formEditorItem->formEditorView()->containerPadding()),
|
||||
m_bottomPadding(formEditorItem->formEditorView()->containerPadding()),
|
||||
m_leftPadding(formEditorItem->formEditorView()->containerPadding()),
|
||||
m_rightPadding(formEditorItem->formEditorView()->containerPadding())
|
||||
{
|
||||
Q_ASSERT(m_formEditorItem);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ void SnappingLineCreator::generateLines(const QList<FormEditorItem*> &exceptionL
|
||||
m_formEditorItem->qmlItemNode().instanceBoundingRect());
|
||||
|
||||
addLines(containerBoundingRectInTransformationSpace, m_formEditorItem);
|
||||
containerBoundingRectInTransformationSpace.adjust(m_leftMargin, m_topMargin, -m_rightMargin, -m_rightMargin);
|
||||
containerBoundingRectInTransformationSpace.adjust(m_leftPadding, m_topPadding, -m_rightPadding, -m_rightPadding);
|
||||
addLines(containerBoundingRectInTransformationSpace, m_formEditorItem);
|
||||
}
|
||||
|
||||
@@ -117,12 +117,12 @@ void SnappingLineCreator::generateLines(const QList<FormEditorItem*> &exceptionL
|
||||
}
|
||||
}
|
||||
|
||||
void SnappingLineCreator::setMargins(double margin)
|
||||
void SnappingLineCreator::setContainerPadding(double containerPadding)
|
||||
{
|
||||
m_topMargin = margin;
|
||||
m_bottomMargin = margin;
|
||||
m_leftMargin = margin;
|
||||
m_rightMargin = margin;
|
||||
m_topPadding = containerPadding;
|
||||
m_bottomPadding = containerPadding;
|
||||
m_leftPadding = containerPadding;
|
||||
m_rightPadding = containerPadding;
|
||||
}
|
||||
|
||||
void SnappingLineCreator::setSpacing(double spacing)
|
||||
@@ -137,7 +137,7 @@ void SnappingLineCreator::update(const QList<FormEditorItem*> &exceptionList,
|
||||
FormEditorItem *transformationSpaceItem)
|
||||
{
|
||||
clearLines();
|
||||
setMargins(m_formEditorItem->formEditorView()->margins());
|
||||
setContainerPadding(m_formEditorItem->formEditorView()->containerPadding());
|
||||
setSpacing(m_formEditorItem->formEditorView()->spacing());
|
||||
generateLines(exceptionList, transformationSpaceItem);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
SnapLineMap leftOffsets() const;
|
||||
SnapLineMap rightOffsets() const;
|
||||
|
||||
void setMargins(double margin);
|
||||
void setContainerPadding(double containerPadding);
|
||||
void setSpacing(double spacing);
|
||||
|
||||
protected:
|
||||
@@ -92,10 +92,10 @@ private:
|
||||
double m_bottomOffset;
|
||||
double m_leftOffset;
|
||||
double m_rightOffset;
|
||||
double m_topMargin;
|
||||
double m_bottomMargin;
|
||||
double m_leftMargin;
|
||||
double m_rightMargin;
|
||||
double m_topPadding;
|
||||
double m_bottomPadding;
|
||||
double m_leftPadding;
|
||||
double m_rightPadding;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -275,9 +275,9 @@ QList<PropertyInfo> getQmlTypes(const CppComponentValue *objectValue, const Cont
|
||||
const CppComponentValue * qmlObjectValue = value_cast<CppComponentValue>(prototype);
|
||||
|
||||
if (qmlObjectValue)
|
||||
propertyList.append(getQmlTypes(qmlObjectValue, context, false, rec + 1));
|
||||
propertyList.append(getQmlTypes(qmlObjectValue, context, false, rec));
|
||||
else
|
||||
propertyList.append(getObjectTypes(prototype, context, false, rec + 1));
|
||||
propertyList.append(getObjectTypes(prototype, context, false, rec));
|
||||
}
|
||||
|
||||
return propertyList;
|
||||
@@ -349,9 +349,9 @@ QList<PropertyInfo> getObjectTypes(const ObjectValue *objectValue, const Context
|
||||
const CppComponentValue * qmlObjectValue = value_cast<CppComponentValue>(prototype);
|
||||
|
||||
if (qmlObjectValue)
|
||||
propertyList.append(getQmlTypes(qmlObjectValue, context, local, rec + 1));
|
||||
propertyList.append(getQmlTypes(qmlObjectValue, context, local, rec));
|
||||
else
|
||||
propertyList.append(getObjectTypes(prototype, context, local, rec + 1));
|
||||
propertyList.append(getObjectTypes(prototype, context, local, rec));
|
||||
}
|
||||
|
||||
return propertyList;
|
||||
|
||||
@@ -37,7 +37,7 @@ using namespace QmlDesigner;
|
||||
DesignerSettings::DesignerSettings()
|
||||
: openDesignMode(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT),
|
||||
itemSpacing(0),
|
||||
snapMargin(0),
|
||||
containerPadding(0),
|
||||
canvasWidth(10000),
|
||||
canvasHeight(10000),
|
||||
warningsInDesigner(true),
|
||||
@@ -55,8 +55,8 @@ void DesignerSettings::fromSettings(QSettings *settings)
|
||||
bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)).toBool();
|
||||
itemSpacing = settings->value(
|
||||
QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), QVariant(6)).toInt();
|
||||
snapMargin = settings->value(
|
||||
QLatin1String(QmlDesigner::Constants::QML_SNAPMARGIN_KEY), QVariant(4)).toInt();
|
||||
containerPadding = settings->value(
|
||||
QLatin1String(QmlDesigner::Constants::QML_CONTAINERPADDING_KEY), QVariant(8)).toInt();
|
||||
canvasWidth = settings->value(QLatin1String(QmlDesigner::Constants::QML_CANVASWIDTH_KEY), QVariant(10000)).toInt();
|
||||
canvasHeight = settings->value(QLatin1String(QmlDesigner::Constants::QML_CANVASHEIGHT_KEY), QVariant(10000)).toInt();
|
||||
warningsInDesigner = settings->value(
|
||||
@@ -78,7 +78,7 @@ void DesignerSettings::toSettings(QSettings *settings) const
|
||||
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP));
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY), openDesignMode);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), itemSpacing);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SNAPMARGIN_KEY), snapMargin);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CONTAINERPADDING_KEY), containerPadding);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CANVASWIDTH_KEY), canvasWidth);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CANVASHEIGHT_KEY), canvasHeight);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_FEATURES_IN_DESIGNER_KEY), warningsInDesigner);
|
||||
@@ -93,7 +93,7 @@ void DesignerSettings::toSettings(QSettings *settings) const
|
||||
bool DesignerSettings::equals(const DesignerSettings &other) const
|
||||
{
|
||||
return openDesignMode == other.openDesignMode
|
||||
&& snapMargin == other.snapMargin
|
||||
&& containerPadding == other.containerPadding
|
||||
&& canvasWidth == other.canvasWidth
|
||||
&& canvasHeight == other.canvasHeight
|
||||
&& warningsInDesigner == other.warningsInDesigner
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
bool equals(const DesignerSettings &other) const;
|
||||
bool openDesignMode;
|
||||
int itemSpacing;
|
||||
int snapMargin;
|
||||
int containerPadding;
|
||||
int canvasWidth;
|
||||
int canvasHeight;
|
||||
bool warningsInDesigner;
|
||||
|
||||
@@ -55,7 +55,7 @@ const char QML_SETTINGS_GROUP[] = "QML";
|
||||
const char QML_DESIGNER_SETTINGS_GROUP[] = "Designer";
|
||||
const char QML_OPENDESIGNMODE_SETTINGS_KEY[] = "OpenDesignMode";
|
||||
const char QML_ITEMSPACING_KEY[] = "ItemSpacing";
|
||||
const char QML_SNAPMARGIN_KEY[] = "SnapMargin";
|
||||
const char QML_CONTAINERPADDING_KEY[] = "ContainerPadding";
|
||||
const char QML_CANVASWIDTH_KEY[] = "CanvasWidth";
|
||||
const char QML_CANVASHEIGHT_KEY[] = "CanvasHeight";
|
||||
const char QML_CONTEXTPANE_KEY[] = "ContextPaneEnabled";
|
||||
|
||||
@@ -50,7 +50,7 @@ DesignerSettings SettingsPageWidget::settings() const
|
||||
{
|
||||
DesignerSettings designerSettings;
|
||||
designerSettings.itemSpacing = m_ui.spinItemSpacing->value();
|
||||
designerSettings.snapMargin = m_ui.spinSnapMargin->value();
|
||||
designerSettings.containerPadding = m_ui.spinSnapMargin->value();
|
||||
designerSettings.canvasWidth = m_ui.spinCanvasWidth->value();
|
||||
designerSettings.canvasHeight = m_ui.spinCanvasHeight->value();
|
||||
designerSettings.warningsInDesigner = m_ui.designerWarningsCheckBox->isChecked();
|
||||
@@ -64,7 +64,7 @@ DesignerSettings SettingsPageWidget::settings() const
|
||||
void SettingsPageWidget::setSettings(const DesignerSettings &designerSettings)
|
||||
{
|
||||
m_ui.spinItemSpacing->setValue(designerSettings.itemSpacing);
|
||||
m_ui.spinSnapMargin->setValue(designerSettings.snapMargin);
|
||||
m_ui.spinSnapMargin->setValue(designerSettings.containerPadding);
|
||||
m_ui.spinCanvasWidth->setValue(designerSettings.canvasWidth);
|
||||
m_ui.spinCanvasHeight->setValue(designerSettings.canvasHeight);
|
||||
m_ui.designerWarningsCheckBox->setChecked(designerSettings.warningsInDesigner);
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="snapMarginLabel">
|
||||
<property name="text">
|
||||
<string>Snap margin:</string>
|
||||
<string>Parent item padding:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -117,7 +117,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="itemSpacingLabel">
|
||||
<property name="text">
|
||||
<string>Item spacing:</string>
|
||||
<string>Sibling item spacing:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -142,61 +142,60 @@ void BarDescriptorPermissionsModel::initModel()
|
||||
{
|
||||
beginResetModel();
|
||||
m_permissions << BarDescriptorPermission(tr("BlackBerry Messenger"), QLatin1String("bbm_connect"),
|
||||
tr("Allows this app to connect to the BBM Social Platform to access BBM\n"
|
||||
"contact lists and user profiles, invite BBM contacts to download your\n"
|
||||
"app, initiate BBM chats and share content from within your app, or\n"
|
||||
"stream data between apps in real time."));
|
||||
tr("<html><head/><body><p>Allows this app to connect to the BBM Social Platform to access BBM "
|
||||
"contact lists and user profiles, invite BBM contacts to download your "
|
||||
"app, initiate BBM chats and share content from within your app, or "
|
||||
"stream data between apps in real time.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Calendar"), QLatin1String("access_pimdomain_calendars"),
|
||||
tr("Allows this app to access the calendar on the device. This access\n"
|
||||
"includes viewing, adding, and deleting calendar appointments."));
|
||||
tr("<html><head/><body><p>Allows this app to access the calendar on the device. This access "
|
||||
"includes viewing, adding, and deleting calendar appointments.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Camera"), QLatin1String("use_camera"),
|
||||
tr("Allows this app to take pictures, record video, and use the flash."));
|
||||
tr("<html><head/><body><p>Allows this app to take pictures, record video, and use the flash.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Contacts"), QLatin1String("access_pimdomain_contacts"),
|
||||
tr("Allows this app to access the contacts stored on the device. This\n"
|
||||
"access includes viewing, creating, and deleting the contacts."));
|
||||
tr("<html><head/><body><p>Allows this app to access the contacts stored on the device. This "
|
||||
"access includes viewing, creating, and deleting the contacts.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Device Identifying Information"), QLatin1String("read_device_identifying_information"),
|
||||
tr("Allows this app to access device identifiers such as serial number and PIN."));
|
||||
tr("<html><head/><body><p>Allows this app to access device identifiers such as serial number and PIN.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Email and PIN Messages"), QLatin1String("access_pimdomain_messages"),
|
||||
tr("Allows this app to access the email and PIN messages stored on the\n"
|
||||
"device. This access includes viewing, creating, sending, and deleting\n"
|
||||
"the messages."));
|
||||
tr("<html><head/><body><p>Allows this app to access the email and PIN messages stored on the "
|
||||
"device. This access includes viewing, creating, sending, and deleting the messages.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("GPS Location"), QLatin1String("read_geolocation"),
|
||||
tr("Allows this app to access the current GPS location of the device."));
|
||||
tr("<html><head/><body><p>Allows this app to access the current GPS location of the device.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Internet"), QLatin1String("access_internet"),
|
||||
tr("Allows this app to use Wi-fi, wired, or other connections to a\n"
|
||||
"destination that is not local on the user's device."));
|
||||
tr("<html><head/><body><p>Allows this app to use Wi-fi, wired, or other connections to a "
|
||||
"destination that is not local on the user's device.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Location"), QLatin1String("access_location_services"),
|
||||
tr("Allows this app to access the device's current or saved locations."));
|
||||
tr("<html><head/><body><p>Allows this app to access the device's current or saved locations.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Microphone"), QLatin1String("record_audio"),
|
||||
tr("Allows this app to record sound using the microphone."));
|
||||
tr("<html><head/><body><p>Allows this app to record sound using the microphone.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Notebooks"), QLatin1String("access_pimdomain_notebooks"),
|
||||
tr("Allows this app to access the content stored in the notebooks on the\n"
|
||||
"device. This access includes adding and deleting entries and content."));
|
||||
tr("<html><head/><body><p>Allows this app to access the content stored in the notebooks on the "
|
||||
"device. This access includes adding and deleting entries and content.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Post Notifications"), QLatin1String("post_notification"),
|
||||
tr("Post a notification to the notifications area of the screen."));
|
||||
tr("<html><head/><body><p>Post a notification to the notifications area of the screen.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Push"), QLatin1String("_sys_use_consumer_push"),
|
||||
tr("Allows this app to use the Push Service with the BlackBerry Internet\n"
|
||||
"Service. This access allows the app to receive and request push\n"
|
||||
"messages. To use the Push Service with the BlackBerry Internet Service,\n"
|
||||
"you must register with BlackBerry. When you register, you\n"
|
||||
"receive a confirmation email message that contains information that\n"
|
||||
"your application needs to receive and request push messages. For more\n"
|
||||
"information about registering, visit\n"
|
||||
"https://developer.blackberry.com/services/push/. If you're using the\n"
|
||||
"Push Service with the BlackBerry Enterprise Server or the BlackBerry\n"
|
||||
"Device Service, you don't need to register with BlackBerry."));
|
||||
tr("<html><head/><body><p>Allows this app to use the Push Service with the BlackBerry Internet "
|
||||
"Service. This access allows the app to receive and request push "
|
||||
"messages. To use the Push Service with the BlackBerry Internet Service, "
|
||||
"you must register with BlackBerry. When you register, you "
|
||||
"receive a confirmation email message that contains information that "
|
||||
"your application needs to receive and request push messages. For more "
|
||||
"information about registering, visit "
|
||||
"https://developer.blackberry.com/services/push/. If you're using the "
|
||||
"Push Service with the BlackBerry Enterprise Server or the BlackBerry "
|
||||
"Device Service, you don't need to register with BlackBerry.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Run When Backgrounded"), QLatin1String("run_when_backgrounded"),
|
||||
tr("Allows background processing. Without this permission, the app is\n"
|
||||
"stopped when the user switches focus to another app. Apps that use this\n"
|
||||
"permission are rigorously reviewed for acceptance to BlackBerry App\n"
|
||||
"World storefront for their use of power."));
|
||||
tr("<html><head/><body><p>Allows background processing. Without this permission, the app is "
|
||||
"stopped when the user switches focus to another app. Apps that use this "
|
||||
"permission are rigorously reviewed for acceptance to BlackBerry App "
|
||||
"World storefront for their use of power.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Shared Files"), QLatin1String("access_shared"),
|
||||
tr("Allows this app to access pictures, music, documents, and other files\n"
|
||||
"stored on the user's device, at a remote storage provider, on a media\n"
|
||||
"card, or in the cloud."));
|
||||
tr("<html><head/><body><p>Allows this app to access pictures, music, documents, and other files "
|
||||
"stored on the user's device, at a remote storage provider, on a media "
|
||||
"card, or in the cloud.</p></body></html>"));
|
||||
m_permissions << BarDescriptorPermission(tr("Text Messages"), QLatin1String("access_sms_mms"),
|
||||
tr("Allows this app to access the text messages stored on the device. The\n"
|
||||
"access includes viewing, creating, sending, and deleting text messages."));
|
||||
tr("<html><head/><body><p>Allows this app to access the text messages stored on the device. The "
|
||||
"access includes viewing, creating, sending, and deleting text messages.</p></body></html>"));
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ bool BlackBerryConfiguration::refresh()
|
||||
if (!simulatorGdbPath.toFileInfo().exists())
|
||||
errorMessage += QLatin1Char('\n') + tr("- No GDB debugger found for BB10 Simulator.");
|
||||
|
||||
QMessageBox::warning(0, tr("Cannot Setup BB10 Configuration"),
|
||||
QMessageBox::warning(0, tr("Cannot Set up BB10 Configuration"),
|
||||
errorMessage, QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
@@ -305,14 +305,14 @@ QtSupport::BaseQtVersion *BlackBerryConfiguration::createQtVersion()
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(m_config.qmakeBinaryFile);
|
||||
if (version) {
|
||||
QMessageBox::warning(0, tr("Qt Version Already Known"),
|
||||
tr("This Qt version was already registered"), QMessageBox::Ok);
|
||||
tr("This Qt version was already registered."), QMessageBox::Ok);
|
||||
return version;
|
||||
}
|
||||
|
||||
version = new BlackBerryQtVersion(QnxUtils::cpudirToArch(cpuDir), m_config.qmakeBinaryFile, false, QString(), m_config.ndkPath);
|
||||
if (!version) {
|
||||
QMessageBox::warning(0, tr("Invalid Qt version"),
|
||||
tr("Unable to add BlackBerry Qt version"), QMessageBox::Ok);
|
||||
QMessageBox::warning(0, tr("Invalid Qt Version"),
|
||||
tr("Unable to add BlackBerry Qt version."), QMessageBox::Ok);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ ProjectExplorer::GccToolChain *BlackBerryConfiguration::createGccToolChain()
|
||||
foreach (ProjectExplorer::ToolChain* tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
|
||||
if (tc->compilerCommand() == m_config.gccCompiler) {
|
||||
QMessageBox::warning(0, tr("Compiler Already Known"),
|
||||
tr("This Compiler was already registered"), QMessageBox::Ok);
|
||||
tr("This compiler was already registered."), QMessageBox::Ok);
|
||||
return dynamic_cast<ProjectExplorer::GccToolChain*>(tc);
|
||||
}
|
||||
}
|
||||
@@ -356,7 +356,7 @@ ProjectExplorer::Kit *BlackBerryConfiguration::createKit(QnxArchitecture arch, Q
|
||||
&& Debugger::DebuggerKitInformation::debuggerCommand(kit) == m_config.simulatorDebuger)
|
||||
|| (arch == ArmLeV7 && Debugger::DebuggerKitInformation::debuggerCommand(kit) == m_config.deviceDebuger)) {
|
||||
QMessageBox::warning(0, tr("Kit Already Known"),
|
||||
tr("This Kit was already registered"), QMessageBox::Ok);
|
||||
tr("This kit was already registered."), QMessageBox::Ok);
|
||||
return kit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
barDescriptorMimeType.setSubClassesOf(QStringList() << QLatin1String("application/xml"));
|
||||
|
||||
if (!Core::ICore::mimeDatabase()->addMimeType(barDescriptorMimeType)) {
|
||||
*errorString = tr("Could not add mime-type for bar-descriptor.xml editor");
|
||||
*errorString = tr("Could not add mime-type for bar-descriptor.xml editor.");
|
||||
return false;
|
||||
}
|
||||
addAutoReleasedObject(new BarDescriptorEditorFactory);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||
<mime-type type="application/vnd.nokia.qt.qmakeprofile">
|
||||
<mime-type type="application/vnd.qt.qmakeprofile">
|
||||
<sub-class-of type="text/plain"/>
|
||||
<comment>Qt Project file</comment>
|
||||
<glob pattern="*.pro"/>
|
||||
</mime-type>
|
||||
<mime-type type="application/vnd.nokia.qt.qmakeproincludefile">
|
||||
<mime-type type="application/vnd.qt.qmakeproincludefile">
|
||||
<sub-class-of type="text/plain"/>
|
||||
<comment>Qt Project include file</comment>
|
||||
<glob pattern="*.pri"/>
|
||||
</mime-type>
|
||||
<mime-type type="application/vnd.nokia.qt.qmakeprofeaturefile">
|
||||
<mime-type type="application/vnd.qt.qmakeprofeaturefile">
|
||||
<sub-class-of type="text/plain"/>
|
||||
<comment>Qt Project feature file</comment>
|
||||
<glob pattern="*.prf"/>
|
||||
|
||||
@@ -152,13 +152,13 @@ void Qt4ProjectManagerPlugin::testQmakeOutputParsers_data()
|
||||
<< QString();
|
||||
|
||||
QTest::newRow("qMake warning with location")
|
||||
<< QString::fromLatin1("WARNING: e:\\NokiaQtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl:1: Unescaped backslashes are deprecated.")
|
||||
<< QString::fromLatin1("WARNING: e:\\QtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl:1: Unescaped backslashes are deprecated.")
|
||||
<< OutputParserTester::STDERR
|
||||
<< QString() << QString()
|
||||
<< (QList<ProjectExplorer::Task>()
|
||||
<< Task(Task::Warning,
|
||||
QLatin1String("Unescaped backslashes are deprecated."),
|
||||
Utils::FileName::fromUserInput(QLatin1String("e:\\NokiaQtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl")), 1,
|
||||
Utils::FileName::fromUserInput(QLatin1String("e:\\QtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl")), 1,
|
||||
categoryBuildSystem))
|
||||
<< QString();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user