Merge remote-tracking branch 'origin/3.0'
Conflicts: qtcreator.pri src/plugins/qnx/qnxutils.cpp Change-Id: I019ad21fb4c128eb736c8ab2d09310757e3be037
8
dist/changes-2.8.0
vendored
@@ -173,7 +173,7 @@ Alessandro Portale
|
||||
Andreas Holzammer
|
||||
André Hartmann
|
||||
André Pönitz
|
||||
Andrey M. Tokarev
|
||||
Andrey M. Tokarev (Андрей М. Токарев)
|
||||
Aurindam Jana
|
||||
Christian Kandeler
|
||||
Christian Stenger
|
||||
@@ -181,7 +181,7 @@ Christian Strømme
|
||||
Daniel Teske
|
||||
David Schulz
|
||||
Debao Zhang
|
||||
Dmitry Savchenko
|
||||
Dmitry Savchenko (Дмитрий Савченко)
|
||||
Eike Ziller
|
||||
El Mehdi Fekari
|
||||
Erik Verbruggen
|
||||
@@ -215,7 +215,7 @@ Petar Perisin
|
||||
Przemyslaw Gorszkowski
|
||||
Rafael Roquetto
|
||||
Robert Löhning
|
||||
Sergey Belyashov
|
||||
Sergey Belyashov (Сергей Беляшов)
|
||||
Sergey Shambir
|
||||
Shane Peelar
|
||||
Thiago Macieira
|
||||
@@ -225,4 +225,4 @@ Timo Jyrinki
|
||||
Tobias Hunger
|
||||
Tobias Nätterlund
|
||||
Tor Arne Vestbø
|
||||
Victor Ostashevsky
|
||||
Viktor Ostashevskyi (Віктор Осташевський)
|
||||
|
||||
@@ -41,19 +41,17 @@ bool ExamplePlugin::initialize(const QStringList &arguments, QString *errorStrin
|
||||
Q_UNUSED(errorString)
|
||||
|
||||
//! [add action]
|
||||
Core::ActionManager *am = Core::ICore::instance()->actionManager();
|
||||
|
||||
QAction *action = new QAction(tr("Example action"), this);
|
||||
Core::Command *cmd = am->registerAction(action, Constants::ACTION_ID,
|
||||
Core::Command *cmd = Core::ActionManager::registerAction(action, Constants::ACTION_ID,
|
||||
Core::Context(Core::Constants::C_GLOBAL));
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A")));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(triggerAction()));
|
||||
//! [add action]
|
||||
//! [add menu]
|
||||
Core::ActionContainer *menu = am->createMenu(Constants::MENU_ID);
|
||||
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
|
||||
menu->menu()->setTitle(tr("Example"));
|
||||
menu->addAction(cmd);
|
||||
am->actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
|
||||
Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
|
||||
//! [add menu]
|
||||
|
||||
return true;
|
||||
|
||||
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 79 KiB |
@@ -298,6 +298,15 @@
|
||||
\li \gui Compile - Selected output from the compiler. Open the
|
||||
\gui {Compile Output} pane for more detailed information.
|
||||
|
||||
\li \gui{Debug Information} - Lists debug information packages that might
|
||||
be missing.
|
||||
|
||||
\li \gui{Debugger Runtime} - Errors encountered when starting \QC. For
|
||||
example, information about missing DLLs.
|
||||
|
||||
\li \gui Deployment - Errors encountered between building an application
|
||||
successfully and starting it on a device.
|
||||
|
||||
\li \gui {My Tasks} - Entries from a task list file (.tasks) generated
|
||||
by \l{Showing Task List Files in Issues Pane}
|
||||
{code scanning and analysis tools}.
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
\list
|
||||
|
||||
\li Qt GUI Application
|
||||
\li Qt Widgets Application
|
||||
|
||||
Use \QD forms to design a Qt widget based user interface for the
|
||||
desktop and C++ to implement the application logic
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
\list 1
|
||||
|
||||
\li Select \gui{File > New File or Project > Applications > Qt Gui
|
||||
\li Select \gui{File > New File or Project > Applications > Qt Widgets
|
||||
Application > Choose}.
|
||||
|
||||
\image qtcreator-new-qt-gui-application.png "New File or Project dialog"
|
||||
|
||||
@@ -181,11 +181,12 @@ class Children:
|
||||
self.childNumChild = childNumChild
|
||||
try:
|
||||
if not addrBase is None and not addrStep is None:
|
||||
self.d.put('addrbase="0x%x",' % long(addrBase))
|
||||
self.d.put('addrstep="0x%x",' % long(addrStep))
|
||||
self.d.put('addrbase="0x%x",' % toInteger(addrBase))
|
||||
self.d.put('addrstep="0x%x",' % toInteger(addrStep))
|
||||
self.printsAddress = False
|
||||
except:
|
||||
warn("ADDRBASE: %s" % addrBase)
|
||||
warn("ADDRSTEP: %s" % addrStep)
|
||||
#warn("CHILDREN: %s %s %s" % (numChild, childType, childNumChild))
|
||||
|
||||
def __enter__(self):
|
||||
@@ -254,23 +255,6 @@ class UnnamedSubItem(SubItem):
|
||||
self.iname = "%s.%s" % (self.d.currentIName, component)
|
||||
self.name = None
|
||||
|
||||
movableTypes = set([
|
||||
"QBrush", "QBitArray", "QByteArray", "QCustomTypeInfo", "QChar", "QDate",
|
||||
"QDateTime", "QFileInfo", "QFixed", "QFixedPoint", "QFixedSize",
|
||||
"QHashDummyValue", "QIcon", "QImage", "QLine", "QLineF", "QLatin1Char",
|
||||
"QLocale", "QMatrix", "QModelIndex", "QPoint", "QPointF", "QPen",
|
||||
"QPersistentModelIndex", "QResourceRoot", "QRect", "QRectF", "QRegExp",
|
||||
"QSize", "QSizeF", "QString", "QTime", "QTextBlock", "QUrl", "QVariant",
|
||||
"QXmlStreamAttribute", "QXmlStreamNamespaceDeclaration",
|
||||
"QXmlStreamNotationDeclaration", "QXmlStreamEntityDeclaration"
|
||||
])
|
||||
|
||||
movableTypes5 = set([
|
||||
"QStringList"
|
||||
])
|
||||
|
||||
|
||||
|
||||
class DumperBase:
|
||||
def __init__(self):
|
||||
self.isCdb = False
|
||||
@@ -472,6 +456,23 @@ class DumperBase:
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def isKnownMovableType(self, type):
|
||||
if type in (
|
||||
"QBrush", "QBitArray", "QByteArray", "QCustomTypeInfo", "QChar", "QDate",
|
||||
"QDateTime", "QFileInfo", "QFixed", "QFixedPoint", "QFixedSize",
|
||||
"QHashDummyValue", "QIcon", "QImage", "QLine", "QLineF", "QLatin1Char",
|
||||
"QLocale", "QMatrix", "QModelIndex", "QPoint", "QPointF", "QPen",
|
||||
"QPersistentModelIndex", "QResourceRoot", "QRect", "QRectF", "QRegExp",
|
||||
"QSize", "QSizeF", "QString", "QTime", "QTextBlock", "QUrl", "QVariant",
|
||||
"QXmlStreamAttribute", "QXmlStreamNamespaceDeclaration",
|
||||
"QXmlStreamNotationDeclaration", "QXmlStreamEntityDeclaration"
|
||||
):
|
||||
return True
|
||||
|
||||
return type == "QStringList" and self.qtVersion() >= 0x050000
|
||||
|
||||
|
||||
def cleanAddress(addr):
|
||||
if addr is None:
|
||||
return "<no address>"
|
||||
@@ -514,8 +515,9 @@ Hex2EncodedUInt8, \
|
||||
Hex2EncodedFloat4, \
|
||||
Hex2EncodedFloat8, \
|
||||
IPv6AddressAndHexScopeId, \
|
||||
Hex2EncodedUtf8WithoutQuotes \
|
||||
= range(29)
|
||||
Hex2EncodedUtf8WithoutQuotes, \
|
||||
MillisecondsSinceEpoch \
|
||||
= range(30)
|
||||
|
||||
# Display modes. Keep that synchronized with DebuggerDisplay in watchutils.h
|
||||
StopDisplay, \
|
||||
|
||||
@@ -794,6 +794,11 @@ registerCommand("bb", bb)
|
||||
registerCommand("p1", p1)
|
||||
registerCommand("p2", p2)
|
||||
|
||||
def extractQtVersion():
|
||||
version = str(gdb.parse_and_eval("qVersion()"))
|
||||
(major, minor, patch) = version[version.find('"')+1:version.rfind('"')].split('.')
|
||||
return 0x10000 * int(major) + 0x100 * int(minor) + int(patch)
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
@@ -826,6 +831,7 @@ class Dumper(DumperBase):
|
||||
self.useDynamicType = True
|
||||
self.expandedINames = {}
|
||||
self.childEventAddress = None
|
||||
self.cachedQtVersion = None
|
||||
|
||||
watchers = ""
|
||||
resultVarName = ""
|
||||
@@ -1236,6 +1242,9 @@ class Dumper(DumperBase):
|
||||
#return long(gdb.Value(addr).cast(self.voidPtrType().pointer()).dereference())
|
||||
return struct.unpack("P", self.readRawMemory(addr, self.ptrSize()))[0]
|
||||
|
||||
def extractInt64(self, addr):
|
||||
return struct.unpack("q", self.readRawMemory(addr, 8))[0]
|
||||
|
||||
def extractInt(self, addr):
|
||||
#return long(gdb.Value(addr).cast(self.intPtrType()).dereference())
|
||||
return struct.unpack("i", self.readRawMemory(addr, 4))[0]
|
||||
@@ -1293,16 +1302,17 @@ class Dumper(DumperBase):
|
||||
return xrange(min(toInteger(self.currentMaxNumChild), toInteger(self.currentNumChild)))
|
||||
|
||||
def qtVersion(self):
|
||||
global qqVersion
|
||||
if not qqVersion is None:
|
||||
return qqVersion
|
||||
try:
|
||||
# This will fail on Qt 5
|
||||
gdb.execute("ptype QString::shared_empty", to_string=True)
|
||||
qqVersion = 0x040800
|
||||
except:
|
||||
qqVersion = 0x050000
|
||||
return qqVersion
|
||||
if self.cachedQtVersion is None:
|
||||
try:
|
||||
self.cachedQtVersion = extractQtVersion()
|
||||
except:
|
||||
try:
|
||||
# This will fail on Qt 5
|
||||
gdb.execute("ptype QString::shared_empty", to_string=True)
|
||||
self.cachedQtVersion = 0x040800
|
||||
except:
|
||||
self.cachedQtVersion = 0x050000
|
||||
return self.cachedQtVersion
|
||||
|
||||
# Convenience function.
|
||||
def putItemCount(self, count, maximum = 1000000000):
|
||||
@@ -1405,10 +1415,7 @@ class Dumper(DumperBase):
|
||||
return True
|
||||
if self.isSimpleType(type):
|
||||
return True
|
||||
typeName = self.stripNamespaceFromType(str(type))
|
||||
if typeName in movableTypes:
|
||||
return True
|
||||
return self.qtVersion() >= 0x050000 and typeName in movableTypes5
|
||||
return self.isKnownMovableType(self.stripNamespaceFromType(str(type)))
|
||||
|
||||
def putIntItem(self, name, value):
|
||||
with SubItem(self, name):
|
||||
@@ -1422,6 +1429,12 @@ class Dumper(DumperBase):
|
||||
self.putType("bool")
|
||||
self.putNumChild(0)
|
||||
|
||||
def putGenericItem(self, name, type, value, encoding = None):
|
||||
with SubItem(self, name):
|
||||
self.putValue(value, encoding)
|
||||
self.putType(type)
|
||||
self.putNumChild(0)
|
||||
|
||||
def currentItemFormat(self):
|
||||
format = self.formats.get(self.currentIName)
|
||||
if format is None:
|
||||
|
||||
@@ -321,6 +321,7 @@ class Dumper(DumperBase):
|
||||
|
||||
self.charType_ = None
|
||||
self.intType_ = None
|
||||
self.int64Type_ = None
|
||||
self.sizetType_ = None
|
||||
self.charPtrType_ = None
|
||||
self.voidPtrType_ = None
|
||||
@@ -412,6 +413,11 @@ class Dumper(DumperBase):
|
||||
#warn(" -> %s" % result)
|
||||
return result
|
||||
|
||||
def parseAndEvaluate(self, expr):
|
||||
thread = self.currentThread()
|
||||
frame = thread.GetFrameAtIndex(0)
|
||||
return frame.EvaluateExpression(expr)
|
||||
|
||||
def call(self, value, func, *args):
|
||||
return self.call2(value, func, args)
|
||||
|
||||
@@ -499,6 +505,11 @@ class Dumper(DumperBase):
|
||||
self.intType_ = self.target.FindFirstType('int')
|
||||
return self.intType_
|
||||
|
||||
def int64Type(self):
|
||||
if self.int64Type_ is None:
|
||||
self.int64Type_ = self.target.FindFirstType('long long int')
|
||||
return self.int64Type_
|
||||
|
||||
def charType(self):
|
||||
if self.charType_ is None:
|
||||
self.charType_ = self.target.FindFirstType('char')
|
||||
@@ -534,6 +545,9 @@ class Dumper(DumperBase):
|
||||
def extractInt(self, address):
|
||||
return int(self.createValue(address, self.intType()))
|
||||
|
||||
def extractInt64(self, address):
|
||||
return int(self.createValue(address, self.int64Type()))
|
||||
|
||||
def extractByte(self, address):
|
||||
return int(self.createValue(address, self.charType())) & 0xFF
|
||||
|
||||
@@ -560,10 +574,9 @@ class Dumper(DumperBase):
|
||||
return format
|
||||
|
||||
def isMovableType(self, type):
|
||||
if type.GetTypeClass() in (lldb.eTypeClassBuiltin,
|
||||
lldb.eTypeClassPointer):
|
||||
if type.GetTypeClass() in (lldb.eTypeClassBuiltin, lldb.eTypeClassPointer):
|
||||
return True
|
||||
return self.stripNamespaceFromType(type.GetName()) in movableTypes
|
||||
return self.isKnownMovableType(self.stripNamespaceFromType(type.GetName()))
|
||||
|
||||
def putIntItem(self, name, value):
|
||||
with SubItem(self, name):
|
||||
@@ -577,6 +590,12 @@ class Dumper(DumperBase):
|
||||
self.putType("bool")
|
||||
self.putNumChild(0)
|
||||
|
||||
def putGenericItem(self, name, type, value, encoding = None):
|
||||
with SubItem(self, name):
|
||||
self.putValue(value, encoding)
|
||||
self.putType(type)
|
||||
self.putNumChild(0)
|
||||
|
||||
def putNumChild(self, numchild):
|
||||
#warn("NUM CHILD: '%s' '%s'" % (numchild, self.currentChildNumChild))
|
||||
#if numchild != self.currentChildNumChild:
|
||||
@@ -670,22 +689,22 @@ class Dumper(DumperBase):
|
||||
self.putFields(value)
|
||||
|
||||
def lookupType(self, name):
|
||||
warn("LOOKUP TYPE NAME: %s" % name)
|
||||
#warn("LOOKUP TYPE NAME: %s" % name)
|
||||
if name.endswith('*'):
|
||||
type = self.lookupType(name[:-1].strip())
|
||||
return type.GetPointerType() if type.IsValid() else None
|
||||
type = self.target.FindFirstType(name)
|
||||
warn("LOOKUP RESULT: %s" % type.name)
|
||||
warn("LOOKUP VALID: %s" % type.IsValid())
|
||||
#warn("LOOKUP RESULT: %s" % type.name)
|
||||
#warn("LOOKUP VALID: %s" % type.IsValid())
|
||||
return type if type.IsValid() else None
|
||||
|
||||
def setupInferior(self, args):
|
||||
error = lldb.SBError()
|
||||
|
||||
self.executable_ = args['executable']
|
||||
self.startMode_ = args['startMode']
|
||||
self.processArgs_ = args['processArgs']
|
||||
self.attachPid_ = args['attachPid']
|
||||
self.startMode_ = args.get('startMode', 1)
|
||||
self.processArgs_ = args.get('processArgs', '')
|
||||
self.attachPid_ = args.get('attachPid', 0)
|
||||
|
||||
self.target = self.debugger.CreateTarget(self.executable_, None, None, True, error)
|
||||
self.importDumpers()
|
||||
@@ -1052,12 +1071,16 @@ class Dumper(DumperBase):
|
||||
self.putArrayData(innerType, value, 1000)
|
||||
return
|
||||
|
||||
#if innerType.code == MethodCode or innerType.code == FunctionCode:
|
||||
# # A function pointer with format None.
|
||||
# self.putValue(str(value))
|
||||
# self.putType(typeName)
|
||||
# self.putNumChild(0)
|
||||
# return
|
||||
if innerType.IsFunctionType():
|
||||
# A function pointer.
|
||||
val = str(value)
|
||||
pos = val.find(" = ")
|
||||
if pos > 0:
|
||||
val = val[pos + 3:]
|
||||
self.putValue(val)
|
||||
self.putType(innerType)
|
||||
self.putNumChild(0)
|
||||
return
|
||||
|
||||
#warn("AUTODEREF: %s" % self.autoDerefPointers)
|
||||
#warn("INAME: %s" % self.currentIName)
|
||||
|
||||
@@ -69,6 +69,14 @@ def qdump__QByteArray(d, value):
|
||||
if d.isExpanded():
|
||||
d.putArrayData(d.charType(), data, size)
|
||||
|
||||
def qdump__QByteArrayData(d, value):
|
||||
data, size, alloc = d.byteArrayDataHelper(d.addressOf(value))
|
||||
d.putValue(d.readMemory(data, size), Hex2EncodedLatin1)
|
||||
d.putNumChild(1)
|
||||
if d.isExpanded():
|
||||
with Children(d):
|
||||
d.putIntItem("size", size)
|
||||
d.putIntItem("alloc", alloc)
|
||||
|
||||
def qdump__QChar(d, value):
|
||||
d.putValue(int(value["ucs"]))
|
||||
@@ -221,24 +229,37 @@ def qdump__QTime(d, value):
|
||||
d.putNumChild(0)
|
||||
|
||||
|
||||
# This relies on the Qt4/Qt5 internal structure layout:
|
||||
# {sharedref(4), date(8), time(4+x)}
|
||||
def qdump__QDateTime(d, value):
|
||||
qtVersion = d.qtVersion()
|
||||
isValid = False
|
||||
# This relies on the Qt4/Qt5 internal structure layout:
|
||||
# {sharedref(4), ...
|
||||
base = d.dereferenceValue(value)
|
||||
# QDateTimePrivate:
|
||||
# - QAtomicInt ref; (padded on 64 bit)
|
||||
# - [QDate date;]
|
||||
# - - uint jd in Qt 4, qint64 in Qt 5; padded on 64 bit
|
||||
# - [QTime time;]
|
||||
# - - uint mds;
|
||||
# - Spec spec;
|
||||
dateSize = 4 if d.qtVersion() < 0x050000 and d.is32bit() else 8
|
||||
dateBase = base + d.ptrSize() # Only QAtomicInt, but will be padded.
|
||||
timeBase = dateBase + dateSize
|
||||
mds = d.extractInt(timeBase)
|
||||
if mds >= 0:
|
||||
jd = d.extractInt(dateBase)
|
||||
d.putValue("%s/%s" % (jd, mds), JulianDateAndMillisecondsSinceMidnight)
|
||||
if qtVersion >= 0x050200:
|
||||
ms = d.extractInt64(dateBase)
|
||||
offset = d.extractInt(dateBase + 12)
|
||||
isValid = ms > 0
|
||||
if isValid:
|
||||
d.putValue("%s" % (ms - offset * 1000), MillisecondsSinceEpoch)
|
||||
else:
|
||||
# This relies on the Qt4/Qt5 internal structure layout:
|
||||
# {sharedref(4), date(8), time(4+x)}
|
||||
# QDateTimePrivate:
|
||||
# - QAtomicInt ref; (padded on 64 bit)
|
||||
# - [QDate date;]
|
||||
# - - uint jd in Qt 4, qint64 in Qt 5.0 and Qt 5.2; padded on 64 bit
|
||||
# - [QTime time;]
|
||||
# - - uint mds;
|
||||
# - Spec spec;
|
||||
dateSize = 4 if qtVersion < 0x050000 and d.is32bit() else 8
|
||||
timeBase = dateBase + dateSize
|
||||
mds = d.extractInt(timeBase)
|
||||
isValid = mds > 0
|
||||
if isValid:
|
||||
jd = d.extractInt(dateBase)
|
||||
d.putValue("%s/%s" % (jd, mds), JulianDateAndMillisecondsSinceMidnight)
|
||||
if isValid:
|
||||
d.putNumChild(1)
|
||||
if d.isExpanded():
|
||||
# FIXME: This improperly uses complex return values.
|
||||
@@ -532,14 +553,18 @@ def qdump__QHashNode(d, value):
|
||||
|
||||
def qHashIteratorHelper(d, value):
|
||||
typeName = str(value.type)
|
||||
hashType = d.lookupType(typeName[0:typeName.rfind("::")])
|
||||
hashTypeName = typeName[0:typeName.rfind("::")]
|
||||
hashType = d.lookupType(hashTypeName)
|
||||
keyType = d.templateArgument(hashType, 0)
|
||||
valueType = d.templateArgument(hashType, 1)
|
||||
d.putNumChild(1)
|
||||
d.putEmptyValue()
|
||||
if d.isExpanded():
|
||||
with Children(d):
|
||||
innerTypeName = "%sQHashNode<%s,%s>" % (d.ns, keyType, valueType)
|
||||
# We need something like QHash<int, float>::iterator
|
||||
# -> QHashNode<int, float> with 'proper' spacing,
|
||||
# as space changes confuse LLDB.
|
||||
innerTypeName = hashTypeName.replace("QHash", "QHashNode", 1)
|
||||
node = value["i"].cast(d.lookupType(innerTypeName).pointer())
|
||||
d.putSubItem("key", node["key"])
|
||||
d.putSubItem("value", node["value"])
|
||||
@@ -857,9 +882,11 @@ def qdumpHelper__Qt5_QMap(d, value, forceLong):
|
||||
keyType = d.templateArgument(value.type, 0)
|
||||
valueType = d.templateArgument(value.type, 1)
|
||||
isCompact = d.isMapCompact(keyType, valueType)
|
||||
# Note: The space in the QMapNode lookup below is
|
||||
# important for LLDB.
|
||||
nodeType = d.lookupType(d.ns + "QMapNode<%s, %s>" % (keyType, valueType))
|
||||
# Note: Keeping the spacing in the type lookup
|
||||
# below is important for LLDB.
|
||||
needle = str(d_ptr.type).replace("QMapData", "QMapNode", 1)
|
||||
nodeType = d.lookupType(needle)
|
||||
|
||||
if isCompact:
|
||||
innerType = valueType
|
||||
else:
|
||||
@@ -1098,15 +1125,10 @@ def qdump__QObject(d, value):
|
||||
gdb.execute("set $d.d.is_null = %s"
|
||||
% value1["is_null"])
|
||||
prop = d.parseAndEvaluate("$d").dereference()
|
||||
val, inner, innert, handled = \
|
||||
qdumpHelper__QVariant(d, prop)
|
||||
val, innert, handled = qdumpHelper__QVariant(d, prop)
|
||||
|
||||
if handled:
|
||||
pass
|
||||
elif len(inner):
|
||||
# Build-in types.
|
||||
d.putType(inner)
|
||||
d.putItem(val)
|
||||
else:
|
||||
# User types.
|
||||
# func = "typeToName(('%sQVariant::Type')%d)"
|
||||
@@ -1443,19 +1465,34 @@ def qdump__QRegion(d, value):
|
||||
d.putValue("<empty>")
|
||||
d.putNumChild(0)
|
||||
else:
|
||||
try:
|
||||
# Fails without debug info.
|
||||
n = int(p.dereference()["numRects"])
|
||||
d.putItemCount(n)
|
||||
d.putNumChild(n)
|
||||
d.putPlainChildren(p.dereference())
|
||||
except:
|
||||
warn("NO DEBUG INFO")
|
||||
d.putValue(p)
|
||||
d.putPlainChildren(value)
|
||||
# struct QRegionPrivate:
|
||||
# int numRects;
|
||||
# QVector<QRect> rects;
|
||||
# QRect extents;
|
||||
# QRect innerRect;
|
||||
# int innerArea;
|
||||
pp = d.dereferenceValue(p)
|
||||
n = d.extractInt(pp)
|
||||
d.putItemCount(n)
|
||||
d.putNumChild(n)
|
||||
if d.isExpanded():
|
||||
with Children(d):
|
||||
v = d.ptrSize()
|
||||
rectType = d.lookupType(d.ns + "QRect")
|
||||
d.putIntItem("numRects", n)
|
||||
d.putSubItem("extents", d.createValue(pp + 2 * v, rectType))
|
||||
d.putSubItem("innerRect", d.createValue(pp + 2 * v + rectType.sizeof, rectType))
|
||||
# FIXME
|
||||
try:
|
||||
# Can fail if QVector<QRect> debuginfo is missing.
|
||||
vectType = d.lookupType("%sQVector<%sQRect>" % (d.ns, d.ns))
|
||||
d.putSubItem("rects", d.createValue(pp + v, vectType))
|
||||
except:
|
||||
with SubItem(d, "rects"):
|
||||
d.putItemCount(n)
|
||||
d.putType("%sQVector<%sQRect>" % (d.ns, d.ns))
|
||||
d.putNumChild(0)
|
||||
|
||||
# qt_rgn might be 0
|
||||
# gdb.parse_and_eval("region")["d"].dereference()["qt_rgn"].dereference()
|
||||
|
||||
def qdump__QScopedPointer(d, value):
|
||||
d.putBetterType(d.currentType)
|
||||
@@ -1674,17 +1711,38 @@ def qdump__QUrl(d, value):
|
||||
# - QString query;
|
||||
# - QString fragment;
|
||||
schemeAddr = d.dereferenceValue(value) + 2 * d.intSize()
|
||||
scheme = d.dereference(schemeAddr)
|
||||
host = d.dereference(schemeAddr + 3 * d.ptrSize())
|
||||
path = d.dereference(schemeAddr + 4 * d.ptrSize())
|
||||
|
||||
str = d.encodeString(scheme)
|
||||
str += "3a002f002f00"
|
||||
str += d.encodeString(host)
|
||||
str += d.encodeString(path)
|
||||
d.putValue(str, Hex4EncodedLittleEndian)
|
||||
d.putPlainChildren(value)
|
||||
scheme = d.encodeStringHelper(d.dereference(schemeAddr))
|
||||
userName = d.encodeStringHelper(d.dereference(schemeAddr + 1 * d.ptrSize()))
|
||||
password = d.encodeStringHelper(d.dereference(schemeAddr + 2 * d.ptrSize()))
|
||||
host = d.encodeStringHelper(d.dereference(schemeAddr + 3 * d.ptrSize()))
|
||||
path = d.encodeStringHelper(d.dereference(schemeAddr + 4 * d.ptrSize()))
|
||||
query = d.encodeStringHelper(d.dereference(schemeAddr + 5 * d.ptrSize()))
|
||||
fragment = d.encodeStringHelper(d.dereference(schemeAddr + 6 * d.ptrSize()))
|
||||
port = d.extractInt(d.dereferenceValue(value) + d.intSize())
|
||||
|
||||
url = scheme
|
||||
url += "3a002f002f00"
|
||||
if len(userName):
|
||||
url += userName
|
||||
url += "4000"
|
||||
url += host
|
||||
if port >= 0:
|
||||
url += "3a00"
|
||||
url += ''.join(["%02x00" % ord(c) for c in str(port)])
|
||||
url += path
|
||||
d.putValue(url, Hex4EncodedLittleEndian)
|
||||
d.putNumChild(8)
|
||||
if d.isExpanded():
|
||||
stringType = d.lookupType(d.ns + "QString")
|
||||
with Children(d):
|
||||
d.putIntItem("port", port)
|
||||
d.putGenericItem("scheme", stringType, scheme, Hex4EncodedLittleEndian)
|
||||
d.putGenericItem("userName", stringType, userName, Hex4EncodedLittleEndian)
|
||||
d.putGenericItem("password", stringType, password, Hex4EncodedLittleEndian)
|
||||
d.putGenericItem("host", stringType, host, Hex4EncodedLittleEndian)
|
||||
d.putGenericItem("path", stringType, path, Hex4EncodedLittleEndian)
|
||||
d.putGenericItem("query", stringType, query, Hex4EncodedLittleEndian)
|
||||
d.putGenericItem("fragment", stringType, fragment, Hex4EncodedLittleEndian)
|
||||
|
||||
def qdumpHelper_QVariant_0(d, data):
|
||||
# QVariant::Invalid
|
||||
@@ -1737,8 +1795,8 @@ qdumpHelper_QVariants_A = [
|
||||
|
||||
qdumpHelper_QVariants_B = [
|
||||
"QChar", # 7
|
||||
None, # 8, QVariantMap
|
||||
None, # 9, QVariantList
|
||||
"QVariantMap", # 8
|
||||
"QVariantList",# 9
|
||||
"QString", # 10
|
||||
"QStringList", # 11
|
||||
"QByteArray", # 12
|
||||
@@ -1757,7 +1815,7 @@ qdumpHelper_QVariants_B = [
|
||||
"QPoint", # 25
|
||||
"QPointF", # 26
|
||||
"QRegExp", # 27
|
||||
None, # 28, QVariantHash
|
||||
"QVariantHash",# 28
|
||||
]
|
||||
|
||||
qdumpHelper_QVariants_C = [
|
||||
@@ -1791,80 +1849,53 @@ def qdumpHelper__QVariant(d, value):
|
||||
variantType = int(value["d"]["type"])
|
||||
#warn("VARIANT TYPE: %s : " % variantType)
|
||||
|
||||
# Well-known simple type.
|
||||
if variantType <= 6:
|
||||
qdumpHelper_QVariants_A[variantType](d, data)
|
||||
d.putNumChild(0)
|
||||
return (None, None, None, True)
|
||||
return (None, None, True)
|
||||
|
||||
inner = ""
|
||||
innert = ""
|
||||
val = None
|
||||
# Unknown user type.
|
||||
if variantType > 86:
|
||||
return (None, "", False)
|
||||
|
||||
# Known Core or Gui type.
|
||||
if variantType <= 28:
|
||||
inner = qdumpHelper_QVariants_B[variantType - 7]
|
||||
if not inner is None:
|
||||
innert = inner
|
||||
elif variantType == 8: # QVariant::VariantMap
|
||||
inner = d.ns + "QMap<" + d.ns + "QString," + d.ns + "QVariant>"
|
||||
innert = "QVariantMap"
|
||||
elif variantType == 9: # QVariant::VariantList
|
||||
inner = d.ns + "QList<" + d.ns + "QVariant>"
|
||||
innert = "QVariantList"
|
||||
elif variantType == 28: # QVariant::VariantHash
|
||||
inner = d.ns + "QHash<" + d.ns + "QString," + d.ns + "QVariant>"
|
||||
innert = "QVariantHash"
|
||||
innert = qdumpHelper_QVariants_B[variantType - 7]
|
||||
else:
|
||||
innert = qdumpHelper_QVariants_C[variantType - 64]
|
||||
|
||||
elif variantType <= 86:
|
||||
inner = d.ns + qdumpHelper_QVariants_C[variantType - 64]
|
||||
innert = inner
|
||||
inner = d.ns + innert
|
||||
|
||||
if len(inner):
|
||||
innerType = d.lookupType(inner)
|
||||
sizePD = 8 # sizeof(QVariant::Private::Data)
|
||||
if innerType.sizeof > sizePD:
|
||||
sizePS = 2 * d.ptrSize() # sizeof(QVariant::PrivateShared)
|
||||
val = (data.cast(d.charPtrType()) + sizePS) \
|
||||
.cast(innerType.pointer()).dereference()
|
||||
else:
|
||||
val = data.cast(innerType)
|
||||
innerType = d.lookupType(inner)
|
||||
sizePD = 8 # sizeof(QVariant::Private::Data)
|
||||
isSpecial = d.qtVersion() >= 0x050000 \
|
||||
and (innert == "QVariantMap" or innert == "QVariantHash")
|
||||
if innerType.sizeof > sizePD or isSpecial:
|
||||
sizePS = 2 * d.ptrSize() # sizeof(QVariant::PrivateShared)
|
||||
val = (data.cast(d.charPtrType()) + sizePS) \
|
||||
.cast(innerType.pointer()).dereference()
|
||||
else:
|
||||
val = data.cast(innerType)
|
||||
|
||||
return (val, inner, innert, False)
|
||||
d.putEmptyValue(-99)
|
||||
d.putItem(val)
|
||||
d.putBetterType("%sQVariant (%s)" % (d.ns, innert))
|
||||
|
||||
return (None, innert, True)
|
||||
|
||||
|
||||
def qdump__QVariant(d, value):
|
||||
d_ptr = value["d"]
|
||||
d_data = d_ptr["data"]
|
||||
|
||||
(val, inner, innert, handled) = qdumpHelper__QVariant(d, value)
|
||||
(val, innert, handled) = qdumpHelper__QVariant(d, value)
|
||||
|
||||
if handled:
|
||||
return
|
||||
|
||||
if len(inner):
|
||||
innerType = d.lookupType(inner)
|
||||
if innerType.sizeof > d_data.type.sizeof:
|
||||
# FIXME:
|
||||
#if int(d_ptr["is_shared"]):
|
||||
# v = d_data["ptr"].cast(innerType.pointer().pointer().pointer()) \
|
||||
# .dereference().dereference().dereference()
|
||||
#else:
|
||||
v = d_data["ptr"].cast(innerType.pointer().pointer()) \
|
||||
.dereference().dereference()
|
||||
else:
|
||||
v = d_data.cast(innerType)
|
||||
d.putEmptyValue(-99)
|
||||
d.putItem(v)
|
||||
d.putBetterType("%sQVariant (%s)" % (d.ns, innert))
|
||||
return innert
|
||||
|
||||
# User types.
|
||||
d_ptr = value["d"]
|
||||
typeCode = int(d_ptr["type"])
|
||||
if d.isGdb:
|
||||
type = str(d.call(value, "typeToName",
|
||||
"('%sQVariant::Type')%d" % (d.ns, typeCode)))
|
||||
if d.isLldb:
|
||||
type = str(d.call(value, "typeToName",
|
||||
"(%sQVariant::Type)%d" % (d.ns, typeCode)))
|
||||
exp = "((const char *(*)(int))%sQMetaType::typeName)(%d)" % (d.ns, typeCode)
|
||||
type = str(d.parseAndEvaluate(exp))
|
||||
type = type[type.find('"') + 1 : type.rfind('"')]
|
||||
type = type.replace("Q", d.ns + "Q") # HACK!
|
||||
type = type.replace("uint", "unsigned int") # HACK!
|
||||
|
||||
@@ -38,7 +38,7 @@ def qdump____c_style_array__(d, value):
|
||||
format = d.currentItemFormat()
|
||||
isDefault = format == None and str(targetType.unqualified()) == "char"
|
||||
if isDefault or format == 0 or format == 1 or format == 2:
|
||||
blob = d.readMemory(value.address, type.sizeof)
|
||||
blob = d.readMemory(d.addressOf(value), type.sizeof)
|
||||
|
||||
if isDefault:
|
||||
# Use Latin1 as default for char [].
|
||||
@@ -56,7 +56,7 @@ def qdump____c_style_array__(d, value):
|
||||
d.putValue("@0x%x" % d.pointerValue(value.cast(targetType.pointer())))
|
||||
|
||||
if d.currentIName in d.expandedINames:
|
||||
p = value.address
|
||||
p = d.addressOf(value)
|
||||
ts = targetType.sizeof
|
||||
if not d.tryPutArrayContents(targetType, p, int(type.sizeof / ts)):
|
||||
with Children(d, childType=targetType,
|
||||
|
||||
@@ -19,6 +19,7 @@ QT += core-private qml-private quick-private gui-private script-private
|
||||
}
|
||||
|
||||
DEFINES += QWEAKPOINTER_ENABLE_ARROW
|
||||
DEFINES -= QT_CREATOR
|
||||
|
||||
include (../instances/instances.pri)
|
||||
include (instances/instances.pri)
|
||||
|
||||
@@ -63,7 +63,7 @@ Item {
|
||||
}
|
||||
|
||||
RoundedPanel {
|
||||
roundLeft: isFirst() && roundLeftButton
|
||||
roundLeft: isFirst() && buttonRowButton.roundLeftButton
|
||||
roundRight: isLast()
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
@@ -37,7 +37,7 @@ Controls.CheckBox {
|
||||
|
||||
property color borderColor: "#222"
|
||||
property color highlightColor: "orange"
|
||||
property color textColor: "#eee"
|
||||
property color textColor: colorLogic.textColor
|
||||
|
||||
onTextChanged: {
|
||||
if (text.charAt(0) !== " ")
|
||||
@@ -49,13 +49,15 @@ Controls.CheckBox {
|
||||
ExtendedFunctionButton {
|
||||
x: 22
|
||||
backendValue: checkBox.backendValue
|
||||
visible: spinBox.enabled
|
||||
visible: checkBox.enabled
|
||||
}
|
||||
|
||||
QtObject {
|
||||
property int valueFromBackend: checkBox.backendValue.value;
|
||||
ColorLogic {
|
||||
id: colorLogic
|
||||
backendValue: checkBox.backendValue
|
||||
onValueFromBackendChanged: {
|
||||
checkBox.checked = valueFromBackend;
|
||||
if (checkBox.checked !== valueFromBackend)
|
||||
checkBox.checked = valueFromBackend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,8 +66,10 @@ Column {
|
||||
onColorChanged: {
|
||||
textField.text = gradientLine.colorToString(color);
|
||||
gradientLine.currentColor = color
|
||||
//Delay setting the color to keep ui responsive
|
||||
colorEditorTimer.restart()
|
||||
|
||||
if (buttonRow.checkedIndex !== 1)
|
||||
//Delay setting the color to keep ui responsive
|
||||
colorEditorTimer.restart()
|
||||
}
|
||||
|
||||
GradientLine {
|
||||
@@ -105,10 +107,14 @@ Column {
|
||||
|
||||
LineEdit {
|
||||
id: textField
|
||||
inputMask: "\\#hhHHHHHH"
|
||||
inputMask: "\\#HHHHHHhh"
|
||||
|
||||
backendValue: colorEditor.backendendValue
|
||||
|
||||
onAccepted: {
|
||||
colorEditor.color = text
|
||||
print("color")
|
||||
print(textField.text)
|
||||
colorEditor.color = textField.text
|
||||
}
|
||||
Layout.preferredWidth: 80
|
||||
}
|
||||
@@ -124,26 +130,25 @@ Column {
|
||||
|
||||
ButtonRowButton {
|
||||
iconSource: "images/icon_color_solid.png"
|
||||
onClicked: {
|
||||
colorEditor.backendendValue.resetValue();
|
||||
}
|
||||
|
||||
}
|
||||
ButtonRowButton {
|
||||
visible: supportGradient
|
||||
iconSource: "images/icon_color_gradient.png"
|
||||
onClicked: {
|
||||
print("gradient")
|
||||
}
|
||||
|
||||
}
|
||||
ButtonRowButton {
|
||||
iconSource: "images/icon_color_none.png"
|
||||
|
||||
}
|
||||
|
||||
onToggled: {
|
||||
if (index === 0) {
|
||||
colorEditor.color = "#ffffff"
|
||||
}
|
||||
|
||||
if (index === 2) {
|
||||
onClicked: {
|
||||
colorEditor.color = "#00000000"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1 as Controls
|
||||
import QtQuick.Controls.Styles 1.0
|
||||
import "Constants.js" as Constants
|
||||
|
||||
QtObject {
|
||||
id: innerObject
|
||||
|
||||
property variant backendValue
|
||||
property color textColor: Constants.colorsDefaultText
|
||||
property variant valueFromBackend: backendValue.value;
|
||||
property bool baseStateFlag: isBaseState;
|
||||
property bool isInModel: backendValue.isInModel;
|
||||
property bool isInSubState: backendValue.isInSubState;
|
||||
|
||||
onBackendValueChanged: {
|
||||
evaluate();
|
||||
}
|
||||
|
||||
onValueFromBackendChanged: {
|
||||
evaluate();
|
||||
}
|
||||
|
||||
onBaseStateFlagChanged: {
|
||||
evaluate();
|
||||
}
|
||||
|
||||
onIsInModelChanged: {
|
||||
evaluate();
|
||||
}
|
||||
|
||||
onIsInSubStateChanged: {
|
||||
evaluate();
|
||||
}
|
||||
|
||||
function evaluate() {
|
||||
if (innerObject.backendValue === undefined)
|
||||
return;
|
||||
|
||||
if (baseStateFlag) {
|
||||
if (innerObject.backendValue.isInModel)
|
||||
innerObject.textColor = Constants.colorsChangedBaseText
|
||||
else
|
||||
innerObject.textColor = Constants.colorsDefaultText
|
||||
} else {
|
||||
if (innerObject.backendValue.isInSubState)
|
||||
innerObject.textColor = Constants.colorsChangedStateText
|
||||
else
|
||||
innerObject.textColor = Constants.colorsDefaultText
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -36,14 +36,20 @@ Controls.ComboBox {
|
||||
|
||||
property variant backendValue
|
||||
|
||||
QtObject {
|
||||
property string valueFromBackend: lineEdit.backendValue.valueToString;
|
||||
property color textColor: colorLogic.textColor
|
||||
|
||||
ColorLogic {
|
||||
id: colorLogic
|
||||
backendValue: comboBox.backendValue
|
||||
onValueFromBackendChanged: {
|
||||
lineEdit.currentText = valueFromBackend;
|
||||
comboBox.currentIndex = comboBox.find( comboBox.backendValue.valueToString);
|
||||
}
|
||||
}
|
||||
|
||||
onCurrentTextChanged: {
|
||||
if (backendValue === undefined)
|
||||
return;
|
||||
|
||||
if (backendValue.value !== currentText)
|
||||
backendValue.value = currentText;
|
||||
}
|
||||
@@ -57,5 +63,13 @@ Controls.ComboBox {
|
||||
}
|
||||
|
||||
style: CustomComboBoxStyle {
|
||||
textColor: comboBox.textColor
|
||||
}
|
||||
|
||||
ExtendedFunctionButton {
|
||||
x: 2
|
||||
y: 4
|
||||
backendValue: comboBox.backendValue
|
||||
visible: comboBox.enabled
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
.pragma library
|
||||
|
||||
var colorsDisabledText = "gray"
|
||||
var colorsDefaultText = "white"
|
||||
var colorsBoldText = "#dedede"
|
||||
var colorsChangedBaseText = "#9999ff"
|
||||
var colorsChangedStateText = "#99ccff"
|
||||
@@ -37,7 +37,7 @@ ComboBoxStyle {
|
||||
property color textColor: "#eee"
|
||||
|
||||
background: Item {
|
||||
implicitWidth: 100
|
||||
implicitWidth: 120
|
||||
implicitHeight: 25
|
||||
|
||||
RoundedPanel {
|
||||
@@ -82,7 +82,7 @@ ComboBoxStyle {
|
||||
Text {
|
||||
id: textitem
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 4
|
||||
anchors.leftMargin: 14
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: control.currentText
|
||||
renderType: Text.NativeRendering
|
||||
|
||||
@@ -47,7 +47,7 @@ SpinBoxStyle {
|
||||
source: "images/up-arrow.png"
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: 2
|
||||
anchors.horizontalCenterOffset: -4
|
||||
anchors.horizontalCenterOffset: -2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ SpinBoxStyle {
|
||||
source: "images/down-arrow.png"
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: -1
|
||||
anchors.horizontalCenterOffset: -4
|
||||
anchors.horizontalCenterOffset: -2
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,10 +90,9 @@ Section {
|
||||
ComboBox {
|
||||
backendValue: backendValues.flickableDirection
|
||||
model: ["AutoFlickDirection", "HorizontalFlick", "VerticalFlick", "HorizontalAndVerticalFlick"]
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
@@ -105,10 +104,9 @@ Section {
|
||||
ComboBox {
|
||||
backendValue: backendValues.boundsBehavior
|
||||
model: ["StopAtBounds", "DragOverBounds", "DragAndOvershootBounds"]
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
@@ -120,9 +118,7 @@ Section {
|
||||
ComboBox {
|
||||
backendValue: backendValues.boundsBehavior
|
||||
model: ["StopAtBounds", "DragOverBounds", "DragAndOvershootBounds"]
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ Section {
|
||||
property variant underlineStyle: backendValues.font_underline
|
||||
property variant strikeoutStyle: backendValues.font_strikeout
|
||||
|
||||
GridLayout {
|
||||
SectionLayout {
|
||||
columns: 2
|
||||
rows: 3
|
||||
Label {
|
||||
@@ -85,9 +85,9 @@ Section {
|
||||
onSelectionFlagChanged: {
|
||||
print("selection changed");
|
||||
isSetup = true;
|
||||
sizeType.currentText = "points";
|
||||
sizeType.currentIndex = 1
|
||||
if (pixelSize.isInModel)
|
||||
sizeType.currentText = "pixels";
|
||||
sizeType.currentIndex = 0
|
||||
isSetup = false;
|
||||
}
|
||||
|
||||
@@ -120,6 +120,8 @@ Section {
|
||||
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
style: CustomComboBoxStyle {
|
||||
}
|
||||
|
||||
|
||||
@@ -38,17 +38,18 @@ Controls.TextField {
|
||||
property variant backendValue
|
||||
property color borderColor: "#222"
|
||||
property color highlightColor: "orange"
|
||||
property color textColor: "#eee"
|
||||
property color textColor: colorLogic.textColor
|
||||
|
||||
// ExtendedFunctionButton {
|
||||
// x: 2
|
||||
// y: 2
|
||||
// backendValue: checkBox.backendValue
|
||||
// visible: spinBox.enabled
|
||||
// }
|
||||
ExtendedFunctionButton {
|
||||
x: 2
|
||||
y: 4
|
||||
backendValue: lineEdit.backendValue
|
||||
visible: lineEdit.enabled
|
||||
}
|
||||
|
||||
QtObject {
|
||||
property string valueFromBackend: lineEdit.backendValue.valueToString;
|
||||
ColorLogic {
|
||||
id: colorLogic
|
||||
backendValue: lineEdit.backendValue
|
||||
onValueFromBackendChanged: {
|
||||
lineEdit.text = valueFromBackend;
|
||||
}
|
||||
@@ -74,6 +75,8 @@ Controls.TextField {
|
||||
textColor: lineEdit.textColor
|
||||
padding.top: 3
|
||||
padding.bottom: 1
|
||||
padding.left: 16
|
||||
placeholderTextColor: "gray"
|
||||
background: Rectangle {
|
||||
implicitWidth: 100
|
||||
implicitHeight: 23
|
||||
|
||||
@@ -55,28 +55,32 @@ Rectangle {
|
||||
}
|
||||
|
||||
border.width: roundLeft || roundRight ? 1 : 0
|
||||
border.color: roundLeft ? "#7f7f7f" : "#2e2e2e"
|
||||
border.color: "#2e2e2e"
|
||||
|
||||
Rectangle {
|
||||
gradient: parent.gradient
|
||||
anchors.fill: parent
|
||||
visible: roundLeft
|
||||
visible: roundLeft && !roundRight
|
||||
anchors.leftMargin: 10
|
||||
anchors.topMargin: 1
|
||||
anchors.bottomMargin: 1
|
||||
Component.onCompleted: {
|
||||
gradient = parent.gradient
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
gradient: parent.gradient
|
||||
anchors.fill: parent
|
||||
visible: roundRight
|
||||
visible: roundRight && !roundLeft
|
||||
anchors.rightMargin: 10
|
||||
anchors.topMargin: 1
|
||||
anchors.bottomMargin: 1
|
||||
Component.onCompleted: {
|
||||
gradient = parent.gradient
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "#7f7f7f"
|
||||
color: "#2e2e2e"
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
@@ -94,4 +98,5 @@ Rectangle {
|
||||
anchors.leftMargin: roundLeft ? 2 : 0
|
||||
anchors.rightMargin: roundRight ? 2 : 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ Item {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "#666"
|
||||
color:"#333"
|
||||
width: parent.width
|
||||
height: 1
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@ Controls.SpinBox {
|
||||
id: spinBox
|
||||
property color borderColor: "#222"
|
||||
property color highlightColor: "orange"
|
||||
property color textColor: "#eee"
|
||||
|
||||
property color textColor: colorLogic.textColor
|
||||
property variant backendValue;
|
||||
prefix: " "
|
||||
|
||||
@@ -47,8 +46,9 @@ Controls.SpinBox {
|
||||
visible: spinBox.enabled
|
||||
}
|
||||
|
||||
QtObject {
|
||||
property int valueFromBackend: spinBox.backendValue.value;
|
||||
ColorLogic {
|
||||
id: colorLogic
|
||||
backendValue: spinBox.backendValue
|
||||
onValueFromBackendChanged: {
|
||||
spinBox.value = valueFromBackend;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ Section {
|
||||
property bool showVerticalAlignment: false
|
||||
property bool useLineEdit: true
|
||||
|
||||
GridLayout {
|
||||
SectionLayout {
|
||||
columns: 2
|
||||
rows: 3
|
||||
Label {
|
||||
@@ -60,6 +60,7 @@ Section {
|
||||
LineEdit {
|
||||
//visible: useLineEdit
|
||||
backendValue: backendValues.text
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
@@ -63,12 +63,6 @@ Controls.TabView {
|
||||
width: parent.width
|
||||
height: 1
|
||||
}
|
||||
Rectangle {
|
||||
color: "#333"
|
||||
width: parent.width
|
||||
height: 1
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ TabView 2.0 TabView.qml
|
||||
Tab 2.0 Tab.qml
|
||||
ScrollView 2.0 ScrollView.qml
|
||||
ComboBox 2.0 ComboBox.qml
|
||||
CustomComboBoxStyle 2.0 CustomComboBoxStyle.qml
|
||||
SectionLayout 2.0 SectionLayout.qml
|
||||
SecondColumnLayout 2.0 SecondColumnLayout.qml
|
||||
ExpandingSpacer 2.0 ExpandingSpacer.qml
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Label {
|
||||
text: "%1"
|
||||
toolTip: "%1"
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: backendValues.%2.value
|
||||
backendValue: backendValues.%2
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
Item {
|
||||
}
|
||||
|
||||
ColorEditor {
|
||||
caption: "%1"
|
||||
backendColor: backendValues.%2
|
||||
supportGradient: false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
Label {
|
||||
text: "%1"
|
||||
toolTip: "%1"
|
||||
}
|
||||
SpinBox {
|
||||
backendValue: backendValues.%2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
Label {
|
||||
text: "%1"
|
||||
toolTip: "%1"
|
||||
}
|
||||
SpinBox {
|
||||
backendValue: backendValues.%2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
Label {
|
||||
text: "%1"
|
||||
toolTip: "%1"
|
||||
}
|
||||
LineEdit {
|
||||
backendValue: backendValues.%2
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
AutoTypes {
|
||||
imports: [ "import HelperWidgets 2.0", "import QtQuick 2.1" ]
|
||||
|
||||
Type {
|
||||
typeNames: ["int"]
|
||||
sourceFile: "IntEditorTemplate.template"
|
||||
}
|
||||
Type {
|
||||
typeNames: ["real", "double", "qreal"]
|
||||
sourceFile: "RealEditorTemplate.template"
|
||||
}
|
||||
Type {
|
||||
typeNames: ["string", "QString"]
|
||||
sourceFile: "StringEditorTemplate.template"
|
||||
}
|
||||
Type {
|
||||
typeNames: ["QUrl", "url"]
|
||||
sourceFile: "UrlEditorTemplate.template"
|
||||
}
|
||||
Type {
|
||||
typeNames: ["bool", "boolean"]
|
||||
sourceFile: "BooleanEditorTemplate.template"
|
||||
}
|
||||
Type {
|
||||
typeNames: ["color", "QColor"]
|
||||
sourceFile: "ColorEditorTemplate.template"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
Label {
|
||||
text: "%1"
|
||||
toolTip: "%1"
|
||||
}
|
||||
LineEdit {
|
||||
backendValue: backendValues.%2
|
||||
}
|
||||
@@ -136,10 +136,7 @@ Column {
|
||||
model: ["Stretch", "Repeat", "Round"]
|
||||
backendValue: backendValues.horizontalTileMode
|
||||
implicitWidth: 180
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,11 +149,9 @@ Column {
|
||||
model: ["Stretch", "Repeat", "Round"]
|
||||
backendValue: backendValues.verticalTileMode
|
||||
implicitWidth: 180
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,11 +64,9 @@ Column {
|
||||
ComboBox {
|
||||
model: ["LeftToRight", "RightToLeft"]
|
||||
backendValue: backendValues.layoutDirection
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
@@ -46,7 +46,6 @@ Section {
|
||||
caption: qsTr("Geometry")
|
||||
|
||||
SectionLayout {
|
||||
columnSpacing: 6
|
||||
rowSpacing: 4
|
||||
rows: 2
|
||||
|
||||
@@ -55,6 +54,7 @@ Section {
|
||||
}
|
||||
|
||||
SecondColumnLayout {
|
||||
|
||||
Label {
|
||||
text: "X"
|
||||
width: 12
|
||||
@@ -67,6 +67,11 @@ Section {
|
||||
decimals: 0
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 4
|
||||
height: 4
|
||||
}
|
||||
|
||||
Label {
|
||||
text: "Y"
|
||||
width: 12
|
||||
@@ -78,7 +83,9 @@ Section {
|
||||
minimumValue: -0xffff
|
||||
decimals: 0
|
||||
}
|
||||
ExpandingSpacer{}
|
||||
ExpandingSpacer {
|
||||
|
||||
}
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Size")
|
||||
@@ -99,6 +106,11 @@ Section {
|
||||
decimals: 0
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 4
|
||||
height: 4
|
||||
}
|
||||
|
||||
Label {
|
||||
text: "H"
|
||||
width: 12
|
||||
@@ -110,7 +122,9 @@ Section {
|
||||
minimumValue: -0xffff
|
||||
decimals: 0
|
||||
}
|
||||
ExpandingSpacer{}
|
||||
ExpandingSpacer {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,10 +83,7 @@ Column {
|
||||
ComboBox {
|
||||
model: ["LeftToRight", "TopToBottom"]
|
||||
backendValue: backendValues.flow
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,11 +95,9 @@ Column {
|
||||
ComboBox {
|
||||
model: ["LeftToRight", "RightToLeft"]
|
||||
backendValue: backendValues.layoutDirection
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
@@ -109,10 +109,7 @@ Column {
|
||||
ComboBox {
|
||||
model: ["LeftToRight", "TopToBottom"]
|
||||
backendValue: backendValues.flow
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,10 +136,7 @@ Column {
|
||||
ComboBox {
|
||||
model: ["LeftToRight", "RightToLeft"]
|
||||
backendValue: backendValues.layoutDirection
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,10 +149,7 @@ Column {
|
||||
ComboBox {
|
||||
model: ["NoSnap", "SnapToRow", "SnapOneRow"]
|
||||
backendValue: backendValues.snapMode
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,10 +172,7 @@ Column {
|
||||
ComboBox {
|
||||
model: ["NoHighlightRange", "ApplyRange", "StrictlyEnforceRange"]
|
||||
backendValue: backendValues.highlightRangeMode
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ Column {
|
||||
model: ["Stretch", "PreserveAspectFit", "PreserveAspectCrop", "Tile", "TileVertically", "TileHorizontally"]
|
||||
backendValue: backendValues.fillMode
|
||||
implicitWidth: 180
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
@@ -54,14 +54,16 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
Label {
|
||||
text: backendValues.className.value
|
||||
width: lineEdit.width
|
||||
SecondColumnLayout {
|
||||
|
||||
Label {
|
||||
text: backendValues.className.value
|
||||
width: lineEdit.width
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("id")
|
||||
|
||||
}
|
||||
|
||||
SecondColumnLayout {
|
||||
@@ -135,6 +137,7 @@ Rectangle {
|
||||
minimumValue: 0
|
||||
maximumValue: 1
|
||||
hasSlider: true
|
||||
stepSize: 0.1
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
@@ -154,11 +157,13 @@ Rectangle {
|
||||
component: Column {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
// Loader {
|
||||
// id: specificsTwo;
|
||||
// baseUrl: globalBaseUrl;
|
||||
// qmlData: specificQmlData;
|
||||
// }
|
||||
Loader {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
id: specificsTwo;
|
||||
sourceComponent: specificQmlComponent
|
||||
}
|
||||
|
||||
Loader {
|
||||
anchors.left: parent.left
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
import QtQuick 2.0
|
||||
import HelperWidgets 2.0
|
||||
import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 1.0 as Controls
|
||||
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
@@ -62,7 +63,6 @@ Section {
|
||||
visible: anchorBackend.topAnchored;
|
||||
|
||||
IconLabel {
|
||||
|
||||
source: "../HelperWidgets/images/anchor-top.png"
|
||||
Layout.alignment: Qt.AlignTop
|
||||
}
|
||||
@@ -72,22 +72,25 @@ Section {
|
||||
rows: 2
|
||||
columns: 2
|
||||
|
||||
|
||||
Text {
|
||||
text: qsTr("Target")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
|
||||
TargetComboBox {
|
||||
targetName: anchorBackend.topTarget
|
||||
onCurrentTextChanged: {
|
||||
anchorBackend.topTarget = currentText
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
text: "Margin"
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
@@ -108,13 +111,10 @@ Section {
|
||||
iconSource: "../HelperWidgets/images/anchor-bottom.png"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RowLayout {
|
||||
visible: anchorBackend.bottomAnchored;
|
||||
anchors.left: parent.left
|
||||
@@ -130,22 +130,25 @@ Section {
|
||||
rows: 2
|
||||
columns: 2
|
||||
|
||||
|
||||
Text {
|
||||
text: qsTr("Target")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
|
||||
TargetComboBox {
|
||||
targetName: anchorBackend.bottomTarget
|
||||
onCurrentTextChanged: {
|
||||
anchorBackend.bottomTarget = currentText
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
text: qsTr("Margin")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
@@ -160,16 +163,13 @@ Section {
|
||||
exclusive: true
|
||||
ButtonRowButton {
|
||||
iconSource: "../HelperWidgets/images/anchor-top.png"
|
||||
|
||||
}
|
||||
|
||||
ButtonRowButton {
|
||||
iconSource: "../HelperWidgets/images/anchor-bottom.png"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,24 +188,25 @@ Section {
|
||||
rows: 2
|
||||
columns: 2
|
||||
|
||||
|
||||
Text {
|
||||
text: qsTr("Target")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
|
||||
TargetComboBox {
|
||||
targetName: anchorBackend.leftTarget
|
||||
onCurrentTextChanged: {
|
||||
anchorBackend.leftTarget = currentText
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
text: qsTr("Margin")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
@@ -213,7 +214,6 @@ Section {
|
||||
maximumValue: 0xffff
|
||||
minimumValue: -0xffff
|
||||
backendValue: backendValues.anchors_leftMargin
|
||||
|
||||
}
|
||||
|
||||
ButtonRow {
|
||||
@@ -227,9 +227,7 @@ Section {
|
||||
iconSource: "../HelperWidgets/images/anchor-right.png"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,24 +246,25 @@ Section {
|
||||
rows: 2
|
||||
columns: 2
|
||||
|
||||
|
||||
Text {
|
||||
text: qsTr("Target")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
|
||||
TargetComboBox {
|
||||
targetName: anchorBackend.rightTarget
|
||||
onCurrentTextChanged: {
|
||||
anchorBackend.rightTarget = currentText
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
text: qsTr("Margin")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
@@ -273,7 +272,6 @@ Section {
|
||||
maximumValue: 0xffff
|
||||
minimumValue: -0xffff
|
||||
backendValue: backendValues.anchors_rightMargin
|
||||
|
||||
}
|
||||
|
||||
ButtonRow {
|
||||
@@ -287,12 +285,122 @@ Section {
|
||||
iconSource: "../HelperWidgets/images/anchor-right.png"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
visible: anchorBackend.horizontalCentered;
|
||||
|
||||
IconLabel {
|
||||
source: "../HelperWidgets/images/anchor-horizontal.png"
|
||||
Layout.alignment: Qt.AlignTop
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
Layout.fillWidth: true
|
||||
rows: 2
|
||||
columns: 2
|
||||
|
||||
Text {
|
||||
text: qsTr("Target")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
TargetComboBox {
|
||||
targetName: anchorBackend.horizontalTarget
|
||||
onCurrentTextChanged: {
|
||||
anchorBackend.horizontalTarget = currentText
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("Margin")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
SpinBox {
|
||||
maximumValue: 0xffff
|
||||
minimumValue: -0xffff
|
||||
backendValue: backendValues.anchors_horizontalCenterOffset
|
||||
}
|
||||
|
||||
ButtonRow {
|
||||
exclusive: true
|
||||
|
||||
ButtonRowButton {
|
||||
iconSource: "../HelperWidgets/images/anchor-left.png"
|
||||
}
|
||||
|
||||
ButtonRowButton {
|
||||
iconSource: "../HelperWidgets/images/anchor-right.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
visible: anchorBackend.verticalCentered;
|
||||
|
||||
IconLabel {
|
||||
source: "../HelperWidgets/images/anchor-vertical.png"
|
||||
Layout.alignment: Qt.AlignTop
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
Layout.fillWidth: true
|
||||
rows: 2
|
||||
columns: 2
|
||||
|
||||
Text {
|
||||
text: qsTr("Target")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
TargetComboBox {
|
||||
targetName: anchorBackend.verticalTarget
|
||||
onCurrentTextChanged: {
|
||||
anchorBackend.verticalTarget = currentText
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("Margin")
|
||||
color: "#eee"
|
||||
elide: Text.ElideRight
|
||||
Layout.minimumWidth: 40
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
SpinBox {
|
||||
maximumValue: 0xffff
|
||||
minimumValue: -0xffff
|
||||
backendValue: backendValues.anchors_verticalCenterOffset
|
||||
}
|
||||
|
||||
ButtonRow {
|
||||
exclusive: true
|
||||
|
||||
ButtonRowButton {
|
||||
iconSource: "../HelperWidgets/images/anchor-top.png"
|
||||
}
|
||||
|
||||
ButtonRowButton {
|
||||
iconSource: "../HelperWidgets/images/anchor-bottom.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -89,11 +89,9 @@ Column {
|
||||
ComboBox {
|
||||
model: ["Horizontal", "Vertical"]
|
||||
backendValue: backendValues.orientation
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
@@ -49,10 +49,7 @@ Column {
|
||||
ComboBox {
|
||||
model: ["LeftToRight", "RightToLeft"]
|
||||
backendValue: backendValues.layoutDirection
|
||||
}
|
||||
|
||||
ExpandingSpacer {
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import HelperWidgets 2.0
|
||||
import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 1.0 as Controls
|
||||
|
||||
Controls.ComboBox {
|
||||
|
||||
property string targetName: anchorBackend.topTarget
|
||||
|
||||
id: targetComboBox
|
||||
|
||||
Connections {
|
||||
target: anchorBackend
|
||||
onInvalidated: {
|
||||
targetComboBox.currentIndex =
|
||||
anchorBackend.indexOfPossibleTargetItem(targetComboBox.targetName)
|
||||
}
|
||||
}
|
||||
|
||||
onTargetNameChanged: {
|
||||
targetComboBox.currentIndex =
|
||||
anchorBackend.indexOfPossibleTargetItem(targetComboBox.targetName)
|
||||
}
|
||||
|
||||
model: anchorBackend.possibleTargetItems
|
||||
|
||||
style: CustomComboBoxStyle {
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,11 @@ Column {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
StandardTextSection {
|
||||
showIsWrapping: true
|
||||
useLineEdit: true
|
||||
}
|
||||
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
@@ -60,12 +65,25 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
StandardTextSection {
|
||||
showIsWrapping: true
|
||||
useLineEdit: true
|
||||
}
|
||||
FontSection {
|
||||
showStyle: false
|
||||
}
|
||||
|
||||
FontSection {
|
||||
showStyle: false
|
||||
}
|
||||
Section {
|
||||
caption: qsTr("Text Input")
|
||||
SectionLayout {
|
||||
Label {
|
||||
text: qsTr("Format")
|
||||
}
|
||||
ComboBox {
|
||||
model: ["PlainText", "RichText", "AutoText"]
|
||||
backendValue: backendValues.textFormat
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextInputSection {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import HelperWidgets 2.0
|
||||
import QtQuick.Layouts 1.0
|
||||
|
||||
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
caption: qsTr("Text Input")
|
||||
|
||||
SectionLayout {
|
||||
rows: 4
|
||||
columns: 2
|
||||
|
||||
|
||||
Label {
|
||||
text: qsTr("Input mask")
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
backendValue: backendValues.inputMask
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label {
|
||||
visible: showVerticalAlignment
|
||||
text: qsTr("Echo mode")
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
visible: showVerticalAlignment
|
||||
Layout.fillWidth: true
|
||||
backendValue: backendValues.echoMode
|
||||
model: ["Normal", "Password", "PasswordEchoOnEdit", "NoEcho"]
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Pass. char")
|
||||
toolTip: qsTr("Character displayed when users enter passwords.")
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
backendValue: backendValues.passwordCharacter
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Flags")
|
||||
Layout.alignment: Qt.AlignTop
|
||||
}
|
||||
|
||||
SecondColumnLayout {
|
||||
ColumnLayout {
|
||||
CheckBox {
|
||||
text: qsTr("Read only")
|
||||
backendValue: backendValues.readOnly;
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: qsTr("Cursor visible")
|
||||
backendValue: backendValues.cursorVisible;
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: qsTr("Active focus on press")
|
||||
backendValue: backendValues.activeFocusOnPress;
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: qsTr("Auto scroll")
|
||||
backendValue: backendValues.autoScroll;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,11 @@ Column {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
StandardTextSection {
|
||||
useLineEdit: false
|
||||
showIsWrapping: false
|
||||
}
|
||||
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
@@ -60,12 +65,11 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
StandardTextSection {
|
||||
useLineEdit: false
|
||||
showIsWrapping: false
|
||||
}
|
||||
|
||||
FontSection {
|
||||
showStyle: false
|
||||
}
|
||||
|
||||
TextInputSection {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,12 @@ Column {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
StandardTextSection {
|
||||
useLineEdit: true
|
||||
showIsWrapping: true
|
||||
showVerticalAlignment: true
|
||||
}
|
||||
|
||||
Section {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
@@ -60,12 +66,6 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
StandardTextSection {
|
||||
useLineEdit: true
|
||||
showIsWrapping: true
|
||||
showVerticalAlignment: true
|
||||
}
|
||||
|
||||
FontSection {
|
||||
showStyle: true
|
||||
}
|
||||
|
||||
@@ -44,6 +44,14 @@ GroupBox {
|
||||
property variant underlineStyle: backendValues.font_underline
|
||||
property variant strikeoutStyle: backendValues.font_strikeout
|
||||
|
||||
onPointSizeChanged: {
|
||||
sizeWidget.setPointPixelSize();
|
||||
}
|
||||
|
||||
onPixelSizeChanged: {
|
||||
sizeWidget.setPointPixelSize();
|
||||
}
|
||||
|
||||
layout: VerticalLayout {
|
||||
|
||||
QWidget {
|
||||
@@ -61,17 +69,22 @@ GroupBox {
|
||||
QWidget {
|
||||
id: sizeWidget
|
||||
property bool selectionFlag: selectionChanged
|
||||
|
||||
|
||||
property bool pixelSize: sizeType.currentText == "pixels"
|
||||
property bool isSetup;
|
||||
|
||||
onSelectionFlagChanged: {
|
||||
|
||||
function setPointPixelSize() {
|
||||
isSetup = true;
|
||||
sizeType.currentText = "points";
|
||||
if (pixelSize.isInModel)
|
||||
if (fontGroupBox.pixelSize.isInModel)
|
||||
sizeType.currentText = "pixels";
|
||||
isSetup = false;
|
||||
}
|
||||
}
|
||||
|
||||
onSelectionFlagChanged: {
|
||||
setPointPixelSize();
|
||||
}
|
||||
|
||||
layout: HorizontalLayout {
|
||||
Label {
|
||||
text: qsTr("Size")
|
||||
|
||||
@@ -313,11 +313,6 @@ int main(int argc, char **argv)
|
||||
|
||||
#if QT_VERSION >= 0x050100
|
||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
if (Utils::HostOsInfo::isWindowsHost() || Utils::HostOsInfo::isMacHost()) {
|
||||
// Prevent native windows from being created for the sibling widgets of the welcome screen.
|
||||
// Causes flicker on Linux, though.
|
||||
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Manually determine -settingspath command line option
|
||||
|
||||
46
src/libs/3rdparty/cplusplus/TranslationUnit.cpp
vendored
@@ -40,6 +40,8 @@
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
const Token TranslationUnit::nullToken;
|
||||
|
||||
TranslationUnit::TranslationUnit(Control *control, const StringLiteral *fileId)
|
||||
: _control(control),
|
||||
_fileId(fileId),
|
||||
@@ -58,9 +60,7 @@ TranslationUnit::TranslationUnit(Control *control, const StringLiteral *fileId)
|
||||
TranslationUnit::~TranslationUnit()
|
||||
{
|
||||
(void) _control->switchTranslationUnit(_previousTranslationUnit);
|
||||
delete _tokens;
|
||||
delete _comments;
|
||||
delete _pool;
|
||||
release();
|
||||
}
|
||||
|
||||
Control *TranslationUnit::control() const
|
||||
@@ -95,7 +95,7 @@ const char *TranslationUnit::spell(unsigned index) const
|
||||
if (! index)
|
||||
return 0;
|
||||
|
||||
return _tokens->at(index).spell();
|
||||
return tokenAt(index).spell();
|
||||
}
|
||||
|
||||
unsigned TranslationUnit::commentCount() const
|
||||
@@ -105,19 +105,19 @@ const Token &TranslationUnit::commentAt(unsigned index) const
|
||||
{ return _comments->at(index); }
|
||||
|
||||
const Identifier *TranslationUnit::identifier(unsigned index) const
|
||||
{ return _tokens->at(index).identifier; }
|
||||
{ return tokenAt(index).identifier; }
|
||||
|
||||
const Literal *TranslationUnit::literal(unsigned index) const
|
||||
{ return _tokens->at(index).literal; }
|
||||
{ return tokenAt(index).literal; }
|
||||
|
||||
const StringLiteral *TranslationUnit::stringLiteral(unsigned index) const
|
||||
{ return _tokens->at(index).string; }
|
||||
{ return tokenAt(index).string; }
|
||||
|
||||
const NumericLiteral *TranslationUnit::numericLiteral(unsigned index) const
|
||||
{ return _tokens->at(index).number; }
|
||||
{ return tokenAt(index).number; }
|
||||
|
||||
unsigned TranslationUnit::matchingBrace(unsigned index) const
|
||||
{ return _tokens->at(index).close_brace; }
|
||||
{ return tokenAt(index).close_brace; }
|
||||
|
||||
MemoryPool *TranslationUnit::memoryPool() const
|
||||
{ return _pool; }
|
||||
@@ -143,7 +143,7 @@ void TranslationUnit::tokenize()
|
||||
lex.setScanCommentTokens(true);
|
||||
|
||||
std::stack<unsigned> braces;
|
||||
_tokens->push_back(Token()); // the first token needs to be invalid!
|
||||
_tokens->push_back(nullToken); // the first token needs to be invalid!
|
||||
|
||||
pushLineOffset(0);
|
||||
pushPreprocessorLine(0, 1, fileId());
|
||||
@@ -250,7 +250,8 @@ void TranslationUnit::tokenize()
|
||||
} else if (tk.f.kind == T_RBRACE && ! braces.empty()) {
|
||||
const unsigned open_brace_index = braces.top();
|
||||
braces.pop();
|
||||
(*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
|
||||
if (open_brace_index < tokenCount())
|
||||
(*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
|
||||
} else if (tk.isComment()) {
|
||||
_comments->push_back(tk);
|
||||
continue; // comments are not in the regular token stream
|
||||
@@ -507,13 +508,15 @@ void TranslationUnit::fatal(unsigned index, const char *format, ...)
|
||||
|
||||
unsigned TranslationUnit::findPreviousLineOffset(unsigned tokenIndex) const
|
||||
{
|
||||
unsigned lineOffset = _lineOffsets[findLineNumber(_tokens->at(tokenIndex).offset)];
|
||||
unsigned lineOffset = _lineOffsets[findLineNumber(tokenAt(tokenIndex).offset)];
|
||||
return lineOffset;
|
||||
}
|
||||
|
||||
bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex)
|
||||
{
|
||||
Token &tok = _tokens->at(tokenIndex);
|
||||
if (tokenIndex >= tokenCount())
|
||||
return false;
|
||||
Token &tok = (*_tokens)[tokenIndex];
|
||||
if (tok.kind() != T_GREATER_GREATER)
|
||||
return false;
|
||||
|
||||
@@ -538,9 +541,17 @@ bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex)
|
||||
return true;
|
||||
}
|
||||
|
||||
void TranslationUnit::releaseTokensAndComments()
|
||||
{
|
||||
delete _tokens;
|
||||
_tokens = 0;
|
||||
delete _comments;
|
||||
_comments = 0;
|
||||
}
|
||||
|
||||
void TranslationUnit::showErrorLine(unsigned index, unsigned column, FILE *out)
|
||||
{
|
||||
unsigned lineOffset = _lineOffsets[findLineNumber(_tokens->at(index).offset)];
|
||||
unsigned lineOffset = _lineOffsets[findLineNumber(tokenAt(index).offset)];
|
||||
for (const char *cp = _firstSourceChar + lineOffset + 1; *cp && *cp != '\n'; ++cp) {
|
||||
fputc(*cp, out);
|
||||
}
|
||||
@@ -567,10 +578,5 @@ void TranslationUnit::resetAST()
|
||||
void TranslationUnit::release()
|
||||
{
|
||||
resetAST();
|
||||
delete _tokens;
|
||||
_tokens = 0;
|
||||
delete _comments;
|
||||
_comments = 0;
|
||||
releaseTokensAndComments();
|
||||
}
|
||||
|
||||
|
||||
|
||||
11
src/libs/3rdparty/cplusplus/TranslationUnit.h
vendored
@@ -63,9 +63,11 @@ public:
|
||||
|
||||
void setSource(const char *source, unsigned size);
|
||||
|
||||
unsigned tokenCount() const { return unsigned(_tokens->size()); }
|
||||
const Token &tokenAt(unsigned index) const { return _tokens->at(index); }
|
||||
int tokenKind(unsigned index) const { return _tokens->at(index).f.kind; }
|
||||
unsigned tokenCount() const { return _tokens ? unsigned(_tokens->size()) : unsigned(0); }
|
||||
const Token &tokenAt(unsigned index) const
|
||||
{ return _tokens && index < tokenCount() ? (*_tokens)[index] : nullToken; }
|
||||
|
||||
int tokenKind(unsigned index) const { return tokenAt(index).f.kind; }
|
||||
const char *spell(unsigned index) const;
|
||||
|
||||
unsigned commentCount() const;
|
||||
@@ -167,11 +169,14 @@ private:
|
||||
{ return offset < other.offset; }
|
||||
};
|
||||
|
||||
void releaseTokensAndComments();
|
||||
unsigned findLineNumber(unsigned offset) const;
|
||||
unsigned findColumnNumber(unsigned offset, unsigned lineNumber) const;
|
||||
PPLine findPreprocessorLine(unsigned offset) const;
|
||||
void showErrorLine(unsigned index, unsigned column, FILE *out);
|
||||
|
||||
static const Token nullToken;
|
||||
|
||||
Control *_control;
|
||||
const StringLiteral *_fileId;
|
||||
const char *_firstSourceChar;
|
||||
|
||||
@@ -63,7 +63,11 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc, const QByteArray &source)
|
||||
if (Document::Ptr doc = _snapshot.document(fileName)) {
|
||||
_merged.insert(fileName);
|
||||
|
||||
mergeEnvironment(Preprocessor::configurationFileName);
|
||||
for (Snapshot::const_iterator i = _snapshot.begin(), ei = _snapshot.end(); i != ei; ++i) {
|
||||
if (isInjectedFile(i.key()))
|
||||
mergeEnvironment(i.key());
|
||||
}
|
||||
|
||||
foreach (const Document::Include &i, doc->resolvedIncludes())
|
||||
mergeEnvironment(i.resolvedFileName());
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
|
||||
#include <cplusplus/CPlusPlusForwardDeclarations.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QByteArray;
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace CPlusPlus {
|
||||
@@ -99,6 +99,11 @@ public:
|
||||
virtual void stopSkippingBlocks(unsigned offset) = 0;
|
||||
|
||||
virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode) = 0;
|
||||
|
||||
static inline bool isInjectedFile(const QString &fileName)
|
||||
{
|
||||
return fileName.startsWith(QLatin1Char('<')) && fileName.endsWith(QLatin1Char('>'));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
@@ -1079,11 +1079,13 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList<PluginSpec *> &queu
|
||||
// check for circular dependencies
|
||||
if (circularityCheckQueue.contains(spec)) {
|
||||
spec->d->hasError = true;
|
||||
spec->d->errorString = PluginManager::tr("Circular dependency detected:\n");
|
||||
spec->d->errorString = PluginManager::tr("Circular dependency detected:");
|
||||
spec->d->errorString += QLatin1Char('\n');
|
||||
int index = circularityCheckQueue.indexOf(spec);
|
||||
for (int i = index; i < circularityCheckQueue.size(); ++i) {
|
||||
spec->d->errorString.append(PluginManager::tr("%1(%2) depends on\n")
|
||||
spec->d->errorString.append(PluginManager::tr("%1(%2) depends on")
|
||||
.arg(circularityCheckQueue.at(i)->name()).arg(circularityCheckQueue.at(i)->version()));
|
||||
spec->d->errorString += QLatin1Char('\n');
|
||||
}
|
||||
spec->d->errorString.append(PluginManager::tr("%1(%2)").arg(spec->name()).arg(spec->version()));
|
||||
return false;
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "qmljsglobal_p.h"
|
||||
#include "qmljsastfwd_p.h"
|
||||
#include "qmljsmemorypool_p.h"
|
||||
#include <qmljs/qmljsconstants.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QSet>
|
||||
@@ -59,21 +60,19 @@ class MemoryPool;
|
||||
class QML_PARSER_EXPORT DiagnosticMessage
|
||||
{
|
||||
public:
|
||||
enum Kind { Warning, Error };
|
||||
|
||||
DiagnosticMessage()
|
||||
: kind(Error) {}
|
||||
: kind(Severity::Error) {}
|
||||
|
||||
DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message)
|
||||
DiagnosticMessage(Severity::Enum kind, const AST::SourceLocation &loc, const QString &message)
|
||||
: kind(kind), loc(loc), message(message) {}
|
||||
|
||||
bool isWarning() const
|
||||
{ return kind == Warning; }
|
||||
{ return kind == Severity::Warning; }
|
||||
|
||||
bool isError() const
|
||||
{ return kind == Error; }
|
||||
{ return kind == Severity::Error; }
|
||||
|
||||
Kind kind;
|
||||
Severity::Enum kind;
|
||||
AST::SourceLocation loc;
|
||||
QString message;
|
||||
};
|
||||
|
||||
@@ -289,7 +289,7 @@ case 20: {
|
||||
if (node) {
|
||||
node->importToken = loc(1);
|
||||
} else {
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
|
||||
diagnostic_messages.append(DiagnosticMessage(Severity::Error, loc(1),
|
||||
QLatin1String("Expected a qualified name id or a string literal")));
|
||||
|
||||
return false; // ### remove me
|
||||
@@ -583,7 +583,7 @@ case 78: {
|
||||
case 79: {
|
||||
bool rx = lexer->scanRegExp(Lexer::NoPrefix);
|
||||
if (!rx) {
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
||||
diagnostic_messages.append(DiagnosticMessage(Severity::Error, location(lexer), lexer->errorMessage()));
|
||||
return false; // ### remove me
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ case 79: {
|
||||
case 80: {
|
||||
bool rx = lexer->scanRegExp(Lexer::EqualPrefix);
|
||||
if (!rx) {
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
||||
diagnostic_messages.append(DiagnosticMessage(Severity::Error, location(lexer), lexer->errorMessage()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -680,7 +680,7 @@ case 88: {
|
||||
|
||||
case 89: {
|
||||
if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) {
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken,
|
||||
diagnostic_messages.append(DiagnosticMessage(Severity::Warning, mem->lbracketToken,
|
||||
QLatin1String("Ignored annotation")));
|
||||
|
||||
sym(1).Expression = mem->base;
|
||||
@@ -691,7 +691,7 @@ case 89: {
|
||||
} else {
|
||||
sym(1).UiQualifiedId = 0;
|
||||
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
|
||||
diagnostic_messages.append(DiagnosticMessage(Severity::Error, loc(1),
|
||||
QLatin1String("Expected a qualified name id")));
|
||||
|
||||
return false; // ### recover
|
||||
@@ -1747,7 +1747,7 @@ case 347: {
|
||||
msg = qApp->translate("QmlParser", "Syntax error");
|
||||
else
|
||||
msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
||||
diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg));
|
||||
|
||||
action = errorState;
|
||||
goto _Lcheck_token;
|
||||
@@ -1775,7 +1775,7 @@ case 347: {
|
||||
int a = t_action(errorState, *tk);
|
||||
if (a > 0 && t_action(a, yytoken)) {
|
||||
const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
||||
diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg));
|
||||
|
||||
yytoken = *tk;
|
||||
yylval = 0;
|
||||
@@ -1799,7 +1799,7 @@ case 347: {
|
||||
int a = t_action(errorState, tk);
|
||||
if (a > 0 && t_action(a, yytoken)) {
|
||||
const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
||||
diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg));
|
||||
|
||||
yytoken = tk;
|
||||
yylval = 0;
|
||||
@@ -1812,7 +1812,7 @@ case 347: {
|
||||
}
|
||||
|
||||
const QString msg = qApp->translate("QmlParser", "Syntax error");
|
||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
|
||||
diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
inline DiagnosticMessage diagnosticMessage() const
|
||||
{
|
||||
foreach (const DiagnosticMessage &d, diagnostic_messages) {
|
||||
if (d.kind != DiagnosticMessage::Warning)
|
||||
if (d.kind != Severity::Warning)
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ HEADERS += \
|
||||
$$PWD/iscriptevaluator.h \
|
||||
$$PWD/qmljssimplereader.h \
|
||||
$$PWD/persistenttrie.h \
|
||||
$$PWD/qmljsqrcparser.h
|
||||
$$PWD/qmljsqrcparser.h \
|
||||
$$PWD/qmljsconstants.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/qmljsbind.cpp \
|
||||
|
||||
@@ -28,6 +28,7 @@ QtcLibrary {
|
||||
"qmljscheck.cpp", "qmljscheck.h",
|
||||
"qmljscodeformatter.cpp", "qmljscodeformatter.h",
|
||||
"qmljscompletioncontextfinder.cpp", "qmljscompletioncontextfinder.h",
|
||||
"qmljsconstants.h",
|
||||
"qmljscontext.cpp", "qmljscontext.h",
|
||||
"qmljsdelta.cpp", "qmljsdelta.h",
|
||||
"qmljsdocument.cpp", "qmljsdocument.h",
|
||||
|
||||
@@ -204,17 +204,17 @@ bool Bind::visit(UiImport *ast)
|
||||
const QString importId = ast->importId.toString();
|
||||
ImportInfo import = ImportInfo::moduleImport(toString(ast->importUri), version,
|
||||
importId, ast);
|
||||
if (_doc->language() == Document::QmlLanguage) {
|
||||
if (_doc->language() == Language::Qml) {
|
||||
const QString importStr = import.name() + importId;
|
||||
QmlLanguageBundles langBundles = ModelManagerInterface::instance()->extendedBundles();
|
||||
QmlBundle qq1 = langBundles.bundleForLanguage(Document::QmlQtQuick1Language);
|
||||
QmlBundle qq2 = langBundles.bundleForLanguage(Document::QmlQtQuick2Language);
|
||||
QmlBundle qq1 = langBundles.bundleForLanguage(Language::QmlQtQuick1);
|
||||
QmlBundle qq2 = langBundles.bundleForLanguage(Language::QmlQtQuick2);
|
||||
bool isQQ1 = qq1.supportedImports().contains(importStr);
|
||||
bool isQQ2 = qq2.supportedImports().contains(importStr);
|
||||
if (isQQ1 && ! isQQ2)
|
||||
_doc->setLanguage(Document::QmlQtQuick1Language);
|
||||
_doc->setLanguage(Language::QmlQtQuick1);
|
||||
if (isQQ2 && ! isQQ1)
|
||||
_doc->setLanguage(Document::QmlQtQuick2Language);
|
||||
_doc->setLanguage(Language::QmlQtQuick2);
|
||||
}
|
||||
_imports += import;
|
||||
} else if (!ast->fileName.isEmpty()) {
|
||||
|
||||
@@ -288,14 +288,14 @@ bool QmlBundle::readFrom(QString path, QStringList *errors)
|
||||
return errs.isEmpty();
|
||||
}
|
||||
|
||||
QmlBundle QmlLanguageBundles::bundleForLanguage(Document::Language l) const
|
||||
QmlBundle QmlLanguageBundles::bundleForLanguage(Language::Enum l) const
|
||||
{
|
||||
if (m_bundles.contains(l))
|
||||
return m_bundles.value(l);
|
||||
return QmlBundle();
|
||||
}
|
||||
|
||||
void QmlLanguageBundles::mergeBundleForLanguage(Document::Language l, const QmlBundle &bundle)
|
||||
void QmlLanguageBundles::mergeBundleForLanguage(Language::Enum l, const QmlBundle &bundle)
|
||||
{
|
||||
if (bundle.isEmpty())
|
||||
return;
|
||||
@@ -305,14 +305,14 @@ void QmlLanguageBundles::mergeBundleForLanguage(Document::Language l, const QmlB
|
||||
m_bundles.insert(l,bundle);
|
||||
}
|
||||
|
||||
QList<Document::Language> QmlLanguageBundles::languages() const
|
||||
QList<Language::Enum> QmlLanguageBundles::languages() const
|
||||
{
|
||||
return m_bundles.keys();
|
||||
}
|
||||
|
||||
void QmlLanguageBundles::mergeLanguageBundles(const QmlLanguageBundles &o)
|
||||
{
|
||||
foreach (Document::Language l, o.languages())
|
||||
foreach (Language::Enum l, o.languages())
|
||||
mergeBundleForLanguage(l, o.bundleForLanguage(l));
|
||||
}
|
||||
|
||||
|
||||
@@ -102,12 +102,12 @@ private:
|
||||
class QMLJS_EXPORT QmlLanguageBundles
|
||||
{
|
||||
public:
|
||||
QmlBundle bundleForLanguage(Document::Language l) const;
|
||||
void mergeBundleForLanguage(Document::Language l, const QmlBundle &bundle);
|
||||
QList<Document::Language> languages() const;
|
||||
QmlBundle bundleForLanguage(Language::Enum l) const;
|
||||
void mergeBundleForLanguage(Language::Enum l, const QmlBundle &bundle);
|
||||
QList<Language::Enum> languages() const;
|
||||
void mergeLanguageBundles(const QmlLanguageBundles &);
|
||||
private:
|
||||
QHash<Document::Language,QmlBundle> m_bundles;
|
||||
QHash<Language::Enum,QmlBundle> m_bundles;
|
||||
};
|
||||
} // namespace QmlJS
|
||||
|
||||
|
||||
76
src/libs/qmljs/qmljsconstants.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QMLJSCONSTANTS_H
|
||||
#define QMLJSCONSTANTS_H
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
namespace ImportType {
|
||||
enum Enum {
|
||||
Invalid,
|
||||
ImplicitDirectory,
|
||||
Library,
|
||||
File,
|
||||
Directory,
|
||||
QrcFile,
|
||||
QrcDirectory,
|
||||
ImplicitQrcDirectory,
|
||||
UnknownFile // refers a file/directory that wasn't found
|
||||
};
|
||||
}
|
||||
|
||||
namespace Severity {
|
||||
enum Enum
|
||||
{
|
||||
Hint, // cosmetic or convention
|
||||
MaybeWarning, // possibly a warning, insufficient information
|
||||
Warning, // could cause unintended behavior
|
||||
MaybeError, // possibly an error, insufficient information
|
||||
Error // definitely an error
|
||||
};
|
||||
}
|
||||
|
||||
namespace Language {
|
||||
enum Enum
|
||||
{
|
||||
Unknown = 0,
|
||||
JavaScript = 1,
|
||||
Json = 2,
|
||||
Qml = 3,
|
||||
QmlQtQuick1 = 4,
|
||||
QmlQtQuick2 = 5,
|
||||
QmlQbs = 6,
|
||||
QmlProject = 7,
|
||||
QmlTypeInfo = 8
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace QmlJS
|
||||
#endif // QMLJSCONSTANTS_H
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "qmljsdocument.h"
|
||||
#include "qmljsbind.h"
|
||||
#include "qmljsconstants.h"
|
||||
#include <qmljs/parser/qmljslexer_p.h>
|
||||
#include <qmljs/parser/qmljsparser_p.h>
|
||||
|
||||
@@ -81,56 +82,56 @@ using namespace QmlJS::AST;
|
||||
*/
|
||||
|
||||
|
||||
bool Document::isQmlLikeLanguage(Document::Language language)
|
||||
bool Document::isQmlLikeLanguage(Language::Enum language)
|
||||
{
|
||||
switch (language) {
|
||||
case QmlLanguage:
|
||||
case QmlQtQuick1Language:
|
||||
case QmlQtQuick2Language:
|
||||
case QmlQbsLanguage:
|
||||
case QmlProjectLanguage:
|
||||
case QmlTypeInfoLanguage:
|
||||
case Language::Qml:
|
||||
case Language::QmlQtQuick1:
|
||||
case Language::QmlQtQuick2:
|
||||
case Language::QmlQbs:
|
||||
case Language::QmlProject:
|
||||
case Language::QmlTypeInfo:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Document::isFullySupportedLanguage(Document::Language language)
|
||||
bool Document::isFullySupportedLanguage(Language::Enum language)
|
||||
{
|
||||
switch (language) {
|
||||
case JavaScriptLanguage:
|
||||
case JsonLanguage:
|
||||
case QmlLanguage:
|
||||
case QmlQtQuick1Language:
|
||||
case QmlQtQuick2Language:
|
||||
case Language::JavaScript:
|
||||
case Language::Json:
|
||||
case Language::Qml:
|
||||
case Language::QmlQtQuick1:
|
||||
case Language::QmlQtQuick2:
|
||||
return true;
|
||||
case UnknownLanguage:
|
||||
case QmlQbsLanguage:
|
||||
case QmlProjectLanguage:
|
||||
case QmlTypeInfoLanguage:
|
||||
case Language::Unknown:
|
||||
case Language::QmlQbs:
|
||||
case Language::QmlProject:
|
||||
case Language::QmlTypeInfo:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Document::isQmlLikeOrJsLanguage(Document::Language language)
|
||||
bool Document::isQmlLikeOrJsLanguage(Language::Enum language)
|
||||
{
|
||||
switch (language) {
|
||||
case QmlLanguage:
|
||||
case QmlQtQuick1Language:
|
||||
case QmlQtQuick2Language:
|
||||
case QmlQbsLanguage:
|
||||
case QmlProjectLanguage:
|
||||
case QmlTypeInfoLanguage:
|
||||
case JavaScriptLanguage:
|
||||
case Language::Qml:
|
||||
case Language::QmlQtQuick1:
|
||||
case Language::QmlQtQuick2:
|
||||
case Language::QmlQbs:
|
||||
case Language::QmlProject:
|
||||
case Language::QmlTypeInfo:
|
||||
case Language::JavaScript:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Document::Document(const QString &fileName, Language language)
|
||||
Document::Document(const QString &fileName, Language::Enum language)
|
||||
: _engine(0)
|
||||
, _ast(0)
|
||||
, _bind(0)
|
||||
@@ -163,24 +164,24 @@ Document::~Document()
|
||||
delete _engine;
|
||||
}
|
||||
|
||||
Document::MutablePtr Document::create(const QString &fileName, Language language)
|
||||
Document::MutablePtr Document::create(const QString &fileName, Language::Enum language)
|
||||
{
|
||||
Document::MutablePtr doc(new Document(fileName, language));
|
||||
doc->_ptr = doc;
|
||||
return doc;
|
||||
}
|
||||
|
||||
Document::Language Document::guessLanguageFromSuffix(const QString &fileName)
|
||||
Language::Enum Document::guessLanguageFromSuffix(const QString &fileName)
|
||||
{
|
||||
if (fileName.endsWith(QLatin1String(".qml"), Qt::CaseInsensitive))
|
||||
return QmlLanguage;
|
||||
return Language::Qml;
|
||||
if (fileName.endsWith(QLatin1String(".qbs"), Qt::CaseInsensitive))
|
||||
return QmlQbsLanguage;
|
||||
return Language::QmlQbs;
|
||||
if (fileName.endsWith(QLatin1String(".js"), Qt::CaseInsensitive))
|
||||
return JavaScriptLanguage;
|
||||
return Language::JavaScript;
|
||||
if (fileName.endsWith(QLatin1String(".json"), Qt::CaseInsensitive))
|
||||
return JsonLanguage;
|
||||
return UnknownLanguage;
|
||||
return Language::Json;
|
||||
return Language::Unknown;
|
||||
}
|
||||
|
||||
Document::Ptr Document::ptr() const
|
||||
@@ -193,12 +194,12 @@ bool Document::isQmlDocument() const
|
||||
return isQmlLikeLanguage(_language);
|
||||
}
|
||||
|
||||
Document::Language Document::language() const
|
||||
Language::Enum Document::language() const
|
||||
{
|
||||
return _language;
|
||||
}
|
||||
|
||||
void Document::setLanguage(Document::Language l)
|
||||
void Document::setLanguage(Language::Enum l)
|
||||
{
|
||||
_language = l;
|
||||
}
|
||||
@@ -428,7 +429,7 @@ void Snapshot::remove(const QString &fileName)
|
||||
|
||||
Document::MutablePtr Snapshot::documentFromSource(
|
||||
const QString &code, const QString &fileName,
|
||||
Document::Language language) const
|
||||
Language::Enum language) const
|
||||
{
|
||||
Document::MutablePtr newDoc = Document::create(fileName, language);
|
||||
|
||||
|
||||
@@ -50,36 +50,23 @@ public:
|
||||
typedef QSharedPointer<const Document> Ptr;
|
||||
typedef QSharedPointer<Document> MutablePtr;
|
||||
|
||||
enum Language
|
||||
{
|
||||
UnknownLanguage = 0,
|
||||
JavaScriptLanguage = 1,
|
||||
JsonLanguage = 2,
|
||||
QmlLanguage = 3,
|
||||
QmlQtQuick1Language = 4,
|
||||
QmlQtQuick2Language = 5,
|
||||
QmlQbsLanguage = 6,
|
||||
QmlProjectLanguage = 7,
|
||||
QmlTypeInfoLanguage = 8
|
||||
};
|
||||
|
||||
static bool isQmlLikeLanguage(Language languge);
|
||||
static bool isFullySupportedLanguage(Language language);
|
||||
static bool isQmlLikeOrJsLanguage(Language language);
|
||||
static bool isQmlLikeLanguage(Language::Enum languge);
|
||||
static bool isFullySupportedLanguage(Language::Enum language);
|
||||
static bool isQmlLikeOrJsLanguage(Language::Enum language);
|
||||
protected:
|
||||
Document(const QString &fileName, Language language);
|
||||
Document(const QString &fileName, Language::Enum language);
|
||||
|
||||
public:
|
||||
~Document();
|
||||
|
||||
static MutablePtr create(const QString &fileName, Language language);
|
||||
static Language guessLanguageFromSuffix(const QString &fileName);
|
||||
static MutablePtr create(const QString &fileName, Language::Enum language);
|
||||
static Language::Enum guessLanguageFromSuffix(const QString &fileName);
|
||||
|
||||
Document::Ptr ptr() const;
|
||||
|
||||
bool isQmlDocument() const;
|
||||
Language language() const;
|
||||
void setLanguage(Language l);
|
||||
Language::Enum language() const;
|
||||
void setLanguage(Language::Enum l);
|
||||
|
||||
AST::UiProgram *qmlProgram() const;
|
||||
AST::Program *jsProgram() const;
|
||||
@@ -124,7 +111,7 @@ private:
|
||||
QString _source;
|
||||
QWeakPointer<Document> _ptr;
|
||||
int _editorRevision;
|
||||
Language _language;
|
||||
Language::Enum _language;
|
||||
bool _parsedCorrectly;
|
||||
|
||||
// for documentFromSource
|
||||
@@ -237,7 +224,7 @@ public:
|
||||
|
||||
Document::MutablePtr documentFromSource(const QString &code,
|
||||
const QString &fileName,
|
||||
Document::Language language) const;
|
||||
Language::Enum language) const;
|
||||
};
|
||||
|
||||
} // namespace QmlJS
|
||||
|
||||
@@ -2074,7 +2074,7 @@ bool ASTSignal::getSourceLocation(QString *fileName, int *line, int *column) con
|
||||
|
||||
|
||||
ImportInfo::ImportInfo()
|
||||
: _type(InvalidImport)
|
||||
: _type(ImportType::Invalid)
|
||||
, _ast(0)
|
||||
{
|
||||
}
|
||||
@@ -2089,7 +2089,7 @@ ImportInfo ImportInfo::moduleImport(QString uri, ComponentVersion version,
|
||||
}
|
||||
|
||||
ImportInfo info;
|
||||
info._type = LibraryImport;
|
||||
info._type = ImportType::Library;
|
||||
info._name = uri;
|
||||
info._path = uri;
|
||||
info._path.replace(QLatin1Char('.'), QDir::separator());
|
||||
@@ -2111,17 +2111,17 @@ ImportInfo ImportInfo::pathImport(const QString &docPath, const QString &path,
|
||||
info._path = importFileInfo.absoluteFilePath();
|
||||
|
||||
if (importFileInfo.isFile()) {
|
||||
info._type = FileImport;
|
||||
info._type = ImportType::File;
|
||||
} else if (importFileInfo.isDir()) {
|
||||
info._type = DirectoryImport;
|
||||
info._type = ImportType::Directory;
|
||||
} else if (path.startsWith(QLatin1String("qrc:"))) {
|
||||
info._path = path;
|
||||
if (ModelManagerInterface::instance()->filesAtQrcPath(info.path()).isEmpty())
|
||||
info._type = QrcDirectoryImport;
|
||||
info._type = ImportType::QrcDirectory;
|
||||
else
|
||||
info._type = QrcFileImport;
|
||||
info._type = ImportType::QrcFile;
|
||||
} else {
|
||||
info._type = UnknownFileImport;
|
||||
info._type = ImportType::UnknownFile;
|
||||
}
|
||||
info._version = version;
|
||||
info._as = as;
|
||||
@@ -2132,7 +2132,7 @@ ImportInfo ImportInfo::pathImport(const QString &docPath, const QString &path,
|
||||
ImportInfo ImportInfo::invalidImport(UiImport *ast)
|
||||
{
|
||||
ImportInfo info;
|
||||
info._type = InvalidImport;
|
||||
info._type = ImportType::Invalid;
|
||||
info._ast = ast;
|
||||
return info;
|
||||
}
|
||||
@@ -2140,17 +2140,17 @@ ImportInfo ImportInfo::invalidImport(UiImport *ast)
|
||||
ImportInfo ImportInfo::implicitDirectoryImport(const QString &directory)
|
||||
{
|
||||
ImportInfo info;
|
||||
info._type = ImplicitDirectoryImport;
|
||||
info._type = ImportType::ImplicitDirectory;
|
||||
info._path = directory;
|
||||
return info;
|
||||
}
|
||||
|
||||
bool ImportInfo::isValid() const
|
||||
{
|
||||
return _type != InvalidImport;
|
||||
return _type != ImportType::Invalid;
|
||||
}
|
||||
|
||||
ImportInfo::Type ImportInfo::type() const
|
||||
ImportType::Enum ImportInfo::type() const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
@@ -2181,9 +2181,14 @@ UiImport *ImportInfo::ast() const
|
||||
}
|
||||
|
||||
Import::Import()
|
||||
: object(0)
|
||||
: object(0), valid(false), used(false)
|
||||
{}
|
||||
|
||||
Import::Import(const Import &other)
|
||||
: object(other.object), info(other.info), libraryPath(other.libraryPath),
|
||||
valid(other.valid), used(false)
|
||||
{ }
|
||||
|
||||
TypeScope::TypeScope(const Imports *imports, ValueOwner *valueOwner)
|
||||
: ObjectValue(valueOwner)
|
||||
, _imports(imports)
|
||||
@@ -2201,13 +2206,14 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
// JS import has no types
|
||||
if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport)
|
||||
if (info.type() == ImportType::File || info.type() == ImportType::QrcFile)
|
||||
continue;
|
||||
|
||||
if (!info.as().isEmpty()) {
|
||||
if (info.as() == name) {
|
||||
if (foundInObject)
|
||||
*foundInObject = this;
|
||||
i.used = true;
|
||||
return import;
|
||||
}
|
||||
continue;
|
||||
@@ -2231,7 +2237,7 @@ void TypeScope::processMembers(MemberProcessor *processor) const
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
// JS import has no types
|
||||
if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport)
|
||||
if (info.type() == ImportType::File || info.type() == ImportType::QrcFile)
|
||||
continue;
|
||||
|
||||
if (!info.as().isEmpty())
|
||||
@@ -2258,12 +2264,13 @@ const Value *JSImportScope::lookupMember(const QString &name, const Context *,
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
// JS imports are always: import "somefile.js" as Foo
|
||||
if (info.type() != ImportInfo::FileImport && info.type() != ImportInfo::QrcFileImport)
|
||||
if (info.type() != ImportType::File && info.type() != ImportType::QrcFile)
|
||||
continue;
|
||||
|
||||
if (info.as() == name) {
|
||||
if (foundInObject)
|
||||
*foundInObject = this;
|
||||
i.used = true;
|
||||
return import;
|
||||
}
|
||||
}
|
||||
@@ -2281,7 +2288,7 @@ void JSImportScope::processMembers(MemberProcessor *processor) const
|
||||
const ObjectValue *import = i.object;
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport)
|
||||
if (info.type() == ImportType::File || info.type() == ImportType::QrcFile)
|
||||
processor->processProperty(info.as(), import);
|
||||
}
|
||||
}
|
||||
@@ -2338,7 +2345,7 @@ ImportInfo Imports::info(const QString &name, const Context *context) const
|
||||
continue;
|
||||
}
|
||||
|
||||
if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport) {
|
||||
if (info.type() == ImportType::File || info.type() == ImportType::QrcFile) {
|
||||
if (import->className() == firstId)
|
||||
return info;
|
||||
} else {
|
||||
@@ -2358,7 +2365,7 @@ QString Imports::nameForImportedObject(const ObjectValue *value, const Context *
|
||||
const ObjectValue *import = i.object;
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport) {
|
||||
if (info.type() == ImportType::File || info.type() == ImportType::QrcFile) {
|
||||
if (import == value)
|
||||
return import->className();
|
||||
} else {
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <qmljs/qmljsdocument.h>
|
||||
#include <qmljs/qmljs_global.h>
|
||||
#include <qmljs/qmljsconstants.h>
|
||||
|
||||
#include <QFileInfoList>
|
||||
#include <QList>
|
||||
@@ -39,6 +40,7 @@
|
||||
#include <QHash>
|
||||
#include <QSet>
|
||||
#include <QMutex>
|
||||
#include <QSharedPointer>
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
@@ -866,17 +868,6 @@ public:
|
||||
class QMLJS_EXPORT ImportInfo
|
||||
{
|
||||
public:
|
||||
enum Type {
|
||||
InvalidImport,
|
||||
ImplicitDirectoryImport,
|
||||
LibraryImport,
|
||||
FileImport,
|
||||
DirectoryImport,
|
||||
QrcFileImport,
|
||||
QrcDirectoryImport,
|
||||
UnknownFileImport // refers a file/directory that wasn't found
|
||||
};
|
||||
|
||||
ImportInfo();
|
||||
|
||||
static ImportInfo moduleImport(QString uri, LanguageUtils::ComponentVersion version,
|
||||
@@ -888,7 +879,7 @@ public:
|
||||
static ImportInfo implicitDirectoryImport(const QString &directory);
|
||||
|
||||
bool isValid() const;
|
||||
Type type() const;
|
||||
ImportType::Enum type() const;
|
||||
|
||||
// LibraryImport: uri with ',' separator
|
||||
// Other: non-absolute path
|
||||
@@ -905,7 +896,7 @@ public:
|
||||
AST::UiImport *ast() const;
|
||||
|
||||
private:
|
||||
Type _type;
|
||||
ImportType::Enum _type;
|
||||
LanguageUtils::ComponentVersion _version;
|
||||
QString _name;
|
||||
QString _path;
|
||||
@@ -916,6 +907,7 @@ private:
|
||||
class QMLJS_EXPORT Import {
|
||||
public:
|
||||
Import();
|
||||
Import(const Import &other);
|
||||
|
||||
// const!
|
||||
ObjectValue *object;
|
||||
@@ -924,6 +916,7 @@ public:
|
||||
QString libraryPath;
|
||||
// whether the import succeeded
|
||||
bool valid;
|
||||
mutable bool used;
|
||||
};
|
||||
|
||||
class Imports;
|
||||
|
||||
@@ -244,16 +244,16 @@ void LinkPrivate::populateImportedTypes(Imports *imports, Document::Ptr doc)
|
||||
|
||||
if (!import.object) {
|
||||
switch (info.type()) {
|
||||
case ImportInfo::FileImport:
|
||||
case ImportInfo::DirectoryImport:
|
||||
case ImportInfo::QrcFileImport:
|
||||
case ImportInfo::QrcDirectoryImport:
|
||||
case ImportType::File:
|
||||
case ImportType::Directory:
|
||||
case ImportType::QrcFile:
|
||||
case ImportType::QrcDirectory:
|
||||
import = importFileOrDirectory(doc, info);
|
||||
break;
|
||||
case ImportInfo::LibraryImport:
|
||||
case ImportType::Library:
|
||||
import = importNonFile(doc, info);
|
||||
break;
|
||||
case ImportInfo::UnknownFileImport:
|
||||
case ImportType::UnknownFile:
|
||||
imports->setImportFailed();
|
||||
if (info.ast()) {
|
||||
error(doc, info.ast()->fileNameToken,
|
||||
@@ -290,8 +290,8 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
|
||||
|
||||
QString path = importInfo.path();
|
||||
|
||||
if (importInfo.type() == ImportInfo::DirectoryImport
|
||||
|| importInfo.type() == ImportInfo::ImplicitDirectoryImport) {
|
||||
if (importInfo.type() == ImportType::Directory
|
||||
|| importInfo.type() == ImportType::ImplicitDirectory) {
|
||||
import.object = new ObjectValue(valueOwner);
|
||||
|
||||
importLibrary(doc, path, &import);
|
||||
@@ -303,11 +303,11 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
|
||||
import.object->setMember(targetName, importedDoc->bind()->rootObjectValue());
|
||||
}
|
||||
}
|
||||
} else if (importInfo.type() == ImportInfo::FileImport) {
|
||||
} else if (importInfo.type() == ImportType::File) {
|
||||
Document::Ptr importedDoc = snapshot.document(path);
|
||||
if (importedDoc)
|
||||
import.object = importedDoc->bind()->rootObjectValue();
|
||||
} else if (importInfo.type() == ImportInfo::QrcFileImport) {
|
||||
} else if (importInfo.type() == ImportType::QrcFile) {
|
||||
QLocale locale;
|
||||
QStringList filePaths = ModelManagerInterface::instance()
|
||||
->filesAtQrcPath(path, &locale, 0, ModelManagerInterface::ActiveQrcResources);
|
||||
@@ -319,7 +319,7 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
|
||||
if (importedDoc)
|
||||
import.object = importedDoc->bind()->rootObjectValue();
|
||||
}
|
||||
} else if (importInfo.type() == ImportInfo::QrcDirectoryImport){
|
||||
} else if (importInfo.type() == ImportType::QrcDirectory){
|
||||
import.object = new ObjectValue(valueOwner);
|
||||
|
||||
importLibrary(doc, path, &import);
|
||||
@@ -454,7 +454,7 @@ bool LinkPrivate::importLibrary(Document::Ptr doc,
|
||||
if (libraryInfo.pluginTypeInfoStatus() == LibraryInfo::NoTypeInfo) {
|
||||
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
||||
if (modelManager) {
|
||||
if (importInfo.type() == ImportInfo::LibraryImport) {
|
||||
if (importInfo.type() == ImportType::Library) {
|
||||
if (version.isValid()) {
|
||||
const QString uri = importInfo.name();
|
||||
modelManager->loadPluginTypes(
|
||||
@@ -510,12 +510,12 @@ bool LinkPrivate::importLibrary(Document::Ptr doc,
|
||||
|
||||
void LinkPrivate::error(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message)
|
||||
{
|
||||
appendDiagnostic(doc, DiagnosticMessage(DiagnosticMessage::Error, loc, message));
|
||||
appendDiagnostic(doc, DiagnosticMessage(Severity::Error, loc, message));
|
||||
}
|
||||
|
||||
void LinkPrivate::warning(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message)
|
||||
{
|
||||
appendDiagnostic(doc, DiagnosticMessage(DiagnosticMessage::Warning, loc, message));
|
||||
appendDiagnostic(doc, DiagnosticMessage(Severity::Warning, loc, message));
|
||||
}
|
||||
|
||||
void LinkPrivate::appendDiagnostic(const Document::Ptr &doc, const DiagnosticMessage &message)
|
||||
|
||||
@@ -258,7 +258,7 @@ void ScopeChain::update() const
|
||||
m_all += m_cppContextProperties;
|
||||
|
||||
// the root scope in js files doesn't see instantiating components
|
||||
if (m_document->language() != Document::JavaScriptLanguage || m_jsScopes.count() != 1) {
|
||||
if (m_document->language() != Language::JavaScript || m_jsScopes.count() != 1) {
|
||||
if (m_qmlComponentScope) {
|
||||
foreach (const QmlComponentChain *parent, m_qmlComponentScope->instantiatingComponents())
|
||||
collectScopes(parent, &m_all);
|
||||
@@ -312,8 +312,8 @@ void ScopeChain::initializeRootScope()
|
||||
if (!m_document->bind()->isJsLibrary()) {
|
||||
foreach (Document::Ptr otherDoc, snapshot) {
|
||||
foreach (const ImportInfo &import, otherDoc->bind()->imports()) {
|
||||
if ((import.type() == ImportInfo::FileImport && m_document->fileName() == import.path())
|
||||
|| (import.type() == ImportInfo::QrcFileImport
|
||||
if ((import.type() == ImportType::File && m_document->fileName() == import.path())
|
||||
|| (import.type() == ImportType::QrcFile
|
||||
&& ModelManagerInterface::instance()->filesAtQrcPath(import.path())
|
||||
.contains(m_document->fileName()))) {
|
||||
QmlComponentChain *component = new QmlComponentChain(otherDoc);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qmljsstaticanalysismessage.h"
|
||||
#include "qmljsconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -35,6 +36,7 @@
|
||||
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::StaticAnalysis;
|
||||
using namespace QmlJS::Severity;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -43,7 +45,7 @@ class StaticAnalysisMessages
|
||||
Q_DECLARE_TR_FUNCTIONS(QmlJS::StaticAnalysisMessages)
|
||||
|
||||
public:
|
||||
void newMsg(Type type, Severity severity, const QString &message, int placeholders = 0)
|
||||
void newMsg(Type type, Enum severity, const QString &message, int placeholders = 0)
|
||||
{
|
||||
PrototypeMessageData prototype;
|
||||
prototype.type = type;
|
||||
@@ -152,7 +154,7 @@ StaticAnalysisMessages::StaticAnalysisMessages()
|
||||
tr("Unnecessary parentheses."));
|
||||
newMsg(MaybeWarnEqualityTypeCoercion, MaybeWarning,
|
||||
tr("== and != may perform type coercion, use === or !== to avoid it."));
|
||||
newMsg(WarnConfusingExpressionStatement, Warning,
|
||||
newMsg(WarnConfusingExpressionStatement, Error,
|
||||
tr("Expression statements should be assignments, calls or delete expressions only."));
|
||||
newMsg(HintDeclarationsShouldBeAtStartOfFunction, Hint,
|
||||
tr("Place var declarations at the start of a function."));
|
||||
@@ -168,17 +170,17 @@ StaticAnalysisMessages::StaticAnalysisMessages()
|
||||
tr("Prototype cycle, the last non-repeated component is '%1'."), 1);
|
||||
newMsg(ErrInvalidPropertyType, Error,
|
||||
tr("Invalid property type '%1'."), 1);
|
||||
newMsg(WarnEqualityTypeCoercion, Warning,
|
||||
newMsg(WarnEqualityTypeCoercion, Error,
|
||||
tr("== and != perform type coercion, use === or !== to avoid it."));
|
||||
newMsg(WarnExpectedNewWithUppercaseFunction, Warning,
|
||||
newMsg(WarnExpectedNewWithUppercaseFunction, Error,
|
||||
tr("Calls of functions that start with an uppercase letter should use 'new'."));
|
||||
newMsg(WarnNewWithLowercaseFunction, Warning,
|
||||
newMsg(WarnNewWithLowercaseFunction, Error,
|
||||
tr("Use 'new' only with functions that start with an uppercase letter."));
|
||||
newMsg(WarnNumberConstructor, Warning,
|
||||
newMsg(WarnNumberConstructor, Error,
|
||||
msgInvalidConstructor("Function"));
|
||||
newMsg(HintBinaryOperatorSpacing, Hint,
|
||||
tr("Use spaces around binary operators."));
|
||||
newMsg(WarnUnintentinalEmptyBlock, Warning,
|
||||
newMsg(WarnUnintentinalEmptyBlock, Error,
|
||||
tr("Unintentional empty block, use ({}) for empty object literal."));
|
||||
newMsg(HintPreferNonVarPropertyType, Hint,
|
||||
tr("Use %1 instead of 'var' or 'variant' to improve performance."), 1);
|
||||
@@ -206,16 +208,16 @@ StaticAnalysisMessages::StaticAnalysisMessages()
|
||||
tr("Maximum string value length is %1."), 1);
|
||||
newMsg(ErrInvalidArrayValueLength, Error,
|
||||
tr("%1 elements expected in array value."), 1);
|
||||
newMsg(WarnImperativeCodeNotEditableInVisualDesigner, Warning,
|
||||
newMsg(WarnImperativeCodeNotEditableInVisualDesigner, Error,
|
||||
tr("Imperative code is not supported in the Qt Quick Designer."));
|
||||
newMsg(WarnUnsupportedTypeInVisualDesigner, Warning,
|
||||
newMsg(WarnUnsupportedTypeInVisualDesigner, Error,
|
||||
tr("This type is not supported in the Qt Quick Designer."));
|
||||
newMsg(WarnReferenceToParentItemNotSupportedByVisualDesigner, Warning,
|
||||
newMsg(WarnReferenceToParentItemNotSupportedByVisualDesigner, Error,
|
||||
tr("Reference to parent item cannot be resolved correctly by the Qt Quick Designer."));
|
||||
newMsg(WarnUndefinedValueForVisualDesigner, Warning,
|
||||
newMsg(WarnUndefinedValueForVisualDesigner, Error,
|
||||
tr("This visual property binding cannot be evaluated in the local context "
|
||||
"and might not show up in Qt Quick Designer as expected."));
|
||||
newMsg(WarnStatesOnlyInRootItemForVisualDesigner, Warning,
|
||||
newMsg(WarnStatesOnlyInRootItemForVisualDesigner, Error,
|
||||
tr("Qt Quick Designer only supports states in the root item."));
|
||||
}
|
||||
|
||||
@@ -271,10 +273,10 @@ DiagnosticMessage Message::toDiagnosticMessage() const
|
||||
case Hint:
|
||||
case MaybeWarning:
|
||||
case Warning:
|
||||
diagnostic.kind = DiagnosticMessage::Warning;
|
||||
diagnostic.kind = Warning;
|
||||
break;
|
||||
default:
|
||||
diagnostic.kind = DiagnosticMessage::Error;
|
||||
diagnostic.kind = Error;
|
||||
break;
|
||||
}
|
||||
diagnostic.loc = location;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define QMLJS_STATICANALYSIS_QMLJSSTATICANALYSISMESSAGE_H
|
||||
|
||||
#include "qmljs_global.h"
|
||||
#include "qmljsconstants.h"
|
||||
#include "parser/qmljsengine_p.h"
|
||||
|
||||
#include <QRegExp>
|
||||
@@ -40,15 +41,6 @@
|
||||
namespace QmlJS {
|
||||
namespace StaticAnalysis {
|
||||
|
||||
enum Severity
|
||||
{
|
||||
Hint, // cosmetic or convention
|
||||
MaybeWarning, // possibly a warning, insufficient information
|
||||
Warning, // could cause unintended behavior
|
||||
MaybeError, // possibly an error, insufficient information
|
||||
Error // definitely an error
|
||||
};
|
||||
|
||||
enum Type
|
||||
{
|
||||
// Changing the numbers can break user code.
|
||||
@@ -134,7 +126,7 @@ enum Type
|
||||
class QMLJS_EXPORT PrototypeMessageData {
|
||||
public:
|
||||
Type type;
|
||||
Severity severity;
|
||||
Severity::Enum severity;
|
||||
QString message;
|
||||
int placeholders;
|
||||
};
|
||||
@@ -159,7 +151,7 @@ public:
|
||||
AST::SourceLocation location;
|
||||
QString message;
|
||||
Type type;
|
||||
Severity severity;
|
||||
Severity::Enum severity;
|
||||
|
||||
static const PrototypeMessageData prototypeForMessageType(Type type);
|
||||
};
|
||||
|
||||
@@ -194,7 +194,7 @@ UiQualifiedId *QmlJS::qualifiedTypeNameId(Node *node)
|
||||
|
||||
DiagnosticMessage QmlJS::errorMessage(const AST::SourceLocation &loc, const QString &message)
|
||||
{
|
||||
return DiagnosticMessage(DiagnosticMessage::Error, loc, message);
|
||||
return DiagnosticMessage(Severity::Error, loc, message);
|
||||
}
|
||||
|
||||
bool QmlJS::isValidBuiltinPropertyType(const QString &name)
|
||||
|
||||
@@ -67,7 +67,7 @@ AST::SourceLocation locationFromRange(const T *node)
|
||||
template <class T>
|
||||
DiagnosticMessage errorMessage(const T *node, const QString &message)
|
||||
{
|
||||
return DiagnosticMessage(DiagnosticMessage::Error,
|
||||
return DiagnosticMessage(Severity::Error,
|
||||
locationFromRange(node),
|
||||
message);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ extern "C" HRESULT CALLBACK pid(CIDebugClient *client, PCSTR args)
|
||||
|
||||
int token;
|
||||
commandTokens<StringList>(args, &token);
|
||||
dprintf("Qt Creator CDB extension version 2.8 %d bit built %s.\n",
|
||||
dprintf("Qt Creator CDB extension version 3.0 %d bit built %s.\n",
|
||||
sizeof(void *) * 8, __DATE__);
|
||||
if (const ULONG pid = currentProcessId(client))
|
||||
ExtensionContext::instance().report('R', token, 0, "pid", "%u", pid);
|
||||
|
||||
@@ -126,9 +126,8 @@ public:
|
||||
if (logger) {
|
||||
QByteArray logBA = oldLog.readAll();
|
||||
logger->appendError(ErrorMessage::NoteLevel,
|
||||
ZConfLib::tr("%1: log of previous daemon run is: '%2'.\n")
|
||||
.arg(name())
|
||||
.arg(QString::fromLatin1(logBA.constData(), logBA.size())));
|
||||
ZConfLib::tr("%1: log of previous daemon run is: '%2'.")
|
||||
.arg(name(), QString::fromLatin1(logBA.constData(), logBA.size())) + QLatin1Char('\n'));
|
||||
qDebug()<<logBA.size()<<oldLog.error()<<oldLog.errorString();
|
||||
}
|
||||
oldLog.close();
|
||||
|
||||
@@ -457,7 +457,12 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::connectedDevices(QString *erro
|
||||
return devices;
|
||||
}
|
||||
QList<QByteArray> adbDevs = adbProc.readAll().trimmed().split('\n');
|
||||
adbDevs.removeFirst();
|
||||
if (adbDevs.empty())
|
||||
return devices;
|
||||
|
||||
while (adbDevs.first().startsWith("* daemon"))
|
||||
adbDevs.removeFirst(); // remove the daemon logs
|
||||
adbDevs.removeFirst(); // remove "List of devices attached" header line
|
||||
|
||||
// workaround for '????????????' serial numbers:
|
||||
// can use "adb -d" when only one usb device attached
|
||||
@@ -578,7 +583,13 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::androidVirtualDevices() const
|
||||
return devices;
|
||||
}
|
||||
QList<QByteArray> avds = proc.readAll().trimmed().split('\n');
|
||||
avds.removeFirst();
|
||||
if (avds.empty())
|
||||
return devices;
|
||||
|
||||
while (avds.first().startsWith("* daemon"))
|
||||
avds.removeFirst(); // remove the daemon logs
|
||||
avds.removeFirst(); // remove "List of devices attached" header line
|
||||
|
||||
AndroidDeviceInfo dev;
|
||||
for (int i = 0; i < avds.size(); i++) {
|
||||
QString line = QLatin1String(avds[i]);
|
||||
@@ -610,7 +621,7 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::androidVirtualDevices() const
|
||||
|
||||
QString AndroidConfigurations::startAVD(const QString &name, int apiLevel, QString cpuAbi) const
|
||||
{
|
||||
if (startAVDAsync(name))
|
||||
if (findAvd(apiLevel, cpuAbi) || startAVDAsync(name))
|
||||
return waitForAvd(apiLevel, cpuAbi);
|
||||
return QString();
|
||||
}
|
||||
@@ -632,6 +643,21 @@ bool AndroidConfigurations::startAVDAsync(const QString &avdName) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AndroidConfigurations::findAvd(int apiLevel, const QString &cpuAbi) const
|
||||
{
|
||||
QVector<AndroidDeviceInfo> devices = connectedDevices();
|
||||
foreach (AndroidDeviceInfo device, devices) {
|
||||
if (!device.serialNumber.startsWith(QLatin1String("emulator")))
|
||||
continue;
|
||||
if (!device.cpuAbi.contains(cpuAbi))
|
||||
continue;
|
||||
if (device.sdk != apiLevel)
|
||||
continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::waitForAvd(int apiLevel, const QString &cpuAbi) const
|
||||
{
|
||||
// we cannot use adb -e wait-for-device, since that doesn't work if a emulator is already running
|
||||
@@ -804,6 +830,18 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
if (k->isSdkProvided())
|
||||
continue;
|
||||
|
||||
// Update code for 3.0 beta, which shipped with a bug for the debugger settings
|
||||
ProjectExplorer::ToolChain *tc =ToolChainKitInformation::toolChain(k);
|
||||
if (tc && Debugger::DebuggerKitInformation::debuggerCommand(k) != tc->suggestedDebugger()) {
|
||||
Debugger::DebuggerItem debugger;
|
||||
debugger.setCommand(tc->suggestedDebugger());
|
||||
debugger.setEngineType(Debugger::GdbEngineType);
|
||||
debugger.setDisplayName(tr("Android Debugger for %1").arg(tc->displayName()));
|
||||
debugger.setAutoDetected(true);
|
||||
debugger.setAbi(tc->targetAbi());
|
||||
QVariant id = Debugger::DebuggerItemManager::registerDebugger(debugger);
|
||||
Debugger::DebuggerKitInformation::setDebugger(k, id);
|
||||
}
|
||||
existingKits << k;
|
||||
}
|
||||
|
||||
@@ -841,7 +879,8 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
debugger.setDisplayName(tr("Android Debugger for %1").arg(tc->displayName()));
|
||||
debugger.setAutoDetected(true);
|
||||
debugger.setAbi(tc->targetAbi());
|
||||
Debugger::DebuggerKitInformation::setDebugger(newKit, debugger);
|
||||
QVariant id = Debugger::DebuggerItemManager::registerDebugger(debugger);
|
||||
Debugger::DebuggerKitInformation::setDebugger(newKit, id);
|
||||
|
||||
AndroidGdbServerKitInformation::setGdbSever(newKit, tc->suggestedGdbServer());
|
||||
newKit->makeSticky();
|
||||
|
||||
@@ -106,6 +106,7 @@ public:
|
||||
QVector<AndroidDeviceInfo> androidVirtualDevices() const;
|
||||
QString startAVD(const QString &name, int apiLevel, QString cpuAbi) const;
|
||||
bool startAVDAsync(const QString &avdName) const;
|
||||
bool findAvd(int apiLevel, const QString &cpuAbi) const;
|
||||
QString waitForAvd(int apiLevel, const QString &cpuAbi) const;
|
||||
QString bestNdkPlatformMatch(const QString &targetAPI) const;
|
||||
|
||||
|
||||
@@ -287,7 +287,8 @@ bool AndroidDeployQtStep::init()
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
AndroidConfigurations::instance().startAVDAsync(m_avdName);
|
||||
if (!AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch))
|
||||
AndroidConfigurations::instance().startAVDAsync(m_avdName);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -389,7 +389,8 @@ void AndroidDeployStep::deployFiles(QProcess *process, const QList<DeployItem> &
|
||||
bool AndroidDeployStep::deployPackage()
|
||||
{
|
||||
if (!m_avdName.isEmpty()) {
|
||||
if (!AndroidConfigurations::instance().startAVDAsync(m_avdName))
|
||||
if (!AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch)
|
||||
&& !AndroidConfigurations::instance().startAVDAsync(m_avdName))
|
||||
return false;
|
||||
m_deviceSerialNumber = AndroidConfigurations::instance().waitForAvd(m_deviceAPILevel, m_targetArch);
|
||||
}
|
||||
|
||||
@@ -86,16 +86,11 @@ void CMakeValidator::finished(int exitCode)
|
||||
}
|
||||
if (m_state == CMakeValidator::RunningBasic) {
|
||||
QByteArray response = m_process->readAll();
|
||||
QRegExp versionRegexp(QLatin1String("^cmake version ([\\d\\.]*)"));
|
||||
versionRegexp.indexIn(QString::fromLocal8Bit(response));
|
||||
|
||||
m_hasCodeBlocksMsvcGenerator = response.contains("CodeBlocks - NMake Makefiles");
|
||||
m_hasCodeBlocksNinjaGenerator = response.contains("CodeBlocks - Ninja");
|
||||
m_version = versionRegexp.cap(1);
|
||||
if (versionRegexp.capturedTexts().size() > 3)
|
||||
m_version += QLatin1Char('.') + versionRegexp.cap(3);
|
||||
|
||||
if (m_version.isEmpty()) {
|
||||
if (response.isEmpty()) {
|
||||
m_state = CMakeValidator::Invalid;
|
||||
} else {
|
||||
m_state = CMakeValidator::RunningFunctionList;
|
||||
|
||||
@@ -74,7 +74,6 @@ private:
|
||||
QProcess *m_process;
|
||||
bool m_hasCodeBlocksMsvcGenerator;
|
||||
bool m_hasCodeBlocksNinjaGenerator;
|
||||
QString m_version;
|
||||
QString m_executable;
|
||||
|
||||
QMap<QString, QStringList> m_functionArgs;
|
||||
|
||||
@@ -195,29 +195,33 @@ void ReadOnlyFilesDialog::promptFailWarning(const QStringList &files, ReadOnlyRe
|
||||
if (IVersionControl *vc = d->versionControls[file]) {
|
||||
const QString openText = vc->vcsOpenText().remove(QLatin1Char('&'));
|
||||
title = tr("Failed to %1 File").arg(openText);
|
||||
message = tr("%1 file %2 from version control system %3 failed.\n")
|
||||
message = tr("%1 file %2 from version control system %3 failed.")
|
||||
.arg(openText)
|
||||
.arg(QDir::toNativeSeparators(file))
|
||||
.arg(vc->displayName());
|
||||
message += QLatin1Char('\n');
|
||||
message += d->failWarning;
|
||||
} else {
|
||||
title = tr("No Version Control System Found");
|
||||
message = tr("Cannot open file %1 from version control system.\n"
|
||||
"No version control system found.\n")
|
||||
"No version control system found.")
|
||||
.arg(QDir::toNativeSeparators(file));
|
||||
message += QLatin1Char('\n');
|
||||
message += d->failWarning;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RO_MakeWritable:
|
||||
title = tr("Cannot Set Permissions");
|
||||
message = tr("Cannot set permissions for %1 to writable.\n")
|
||||
message = tr("Cannot set permissions for %1 to writable.")
|
||||
.arg(QDir::toNativeSeparators(file));
|
||||
message += QLatin1Char('\n');
|
||||
message += d->failWarning;
|
||||
break;
|
||||
case RO_SaveAs:
|
||||
title = tr("Cannot Save File");
|
||||
message = tr("Cannot save file %1\n").arg(QDir::toNativeSeparators(file));
|
||||
message = tr("Cannot save file %1").arg(QDir::toNativeSeparators(file));
|
||||
message += QLatin1Char('\n');
|
||||
message += d->failWarning;
|
||||
break;
|
||||
default:
|
||||
@@ -240,6 +244,7 @@ void ReadOnlyFilesDialog::promptFailWarning(const QStringList &files, ReadOnlyRe
|
||||
* Executes the ReadOnlyFilesDialog dialog.
|
||||
* Returns ReadOnlyResult to provide information about the operation that was
|
||||
* used to make the files writable.
|
||||
*
|
||||
* \internal
|
||||
*
|
||||
* Also displays an error dialog when some operations cannot be executed and the
|
||||
|
||||
@@ -561,9 +561,10 @@ bool ExternalToolRunner::resolve()
|
||||
if (m_resolvedExecutable.isEmpty()) {
|
||||
m_hasError = true;
|
||||
for (int i = 0; i < expandedExecutables.size(); ++i) {
|
||||
m_errorString += tr("Could not find executable for '%1' (expanded '%2')\n")
|
||||
m_errorString += tr("Could not find executable for '%1' (expanded '%2')")
|
||||
.arg(m_tool->executables().at(i))
|
||||
.arg(expandedExecutables.at(i));
|
||||
m_errorString += QLatin1Char('\n');
|
||||
}
|
||||
if (!m_errorString.isEmpty())
|
||||
m_errorString.chop(1);
|
||||
|
||||
@@ -264,7 +264,7 @@ void OutputWindow::appendText(const QString &textIn, const QTextCharFormat &form
|
||||
if (m_maxLineCount > 0 && document()->blockCount() >= m_maxLineCount) {
|
||||
QTextCharFormat tmp;
|
||||
tmp.setFontWeight(QFont::Bold);
|
||||
cursor.insertText(doNewlineEnforcement(tr("Additional output omitted\n")), tmp);
|
||||
cursor.insertText(doNewlineEnforcement(tr("Additional output omitted") + QLatin1Char('\n')), tmp);
|
||||
}
|
||||
|
||||
cursor.endEditBlock();
|
||||
|
||||
@@ -72,7 +72,7 @@ using namespace Core::Internal;
|
||||
The progress indicator also allows the user to cancel the task.
|
||||
|
||||
You get the single instance of this class via the
|
||||
Core::ICore::progressManager() function.
|
||||
ProgressManager::instance() function.
|
||||
|
||||
\section1 Registering a task
|
||||
The ProgressManager API uses QtConcurrent as the basis for defining
|
||||
@@ -149,9 +149,8 @@ using namespace Core::Internal;
|
||||
in a different thread, looks like this:
|
||||
\code
|
||||
QFuture<void> task = QtConcurrent::run(&ILocatorFilter::refresh, filters);
|
||||
Core::FutureProgress *progress = Core::ICore::instance()
|
||||
->progressManager()->addTask(task, tr("Indexing"),
|
||||
Locator::Constants::TASK_INDEX);
|
||||
Core::FutureProgress *progress = Core::ProgressManager::addTask(task, tr("Indexing"),
|
||||
Locator::Constants::TASK_INDEX);
|
||||
\endcode
|
||||
First, we tell QtConcurrent to start a thread which calls all the filters'
|
||||
refresh function. After that we register the returned QFuture object
|
||||
@@ -166,9 +165,7 @@ using namespace Core::Internal;
|
||||
// We are already running in a different thread here
|
||||
QFutureInterface<void> *progressObject = new QFutureInterface<void>;
|
||||
progressObject->setProgressRange(0, MAX);
|
||||
Core::ICore::progressManager()->addTask(
|
||||
progressObject->future(),
|
||||
tr("DoIt"), MYTASKTYPE);
|
||||
Core::ProgressManager::addTask(progressObject->future(), tr("DoIt"), MYTASKTYPE);
|
||||
progressObject->reportStarted();
|
||||
// Do something
|
||||
...
|
||||
|
||||
@@ -404,8 +404,8 @@ QString VcsManager::msgAddToVcsFailedTitle()
|
||||
QString VcsManager::msgToAddToVcsFailed(const QStringList &files, const IVersionControl *vc)
|
||||
{
|
||||
return files.size() == 1
|
||||
? tr("Could not add the file\n%1\nto version control (%2)\n")
|
||||
.arg(files.front(), vc->displayName())
|
||||
? tr("Could not add the file\n%1\nto version control (%2)")
|
||||
.arg(files.front(), vc->displayName()) + QLatin1Char('\n')
|
||||
: tr("Could not add the following files to version control (%1)\n%2")
|
||||
.arg(vc->displayName(), files.join(QString(QLatin1Char('\n'))));
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ HEADERS += cppeditorplugin.h \
|
||||
cppincludehierarchyitem.h \
|
||||
cppincludehierarchytreeview.h \
|
||||
cppvirtualfunctionassistprovider.h \
|
||||
cppvirtualfunctionproposalitem.h \
|
||||
cpppreprocessordialog.h
|
||||
|
||||
SOURCES += cppeditorplugin.cpp \
|
||||
@@ -49,6 +50,7 @@ SOURCES += cppeditorplugin.cpp \
|
||||
cppincludehierarchyitem.cpp \
|
||||
cppincludehierarchytreeview.cpp \
|
||||
cppvirtualfunctionassistprovider.cpp \
|
||||
cppvirtualfunctionproposalitem.cpp \
|
||||
cpppreprocessordialog.cpp
|
||||
|
||||
RESOURCES += cppeditor.qrc
|
||||
|
||||
@@ -65,6 +65,8 @@ QtcPlugin {
|
||||
"cpptypehierarchy.h",
|
||||
"cppvirtualfunctionassistprovider.cpp",
|
||||
"cppvirtualfunctionassistprovider.h",
|
||||
"cppvirtualfunctionproposalitem.cpp",
|
||||
"cppvirtualfunctionproposalitem.h",
|
||||
]
|
||||
|
||||
Group {
|
||||
|
||||
@@ -454,16 +454,18 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
const QByteArray name = CPPEditorWidget::identifierUnderCursor(¯oCursor).toLatin1();
|
||||
if (macro->name() == name)
|
||||
return link; //already on definition!
|
||||
} else {
|
||||
const Document::MacroUse *use = doc->findMacroUseAt(endOfToken - 1);
|
||||
if (use && use->macro().fileName() != CppModelManagerInterface::configurationFileName()) {
|
||||
} else if (const Document::MacroUse *use = doc->findMacroUseAt(endOfToken - 1)) {
|
||||
const QString fileName = use->macro().fileName();
|
||||
if (fileName == CppModelManagerInterface::editorConfigurationFileName()) {
|
||||
m_widget->showPreProcessorWidget();
|
||||
} else if (fileName != CppModelManagerInterface::configurationFileName()) {
|
||||
const Macro ¯o = use->macro();
|
||||
link.targetFileName = macro.fileName();
|
||||
link.targetLine = macro.line();
|
||||
link.linkTextStart = use->begin();
|
||||
link.linkTextEnd = use->end();
|
||||
return link;
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
// Find the last symbol up to the cursor position
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Additional C++ Preprocess Directives</string>
|
||||
<string>Additional C++ Preprocessor Directives</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "cppeditorconstants.h"
|
||||
#include "cppelementevaluator.h"
|
||||
#include "cppvirtualfunctionproposalitem.h"
|
||||
|
||||
#include <cplusplus/Icons.h>
|
||||
#include <cplusplus/Overview.h>
|
||||
@@ -39,7 +40,6 @@
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
|
||||
#include <texteditor/codeassist/basicproposalitem.h>
|
||||
#include <texteditor/codeassist/basicproposalitemlistmodel.h>
|
||||
#include <texteditor/codeassist/genericproposal.h>
|
||||
#include <texteditor/codeassist/genericproposalwidget.h>
|
||||
@@ -53,31 +53,6 @@ using namespace CPlusPlus;
|
||||
using namespace CppEditor::Internal;
|
||||
using namespace TextEditor;
|
||||
|
||||
class VirtualFunctionProposalItem: public BasicProposalItem {
|
||||
public:
|
||||
VirtualFunctionProposalItem(const BaseTextEditorWidget::Link &link, bool openInSplit = true)
|
||||
: m_link(link), m_openInSplit(openInSplit) {}
|
||||
|
||||
void apply(BaseTextEditor * /* editor */, int /* basePosition */) const
|
||||
{
|
||||
if (!m_link.hasValidTarget())
|
||||
return;
|
||||
|
||||
Core::EditorManager::OpenEditorFlags flags;
|
||||
if (m_openInSplit)
|
||||
flags |= Core::EditorManager::OpenInOtherSplit;
|
||||
Core::EditorManager::openEditorAt(m_link.targetFileName,
|
||||
m_link.targetLine,
|
||||
m_link.targetColumn,
|
||||
CppEditor::Constants::CPPEDITOR_ID,
|
||||
flags);
|
||||
}
|
||||
|
||||
private:
|
||||
BaseTextEditorWidget::Link m_link;
|
||||
bool m_openInSplit;
|
||||
};
|
||||
|
||||
/// Activate current item with the same shortcut that is configured for Follow Symbol Under Cursor.
|
||||
/// This is limited to single-key shortcuts without modifiers.
|
||||
class VirtualFunctionProposalWidget : public GenericProposalWidget
|
||||
@@ -166,7 +141,7 @@ public:
|
||||
QTC_ASSERT(!m_snapshot.isEmpty(), return 0);
|
||||
|
||||
const QList<Symbol *> overrides = FunctionHelper::overrides(m_startClass, m_function,
|
||||
m_snapshot);
|
||||
m_snapshot);
|
||||
QList<BasicProposalItem *> items;
|
||||
foreach (Symbol *symbol, overrides)
|
||||
items << itemFromSymbol(symbol, m_function);
|
||||
|
||||