Merge remote-tracking branch 'origin/3.1'

Conflicts:
	README
	tests/auto/debugger/tst_dumpers.cpp

Change-Id: Ib9aef37a246bc3bb9bca0c32a902af3b09ef3146
This commit is contained in:
Oswald Buddenhagen
2014-03-11 13:39:55 +01:00
279 changed files with 3131 additions and 1418 deletions

2
README
View File

@@ -12,7 +12,7 @@ Mac OS X 10.7 or later
Building the sources requires Qt 5.2.0 or later.
It is also possible to build with Qt 4.8.x, but in that case the Welcome mode,
Qt Quick Designer, QML Profiler and Qbs support are disabled.
Qt Quick Designer, QML Profiler, and the WinRT and Qbs support are disabled.
Compiling Qt Creator
====================

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -662,7 +662,7 @@
Also, the debugger displays access data for QFileInfo and provides
access to the "real" contents of QVariant.
Right-click in the the \gui{Locals and Expressions} view to open a context
Right-click in the \gui{Locals and Expressions} view to open a context
menu that provides additional options for viewing data. The available
options depend on the type of the current items, and are provided by the
\l{Using Debugging Helpers}{Debugging Helpers}. Typically, string-like data,

View File

@@ -0,0 +1,120 @@
/****************************************************************************
**
** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator
**
**
** GNU Free Documentation License
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
**
****************************************************************************/
// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************
/*!
\contentspage index.html
\previouspage creator-editor-refactoring.html
\page creator-beautifier.html
\nextpage creator-editor-options.html
\title Beautifying Source Code
You can use the experimental Beautifier plugin to format your source code
by using the following external tools:
\list
\li \l{http://astyle.sourceforge.net}{Artistic Style}
\li \l{http://clang.llvm.org/docs/ClangFormat.html}{ClangFormat}
\li \l{http://uncrustify.sourceforge.net}{Uncrustify}
\endlist
The Beautifier plugin parses the source code into component structures, such
as assignment statements, if blocks, loops, and so on, and formats them as
specified in the Beautifier options. You can use a predefined style or
define your own style.
To use the Beautifier plugin:
\list 1
\li Download and install the tool to use for formatting source code:
\list
\li \l{http://sourceforge.net/projects/astyle/files/astyle}
{Artistic Style}
\li \l{http://llvm.org/releases/download.html}{ClangFormat}
\li \l{http://sourceforge.net/projects/uncrustify/files/uncrustify}
{Uncrustify}
\endlist
You might have to build the tools from sources for some platforms.
\li Select \gui Help > \gui {About Plugins} > \gui {C++} >
\gui Beautifier to enable the plugin.
\li Restart \QC to be able to use the plugin.
\li Select \gui Tools > \gui Options > \gui Beautifier to specify
settings for the tool you want to use.
\image beautifier_options.png
\li In the \gui {Artistic Style command}, \gui {Clang Format command},
or \gui {Uncrustify command} field, specify the path to the tool
executable.
\li In the \gui Options group, select the configuration file that
defines the style to use in the source files. If you select several
options, they are applied from top down.
\list
\li Select the \gui {Use file defined in project files} option
to use the configuration file defined in the qmake
OTHER_FILES variable as the configuration file for the
selected tool.
\li Select the \gui {Use $HOME} option to use the specified file
in the user's home directory as the configuration file for
the selected tool.
\li Select the \gui {Use self-defined style} option, and then
\gui Add to define your own style.
\li Define code formatting in the \gui {Edit Configuration}
dialog. It provides syntax highlighting, auto-completion,
and context-sensitive help. For these features, you must
have the tool installed.
\image beautifier_editor.png
\li Select \gui Tools > \gui Beautifier > \gui {Artistic Style},
\gui ClangFormat, or \gui Uncrustify > \gui {Format Current File}
to format the currently open file.
You can \l{Keyboard Shortcuts}{create keyboard shortcuts} for the
functions.
\endlist
In addition to the \gui {Format Current File} command, ClangFormat provides
the \gui {Format Selected Text} command. If you select it when no text is
selected, nothing happens. To format the entire file in this case, select
the \gui {Format entire file if no text was selected} check box in the
\gui {Clang Format} options.
*/

View File

@@ -55,10 +55,16 @@
can easily find and rename symbols and apply predefined actions to
refactor code.
\li \l{Beautifying Source Code}
Beautifying code means applying indentation and style to source
code files. You can use the Artistic Style, ClangFormat, or
Uncrustify tool to format source files.
\li \l{Configuring the Editor}
You can change the fonts, colors, highlighting, and indentation.
If you are used to the the Vim editor, you can even run the main
If you are used to the Vim editor, you can even run the main
editor in a manner similar to it in the \gui{FakeVim} mode.
\endlist

View File

@@ -24,7 +24,7 @@
/*!
\contentspage index.html
\previouspage creator-editor-refactoring.html
\previouspage creator-beautifier.html
\page creator-editor-options.html
\nextpage creator-editor-options-text.html

View File

@@ -1430,7 +1430,7 @@
\contentspage index.html
\previouspage creator-editor-locator.html
\page creator-editor-refactoring.html
\nextpage creator-editor-options.html
\nextpage creator-beautifier.html
\title Refactoring

View File

@@ -84,6 +84,12 @@
requires the BlackBerry NDK or the QNX SDK to be installed on the
development PC.
\li \l{Connecting Windows Runtime Devices}
You can build Windows Store Apps and run them on Windows Phones, the
Windows Phone Emulator, or the Windows computer in Modern UI mode.
You can install the necessary tool chains as part of Qt 5.3.
\endlist
*/

View File

@@ -16,6 +16,8 @@
\li QNX
\li Windows Runtime (including Windows Phone)
\endlist
The following table summarizes operating system support for developing
@@ -55,6 +57,11 @@
\li Yes
\li Yes
\li Yes (see \l{Running on QNX Devices} for limitations)
\row
\li Windows Runtime
\li No
\li No
\li Yes
\endtable
\note Symbian support has been removed from \QC 2.6. To develop for Symbian,

View File

@@ -24,7 +24,7 @@
/*!
\contentspage index.html
\previouspage creator-developing-qnx.html
\previouspage creator-developing-winrt.html
\page creator-build-process-customizing.html
\nextpage creator-testing.html

View File

@@ -22,7 +22,7 @@
\contentspage index.html
\previouspage creator-developing-ios.html
\page creator-developing-qnx.html
\nextpage creator-build-process-customizing.html
\nextpage creator-developing-winrt.html
\title Connecting QNX Devices

View File

@@ -200,6 +200,7 @@
\li \l{Searching with the Locator}
\endlist
\li \l{Refactoring}
\li \l{Beautifying Source Code}
\li \l{Configuring the Editor}
\list
\li \l{Specifying Text Editor Settings}
@@ -226,6 +227,7 @@
\li \l{Connecting Embedded Linux Devices}
\li \l{Connecting iOS Devices}
\li \l{Connecting QNX Devices}
\li \l{Connecting Windows Runtime Devices}
\endlist
\li \l{Customizing the Build Process}
\endlist

View File

@@ -0,0 +1,69 @@
/****************************************************************************
**
** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator
**
**
** GNU Free Documentation License
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
**
****************************************************************************/
/*!
\contentspage index.html
\previouspage creator-developing-qnx.html
\page creator-developing-winrt.html
\nextpage creator-build-process-customizing.html
\title Connecting Windows Runtime Devices
You can build Windows Store Apps and run them on Windows Phones, Windows
Phone Emulator, or the Windows computer in Modern UI mode.
\QC uses the integrated \c windeployqt and \c winrtrunner tools to deploy
and run applications. You can also run the tools manually from the command
line.
The Qt 5.3 installer adds Windows Runtime and Windows Phone Qt versions to
\QC and creates the necessary kits.
\image creator-winrt-kits.png "WinRT kits"
To connect Windows Runtime devices:
\list 1
\li Select \gui Help > \gui {About Plugins} > \gui {Device Support} >
\gui WinRT to enable the experimental Winows Runtime plugin.
\li Restart \QC to be able to use the plugin.
\li To specify build settings:
\list 1
\li Open a project for an application you want to develop for the
device.
\li Select \gui Projects > \gui {Build & Run} > \gui {Add Kit} to
add a kit for building and running applications on Windows
Runtime devices (the local computer, for now) Windows Phones,
or the Windows Phone emulator.
\endlist
\li Select \gui Run to specify run settings.
Usually, you can use the default settings.
\endlist
*/

View File

@@ -714,6 +714,19 @@ class DumperBase:
warn("CANNOT CONVERT TYPE: %s" % type(addr))
return str(addr)
def tryPutArrayContents(self, typeobj, base, n):
enc = self.simpleEncoding(typeobj)
if not enc:
return False
size = n * typeobj.sizeof;
self.put('childtype="%s",' % typeobj)
self.put('addrbase="0x%x",' % toInteger(base))
self.put('addrstep="0x%x",' % toInteger(typeobj.sizeof))
self.put('arrayencoding="%s",' % enc)
self.put('arraydata="')
self.put(self.readMemory(base, size))
self.put('",')
return True
def putFormattedPointer(self, value):
#warn("POINTER: %s" % value)

View File

@@ -331,7 +331,11 @@ registerCommand("bbedit", bbedit)
def bb(args):
try:
print(theDumper.run(args))
except:
import traceback
traceback.print_exc()
registerCommand("bb", bb)
@@ -409,11 +413,13 @@ class Dumper(DumperBase):
self.useDynamicType = "dyntype" in options
self.useFancy = "fancy" in options
self.forceQtNamespace = "forcens" in options
self.passExceptions = "pe" in options
#self.passExceptions = True
self.autoDerefPointers = "autoderef" in options
self.partialUpdate = "partial" in options
self.tooltipOnly = "tooltiponly" in options
self.fallbackQtVersion = 0x50200
#warn("NAMESPACE: '%s'" % self.qtNamespace())
#warn("VARIABLES: %s" % varList)
#warn("EXPANDED INAMES: %s" % self.expandedINames)
@@ -495,6 +501,9 @@ class Dumper(DumperBase):
self.output.append(']')
self.typesToReport = {}
if "forcens" in options:
self.qtNamepaceToRport = self.qtNamespace()
if self.qtNamespaceToReport:
self.output.append(',qtnamespace="%s"' % self.qtNamespaceToReport)
self.qtNamespaceToReport = None
@@ -846,7 +855,9 @@ class Dumper(DumperBase):
pass
# Older GDB ~7.4
try:
return gdb.parse_and_eval(symbolName)
address = gdb.parse_and_eval("&'%s'" % symbolName)
type = gdb.lookup_type(self.qtNamespace() + "QMetaObject")
return self.createPointerValue(address, type)
except:
return 0
@@ -905,25 +916,28 @@ class Dumper(DumperBase):
def isQnxTarget(self):
return 'qnx' in gdb.TARGET_CONFIG.lower()
def qtVersion(self):
def qtVersionString(self):
try:
return str(gdb.lookup_symbol("qVersion")[0].value()())
except:
pass
try:
ns = self.qtNamespace()
version = str(gdb.parse_and_eval("((const char*(*)())'%s::qVersion')()" % ns))
(major, minor, patch) = version[version.find('"')+1:version.rfind('"')].split('.')
self.cachedQtVersion = 0x10000 * int(major) + 0x100 * int(minor) + int(patch)
return str(gdb.parse_and_eval("((const char*(*)())'%sqVersion')()" % ns))
except:
try:
# This will fail on Qt 5
gdb.execute("ptype QString::shared_null", to_string=True)
self.cachedQtVersion = 0x040800
except:
#self.cachedQtVersion = 0x050000
# Assume Qt 5.3 until we have a definitive answer.
return 0x050300
pass
return None
# Memoize good results.
self.qtVersion = lambda: self.cachedQtVersion
return self.cachedQtVersion
def qtVersion(self):
try:
version = self.qtVersionString()
(major, minor, patch) = version[version.find('"')+1:version.rfind('"')].split('.')
qtversion = 0x10000 * int(major) + 0x100 * int(minor) + int(patch)
self.qtVersion = lambda: qtversion
return qtversion
except:
# Use fallback until we have a better answer.
return self.fallbackQtVersion
def isQt3Support(self):
if self.qtVersion() >= 0x050000:
@@ -1044,20 +1058,6 @@ class Dumper(DumperBase):
return Hex2EncodedFloat8
return None
def tryPutArrayContents(self, typeobj, base, n):
enc = self.simpleEncoding(typeobj)
if not enc:
return False
size = n * typeobj.sizeof;
self.put('childtype="%s",' % typeobj)
self.put('addrbase="0x%x",' % toInteger(base))
self.put('addrstep="0x%x",' % toInteger(typeobj.sizeof))
self.put('arrayencoding="%s",' % enc)
self.put('arraydata="')
self.put(self.readMemory(base, size))
self.put('",')
return True
def isReferenceType(self, typeobj):
return typeobj.code == gdb.TYPE_CODE_REF
@@ -1560,29 +1560,32 @@ class Dumper(DumperBase):
self.importPlainDumper(printer)
def qtNamespace(self):
# FIXME: This only works when call from inside a Qt function frame.
namespace = ""
# This only works when called from a valid frame.
try:
out = gdb.execute("ptype QString::Null", to_string=True)
# The result looks like:
# "type = const struct myns::QString::Null {"
# " <no data fields>"
# "}"
pos1 = out.find("struct") + 7
pos2 = out.find("QString::Null")
if pos1 > -1 and pos2 > -1:
namespace = out[pos1:pos2]
# Doesn't work
#gdb.write('=qt-namespace-detected,ns="%s"' % namespace)
self.qtNamespaceToReport = namespace
self.cachedQtNamespace = namespace
self.qtNamespace = lambda: self.cachedQtNamespace
cand = "QArrayData::shared_null"
symbol = gdb.lookup_symbol(cand)[0]
if symbol:
ns = symbol.name[:-len(cand)]
self.qtNamespaceToReport = ns
self.qtNamespace = lambda: ns
return ns
except:
pass
return namespace
try:
# This is Qt, but not 5.x.
cand = "QByteArray::shared_null"
symbol = gdb.lookup_symbol(cand)[0]
if symbol:
ns = symbol.name[:-len(cand)]
self.qtNamespaceToReport = ns
self.qtNamespace = lambda: ns
self.fallbackQtVersion = 0x40800
return ns
except:
pass
return ""
def bbedit(self, args):
(typeName, expr, data) = args.split(',')

View File

@@ -221,35 +221,6 @@ lldb.SBType.strip_typedefs = \
lldb.SBType.__orig__str__ = lldb.SBType.__str__
lldb.SBType.__str__ = lldb.SBType.GetName
def simpleEncoding(typeobj):
code = typeobj.GetTypeClass()
size = typeobj.sizeof
if code == lldb.eTypeClassBuiltin:
name = str(typeobj)
if name == "float":
return Hex2EncodedFloat4
if name == "double":
return Hex2EncodedFloat8
if name.find("unsigned") >= 0:
if size == 1:
return Hex2EncodedUInt1
if size == 2:
return Hex2EncodedUInt2
if size == 4:
return Hex2EncodedUInt4
if size == 8:
return Hex2EncodedUInt8
else:
if size == 1:
return Hex2EncodedInt1
if size == 2:
return Hex2EncodedInt2
if size == 4:
return Hex2EncodedInt4
if size == 8:
return Hex2EncodedInt8
return None
class Dumper(DumperBase):
def __init__(self):
DumperBase.__init__(self)
@@ -316,6 +287,7 @@ class Dumper(DumperBase):
self.isInterrupting_ = False
self.dummyValue = None
self.types_ = {}
self.breakpointsToCheck = set([])
def enterSubItem(self, item):
if isinstance(item.name, lldb.SBValue):
@@ -587,18 +559,34 @@ class Dumper(DumperBase):
def putSimpleValue(self, value, encoding = None, priority = 0):
self.putValue(value.GetValue(), encoding, priority)
def tryPutArrayContents(self, typeobj, base, n):
if not self.isSimpleType(typeobj):
return False
size = n * typeobj.sizeof
self.put('childtype="%s",' % typeobj)
self.put('addrbase="0x%x",' % int(base))
self.put('addrstep="%d",' % typeobj.sizeof)
self.put('arrayencoding="%s",' % simpleEncoding(typeobj))
self.put('arraydata="')
self.put(self.readMemory(base, size))
self.put('",')
return True
def simpleEncoding(self, typeobj):
code = typeobj.GetTypeClass()
size = typeobj.sizeof
if code == lldb.eTypeClassBuiltin:
name = str(typeobj)
if name == "float":
return Hex2EncodedFloat4
if name == "double":
return Hex2EncodedFloat8
if name.find("unsigned") >= 0:
if size == 1:
return Hex2EncodedUInt1
if size == 2:
return Hex2EncodedUInt2
if size == 4:
return Hex2EncodedUInt4
if size == 8:
return Hex2EncodedUInt8
else:
if size == 1:
return Hex2EncodedInt1
if size == 2:
return Hex2EncodedInt2
if size == 4:
return Hex2EncodedInt4
if size == 8:
return Hex2EncodedInt8
return None
def putArrayData(self, type, base, n,
childNumChild = None, maxNumChild = 10000):
@@ -660,6 +648,7 @@ class Dumper(DumperBase):
self.executable_ = args['executable']
self.startMode_ = args.get('startMode', 1)
self.breakOnMain_ = args.get('breakOnMain', 0)
self.useTerminal_ = args.get('useTerminal', 0)
self.processArgs_ = args.get('processArgs', [])
self.processArgs_ = map(lambda x: self.hexdecode(x), self.processArgs_)
self.attachPid_ = args.get('attachPid', 0)
@@ -667,6 +656,8 @@ class Dumper(DumperBase):
self.remoteChannel_ = args.get('remoteChannel', '')
self.platform_ = args.get('platform', '')
self.ignoreStops = 1 if self.useTerminal_ else 0
if self.platform_:
self.debugger.SetCurrentPlatform(self.platform_)
# sysroot has to be set *after* the platform
@@ -801,6 +792,14 @@ class Dumper(DumperBase):
result += '],current-thread-id="%s"},' % self.currentThread().id
self.report(result)
def reportChangedBreakpoints(self):
for i in xrange(0, self.target.GetNumBreakpoints()):
bp = self.target.GetBreakpointAtIndex(i)
if bp.GetID() in self.breakpointsToCheck:
if bp.GetNumLocations():
self.breakpointsToCheck.remove(bp.GetID())
self.report('breakpoint-changed={%s}' % self.describeBreakpoint(bp))
def firstUsableFrame(self, thread):
for i in xrange(10):
frame = thread.GetFrameAtIndex(i)
@@ -819,16 +818,10 @@ class Dumper(DumperBase):
if not thread:
self.report('msg="No thread"')
return
frame = thread.GetSelectedFrame()
if frame:
frameId = frame.GetFrameID()
else:
frameId = 0;
(n, isLimited) = (limit, True) if limit > 0 else (thread.GetNumFrames(), False)
result = 'stack={current-frame="%s"' % frameId
result += ',current-thread="%s"' % thread.GetThreadID()
result = 'stack={current-thread="%s"' % thread.GetThreadID()
result += ',frames=['
for i in xrange(n):
frame = thread.GetFrameAtIndex(i)
@@ -837,14 +830,12 @@ class Dumper(DumperBase):
break
lineEntry = frame.GetLineEntry()
line = lineEntry.GetLine()
usable = line != 0
result += '{pc="0x%x"' % frame.GetPC()
result += ',level="%d"' % frame.idx
result += ',addr="0x%x"' % frame.GetPCAddress().GetLoadAddress(self.target)
result += ',func="%s"' % frame.GetFunctionName()
result += ',line="%d"' % line
result += ',fullname="%s"' % fileName(lineEntry.file)
result += ',usable="%d"' % usable
result += ',file="%s"},' % fileName(lineEntry.file)
result += ']'
result += ',hasmore="%d"' % isLimited
@@ -852,6 +843,20 @@ class Dumper(DumperBase):
result += '}'
self.report(result)
def reportStackPosition(self):
thread = self.currentThread()
if not thread:
self.report('msg="No thread"')
return
frame = thread.GetSelectedFrame()
if frame:
self.report('stack-position={id="%s"}' % frame.GetFrameID())
else:
self.report('stack-position={id="-1"}')
def reportStackTop(self):
self.report('stack-top={}')
def putBetterType(self, type):
try:
self.currentType = type.GetName()
@@ -1184,8 +1189,8 @@ class Dumper(DumperBase):
state = self.process.GetState()
if state == lldb.eStateStopped:
self.reportStack()
self.reportStackPosition()
self.reportThreads()
self.reportLocation()
self.reportVariables()
def reportRegisters(self, _ = None):
@@ -1259,6 +1264,9 @@ class Dumper(DumperBase):
if self.isInterrupting_:
self.isInterrupting_ = False
self.report('state="inferiorstopok"')
elif self.ignoreStops > 0:
self.ignoreStops -= 1
self.process.Continue()
else:
self.report('state="stopped"')
else:
@@ -1269,14 +1277,13 @@ class Dumper(DumperBase):
stoppedThread = self.firstStoppedThread()
if stoppedThread:
self.process.SetSelectedThread(stoppedThread)
usableFrame = self.firstUsableFrame(stoppedThread)
if usableFrame:
stoppedThread.SetSelectedFrame(usableFrame)
self.reportStack({'stacklimit': 20})
self.reportStackTop()
self.reportThreads()
self.reportLocation()
self.reportVariables()
self.reportRegisters()
self.reportChangedBreakpoints()
elif type == lldb.SBProcess.eBroadcastBitInterrupt:
pass
elif type == lldb.SBProcess.eBroadcastBitSTDOUT:
@@ -1291,13 +1298,12 @@ class Dumper(DumperBase):
elif type == lldb.SBProcess.eBroadcastBitProfileData:
pass
def describeBreakpoint(self, bp, modelId):
def describeBreakpoint(self, bp):
isWatch = isinstance(bp, lldb.SBWatchpoint)
if isWatch:
result = 'lldbid="%s"' % (qqWatchpointOffset + bp.GetID())
else:
result = 'lldbid="%s"' % bp.GetID()
result += ',modelid="%s"' % modelId
if not bp.IsValid():
return
result += ',hitcount="%s"' % bp.GetHitCount()
@@ -1312,18 +1318,25 @@ class Dumper(DumperBase):
result += ',valid="%s"' % (1 if bp.IsValid() else 0)
result += ',ignorecount="%s"' % bp.GetIgnoreCount()
result += ',locations=['
lineEntry = None
if hasattr(bp, 'GetNumLocations'):
for i in xrange(bp.GetNumLocations()):
loc = bp.GetLocationAtIndex(i)
addr = loc.GetAddress()
lineEntry = addr.GetLineEntry()
result += '{locid="%s"' % loc.GetID()
result += ',func="%s"' % addr.GetFunction().GetName()
result += ',enabled="%s"' % (1 if loc.IsEnabled() else 0)
result += ',resolved="%s"' % (1 if loc.IsResolved() else 0)
result += ',valid="%s"' % (1 if loc.IsValid() else 0)
result += ',ignorecount="%s"' % loc.GetIgnoreCount()
result += ',file="%s"' % lineEntry.GetFileSpec()
result += ',line="%s"' % lineEntry.GetLine()
result += ',addr="%s"},' % loc.GetLoadAddress()
result += '],'
result += ']'
if lineEntry is not None:
result += ',file="%s"' % lineEntry.GetFileSpec()
result += ',line="%s"' % lineEntry.GetLine()
return result
def createBreakpointAtMain(self):
@@ -1333,26 +1346,26 @@ class Dumper(DumperBase):
def addBreakpoint(self, args):
bpType = args["type"]
if bpType == BreakpointByFileAndLine:
bpNew = self.target.BreakpointCreateByLocation(
bp = self.target.BreakpointCreateByLocation(
str(args["file"]), int(args["line"]))
elif bpType == BreakpointByFunction:
bpNew = self.target.BreakpointCreateByName(args["function"])
bp = self.target.BreakpointCreateByName(args["function"])
elif bpType == BreakpointByAddress:
bpNew = self.target.BreakpointCreateByAddress(args["address"])
bp = self.target.BreakpointCreateByAddress(args["address"])
elif bpType == BreakpointAtMain:
bpNew = self.createBreakpointAtMain()
bp = self.createBreakpointAtMain()
elif bpType == BreakpointByFunction:
bpNew = self.target.BreakpointCreateByName(args["function"])
bp = self.target.BreakpointCreateByName(args["function"])
elif bpType == BreakpointAtThrow:
bpNew = self.target.BreakpointCreateForException(
bp = self.target.BreakpointCreateForException(
lldb.eLanguageTypeC_plus_plus, False, True)
elif bpType == BreakpointAtCatch:
bpNew = self.target.BreakpointCreateForException(
bp = self.target.BreakpointCreateForException(
lldb.eLanguageTypeC_plus_plus, True, False)
elif bpType == WatchpointAtAddress:
error = lldb.SBError()
bpNew = self.target.WatchAddress(args["address"], 4, False, True, error)
#warn("BPNEW: %s" % bpNew)
bp = self.target.WatchAddress(args["address"], 4, False, True, error)
#warn("BPNEW: %s" % bp)
self.reportError(error)
elif bpType == WatchpointAtExpression:
# FIXME: Top level-only for now.
@@ -1360,7 +1373,7 @@ class Dumper(DumperBase):
frame = self.currentFrame()
value = frame.FindVariable(args["expression"])
error = lldb.SBError()
bpNew = self.target.WatchAddress(value.GetLoadAddress(),
bp = self.target.WatchAddress(value.GetLoadAddress(),
value.GetByteSize(), False, True, error)
except:
return self.target.BreakpointCreateByName(None)
@@ -1368,13 +1381,14 @@ class Dumper(DumperBase):
# This leaves the unhandled breakpoint in a (harmless)
# "pending" state.
return self.target.BreakpointCreateByName(None)
bpNew.SetIgnoreCount(int(args["ignorecount"]))
if hasattr(bpNew, 'SetCondition'):
bpNew.SetCondition(self.hexdecode(args["condition"]))
bpNew.SetEnabled(int(args["enabled"]))
if hasattr(bpNew, 'SetOneShot'):
bpNew.SetOneShot(int(args["oneshot"]))
return bpNew
bp.SetIgnoreCount(int(args["ignorecount"]))
if hasattr(bp, 'SetCondition'):
bp.SetCondition(self.hexdecode(args["condition"]))
bp.SetEnabled(int(args["enabled"]))
if hasattr(bp, 'SetOneShot'):
bp.SetOneShot(int(args["oneshot"]))
self.breakpointsToCheck.add(bp.GetID())
return bp
def changeBreakpoint(self, args):
id = int(args["lldbid"])
@@ -1387,6 +1401,7 @@ class Dumper(DumperBase):
bp.SetEnabled(int(args["enabled"]))
if hasattr(bp, 'SetOneShot'):
bp.SetOneShot(int(args["oneshot"]))
return bp
def removeBreakpoint(self, args):
id = int(args['lldbid'])
@@ -1402,30 +1417,27 @@ class Dumper(DumperBase):
if needStop:
error = self.process.Stop()
result = 'bkpts=['
for bp in args['bkpts']:
operation = bp['operation']
modelId = bp['modelid']
if operation == 'add':
bpNew = self.addBreakpoint(bp)
result += '{operation="added",%s}' \
% self.describeBreakpoint(bpNew, bp["modelid"])
self.report('breakpoint-added={%s,modelid="%s"}'
% (self.describeBreakpoint(bpNew), modelId))
elif operation == 'change':
bpNew = self.changeBreakpoint(bp)
result += '{operation="changed",%s' \
% self.describeBreakpoint(bpNew, bp["modelid"])
self.report('breakpoint-changed={%s,modelid="%s"}'
% (self.describeBreakpoint(bpNew), modelId))
elif operation == 'remove':
bpDead = self.removeBreakpoint(bp)
result += '{operation="removed",modelid="%s"}' % bp["modelid"]
result += "]"
self.report('breakpoint-removed={modelid="%s"}' % modelId)
if needStop:
error = self.process.Continue()
self.report(result)
def listModules(self, args):
result = 'modules=['
@@ -1543,9 +1555,7 @@ class Dumper(DumperBase):
self.currentThread().SetSelectedFrame(args['index'])
state = self.process.GetState()
if state == lldb.eStateStopped:
self.reportStack(args)
self.reportThreads()
self.reportLocation()
self.reportStackPosition()
self.reportVariables()
def selectThread(self, args):
@@ -1580,19 +1590,30 @@ class Dumper(DumperBase):
self.reportVariables(args)
def disassemble(self, args):
frame = self.currentFrame();
function = frame.GetFunction()
name = function.GetName()
functionName = args.get('function', '')
flavor = args.get('flavor', '')
function = None
if len(functionName):
functions = self.target.FindFunctions(functionName).functions
if len(functions):
function = functions[0]
if function:
base = function.GetStartAddress().GetLoadAddress(self.target)
instructions = function.GetInstructions(self.target)
else:
base = args.get('address', 0)
addr = lldb.SBAddress(base, self.target)
instructions = self.target.ReadInstructions(addr, 100)
result = 'disassembly={cookie="%s",' % args['cookie']
result += ',lines=['
base = function.GetStartAddress().GetLoadAddress(self.target)
for insn in function.GetInstructions(self.target):
for insn in instructions:
comment = insn.GetComment(self.target)
addr = insn.GetAddress().GetLoadAddress(self.target)
result += '{address="%s"' % addr
result += ',inst="%s %s"' % (insn.GetMnemonic(self.target),
insn.GetOperands(self.target))
result += ',func_name="%s"' % name
result += ',func_name="%s"' % functionName
if comment:
result += ',comment="%s"' % comment
result += ',offset="%s"},' % (addr - base)

View File

@@ -402,10 +402,10 @@ def qdump__QDir(d, value):
def qdump__QFile(d, value):
# 9fc0965 changes the layout of the private structure
qtVersion = d.qtVersion()
if qtVersion >= 0x050300:
offset = 172 if d.is32bit() else 272
if qtVersion >= 0x050200:
offset = 176 if d.is32bit() else 272
elif qtVersion >= 0x050000:
offset = 176 if d.is32bit() else 280
offset = 180 if d.is32bit() else 280
else:
offset = 140 if d.is32bit() else 232
privAddress = d.extractPointer(d.addressOf(value) + d.ptrSize())

View File

@@ -66,17 +66,8 @@ Controls.CheckBox {
backendValue.value = checkBox.checked;
}
style: CheckBoxStyle {
spacing: 8
label: Controls.Label { text: control.text ; color: checkBox.textColor }
indicator: Item {
implicitWidth: 16
implicitHeight: 16
Image { source: "qrc:qmldesigner/images/checkbox_" +
(control.checked ? "checked": "unchecked") +
(control.pressed ? "_pressed": "") + ".png" }
style: CustomCheckBoxStyle {
}
} //control.pressed ? "qrc:qmldesigner/images/checkbox_unchecked_pressed.png" :
}

View File

@@ -0,0 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2014 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 2.1
import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.1
CheckBoxStyle {
spacing: 8
label: Controls.Label { text: control.text ; color: checkBox.textColor }
indicator: Item {
implicitWidth: 16
implicitHeight: 16
Image { source: "qrc:qmldesigner/images/checkbox_" +
(control.checked ? "checked": "unchecked") +
(control.pressed ? "_pressed": "") + ".png" }
}
}

View File

@@ -91,6 +91,7 @@ Section {
backendValue: backendValues.flickableDirection
model: ["AutoFlickDirection", "HorizontalFlick", "VerticalFlick", "HorizontalAndVerticalFlick"]
Layout.fillWidth: true
scope: "Flickable"
}
}
@@ -105,23 +106,11 @@ Section {
backendValue: backendValues.boundsBehavior
model: ["StopAtBounds", "DragOverBounds", "DragAndOvershootBounds"]
Layout.fillWidth: true
scope: "Flickable"
}
}
Label {
text: qsTr("Behavior")
toolTip: qsTr("Bounds behavior")
}
SecondColumnLayout {
ComboBox {
backendValue: backendValues.boundsBehavior
model: ["StopAtBounds", "DragOverBounds", "DragAndOvershootBounds"]
Layout.fillWidth: true
}
}
Label {
text:qsTr("Interactive")
}

View File

@@ -166,6 +166,7 @@ Section {
Layout.fillWidth: true
backendValue: (backendValues.style === undefined) ? dummyBackendValue : backendValues.style
model: ["Normal", "Outline", "Raised", "Sunken"]
scope: "Text"
}
}
}

View File

@@ -34,3 +34,6 @@ FlickableSection 2.0 FlickableSection.qml
UrlChooser 2.0 UrlChooser.qml
FontComboBox 2.0 FontComboBox.qml
OriginControl 2.0 OriginControl.qml
CustomComboBoxStyle 2.0 CustomComboBoxStyle.qml
CustomSpinBoxStyle 2.0 CustomSpinBoxStyle.qml
CustomCheckBoxStyle 2.0 CustomCheckBoxStyle.qml

View File

@@ -3,5 +3,7 @@ Label {
toolTip: "%1"
}
SpinBox {
maximumValue: 9999999
minimumValue: -9999999
backendValue: backendValues.%2
}

View File

@@ -107,9 +107,10 @@ Column {
SecondColumnLayout {
ComboBox {
model: ["LeftToRight", "TopToBottom"]
model: ["FlowLeftToRight", "FlowTopToBottom"]
backendValue: backendValues.flow
Layout.fillWidth: true
scope: "GridView"
}
}
@@ -137,6 +138,7 @@ Column {
model: ["LeftToRight", "RightToLeft"]
backendValue: backendValues.layoutDirection
Layout.fillWidth: true
scope: "Qt"
}
}
@@ -150,6 +152,7 @@ Column {
model: ["NoSnap", "SnapToRow", "SnapOneRow"]
backendValue: backendValues.snapMode
Layout.fillWidth: true
scope: "GridView"
}
}
@@ -173,6 +176,7 @@ Column {
model: ["NoHighlightRange", "ApplyRange", "StrictlyEnforceRange"]
backendValue: backendValues.highlightRangeMode
Layout.fillWidth: true
scope: "GridView"
}
}

View File

@@ -90,6 +90,7 @@ Column {
model: ["Horizontal", "Vertical"]
backendValue: backendValues.orientation
Layout.fillWidth: true
scope: "ListView"
}
}
@@ -102,6 +103,7 @@ Column {
ComboBox {
model: ["LeftToRight", "RightToLeft"]
backendValue: backendValues.layoutDirection
scope: "Qt"
}
ExpandingSpacer {
@@ -116,8 +118,9 @@ Column {
SecondColumnLayout {
ComboBox {
model: ["NoSnap", "SnapToRow", "SnapOneRow"]
model: ["NoSnap", "SnapToItem", "SnapOneItem"]
backendValue: backendValues.snapMode
scope: "ListView"
}
ExpandingSpacer {
@@ -163,6 +166,7 @@ Column {
model: ["NoHighlightRange", "ApplyRange", "StrictlyEnforceRange"]
backendValue: backendValues.highlightRangeMode
Layout.fillWidth: true
scope: "ListView"
}
ExpandingSpacer {

View File

@@ -146,6 +146,7 @@ Column {
model: ["NoHighlightRange", "ApplyRange", "StrictlyEnforceRange"]
backendValue: backendValues.highlightRangeMode
Layout.fillWidth: true
scope: "PathView"
}
ExpandingSpacer {

View File

@@ -3,15 +3,17 @@ import QtQuick 1.1
Rectangle {
width: 360
height: 360
Text {
anchors.centerIn: parent
text: "Hello World"
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}

View File

@@ -3,15 +3,18 @@ import QtQuick 2.1
Rectangle {
width: 360
height: 360
Text {
anchors.centerIn: parent
text: "Hello World"
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="C"
<template openeditor="main.qml" priority="D"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.2.1">
<displayname>Qt Quick 2.1</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.1 or newer.</description>

View File

@@ -3,15 +3,17 @@ import QtQuick 2.2
Rectangle {
width: 360
height: 360
Text {
anchors.centerIn: parent
text: "Hello World"
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="A"
<template openeditor="main.qml" priority="C"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.2.2">
<displayname>Qt Quick 2.2</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.2 or newer.</description>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="D"
<template openeditor="main.qml" priority="B"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.0">
<displayname>Qt Quick Controls 1.0</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.1 or newer.</description>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="B"
<template openeditor="main.qml" priority="A"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.1">
<displayname>Qt Quick Controls 1.1</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.2 or newer.</description>

View File

@@ -3,14 +3,16 @@ import QtQuick 1.1
Rectangle {
width: 360
height: 360
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
}

View File

@@ -6,15 +6,15 @@ Window {
width: 360
height: 360
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="C"
<template openeditor="main.qml" priority="D"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.2.1"
qrcdeployment="qrcdeployment.pri"
stubversionminor="5">

View File

@@ -6,15 +6,15 @@ Window {
width: 360
height: 360
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="A"
<template openeditor="main.qml" priority="C"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.2.2"
qrcdeployment="qrcdeployment.pri"
stubversionminor="5">

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="D"
<template openeditor="main.qml" priority="B"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.Controls.1.0"
qrcdeployment="qrcdeployment.pri"
stubversionminor="1">

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="B"
<template openeditor="main.qml" priority="A"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.Controls.1.1"
qrcdeployment="qrcdeployment.pri"
stubversionminor="1">

View File

@@ -336,7 +336,7 @@ public:
unsigned kind : 8;
// The token starts a new line.
unsigned newline : 1;
// The token is preceeded by whitespace(s).
// The token is preceded by whitespace(s).
unsigned whitespace : 1;
// The token is joined with the previous one.
unsigned joined : 1;
@@ -354,7 +354,7 @@ public:
unsigned generated : 1;
// Unused...
unsigned pad : 3;
// The token lenght.
// The token length.
unsigned length : 16;
};
union {

View File

@@ -197,7 +197,7 @@ void TranslationUnit::tokenize()
if (tk.is(T_TILDE)) {
lex(&tk);
// Get the total number of generated tokens and specifiy "null"
// Get the total number of generated tokens and specify "null"
// information for them.
unsigned totalGenerated =
static_cast<unsigned>(strtoul(tk.spell(), 0, 0));

View File

@@ -976,7 +976,7 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
QVector<PPToken> body = macro->definitionTokens();
// Withing nested expansion we might reach a previously added marker token. In this case,
// Within nested expansion we might reach a previously added marker token. In this case,
// we need to move it from its current possition to outside the nesting.
PPToken oldMarkerTk;
@@ -1837,13 +1837,13 @@ void Preprocessor::handleElifDirective(PPToken *tk, const PPToken &poundToken)
m_state.m_skipping[m_state.m_ifLevel] = true;
} else if (m_state.m_trueTest[m_state.m_ifLevel]) {
if (!m_state.m_skipping[m_state.m_ifLevel]) {
// start skipping because the preceeding then-part was not skipped
// start skipping because the preceding then-part was not skipped
m_state.m_skipping[m_state.m_ifLevel] = true;
if (m_client)
startSkippingBlocks(poundToken);
}
} else {
// preceeding then-part was skipped, so calculate if we should start
// preceding then-part was skipped, so calculate if we should start
// skipping, depending on the condition
Value result;
evalExpression(tk, result);

View File

@@ -55,6 +55,13 @@ enum BindingType {
MaximumBindingType
};
enum AnimationThread {
GuiThread,
RenderThread,
MaximumAnimationThread
};
namespace Constants {
const int QML_MIN_LEVEL = 1; // Set to 0 to remove the empty line between models in the timeline
}

View File

@@ -169,9 +169,14 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
d->maximumTime = qMax(time, d->maximumTime);
} else if (event == AnimationFrame) {
int frameRate, animationCount;
int threadId;
stream >> frameRate >> animationCount;
if (!stream.atEnd())
stream >> threadId;
else
threadId = 0;
emit rangedEvent(QmlDebug::Painting, QmlDebug::AnimationFrame, time, 0,
QStringList(), QmlDebug::QmlEventLocation(), frameRate, animationCount, 0,0,0);
QStringList(), QmlDebug::QmlEventLocation(), frameRate, animationCount, threadId,0,0);
d->maximumTime = qMax(time, d->maximumTime);
} else if (event == StartTrace) {
emit this->traceStarted(time);

View File

@@ -1054,7 +1054,7 @@ void ModelManagerInterface::updateImportPaths()
m_synchronizer.addFuture(result);
addTaskInternal(result, tr("Qml import scan"), Constants::TASK_IMPORT_SCAN);
addTaskInternal(result, tr("QML import scan"), Constants::TASK_IMPORT_SCAN);
}
}

View File

@@ -225,7 +225,7 @@ void PluginDumper::dumpAllPlugins()
static QString noTypeinfoError(const QString &libraryPath)
{
return PluginDumper::tr("QML module does not contain information about components contained in plugins\n\n"
return PluginDumper::tr("QML module does not contain information about components contained in plugins.\n\n"
"Module path: %1\n"
"See \"Using QML Modules with Plugins\" in the documentation.").arg(
libraryPath);
@@ -255,7 +255,7 @@ static QString qmldumpFailedMessage(const QString &libraryPath, const QString &e
static void printParseWarnings(const QString &libraryPath, const QString &warning)
{
ModelManagerInterface::writeWarning(
PluginDumper::tr("Warnings while parsing qmltypes information of %1:\n"
PluginDumper::tr("Warnings while parsing QML type information of %1:\n"
"%2").arg(libraryPath, warning));
}

View File

@@ -31,6 +31,7 @@
#include "symbolgroupvalue.h"
#include "symbolgroup.h"
#include "stringutils.h"
#include "extensioncontext.h"
#include <functional>
#include <iterator>
@@ -225,13 +226,13 @@ int containerSize(KnownType kt, const SymbolGroupValue &v)
* and the next link */
template <class ValueFunction, class NextFunction>
AbstractSymbolGroupNodePtrVector linkedListChildList(SymbolGroupValue headNode,
int count,
unsigned count,
ValueFunction valueFunc,
NextFunction nextFunc)
{
AbstractSymbolGroupNodePtrVector rc;
rc.reserve(count);
for (int i =0; i < count && headNode; i++) {
for (unsigned i = 0; i < count && headNode; i++) {
if (const SymbolGroupValue value = valueFunc(headNode)) {
rc.push_back(ReferenceSymbolGroupNode::createArrayNode(i, value.node()));
headNode = nextFunc(headNode);
@@ -254,7 +255,7 @@ private:
};
// std::list<T>: Skip dummy head node and then a linked list of "_Next", "_Myval".
static inline AbstractSymbolGroupNodePtrVector stdListChildList(SymbolGroupNode *n, int count,
static inline AbstractSymbolGroupNodePtrVector stdListChildList(SymbolGroupNode *n, unsigned count,
const SymbolGroupValueContext &ctx)
{
if (!count)
@@ -267,13 +268,13 @@ static inline AbstractSymbolGroupNodePtrVector stdListChildList(SymbolGroupNode
return AbstractSymbolGroupNodePtrVector();
}
static inline AbstractSymbolGroupNodePtrVector stdArrayChildList(SymbolGroupNode *n, int count,
static inline AbstractSymbolGroupNodePtrVector stdArrayChildList(SymbolGroupNode *n, unsigned count,
const SymbolGroupValueContext &ctx)
{
AbstractSymbolGroupNodePtrVector rc;
if (SymbolGroupValue elems = SymbolGroupValue(n, ctx)["_Elems"]) {
rc.reserve(count);
for (int i = 0; i < count; ++i) {
for (unsigned i = 0; i < count; ++i) {
if (const SymbolGroupValue value = elems[i])
rc.push_back(ReferenceSymbolGroupNode::createArrayNode(i, value.node()));
else
@@ -284,8 +285,8 @@ static inline AbstractSymbolGroupNodePtrVector stdArrayChildList(SymbolGroupNode
}
// QLinkedList<T>: Dummy head node and then a linked list of "n", "t".
static inline AbstractSymbolGroupNodePtrVector qLinkedListChildList(SymbolGroupNode *n, int count,
const SymbolGroupValueContext &ctx)
static inline AbstractSymbolGroupNodePtrVector qLinkedListChildList(
SymbolGroupNode *n, unsigned count, const SymbolGroupValueContext &ctx)
{
if (count)
if (const SymbolGroupValue head = SymbolGroupValue(n, ctx)["e"]["n"])
@@ -301,14 +302,14 @@ template <class AddressFunc>
AbstractSymbolGroupNodePtrVector arrayChildList(SymbolGroup *sg, AddressFunc addressFunc,
const std::string &module,
const std::string &innerType,
int count)
unsigned count)
{
AbstractSymbolGroupNodePtrVector rc;
if (!count)
return rc;
std::string errorMessage;
rc.reserve(count);
for (int i = 0; i < count; i++) {
for (unsigned i = 0; i < count; i++) {
const std::string name = SymbolGroupValue::pointedToSymbolName(addressFunc(), innerType);
if (SymbolGroupNode *child = sg->addSymbol(module, name, std::string(), &errorMessage)) {
rc.push_back(ReferenceSymbolGroupNode::createArrayNode(i, child));
@@ -344,7 +345,7 @@ private:
static inline AbstractSymbolGroupNodePtrVector
arrayChildList(SymbolGroup *sg, ULONG64 address, const std::string &module,
const std::string &innerType, int count)
const std::string &innerType, unsigned count)
{
if (const unsigned innerTypeSize = SymbolGroupValue::sizeOf(innerType.c_str()))
return arrayChildList(sg, AddressSequence(address, innerTypeSize),
@@ -354,7 +355,7 @@ static inline AbstractSymbolGroupNodePtrVector
// std::vector<T>
static inline AbstractSymbolGroupNodePtrVector
stdVectorChildList(SymbolGroupNode *n, int count, const SymbolGroupValueContext &ctx)
stdVectorChildList(SymbolGroupNode *n, unsigned count, const SymbolGroupValueContext &ctx)
{
if (!count)
return AbstractSymbolGroupNodePtrVector();
@@ -382,14 +383,14 @@ AbstractSymbolGroupNodePtrVector
const AddressType *blockArray, ULONG64 blockArraySize,
const std::string &module,
const std::string &innerType, ULONG64 innerTypeSize,
ULONG64 startOffset, ULONG64 dequeSize, int count)
ULONG64 startOffset, ULONG64 dequeSize, unsigned count)
{
AbstractSymbolGroupNodePtrVector rc;
rc.reserve(count);
std::string errorMessage;
// Determine block number and offset in the block array T[][dequeSize]
// and create symbol by address.
for (int i = 0; i < count; i++) {
for (unsigned i = 0; i < count; i++) {
// see <deque>-header: std::deque<T>::iterator::operator*
const ULONG64 offset = startOffset + i;
ULONG64 block = offset / dequeSize;
@@ -407,7 +408,7 @@ AbstractSymbolGroupNodePtrVector
// std::deque<>
static inline AbstractSymbolGroupNodePtrVector
stdDequeChildList(const SymbolGroupValue &dequeIn, int count)
stdDequeChildList(const SymbolGroupValue &dequeIn, unsigned count)
{
if (!count)
return AbstractSymbolGroupNodePtrVector();
@@ -618,29 +619,29 @@ static inline SymbolGroupValueVector
// std::set<>: Children directly contained in list
static inline AbstractSymbolGroupNodePtrVector
stdSetChildList(const SymbolGroupValue &set, int count)
stdSetChildList(const SymbolGroupValue &set, unsigned count)
{
const SymbolGroupValueVector children = stdTreeChildList(set, count);
if (int(children.size()) != count)
return AbstractSymbolGroupNodePtrVector();
AbstractSymbolGroupNodePtrVector rc;
rc.reserve(count);
for (int i = 0; i < count; i++)
for (unsigned i = 0; i < count; i++)
rc.push_back(ReferenceSymbolGroupNode::createArrayNode(i, children.at(i).node()));
return rc;
}
// std::map<K,V>: A list of std::pair<K,V> (derived from std::pair_base<K,V>)
static inline AbstractSymbolGroupNodePtrVector
stdMapChildList(const SymbolGroupValue &map, int count)
stdMapChildList(const SymbolGroupValue &map, unsigned count)
{
const SymbolGroupValueVector children = stdTreeChildList(map[unsigned(0)], count);
if (int(children.size()) != count)
if (children.size() != count)
return AbstractSymbolGroupNodePtrVector();
AbstractSymbolGroupNodePtrVector rc;
rc.reserve(count);
const std::string firstName = "first";
for (int i = 0; i < count; i++) {
for (unsigned i = 0; i < count; i++) {
// MSVC2010 (only) has a std::pair_base class.
const SymbolGroupValue key = SymbolGroupValue::findMember(children.at(i), firstName);
const SymbolGroupValue pairBase = key.parent();
@@ -658,7 +659,7 @@ static inline AbstractSymbolGroupNodePtrVector
// QVector<T>
static inline AbstractSymbolGroupNodePtrVector
qVectorChildList(SymbolGroupNode *n, int count, const SymbolGroupValueContext &ctx)
qVectorChildList(SymbolGroupNode *n, unsigned count, const SymbolGroupValueContext &ctx)
{
if (!count)
return AbstractSymbolGroupNodePtrVector();
@@ -706,7 +707,7 @@ private:
// QList<>.
static inline AbstractSymbolGroupNodePtrVector
qListChildList(const SymbolGroupValue &v, int count)
qListChildList(const SymbolGroupValue &v, unsigned count)
{
// QList<T>: d/array is declared as array of void *[]. Dereference first
// element to obtain address.
@@ -750,9 +751,11 @@ static inline AbstractSymbolGroupNodePtrVector
bool isLargeOrStatic = innerTypeSize > pointerSize;
if (!isLargeOrStatic && !SymbolGroupValue::isPointerType(innerType)) {
const KnownType kt = knownType(innerType, false); // inner type, no 'class ' prefix.
if (kt != KT_Unknown && !(kt & (KT_POD_Type|KT_Qt_PrimitiveType|KT_Qt_MovableType)))
if (kt != KT_Unknown && !(kt & (KT_POD_Type|KT_Qt_PrimitiveType|KT_Qt_MovableType))
&& !(kt == KT_QStringList && QtInfo::get(v.context()).version >= 5)) {
isLargeOrStatic = true;
}
}
if (SymbolGroupValue::verbose)
DebugPrint() << "isLargeOrStatic " << isLargeOrStatic;
if (isLargeOrStatic) {
@@ -896,7 +899,7 @@ SymbolGroupValueVector qHashNodes(const SymbolGroupValue &v,
// QSet<>: Contains a 'QHash<key, QHashDummyValue>' as member 'q_hash'.
// Just dump the keys as an array.
static inline AbstractSymbolGroupNodePtrVector
qSetChildList(const SymbolGroupValue &v, int count)
qSetChildList(const SymbolGroupValue &v, unsigned count)
{
const SymbolGroupValue qHash = v["q_hash"];
AbstractSymbolGroupNodePtrVector rc;
@@ -906,7 +909,7 @@ static inline AbstractSymbolGroupNodePtrVector
if (nodes.size() != VectorIndexType(count))
return rc;
rc.reserve(count);
for (int i = 0; i < count; i++) {
for (unsigned i = 0; i < count; i++) {
if (const SymbolGroupValue key = nodes.at(i)["key"])
rc.push_back(ReferenceSymbolGroupNode::createArrayNode(i, key.node()));
else
@@ -917,7 +920,7 @@ static inline AbstractSymbolGroupNodePtrVector
// QHash<>: Add with fake map nodes.
static inline AbstractSymbolGroupNodePtrVector
qHashChildList(const SymbolGroupValue &v, int count)
qHashChildList(const SymbolGroupValue &v, unsigned count)
{
AbstractSymbolGroupNodePtrVector rc;
if (!count)
@@ -926,7 +929,7 @@ static inline AbstractSymbolGroupNodePtrVector
if (nodes.size() != count)
return rc;
rc.reserve(count);
for (int i = 0; i < count; i++) {
for (unsigned i = 0; i < count; i++) {
const SymbolGroupValue &mapNode = nodes.at(i);
const SymbolGroupValue key = mapNode["key"];
const SymbolGroupValue value = mapNode["value"];
@@ -1088,7 +1091,7 @@ static inline AbstractSymbolGroupNodePtrVector
/*! Determine children of containers \ingroup qtcreatorcdbext */
AbstractSymbolGroupNodePtrVector containerChildren(SymbolGroupNode *node, int type,
int size, const SymbolGroupValueContext &ctx)
unsigned size, const SymbolGroupValueContext &ctx)
{
if (SymbolGroupValue::verbose) {
DebugPrint dp;
@@ -1100,8 +1103,9 @@ AbstractSymbolGroupNodePtrVector containerChildren(SymbolGroupNode *node, int ty
}
if (!size)
return AbstractSymbolGroupNodePtrVector();
if (size > 100)
size = 100;
const unsigned maxArraySize = ExtensionContext::instance().parameters().maxArraySize;
if (size > maxArraySize)
size = maxArraySize;
switch (type) {
case KT_QVector:
return qVectorChildList(node, size, ctx);

View File

@@ -47,7 +47,7 @@ int containerSize(KnownType kt, SymbolGroupNode *n, const SymbolGroupValueContex
/* Create a list of children of containers. */
std::vector<AbstractSymbolGroupNode *> containerChildren(SymbolGroupNode *node,
int type,
int size,
unsigned size,
const SymbolGroupValueContext &ctx);
#endif // CONTAINERS_H

View File

@@ -50,7 +50,7 @@ const char *ExtensionContext::breakPointStopReasonC = "breakpoint";
\ingroup qtcreatorcdbext
*/
Parameters::Parameters() : maxStringLength(10000), maxStackDepth(1000)
Parameters::Parameters() : maxStringLength(10000), maxArraySize(100) ,maxStackDepth(1000)
{
}

View File

@@ -48,6 +48,7 @@ public:
Parameters();
unsigned maxStringLength;
unsigned maxArraySize;
unsigned maxStackDepth;
};

View File

@@ -174,7 +174,8 @@ static const CommandDescription commandDescriptions[] = {
{"widgetat","Return address of widget at position","<x> <y>"},
{"breakpoints","List breakpoints with modules","[-h] [-v]"},
{"test","Testing command","-T type | -w watch-expression"},
{"setparameter","Set parameter","maxStringLength=value maxStackDepth=value stateNotification=1,0"}
{"setparameter","Set parameter",
"maxStringLength=value maxArraySize=value maxStackDepth=value stateNotification=1,0"}
};
typedef std::vector<std::string> StringVector;
@@ -912,6 +913,9 @@ extern "C" HRESULT CALLBACK setparameter(CIDebugClient *, PCSTR args)
if (!token.compare(0, equalsPos, "maxStringLength")) {
if (integerFromString(value, &ExtensionContext::instance().parameters().maxStringLength))
++success;
} else if (!token.compare(0, equalsPos, "maxArraySize")) {
if (integerFromString(value, &ExtensionContext::instance().parameters().maxArraySize))
++success;
} else if (!token.compare(0, equalsPos, "maxStackDepth")) {
if (integerFromString(value, &ExtensionContext::instance().parameters().maxStackDepth))
++success;

View File

@@ -1793,7 +1793,7 @@ static bool dumpQStringFromQPrivateClass(const SymbolGroupValue &v,
v.node()->symbolGroup()->addSymbol(v.module(), symbolName, std::string(), &errorMessage);
if (!stringNode && errorMessage.find("DEBUG_ANY_ID") != std::string::npos) {
// HACK:
// In some rare cases the the AddSymbol can't create a node with a given module name,
// In some rare cases the AddSymbol can't create a node with a given module name,
// but is able to add the symbol without any modulename.
dumpType = QtInfo::get(v.context()).prependModuleAndNameSpace("QString", "", QtInfo::get(v.context()).nameSpace);
symbolName = SymbolGroupValue::pointedToSymbolName(stringAddress , dumpType);
@@ -2557,7 +2557,7 @@ static bool dumpQVariant(const SymbolGroupValue &v, std::wostream &str, void **s
if (const SymbolGroupValue sv = dataV.typeCast(qtInfo.prependQtCoreModule("QString *").c_str())) {
if (!dumpQString(sv, str)) {
// HACK:
// In some rare cases the the AddSymbol can't create a node with a given module name,
// In some rare cases the AddSymbol can't create a node with a given module name,
// but is able to add the symbol without any modulename.
if (const SymbolGroupValue svc = dataV.typeCast("QString *"))
dumpQString(svc, str);

View File

@@ -67,7 +67,6 @@ ConsoleProcess::ConsoleProcess(QObject *parent) :
qint64 ConsoleProcess::applicationMainThreadID() const
{
QTC_CHECK(false);
return -1;
}

View File

@@ -31,6 +31,7 @@
#include <QDir>
#include <QProcessEnvironment>
#include <QSet>
#include <QCoreApplication>
class SystemEnvironment : public Utils::Environment
@@ -262,7 +263,11 @@ QString Environment::searchInPath(const QString &executable,
if (fi.isAbsolute())
return exec;
QSet<QString> alreadyChecked;
foreach (const QString &dir, additionalDirs) {
if (alreadyChecked.contains(dir))
continue;
alreadyChecked.insert(dir);
QString tmp = searchInDirectory(execs, dir);
if (!tmp.isEmpty())
return tmp;
@@ -272,6 +277,9 @@ QString Environment::searchInPath(const QString &executable,
return QString();
foreach (const QString &p, path()) {
if (alreadyChecked.contains(p))
continue;
alreadyChecked.insert(p);
QString tmp = searchInDirectory(execs, QDir::fromNativeSeparators(p));
if (!tmp.isEmpty())
return tmp;

View File

@@ -514,7 +514,7 @@ QString FileName::toUserOutput() const
/// Find the parent directory of a given directory.
/// Returns an empty FileName if the current dirctory is already
/// Returns an empty FileName if the current directory is already
/// a root level directory.
/// \returns \a FileName with the last segment removed.

View File

@@ -89,7 +89,7 @@ QString JsonValue::kindToString(JsonValue::Kind kind)
if (kind == Null)
return QLatin1String("null");
return QLatin1String("unkown");
return QLatin1String("unknown");
}
JsonValue *JsonValue::build(const QVariant &variant, JsonMemoryPool *pool)

View File

@@ -67,7 +67,7 @@ private:
return category; \
}
# ifdef QT_VERSION > 0x050000
#if QT_VERSION > 0x050000
//
// Qt 5.0, 5.1 do have already support for categories in QMessageLogger
@@ -106,7 +106,7 @@ private:
#include <QLoggingCategory>
#ifdef QT_VERSION < 0x053000
#if QT_VERSION < 0x053000
// printf style for qCDebug was only added in Qt 5.3
@@ -125,5 +125,5 @@ private:
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical(__VA_ARGS__)
#endif // QT_VERSION < 0x053000
#endif // QT_VERSION < 0x052000
#endif // LOGGING_H

View File

@@ -291,7 +291,7 @@ void PathChooser::setBaseDirectory(const QString &directory)
if (d->m_baseDirectory == directory)
return;
d->m_baseDirectory = directory;
d->m_lineEdit->triggerChanged();
triggerChanged();
}
FileName PathChooser::baseFileName() const
@@ -302,14 +302,17 @@ FileName PathChooser::baseFileName() const
void PathChooser::setBaseFileName(const FileName &base)
{
d->m_baseDirectory = base.toString();
triggerChanged();
}
void PathChooser::setEnvironment(const Utils::Environment &env)
{
QString oldExpand = path();
d->m_environment = env;
if (path() != oldExpand)
if (path() != oldExpand) {
triggerChanged();
emit changed(rawPath());
}
}
QString PathChooser::path() const
@@ -434,7 +437,7 @@ void PathChooser::slotBrowse()
}
emit browsingFinished();
d->m_lineEdit->triggerChanged();
triggerChanged();
}
void PathChooser::slotTextChanged()

View File

@@ -680,7 +680,7 @@ void QtcProcess::start()
qWarning("QtcProcess::start: Empty environment set when running '%s'.", qPrintable(m_command));
env = m_environment;
// If the process environemnt has no libraryPath,
// If the process environment has no libraryPath,
// Qt will copy creator's libraryPath into the process environment.
// That's brain dead, and we work around it
if (osType != OsTypeWindows) { // a.k.a "Unixoid"

View File

@@ -98,8 +98,8 @@ void AnalyzerRunConfigWidget::chooseSettings(int setting)
m_configWidget->setEnabled(isCustom);
m_restoreButton->setEnabled(isCustom);
m_details->setSummaryText(isCustom
? tr("Use <strong>Customized Settings</strong>")
: tr("Use <strong>Global Settings</strong>"));
? tr("Use Customized Settings")
: tr("Use Global Settings"));
}
void AnalyzerRunConfigWidget::restoreGlobal()

View File

@@ -431,7 +431,12 @@ QVector<AndroidDeviceInfo> AndroidConfig::connectedDevices(QString *error) const
dev.type = serialNo.startsWith(QLatin1String("emulator")) ? AndroidDeviceInfo::Emulator : AndroidDeviceInfo::Hardware;
dev.sdk = getSDKVersion(dev.serialNumber);
dev.cpuAbi = getAbis(dev.serialNumber);
dev.unauthorized = (deviceType == QLatin1String("unauthorized"));
if (deviceType == QLatin1String("unauthorized"))
dev.state = AndroidDeviceInfo::UnAuthorizedState;
else if (deviceType == QLatin1String("offline"))
dev.state = AndroidDeviceInfo::OfflineState;
else
dev.state = AndroidDeviceInfo::OkState;
devices.push_back(dev);
}
@@ -575,7 +580,7 @@ QVector<AndroidDeviceInfo> AndroidConfig::androidVirtualDevices() const
// armeabi-v7a devices can also run armeabi code
if (dev.cpuAbi == QStringList(QLatin1String("armeabi-v7a")))
dev.cpuAbi << QLatin1String("armeabi");
dev.unauthorized = false;
dev.state = AndroidDeviceInfo::OkState;
dev.type = AndroidDeviceInfo::Emulator;
devices.push_back(dev);
}
@@ -1077,7 +1082,7 @@ QStringList AndroidDeviceInfo::adbSelector(const QString &serialNumber)
return QStringList() << QLatin1String("-s") << serialNumber;
}
AndroidConfig AndroidConfigurations::currentConfig()
const AndroidConfig &AndroidConfigurations::currentConfig()
{
return m_instance->m_config; // ensure that m_instance is initialized
}

View File

@@ -56,6 +56,8 @@ struct AndroidDeviceInfo
QString serialNumber;
QStringList cpuAbi;
int sdk;
enum State { OkState, UnAuthorizedState, OfflineState };
State state;
bool unauthorized;
enum AndroidDeviceType { Hardware, Emulator };
AndroidDeviceType type;
@@ -173,7 +175,7 @@ class AndroidConfigurations : public QObject
Q_OBJECT
public:
static AndroidConfig currentConfig();
static const AndroidConfig &currentConfig();
static void setConfig(const AndroidConfig &config);
static AndroidConfigurations *instance();

View File

@@ -243,7 +243,7 @@ bool AndroidDeployQtStep::init()
QString inputFile = node->singleVariableValue(QmakeProjectManager::AndroidDeploySettingsFile);
if (inputFile.isEmpty()) { // should never happen
emit addOutput(tr("Internal Error: Unknown android deployment json file location"), BuildStep::ErrorMessageOutput);
emit addOutput(tr("Internal Error: Unknown Android deployment JSON file location."), BuildStep::ErrorMessageOutput);
return false;
}

View File

@@ -331,9 +331,12 @@ void AndroidDeviceModel::setDevices(const QVector<AndroidDeviceInfo> &devices)
AndroidDeviceModelNode *incompatibleDevices = 0; // created on demand
foreach (const AndroidDeviceInfo &device, devices) {
QString error;
if (device.unauthorized) {
if (device.state == AndroidDeviceInfo::UnAuthorizedState) {
error = AndroidDeviceDialog::tr("Unauthorized. Please check the confirmation dialog on your device %1.")
.arg(device.serialNumber);
}else if (device.state == AndroidDeviceInfo::OfflineState) {
error = AndroidDeviceDialog::tr("Offline. Please check the state of your device %1.")
.arg(device.serialNumber);
} else if (!device.cpuAbi.contains(m_abi)) {
error = AndroidDeviceDialog::tr("ABI is incompatible, device supports ABIs: %1.")
.arg(device.cpuAbi.join(QLatin1String(" ")));

View File

@@ -499,7 +499,7 @@ bool AndroidManifestEditorWidget::open(QString *errorString, const QString &file
return true;
}
}
// some error occured
// some error occurred
updateInfoBar(error, errorLine, errorColumn);
setActivePage(Source);
return true;

View File

@@ -163,7 +163,7 @@ void AndroidRunner::checkPID()
emit remoteProcessFinished(QLatin1String("\n\n") + tr("\"%1\" died.").arg(m_packageName));
} else {
if (++m_tries > 3)
emit remoteProcessFinished(QLatin1String("\n\n") + tr("Unable to start \"%1\"").arg(m_packageName));
emit remoteProcessFinished(QLatin1String("\n\n") + tr("Unable to start \"%1\".").arg(m_packageName));
}
} else if (!m_wasStarted){
if (m_useCppDebugger) {

View File

@@ -155,21 +155,11 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
{
if (mode & Sdk) {
m_sdkState = Okay;
if (m_androidConfig.sdkLocation().isEmpty()) {
if (m_androidConfig.sdkLocation().isEmpty())
m_sdkState = NotSet;
} else {
Utils::FileName adb = m_androidConfig.sdkLocation();
Utils::FileName androidExe = m_androidConfig.sdkLocation();
Utils::FileName androidBat = m_androidConfig.sdkLocation();
Utils::FileName emulator = m_androidConfig.sdkLocation();
if (!adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
|| (!androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
&& !androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
|| !emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()) {
else if (!(sdkLocationIsValid() && sdkPlatformToolsInstalled()))
m_sdkState = Error;
}
}
}
if (mode & Ndk) {
m_ndkState = Okay;
@@ -241,6 +231,9 @@ void AndroidSettingsWidget::applyToUi(AndroidSettingsWidget::Mode mode)
m_ui->sdkWarningIconLabel->setVisible(true);
m_ui->sdkWarningLabel->setVisible(true);
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->SDKLocationLineEdit->text());
if (sdkLocationIsValid())
m_ui->sdkWarningLabel->setText(tr("The Platform tools are missing. Please use the Android SDK Manager to install them."));
else
m_ui->sdkWarningLabel->setText(tr("\"%1\" does not seem to be an Android SDK top folder.").arg(location.toUserOutput()));
} else {
m_ui->sdkWarningIconLabel->setVisible(false);
@@ -300,6 +293,22 @@ void AndroidSettingsWidget::applyToUi(AndroidSettingsWidget::Mode mode)
}
}
bool AndroidSettingsWidget::sdkLocationIsValid() const
{
Utils::FileName androidExe = m_androidConfig.sdkLocation();
Utils::FileName androidBat = m_androidConfig.sdkLocation();
Utils::FileName emulator = m_androidConfig.sdkLocation();
return (androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
|| androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
&& emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists();
}
bool AndroidSettingsWidget::sdkPlatformToolsInstalled() const
{
Utils::FileName adb = m_androidConfig.sdkLocation();
return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists();
}
void AndroidSettingsWidget::saveSettings()
{
sdkLocationEditingFinished();
@@ -405,19 +414,19 @@ void AndroidSettingsWidget::browseNDKLocation()
void AndroidSettingsWidget::browseAntLocation()
{
QString dir;
QString antApp;
QString filter;
if (Utils::HostOsInfo::isWindowsHost()) {
dir = QDir::homePath();
antApp = QLatin1String("ant.bat");
dir = QDir::homePath() + QLatin1String("/ant.bat");
filter = QLatin1String("ant (ant.bat)");
} else {
dir = QLatin1String("/usr/bin/ant");
antApp = QLatin1String("ant");
filter = QLatin1String("ant (ant)");
}
const QString file =
QFileDialog::getOpenFileName(this, tr("Select ant Script"), dir, antApp);
QFileDialog::getOpenFileName(this, tr("Select ant Script"), dir, filter);
if (!file.length())
return;
m_ui->AntLocationLineEdit->setText(file);
m_ui->AntLocationLineEdit->setText(QDir::toNativeSeparators(file));
antLocationEditingFinished();
}

View File

@@ -98,6 +98,8 @@ private:
enum State { NotSet = 0, Okay = 1, Error = 2 };
void check(Mode mode);
void applyToUi(Mode mode);
bool sdkLocationIsValid() const;
bool sdkPlatformToolsInstalled() const;
State m_sdkState;
State m_ndkState;

View File

@@ -111,7 +111,7 @@ public:
bool hasError() const;
/**
* @return True, if the the has been cancelled by MakefileParserThread::cancel().
* @return True, if the parsing has been cancelled by MakefileParserThread::cancel().
*/
bool isCanceled() const;

View File

@@ -70,9 +70,9 @@ ArtisticStyle::~ArtisticStyle()
bool ArtisticStyle::initialize()
{
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::ArtisticStyle::MENU_ID);
menu->menu()->setTitle(QLatin1String("Artistic Style"));
menu->menu()->setTitle(QLatin1String(Constants::ArtisticStyle::DISPLAY_NAME));
m_formatFile = new QAction(tr("Format Current File"), this);
m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this);
Core::Command *cmd
= Core::ActionManager::registerAction(m_formatFile,
Constants::ArtisticStyle::ACTION_FORMATFILE,
@@ -132,7 +132,8 @@ void ArtisticStyle::formatFile()
cfgFileName = m_settings->styleFileName(m_settings->customStyle());
if (cfgFileName.isEmpty()) {
BeautifierPlugin::showError(tr("Cannot get configuration file for Artistic Style."));
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(
QLatin1String(Constants::ArtisticStyle::DISPLAY_NAME)));
} else {
BeautifierPlugin::formatCurrentFile(QStringList()
<< m_settings->command()

View File

@@ -34,6 +34,7 @@ namespace Beautifier {
namespace Constants {
namespace ArtisticStyle {
const char DISPLAY_NAME[] = "Artistic Style";
const char ACTION_FORMATFILE[] = "ArtisticStyle.FormatFile";
const char MENU_ID[] = "ArtisticStyle.Menu";
const char OPTION_ID[] = "ArtisticStyle";

View File

@@ -34,6 +34,7 @@
#include "artisticstylesettings.h"
#include "../beautifierconstants.h"
#include "../beautifierplugin.h"
#include <coreplugin/icore.h>
@@ -51,7 +52,8 @@ ArtisticStyleOptionsPageWidget::ArtisticStyleOptionsPageWidget(ArtisticStyleSett
{
ui->setupUi(this);
ui->command->setExpectedKind(Utils::PathChooser::ExistingCommand);
ui->command->setPromptDialogTitle(tr("Artistic Style Command"));
ui->command->setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle(
QLatin1String(Constants::ArtisticStyle::DISPLAY_NAME)));
connect(ui->command, SIGNAL(validChanged(bool)), ui->options, SLOT(setEnabled(bool)));
ui->configurations->setSettings(m_settings);
}

View File

@@ -288,7 +288,30 @@ void BeautifierPlugin::formatCurrentFile(QStringList command)
void BeautifierPlugin::showError(const QString &error)
{
Core::MessageManager::write(tr("ERROR in Beautifier: %1").arg(error.trimmed()));
Core::MessageManager::write(tr("Error in Beautifier: %1").arg(error.trimmed()));
}
QString BeautifierPlugin::msgCannotGetConfigurationFile(const QString &command)
{
return tr("Cannot get configuration file for %1.").arg(command);
}
QString BeautifierPlugin::msgFormatCurrentFile()
{
//: Menu entry
return tr("Format Current File");
}
QString BeautifierPlugin::msgFormatSelectedText()
{
//: Menu entry
return tr("Format Selected Text");
}
QString BeautifierPlugin::msgCommandPromptDialogTitle(const QString &command)
{
//: File dialog title for path chooser when choosing binary
return tr("%1 Command").arg(command);
}
} // namespace Internal

View File

@@ -56,6 +56,11 @@ public:
static void formatCurrentFile(QStringList command);
static void showError(const QString &error);
static QString msgCannotGetConfigurationFile(const QString &command);
static QString msgFormatCurrentFile();
static QString msgFormatSelectedText();
static QString msgCommandPromptDialogTitle(const QString &command);
private slots:
void updateActions(Core::IEditor *editor = 0);

View File

@@ -70,7 +70,7 @@ bool ClangFormat::initialize()
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::ClangFormat::MENU_ID);
menu->menu()->setTitle(QLatin1String("ClangFormat"));
m_formatFile = new QAction(tr("Format Current File"), this);
m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this);
Core::Command *cmd
= Core::ActionManager::registerAction(m_formatFile,
Constants::ClangFormat::ACTION_FORMATFILE,
@@ -78,7 +78,7 @@ bool ClangFormat::initialize()
menu->addAction(cmd);
connect(m_formatFile, SIGNAL(triggered()), this, SLOT(formatFile()));
m_formatRange = new QAction(tr("Format Selected Text"), this);
m_formatRange = new QAction(BeautifierPlugin::msgFormatSelectedText(), this);
cmd = Core::ActionManager::registerAction(m_formatRange,
Constants::ClangFormat::ACTION_FORMATSELECTED,
Core::Context(Core::Constants::C_GLOBAL));

View File

@@ -34,6 +34,7 @@
#include "clangformatsettings.h"
#include "../beautifierconstants.h"
#include "../beautifierplugin.h"
#include <coreplugin/icore.h>
@@ -53,7 +54,8 @@ ClangFormatOptionsPageWidget::ClangFormatOptionsPageWidget(ClangFormatSettings *
ui->options->setEnabled(false);
ui->predefinedStyle->addItems(m_settings->predefinedStyles());
ui->command->setExpectedKind(Utils::PathChooser::ExistingCommand);
ui->command->setPromptDialogTitle(tr("Clang Format Command"));
ui->command->setPromptDialogTitle(
BeautifierPlugin::msgCommandPromptDialogTitle(QLatin1String("Clang Format")));
connect(ui->command, SIGNAL(validChanged(bool)), ui->options, SLOT(setEnabled(bool)));
ui->configurations->setSettings(m_settings);
}

View File

@@ -70,9 +70,9 @@ Uncrustify::~Uncrustify()
bool Uncrustify::initialize()
{
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::Uncrustify::MENU_ID);
menu->menu()->setTitle(QLatin1String("Uncrustify"));
menu->menu()->setTitle(QLatin1String(Constants::Uncrustify::DISPLAY_NAME));
m_formatFile = new QAction(tr("Format Current File"), this);
m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this);
Core::Command *cmd
= Core::ActionManager::registerAction(m_formatFile,
Constants::Uncrustify::ACTION_FORMATFILE,
@@ -127,7 +127,8 @@ void Uncrustify::formatFile()
cfgFileName = m_settings->styleFileName(m_settings->customStyle());
if (cfgFileName.isEmpty()) {
BeautifierPlugin::showError(tr("Cannot get configuration file for uncrustify."));
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(
QLatin1String(Constants::Uncrustify::DISPLAY_NAME)));
} else {
BeautifierPlugin::formatCurrentFile(QStringList()
<< m_settings->command()

View File

@@ -34,6 +34,7 @@ namespace Beautifier {
namespace Constants {
namespace Uncrustify {
const char DISPLAY_NAME[] = "Uncrustify";
const char ACTION_FORMATFILE[] = "Uncrustify.FormatFile";
const char MENU_ID[] = "Uncrustify.Menu";
const char OPTION_ID[] = "Uncrustify";

View File

@@ -34,6 +34,7 @@
#include "uncrustifysettings.h"
#include "../beautifierconstants.h"
#include "../beautifierplugin.h"
#include <coreplugin/icore.h>
@@ -51,7 +52,8 @@ UncrustifyOptionsPageWidget::UncrustifyOptionsPageWidget(UncrustifySettings *set
{
ui->setupUi(this);
ui->command->setExpectedKind(Utils::PathChooser::ExistingCommand);
ui->command->setPromptDialogTitle(tr("Uncrustify Command"));
ui->command->setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle(
QLatin1String(Constants::Uncrustify::DISPLAY_NAME)));
connect(ui->command, SIGNAL(validChanged(bool)), ui->options, SLOT(setEnabled(bool)));
ui->configurations->setSettings(m_settings);
}

View File

@@ -34,6 +34,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
#include <QFile>
@@ -153,14 +154,35 @@ void PchManager::updatePchInfo(ClangProjectSettings *cps,
const QList<ProjectPart::Ptr> &projectParts)
{
if (m_pchGenerationWatcher.isRunning()) {
// m_pchGenerationWatcher.cancel();
m_pchGenerationWatcher.waitForFinished();
}
QFuture<void> future = QtConcurrent::run(&PchManager::doPchInfoUpdate,
cps->pchUsage(),
cps->customPchFile(),
projectParts);
const QString customPchFile = cps->customPchFile();
const ClangProjectSettings::PchUsage pchUsage = cps->pchUsage();
void (*updateFunction)(QFutureInterface<void> &future,
const PchManager::UpdateParams params) = 0;
QString message;
if (pchUsage == ClangProjectSettings::PchUse_None
|| (pchUsage == ClangProjectSettings::PchUse_Custom && customPchFile.isEmpty())) {
updateFunction = &PchManager::doPchInfoUpdateNone;
message = QLatin1String("updatePchInfo: switching to none");
} else if (pchUsage == ClangProjectSettings::PchUse_BuildSystem_Fuzzy) {
updateFunction = &PchManager::doPchInfoUpdateFuzzy;
message = QLatin1String("updatePchInfo: switching to build system (fuzzy)");
} else if (pchUsage == ClangProjectSettings::PchUse_BuildSystem_Exact) {
updateFunction = &PchManager::doPchInfoUpdateExact;
message = QLatin1String("updatePchInfo: switching to build system (exact)");
} else if (pchUsage == ClangProjectSettings::PchUse_Custom) {
updateFunction = &PchManager::doPchInfoUpdateCustom;
message = QLatin1String("updatePchInfo: switching to custom") + customPchFile;
}
QTC_ASSERT(updateFunction && !message.isEmpty(), return);
Core::MessageManager::write(message, Core::MessageManager::Silent);
QFuture<void> future = QtConcurrent::run(updateFunction,
UpdateParams(customPchFile, projectParts));
m_pchGenerationWatcher.setFuture(future);
Core::ProgressManager::addTask(future, tr("Precompiling..."), "Key.Tmp.Precompiling");
}
@@ -214,27 +236,19 @@ CppTools::ProjectFile::Kind getPrefixFileKind(bool hasObjectiveC, bool hasCPlusP
}
void PchManager::doPchInfoUpdate(QFutureInterface<void> &future,
ClangProjectSettings::PchUsage pchUsage,
const QString customPchFile,
const QList<ProjectPart::Ptr> projectParts)
void PchManager::doPchInfoUpdateNone(QFutureInterface<void> &future,
const PchManager::UpdateParams params)
{
PchManager *pchManager = PchManager::instance();
// qDebug() << "switching to" << pchUsage;
if (pchUsage == ClangProjectSettings::PchUse_None
|| (pchUsage == ClangProjectSettings::PchUse_Custom && customPchFile.isEmpty())) {
future.setProgressRange(0, 2);
Core::MessageManager::write(QLatin1String("updatePchInfo: switching to none"),
Core::MessageManager::Silent);
future.setProgressRange(0, 1);
PchInfo::Ptr emptyPch = PchInfo::createEmpty();
pchManager->setPCHInfo(projectParts, emptyPch, qMakePair(true, QStringList()));
PchManager::instance()->setPCHInfo(params.projectParts, emptyPch,
qMakePair(true, QStringList()));
future.setProgressValue(1);
} else if (pchUsage == ClangProjectSettings::PchUse_BuildSystem_Fuzzy) {
Core::MessageManager::write(
QLatin1String("updatePchInfo: switching to build system (fuzzy)"),
Core::MessageManager::Silent);
}
void PchManager::doPchInfoUpdateFuzzy(QFutureInterface<void> &future,
const PchManager::UpdateParams params)
{
QHash<QString, QSet<QString> > includes, frameworks;
QHash<QString, QSet<QByteArray> > definesPerPCH;
QHash<QString, bool> objc;
@@ -244,7 +258,7 @@ void PchManager::doPchInfoUpdate(QFutureInterface<void> &future,
QHash<QString, ProjectPart::CXXVersion> cxxVersions;
QHash<QString, ProjectPart::CXXExtensions> cxxExtensionsMap;
QHash<QString, QList<ProjectPart::Ptr> > inputToParts;
foreach (const ProjectPart::Ptr &projectPart, projectParts) {
foreach (const ProjectPart::Ptr &projectPart, params.projectParts) {
if (projectPart->precompiledHeaders.isEmpty())
continue;
const QString &pch = projectPart->precompiledHeaders.first(); // TODO: support more than 1 PCH file.
@@ -310,6 +324,7 @@ void PchManager::doPchInfoUpdate(QFutureInterface<void> &future,
QStringList options = Utils::createClangOptions(projectPart, prefixFileKind);
projectPart.reset();
PchManager *pchManager = PchManager::instance();
PchInfo::Ptr pchInfo = pchManager->findMatchingPCH(pch, options, true);
QPair<bool, QStringList> msgs = qMakePair(true, QStringList());
if (pchInfo.isNull()) {
@@ -320,13 +335,16 @@ void PchManager::doPchInfoUpdate(QFutureInterface<void> &future,
pchManager->setPCHInfo(inputToParts[pch], pchInfo, msgs);
future.setProgressValue(future.progressValue() + 1);
}
} else if (pchUsage == ClangProjectSettings::PchUse_BuildSystem_Exact) {
future.setProgressRange(0, projectParts.size() + 1);
future.setProgressValue(future.progressValue() + 1);
}
void PchManager::doPchInfoUpdateExact(QFutureInterface<void> &future,
const PchManager::UpdateParams params)
{
future.setProgressRange(0, params.projectParts.size() + 1);
future.setProgressValue(0);
Core::MessageManager::write(
QLatin1String("updatePchInfo: switching to build system (exact)"),
Core::MessageManager::Silent);
foreach (const ProjectPart::Ptr &projectPart, projectParts) {
foreach (const ProjectPart::Ptr &projectPart, params.projectParts) {
if (future.isCanceled())
return;
if (projectPart->precompiledHeaders.isEmpty())
@@ -339,6 +357,7 @@ void PchManager::doPchInfoUpdate(QFutureInterface<void> &future,
QStringList options = Utils::createClangOptions(
projectPart, getPrefixFileKind(hasObjC, hasCppFiles(projectPart)));
PchManager *pchManager = PchManager::instance();
PchInfo::Ptr pchInfo = pchManager->findMatchingPCH(pch, options, false);
QPair<bool, QStringList> msgs = qMakePair(true, QStringList());
if (pchInfo.isNull()) {
@@ -349,19 +368,22 @@ void PchManager::doPchInfoUpdate(QFutureInterface<void> &future,
pchInfo, msgs);
future.setProgressValue(future.progressValue() + 1);
}
} else if (pchUsage == ClangProjectSettings::PchUse_Custom) {
future.setProgressRange(0, 2);
future.setProgressValue(future.progressValue() + 1);
}
void PchManager::doPchInfoUpdateCustom(QFutureInterface<void> &future,
const PchManager::UpdateParams params)
{
future.setProgressRange(0, 1);
future.setProgressValue(0);
Core::MessageManager::write(
QLatin1String("updatePchInfo: switching to custom") + customPchFile,
Core::MessageManager::Silent);
QSet<QString> includes, frameworks;
bool objc = false;
bool cplusplus = false;
ProjectPart::Ptr united(new ProjectPart());
united->cxxVersion = ProjectPart::CXX98;
foreach (const ProjectPart::Ptr &projectPart, projectParts) {
foreach (const ProjectPart::Ptr &projectPart, params.projectParts) {
includes.unite(QSet<QString>::fromList(projectPart->includePaths));
frameworks.unite(QSet<QString>::fromList(projectPart->frameworkPaths));
united->cVersion = std::max(united->cVersion, projectPart->cVersion);
@@ -376,19 +398,17 @@ void PchManager::doPchInfoUpdate(QFutureInterface<void> &future,
united, getPrefixFileKind(objc, cplusplus));
united.clear();
PchInfo::Ptr pchInfo = pchManager->findMatchingPCH(customPchFile, opts, true);
PchManager *pchManager = PchManager::instance();
PchInfo::Ptr pchInfo = pchManager->findMatchingPCH(params.customPchFile, opts, true);
QPair<bool, QStringList> msgs = qMakePair(true, QStringList());;
if (future.isCanceled())
return;
if (pchInfo.isNull()) {
pchInfo = PchInfo::createWithFileName(customPchFile, opts, objc);
pchInfo = PchInfo::createWithFileName(params.customPchFile, opts, objc);
msgs = precompile(pchInfo);
}
pchManager->setPCHInfo(projectParts, pchInfo, msgs);
pchManager->setPCHInfo(params.projectParts, pchInfo, msgs);
future.setProgressValue(1);
}
future.setProgressValue(future.progressValue() + 1);
}
PchInfo::Ptr PchManager::findMatchingPCH(const QString &inputFileName,

View File

@@ -75,12 +75,21 @@ private slots:
void updateActivePchFiles();
private:
struct UpdateParams {
UpdateParams(const QString &customPchFile, const QList<ProjectPart::Ptr> &projectParts)
: customPchFile(customPchFile) , projectParts(projectParts) {}
const QString customPchFile;
const QList<ProjectPart::Ptr> projectParts;
};
void updatePchInfo(ClangProjectSettings *cps,
const QList<ProjectPart::Ptr> &projectParts);
static void doPchInfoUpdate(QFutureInterface<void> &future,
ClangProjectSettings::PchUsage pchUsage,
const QString customPchFile,
const QList<ProjectPart::Ptr> projectParts);
static void doPchInfoUpdateNone(QFutureInterface<void> &future, const UpdateParams params);
static void doPchInfoUpdateFuzzy(QFutureInterface<void> &future, const UpdateParams params);
static void doPchInfoUpdateExact(QFutureInterface<void> &future, const UpdateParams params);
static void doPchInfoUpdateCustom(QFutureInterface<void> &future, const UpdateParams params);
void setPCHInfo(const QList<ProjectPart::Ptr> &projectParts,
const PchInfo::Ptr &pchInfo,
const QPair<bool, QStringList> &msgs);

View File

@@ -1121,7 +1121,7 @@ void ClearCasePlugin::diffActivity()
// latest version - updated each line
filever[file].second = shortver;
// pre-first version. only for the first occurence
// pre-first version. only for the first occurrence
if (filever[file].first.isEmpty()) {
int verpos = shortver.lastIndexOf(QRegExp(QLatin1String("[^0-9]"))) + 1;
int vernum = shortver.mid(verpos).toInt();
@@ -1517,7 +1517,9 @@ IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const QString
qDebug() << "ClearCasePlugin::showOutputInEditor" << title << id.name()
<< "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
QString s = title;
IEditor *editor = EditorManager::openEditorWithContents(id, &s, output.toUtf8());
IEditor *editor = EditorManager::openEditorWithContents(id, &s, output.toUtf8(),
(EditorManager::OpenInOtherSplit
| EditorManager::NoNewSplits));
connect(editor, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
this, SLOT(annotateVersion(QString,QString,QString,int)));
ClearCaseEditor *e = qobject_cast<ClearCaseEditor*>(editor->widget());
@@ -1530,7 +1532,6 @@ IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const QString
e->setSource(source);
if (codec)
e->setCodec(codec);
EditorManager::activateEditor(editor);
return editor;
}

View File

@@ -736,7 +736,7 @@ void CMakeRunPage::runCMake()
m_cmakeWizard->setKit(generatorInfo.kit());
m_cmakeWizard->setUseNinja(generatorInfo.isNinja());
// If mode is initial the user chooses the kit, otherwise it's already choosen
// If mode is initial the user chooses the kit, otherwise it's already chosen
// and the environment already contains the kit
if (m_mode == Initial)
generatorInfo.kit()->addToEnvironment(env);

View File

@@ -98,7 +98,7 @@ public:
item->setText(0, CommandMappings::tr("Command"));
defaultButton = new QPushButton(CommandMappings::tr("Reset All"), groupBox);
defaultButton->setToolTip(CommandMappings::tr("Reset all to default"));
defaultButton->setToolTip(CommandMappings::tr("Reset all to default."));
importButton = new QPushButton(CommandMappings::tr("Import..."), groupBox);
exportButton = new QPushButton(CommandMappings::tr("Export..."), groupBox);
@@ -112,7 +112,7 @@ public:
targetEdit->setFiltering(true);
resetButton = new QPushButton(targetEditGroup);
resetButton->setToolTip(CommandMappings::tr("Reset to default"));
resetButton->setToolTip(CommandMappings::tr("Reset to default."));
resetButton->setText(CommandMappings::tr("Reset"));
QLabel *infoLabel = new QLabel(targetEditGroup);

View File

@@ -1492,8 +1492,13 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId,
OpenEditorFlags flags, bool *newEditor)
{
if (flags & EditorManager::OpenInOtherSplit)
if (flags & EditorManager::OpenInOtherSplit) {
if (flags & EditorManager::NoNewSplits)
m_instance->gotoNextSplit();
else
m_instance->gotoOtherSplit();
}
return m_instance->openEditor(m_instance->currentEditorView(),
fileName, editorId, flags, newEditor);
}
@@ -1659,11 +1664,19 @@ QStringList EditorManager::getOpenFileNames()
IEditor *EditorManager::openEditorWithContents(const Id &editorId,
QString *titlePattern,
const QByteArray &contents)
const QByteArray &contents,
OpenEditorFlags flags)
{
if (debugEditorManager)
qDebug() << Q_FUNC_INFO << editorId.name() << titlePattern << contents;
if (flags & EditorManager::OpenInOtherSplit) {
if (flags & EditorManager::NoNewSplits)
m_instance->gotoNextSplit();
else
m_instance->gotoOtherSplit();
}
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString title;
@@ -1714,6 +1727,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId,
m_instance->addEditor(edt);
QApplication::restoreOverrideCursor();
activateEditor(edt, flags);
return edt;
}
@@ -1785,9 +1799,6 @@ void EditorManager::autoSave()
if (!errors.isEmpty())
QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
errors.join(QLatin1String("\n")));
// Also save settings while accessing the disk anyway:
ICore::saveSettings();
}
MakeWritableResult EditorManager::makeFileWritable(IDocument *document)

View File

@@ -98,22 +98,25 @@ public:
static EditorToolBar *createToolBar(QWidget *parent = 0);
enum OpenEditorFlag {
NoFlags = 0,
DoNotChangeCurrentEditor = 1,
IgnoreNavigationHistory = 2,
DoNotMakeVisible = 4,
CanContainLineNumber = 8,
OpenInOtherSplit = 16
OpenInOtherSplit = 16,
NoNewSplits = 32
};
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)
static QString splitLineNumber(QString *fileName);
static IEditor *openEditor(const QString &fileName, const Id &editorId = Id(),
OpenEditorFlags flags = 0, bool *newEditor = 0);
OpenEditorFlags flags = NoFlags, bool *newEditor = 0);
static IEditor *openEditorAt(const QString &fileName, int line, int column = 0,
const Id &editorId = Id(), OpenEditorFlags flags = 0,
const Id &editorId = Id(), OpenEditorFlags flags = NoFlags,
bool *newEditor = 0);
static IEditor *openEditorWithContents(const Id &editorId,
QString *titlePattern = 0, const QByteArray &contents = QByteArray());
static IEditor *openEditorWithContents(const Id &editorId, QString *titlePattern = 0,
const QByteArray &contents = QByteArray(),
OpenEditorFlags flags = NoFlags);
static bool openExternalEditor(const QString &fileName, const Id &editorId);
@@ -259,11 +262,12 @@ private:
static IEditor *placeEditor(Internal::EditorView *view, IEditor *editor);
static IEditor *duplicateEditor(IEditor *editor);
static IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = 0);
static void activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry, OpenEditorFlags flags = 0);
static IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = NoFlags);
static void activateEditorForEntry(Internal::EditorView *view, DocumentModel::Entry *entry,
OpenEditorFlags flags = NoFlags);
static void activateView(Internal::EditorView *view);
static IEditor *openEditor(Internal::EditorView *view, const QString &fileName,
const Id &id = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0);
const Id &id = Id(), OpenEditorFlags flags = NoFlags, bool *newEditor = 0);
static int visibleDocumentsCount();
static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);

View File

@@ -146,7 +146,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
m_cancelButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
m_searchAgainButton = new QToolButton(topWidget);
m_searchAgainButton->setToolTip(tr("Repeat the search with same parameters"));
m_searchAgainButton->setToolTip(tr("Repeat the search with same parameters."));
m_searchAgainButton->setText(tr("Search again"));
m_searchAgainButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
m_searchAgainButton->setVisible(false);
@@ -158,7 +158,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
m_replaceTextEdit->setEnabled(false);
m_replaceTextEdit->setTabOrder(m_replaceTextEdit, m_searchResultTreeView);
m_replaceButton = new QToolButton(topWidget);
m_replaceButton->setToolTip(tr("Replace all occurrences"));
m_replaceButton->setToolTip(tr("Replace all occurrences."));
m_replaceButton->setText(tr("Replace"));
m_replaceButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
m_replaceButton->setEnabled(false);

View File

@@ -298,6 +298,7 @@
#include <QStatusBar>
using namespace Core::Internal;
using namespace ExtensionSystem;
namespace Core {
@@ -316,7 +317,7 @@ ICore::ICore(MainWindow *mainwindow)
m_mainwindow = mainwindow;
// Save settings once after all plugins are initialized:
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()),
this, SIGNAL(saveSettingsRequested()));
this, SLOT(saveSettings()));
}
ICore::~ICore()
@@ -356,7 +357,10 @@ bool ICore::showWarningWithOptions(const QString &title, const QString &text,
QSettings *ICore::settings(QSettings::Scope scope)
{
return m_mainwindow->settings(scope);
if (scope == QSettings::UserScope)
return PluginManager::settings();
else
return PluginManager::globalSettings();
}
SettingsDatabase *ICore::settingsDatabase()

View File

@@ -118,6 +118,7 @@ public:
static void emitNewItemsDialogRequested();
public slots:
static void saveSettings();
signals:

View File

@@ -33,6 +33,7 @@
#include <utils/qtcassert.h>
#include <QFileInfo>
#include <QStringList>
/*!
\class Core::IVersionControl::TopicCache
@@ -76,6 +77,11 @@ QString IVersionControl::vcsMakeWritableText() const
return QString();
}
QStringList IVersionControl::additionalToolsPath() const
{
return QStringList();
}
QString IVersionControl::vcsTopic(const QString &topLevel)
{
return m_topicCache ? m_topicCache->topic(topLevel) : QString();

View File

@@ -198,6 +198,12 @@ public:
*/
virtual QString vcsMakeWritableText() const;
/*!
* Return a list of paths where tools that came with the VCS may be installed.
* This is helpful on windows where e.g. git comes with a lot of nice unix tools.
*/
virtual QStringList additionalToolsPath() const;
signals:
void repositoryChanged(const QString &repository);
void filesChanged(const QStringList &files);

View File

@@ -158,18 +158,18 @@ void ExecuteFilter::runHeadCommand()
const ExecuteData &d = m_taskQueue.head();
const QString fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable);
if (fullPath.isEmpty()) {
MessageManager::write(tr("Could not find executable for '%1'").arg(d.executable));
MessageManager::write(tr("Could not find executable for '%1'.").arg(d.executable));
m_taskQueue.dequeue();
runHeadCommand();
return;
}
MessageManager::write(tr("Starting command '%1'").arg(headCommand()));
MessageManager::write(tr("Starting command '%1'.").arg(headCommand()));
m_process->setWorkingDirectory(d.workingDirectory);
m_process->setCommand(fullPath, d.arguments);
m_process->start();
m_process->closeWriteChannel();
if (!m_process->waitForStarted(1000)) {
MessageManager::write(tr("Could not start process: %1").arg(m_process->errorString()));
MessageManager::write(tr("Could not start process: %1.").arg(m_process->errorString()));
m_taskQueue.dequeue();
runHeadCommand();
}

View File

@@ -99,8 +99,10 @@
#include <QPushButton>
#include <QStyleFactory>
using namespace Core;
using namespace Core::Internal;
using namespace ExtensionSystem;
namespace Core {
namespace Internal {
enum { debugMainWindow = 0 };
@@ -108,9 +110,7 @@ MainWindow::MainWindow() :
Utils::AppMainWindow(),
m_coreImpl(new ICore(this)),
m_additionalContexts(Constants::C_GLOBAL),
m_settings(ExtensionSystem::PluginManager::settings()),
m_globalSettings(ExtensionSystem::PluginManager::globalSettings()),
m_settingsDatabase(new SettingsDatabase(QFileInfo(m_settings->fileName()).path(),
m_settingsDatabase(new SettingsDatabase(QFileInfo(PluginManager::settings()->fileName()).path(),
QLatin1String("QtCreator"),
this)),
m_printer(0),
@@ -151,7 +151,7 @@ MainWindow::MainWindow() :
(void) new DocumentManager(this);
OutputPaneManager::create();
Utils::HistoryCompleter::setSettings(m_settings);
Utils::HistoryCompleter::setSettings(PluginManager::settings());
setWindowTitle(tr("Qt Creator"));
if (!Utils::HostOsInfo::isMacHost())
@@ -269,8 +269,6 @@ MainWindow::~MainWindow()
m_mimeTypeSettings = 0;
delete m_systemEditor;
m_systemEditor = 0;
delete m_settings;
m_settings = 0;
delete m_printer;
m_printer = 0;
delete m_vcsManager;
@@ -955,14 +953,6 @@ void MainWindow::openFileWith()
}
}
QSettings *MainWindow::settings(QSettings::Scope scope) const
{
if (scope == QSettings::UserScope)
return m_settings;
else
return m_globalSettings;
}
IContext *MainWindow::contextObject(QWidget *widget)
{
return m_contextWidgets.value(widget);
@@ -1068,7 +1058,8 @@ static const char modeSelectorVisibleKey[] = "ModeSelectorVisible";
void MainWindow::readSettings()
{
m_settings->beginGroup(QLatin1String(settingsGroup));
QSettings *settings = PluginManager::settings();
settings->beginGroup(QLatin1String(settingsGroup));
if (m_overrideColor.isValid()) {
Utils::StyleHelper::setBaseColor(m_overrideColor);
@@ -1076,38 +1067,39 @@ void MainWindow::readSettings()
m_overrideColor = Utils::StyleHelper::baseColor();
} else {
Utils::StyleHelper::setBaseColor(
m_settings->value(QLatin1String(colorKey),
settings->value(QLatin1String(colorKey),
QColor(Utils::StyleHelper::DEFAULT_BASE_COLOR)).value<QColor>());
}
bool modeSelectorVisible = m_settings->value(QLatin1String(modeSelectorVisibleKey), true).toBool();
bool modeSelectorVisible = settings->value(QLatin1String(modeSelectorVisibleKey), true).toBool();
ModeManager::setModeSelectorVisible(modeSelectorVisible);
m_toggleModeSelectorAction->setChecked(modeSelectorVisible);
m_settings->endGroup();
settings->endGroup();
m_editorManager->readSettings();
m_navigationWidget->restoreSettings(m_settings);
m_rightPaneWidget->readSettings(m_settings);
m_navigationWidget->restoreSettings(settings);
m_rightPaneWidget->readSettings(settings);
}
void MainWindow::writeSettings()
{
m_settings->beginGroup(QLatin1String(settingsGroup));
QSettings *settings = PluginManager::settings();
settings->beginGroup(QLatin1String(settingsGroup));
if (!(m_overrideColor.isValid() && Utils::StyleHelper::baseColor() == m_overrideColor))
m_settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::requestedBaseColor());
settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::requestedBaseColor());
m_settings->setValue(QLatin1String(windowGeometryKey), saveGeometry());
m_settings->setValue(QLatin1String(windowStateKey), saveState());
m_settings->setValue(QLatin1String(modeSelectorVisibleKey), ModeManager::isModeSelectorVisible());
settings->setValue(QLatin1String(windowGeometryKey), saveGeometry());
settings->setValue(QLatin1String(windowStateKey), saveState());
settings->setValue(QLatin1String(modeSelectorVisibleKey), ModeManager::isModeSelectorVisible());
m_settings->endGroup();
settings->endGroup();
DocumentManager::saveSettings();
m_actionManager->saveSettings(m_settings);
m_actionManager->saveSettings(settings);
m_editorManager->saveSettings();
m_navigationWidget->saveSettings(m_settings);
m_navigationWidget->saveSettings(settings);
}
void MainWindow::updateAdditionalContexts(const Context &remove, const Context &add)
@@ -1264,10 +1256,14 @@ bool MainWindow::showWarningWithOptions(const QString &title,
void MainWindow::restoreWindowState()
{
m_settings->beginGroup(QLatin1String(settingsGroup));
if (!restoreGeometry(m_settings->value(QLatin1String(windowGeometryKey)).toByteArray()))
QSettings *settings = PluginManager::settings();
settings->beginGroup(QLatin1String(settingsGroup));
if (!restoreGeometry(settings->value(QLatin1String(windowGeometryKey)).toByteArray()))
resize(1008, 700); // size without window decoration
restoreState(m_settings->value(QLatin1String(windowStateKey)).toByteArray());
m_settings->endGroup();
restoreState(settings->value(QLatin1String(windowStateKey)).toByteArray());
settings->endGroup();
show();
}
} // namespace Internal
} // namespace Core

View File

@@ -95,7 +95,6 @@ public:
Core::IDocument *openFiles(const QStringList &fileNames, ICore::OpenFilesFlags flags);
QSettings *settings(QSettings::Scope scope) const;
inline SettingsDatabase *settingsDatabase() const { return m_settingsDatabase; }
virtual QPrinter *printer() const;
IContext * currentContextObject() const;
@@ -162,8 +161,6 @@ private:
ICore *m_coreImpl;
Context m_additionalContexts;
QSettings *m_settings;
QSettings *m_globalSettings;
SettingsDatabase *m_settingsDatabase;
mutable QPrinter *m_printer;
ActionManager *m_actionManager;

View File

@@ -71,7 +71,6 @@ struct ModeManagerPrivate
QSignalMapper *m_signalMapper;
Context m_addedContexts;
int m_oldCurrent;
bool m_saveSettingsOnModeChange;
bool m_modeSelectorVisible;
};
@@ -99,15 +98,12 @@ ModeManager::ModeManager(Internal::MainWindow *mainWindow,
d->m_oldCurrent = -1;
d->m_actionBar = new Internal::FancyActionBar(modeStack);
d->m_modeStack->addCornerWidget(d->m_actionBar);
d->m_saveSettingsOnModeChange = false;
d->m_modeSelectorVisible = true;
d->m_modeStack->setSelectionWidgetVisible(d->m_modeSelectorVisible);
connect(d->m_modeStack, SIGNAL(currentAboutToShow(int)), SLOT(currentTabAboutToChange(int)));
connect(d->m_modeStack, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int)));
connect(d->m_signalMapper, SIGNAL(mapped(int)), this, SLOT(slotActivateMode(int)));
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()), this, SLOT(handleStartup()));
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(handleShutdown()));
}
void ModeManager::init()
@@ -237,12 +233,6 @@ void ModeManager::enabledStateChanged()
}
}
void ModeManager::handleStartup()
{ d->m_saveSettingsOnModeChange = true; }
void ModeManager::handleShutdown()
{ d->m_saveSettingsOnModeChange = false; }
void ModeManager::aboutToRemoveObject(QObject *obj)
{
IMode *mode = Aggregation::query<IMode>(obj);
@@ -281,12 +271,9 @@ void ModeManager::currentTabAboutToChange(int index)
{
if (index >= 0) {
IMode *mode = d->m_modes.at(index);
if (mode) {
if (d->m_saveSettingsOnModeChange)
ICore::saveSettings();
if (mode)
emit currentModeAboutToChange(mode);
}
}
}
void ModeManager::currentTabChanged(int index)

View File

@@ -82,8 +82,6 @@ private slots:
void currentTabChanged(int index);
void updateModeToolTip();
void enabledStateChanged();
void handleStartup();
void handleShutdown();
private:
explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack);

View File

@@ -85,7 +85,7 @@ public:
QString topLevel;
};
VcsManagerPrivate() : m_unconfiguredVcs(0)
VcsManagerPrivate() : m_unconfiguredVcs(0), m_cachedAdditionalToolsPathsDirty(true)
{ }
~VcsManagerPrivate()
@@ -180,6 +180,9 @@ public:
QMap<QString, VcsInfo *> m_cachedMatches;
QList<VcsInfo *> m_vcsInfoList;
IVersionControl *m_unconfiguredVcs;
QStringList m_cachedAdditionalToolsPaths;
bool m_cachedAdditionalToolsPathsDirty;
};
static VcsManagerPrivate *d = 0;
@@ -213,6 +216,8 @@ void VcsManager::extensionsInitialized()
DocumentManager::instance(), SIGNAL(filesChangedInternally(QStringList)));
connect(versionControl, SIGNAL(repositoryChanged(QString)),
m_instance, SIGNAL(repositoryChanged(QString)));
connect(versionControl, SIGNAL(configurationChanged()),
m_instance, SLOT(handleConfigurationChanges()));
}
}
@@ -411,6 +416,17 @@ QString VcsManager::msgToAddToVcsFailed(const QStringList &files, const IVersion
.arg(vc->displayName(), files.join(QString(QLatin1Char('\n'))));
}
QStringList VcsManager::additionalToolsPath()
{
if (d->m_cachedAdditionalToolsPathsDirty) {
d->m_cachedAdditionalToolsPaths.clear();
foreach (IVersionControl *vc, allVersionControls())
d->m_cachedAdditionalToolsPaths.append(vc->additionalToolsPath());
d->m_cachedAdditionalToolsPathsDirty = false;
}
return d->m_cachedAdditionalToolsPaths;
}
void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNames)
{
IVersionControl *vc = findVersionControlForDirectory(directory);
@@ -462,6 +478,14 @@ void VcsManager::configureVcs()
d->m_unconfiguredVcs->id());
}
void VcsManager::handleConfigurationChanges()
{
d->m_cachedAdditionalToolsPathsDirty = true;
IVersionControl *vcs = qobject_cast<IVersionControl *>(sender());
if (vcs)
emit configurationChanged(vcs);
}
} // namespace Core
#if defined(WITH_TESTS)

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