diff --git a/dist/changes-2.8.0 b/dist/changes-2.8.0 index 60737f2f467999b12be5b7a45138f90ce7f48deb..deca684bda3a7260893fa9c0df94a3cecaed5081 100644 --- a/dist/changes-2.8.0 +++ b/dist/changes-2.8.0 @@ -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 (Віктор ОÑташевÑький) diff --git a/doc/api/examples/exampleplugin/exampleplugin.cpp b/doc/api/examples/exampleplugin/exampleplugin.cpp index 147a4274b9c889d015f7b3c787111195d1d6f825..7b2b3c0cead88dc5f3713a44e55415ffbb2ae301 100644 --- a/doc/api/examples/exampleplugin/exampleplugin.cpp +++ b/doc/api/examples/exampleplugin/exampleplugin.cpp @@ -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; diff --git a/doc/images/qmldesigner-new-project.png b/doc/images/qmldesigner-new-project.png index 635329b9789f5395d51f4568ef1e31f3d2a9a2a4..7a6cce9fa1c5edab48b97d9def60dbaf3c3e64eb 100644 Binary files a/doc/images/qmldesigner-new-project.png and b/doc/images/qmldesigner-new-project.png differ diff --git a/doc/images/qtcreator-breakdown.png b/doc/images/qtcreator-breakdown.png index 5cbaa5e9a8bc6d40f719dd6145bcef7728aefcb3..6ace91bcc7ff278a5de634c838e8391a6c263393 100644 Binary files a/doc/images/qtcreator-breakdown.png and b/doc/images/qtcreator-breakdown.png differ diff --git a/doc/images/qtcreator-build-issues.png b/doc/images/qtcreator-build-issues.png index b0d77588402c24fdc6c97f24aebc9429fd0fc71e..c8f4c138c7860e42d7d0d3ab5d29028b2cda643d 100644 Binary files a/doc/images/qtcreator-build-issues.png and b/doc/images/qtcreator-build-issues.png differ diff --git a/doc/images/qtcreator-gs-build-example-open.png b/doc/images/qtcreator-gs-build-example-open.png index 87512a8884440131013151ef9593ad325dd8d1f1..6f73b1a9beb8310daa802c32d239ee29dba7d3c3 100644 Binary files a/doc/images/qtcreator-gs-build-example-open.png and b/doc/images/qtcreator-gs-build-example-open.png differ diff --git a/doc/images/qtcreator-new-qt-gui-application.png b/doc/images/qtcreator-new-qt-gui-application.png index 95353a38ca8152451a7c275eba983006a3a7b19a..9682d5abd57e66bb3fe596d32f58d6824eff9f9b 100644 Binary files a/doc/images/qtcreator-new-qt-gui-application.png and b/doc/images/qtcreator-new-qt-gui-application.png differ diff --git a/doc/images/qtcreator-new-qt-quick-project-wizard.png b/doc/images/qtcreator-new-qt-quick-project-wizard.png index 571a67eb31bbbbad9d7572125abdaee51bb7b3f7..9b4c79f6a8ba3d7d4a2f6aea4bd12f3dac8bea91 100644 Binary files a/doc/images/qtcreator-new-qt-quick-project-wizard.png and b/doc/images/qtcreator-new-qt-quick-project-wizard.png differ diff --git a/doc/src/howto/creator-ui.qdoc b/doc/src/howto/creator-ui.qdoc index a3ffea286f1cce9ec6a08b9029a81b20810072ca..4d4b7d082921eb7f9377d6bdbb06f06095597737 100644 --- a/doc/src/howto/creator-ui.qdoc +++ b/doc/src/howto/creator-ui.qdoc @@ -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}. diff --git a/doc/src/projects/creator-projects-creating.qdoc b/doc/src/projects/creator-projects-creating.qdoc index 4b77c31b0017eba5803bcb1aa8f1db9ba6320cc2..43b99614a280e38ff657aa22d22fde3b5fb9070d 100644 --- a/doc/src/projects/creator-projects-creating.qdoc +++ b/doc/src/projects/creator-projects-creating.qdoc @@ -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 diff --git a/doc/src/widgets/qtdesigner-app-tutorial.qdoc b/doc/src/widgets/qtdesigner-app-tutorial.qdoc index 1cdfcf350602a3c4f0b2aef291a3277ce89e0ce8..edabb72f5ec75113d6f21e28704ca12241beed2d 100644 --- a/doc/src/widgets/qtdesigner-app-tutorial.qdoc +++ b/doc/src/widgets/qtdesigner-app-tutorial.qdoc @@ -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" diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index a1b9c8ddbbe282e1b62d9d95485e0e4a6a7f20c9..cf37f4f965ff8baaf64da664710304463c12c17d 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -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, \ diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index f8f74b3c71347c0a89f84417be9bd096bd56fea1..914cba7b160def9ac5d8ab78c9a93bff45e5a099 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -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: diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 0105e426e21e21f04572ec5d9cc78a5954238996..b647408982327e7c8acca2c2acfd7d11f01fc8b3 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -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) diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index 0d54286127d54e6266bbc4ded5f826b4babb1255..a80986ef7440a6d09b346a82af9b2f3833fb6003 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -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" - - elif variantType <= 86: - inner = d.ns + qdumpHelper_QVariants_C[variantType - 64] - innert = inner - - 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) + innert = qdumpHelper_QVariants_B[variantType - 7] + else: + innert = qdumpHelper_QVariants_C[variantType - 64] + + inner = d.ns + innert + + 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) +def qdump__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! diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py index 4d6ac1bd1a988fae6f7da7d48ecdfc47a705a023..d0fac283c0bd55ccc784ba287a493ccc4a7e0aed 100644 --- a/share/qtcreator/debugger/stdtypes.py +++ b/share/qtcreator/debugger/stdtypes.py @@ -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, diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri index 7cc9dfdde45861dc1d57507d269cefdff1cffcfd..68324e6a794bd52d3ec43d923b5110064132bd7d 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri @@ -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) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml index 5bf7df9b041037a90fe99eff0716476f7507a5cc..737b49afe7176919819d430173bb28370129ceae 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml @@ -63,7 +63,7 @@ Item { } RoundedPanel { - roundLeft: isFirst() && roundLeftButton + roundLeft: isFirst() && buttonRowButton.roundLeftButton roundRight: isLast() anchors.fill: parent diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CheckBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CheckBox.qml index a1158cc5c69d98ec511fe03f1ac67d4d7665a366..fa85db2fb48c2686a3231456a6d7742d4216ae58 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CheckBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CheckBox.qml @@ -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; } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml index f3044101c1ec52faef7aa1892a2660f0a23b4ed5..ddf0f60c302a1c947d63aaef10df7dce6154312f 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml @@ -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" } + } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorLogic.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorLogic.qml new file mode 100644 index 0000000000000000000000000000000000000000..b4817ecef49da6e0900c29cabd03c6cb15e11c58 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorLogic.qml @@ -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 + } + + } +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml index 1534cbdfd3ef602fba5ee79e1ec1f54e72fd20bd..9349b25057272d8da27e1e2ec9f2e6d48756144a 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml @@ -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 } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Constants.js b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Constants.js new file mode 100644 index 0000000000000000000000000000000000000000..a673afe5b088573fe02337554f04f4d4d9152718 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Constants.js @@ -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" diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml index d522f8bfed00d97e3829e78ddee8d0635bbc8aad..185ac8b7ce7f887357f7d553c49dc15c3e6718b5 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml @@ -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 diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml index 1e11856a2275e1704ec95c0c91881bf1f0f9ce1f..47553f1ad96349762683fce3bbb8ca6bc6156385 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml @@ -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 } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FlickableSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FlickableSection.qml index 90aa27dff568c3799d8e42739d0a9dd528b85978..4f150e2afa93ba063a7bd4f2204f3dcbbeeb45cd 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FlickableSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FlickableSection.qml @@ -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 } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontSection.qml index 96a8b64f58b9788f3f81e0aab03a9f4c3b630dd8..5373026463b03ab8bdf95199f08e1c5703d0891d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontSection.qml @@ -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 { } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml index 8e75dbf0b3f7a1858c1e22274b1a573beb1d0838..1a0816b1ee1ca1ff553ffbf23a415972f347f152 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml @@ -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 diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/RoundedPanel.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/RoundedPanel.qml index 992ff27bf20106c6042596e5f0743d062321e624..fdf294c148bc79505774a7053af468b11707d650 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/RoundedPanel.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/RoundedPanel.qml @@ -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 } + } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml index 2858d6c6151a214a81d9e584cf9318eb9312b4d8..c59fe14ad98ea4b3b7f56617e8ce01ec17547e8e 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml @@ -69,7 +69,7 @@ Item { } Rectangle { - color: "#666" + color:"#333" width: parent.width height: 1 } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/SpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/SpinBox.qml index 6e5f6c06db51d6c30aa5a6cd46434aaf0c35fc7a..1d361b8273f5cd788e5f88fdc36a7ac0a5f9f4c3 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/SpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/SpinBox.qml @@ -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; } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml index 5ef3f0a8ef0ebb896df0b3a48573c5c207a51a08..ac14ca8ef7946a8de4ff27e9eb75fa5c8cc04540 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml @@ -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 { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/TabView.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/TabView.qml index 27a474e94e1eb918555206e744d1e181baab899f..9a5bdbdb9cd3383b19e58c67466a75b1fa041dd6 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/TabView.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/TabView.qml @@ -63,12 +63,6 @@ Controls.TabView { width: parent.width height: 1 } - Rectangle { - color: "#333" - width: parent.width - height: 1 - anchors.bottom: parent.bottom - } } } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/qmldir b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/qmldir index ec6e3d0a8fab36cb335c64c079f7814b421233d5..e74806a6272468136d3b69161bedf329d67e18a3 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/qmldir +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/qmldir @@ -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 diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/BooleanEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/BooleanEditorTemplate.template new file mode 100644 index 0000000000000000000000000000000000000000..c9a82d0f4a2b31816c039014acdb2f5b04a43edb --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/BooleanEditorTemplate.template @@ -0,0 +1,9 @@ +Label { + text: "%1" + toolTip: "%1" +} + +CheckBox { + text: backendValues.%2.value + backendValue: backendValues.%2 +} \ No newline at end of file diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ColorEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ColorEditorTemplate.template new file mode 100644 index 0000000000000000000000000000000000000000..0c2c697ecc2bf9755ce282766b6b9df6bab7fddd --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ColorEditorTemplate.template @@ -0,0 +1,8 @@ +Item { +} + +ColorEditor { + caption: "%1" + backendColor: backendValues.%2 + supportGradient: false +} \ No newline at end of file diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/IntEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/IntEditorTemplate.template new file mode 100644 index 0000000000000000000000000000000000000000..cc8259da8b5a9bb1875f532e12f0d350c9d832d3 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/IntEditorTemplate.template @@ -0,0 +1,7 @@ +Label { + text: "%1" + toolTip: "%1" +} +SpinBox { + backendValue: backendValues.%2 +} \ No newline at end of file diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/RealEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/RealEditorTemplate.template new file mode 100644 index 0000000000000000000000000000000000000000..cc8259da8b5a9bb1875f532e12f0d350c9d832d3 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/RealEditorTemplate.template @@ -0,0 +1,7 @@ +Label { + text: "%1" + toolTip: "%1" +} +SpinBox { + backendValue: backendValues.%2 +} \ No newline at end of file diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/StringEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/StringEditorTemplate.template new file mode 100644 index 0000000000000000000000000000000000000000..3619dd5d4e4352c7581b5d6a1de0ff309872fad9 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/StringEditorTemplate.template @@ -0,0 +1,7 @@ +Label { + text: "%1" + toolTip: "%1" +} +LineEdit { + backendValue: backendValues.%2 +} \ No newline at end of file diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TemplateTypes.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TemplateTypes.qml new file mode 100644 index 0000000000000000000000000000000000000000..7c14041197153f57e8fb02a91925507ca7fe71d3 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TemplateTypes.qml @@ -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" + } +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/UrlEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/UrlEditorTemplate.template new file mode 100644 index 0000000000000000000000000000000000000000..3619dd5d4e4352c7581b5d6a1de0ff309872fad9 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/UrlEditorTemplate.template @@ -0,0 +1,7 @@ +Label { + text: "%1" + toolTip: "%1" +} +LineEdit { + backendValue: backendValues.%2 +} \ No newline at end of file diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml index f87ec5d9dedeaa48cd351ceb6ff0394072cc858d..cc3dd56d9986c25cf069ce973d8dfce651f58ef9 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml @@ -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 { - - } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml index 57f640cfc02bd5109a8371fcfc6cdf887837f326..995874e73d798d4f54e3276ddea5319251950322 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml @@ -64,11 +64,9 @@ Column { ComboBox { model: ["LeftToRight", "RightToLeft"] backendValue: backendValues.layoutDirection + Layout.fillWidth: true } - ExpandingSpacer { - - } } Label { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GeometrySection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GeometrySection.qml index d174be3bdc99d52f584475dde01457b54895a8a5..74ecee463981ca830b18abbd8ea799f3112c7c5e 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GeometrySection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GeometrySection.qml @@ -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 { + + } } } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml index c4a13f597f9fa50f3d23e4770bf04492e2d5bc60..c22a26ac8907f6c9008d8ed972bc6b1082a55ec7 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml @@ -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 { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml index cf13bf93bdd7fd1b39fd71f16d0a3318dadbd61e..69b5f7a9ba9e816712e818a0ddf33f906b4b418c 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml @@ -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 } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml index 3fba1ff36b64858a2094ca024e694d88e63bd50e..f7dd4a7033916c39911bc30835e31e9e02aa1c97 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml @@ -64,6 +64,7 @@ Column { model: ["Stretch", "PreserveAspectFit", "PreserveAspectCrop", "Tile", "TileVertically", "TileHorizontally"] backendValue: backendValues.fillMode implicitWidth: 180 + Layout.fillWidth: true } ExpandingSpacer { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml index f201ebf8fb8c8d3c9f356eaa11c51ddfa4813e42..4090bb4814605f1b968a0095127faab9ddd93527 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml @@ -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 diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayoutSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayoutSection.qml index b85d8b731fd70b4924011ed7c7a3f65bfdeeea23..49ac950e891d4030f866a55561517f6dae63a52c 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayoutSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayoutSection.qml @@ -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,32 +246,89 @@ Section { rows: 2 columns: 2 - Text { text: qsTr("Target") color: "#eee" elide: Text.ElideRight + Layout.minimumWidth: 40 + } + TargetComboBox { + targetName: anchorBackend.rightTarget + onCurrentTextChanged: { + anchorBackend.rightTarget = currentText + } + } + + Text { + text: qsTr("Margin") + color: "#eee" + elide: Text.ElideRight + Layout.minimumWidth: 40 } - ComboBox { + RowLayout { + SpinBox { + maximumValue: 0xffff + minimumValue: -0xffff + backendValue: backendValues.anchors_rightMargin + } + + 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.horizontalCentered; + IconLabel { + source: "../HelperWidgets/images/anchor-horizontal.png" + Layout.alignment: Qt.AlignTop + } + + GridLayout { + Layout.fillWidth: true + rows: 2 + columns: 2 Text { - text: qsTr("Margin") + 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_rightMargin - + backendValue: backendValues.anchors_horizontalCenterOffset } ButtonRow { @@ -287,12 +342,65 @@ Section { 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" + } + } + } } } - } - } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml index c72364f0dfd01e30df5f884fc0d727b6b0df0857..ed60426cc01115722233b8de6cb970ce874e3158 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml @@ -89,11 +89,9 @@ Column { ComboBox { model: ["Horizontal", "Vertical"] backendValue: backendValues.orientation + Layout.fillWidth: true } - ExpandingSpacer { - - } } Label { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml index e26f165a43f46f7bad149034bcb1c29d03188552..a65994eeea25dce4ad172c4d1c203ef6d0345929 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml @@ -49,10 +49,7 @@ Column { ComboBox { model: ["LeftToRight", "RightToLeft"] backendValue: backendValues.layoutDirection - } - - ExpandingSpacer { - + Layout.fillWidth: true } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TargetComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TargetComboBox.qml new file mode 100644 index 0000000000000000000000000000000000000000..178dd8a7db730ea6cb9f8bf6bb14a3bfecfb3c57 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TargetComboBox.qml @@ -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 { + } +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml index bc471cc8ce0d3fa4a3c0257a5454c6031f3f0ddc..e3a5064f22b67d10380651919b839052d2399a9f 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml @@ -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 { + + } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml new file mode 100644 index 0000000000000000000000000000000000000000..770ba6a1bb73dc94e98dc195c1659c24d6a3ce8c --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml @@ -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; + } + + } + } + } +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml index e05a850c98985dbfece8a30061dc0d63e75e2aa6..e6b320258ad797eac27b81766337a4eed6f496b2 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml @@ -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 { + + } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml index d2d6688b982a734695fc7f1033d95f7bde5ef690..23acc4293c1ec8ab809b71d6cc802bef6c926ad8 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml @@ -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 } diff --git a/share/qtcreator/qmldesigner/propertyeditor/HelperWidgets/FontGroupBox.qml b/share/qtcreator/qmldesigner/propertyeditor/HelperWidgets/FontGroupBox.qml index 3ecd6aaf64041a80b9bfeab21dfdd2c6c2500e9c..85f552b6dc04c1c33a9c1d3c0d1a797e9f15073d 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/HelperWidgets/FontGroupBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/HelperWidgets/FontGroupBox.qml @@ -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") diff --git a/src/app/main.cpp b/src/app/main.cpp index 6393458d31b349859d4f37ae9cc7d3ea0f5ccb63..87d988313f5817a2518178c10965196108063caa 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -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 diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp index 53725dc1a0ce34f5cc37edbcb8855aca9276940c..040ddc55a4925a4d461e8c4335cbb10953f0e263 100644 --- a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp +++ b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp @@ -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(); } - - diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.h b/src/libs/3rdparty/cplusplus/TranslationUnit.h index 885820732e3df7d679ec653ac548d990d0ad38cb..81df75f2aa231bbbba3dd8a460d33e510f033149 100644 --- a/src/libs/3rdparty/cplusplus/TranslationUnit.h +++ b/src/libs/3rdparty/cplusplus/TranslationUnit.h @@ -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; diff --git a/src/libs/cplusplus/FastPreprocessor.cpp b/src/libs/cplusplus/FastPreprocessor.cpp index 45f1d24d37a684bd47a0ce9d751a27fe472e0b0a..66df01c3488cfa7d6c46742e0d4af9598596e269 100644 --- a/src/libs/cplusplus/FastPreprocessor.cpp +++ b/src/libs/cplusplus/FastPreprocessor.cpp @@ -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()); } diff --git a/src/libs/cplusplus/PreprocessorClient.h b/src/libs/cplusplus/PreprocessorClient.h index 9b0ad80d19ae51d09ee3d35c101eac5612db05ef..217337a112bee8eb38ae94b4386d4ebf6d1b9416 100644 --- a/src/libs/cplusplus/PreprocessorClient.h +++ b/src/libs/cplusplus/PreprocessorClient.h @@ -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 diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 2de78a7f13721f917f866000322bdf794a500850..917642e43c0a9d5f8d4a818301078dc57c7a86a4 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -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; diff --git a/src/libs/qmljs/parser/qmljsengine_p.h b/src/libs/qmljs/parser/qmljsengine_p.h index 5b1fe269f0d363bed5b73e829a7adedac23cfa99..b43b1be239db3ff5bcb4113ac615d6ff3bcac77c 100644 --- a/src/libs/qmljs/parser/qmljsengine_p.h +++ b/src/libs/qmljs/parser/qmljsengine_p.h @@ -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; }; diff --git a/src/libs/qmljs/parser/qmljsparser.cpp b/src/libs/qmljs/parser/qmljsparser.cpp index 5b95f16b25736fe9baa88884292b647c9bc7a0bd..ecf18954804a75c8bfb9e829b0e5ad983bcef9db 100644 --- a/src/libs/qmljs/parser/qmljsparser.cpp +++ b/src/libs/qmljs/parser/qmljsparser.cpp @@ -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; diff --git a/src/libs/qmljs/parser/qmljsparser_p.h b/src/libs/qmljs/parser/qmljsparser_p.h index eafea8f405ddfa6b007120021a36a4f36e44b57c..9b41ce3412e4432d2a53b8dc0bc227e839e3dc06 100644 --- a/src/libs/qmljs/parser/qmljsparser_p.h +++ b/src/libs/qmljs/parser/qmljsparser_p.h @@ -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; } diff --git a/src/libs/qmljs/qmljs-lib.pri b/src/libs/qmljs/qmljs-lib.pri index 1ea154d3ad269da5f3facad63155ede37441efb3..d4e83127daa21ecbaeb786e53622a8c0cdc6795d 100644 --- a/src/libs/qmljs/qmljs-lib.pri +++ b/src/libs/qmljs/qmljs-lib.pri @@ -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 \ diff --git a/src/libs/qmljs/qmljs.qbs b/src/libs/qmljs/qmljs.qbs index ae5334c4bbc8adfe5ef83c4319b80fd5c019f45f..c79197475fec8a2bf6042bdcd1d687d8e92225ae 100644 --- a/src/libs/qmljs/qmljs.qbs +++ b/src/libs/qmljs/qmljs.qbs @@ -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", diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index fd7c7c68cb87658c83ef91ff2186825c1a2bc80e..65804d72a090eafe788407dcc1ae0beea0a2cfd2 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -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()) { diff --git a/src/libs/qmljs/qmljsbundle.cpp b/src/libs/qmljs/qmljsbundle.cpp index 8b2ff587b43a5d9af22b234576a9ba39443c8dd0..198808a9f2972aa193b629e4b816c0f20d8df34b 100644 --- a/src/libs/qmljs/qmljsbundle.cpp +++ b/src/libs/qmljs/qmljsbundle.cpp @@ -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)); } diff --git a/src/libs/qmljs/qmljsbundle.h b/src/libs/qmljs/qmljsbundle.h index 63acca2da532365cca4a6ef86db82904999968be..3357ee5a0c9696c3571541fcb8b242f0fb238504 100644 --- a/src/libs/qmljs/qmljsbundle.h +++ b/src/libs/qmljs/qmljsbundle.h @@ -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 diff --git a/src/libs/qmljs/qmljsconstants.h b/src/libs/qmljs/qmljsconstants.h new file mode 100644 index 0000000000000000000000000000000000000000..fcb117050f09f29c11e829271b0ba155105e1060 --- /dev/null +++ b/src/libs/qmljs/qmljsconstants.h @@ -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 diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index 942882ef1ac478a677c004af0b57b7c24fb8f9f2..fe169f795c45655150f7271b1c19943f6b2b499b 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -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); diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h index 56ebb7061e8d23316a236ab5e3845a97db37a863..3d9491e165f7b87a88742003abc732daeb6b2db8 100644 --- a/src/libs/qmljs/qmljsdocument.h +++ b/src/libs/qmljs/qmljsdocument.h @@ -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 diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index ddecffd2f19d1c2e969ff0d4dec6a32be0c44b24..bb36c1b25c14787af963324822fa9dfcd433c3f1 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -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 { diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 356f52bb387fbe04724de751cefa4cd06f8d5438..cf8d22a3846e8b17ea791fe2cc880876520828a5 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -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; diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 1515286a54fd240d02b8755552ba8a5f3976f213..8868ceee21f595f61338ff2083f2e281f6e6bb7a 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -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) diff --git a/src/libs/qmljs/qmljsscopechain.cpp b/src/libs/qmljs/qmljsscopechain.cpp index 9ec4d0cf374014e09adb55fea35a63b2d28366cb..41cb3fb356794153366585599ce59400ccbb279b 100644 --- a/src/libs/qmljs/qmljsscopechain.cpp +++ b/src/libs/qmljs/qmljsscopechain.cpp @@ -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); diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.cpp b/src/libs/qmljs/qmljsstaticanalysismessage.cpp index 6336bc21e2952499cb356b469869bd507fe7ae02..57dc9b9ba704521a2686a22c6e4ee294923b449f 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.cpp +++ b/src/libs/qmljs/qmljsstaticanalysismessage.cpp @@ -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; diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.h b/src/libs/qmljs/qmljsstaticanalysismessage.h index 3cf29d7bba04e37562981a55a9a428b17ab3cd5a..4e1ca5afc60cb657b4f5ddd4203935cc08c851d0 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.h +++ b/src/libs/qmljs/qmljsstaticanalysismessage.h @@ -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); }; diff --git a/src/libs/qmljs/qmljsutils.cpp b/src/libs/qmljs/qmljsutils.cpp index 2836350291256269856ac9ed1defd3731b0018b3..764a5c0f4867de9bc82784d9d19e0df5f40d7895 100644 --- a/src/libs/qmljs/qmljsutils.cpp +++ b/src/libs/qmljs/qmljsutils.cpp @@ -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) diff --git a/src/libs/qmljs/qmljsutils.h b/src/libs/qmljs/qmljsutils.h index 30ec1ba69e78e7f8b9f3822176a01a61abd1c4c1..5ac47f72077a8acdf0d1fa694a4fa0346a17dbd7 100644 --- a/src/libs/qmljs/qmljsutils.h +++ b/src/libs/qmljs/qmljsutils.h @@ -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); } diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp index f3cc7bbedf9039ddb020a7cc469f86da2fda9383..b43a9c7b3a4d1ec638500812c9e45fa8d6e109d3 100644 --- a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp +++ b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp @@ -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); diff --git a/src/libs/zeroconf/embeddedLib.cpp b/src/libs/zeroconf/embeddedLib.cpp index b4ae626d4944878434a0bc217b1e51f382a6a526..993944d0b0e13aff8ca55b42758312f97d6e11f7 100644 --- a/src/libs/zeroconf/embeddedLib.cpp +++ b/src/libs/zeroconf/embeddedLib.cpp @@ -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(); diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 543c66ab26a64ebb21a2ef340dc7d576ace0f3f8..80d1c9451abeba2219668c027d29305eaa636fc0 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -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(); diff --git a/src/plugins/android/androidconfigurations.h b/src/plugins/android/androidconfigurations.h index 64d7e08068457ccebc6e2d27e160ac31242aa6db..38af17330fe877ce5a4f2829d7d1faef01134135 100644 --- a/src/plugins/android/androidconfigurations.h +++ b/src/plugins/android/androidconfigurations.h @@ -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; diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index 349af217347ff50f7761a5ec7422ad12c26375b3..405f317ef502b47243332d3e5a7b1cdeb8fb953e 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -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; } diff --git a/src/plugins/android/androiddeploystep.cpp b/src/plugins/android/androiddeploystep.cpp index 3fadfce5fe890aca65fa9504ddb296bb9c0d3a52..d8264898d8793f0f83b13781fa1c647e86657228 100644 --- a/src/plugins/android/androiddeploystep.cpp +++ b/src/plugins/android/androiddeploystep.cpp @@ -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); } diff --git a/src/plugins/cmakeprojectmanager/cmakevalidator.cpp b/src/plugins/cmakeprojectmanager/cmakevalidator.cpp index 8a85a756fa7c5776b06160799bbb37058d476ffa..203dfe8706d90d26d97e7ccbd6983df7cbb4e7fa 100644 --- a/src/plugins/cmakeprojectmanager/cmakevalidator.cpp +++ b/src/plugins/cmakeprojectmanager/cmakevalidator.cpp @@ -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; diff --git a/src/plugins/cmakeprojectmanager/cmakevalidator.h b/src/plugins/cmakeprojectmanager/cmakevalidator.h index 945a2271ff799d6bdce990e7177961ec350fc37a..c4c39283a59f79779bb98923c1b24058ef13bba5 100644 --- a/src/plugins/cmakeprojectmanager/cmakevalidator.h +++ b/src/plugins/cmakeprojectmanager/cmakevalidator.h @@ -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; diff --git a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp index 3a017e8c52c43ddf215393ea544600d4deca6568..e5b92af57c760d6f72a3c839ade085e3fa26c93d 100644 --- a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp +++ b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp @@ -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 diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp index 971704272e3c9b50fcf276dc10617bda044ee6af..590806ff2535407b9d58231d9cdbee98a109b0ba 100644 --- a/src/plugins/coreplugin/externaltool.cpp +++ b/src/plugins/coreplugin/externaltool.cpp @@ -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); diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index bdd82784b13f4e3d36d4d22178d903719ac46820..8813ea21e9f82f616a3cd22383e1992e82ef6f61 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -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(); diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 444f19296b5706745588106264489b095f04f13b..419d8be0b70e22f0bc84594087775cfa29347260 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -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 ... diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index d58a678d468849bb5c65a1228e4fedebc864646e..4e2636a90889e48f3164ae647ef31880c7e30317 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -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')))); } diff --git a/src/plugins/cppeditor/cppeditor.pro b/src/plugins/cppeditor/cppeditor.pro index 64ffa94641fcffb49cda2682787afd028d743c66..f7fe4eb9af509752b691866160d6f3f552fa5f3a 100644 --- a/src/plugins/cppeditor/cppeditor.pro +++ b/src/plugins/cppeditor/cppeditor.pro @@ -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 diff --git a/src/plugins/cppeditor/cppeditor.qbs b/src/plugins/cppeditor/cppeditor.qbs index d8c465ad557c6ba49a3f0f0f4160f9e2b5f3a535..920b3a834bf1d00fa70a1e49fbb4f20e506e4fb2 100644 --- a/src/plugins/cppeditor/cppeditor.qbs +++ b/src/plugins/cppeditor/cppeditor.qbs @@ -65,6 +65,8 @@ QtcPlugin { "cpptypehierarchy.h", "cppvirtualfunctionassistprovider.cpp", "cppvirtualfunctionassistprovider.h", + "cppvirtualfunctionproposalitem.cpp", + "cppvirtualfunctionproposalitem.h", ] Group { diff --git a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp index bd2acf05abf5812f3337455ff375e98c37a8535a..ad4a8c3012180c03336866e9d490a6f94f092b59 100644 --- a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp +++ b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp @@ -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 diff --git a/src/plugins/cppeditor/cpppreprocessordialog.ui b/src/plugins/cppeditor/cpppreprocessordialog.ui index 28c7b5f47bd3fe6e3df5961bc1da95c83452bf18..386090115659124b920035da72172decee96445a 100644 --- a/src/plugins/cppeditor/cpppreprocessordialog.ui +++ b/src/plugins/cppeditor/cpppreprocessordialog.ui @@ -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> diff --git a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp index fb9c7621bafaaf5c213322f493c6e03e6d0c9eda..5f445898855c6bec1dfa26674e3fbccab428760e 100644 --- a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp +++ b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp @@ -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); diff --git a/src/plugins/cppeditor/cppvirtualfunctionproposalitem.cpp b/src/plugins/cppeditor/cppvirtualfunctionproposalitem.cpp new file mode 100644 index 0000000000000000000000000000000000000000..91335af54de4f4a7c5e36f78504cc7d8ec54d435 --- /dev/null +++ b/src/plugins/cppeditor/cppvirtualfunctionproposalitem.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "cppvirtualfunctionproposalitem.h" + +#include "cppeditorconstants.h" + +using namespace CppEditor::Internal; + +VirtualFunctionProposalItem::VirtualFunctionProposalItem( + const TextEditor::BaseTextEditorWidget::Link &link, bool openInSplit) + : m_link(link), m_openInSplit(openInSplit) +{ +} + +void VirtualFunctionProposalItem::apply(TextEditor::BaseTextEditor *, int) 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); +} diff --git a/src/plugins/cppeditor/cppvirtualfunctionproposalitem.h b/src/plugins/cppeditor/cppvirtualfunctionproposalitem.h new file mode 100644 index 0000000000000000000000000000000000000000..7d09c9db2cdac8639f292c2feae2886b3a84e311 --- /dev/null +++ b/src/plugins/cppeditor/cppvirtualfunctionproposalitem.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** 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 CPPVIRTUALFUNCTIONPROPOSALITEM_H +#define CPPVIRTUALFUNCTIONPROPOSALITEM_H + +#include <texteditor/basetexteditor.h> +#include <texteditor/codeassist/basicproposalitem.h> + +namespace CppEditor { +namespace Internal { + +class VirtualFunctionProposalItem: public TextEditor::BasicProposalItem { +public: + VirtualFunctionProposalItem(const TextEditor::BaseTextEditorWidget::Link &link, + bool openInSplit = true); + void apply(TextEditor::BaseTextEditor * /* editor */, int /* basePosition */) const; + +private: + TextEditor::BaseTextEditorWidget::Link m_link; + bool m_openInSplit; +}; + +} // namespace Internal +} // namespace CppEditor + +#endif // CPPVIRTUALFUNCTIONPROPOSALITEM_H diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.cpp b/src/plugins/cpptools/cppmodelmanagerinterface.cpp index e2a7c6f10ebdbae04883a0cd57256a3d3ae8c33e..31f1b55e18facd1c981aa5f577b48c21de514f99 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.cpp +++ b/src/plugins/cpptools/cppmodelmanagerinterface.cpp @@ -175,6 +175,11 @@ static CppModelManagerInterface *g_instance = 0; const QString CppModelManagerInterface::configurationFileName() { return CPlusPlus::Preprocessor::configurationFileName; } +const QString CppModelManagerInterface::editorConfigurationFileName() +{ + return QLatin1String("<per-editor-defines>"); +} + CppModelManagerInterface::CppModelManagerInterface(QObject *parent) : QObject(parent) { diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index eacfa6f756a95b4fc906f911457962592537fbf9..bb6787bd2f2dd046b9a4a493303d0b7df0511538 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -216,6 +216,7 @@ public: public: static const QString configurationFileName(); + static const QString editorConfigurationFileName(); public: CppModelManagerInterface(QObject *parent = 0); diff --git a/src/plugins/cpptools/cpppreprocessor.cpp b/src/plugins/cpptools/cpppreprocessor.cpp index f60c853b83261c655079ccf3292c283ec42b02b3..63e64c61a16fdd3e1d5473410a1889a189535643 100644 --- a/src/plugins/cpptools/cpppreprocessor.cpp +++ b/src/plugins/cpptools/cpppreprocessor.cpp @@ -416,7 +416,6 @@ void CppPreprocessor::sourceNeeded(unsigned line, const QString &fileName, Inclu if (m_dumpFileNameWhileParsing) { qDebug() << "Parsing file:" << absoluteFileName << "contents:" << contents.size() << "bytes"; - ; } Document::Ptr doc = m_snapshot.document(absoluteFileName); diff --git a/src/plugins/cpptools/cppsnapshotupdater.cpp b/src/plugins/cpptools/cppsnapshotupdater.cpp index cf4a7cec7490cbc1ffd7f130b75f8b762f60fb93..11cd3ff5b32cad00f3e4e4f0442d8fe617063108 100644 --- a/src/plugins/cpptools/cppsnapshotupdater.cpp +++ b/src/plugins/cpptools/cppsnapshotupdater.cpp @@ -138,7 +138,8 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy) workingCopy.insert(configurationFileName, m_configFile); m_snapshot.remove(m_fileInEditor); - static const QString editorDefinesFileName = QLatin1String("<per-editor-defines>"); + static const QString editorDefinesFileName + = CppModelManagerInterface::editorConfigurationFileName(); if (editorDefinesChanged) { m_snapshot.remove(editorDefinesFileName); workingCopy.insert(editorDefinesFileName, m_editorDefines); @@ -152,15 +153,21 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy) preproc.setIncludePaths(m_includePaths); preproc.setFrameworkPaths(m_frameworkPaths); preproc.run(configurationFileName); - if (m_usePrecompiledHeaders) + if (m_usePrecompiledHeaders) { foreach (const QString &precompiledHeader, m_precompiledHeaders) preproc.run(precompiledHeader); + } if (!m_editorDefines.isEmpty()) preproc.run(editorDefinesFileName); preproc.run(m_fileInEditor); m_snapshot = preproc.snapshot(); - m_snapshot = m_snapshot.simplified(document()); + Snapshot newSnapshot = m_snapshot.simplified(document()); + for (Snapshot::const_iterator i = m_snapshot.begin(), ei = m_snapshot.end(); i != ei; ++i) { + if (Client::isInjectedFile(i.key())) + newSnapshot.insert(i.value()); + } + m_snapshot = newSnapshot; m_deps.build(m_snapshot); foreach (Document::Ptr doc, m_snapshot) { diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 7f422ec8cc0703375f771f760d5183cc864a1ea7..71b196a710215640e48b938a716bb51b71a2cf50 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -1810,7 +1810,8 @@ void DebuggerEngine::checkForReleaseBuild(const DebuggerStartParameters &sp) } showMessageBox(QMessageBox::Information, tr("Warning"), tr("This does not seem to be a \"Debug\" build.\n" - "Setting breakpoints by file name and line number may fail.\n").append(detailedWarning)); + "Setting breakpoints by file name and line number may fail.") + + QLatin1Char('\n') + detailedWarning); } } // namespace Debugger diff --git a/src/plugins/debugger/debuggerkitconfigwidget.cpp b/src/plugins/debugger/debuggerkitconfigwidget.cpp index ece61bb99e58f1c74272e29677380f6c58083910..9d9f0b23a9a5b70b921c51b833033c790895b681 100644 --- a/src/plugins/debugger/debuggerkitconfigwidget.cpp +++ b/src/plugins/debugger/debuggerkitconfigwidget.cpp @@ -345,16 +345,11 @@ QString DebuggerKitInformation::displayString(const Kit *k) return binary.isEmpty() ? tr("%1 <None>").arg(name) : tr("%1 using \"%2\"").arg(name, binary); } -void DebuggerKitInformation::setDebugger(Kit *k, const DebuggerItem &item) +void DebuggerKitInformation::setDebugger(Kit *k, const QVariant &id) { // Only register reasonably complete debuggers. - QTC_ASSERT(!item.id().isValid(), return); - QTC_ASSERT(!item.command().isEmpty(), return); - QTC_ASSERT(!item.displayName().isEmpty(), return); - QTC_ASSERT(item.engineType() != NoEngineType, return); - // Only set registered/existing debuggers - QTC_ASSERT(DebuggerItemManager::findByCommand(item.command()), return); - k->setValue(DebuggerKitInformation::id(), item.id()); + QTC_ASSERT(DebuggerItemManager::findById(id), return); + k->setValue(DebuggerKitInformation::id(), id); } Core::Id DebuggerKitInformation::id() @@ -651,11 +646,12 @@ void DebuggerItemManager::saveDebuggers() // Do not save default debuggers as they are set by the SDK. } -void DebuggerItemManager::registerDebugger(const DebuggerItem &item) +QVariant DebuggerItemManager::registerDebugger(const DebuggerItem &item) { if (findByCommand(item.command())) - return; - addDebugger(item); + return item.id(); + + return addDebugger(item); } void DebuggerItemManager::deregisterDebugger(const DebuggerItem &item) @@ -664,13 +660,17 @@ void DebuggerItemManager::deregisterDebugger(const DebuggerItem &item) removeDebugger(item.id()); } -void DebuggerItemManager::addDebugger(const DebuggerItem& item0) +QVariant DebuggerItemManager::addDebugger(const DebuggerItem& item0) { DebuggerItem item = item0; + QTC_ASSERT(!item.command().isEmpty(), return QVariant()); + QTC_ASSERT(!item.displayName().isEmpty(), return QVariant()); + QTC_ASSERT(item.engineType() != NoEngineType, return QVariant()); if (item.id().isNull()) item.setId(QUuid::createUuid().toString()); m_debuggers.append(item); m_model->addDebugger(item); + return item.id(); } void DebuggerItemManager::removeDebugger(const QVariant &id) diff --git a/src/plugins/debugger/debuggerkitinformation.cpp b/src/plugins/debugger/debuggerkitinformation.cpp index fc01bf2e6a717e6799de726f8f0550adcb07154d..30ca4f2c23022cbf7c49cfd9163ee099b67f5194 100644 --- a/src/plugins/debugger/debuggerkitinformation.cpp +++ b/src/plugins/debugger/debuggerkitinformation.cpp @@ -199,17 +199,18 @@ static DebuggerItem::MatchLevel matchSingle(const Abi &debuggerAbi, const Abi &t && debuggerAbi.binaryFormat() != targetAbi.binaryFormat()) return DebuggerItem::DoesNotMatch; - if (debuggerAbi.wordWidth() != 0 && debuggerAbi.wordWidth() != targetAbi.wordWidth()) - return DebuggerItem::DoesNotMatch; - if (debuggerAbi.os() == Abi::WindowsOS) { if (debuggerAbi.osFlavor() == Abi::WindowsMSysFlavor && targetAbi.osFlavor() != Abi::WindowsMSysFlavor) return DebuggerItem::DoesNotMatch; if (debuggerAbi.osFlavor() != Abi::WindowsMSysFlavor && targetAbi.osFlavor() == Abi::WindowsMSysFlavor) return DebuggerItem::DoesNotMatch; - return DebuggerItem::MatchesSomewhat; } + if (debuggerAbi.wordWidth() == 64 && targetAbi.wordWidth() == 32) + return DebuggerItem::MatchesSomewhat; + if (debuggerAbi.wordWidth() != 0 && debuggerAbi.wordWidth() != targetAbi.wordWidth()) + return DebuggerItem::DoesNotMatch; + return DebuggerItem::MatchesPerfectly; } @@ -230,3 +231,109 @@ bool Debugger::DebuggerItem::isValid() const } } // namespace Debugger; + +#ifdef WITH_TESTS + +# include <QTest> +# include "debuggerplugin.h" + +void Debugger::DebuggerPlugin::testDebuggerMatching_data() +{ + QTest::addColumn<QStringList>("debugger"); + QTest::addColumn<QString>("target"); + QTest::addColumn<int>("result"); + + QTest::newRow("Invalid data") + << QStringList() + << QString() + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Invalid debugger") + << QStringList() + << QString::fromLatin1("x86-linux-generic-elf-32bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Invalid target") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString() + << int(DebuggerItem::DoesNotMatch); + + QTest::newRow("Fuzzy match 1") + << (QStringList() << QLatin1String("unknown-unknown-unknown-unknown-0bit")) + << QString::fromLatin1("x86-linux-generic-elf-32bit") + << int(DebuggerItem::MatchesPerfectly); // Is this the expected behavior? + QTest::newRow("Fuzzy match 2") + << (QStringList() << QLatin1String("unknown-unknown-unknown-unknown-0bit")) + << QString::fromLatin1("arm-windows-msys-pe-64bit") + << int(DebuggerItem::MatchesPerfectly); // Is this the expected behavior? + + QTest::newRow("Architecture mismatch") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString::fromLatin1("arm-linux-generic-elf-32bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("OS mismatch") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString::fromLatin1("x86-macosx-generic-elf-32bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Format mismatch") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString::fromLatin1("x86-linux-generic-pe-32bit") + << int(DebuggerItem::DoesNotMatch); + + QTest::newRow("Linux perfect match") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString::fromLatin1("x86-linux-generic-elf-32bit") + << int(DebuggerItem::MatchesPerfectly); + QTest::newRow("Linux match") + << (QStringList() << QLatin1String("x86-linux-generic-elf-64bit")) + << QString::fromLatin1("x86-linux-generic-elf-32bit") + << int(DebuggerItem::MatchesSomewhat); + + QTest::newRow("Windows perfect match 1") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) + << QString::fromLatin1("x86-windows-msvc2013-pe-64bit") + << int(DebuggerItem::MatchesPerfectly); + QTest::newRow("Windows perfect match 2") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) + << QString::fromLatin1("x86-windows-msvc2012-pe-64bit") + << int(DebuggerItem::MatchesPerfectly); + QTest::newRow("Windows match 1") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) + << QString::fromLatin1("x86-windows-msvc2013-pe-32bit") + << int(DebuggerItem::MatchesSomewhat); + QTest::newRow("Windows match 2") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) + << QString::fromLatin1("x86-windows-msvc2012-pe-32bit") + << int(DebuggerItem::MatchesSomewhat); + QTest::newRow("Windows mismatch on word size") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-32bit")) + << QString::fromLatin1("x86-windows-msvc2013-pe-64bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Windows mismatch on osflavor 1") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-32bit")) + << QString::fromLatin1("x86-windows-msys-pe-64bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Windows mismatch on osflavor 2") + << (QStringList() << QLatin1String("x86-windows-msys-pe-32bit")) + << QString::fromLatin1("x86-windows-msvc2010-pe-64bit") + << int(DebuggerItem::DoesNotMatch); +} + +void Debugger::DebuggerPlugin::testDebuggerMatching() +{ + QFETCH(QStringList, debugger); + QFETCH(QString, target); + QFETCH(int, result); + + DebuggerItem::MatchLevel expectedLevel = static_cast<DebuggerItem::MatchLevel>(result); + + QList<Abi> debuggerAbis; + foreach (const QString &abi, debugger) + debuggerAbis << Abi(abi); + + DebuggerItem item; + item.setAbis(debuggerAbis); + + DebuggerItem::MatchLevel level = item.matchTarget(Abi(target)); + + QCOMPARE(expectedLevel, level); +} +#endif diff --git a/src/plugins/debugger/debuggerkitinformation.h b/src/plugins/debugger/debuggerkitinformation.h index de965ca98581916074f08c8724832860b91201e8..dfdf6350a4e0ec56f8590c8e14f2739b738a879f 100644 --- a/src/plugins/debugger/debuggerkitinformation.h +++ b/src/plugins/debugger/debuggerkitinformation.h @@ -110,7 +110,7 @@ public: static QList<DebuggerItem> debuggers(); static Debugger::Internal::DebuggerItemModel *model(); - static void registerDebugger(const DebuggerItem &item); + static QVariant registerDebugger(const DebuggerItem &item); static void deregisterDebugger(const DebuggerItem &item); static const DebuggerItem *findByCommand(const Utils::FileName &command); @@ -121,7 +121,7 @@ public: static void setItemData(const QVariant &id, const QString& displayName, const Utils::FileName &fileName); static void removeDebugger(const QVariant &id); - static void addDebugger(const DebuggerItem &item); + static QVariant addDebugger(const DebuggerItem &item); public slots: void saveDebuggers(); @@ -164,7 +164,7 @@ public: ItemList toUserOutput(const ProjectExplorer::Kit *k) const; - static void setDebugger(ProjectExplorer::Kit *k, const DebuggerItem &item); + static void setDebugger(ProjectExplorer::Kit *k, const QVariant &id); static Core::Id id(); static Utils::FileName debuggerCommand(const ProjectExplorer::Kit *k); diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index c0f6429742f736222d0dec6e24910d15a20b5bcb..32790efd4f0ac1c986afaa0336c7d37557f2e4bc 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -76,6 +76,9 @@ private: #ifdef WITH_TESTS private slots: + void testDebuggerMatching_data(); + void testDebuggerMatching(); + void testBenchmark(); // void testStateMachine(); #endif diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index 13335773326e213b670cf0a2a6d21766039382f3..1e50d13c3acf45b6d83131ac858afd1fa3f7229b 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -628,6 +628,13 @@ QString decodeData(const QByteArray &ba, int encoding) const QByteArray decodedBa = QByteArray::fromHex(ba); return QString::fromUtf8(decodedBa); } + case MillisecondsSinceEpoch: { + const qint64 ms = ba.toLongLong(); + QDateTime d; + d.setTimeSpec(Qt::UTC); + d.setMSecsSinceEpoch(ms); + return d.toString(Qt::TextDate); + } } qDebug() << "ENCODING ERROR: " << encoding; return QCoreApplication::translate("Debugger", "<Encoding error>"); diff --git a/src/plugins/debugger/debuggerprotocol.h b/src/plugins/debugger/debuggerprotocol.h index 6bce7e1aec6ba20df5e77cd2125828501586c0e6..a71bb6f13313c4ac8fa95e97e6c78bca70b506e1 100644 --- a/src/plugins/debugger/debuggerprotocol.h +++ b/src/plugins/debugger/debuggerprotocol.h @@ -204,7 +204,8 @@ enum DebuggerEncoding Hex2EncodedFloat4 = 25, Hex2EncodedFloat8 = 26, IPv6AddressAndHexScopeId = 27, - Hex2EncodedUtf8WithoutQuotes = 28 + Hex2EncodedUtf8WithoutQuotes = 28, + MillisecondsSinceEpoch = 29 }; // Keep in sync with dumper.py, symbolgroupvalue.cpp of CDB diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index a301f443fe7c48cca8754b968cbb84b48a1b9a61..a7d33fdb5ec3173eca4352de7d847807890980c3 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -192,7 +192,7 @@ void DebuggerRunControl::start() // User canceled input dialog asking for executable when working on library project. if (d->m_engine->startParameters().startMode == StartInternal && d->m_engine->startParameters().executable.isEmpty()) { - appendMessage(tr("No executable specified.\n"), ErrorMessageFormat); + appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat); emit started(); emit finished(); return; @@ -232,12 +232,12 @@ void DebuggerRunControl::start() d->m_engine->startDebugger(this); if (d->m_running) - appendMessage(tr("Debugging starts\n"), NormalMessageFormat); + appendMessage(tr("Debugging starts") + QLatin1Char('\n'), NormalMessageFormat); } void DebuggerRunControl::startFailed() { - appendMessage(tr("Debugging has failed\n"), NormalMessageFormat); + appendMessage(tr("Debugging has failed") + QLatin1Char('\n'), NormalMessageFormat); d->m_running = false; emit finished(); d->m_engine->handleStartFailed(); @@ -245,7 +245,7 @@ void DebuggerRunControl::startFailed() void DebuggerRunControl::handleFinished() { - appendMessage(tr("Debugging has finished\n"), NormalMessageFormat); + appendMessage(tr("Debugging has finished") + QLatin1Char('\n'), NormalMessageFormat); if (d->m_engine) d->m_engine->handleFinished(); debuggerCore()->runControlFinished(d->m_engine); diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp index ce66963e525d82a5271cc0ff2e17dd1b3de612cd..13f6326a21f11b9dd1c16d52cf13d897139379a6 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.cpp +++ b/src/plugins/debugger/gdb/coregdbadapter.cpp @@ -211,8 +211,9 @@ void GdbCoreEngine::handleTargetCore(const GdbResponse &response) postCommand("p 5", CB(handleRoundTrip)); return; } - QString msg = tr("Attach to core \"%1\" failed:\n") + QString msg = tr("Attach to core \"%1\" failed:") .arg(startParameters().coreFile) + + QLatin1Char('\n') + QString::fromLocal8Bit(response.data["msg"].data()); notifyInferiorSetupFailed(msg); } diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index bdd1c40b36a5d83d6e11f8d228a85b3bd9ac4acf..7e8febf779c3586e8f1fb24e4d5c05ddd024c223 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1893,7 +1893,7 @@ void GdbEngine::pythonDumpersFailed() void GdbEngine::showExecutionError(const QString &message) { showMessageBox(QMessageBox::Critical, tr("Execution Error"), - tr("Cannot continue debugged process:\n") + message); + tr("Cannot continue debugged process:") + QLatin1Char('\n') + message); } void GdbEngine::handleExecuteContinue(const GdbResponse &response) @@ -2296,7 +2296,7 @@ void GdbEngine::handleExecuteNext(const GdbResponse &response) notifyInferiorRunFailed(); } else { showMessageBox(QMessageBox::Critical, tr("Execution Error"), - tr("Cannot continue debugged process:\n") + QString::fromLocal8Bit(msg)); + tr("Cannot continue debugged process:") + QLatin1Char('\n') + QString::fromLocal8Bit(msg)); notifyInferiorIll(); } } @@ -3848,7 +3848,7 @@ void GdbEngine::handleMakeSnapshot(const GdbResponse &response) } else { QByteArray msg = response.data["msg"].data(); showMessageBox(QMessageBox::Critical, tr("Snapshot Creation Error"), - tr("Cannot create snapshot:\n") + QString::fromLocal8Bit(msg)); + tr("Cannot create snapshot:") + QLatin1Char('\n') + QString::fromLocal8Bit(msg)); } } @@ -4836,8 +4836,15 @@ void GdbEngine::startGdb(const QStringList &args) // template <class T> T foo() { return T(0); } // int main() { return foo<int>(); } // (gdb) call 'int foo<int>'() - // /build/buildd/gdb-6.8/gdb/valops.c:2069: internal-error: - postCommand("set overload-resolution off"); + // /build/buildd/gdb-6.8/gdb/valops.c:2069: internal-error + // This seems to be fixed, however, with 'on' it seems to _require_ + // explicit casting of function pointers: + // GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu + // (gdb) p &Myns::QMetaType::typeName -> $1 = (const char *(*)(int)) 0xb7cf73b0 <Myns::QMetaType::typeName(int)> + // (gdb) p Myns::QMetaType::typeName(1024) -> 31^error,msg="Couldn't find method Myns::QMetaType::typeName" + // But we can work around on the dumper side. So let's use the default (i.e. 'on') + //postCommand("set overload-resolution off"); + //postCommand(_("set demangle-style none")); // From the docs: // Stop means reenter debugger if this signal happens (implies print). diff --git a/src/plugins/debugger/gdb/gdbplainengine.cpp b/src/plugins/debugger/gdb/gdbplainengine.cpp index eaa992ec75a779d22a60fc2ebad7828b64f5d4c9..4050e9048e50db3696a63e4b052916f63f7e9cb4 100644 --- a/src/plugins/debugger/gdb/gdbplainengine.cpp +++ b/src/plugins/debugger/gdb/gdbplainengine.cpp @@ -78,7 +78,7 @@ void GdbPlainEngine::handleFileExecAndSymbols(const GdbResponse &response) QString msg = fromLocalEncoding(ba); // Extend the message a bit in unknown cases. if (!ba.endsWith("File format not recognized")) - msg = tr("Starting executable failed:\n") + msg; + msg = tr("Starting executable failed:") + QLatin1Char('\n') + msg; notifyInferiorSetupFailed(msg); } } diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index fe1913d64e6aa286ba5f8e3d91550ab1d4a0c0ee..dfe658711293d994c88b06cf56f446a8a181df15 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -252,7 +252,8 @@ void GdbRemoteServerEngine::handleFileExecAndSymbols(const GdbResponse &response callTargetRemote(); } else { QByteArray reason = response.data["msg"].data(); - QString msg = tr("Reading debug information failed:\n"); + QString msg = tr("Reading debug information failed:"); + msg += QLatin1Char('\n'); msg += QString::fromLocal8Bit(reason); if (reason.endsWith("No such file or directory.")) { showMessage(_("INFERIOR STARTUP: BINARY NOT FOUND")); diff --git a/src/plugins/debugger/qml/qmladapter.cpp b/src/plugins/debugger/qml/qmladapter.cpp index ef7a7434d353c209bbfa264c56c4a74948f685c4..16c66285252a7855b6d1e464dbdef408fa5aa15c 100644 --- a/src/plugins/debugger/qml/qmladapter.cpp +++ b/src/plugins/debugger/qml/qmladapter.cpp @@ -141,7 +141,7 @@ void QmlAdapter::connectionStateChanged() switch (m_conn->state()) { case QAbstractSocket::UnconnectedState: { - showConnectionStatusMessage(tr("Disconnected.\n\n")); + showConnectionStatusMessage(tr("Disconnected.") + QLatin1String("\n\n")); emit disconnected(); break; @@ -154,7 +154,7 @@ void QmlAdapter::connectionStateChanged() break; case QAbstractSocket::ConnectedState: { - showConnectionStatusMessage(tr("Connected.\n")); + showConnectionStatusMessage(tr("Connected.") + QLatin1Char('\n')); m_connectionTimer.stop(); diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp index 9cbe253d7e42bf89985089a458b3d2ecffd3f223..8cad1a3c13c0fb25d85261a7e1f7ed9f75bff931 100644 --- a/src/plugins/debugger/watchdata.cpp +++ b/src/plugins/debugger/watchdata.cpp @@ -34,7 +34,6 @@ #include "watchutils.h" #include "debuggerprotocol.h" -#include <QTextDocument> // Qt::escape() in Qt 4 #include <QDebug> //////////////////////////////////////////////////////////////////// @@ -338,11 +337,36 @@ QString WatchData::toString() const return res + QLatin1Char('}'); } +static QString htmlEscape(const QString &plain) +{ +#if QT_VERSION >= 0x050000 + return Qt::escape(plain); +#else + // Copied from Qt to avoid GUI dependency + // (Qt::escape has been moved in Qt 5) + QString rich; + rich.reserve(int(plain.length() * qreal(1.1))); + for (int i = 0; i < plain.length(); ++i) { + if (plain.at(i) == QLatin1Char('<')) + rich += QLatin1String("<"); + else if (plain.at(i) == QLatin1Char('>')) + rich += QLatin1String(">"); + else if (plain.at(i) == QLatin1Char('&')) + rich += QLatin1String("&"); + else if (plain.at(i) == QLatin1Char('"')) + rich += QLatin1String("""); + else + rich += plain.at(i); + } + return rich; +#endif +} + // Format a tooltip fow with aligned colon. static void formatToolTipRow(QTextStream &str, const QString &category, const QString &value) { - QString val = Qt::escape(value); + QString val = htmlEscape(value); val.replace(QLatin1Char('\n'), QLatin1String("<br>")); str << "<tr><td>" << category << "</td><td> : </td><td>" << val << "</td></tr>"; diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index d06d99cd539eff3f597ab91004ee8e9bf297e487..59a65c0ac2cf00d4bb25d9181b58caa47dccb998 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -2056,22 +2056,23 @@ FakeVimHandler::Private::GlobalData FakeVimHandler::Private::g; FakeVimHandler::Private::Private(FakeVimHandler *parent, QWidget *widget) { - //static PythonHighlighterRules pythonRules; q = parent; m_textedit = qobject_cast<QTextEdit *>(widget); m_plaintextedit = qobject_cast<QPlainTextEdit *>(widget); + + init(); + if (editor()) { connect(EDITOR(document()), SIGNAL(contentsChange(int,int,int)), SLOT(onContentsChanged(int,int,int))); connect(EDITOR(document()), SIGNAL(undoCommandAdded()), SLOT(onUndoCommandAdded())); m_lastRevision = revision(); } - //new Highlighter(document(), &pythonRules); - init(); } void FakeVimHandler::Private::init() { + m_inFakeVim = false; m_findStartPosition = -1; m_visualBlockInsert = false; m_fakeEnd = false; @@ -2315,10 +2316,6 @@ void FakeVimHandler::Private::setupWidget() enterFakeVim(); resetCommandMode(); - if (m_textedit) - m_textedit->setLineWrapMode(QTextEdit::NoWrap); - else if (m_plaintextedit) - m_plaintextedit->setLineWrapMode(QPlainTextEdit::NoWrap); m_wasReadOnly = EDITOR(isReadOnly()); updateEditor(); @@ -6471,19 +6468,22 @@ int FakeVimHandler::Private::linesInDocument() const void FakeVimHandler::Private::scrollToLine(int line) { - const QTextCursor tc = EDITOR(textCursor()); - // Don't scroll if the line is already at the top. updateFirstVisibleLine(); if (line == m_firstVisibleLine) return; + const QTextCursor tc = m_cursor; + QTextCursor tc2 = tc; tc2.setPosition(document()->lastBlock().position()); EDITOR(setTextCursor(tc2)); EDITOR(ensureCursorVisible()); - tc2.setPosition(document()->findBlockByLineNumber(line).position()); + const QTextBlock block = document()->findBlockByLineNumber(line); + const QTextLine textLine = block.isValid() + ? block.layout()->lineAt(line - block.firstLineNumber()) : QTextLine(); + tc2.setPosition(block.position() + (textLine.isValid() ? textLine.textStart() : 0)); EDITOR(setTextCursor(tc2)); EDITOR(ensureCursorVisible()); @@ -6497,7 +6497,7 @@ void FakeVimHandler::Private::scrollToLine(int line) void FakeVimHandler::Private::updateFirstVisibleLine() { const QTextCursor tc = EDITOR(cursorForPosition(QPoint(0,0))); - m_firstVisibleLine = tc.block().firstLineNumber(); + m_firstVisibleLine = lineForPosition(tc.position()) - 1; } int FakeVimHandler::Private::firstVisibleLine() const @@ -6507,9 +6507,9 @@ int FakeVimHandler::Private::firstVisibleLine() const int FakeVimHandler::Private::lastVisibleLine() const { - const QTextBlock block = - document()->findBlockByLineNumber(m_firstVisibleLine + linesOnScreen()); - return block.isValid() ? block.firstLineNumber() : document()->lastBlock().firstLineNumber(); + const int line = m_firstVisibleLine + linesOnScreen(); + const QTextBlock block = document()->findBlockByLineNumber(line); + return block.isValid() ? line : document()->lastBlock().firstLineNumber(); } int FakeVimHandler::Private::lineOnTop(int count) const @@ -6538,7 +6538,7 @@ void FakeVimHandler::Private::updateScrollOffset() if (line < lineOnTop()) scrollToLine(qMax(0, line - windowScrollOffset())); else if (line > lineOnBottom()) - scrollToLine(line - linesOnScreen() + windowScrollOffset() + 1); + scrollToLine(firstVisibleLine() + line - lineOnBottom()); } void FakeVimHandler::Private::alignViewportToCursor(AlignmentFlag align, int line, @@ -7156,8 +7156,12 @@ int FakeVimHandler::Private::lastPositionInLine(int line, bool onlyVisibleLines) int FakeVimHandler::Private::lineForPosition(int pos) const { - QTextBlock block = document()->findBlock(pos); - return lineNumber(block); + const QTextBlock block = document()->findBlock(pos); + if (!block.isValid()) + return 0; + const int positionInBlock = pos - block.position(); + const int lineNumberInBlock = block.layout()->lineForTextPosition(positionInBlock).lineNumber(); + return block.firstLineNumber() + lineNumberInBlock + 1; } void FakeVimHandler::Private::toggleVisualMode(VisualMode visualMode) diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index 2af83549998c148246e39aeffec6b19a2bf69d5c..fc9f05e23ef1e2380e833e4fa4b2414ab12f5e5c 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -255,6 +255,8 @@ void GenericProject::refresh(RefreshOptions options) part->displayName = displayName(); part->projectFile = projectFilePath(); + part->includePaths += projectIncludePaths(); + Kit *k = activeTarget() ? activeTarget()->kit() : KitManager::defaultKit(); if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) { QStringList cxxflags; // FIXME: Can we do better? @@ -263,7 +265,6 @@ void GenericProject::refresh(RefreshOptions options) } part->cxxVersion = CppTools::ProjectPart::CXX11; // assume C++11 - part->includePaths += allIncludePaths(); part->defines += m_defines; // ### add _defines. @@ -337,15 +338,6 @@ QStringList GenericProject::processEntries(const QStringList &paths, return absolutePaths; } -QStringList GenericProject::allIncludePaths() const -{ - QStringList paths; - paths += m_includePaths; - paths += m_projectIncludePaths; - paths.removeDuplicates(); - return paths; -} - QStringList GenericProject::projectIncludePaths() const { return m_projectIncludePaths; @@ -356,16 +348,6 @@ QStringList GenericProject::files() const return m_files; } -QStringList GenericProject::includePaths() const -{ - return m_includePaths; -} - -void GenericProject::setIncludePaths(const QStringList &includePaths) -{ - m_includePaths = includePaths; -} - QByteArray GenericProject::defines() const { return m_defines; @@ -425,8 +407,6 @@ bool GenericProject::fromMap(const QVariantMap &map) t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t)); } - setIncludePaths(allIncludePaths()); - refresh(Everything); return true; } diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h index 0291485f1820c18bd1ac855e37d133e0e8e588b4..3022b20ba1413af1a51294fe19ac51287087a83f 100644 --- a/src/plugins/genericprojectmanager/genericproject.h +++ b/src/plugins/genericprojectmanager/genericproject.h @@ -85,7 +85,6 @@ public: void setIncludePaths(const QStringList &includePaths); QByteArray defines() const; - QStringList allIncludePaths() const; QStringList projectIncludePaths() const; QStringList files() const; @@ -111,7 +110,6 @@ private: QStringList m_rawFileList; QStringList m_files; QHash<QString, QString> m_rawListEntries; - QStringList m_includePaths; QStringList m_projectIncludePaths; QByteArray m_defines; diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.cpp b/src/plugins/genericprojectmanager/genericprojectwizard.cpp index 5f97652ca53833e82bc03d205b7aa8dc9fe12c83..0f7cbdeacd300bcc2617f0de81e3b0b63ded35f8 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.cpp +++ b/src/plugins/genericprojectmanager/genericprojectwizard.cpp @@ -163,11 +163,15 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w, QStringList includePaths; foreach (const QString &path, paths) { - QFileInfo fileInfo(dir, path); + QFileInfo fileInfo(path); QDir thisDir(fileInfo.absoluteFilePath()); - if (! thisDir.entryList(nameFilters, QDir::Files).isEmpty()) - includePaths.append(path); + if (! thisDir.entryList(nameFilters, QDir::Files).isEmpty()) { + QString relative = dir.relativeFilePath(path); + if (relative.isEmpty()) + relative = QLatin1String("."); + includePaths.append(relative); + } } Core::GeneratedFile generatedCreatorFile(creatorFileName); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 739b50fb570eef5eae8d3f01b8d4213f38a200c4..80eddec1e0d014f831be8fe5d55fc7c686839a36 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2665,11 +2665,6 @@ void GitClient::continueCommandIfNeeded(const QString &workingDirectory) { CommandInProgress command = checkCommandInProgress(workingDirectory); switch (command) { - case Merge: - continuePreviousGitCommand(workingDirectory, tr("Continue Merge"), - tr("Merge is in progress. What do you want to do?"), - tr("Continue"), QLatin1String("merge")); - break; case Rebase: case RebaseMerge: continuePreviousGitCommand(workingDirectory, tr("Continue Rebase"), @@ -2677,6 +2672,11 @@ void GitClient::continueCommandIfNeeded(const QString &workingDirectory) tr("Continue"), QLatin1String("rebase"), command != RebaseMerge); break; + case Merge: + continuePreviousGitCommand(workingDirectory, tr("Continue Merge"), + tr("You need to commit changes to finish merge.\nCommit now?"), + tr("Commit"), QLatin1String("merge")); + break; case Revert: continuePreviousGitCommand(workingDirectory, tr("Continue Revert"), tr("You need to commit changes to finish revert.\nCommit now?"), @@ -3032,9 +3032,9 @@ bool GitClient::getCommitData(const QString &workingDirectory, static inline QString msgCommitted(const QString &amendSHA1, int fileCount) { if (amendSHA1.isEmpty()) - return GitClient::tr("Committed %n file(s).\n", 0, fileCount); + return GitClient::tr("Committed %n file(s).", 0, fileCount) + QLatin1Char('\n'); if (fileCount) - return GitClient::tr("Amended \"%1\" (%n file(s)).\n", 0, fileCount).arg(amendSHA1); + return GitClient::tr("Amended \"%1\" (%n file(s)).", 0, fileCount).arg(amendSHA1) + QLatin1Char('\n'); return GitClient::tr("Amended \"%1\".").arg(amendSHA1); } diff --git a/src/plugins/git/stashdialog.cpp b/src/plugins/git/stashdialog.cpp index ffbf7ecb3fe1ad4ccb2f7c67eae6ecff1bfdbc86..fecdedddd852a3d3b6c24e043131836796fa45da 100644 --- a/src/plugins/git/stashdialog.cpp +++ b/src/plugins/git/stashdialog.cpp @@ -212,7 +212,7 @@ void StashDialog::showCurrent() { const int index = currentRow(); QTC_ASSERT(index >= 0, return); - gitClient()->show(m_repository, m_model->at(index).name); + gitClient()->show(m_repository, QString(m_model->at(index).name)); } // Suggest Branch name to restore 'stash@{0}' -> 'stash0-date' diff --git a/src/plugins/ios/iosconfigurations.cpp b/src/plugins/ios/iosconfigurations.cpp index 9dac4889b3d6901d086791ac4f1d924f543fa336..ebfca0293fcc2a532c29a01583bcf7070fbba2f0 100644 --- a/src/plugins/ios/iosconfigurations.cpp +++ b/src/plugins/ios/iosconfigurations.cpp @@ -316,7 +316,8 @@ void IosConfigurations::updateAutomaticKitList() debugger.setDisplayName(tr("IOS Debugger")); debugger.setAutoDetected(true); debugger.setAbi(pToolchain->targetAbi()); - Debugger::DebuggerKitInformation::setDebugger(newKit, debugger); + QVariant id = Debugger::DebuggerItemManager::registerDebugger(debugger); + Debugger::DebuggerKitInformation::setDebugger(newKit, id); SysRootKitInformation::setSysRoot(newKit, p.sdkPath); // QmakeProjectManager::QmakeKitInformation::setMkspec(newKit, diff --git a/src/plugins/ios/iosruncontrol.cpp b/src/plugins/ios/iosruncontrol.cpp index 551ef33f85f59fc72d25d685aaa2afe8e1c7e0af..6db4fa7d44690b5e03e37b1746576bdf72598e82 100644 --- a/src/plugins/ios/iosruncontrol.cpp +++ b/src/plugins/ios/iosruncontrol.cpp @@ -64,7 +64,7 @@ void IosRunControl::start() SLOT(handleRemoteOutput(QString))); connect(m_runner, SIGNAL(finished(bool)), SLOT(handleRemoteProcessFinished(bool))); - appendMessage(tr("Starting remote process.\n"), Utils::NormalMessageFormat); + appendMessage(tr("Starting remote process.") + QLatin1Char('\n'), Utils::NormalMessageFormat); m_runner->start(); } diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index dbfef44220aed6686b425e57676e42a7cd3bad4c..a3667fbeceb2d9d54fec7f5b77fa5b7bd38af14d 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -285,7 +285,7 @@ void ApplicationLauncher::bringToForeground() QString ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput() { - return tr("Cannot retrieve debugging output.\n"); + return tr("Cannot retrieve debugging output.") + QLatin1Char('\n'); } } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.cpp b/src/plugins/projectexplorer/localapplicationruncontrol.cpp index ff19195f15c27c21ea7f9b855b7232dd2df47a01..4a680a551dccc82e6080d1a853f04de929961bec 100644 --- a/src/plugins/projectexplorer/localapplicationruncontrol.cpp +++ b/src/plugins/projectexplorer/localapplicationruncontrol.cpp @@ -98,15 +98,15 @@ void LocalApplicationRunControl::start() { emit started(); if (m_executable.isEmpty()) { - appendMessage(tr("No executable specified.\n"), Utils::ErrorMessageFormat); + appendMessage(tr("No executable specified.") + QLatin1Char('\n'), Utils::ErrorMessageFormat); emit finished(); } else if (!QFileInfo(m_executable).exists()){ - appendMessage(tr("Executable %1 does not exist.\n").arg(m_executable), + appendMessage(tr("Executable %1 does not exist.").arg(m_executable) + QLatin1Char('\n'), Utils::ErrorMessageFormat); emit finished(); } else { m_running = true; - QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable)); + QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)) + QLatin1Char('\n'); appendMessage(msg, Utils::NormalMessageFormat); m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments); setApplicationProcessHandle(ProcessHandle(m_applicationLauncher.applicationPID())); @@ -147,13 +147,13 @@ void LocalApplicationRunControl::processExited(int exitCode, QProcess::ExitStatu setApplicationProcessHandle(ProcessHandle()); QString msg; if (status == QProcess::CrashExit) { - msg = tr("%1 crashed\n") + msg = tr("%1 crashed") .arg(QDir::toNativeSeparators(m_executable)); } else { - msg = tr("%1 exited with code %2\n") + msg = tr("%1 exited with code %2") .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); } - appendMessage(msg, Utils::NormalMessageFormat); + appendMessage(msg + QLatin1Char('\n'), Utils::NormalMessageFormat); emit finished(); } diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 26385f6c12395fbcd33e3364ca4c4fd9e143d5bd..6321d7a0dabdef590b0a146c504d0a26f6b20475 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1985,8 +1985,8 @@ int ProjectExplorerPlugin::queue(QList<Project *> projects, QList<Id> stepIds) foreach (Project *pro, projects) if (pro && pro->needsConfiguration()) - preambleMessage.append(tr("The project %1 is not configured, skipping it.\n") - .arg(pro->displayName())); + preambleMessage.append(tr("The project %1 is not configured, skipping it.") + .arg(pro->displayName()) + QLatin1Char('\n')); foreach (Id id, stepIds) { foreach (Project *pro, projects) { if (!pro || !pro->activeTarget()) @@ -2204,9 +2204,10 @@ QPair<bool, QString> ProjectExplorerPlugin::buildSettingsEnabledForSession() && project->activeTarget()->activeBuildConfiguration() && !project->activeTarget()->activeBuildConfiguration()->isEnabled()) { result.first = false; - result.second += tr("Building '%1' is disabled: %2\n") + result.second += tr("Building '%1' is disabled: %2") .arg(project->displayName(), project->activeTarget()->activeBuildConfiguration()->disabledReason()); + result.second += QLatin1Char('\n'); } } } @@ -2788,7 +2789,8 @@ void ProjectExplorerPlugin::addExistingFiles(ProjectNode *projectNode, const QSt projectNode->addFiles(fileNames, ¬Added); if (!notAdded.isEmpty()) { - QString message = tr("Could not add following files to project %1:\n").arg(projectNode->displayName()); + QString message = tr("Could not add following files to project %1:").arg(projectNode->displayName()); + message += QLatin1Char('\n'); QString files = notAdded.join(QString(QLatin1Char('\n'))); QMessageBox::warning(ICore::mainWindow(), tr("Adding Files to Project Failed"), message + files); diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp index f7d3c32db429d4260ca72caeab770451882b6f48..24cba5f192aa341d6d3e1432629be6b631992141 100644 --- a/src/plugins/projectexplorer/projectfilewizardextension.cpp +++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp @@ -303,7 +303,8 @@ void ProjectFileWizardExtension::firstExtensionPageShown( // <Implicitly Add> m_context->page->setNoneLabel(tr("<Implicitly Add>")); - QString text = tr("The files are implicitly added to the projects:\n"); + QString text = tr("The files are implicitly added to the projects:"); + text += QLatin1Char('\n'); foreach (const ProjectEntry &project, deployingProjects) { text += project.fileName; text += QLatin1Char('\n'); diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index 0cf020a9c72f865544d06e94bbdec0088311bc75..edf84b03cbf0fb8fa3627c18f74c2f03930f793b 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -237,14 +237,15 @@ RunSettingsWidget::RunSettingsWidget(Target *target) m_addRunMenu = new QMenu(m_addRunToolButton); m_addRunToolButton->setMenu(m_addRunMenu); + RunConfiguration *rc = m_target->activeRunConfiguration(); m_runConfigurationCombo->setModel(m_runConfigurationsModel); m_runConfigurationCombo->setCurrentIndex( - m_runConfigurationsModel->indexFor(m_target->activeRunConfiguration()).row()); + m_runConfigurationsModel->indexFor(rc).row()); m_removeRunToolButton->setEnabled(m_target->runConfigurations().size() > 1); - m_renameRunButton->setEnabled(m_target->activeRunConfiguration()); + m_renameRunButton->setEnabled(rc); - setConfigurationWidget(m_target->activeRunConfiguration()); + setConfigurationWidget(rc); connect(m_addRunMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowAddMenu())); @@ -523,12 +524,16 @@ void RunSettingsWidget::updateDeployConfiguration(DeployConfiguration *dc) void RunSettingsWidget::setConfigurationWidget(RunConfiguration *rc) { + if (rc == m_runConfiguration) + return; + delete m_runConfigurationWidget; m_runConfigurationWidget = 0; removeSubWidgets(); if (!rc) return; m_runConfigurationWidget = rc->createConfigurationWidget(); + m_runConfiguration = rc; if (m_runConfigurationWidget) m_runLayout->addWidget(m_runConfigurationWidget); @@ -567,7 +572,7 @@ QString RunSettingsWidget::uniqueRCName(const QString &name) void RunSettingsWidget::addRunControlWidgets() { - foreach (IRunConfigurationAspect *aspect, m_target->activeRunConfiguration()->extraAspects()) { + foreach (IRunConfigurationAspect *aspect, m_runConfiguration->extraAspects()) { ProjectExplorer::RunConfigWidget *rcw = aspect->createConfigurationWidget(); if (rcw) addSubWidget(rcw); diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index d062862a2c66ed9c77a4b4739b65907bf7c49f89..504871cb5b6ee7e729f355c2a0b7987f9447f28d 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -403,13 +403,15 @@ Target *TargetSettingsPanelWidget::cloneTarget(Target *sourceTarget, Kit *k) QString error; if (!buildconfigurationError.isEmpty()) - error += tr("Build configurations:\n") + error += tr("Build configurations:") + + QLatin1Char('\n') + buildconfigurationError.join(QLatin1String("\n")); if (!deployconfigurationError.isEmpty()) { if (!error.isEmpty()) error.append(QLatin1Char('\n')); - error += tr("Deploy configurations:\n") + error += tr("Deploy configurations:") + + QLatin1Char('\n') + deployconfigurationError.join(QLatin1String("\n")); } diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index 87123b5ef6856a11a3d5672becd475dddc8afea2..03f5c72654c6c4f066c28363448e05768a12cf9d 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -115,6 +115,8 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) : connect(&m_parsingDelay, SIGNAL(timeout()), this, SLOT(parseCurrentBuildConfiguration())); updateDocuments(QSet<QString>() << fileName); + + // NOTE: QbsProjectNode does not use this as a parent! m_rootProjectNode = new QbsProjectNode(this); // needs documents to be initialized! } @@ -126,6 +128,12 @@ QbsProject::~QbsProject() m_qbsSetupProjectJob->cancel(); delete m_qbsSetupProjectJob; } + + // Deleting the root node triggers a few things, make sure rootProjectNode + // returns 0 already + QbsProjectNode *root = m_rootProjectNode; + m_rootProjectNode = 0; + delete root; } QString QbsProject::displayName() const diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp index 51d45174765d5061370a65d41732f1bf51b03065..195a24afb34cc5316d35b54213cd07ad0485db03 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp @@ -29,6 +29,8 @@ #include "propertyeditorcontextobject.h" +#include <QQmlContext> + namespace QmlDesigner { PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) : @@ -37,7 +39,9 @@ PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) : m_selectionChanged(false), m_backendValues(0), m_majorVersion(-1), - m_minorVersion(-1) + m_minorVersion(-1), + m_qmlComponent(0), + m_qmlContext(0) { } @@ -73,4 +77,94 @@ void PropertyEditorContextObject::setMinorVersion(int minorVersion) emit minorVersionChanged(); } +void PropertyEditorContextObject::insertInQmlContext(QQmlContext *context) +{ + m_qmlContext = context; + m_qmlContext->setContextObject(this); +} + +QQmlComponent *PropertyEditorContextObject::specificQmlComponent() +{ + if (m_qmlComponent) + return m_qmlComponent; + + m_qmlComponent = new QQmlComponent(m_qmlContext->engine(), this); + + m_qmlComponent->setData(m_specificQmlData.toAscii(), QUrl::fromLocalFile("specfics.qml")); + + return m_qmlComponent; +} + +void PropertyEditorContextObject::setGlobalBaseUrl(const QUrl &newBaseUrl) +{ + if (newBaseUrl == m_globalBaseUrl) + return; + + m_globalBaseUrl = newBaseUrl; + emit globalBaseUrlChanged(); +} + +void PropertyEditorContextObject::setSpecificsUrl(const QUrl &newSpecificsUrl) +{ + if (newSpecificsUrl == m_specificsUrl) + return; + + m_specificsUrl = newSpecificsUrl; + emit specificsUrlChanged(); +} + +void PropertyEditorContextObject::setSpecificQmlData(const QString &newSpecificQmlData) +{ + if (m_specificQmlData == newSpecificQmlData) + return; + + m_specificQmlData = newSpecificQmlData; + emit specificQmlDataChanged(); + + delete m_qmlComponent; + m_qmlComponent = 0; + emit specificQmlComponentChanged(); +} + +void PropertyEditorContextObject::setStateName(const QString &newStateName) +{ + if (newStateName == m_stateName) + return; + + m_stateName = newStateName; + emit stateNameChanged(); +} + +void PropertyEditorContextObject::setIsBaseState(bool newIsBaseState) +{ + if (newIsBaseState == m_isBaseState) + return; + + m_isBaseState = newIsBaseState; + emit isBaseStateChanged(); +} + +void PropertyEditorContextObject::setSelectionChanged(bool newSelectionChanged) +{ + if (newSelectionChanged == m_selectionChanged) + return; + + m_selectionChanged = newSelectionChanged; + emit selectionChangedChanged(); +} + +void PropertyEditorContextObject::setBackendValues(QQmlPropertyMap *newBackendValues) +{ + if (newBackendValues == m_backendValues) + return; + + m_backendValues = newBackendValues; + emit backendValuesChanged(); +} + +void PropertyEditorContextObject::triggerSelectionChanged() +{ + setSelectionChanged(!m_selectionChanged); +} + } //QmlDesigner diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h index 96f43da3cad1cf539c4e7445408e99d55a154a88..6eb7b9bd4b49064333d954a8b4c79d85e3bd3988 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h @@ -33,6 +33,7 @@ #include <QObject> #include <QUrl> #include <QQmlPropertyMap> +#include <QQmlComponent> #include <QColor> namespace QmlDesigner { @@ -55,6 +56,8 @@ class PropertyEditorContextObject : public QObject Q_PROPERTY(QQmlPropertyMap* backendValues READ backendValues WRITE setBackendValues NOTIFY backendValuesChanged) + Q_PROPERTY(QQmlComponent* specificQmlComponent READ specificQmlComponent NOTIFY specificQmlComponentChanged) + public: PropertyEditorContextObject(QObject *parent = 0); @@ -75,6 +78,9 @@ public: int minorVersion() const; void setMinorVersion(int minorVersion); + void insertInQmlContext(QQmlContext *context); + QQmlComponent *specificQmlComponent(); + signals: void globalBaseUrlChanged(); void specificsUrlChanged(); @@ -85,75 +91,24 @@ signals: void backendValuesChanged(); void majorVersionChanged(); void minorVersionChanged(); + void specificQmlComponentChanged(); public slots: - void setGlobalBaseUrl(const QUrl &newBaseUrl) - { - if (newBaseUrl == m_globalBaseUrl) - return; - - m_globalBaseUrl = newBaseUrl; - emit globalBaseUrlChanged(); - } - - void setSpecificsUrl(const QUrl &newSpecificsUrl) - { - if (newSpecificsUrl == m_specificsUrl) - return; - - m_specificsUrl = newSpecificsUrl; - emit specificsUrlChanged(); - } - - void setSpecificQmlData(const QString &newSpecificQmlData) - { - if (m_specificQmlData == newSpecificQmlData) - return; - - m_specificQmlData = newSpecificQmlData; - emit specificQmlDataChanged(); - } - - void setStateName(const QString &newStateName) - { - if (newStateName == m_stateName) - return; - - m_stateName = newStateName; - emit stateNameChanged(); - } - - void setIsBaseState(bool newIsBaseState) - { - if (newIsBaseState == m_isBaseState) - return; - - m_isBaseState = newIsBaseState; - emit isBaseStateChanged(); - } - - void setSelectionChanged(bool newSelectionChanged) - { - if (newSelectionChanged == m_selectionChanged) - return; - - m_selectionChanged = newSelectionChanged; - emit selectionChangedChanged(); - } - - void setBackendValues(QQmlPropertyMap* newBackendValues) - { - if (newBackendValues == m_backendValues) - return; - - m_backendValues = newBackendValues; - emit backendValuesChanged(); - } - - void triggerSelectionChanged() - { - setSelectionChanged(!m_selectionChanged); - } + void setGlobalBaseUrl(const QUrl &newBaseUrl); + + void setSpecificsUrl(const QUrl &newSpecificsUrl); + + void setSpecificQmlData(const QString &newSpecificQmlData); + + void setStateName(const QString &newStateName); + + void setIsBaseState(bool newIsBaseState); + + void setSelectionChanged(bool newSelectionChanged); + + void setBackendValues(QQmlPropertyMap* newBackendValues); + + void triggerSelectionChanged(); private: QUrl m_globalBaseUrl; @@ -169,6 +124,8 @@ private: int m_majorVersion; int m_minorVersion; + QQmlComponent *m_qmlComponent; + QQmlContext *m_qmlContext; }; } //QmlDesigner { diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index 37fa5bc6df60e639db7bed1b1af967cef8e65404..05b2511778b71fed3206a28e1b3729c5d3dfe987 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -129,7 +129,7 @@ PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyE m_dummyPropertyEditorValue->setValue("#000000"); context()->setContextProperty("dummyBackendValue", m_dummyPropertyEditorValue.data()); m_contextObject->setBackendValues(&m_backendValuesPropertyMap); - context()->setContextObject(m_contextObject.data()); + m_contextObject->insertInQmlContext(context()); QObject::connect(&m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)), propertyEditor, SLOT(changeValue(QString))); } @@ -352,9 +352,9 @@ QString PropertyEditorQmlBackend::templateGeneration(NodeMetaInfo type, QStringList imports = variantToStringList(templateConfiguration()->property(QLatin1String("imports"))); QString qmlTemplate = imports.join(QLatin1String("\n")) + QLatin1Char('\n'); - qmlTemplate += QLatin1String("GroupBox {\n"); + qmlTemplate += QLatin1String("Section {\n"); qmlTemplate += QString(QLatin1String("caption: \"%1\"\n")).arg(QString::fromUtf8(objectNode.modelNode().simplifiedTypeName())); - qmlTemplate += QLatin1String("layout: VerticalLayout {\n"); + qmlTemplate += QLatin1String("SectionLayout {\n"); QList<PropertyName> orderedList = type.propertyNames(); qSort(orderedList); @@ -390,8 +390,8 @@ QString PropertyEditorQmlBackend::templateGeneration(NodeMetaInfo type, } } } - qmlTemplate += QLatin1String("}\n"); //VerticalLayout - qmlTemplate += QLatin1String("}\n"); //GroupBox + qmlTemplate += QLatin1String("}\n"); //Section + qmlTemplate += QLatin1String("}\n"); //SectionLayout if (emptyTemplate) return QString(); diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp index 5375d03a0af6a8cbf87c058345ca8659f093db4a..1bb16e1cb77e1acb823e7333f75b5c96128a6149 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp @@ -64,7 +64,7 @@ static inline void restoreProperty(ModelNode node, const PropertyName &propertyN namespace Internal { QmlAnchorBindingProxy::QmlAnchorBindingProxy(QObject *parent) : - QObject(parent), m_locked(false) + QObject(parent), m_locked(false), m_ignoreQml(false) { } @@ -76,6 +76,8 @@ void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode) { m_qmlItemNode = fxItemNode; + m_ignoreQml = true; + if (m_qmlItemNode.modelNode().hasParentProperty()) { setDefaultAnchorTarget(m_qmlItemNode.modelNode().parentProperty().parentModelNode()); } else { @@ -137,6 +139,10 @@ void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode) emit verticalTargetChanged(); emit horizontalTargetChanged(); } + + emit invalidated(); + + m_ignoreQml = false; } void QmlAnchorBindingProxy::invalidate(const QmlItemNode &fxItemNode) @@ -146,6 +152,8 @@ void QmlAnchorBindingProxy::invalidate(const QmlItemNode &fxItemNode) m_qmlItemNode = fxItemNode; + m_ignoreQml = true; + m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_qmlItemNode.modelNode().parentProperty().parentModelNode(); if (topAnchored()) { @@ -201,6 +209,10 @@ void QmlAnchorBindingProxy::invalidate(const QmlItemNode &fxItemNode) emit verticalTargetChanged(); emit horizontalTargetChanged(); } + + emit invalidated(); + + m_ignoreQml = false; } bool QmlAnchorBindingProxy::hasParent() @@ -243,13 +255,20 @@ bool QmlAnchorBindingProxy::hasAnchors() } -void QmlAnchorBindingProxy::setTopTarget(const QVariant &target) +void QmlAnchorBindingProxy::setTopTarget(const QString &target) { - QmlItemNode newTarget(target.value<ModelNode>()); + + if (m_ignoreQml) + return; + + QmlItemNode newTarget(targetIdToNode(target)); if (newTarget == m_topTarget) return; + if (!newTarget.isValid()) + return; + RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(); m_topTarget = newTarget; @@ -259,13 +278,22 @@ void QmlAnchorBindingProxy::setTopTarget(const QVariant &target) } -void QmlAnchorBindingProxy::setBottomTarget(const QVariant &target) +void QmlAnchorBindingProxy::setBottomTarget(const QString &target) { - QmlItemNode newTarget(target.value<ModelNode>()); + if (m_ignoreQml) + return; + + if (m_ignoreQml) + return; + + QmlItemNode newTarget(targetIdToNode(target)); if (newTarget == m_bottomTarget) return; + if (!newTarget.isValid()) + return; + RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(); m_bottomTarget = newTarget; @@ -274,13 +302,19 @@ void QmlAnchorBindingProxy::setBottomTarget(const QVariant &target) emit bottomTargetChanged(); } -void QmlAnchorBindingProxy::setLeftTarget(const QVariant &target) +void QmlAnchorBindingProxy::setLeftTarget(const QString &target) { - QmlItemNode newTarget(target.value<ModelNode>()); + if (m_ignoreQml) + return; + + QmlItemNode newTarget(targetIdToNode(target)); if (newTarget == m_leftTarget) return; + if (!newTarget.isValid()) + return; + RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(); m_leftTarget = newTarget; @@ -289,13 +323,19 @@ void QmlAnchorBindingProxy::setLeftTarget(const QVariant &target) emit leftTargetChanged(); } -void QmlAnchorBindingProxy::setRightTarget(const QVariant &target) +void QmlAnchorBindingProxy::setRightTarget(const QString &target) { - QmlItemNode newTarget(target.value<ModelNode>()); + if (m_ignoreQml) + return; + + QmlItemNode newTarget(targetIdToNode(target)); if (newTarget == m_rightTarget) return; + if (!newTarget.isValid()) + return; + RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(); m_rightTarget = newTarget; @@ -304,13 +344,19 @@ void QmlAnchorBindingProxy::setRightTarget(const QVariant &target) emit rightTargetChanged(); } -void QmlAnchorBindingProxy::setVerticalTarget(const QVariant &target) +void QmlAnchorBindingProxy::setVerticalTarget(const QString &target) { - QmlItemNode newTarget(target.value<ModelNode>()); + if (m_ignoreQml) + return; + + QmlItemNode newTarget(targetIdToNode(target)); if (newTarget == m_verticalTarget) return; + if (!newTarget.isValid()) + return; + RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(); m_verticalTarget = newTarget; @@ -319,13 +365,19 @@ void QmlAnchorBindingProxy::setVerticalTarget(const QVariant &target) emit verticalTargetChanged(); } -void QmlAnchorBindingProxy::setHorizontalTarget(const QVariant &target) +void QmlAnchorBindingProxy::setHorizontalTarget(const QString &target) { - QmlItemNode newTarget(target.value<ModelNode>()); + if (m_ignoreQml) + return; + + QmlItemNode newTarget(targetIdToNode(target)); if (newTarget == m_horizontalTarget) return; + if (!newTarget.isValid()) + return; + RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(); m_horizontalTarget = newTarget; @@ -334,6 +386,43 @@ void QmlAnchorBindingProxy::setHorizontalTarget(const QVariant &target) emit horizontalTargetChanged(); } +QStringList QmlAnchorBindingProxy::possibleTargetItems() const +{ + QStringList stringList; + if (!m_qmlItemNode.isValid()) + return stringList; + + QList<QmlItemNode> itemList; + + if (m_qmlItemNode.instanceParent().modelNode().isValid()) + itemList = toQmlItemNodeList(m_qmlItemNode.instanceParent().modelNode().allDirectSubModelNodes()); + itemList.removeOne(m_qmlItemNode); + //We currently have no instanceChildren(). + //So we double check here if the instanceParents are equal. + foreach (const QmlItemNode &node, itemList) + if (node.isValid() && (node.instanceParent().modelNode() != m_qmlItemNode.instanceParent().modelNode())) + itemList.removeAll(node); + + foreach (const QmlItemNode &itemNode, itemList) { + if (itemNode.isValid() && !itemNode.id().isEmpty()) { + stringList.append(itemNode.id()); + } + } + + QmlItemNode parent(m_qmlItemNode.instanceParent().toQmlItemNode()); + + if (parent.isValid()) { + stringList.append(QLatin1String("parent")); + } + + return stringList; +} + +int QmlAnchorBindingProxy::indexOfPossibleTargetItem(const QString &targetName) const +{ + return possibleTargetItems().indexOf(targetName); +} + void QmlAnchorBindingProxy::resetLayout() { RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(); @@ -512,6 +601,29 @@ void QmlAnchorBindingProxy::calcRightMargin() m_locked = false; } +QmlItemNode QmlAnchorBindingProxy::targetIdToNode(const QString &id) const +{ + QmlItemNode itemNode; + + if (m_qmlItemNode.isValid() && m_qmlItemNode.view()) { + + itemNode = m_qmlItemNode.view()->modelNodeForId(id); + + if (id == QLatin1String("parent")) + itemNode = m_qmlItemNode.instanceParent().modelNode(); + } + + return itemNode; +} + +QString QmlAnchorBindingProxy::idForNode(const QmlItemNode &qmlItemNode) const +{ + if (m_qmlItemNode.instanceParent().modelNode() == qmlItemNode) + return QLatin1String("parent"); + + return qmlItemNode.id(); +} + ModelNode QmlAnchorBindingProxy::modelNode() const { return m_qmlItemNode.modelNode(); @@ -633,6 +745,37 @@ bool QmlAnchorBindingProxy::verticalCentered() return m_qmlItemNode.isValid() && m_qmlItemNode.anchors().instanceHasAnchor(AnchorLine::VerticalCenter); } +QString QmlAnchorBindingProxy::topTarget() const +{ + qDebug() << "top node" << idForNode(m_topTarget); + return idForNode(m_topTarget); +} + +QString QmlAnchorBindingProxy::bottomTarget() const +{ + return idForNode(m_bottomTarget); +} + +QString QmlAnchorBindingProxy::leftTarget() const +{ + return idForNode(m_leftTarget); +} + +QString QmlAnchorBindingProxy::rightTarget() const +{ + return idForNode(m_rightTarget); +} + +QString QmlAnchorBindingProxy::verticalTarget() const +{ + return idForNode(m_verticalTarget); +} + +QString QmlAnchorBindingProxy::horizontalTarget() const +{ + return idForNode(m_horizontalTarget); +} + bool QmlAnchorBindingProxy::horizontalCentered() { return m_qmlItemNode.isValid() && m_qmlItemNode.anchors().instanceHasAnchor(AnchorLine::HorizontalCenter); diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.h b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.h index 619fcf0c5caefd0210de1a20e6d9020402f34126..f79e1b5b9369f35f34ceb1795feae2dbe371b0f6 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.h +++ b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.h @@ -52,13 +52,13 @@ class QmlAnchorBindingProxy : public QObject Q_PROPERTY(bool rightAnchored READ rightAnchored WRITE setRightAnchor NOTIFY rightAnchorChanged) Q_PROPERTY(bool hasParent READ hasParent NOTIFY parentChanged) - Q_PROPERTY(QVariant topTarget READ topTarget WRITE setTopTarget NOTIFY topTargetChanged) - Q_PROPERTY(QVariant bottomTarget READ bottomTarget WRITE setBottomTarget NOTIFY bottomTargetChanged) - Q_PROPERTY(QVariant leftTarget READ leftTarget WRITE setLeftTarget NOTIFY leftTargetChanged) - Q_PROPERTY(QVariant rightTarget READ rightTarget WRITE setRightTarget NOTIFY rightTargetChanged) + Q_PROPERTY(QString topTarget READ topTarget WRITE setTopTarget NOTIFY topTargetChanged) + Q_PROPERTY(QString bottomTarget READ bottomTarget WRITE setBottomTarget NOTIFY bottomTargetChanged) + Q_PROPERTY(QString leftTarget READ leftTarget WRITE setLeftTarget NOTIFY leftTargetChanged) + Q_PROPERTY(QString rightTarget READ rightTarget WRITE setRightTarget NOTIFY rightTargetChanged) - Q_PROPERTY(QVariant verticalTarget READ verticalTarget WRITE setVerticalTarget NOTIFY verticalTargetChanged) - Q_PROPERTY(QVariant horizontalTarget READ horizontalTarget WRITE setHorizontalTarget NOTIFY horizontalTargetChanged) + Q_PROPERTY(QString verticalTarget READ verticalTarget WRITE setVerticalTarget NOTIFY verticalTargetChanged) + Q_PROPERTY(QString horizontalTarget READ horizontalTarget WRITE setHorizontalTarget NOTIFY horizontalTargetChanged) Q_PROPERTY(bool hasAnchors READ hasAnchors NOTIFY anchorsChanged) Q_PROPERTY(bool isFilled READ isFilled NOTIFY anchorsChanged) @@ -67,6 +67,8 @@ class QmlAnchorBindingProxy : public QObject Q_PROPERTY(bool verticalCentered READ verticalCentered WRITE setVerticalCentered NOTIFY centeredVChanged) Q_PROPERTY(QVariant itemNode READ itemNode NOTIFY itemNodeChanged) + Q_PROPERTY(QStringList possibleTargetItems READ possibleTargetItems NOTIFY itemNodeChanged) + public: //only enable if node has parent @@ -92,23 +94,26 @@ public: bool horizontalCentered(); bool verticalCentered(); - QVariant itemNode() const { return QVariant::fromValue(m_qmlItemNode.modelNode()); } + QVariant itemNode() const { return QVariant::fromValue(m_qmlItemNode.modelNode().id()); } - QVariant topTarget() const { return QVariant::fromValue(m_topTarget.modelNode()); } - QVariant bottomTarget() const { return QVariant::fromValue(m_bottomTarget.modelNode()); } - QVariant leftTarget() const { return QVariant::fromValue(m_leftTarget.modelNode()); } - QVariant rightTarget() const { return QVariant::fromValue(m_rightTarget.modelNode()); } + QString topTarget() const; + QString bottomTarget() const; + QString leftTarget() const; + QString rightTarget() const; - QVariant verticalTarget() const { return QVariant::fromValue(m_verticalTarget.modelNode()); } - QVariant horizontalTarget() const { return QVariant::fromValue(m_horizontalTarget.modelNode()); } + QString verticalTarget() const; + QString horizontalTarget() const; public: - void setTopTarget(const QVariant &target); - void setBottomTarget(const QVariant &target); - void setLeftTarget(const QVariant &target); - void setRightTarget(const QVariant &target); - void setVerticalTarget(const QVariant &target); - void setHorizontalTarget(const QVariant &target); + void setTopTarget(const QString &target); + void setBottomTarget(const QString &target); + void setLeftTarget(const QString &target); + void setRightTarget(const QString &target); + void setVerticalTarget(const QString &target); + void setHorizontalTarget(const QString &target); + + QStringList possibleTargetItems() const; + Q_INVOKABLE int indexOfPossibleTargetItem(const QString &targetName) const; public slots: @@ -142,12 +147,16 @@ signals: void verticalTargetChanged(); void horizontalTargetChanged(); + void invalidated(); + private: void setDefaultAnchorTarget(const ModelNode &modelNode); void calcTopMargin(); void calcBottomMargin(); void calcLeftMargin(); void calcRightMargin(); + QmlItemNode targetIdToNode(const QString &id) const; + QString idForNode(const QmlItemNode &qmlItemNode) const; ModelNode modelNode() const; @@ -168,6 +177,7 @@ private: QmlItemNode m_horizontalTarget; bool m_locked; + bool m_ignoreQml; }; } // namespace Internal diff --git a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp index 0bb87dd813e3680d4f88a29bdb86906c863f0880..97f0a00eba41fa840f646f6f1de30a86ac861814 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp @@ -36,7 +36,7 @@ using namespace QmlDesigner; using namespace QmlJS::AST; ASTObjectTextExtractor::ASTObjectTextExtractor(const QString &text): - m_document(Document::create("<ASTObjectTextExtractor>", Document::QmlLanguage)) + m_document(Document::create("<ASTObjectTextExtractor>", Language::Qml)) { m_document->setSource(text); m_document->parseQml(); diff --git a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp index d35b1d5f93166b1f047502e4e7f70d16871fd05b..615d049925dbd759477fa6ab3a7bc15bd55eafef 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp @@ -38,7 +38,7 @@ using namespace QmlDesigner; using namespace QmlJS::AST; FirstDefinitionFinder::FirstDefinitionFinder(const QString &text): - m_doc(Document::create("<internal>", Document::QmlLanguage)) + m_doc(Document::create("<internal>", Language::Qml)) { m_doc->setSource(text); bool ok = m_doc->parseQml(); diff --git a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp index 7e0cedd4d4786876af3c352f607f6c8f4db0ddd4..3290c86d454da99953a0224cd1368c789c1d256d 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp @@ -36,7 +36,7 @@ using namespace QmlDesigner; using namespace QmlJS::AST; ObjectLengthCalculator::ObjectLengthCalculator(): - m_doc(Document::create("<internal>", Document::QmlLanguage)) + m_doc(Document::create("<internal>", Language::Qml)) { } diff --git a/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp b/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp index 674e2a1aa7fd05bae33ca484621214a19849186d..5b1916a9b12179f634b2a35b6558c873bc6d7aa1 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp @@ -59,7 +59,7 @@ bool QmlRefactoring::reparseDocument() // qDebug() << "QmlRefactoring::reparseDocument() new QML source:" << newSource; - Document::MutablePtr tmpDocument(Document::create("<ModelToTextMerger>", Document::QmlLanguage)); + Document::MutablePtr tmpDocument(Document::create("<ModelToTextMerger>", Language::Qml)); tmpDocument->setSource(newSource); if (tmpDocument->parseQml()) { diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 94e9bbc0189efb991f6215fbe04b4ccd8ba93790..e5b5180233ad5410f77669ccdb83abc6af1935ab 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -40,6 +40,7 @@ #include <qmljs/qmljsscopechain.h> #include <qmljs/parser/qmljsast_p.h> #include <qmljs/qmljsmodelmanagerinterface.h> +#include <languageutils/fakemetaobject.h> namespace QmlDesigner { @@ -544,7 +545,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i m_isFileComponent = true; const Imports *imports = context()->imports(document()); ImportInfo importInfo = imports->info(lookupNameComponent().last(), context().data()); - if (importInfo.isValid() && importInfo.type() == ImportInfo::LibraryImport) { + if (importInfo.isValid() && importInfo.type() == ImportType::Library) { m_majorVersion = importInfo.version().majorVersion(); m_minorVersion = importInfo.version().minorVersion(); } @@ -775,8 +776,20 @@ QString NodeMetaInfoPrivate::propertyEnumScope(const PropertyName &propertyName) return QString(); const CppComponentValue *definedIn = 0; qmlObjectValue->getEnum(propertyType(propertyName), &definedIn); - if (definedIn) + if (definedIn) { + QString nonCppPackage; + foreach (const LanguageUtils::FakeMetaObject::Export &qmlExport, definedIn->metaObject()->exports()) { + if (qmlExport.package != QLatin1String("<cpp>")) + nonCppPackage = qmlExport.package; + } + + const LanguageUtils::FakeMetaObject::Export qmlExport = + definedIn->metaObject()->exportInPackage(nonCppPackage); + if (qmlExport.isValid()) + return qmlExport.type; + return definedIn->className(); + } return QString(); } @@ -937,9 +950,9 @@ QString NodeMetaInfoPrivate::importDirectoryPath() const const Imports *imports = context()->imports(document()); ImportInfo importInfo = imports->info(lookupNameComponent().last(), context().data()); - if (importInfo.type() == ImportInfo::DirectoryImport) { + if (importInfo.type() == ImportType::Directory) { return importInfo.path(); - } else if (importInfo.type() == ImportInfo::LibraryImport) { + } else if (importInfo.type() == ImportType::Library) { if (modelManager) { foreach (const QString &importPath, modelManager->importPaths()) { const QString targetPath = QDir(importPath).filePath(importInfo.path()); diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp index 69191cbe9e9ad51f08244f6879c0fcacf3bb6e05..2405ef8412c1893383c8cccf821788e7993c060e 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp @@ -91,7 +91,7 @@ static inline bool checkIfDerivedFromItem(const QString &fileName) QmlJS::Document::MutablePtr document = QmlJS::Document::create(fileName.isEmpty() ? - QLatin1String("<internal>") : fileName, QmlJS::Document::QmlLanguage); + QLatin1String("<internal>") : fileName, QmlJS::Language::Qml); document->setSource(source); document->parseQml(); diff --git a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp index 232b2151c66881acd23ebaf36ceb71b4720869d5..67cf034d62ef1824f81e5f135f09256e3d109c8c 100644 --- a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp @@ -221,7 +221,7 @@ void ModelToTextMerger::applyChanges() if (m_rewriteActions.isEmpty()) return; - Document::MutablePtr tmpDocument(Document::create(QLatin1String("<ModelToTextMerger>"), Document::QmlLanguage)); + Document::MutablePtr tmpDocument(Document::create(QLatin1String("<ModelToTextMerger>"), Language::Qml)); tmpDocument->setSource(m_rewriterView->textModifier()->text()); if (!tmpDocument->parseQml()) { qDebug() << "*** Possible problem: QML file wasn't parsed correctly."; diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 520b07dac7c4a48ab5014a381dea7c744553b978..106af608691c4c3a6d995604363f6f3fb1f0a29c 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -359,12 +359,12 @@ public: const Imports *imports = m_context->imports(m_doc.data()); ImportInfo importInfo = imports->info(fullTypeName, m_context.data()); - if (importInfo.isValid() && importInfo.type() == ImportInfo::LibraryImport) { + if (importInfo.isValid() && importInfo.type() == ImportType::Library) { QString name = importInfo.name(); majorVersion = importInfo.version().majorVersion(); minorVersion = importInfo.version().minorVersion(); typeName.prepend(name + QLatin1Char('.')); - } else if (importInfo.isValid() && importInfo.type() == ImportInfo::DirectoryImport) { + } else if (importInfo.isValid() && importInfo.type() == ImportType::Directory) { QString path = importInfo.path(); QDir dir(m_doc->path()); // should probably try to make it relatve to some import path, not to the document path @@ -372,7 +372,7 @@ public: QString name = relativeDir.replace(QLatin1Char('/'), QLatin1Char('.')); if (!name.isEmpty()) typeName.prepend(name + QLatin1Char('.')); - } else if (importInfo.isValid() && importInfo.type() == ImportInfo::QrcDirectoryImport) { + } else if (importInfo.isValid() && importInfo.type() == ImportType::QrcDirectory) { QString path = QrcParser::normalizedQrcDirectoryPath(importInfo.path()); path = path.mid(1, path.size() - ((path.size() > 1) ? 2 : 1)); const QString name = path.replace(QLatin1Char('/'), QLatin1Char('.')); @@ -738,7 +738,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH try { Snapshot snapshot = m_rewriterView->textModifier()->getSnapshot(); const QString fileName = url.toLocalFile(); - Document::MutablePtr doc = Document::create(fileName.isEmpty() ? QLatin1String("<internal>") : fileName, Document::QmlLanguage); + Document::MutablePtr doc = Document::create(fileName.isEmpty() ? QLatin1String("<internal>") : fileName, Language::Qml); doc->setSource(data); doc->parseQml(); @@ -766,13 +766,13 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH setupImports(doc, differenceHandler); if (m_rewriterView->model()->imports().isEmpty()) { - const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::DiagnosticMessage::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found")); + const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found")); errors.append(RewriterView::Error(diagnosticMessage, QUrl::fromLocalFile(doc->fileName()))); } foreach (const QmlDesigner::Import &import, m_rewriterView->model()->imports()) { if (import.isLibraryImport() && import.url() == QLatin1String("QtQuick") && !supportedQtQuickVersion(import.version())) { - const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::DiagnosticMessage::Error, AST::SourceLocation(0, 0, 0, 0), + const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "Unsupported QtQuick version")); errors.append(RewriterView::Error(diagnosticMessage, QUrl::fromLocalFile(doc->fileName()))); } @@ -787,8 +787,8 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH foreach (StaticAnalysis::Type type, StaticAnalysis::Message::allMessageTypes()) { StaticAnalysis::PrototypeMessageData prototypeMessageData = StaticAnalysis::Message::prototypeForMessageType(type); - if (prototypeMessageData.severity == StaticAnalysis::MaybeWarning - || prototypeMessageData.severity == StaticAnalysis::Warning) { + if (prototypeMessageData.severity == Severity::MaybeWarning + || prototypeMessageData.severity == Severity::Warning) { check.disableMessage(type); } } @@ -800,9 +800,9 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH check.enableMessage(StaticAnalysis::WarnStatesOnlyInRootItemForVisualDesigner); foreach (const StaticAnalysis::Message &message, check()) { - if (message.severity == StaticAnalysis::Error) + if (message.severity == Severity::Error) errors.append(RewriterView::Error(message.toDiagnosticMessage(), QUrl::fromLocalFile(doc->fileName()))); - if (message.severity == StaticAnalysis::Warning) + if (message.severity == Severity::Warning) warnings.append(RewriterView::Error(message.toDiagnosticMessage(), QUrl::fromLocalFile(doc->fileName()))); } diff --git a/src/plugins/qmljseditor/qmlexpressionundercursor.cpp b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp index 7e7ea48f656d71f5be98a7ea396634015d17fb79..5f2fe8f94c1aa3bb98f6b0a0b2076f0e355a5667 100644 --- a/src/plugins/qmljseditor/qmlexpressionundercursor.cpp +++ b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp @@ -134,7 +134,7 @@ QmlJS::AST::ExpressionNode *QmlExpressionUnderCursor::operator()(const QTextCurs _text = expressionUnderCursor(cursor); Document::MutablePtr newDoc = Document::create( - QLatin1String("<expression>"), Document::JavaScriptLanguage); + QLatin1String("<expression>"), Language::JavaScript); newDoc->setSource(_text); newDoc->parseExpression(); exprDoc = newDoc; diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index c8b71c9bdad15ded748c18e3773e425bdd1f2128..dc0b419a0a1fc67ea285109f4dbdb3fb795ac4b3 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -1079,7 +1079,7 @@ TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const Q if (AST::UiImport *importAst = cast<AST::UiImport *>(node)) { // if it's a file import, link to the file foreach (const ImportInfo &import, semanticInfo.document->bind()->imports()) { - if (import.ast() == importAst && import.type() == ImportInfo::FileImport) { + if (import.ast() == importAst && import.type() == ImportType::File) { BaseTextEditorWidget::Link link(import.path()); link.linkTextStart = importAst->firstSourceLocation().begin(); link.linkTextEnd = importAst->lastSourceLocation().end(); diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index 11e22d50285982fb19de78d0eac8ac30730d8c90..a8b7d70914d7a8ee8b6a763f54e4a9a69d3a0b12 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -812,7 +812,7 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future, if (oldDoc && oldDoc->editorRevision() == it.value().second) continue; - Document::Language language; + Language::Enum language; if (oldDoc) language = oldDoc->language(); else diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 472cff9c26975dcaa784bb073f226fc003469cbd..b32537362eed12fe38c7fdef356ba940b1bcd158 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -115,7 +115,7 @@ static inline QString getModuleName(const ScopeChain &scopeChain, const Document const QString moduleName = qmlValue->moduleName(); const Imports *imports = scopeChain.context()->imports(qmlDocument.data()); const ImportInfo importInfo = imports->info(qmlValue->className(), scopeChain.context().data()); - if (importInfo.isValid() && importInfo.type() == ImportInfo::LibraryImport) { + if (importInfo.isValid() && importInfo.type() == ImportType::Library) { const int majorVersion = importInfo.version().majorVersion(); const int minorVersion = importInfo.version().minorVersion(); return moduleName + QString::number(majorVersion) + QLatin1Char('.') @@ -127,20 +127,20 @@ static inline QString getModuleName(const ScopeChain &scopeChain, const Document const Imports *imports = scopeChain.context()->imports(qmlDocument.data()); const ImportInfo importInfo = imports->info(typeName, scopeChain.context().data()); - if (importInfo.isValid() && importInfo.type() == ImportInfo::LibraryImport) { + if (importInfo.isValid() && importInfo.type() == ImportType::Library) { const QString moduleName = importInfo.name(); const int majorVersion = importInfo.version().majorVersion(); const int minorVersion = importInfo.version().minorVersion(); return moduleName + QString::number(majorVersion) + QLatin1Char('.') + QString::number(minorVersion) ; - } else if (importInfo.isValid() && importInfo.type() == ImportInfo::DirectoryImport) { + } else if (importInfo.isValid() && importInfo.type() == ImportType::Directory) { const QString path = importInfo.path(); const QDir dir(qmlDocument->path()); // should probably try to make it relatve to some import path, not to the document path QString relativeDir = dir.relativeFilePath(path); const QString name = relativeDir.replace(QLatin1Char('/'), QLatin1Char('.')); return name; - } else if (importInfo.isValid() && importInfo.type() == ImportInfo::QrcDirectoryImport) { + } else if (importInfo.isValid() && importInfo.type() == ImportType::QrcDirectory) { QString path = QrcParser::normalizedQrcDirectoryPath(importInfo.path()); path = path.mid(1, path.size() - ((path.size() > 1) ? 2 : 1)); const QString name = path.replace(QLatin1Char('/'), QLatin1Char('.')); @@ -350,7 +350,7 @@ void HoverHandler::handleImport(const ScopeChain &scopeChain, AST::UiImport *nod foreach (const Import &import, imports->all()) { if (import.info.ast() == node) { - if (import.info.type() == ImportInfo::LibraryImport + if (import.info.type() == ImportType::Library && !import.libraryPath.isEmpty()) { QString msg = tr("Library at %1").arg(import.libraryPath); const LibraryInfo &libraryInfo = scopeChain.context()->snapshot().libraryInfo(import.libraryPath); diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index 7350583abb92c78e6b5fd022a212d38b8cc6bee2..ffafb7a8fe02e46cc5a231073fb829f8a9ac6a5a 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -413,11 +413,11 @@ protected: length = end-begin; } QTextCharFormat format; - if (d.severity == StaticAnalysis::Warning || d.severity == StaticAnalysis::MaybeWarning) + if (d.severity == Severity::Warning || d.severity == Severity::MaybeWarning) format.setUnderlineColor(Qt::darkYellow); - else if (d.severity == StaticAnalysis::Error || d.severity == StaticAnalysis::MaybeError) + else if (d.severity == Severity::Error || d.severity == Severity::MaybeError) format.setUnderlineColor(Qt::red); - else if (d.severity == StaticAnalysis::Hint) + else if (d.severity == Severity::Hint) format.setUnderlineColor(Qt::darkGreen); format.setUnderlineStyle(QTextCharFormat::WaveUnderline); diff --git a/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp b/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp index 38674c9b0c4740348c7cda4efba2a65db5930ab1..2e4a73b57e7a29e23bdf8ba3a8f41b5b7eff1db4 100644 --- a/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp +++ b/src/plugins/qmljseditor/qmljssemanticinfoupdater.cpp @@ -128,7 +128,7 @@ QmlJSTools::SemanticInfo SemanticInfoUpdater::makeNewSemanticInfo(const QmlJS::D ScopeChain *scopeChain = new ScopeChain(doc, semanticInfo.context); semanticInfo.setRootScopeChain(QSharedPointer<const ScopeChain>(scopeChain)); - if (doc->language() == Document::JsonLanguage) { + if (doc->language() == Language::Json) { Utils::JsonSchema *schema = QmlJSEditorPlugin::instance()->jsonManager()->schemaForFile(doc->fileName()); if (schema) { diff --git a/src/plugins/qmljseditor/qmljswrapinloader.cpp b/src/plugins/qmljseditor/qmljswrapinloader.cpp index d7ee184eb1f7fd558b23b11da49fde691ce66df1..8605db7f22f7176232313b5ab505887c515f423c 100644 --- a/src/plugins/qmljseditor/qmljswrapinloader.cpp +++ b/src/plugins/qmljseditor/qmljswrapinloader.cpp @@ -132,10 +132,11 @@ public: innerIds.remove(id); QString comment = tr("// TODO: Move position bindings from the component to the Loader.\n" - "// Check all uses of 'parent' inside the root element of the component.\n"); + "// Check all uses of 'parent' inside the root element of the component.") + + QLatin1Char('\n'); if (idBinding) { - comment += tr("// Rename all outer uses of the id '%1' to '%2.item'.\n").arg( - id, loaderId); + comment += tr("// Rename all outer uses of the id '%1' to '%2.item'.").arg( + id, loaderId) + QLatin1Char('\n'); } // handle inner ids diff --git a/src/plugins/qmljstools/qmljsbundleprovider.cpp b/src/plugins/qmljstools/qmljsbundleprovider.cpp index 390618c2bbbee572c0c1d583855a4f2297059f5b..a938e9d18cb06db97ac62f62d517227e3d4d7df6 100644 --- a/src/plugins/qmljstools/qmljsbundleprovider.cpp +++ b/src/plugins/qmljstools/qmljsbundleprovider.cpp @@ -31,6 +31,7 @@ #include <coreplugin/icore.h> #include <qmljs/qmljsbundle.h> +#include <qmljs/qmljsconstants.h> #include <qtsupport/qtkitinformation.h> #include <qtsupport/qtsupportconstants.h> @@ -39,10 +40,10 @@ namespace QmlJSTools { namespace { -typedef QmlJS::Document::Language Language; typedef QmlJS::QmlBundle QmlBundle; typedef QmlJS::QmlLanguageBundles QmlLanguageBundles; } +using namespace QmlJS; /*! \class QmlJSEditor::BasicBundleProvider @@ -106,27 +107,26 @@ QmlBundle BasicBundleProvider::defaultQmlprojectBundle() } void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit - , QmlJS::QmlLanguageBundles &bundles + , QmlLanguageBundles &bundles , const QHash<QString,QString> &replacements) { - typedef QmlJS::Document Doc; QHash<QString,QString> myReplacements = replacements; - bundles.mergeBundleForLanguage(Doc::QmlQbsLanguage, defaultQbsBundle()); - bundles.mergeBundleForLanguage(Doc::QmlTypeInfoLanguage, defaultQmltypesBundle()); - bundles.mergeBundleForLanguage(Doc::QmlProjectLanguage, defaultQmlprojectBundle()); + bundles.mergeBundleForLanguage(Language::QmlQbs, defaultQbsBundle()); + bundles.mergeBundleForLanguage(Language::QmlTypeInfo, defaultQmltypesBundle()); + bundles.mergeBundleForLanguage(Language::QmlProject, defaultQmlprojectBundle()); QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(kit); if (!qtVersion) { QmlBundle b1(defaultQt4QtQuick1Bundle()); - bundles.mergeBundleForLanguage(Doc::QmlLanguage, b1); - bundles.mergeBundleForLanguage(Doc::QmlQtQuick1Language, b1); + bundles.mergeBundleForLanguage(Language::Qml, b1); + bundles.mergeBundleForLanguage(Language::QmlQtQuick1, b1); QmlBundle b11(defaultQt5QtQuick1Bundle()); - bundles.mergeBundleForLanguage(Doc::QmlLanguage, b11); - bundles.mergeBundleForLanguage(Doc::QmlQtQuick1Language, b11); + bundles.mergeBundleForLanguage(Language::Qml, b11); + bundles.mergeBundleForLanguage(Language::QmlQtQuick1, b11); QmlBundle b2(defaultQt5QtQuick2Bundle()); - bundles.mergeBundleForLanguage(Doc::QmlLanguage, b2); - bundles.mergeBundleForLanguage(Doc::QmlQtQuick2Language, b2); + bundles.mergeBundleForLanguage(Language::Qml, b2); + bundles.mergeBundleForLanguage(Language::QmlQtQuick2, b2); return; } QString qtImportsPath = qtVersion->qmakeProperty("QT_INSTALL_IMPORTS"); @@ -150,15 +150,15 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit qtQuick1Bundle.merge(bAtt); } if (!qtQuick1Bundle.supportedImports().contains(QLatin1String("QtQuick 1."), - QmlJS::PersistentTrie::Partial)) { + PersistentTrie::Partial)) { if (qtVersion->qtVersion().majorVersion == 4) qtQuick1Bundle.merge(defaultQt4QtQuick1Bundle()); else if (qtVersion->qtVersion().majorVersion > 4) qtQuick1Bundle.merge(defaultQt5QtQuick1Bundle()); } qtQuick1Bundle.replaceVars(myReplacements); - bundles.mergeBundleForLanguage(Doc::QmlLanguage, qtQuick1Bundle); - bundles.mergeBundleForLanguage(Doc::QmlQtQuick1Language, qtQuick1Bundle); + bundles.mergeBundleForLanguage(Language::Qml, qtQuick1Bundle); + bundles.mergeBundleForLanguage(Language::QmlQtQuick1, qtQuick1Bundle); } if (features.contains(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2))) { myReplacements.insert(QLatin1String("$(CURRENT_DIRECTORY)"), qtQmlPath); @@ -175,12 +175,12 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit qtQuick2Bundle.merge(bAtt); } if (!qtQuick2Bundle.supportedImports().contains(QLatin1String("QtQuick 2."), - QmlJS::PersistentTrie::Partial)) { + PersistentTrie::Partial)) { qtQuick2Bundle.merge(defaultQt5QtQuick2Bundle()); } qtQuick2Bundle.replaceVars(myReplacements); - bundles.mergeBundleForLanguage(Doc::QmlLanguage, qtQuick2Bundle); - bundles.mergeBundleForLanguage(Doc::QmlQtQuick2Language, qtQuick2Bundle); + bundles.mergeBundleForLanguage(Language::Qml, qtQuick2Bundle); + bundles.mergeBundleForLanguage(Language::QmlQtQuick2, qtQuick2Bundle); } } diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index a0bdef083c68c9dae0bcd2909edc612702aa4b82..24134e4da08baafbf7c57a8de308756e9e876383 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -178,7 +178,7 @@ static void mergeSuffixes(QStringList &l1, const QStringList &l2) l1 = l2; } -QmlJS::Document::Language QmlJSTools::languageOfFile(const QString &fileName) +QmlJS::Language::Enum QmlJSTools::languageOfFile(const QString &fileName) { QStringList jsSuffixes(QLatin1String("js")); QStringList qmlSuffixes(QLatin1String("qml")); @@ -202,14 +202,14 @@ QmlJS::Document::Language QmlJSTools::languageOfFile(const QString &fileName) const QFileInfo info(fileName); const QString fileSuffix = info.suffix(); if (jsSuffixes.contains(fileSuffix)) - return QmlJS::Document::JavaScriptLanguage; + return QmlJS::Language::JavaScript; if (qbsSuffixes.contains(fileSuffix)) - return QmlJS::Document::QmlQbsLanguage; + return QmlJS::Language::QmlQbs; if (qmlSuffixes.contains(fileSuffix) || qmlProjectSuffixes.contains(fileSuffix)) - return QmlJS::Document::QmlLanguage; + return QmlJS::Language::Qml; if (jsonSuffixes.contains(fileSuffix)) - return QmlJS::Document::JsonLanguage; - return QmlJS::Document::UnknownLanguage; + return QmlJS::Language::Json; + return QmlJS::Language::Unknown; } QStringList QmlJSTools::qmlAndJsGlobPatterns() @@ -666,23 +666,23 @@ static void findNewFileImports(const Document::Ptr &doc, const Snapshot &snapsho // scan files and directories that are explicitly imported foreach (const ImportInfo &import, doc->bind()->imports()) { const QString &importName = import.path(); - if (import.type() == ImportInfo::FileImport) { + if (import.type() == ImportType::File) { if (! snapshot.document(importName)) *importedFiles += importName; - } else if (import.type() == ImportInfo::DirectoryImport) { + } else if (import.type() == ImportType::Directory) { if (snapshot.documentsInDirectory(importName).isEmpty()) { if (! scannedPaths->contains(importName)) { *importedFiles += qmlFilesInDirectory(importName); scannedPaths->insert(importName); } } - } else if (import.type() == ImportInfo::QrcFileImport) { + } else if (import.type() == ImportType::QrcFile) { QStringList importPaths = ModelManagerInterface::instance()->filesAtQrcPath(importName); foreach (const QString &importPath, importPaths) { if (! snapshot.document(importPath)) *importedFiles += importPath; } - } else if (import.type() == ImportInfo::QrcDirectoryImport) { + } else if (import.type() == ImportType::QrcDirectory) { QMapIterator<QString,QStringList> dirContents(ModelManagerInterface::instance()->filesInQrcPath(importName)); while (dirContents.hasNext()) { dirContents.next(); @@ -792,13 +792,13 @@ static void findNewLibraryImports(const Document::Ptr &doc, const Snapshot &snap // scan dir and lib imports const QStringList importPaths = modelManager->importPaths(); foreach (const ImportInfo &import, doc->bind()->imports()) { - if (import.type() == ImportInfo::DirectoryImport) { + if (import.type() == ImportType::Directory) { const QString targetPath = import.path(); findNewQmlLibraryInPath(targetPath, snapshot, modelManager, importedFiles, scannedPaths, newLibraries); } - if (import.type() == ImportInfo::LibraryImport) { + if (import.type() == ImportType::Library) { if (!import.version().isValid()) continue; foreach (const QString &importPath, importPaths) { @@ -829,8 +829,8 @@ void ModelManager::parse(QFutureInterface<void> &future, const QString fileName = files.at(i); - Document::Language language = languageOfFile(fileName); - if (language == Document::UnknownLanguage) { + Language::Enum language = languageOfFile(fileName); + if (language == Language::Unknown) { if (fileName.endsWith(QLatin1String(".qrc"))) modelManager->updateQrcFile(fileName); continue; @@ -951,7 +951,7 @@ void ModelManager::updateImportPaths() while (it.hasNext()) { it.next(); activeBundles.mergeLanguageBundles(it.value().activeBundle); - foreach (Document::Language l, it.value().activeBundle.languages()) { + foreach (Language::Enum l, it.value().activeBundle.languages()) { foreach (const QString &path, it.value().activeBundle.bundleForLanguage(l) .searchPaths().stringList()) { const QString canonicalPath = QFileInfo(path).canonicalFilePath(); @@ -964,7 +964,7 @@ void ModelManager::updateImportPaths() while (it.hasNext()) { it.next(); extendedBundles.mergeLanguageBundles(it.value().extendedBundle); - foreach (Document::Language l, it.value().extendedBundle.languages()) { + foreach (Language::Enum l, it.value().extendedBundle.languages()) { foreach (const QString &path, it.value().extendedBundle.bundleForLanguage(l) .searchPaths().stringList()) { const QString canonicalPath = QFileInfo(path).canonicalFilePath(); diff --git a/src/plugins/qmljstools/qmljsmodelmanager.h b/src/plugins/qmljstools/qmljsmodelmanager.h index 9f6d2a35f36ed8e37fdf121f94ad0e239713bb51..f9f4121e39ac9ae03ebb3b4c10d31e3e96e839c9 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.h +++ b/src/plugins/qmljstools/qmljsmodelmanager.h @@ -58,7 +58,7 @@ class QrcParser; namespace QmlJSTools { -QMLJSTOOLS_EXPORT QmlJS::Document::Language languageOfFile(const QString &fileName); +QMLJSTOOLS_EXPORT QmlJS::Language::Enum languageOfFile(const QString &fileName); QMLJSTOOLS_EXPORT QStringList qmlAndJsGlobPatterns(); namespace Internal { diff --git a/src/plugins/qmljstools/qmljsplugindumper.cpp b/src/plugins/qmljstools/qmljsplugindumper.cpp index 33565307673949172743d7151608d88a135d053c..bb8a4a8835baad0e20ff22907f522bbb562f5f93 100644 --- a/src/plugins/qmljstools/qmljsplugindumper.cpp +++ b/src/plugins/qmljstools/qmljsplugindumper.cpp @@ -233,8 +233,8 @@ static QString noTypeinfoError(const QString &libraryPath) static QString qmldumpErrorMessage(const QString &libraryPath, const QString &error) { return noTypeinfoError(libraryPath) + QLatin1String("\n\n") + - PluginDumper::tr("Automatic type dump of QML module failed.\nErrors:\n%1\n"). - arg(error); + PluginDumper::tr("Automatic type dump of QML module failed.\nErrors:\n%1"). + arg(error) + QLatin1Char('\n'); } static QString qmldumpFailedMessage(const QString &libraryPath, const QString &error) diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp index 827a3fddde830d5b635a6b4f32ad34cb57dcd48a..06381b313b8cc687fb348a5e977e4dcfb300424a 100644 --- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp +++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp @@ -123,7 +123,7 @@ QmlJSRefactoringFile::QmlJSRefactoringFile(const QString &fileName, const QShare : RefactoringFile(fileName, data) { // the RefactoringFile is invalid if its not for a file with qml or js code - if (languageOfFile(fileName) == Document::UnknownLanguage) + if (languageOfFile(fileName) == Language::Unknown) m_fileName.clear(); } diff --git a/src/plugins/qnx/blackberryconfiguration.cpp b/src/plugins/qnx/blackberryconfiguration.cpp index 81f5ed0469da5063d267734a9b9613a8d12a66a9..78b01a30d88c34ab4fc4ddc5f918d08d71bbce7d 100644 --- a/src/plugins/qnx/blackberryconfiguration.cpp +++ b/src/plugins/qnx/blackberryconfiguration.cpp @@ -237,8 +237,8 @@ Kit *BlackBerryConfiguration::createKit(QnxAbstractQtVersion *version, ToolChain version->qtVersionString(), version->platformDisplayName(), version->archString(), m_targetName)); - DebuggerItemManager::registerDebugger(debugger); - DebuggerKitInformation::setDebugger(kit, debugger); + QVariant id = DebuggerItemManager::registerDebugger(debugger); + DebuggerKitInformation::setDebugger(kit, id); if (isSimulator) QmakeProjectManager::QmakeKitInformation::setMkspec( diff --git a/src/plugins/qnx/blackberryinstallwizardpages.cpp b/src/plugins/qnx/blackberryinstallwizardpages.cpp index 790a88cdb96afb38d854f7d19724be40591de36d..19c9055815e8ddc428e00590fb2b3faac7564456 100644 --- a/src/plugins/qnx/blackberryinstallwizardpages.cpp +++ b/src/plugins/qnx/blackberryinstallwizardpages.cpp @@ -385,9 +385,9 @@ void BlackBerryInstallWizardProcessPage::initializePage() } } - m_ui->label->setText(tr("Uninstalling target:\n") + m_data.target); + m_ui->label->setText(tr("Uninstalling target:") + QLatin1Char('\n') + m_data.target); } else { - m_ui->label->setText(tr("Installing target:\n") + m_data.target); + m_ui->label->setText(tr("Installing target:") + QLatin1Char('\n') + m_data.target); } // m_targetProcess could be running if (m_targetProcess->state() == QProcess::Running) { diff --git a/src/plugins/qnx/cascadesimport/importlogconverter.cpp b/src/plugins/qnx/cascadesimport/importlogconverter.cpp index 896545aa21fbd303da82ffe0af7b8d35637ed506..bbcb2029d3a44a473532e31ae550b8f10c2f14d6 100644 --- a/src/plugins/qnx/cascadesimport/importlogconverter.cpp +++ b/src/plugins/qnx/cascadesimport/importlogconverter.cpp @@ -54,10 +54,10 @@ bool ImportLogConverter::convertFile(Core::GeneratedFile &file, QString &errorMe Q_UNUSED(errorMessage); QString content; content += QLatin1String("========================================================\n"); - content += tr("Generated by cascades importer ver: %1, %2\n") + content += tr("Generated by cascades importer ver: %1, %2") .arg(QLatin1String(Qnx::Constants::QNX_BLACKBERRY_CASCADESIMPORTER_VERSION)) .arg(QDateTime::currentDateTime().toString(Qt::ISODate)); - content += QLatin1String("========================================================\n\n"); + content += QLatin1String("\n========================================================\n\n"); content += convertedProjectContext().importLog().toString(); file.setContents(content); file.setAttributes(file.attributes() | Core::GeneratedFile::OpenEditorAttribute); diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index fe9caf70bf7d56cab802d982291aafd0e48bbff8..027a4b3b37cf533af9a2d92b168ea0b4c40e7a84 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -65,7 +65,7 @@ void QnxAnalyzeSupport::handleAdapterSetupRequested() { QTC_ASSERT(state() == Inactive, return); - showMessage(tr("Preparing remote side...\n"), Utils::NormalMessageFormat); + showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), Utils::NormalMessageFormat); QnxAbstractRunSupport::handleAdapterSetupRequested(); } diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index 20c238cfdcce16f8ecbf17e20cf60fc0bf2cdd33..df1a7c16e7856d4c044588291d2b9c58fd618030 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -73,7 +73,7 @@ void QnxDebugSupport::handleAdapterSetupRequested() QTC_ASSERT(state() == Inactive, return); if (m_engine) - m_engine->showMessage(tr("Preparing remote side...\n"), Debugger::AppStuff); + m_engine->showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), Debugger::AppStuff); QnxAbstractRunSupport::handleAdapterSetupRequested(); } diff --git a/src/plugins/qnx/qnxdeviceconfiguration.cpp b/src/plugins/qnx/qnxdeviceconfiguration.cpp index f5a26bd9bb73d317200a62ebc49128acd0da9de2..d9b64ed9a3f3c4a81501eb8af8cd011ec69b0ebd 100644 --- a/src/plugins/qnx/qnxdeviceconfiguration.cpp +++ b/src/plugins/qnx/qnxdeviceconfiguration.cpp @@ -34,14 +34,22 @@ #include "qnxdeviceprocesslist.h" #include "qnxdeviceprocesssignaloperation.h" +#include <projectexplorer/devicesupport/sshdeviceprocess.h> #include <ssh/sshconnection.h> +#include <utils/qtcassert.h> +#include <QApplication> #include <QRegExp> #include <QStringList> +#include <QThread> using namespace Qnx; using namespace Qnx::Internal; +namespace { +const char QnxVersionKey[] = "QnxVersion"; +} + class QnxPortsGatheringMethod : public ProjectExplorer::PortsGatheringMethod { // TODO: The command is probably needlessly complicated because the parsing method @@ -82,20 +90,22 @@ class QnxPortsGatheringMethod : public ProjectExplorer::PortsGatheringMethod QnxDeviceConfiguration::QnxDeviceConfiguration() : RemoteLinux::LinuxDevice() + , m_versionNumber(0) { } QnxDeviceConfiguration::QnxDeviceConfiguration(const QString &name, Core::Id type, MachineType machineType, Origin origin, Core::Id id) : RemoteLinux::LinuxDevice(name, type, machineType, origin, id) + , m_versionNumber(0) { } QnxDeviceConfiguration::QnxDeviceConfiguration(const QnxDeviceConfiguration &other) : RemoteLinux::LinuxDevice(other) + , m_versionNumber(other.m_versionNumber) { } - QnxDeviceConfiguration::Ptr QnxDeviceConfiguration::create() { return Ptr(new QnxDeviceConfiguration); @@ -111,6 +121,58 @@ QString QnxDeviceConfiguration::displayType() const return tr("QNX"); } +int QnxDeviceConfiguration::qnxVersion() const +{ + if (m_versionNumber == 0) + updateVersionNumber(); + + return m_versionNumber; +} + +void QnxDeviceConfiguration::updateVersionNumber() const +{ + QEventLoop eventLoop; + ProjectExplorer::SshDeviceProcess versionNumberProcess(sharedFromThis()); + QObject::connect(&versionNumberProcess, SIGNAL(finished()), &eventLoop, SLOT(quit())); + QObject::connect(&versionNumberProcess, SIGNAL(error(QProcess::ProcessError)), &eventLoop, SLOT(quit())); + + QStringList arguments; + arguments << QLatin1String("-r"); + versionNumberProcess.start(QLatin1String("uname"), arguments); + + bool isGuiThread = QThread::currentThread() == QCoreApplication::instance()->thread(); + if (isGuiThread) + QApplication::setOverrideCursor(Qt::WaitCursor); + + eventLoop.exec(QEventLoop::ExcludeUserInputEvents); + + QByteArray output = versionNumberProcess.readAllStandardOutput(); + QString versionMessage = QString::fromLatin1(output); + QRegExp versionNumberRegExp = QRegExp(QLatin1String("(\\d+)\\.(\\d+)\\.(\\d+)")); + if (versionNumberRegExp.indexIn(versionMessage) > -1 && versionNumberRegExp.captureCount() == 3) { + int major = versionNumberRegExp.cap(1).toInt(); + int minor = versionNumberRegExp.cap(2).toInt(); + int patch = versionNumberRegExp.cap(3).toInt(); + m_versionNumber = (major << 16)|(minor<<8)|(patch); + } + + if (isGuiThread) + QApplication::restoreOverrideCursor(); +} + +void QnxDeviceConfiguration::fromMap(const QVariantMap &map) +{ + m_versionNumber = map.value(QLatin1String(QnxVersionKey), 0).toInt(); + RemoteLinux::LinuxDevice::fromMap(map); +} + +QVariantMap QnxDeviceConfiguration::toMap() const +{ + QVariantMap map(RemoteLinux::LinuxDevice::toMap()); + map.insert(QLatin1String(QnxVersionKey), m_versionNumber); + return map; +} + ProjectExplorer::IDevice::Ptr QnxDeviceConfiguration::clone() const { return Ptr(new QnxDeviceConfiguration(*this)); diff --git a/src/plugins/qnx/qnxdeviceconfiguration.h b/src/plugins/qnx/qnxdeviceconfiguration.h index ec67de55d914649a7502291f73e4ec6ae71c34d2..5e9fb69070590df90150e23150be80f89e7f5f72 100644 --- a/src/plugins/qnx/qnxdeviceconfiguration.h +++ b/src/plugins/qnx/qnxdeviceconfiguration.h @@ -58,6 +58,11 @@ public: QString displayType() const; + int qnxVersion() const; + + void fromMap(const QVariantMap &map); + QVariantMap toMap() const; + protected: QnxDeviceConfiguration(); QnxDeviceConfiguration(const QString &name, Core::Id type, MachineType machineType, @@ -67,6 +72,10 @@ protected: QString interruptProcessByNameCommandLine(const QString &filePath) const; QString killProcessByNameCommandLine(const QString &filePath) const; +private: + void updateVersionNumber() const; + + mutable int m_versionNumber; }; } // namespace Internal diff --git a/src/plugins/qnx/qnxdevicetester.cpp b/src/plugins/qnx/qnxdevicetester.cpp index 634ab3ce4295cdbd9f679e72a0d13e64ce16e1de..a229ae20463621b9d9545541e1c7b76e98402a0f 100644 --- a/src/plugins/qnx/qnxdevicetester.cpp +++ b/src/plugins/qnx/qnxdevicetester.cpp @@ -30,6 +30,7 @@ ****************************************************************************/ #include "qnxdevicetester.h" +#include "qnxdeviceconfiguration.h" #include <ssh/sshremoteprocessrunner.h> #include <utils/qtcassert.h> @@ -44,6 +45,10 @@ QnxDeviceTester::QnxDeviceTester(QObject *parent) , m_currentCommandIndex(-1) { m_genericTester = new RemoteLinux::GenericLinuxDeviceTester(this); + connect(m_genericTester, SIGNAL(progressMessage(QString)), SIGNAL(progressMessage(QString))); + connect(m_genericTester, SIGNAL(errorMessage(QString)), SIGNAL(errorMessage(QString))); + connect(m_genericTester, SIGNAL(finished(ProjectExplorer::DeviceTester::TestResult)), + SLOT(handleGenericTestFinished(ProjectExplorer::DeviceTester::TestResult))); m_processRunner = new QSsh::SshRemoteProcessRunner(this); connect(m_processRunner, SIGNAL(connectionError()), SLOT(handleConnectionError())); @@ -68,11 +73,6 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::ConstPtr &devic m_deviceConfiguration = deviceConfiguration; - connect(m_genericTester, SIGNAL(progressMessage(QString)), SIGNAL(progressMessage(QString))); - connect(m_genericTester, SIGNAL(errorMessage(QString)), SIGNAL(errorMessage(QString))); - connect(m_genericTester, SIGNAL(finished(ProjectExplorer::DeviceTester::TestResult)), - SLOT(handleGenericTestFinished(ProjectExplorer::DeviceTester::TestResult))); - m_state = GenericTest; m_genericTester->testDevice(deviceConfiguration); } @@ -107,6 +107,10 @@ void QnxDeviceTester::handleGenericTestFinished(TestResult result) } m_state = CommandsTest; + + QnxDeviceConfiguration::ConstPtr qnxDevice = m_deviceConfiguration.dynamicCast<const QnxDeviceConfiguration>(); + m_commandsToTest.append(versionSpecificCommandsToTest(qnxDevice->qnxVersion())); + testNextCommand(); } @@ -117,13 +121,13 @@ void QnxDeviceTester::handleProcessFinished(int exitStatus) const QString command = m_commandsToTest[m_currentCommandIndex]; if (exitStatus == QSsh::SshRemoteProcess::NormalExit) { if (m_processRunner->processExitCode() == 0) { - emit progressMessage(tr("%1 found.\n").arg(command)); + emit progressMessage(tr("%1 found.").arg(command) + QLatin1Char('\n')); } else { - emit errorMessage(tr("%1 not found.\n").arg(command)); + emit errorMessage(tr("%1 not found.").arg(command) + QLatin1Char('\n')); m_result = TestFailure; } } else { - emit errorMessage(tr("An error occurred checking for %1.\n").arg(command)); + emit errorMessage(tr("An error occurred checking for %1.").arg(command) + QLatin1Char('\n')); m_result = TestFailure; } testNextCommand(); @@ -134,7 +138,7 @@ void QnxDeviceTester::handleConnectionError() QTC_ASSERT(m_state == CommandsTest, return); m_result = TestFailure; - emit errorMessage(tr("SSH connection error: %1\n").arg(m_processRunner->lastConnectionErrorString())); + emit errorMessage(tr("SSH connection error: %1").arg(m_processRunner->lastConnectionErrorString()) + QLatin1Char('\n')); setFinished(); } @@ -161,3 +165,12 @@ void QnxDeviceTester::setFinished() disconnect(m_processRunner, 0, this, 0); emit finished(m_result); } + +QStringList QnxDeviceTester::versionSpecificCommandsToTest(int versionNumber) const +{ + QStringList result; + if (versionNumber > 0x060500) + result << QLatin1String("slog2info"); + + return result; +} diff --git a/src/plugins/qnx/qnxdevicetester.h b/src/plugins/qnx/qnxdevicetester.h index 834f6a601ee3c0ae0824941b765189d64b32beaa..d0a4a8a286fc7daa0609a886128f853d5003f4af 100644 --- a/src/plugins/qnx/qnxdevicetester.h +++ b/src/plugins/qnx/qnxdevicetester.h @@ -68,6 +68,8 @@ private: void testNextCommand(); void setFinished(); + QStringList versionSpecificCommandsToTest(int versionNumber) const; + RemoteLinux::GenericLinuxDeviceTester *m_genericTester; ProjectExplorer::IDevice::ConstPtr m_deviceConfiguration; ProjectExplorer::DeviceTester::TestResult m_result; diff --git a/src/plugins/qnx/qnxruncontrol.cpp b/src/plugins/qnx/qnxruncontrol.cpp index 0f717d83bebfba4c30cbac1326dd250a036b9c6d..53a32ac8e84204ebd5dfe4491456f5d44863a4d2 100644 --- a/src/plugins/qnx/qnxruncontrol.cpp +++ b/src/plugins/qnx/qnxruncontrol.cpp @@ -58,6 +58,8 @@ QnxRunControl::QnxRunControl(ProjectExplorer::RunConfiguration *runConfig) m_slog2Info = new Slog2InfoRunner(applicationId, qnxDevice, this); connect(m_slog2Info, SIGNAL(output(QString,Utils::OutputFormat)), this, SLOT(appendMessage(QString,Utils::OutputFormat))); connect(this, SIGNAL(started()), m_slog2Info, SLOT(start())); + if (qnxDevice->qnxVersion() > 0x060500) + connect(m_slog2Info, SIGNAL(commandMissing()), this, SLOT(printMissingWarning())); } ProjectExplorer::RunControl::StopResult QnxRunControl::stop() @@ -65,3 +67,8 @@ ProjectExplorer::RunControl::StopResult QnxRunControl::stop() m_slog2Info->stop(); return RemoteLinuxRunControl::stop(); } + +void QnxRunControl::printMissingWarning() +{ + appendMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available!"), Utils::ErrorMessageFormat); +} diff --git a/src/plugins/qnx/qnxruncontrol.h b/src/plugins/qnx/qnxruncontrol.h index 20368e608917d5a9ccd494cf29ade4b96493dc83..c3e44777e523e0bead8900f19e89730b8c72fd81 100644 --- a/src/plugins/qnx/qnxruncontrol.h +++ b/src/plugins/qnx/qnxruncontrol.h @@ -47,6 +47,9 @@ public: RemoteLinux::RemoteLinuxRunControl::StopResult stop(); +private slots: + void printMissingWarning(); + private: Slog2InfoRunner *m_slog2Info; }; diff --git a/src/plugins/qnx/qnxutils.cpp b/src/plugins/qnx/qnxutils.cpp index 4aa9286fcfba1c38b5a4fb446d231886159e9a91..f799fb524faeee49493c85759b4f29429ad0bf88 100644 --- a/src/plugins/qnx/qnxutils.cpp +++ b/src/plugins/qnx/qnxutils.cpp @@ -196,13 +196,7 @@ QList<Utils::EnvironmentItem> QnxUtils::qnxEnvironmentFromNdkFile(const QString } } - QString modifieddValue; - if (Utils::HostOsInfo::isWindowsHost()) - modifieddValue = modifiedValues.join(QLatin1String(";")); - else if (Utils::HostOsInfo::isAnyUnixHost()) - modifieddValue = modifiedValues.join(QLatin1String(":")); - - items.append(Utils::EnvironmentItem(key, modifieddValue)); + items.append(Utils::EnvironmentItem(key, modifiedValues.join(QString(Utils::HostOsInfo::pathListSeparator())))); } return items; diff --git a/src/plugins/qt4projectmanager/addlibrarywizard.cpp b/src/plugins/qt4projectmanager/addlibrarywizard.cpp index ec3ec3a0e6de18c9566db9b8e01206ea6243cff1..554081081efae91fcdcb9cf835716cfaca5a7bee 100644 --- a/src/plugins/qt4projectmanager/addlibrarywizard.cpp +++ b/src/plugins/qt4projectmanager/addlibrarywizard.cpp @@ -275,6 +275,7 @@ SummaryPage::SummaryPage(AddLibraryWizard *parent) QVBoxLayout *layout = new QVBoxLayout(this); m_summaryLabel = new QLabel(this); m_snippetLabel = new QLabel(this); + m_snippetLabel->setWordWrap(true); layout->addWidget(m_summaryLabel); layout->addWidget(m_snippetLabel); m_summaryLabel->setTextFormat(Qt::RichText); diff --git a/src/plugins/qt4projectmanager/addlibrarywizard.h b/src/plugins/qt4projectmanager/addlibrarywizard.h index 9fa7b52e7ebf3b791682a4c13d90aa86670f0c3e..be9b99b2cea246052c6e5a1144afb125b7f90ab0 100644 --- a/src/plugins/qt4projectmanager/addlibrarywizard.h +++ b/src/plugins/qt4projectmanager/addlibrarywizard.h @@ -78,7 +78,8 @@ public: enum Platform { LinuxPlatform = 0x01, MacPlatform = 0x02, - WindowsPlatform = 0x04 + WindowsMinGWPlatform = 0x04, + WindowsMSVCPlatform = 0x08 }; Q_DECLARE_FLAGS(Platforms, Platform) diff --git a/src/plugins/qt4projectmanager/librarydetailscontroller.cpp b/src/plugins/qt4projectmanager/librarydetailscontroller.cpp index ab0a59d5d48376e892b4afe7497c3ed2dfd758f2..7253684966432764ffa7e0a9fd742ddb0e4f8b74 100644 --- a/src/plugins/qt4projectmanager/librarydetailscontroller.cpp +++ b/src/plugins/qt4projectmanager/librarydetailscontroller.cpp @@ -55,7 +55,8 @@ LibraryDetailsController::LibraryDetailsController( QObject(parent), m_platforms(AddLibraryWizard::LinuxPlatform | AddLibraryWizard::MacPlatform - | AddLibraryWizard::WindowsPlatform), + | AddLibraryWizard::WindowsMinGWPlatform + | AddLibraryWizard::WindowsMSVCPlatform), m_linkageType(AddLibraryWizard::NoLinkage), m_macLibraryType(AddLibraryWizard::NoLibraryType), m_proFile(proFile), @@ -83,14 +84,24 @@ LibraryDetailsController::LibraryDetailsController( if (!Utils::HostOsInfo::isLinuxHost()) { // project for which we are going to insert the snippet - const ProjectExplorer::Project *project = - ProjectExplorer::SessionManager::projectForFile(proFile); - // if its tool chain is maemo behave the same as we would be on linux - ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(project->activeTarget()->kit()); - if (tc - && (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor - || tc->targetAbi().osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor)) - m_creatorPlatform = CreatorLinux; + const Project *project = SessionManager::projectForFile(proFile); + if (project && project->activeTarget()) { + // if its tool chain is maemo behave the same as we would be on linux + ProjectExplorer::ToolChain *tc = ToolChainKitInformation::toolChain(project->activeTarget()->kit()); + if (tc) { + switch (tc->targetAbi().os()) { + case Abi::WindowsOS: + m_creatorPlatform = CreatorWindows; + break; + case Abi::MacOS: + m_creatorPlatform = CreatorMac; + break; + default: + m_creatorPlatform = CreatorLinux; + break; + } + } + } } setPlatformsVisible(true); @@ -156,7 +167,8 @@ void LibraryDetailsController::updateGui() if (libraryDetailsWidget()->macCheckBox->isChecked()) m_platforms |= AddLibraryWizard::MacPlatform; if (libraryDetailsWidget()->winCheckBox->isChecked()) - m_platforms |= AddLibraryWizard::WindowsPlatform; + m_platforms |= AddLibraryWizard::WindowsMinGWPlatform + | AddLibraryWizard::WindowsMSVCPlatform; bool macLibraryTypeUpdated = false; if (!m_linkageRadiosVisible) { @@ -409,6 +421,21 @@ static QString appendSeparator(const QString &aString) return aString + QLatin1Char('/'); } +static QString windowsScopes(AddLibraryWizard::Platforms scopes) +{ + QString scopesString; + QTextStream str(&scopesString); + AddLibraryWizard::Platforms windowsPlatforms = scopes + & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform); + if (windowsPlatforms == AddLibraryWizard::WindowsMinGWPlatform) + str << "win32-g++"; // mingw only + else if (windowsPlatforms == AddLibraryWizard::WindowsMSVCPlatform) + str << "win32:!win32-g++"; // msvc only + else if (windowsPlatforms) + str << "win32"; // both mingw and msvc + return scopesString; +} + static QString commonScopes(AddLibraryWizard::Platforms scopes, AddLibraryWizard::Platforms excludedScopes) { @@ -416,7 +443,8 @@ static QString commonScopes(AddLibraryWizard::Platforms scopes, QTextStream str(&scopesString); AddLibraryWizard::Platforms common = scopes | excludedScopes; bool unixLikeScopes = false; - if (scopes & ~QFlags<AddLibraryWizard::Platform>(AddLibraryWizard::WindowsPlatform)) { + if (scopes & ~QFlags<AddLibraryWizard::Platform>(AddLibraryWizard::WindowsMinGWPlatform + | AddLibraryWizard::WindowsMSVCPlatform)) { unixLikeScopes = true; if (common & AddLibraryWizard::LinuxPlatform) { str << "unix"; @@ -427,10 +455,12 @@ static QString commonScopes(AddLibraryWizard::Platforms scopes, str << "macx"; } } - if (scopes & AddLibraryWizard::WindowsPlatform) { + AddLibraryWizard::Platforms windowsPlatforms = scopes + & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform); + if (windowsPlatforms) { if (unixLikeScopes) str << "|"; - str << "win32"; + str << windowsScopes(windowsPlatforms); } return scopesString; } @@ -457,7 +487,8 @@ static QString generateLibsSnippet(AddLibraryWizard::Platforms platforms, if (macLibraryType == AddLibraryWizard::FrameworkType) // we will generate a separate -F -framework line commonPlatforms &= ~QFlags<AddLibraryWizard::Platform>(AddLibraryWizard::MacPlatform); if (useSubfolders || addSuffix) // we will generate a separate debug/release conditions - commonPlatforms &= ~QFlags<AddLibraryWizard::Platform>(AddLibraryWizard::WindowsPlatform); + commonPlatforms &= ~QFlags<AddLibraryWizard::Platform>(AddLibraryWizard::WindowsMinGWPlatform + | AddLibraryWizard::WindowsMSVCPlatform); AddLibraryWizard::Platforms diffPlatforms = platforms ^ commonPlatforms; AddLibraryWizard::Platforms generatedPlatforms = 0; @@ -465,19 +496,22 @@ static QString generateLibsSnippet(AddLibraryWizard::Platforms platforms, QString snippetMessage; QTextStream str(&snippetMessage); - if (diffPlatforms & AddLibraryWizard::WindowsPlatform) { - str << "win32:CONFIG(release, debug|release): LIBS += "; + AddLibraryWizard::Platforms windowsPlatforms = diffPlatforms + & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform); + if (windowsPlatforms) { + QString windowsString = windowsScopes(windowsPlatforms); + str << windowsString << ":CONFIG(release, debug|release): LIBS += "; if (useSubfolders) str << simpleLibraryPathSnippet << "release/ " << "-l" << libName << "\n"; else if (addSuffix) str << appendSpaceIfNotEmpty(simpleLibraryPathSnippet) << "-l" << libName << "\n"; - str << "else:win32:CONFIG(debug, debug|release): LIBS += "; + str << "else:" << windowsString << ":CONFIG(debug, debug|release): LIBS += "; if (useSubfolders) str << simpleLibraryPathSnippet << "debug/ " << "-l" << libName << "\n"; else if (addSuffix) str << appendSpaceIfNotEmpty(simpleLibraryPathSnippet) << "-l" << libName << "d\n"; - generatedPlatforms |= AddLibraryWizard::WindowsPlatform; + generatedPlatforms |= windowsPlatforms; } if (diffPlatforms & AddLibraryWizard::MacPlatform) { if (generatedPlatforms) @@ -521,28 +555,55 @@ static QString generatePreTargetDepsSnippet(AddLibraryWizard::Platforms platform QTextStream str(&snippetMessage); str << "\n"; AddLibraryWizard::Platforms generatedPlatforms = 0; - if (platforms & AddLibraryWizard::WindowsPlatform) { + AddLibraryWizard::Platforms windowsPlatforms = platforms + & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform); + AddLibraryWizard::Platforms commonPlatforms = platforms; + if (useSubfolders || addSuffix) // we will generate a separate debug/release conditions, otherwise mingw is unix like + commonPlatforms &= ~QFlags<AddLibraryWizard::Platform>(AddLibraryWizard::WindowsMinGWPlatform); + commonPlatforms &= ~QFlags<AddLibraryWizard::Platform>(AddLibraryWizard::WindowsMSVCPlatform); // this case is different from all platforms + if (windowsPlatforms) { if (useSubfolders || addSuffix) { - str << "win32:CONFIG(release, debug|release): " - << preTargetDepsSnippet; - if (useSubfolders) - str << "release/" << libName << ".lib\n"; - else if (addSuffix) - str << libName << ".lib\n"; - - str << "else:win32:CONFIG(debug, debug|release): " - << preTargetDepsSnippet; - if (useSubfolders) - str << "debug/" << libName << ".lib\n"; - else if (addSuffix) - str << libName << "d.lib\n"; + if (windowsPlatforms & AddLibraryWizard::WindowsMinGWPlatform) { + str << "win32-g++:CONFIG(release, debug|release): " + << preTargetDepsSnippet; + if (useSubfolders) + str << "release/" << "lib" << libName << ".a\n"; + else if (addSuffix) + str << "lib" << libName << ".a\n"; + + str << "else:win32-g++:CONFIG(debug, debug|release): " + << preTargetDepsSnippet; + if (useSubfolders) + str << "debug/" << "lib" << libName << ".a\n"; + else if (addSuffix) + str << "lib" << libName << "d.a\n"; + } + if (windowsPlatforms & AddLibraryWizard::WindowsMSVCPlatform) { + if (windowsPlatforms & AddLibraryWizard::WindowsMinGWPlatform) + str << "else:"; + str << "win32:!win32-g++:CONFIG(release, debug|release): " + << preTargetDepsSnippet; + if (useSubfolders) + str << "release/" << libName << ".lib\n"; + else if (addSuffix) + str << libName << ".lib\n"; + + str << "else:win32:!win32-g++:CONFIG(debug, debug|release): " + << preTargetDepsSnippet; + if (useSubfolders) + str << "debug/" << libName << ".lib\n"; + else if (addSuffix) + str << libName << "d.lib\n"; + } + generatedPlatforms |= windowsPlatforms; } else { - str << "win32: " << preTargetDepsSnippet << libName << ".lib\n"; + if (windowsPlatforms & AddLibraryWizard::WindowsMSVCPlatform) { + str << "win32:!win32-g++ " << preTargetDepsSnippet << libName << ".lib\n"; + generatedPlatforms |= AddLibraryWizard::WindowsMSVCPlatform; // mingw will be handled with common scopes + } + // mingw not generated yet, will be joined with unix like } - generatedPlatforms |= AddLibraryWizard::WindowsPlatform; } - AddLibraryWizard::Platforms commonPlatforms = platforms; - commonPlatforms &= ~QFlags<AddLibraryWizard::Platform>(AddLibraryWizard::WindowsPlatform); if (commonPlatforms) { if (generatedPlatforms) str << "else:"; @@ -562,7 +623,7 @@ NonInternalLibraryDetailsController::NonInternalLibraryDetailsController( if (creatorPlatform() == CreatorWindows) { libraryDetailsWidget()->libraryPathChooser->setPromptDialogFilter( - QLatin1String("Library file (*.lib)")); + QLatin1String("Library file (*.lib lib*.a)")); setLinkageRadiosVisible(true); setRemoveSuffixVisible(true); } else { @@ -646,7 +707,7 @@ QString NonInternalLibraryDetailsController::suggestedIncludePath() const void NonInternalLibraryDetailsController::updateWindowsOptionsEnablement() { - bool ena = platforms() & AddLibraryWizard::WindowsPlatform; + bool ena = platforms() & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform); if (creatorPlatform() == CreatorWindows) { libraryDetailsWidget()->addSuffixCheckBox->setEnabled(ena); ena = true; @@ -725,6 +786,8 @@ QString NonInternalLibraryDetailsController::snippet() const libName = fi.baseName(); if (removeSuffix && !libName.isEmpty()) // remove last letter which needs to be "d" libName = libName.left(libName.size() - 1); + if (fi.completeSuffix() == QLatin1String("a")) // the mingw lib case + libName = libName.mid(3); // cut the "lib" prefix } else if (creatorPlatform() == CreatorMac) { if (macLibraryType() == AddLibraryWizard::FrameworkType) libName = fi.baseName(); @@ -742,10 +805,11 @@ QString NonInternalLibraryDetailsController::snippet() const // when we are on Win but we don't generate the code for Win // we still need to remove "debug" or "release" subfolder const bool useSubfoldersCondition = (creatorPlatform() == CreatorWindows) - ? true : platforms() & AddLibraryWizard::WindowsPlatform; + ? true : platforms() & (AddLibraryWizard::WindowsMinGWPlatform + | AddLibraryWizard::WindowsMSVCPlatform); if (useSubfoldersCondition) useSubfolders = libraryDetailsWidget()->useSubfoldersCheckBox->isChecked(); - if (platforms() & AddLibraryWizard::WindowsPlatform) + if (platforms() & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform)) addSuffix = libraryDetailsWidget()->addSuffixCheckBox->isChecked() || removeSuffix; } if (isIncludePathVisible()) { // generate also the path to lib @@ -960,7 +1024,7 @@ void InternalLibraryDetailsController::updateWindowsOptionsEnablement() if (creatorPlatform() == CreatorWindows) libraryDetailsWidget()->addSuffixCheckBox->setEnabled(true); libraryDetailsWidget()->winGroupBox->setEnabled(platforms() - & AddLibraryWizard::WindowsPlatform); + & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform)); } void InternalLibraryDetailsController::updateProFile() diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp index aaa1f95abcf04cd576f90fed749646cadb0f5c4e..171277b616c1d0fdd1dac4d7b5d1152f6848646e 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp @@ -78,7 +78,7 @@ GuiAppWizard::GuiAppWizard(bool isMobile) setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY)); setDisplayCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY)); - setDisplayName(tr("Qt Gui Application")); + setDisplayName(tr("Qt Widgets Application")); setDescription(tr("Creates a Qt application for the desktop. " "Includes a Qt Designer-based main window.\n\n" "Preselects a desktop Qt for building the application if available.")); diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp index cf15d1f2fa2ef10838fdd881df6ac91a18c9edc6..d6a1c534d56ad3971d8808e63a688924affcaf1d 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp @@ -57,7 +57,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName, setWindowTitle(templateName); setSelectedModules(QLatin1String("core gui"), true); - setIntroDescription(tr("This wizard generates a Qt GUI application " + setIntroDescription(tr("This wizard generates a Qt Widgets Application " "project. The application derives by default from QApplication " "and includes an empty widget.")); diff --git a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp index c5a7b52a60709f93c43084a957855f23c429ae3e..1d978acdc9db964d3411aa6f3ee9c5969b7a8fe2 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp @@ -349,7 +349,8 @@ LibraryParameters LibraryWizardDialog::libraryParameters() const { LibraryParameters rc; rc.className = m_filesPage->className(); - rc.baseClassName = m_filesPage->baseClassName(); + rc.baseClassName = type() == QtProjectParameters::Qt4Plugin ? + m_filesPage->baseClassName() : QString(); rc.sourceFileName = m_filesPage->sourceFileName(); rc.headerFileName = m_filesPage->headerFileName(); return rc; diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 0e761bb67a3982ad4788cb38cd0ce1dd8727833b..136a78b4f00de9b55d285a3d666ecdb39bf34731 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -361,7 +361,6 @@ void QtVersionManager::updateFromInstaller(bool emitSignal) } if (emitSignal) emit qtVersionsChanged(added, removed, changed); - saveQtVersions(); } void QtVersionManager::saveQtVersions() diff --git a/src/plugins/remotelinux/linuxdevicetester.cpp b/src/plugins/remotelinux/linuxdevicetester.cpp index 7b30be03a97b47880a8d51342b3bea017f5bf94d..4a62f1d60280eaf24981639c3f1dd3824d81b0b4 100644 --- a/src/plugins/remotelinux/linuxdevicetester.cpp +++ b/src/plugins/remotelinux/linuxdevicetester.cpp @@ -128,7 +128,7 @@ void GenericLinuxDeviceTester::handleConnectionFailure() { QTC_ASSERT(d->state != Inactive, return); - emit errorMessage(tr("SSH connection failure: %1\n").arg(d->connection->errorString())); + emit errorMessage(tr("SSH connection failure: %1").arg(d->connection->errorString()) + QLatin1Char('\n')); setFinished(TestFailure); } @@ -139,9 +139,9 @@ void GenericLinuxDeviceTester::handleProcessFinished(int exitStatus) if (exitStatus != SshRemoteProcess::NormalExit || d->process->exitCode() != 0) { const QByteArray stderrOutput = d->process->readAllStandardError(); if (!stderrOutput.isEmpty()) - emit errorMessage(tr("uname failed: %1\n").arg(QString::fromUtf8(stderrOutput))); + emit errorMessage(tr("uname failed: %1").arg(QString::fromUtf8(stderrOutput)) + QLatin1Char('\n')); else - emit errorMessage(tr("uname failed.\n")); + emit errorMessage(tr("uname failed.") + QLatin1Char('\n')); } else { emit progressMessage(QString::fromUtf8(d->process->readAllStandardOutput())); } @@ -158,7 +158,7 @@ void GenericLinuxDeviceTester::handlePortsGatheringError(const QString &message) { QTC_ASSERT(d->state == TestingPorts, return); - emit errorMessage(tr("Error gathering ports: %1\n").arg(message)); + emit errorMessage(tr("Error gathering ports: %1").arg(message) + QLatin1Char('\n')); setFinished(TestFailure); } @@ -167,14 +167,14 @@ void GenericLinuxDeviceTester::handlePortListReady() QTC_ASSERT(d->state == TestingPorts, return); if (d->portsGatherer.usedPorts().isEmpty()) { - emit progressMessage(tr("All specified ports are available.\n")); + emit progressMessage(tr("All specified ports are available.") + QLatin1Char('\n')); } else { QString portList; foreach (const int port, d->portsGatherer.usedPorts()) portList += QString::number(port) + QLatin1String(", "); portList.remove(portList.count() - 2, 2); - emit errorMessage(tr("The following specified ports are currently in use: %1\n") - .arg(portList)); + emit errorMessage(tr("The following specified ports are currently in use: %1") + .arg(portList) + QLatin1Char('\n')); } setFinished(TestSuccess); } diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp index 48680b861fe17372b9674832a5faefd783b2822d..508e9c0c21d8a31886fe32412bda2b6be21ebfbc 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp @@ -115,7 +115,7 @@ void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested() { QTC_ASSERT(state() == Inactive, return); - showMessage(tr("Checking available ports...\n"), Utils::NormalMessageFormat); + showMessage(tr("Checking available ports...") + QLatin1Char('\n'), Utils::NormalMessageFormat); AbstractRemoteLinuxRunSupport::handleRemoteSetupRequested(); } diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 030df3661efadab9dcfe15b75721aef190ebf436..ab1c0d4150af27564cbdd03f371f6a2c5ba585e6 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -141,7 +141,7 @@ void LinuxDeviceDebugSupport::handleRemoteSetupRequested() { QTC_ASSERT(state() == Inactive, return); - showMessage(tr("Checking available ports...\n"), LogStatus); + showMessage(tr("Checking available ports...") + QLatin1Char('\n'), LogStatus); AbstractRemoteLinuxRunSupport::handleRemoteSetupRequested(); } diff --git a/src/plugins/valgrind/callgrindengine.cpp b/src/plugins/valgrind/callgrindengine.cpp index c8e6099c25cb606896b64e034d538349509cae23..574f286370aa0d596da049ef043fec58d75f9dd9 100644 --- a/src/plugins/valgrind/callgrindengine.cpp +++ b/src/plugins/valgrind/callgrindengine.cpp @@ -100,7 +100,7 @@ Valgrind::ValgrindRunner * CallgrindRunControl::runner() bool CallgrindRunControl::startEngine() { - appendMessage(tr("Profiling %1\n").arg(executable()), Utils::NormalMessageFormat); + appendMessage(tr("Profiling %1").arg(executable()) + QLatin1Char('\n'), Utils::NormalMessageFormat); return ValgrindRunControl::startEngine(); } diff --git a/src/plugins/valgrind/memcheckengine.cpp b/src/plugins/valgrind/memcheckengine.cpp index 232b01e72fe0ace08f093a71c14740d650c24907..b416dddc0eecc7ed8e7183db96d70234fa55d8da 100644 --- a/src/plugins/valgrind/memcheckengine.cpp +++ b/src/plugins/valgrind/memcheckengine.cpp @@ -80,7 +80,7 @@ bool MemcheckRunControl::startEngine() // Clear about-to-be-outdated tasks. TaskHub::clearTasks(Analyzer::Constants::ANALYZERTASK_ID); - appendMessage(tr("Analyzing memory of %1\n").arg(executable()), + appendMessage(tr("Analyzing memory of %1").arg(executable()) + QLatin1Char('\n'), Utils::NormalMessageFormat); return ValgrindRunControl::startEngine(); } diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index 337fee3a09870ba486cfa5a8b11356f42a9decf1..7f5cb77edf0f0ad10eef3752ebf30a2688fff11d 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -173,7 +173,7 @@ void ValgrindRunControl::handleProgressFinished() void ValgrindRunControl::runnerFinished() { - appendMessage(tr("Analyzing finished.\n"), NormalMessageFormat); + appendMessage(tr("Analyzing finished.") + QLatin1Char('\n'), NormalMessageFormat); emit finished(); m_progress->reportFinished(); @@ -200,11 +200,11 @@ void ValgrindRunControl::receiveProcessError(const QString &message, QProcess::P if (error == QProcess::FailedToStart) { const QString valgrind = m_settings->valgrindExecutable(); if (!valgrind.isEmpty()) - appendMessage(tr("Error: \"%1\" could not be started: %2\n").arg(valgrind).arg(message), ErrorMessageFormat); + appendMessage(tr("Error: \"%1\" could not be started: %2").arg(valgrind, message) + QLatin1Char('\n'), ErrorMessageFormat); else - appendMessage(tr("Error: no Valgrind executable set.\n"), ErrorMessageFormat); + appendMessage(tr("Error: no Valgrind executable set.") + QLatin1Char('\n'), ErrorMessageFormat); } else if (m_isStopping && error == QProcess::Crashed) { // process gets killed on stop - appendMessage(tr("Process terminated.\n"), ErrorMessageFormat); + appendMessage(tr("Process terminated.") + QLatin1Char('\n'), ErrorMessageFormat); } else { appendMessage(QString::fromLatin1("** %1 **\n").arg(message), ErrorMessageFormat); } diff --git a/src/plugins/vcsbase/vcsbaseoutputwindow.cpp b/src/plugins/vcsbase/vcsbaseoutputwindow.cpp index 200271a325ca49719c8574e42c17bd6af03277a5..9fbfe75548b43acc92d49265466deb1d61290265 100644 --- a/src/plugins/vcsbase/vcsbaseoutputwindow.cpp +++ b/src/plugins/vcsbase/vcsbaseoutputwindow.cpp @@ -429,9 +429,9 @@ QString VcsBaseOutputWindow::msgExecutionLogEntry(const QString &workingDir, const QString args = formatArguments(arguments); const QString nativeExecutable = QDir::toNativeSeparators(executable); if (workingDir.isEmpty()) - return tr("Executing: %1 %2\n").arg(nativeExecutable, args); - return tr("Executing in %1: %2 %3\n"). - arg(QDir::toNativeSeparators(workingDir), nativeExecutable, args); + return tr("Executing: %1 %2").arg(nativeExecutable, args) + QLatin1Char('\n'); + return tr("Executing in %1: %2 %3"). + arg(QDir::toNativeSeparators(workingDir), nativeExecutable, args) + QLatin1Char('\n'); } void VcsBaseOutputWindow::appendCommand(const QString &text) diff --git a/src/tools/qml2puppet/qml2puppet/qml2puppet.pro b/src/tools/qml2puppet/qml2puppet/qml2puppet.pro index 383affb20489c17e1fad6cc42b6c99980f3d2dcf..38ae1af110887359ac6533d8a6d8cb52f000de51 100644 --- a/src/tools/qml2puppet/qml2puppet/qml2puppet.pro +++ b/src/tools/qml2puppet/qml2puppet/qml2puppet.pro @@ -8,9 +8,11 @@ BUILD_PUPPET_IN_CREATOR_BINPATH = $$(BUILD_PUPPET_IN_CREATOR_BINPATH) CONFIG(debug, debug|release):isEmpty(BUILD_PUPPET_IN_CREATOR_BINPATH) { QML_TARGET_PATH=$$[QT_INSTALL_BINS]/$$TARGET$$TARGET_EXT if(write_file($$QML_TARGET_PATH)) { + CONVERTED_PATH=$$system_quote($$system_path($$QML_TARGET_PATH)) win32 { - CONVERTED_PATH=$$system_quote($$system_path($$QML_TARGET_PATH)) system(del $$CONVERTED_PATH) + } else { + system(rm $$CONVERTED_PATH) } DESTDIR = $$[QT_INSTALL_BINS] message("Build Qml Puppet to the Qt binary directory!") diff --git a/tests/auto/cplusplus/ast/tst_ast.cpp b/tests/auto/cplusplus/ast/tst_ast.cpp index 968d80e11042cc8248e4c29ed242394e6d74d9b3..449c8db6e5379a032af0dfeff60417b6e5a763dc 100644 --- a/tests/auto/cplusplus/ast/tst_ast.cpp +++ b/tests/auto/cplusplus/ast/tst_ast.cpp @@ -180,6 +180,8 @@ private slots: // Qt "keywords" void q_enum_1(); + + void incomplete_ast(); }; void tst_AST::gcc_attributes_1() @@ -1723,6 +1725,13 @@ void tst_AST::q_enum_1() QCOMPARE(unit->spell(e->identifier_token), "e"); } +void tst_AST::incomplete_ast() +{ + QSharedPointer<TranslationUnit> unit(parseStatement("class A { virtual void a() =\n")); + AST *ast = unit->ast(); + QVERIFY(ast); +} + void tst_AST::initTestCase() { control.setDiagnosticClient(&diag); diff --git a/tests/auto/debugger/dumpers.pro b/tests/auto/debugger/dumpers.pro index 0cba83242fdcfc4b4c6b99f1332b62e44eaba093..331ddc1024336744809c60e3ce0f39d39a4045bd 100644 --- a/tests/auto/debugger/dumpers.pro +++ b/tests/auto/debugger/dumpers.pro @@ -1,6 +1,7 @@ QTC_LIB_DEPENDS += cplusplus utils QT += network +QT -= gui include(../qttest.pri) diff --git a/tests/auto/debugger/namedemangler.pro b/tests/auto/debugger/namedemangler.pro index 872cadc7fc97858cd3c8b1196a7f714da5c22c5b..ec021e6eb8002e0975c5122baf0188ef6cb46c63 100644 --- a/tests/auto/debugger/namedemangler.pro +++ b/tests/auto/debugger/namedemangler.pro @@ -1,4 +1,5 @@ QTC_LIB_DEPENDS += utils +QT -= gui include(../qttest.pri) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index f57dee2a142bda48b52158841e726e6e5726ec51..0bcb04d49753130e2a345c33cc15415c9f3c84e3 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -196,10 +196,11 @@ static QByteArray parentIName(const QByteArray &iname) struct ValueBase { - ValueBase() : hasPtrSuffix(false), isFloatValue(false), version(0) {} + ValueBase() : hasPtrSuffix(false), isFloatValue(false), substituteNamespace(true), version(0) {} bool hasPtrSuffix; bool isFloatValue; + bool substituteNamespace; int version; }; @@ -232,7 +233,8 @@ struct Value : public ValueBase if (actualValue == QLatin1String(" ")) actualValue.clear(); // FIXME: Remove later. QString expectedValue = value; - expectedValue.replace(QLatin1Char('@'), QString::fromLatin1(context.nameSpace)); + if (substituteNamespace) + expectedValue.replace(QLatin1Char('@'), QString::fromLatin1(context.nameSpace)); if (hasPtrSuffix) return actualValue.startsWith(expectedValue + QLatin1String(" @0x")) @@ -277,6 +279,11 @@ struct Value5 : Value Value5(const QByteArray &value) : Value(value) { version = 5; } }; +struct UnsubstitutedValue : Value +{ + UnsubstitutedValue(const QByteArray &value) : Value(value) { substituteNamespace = false; } +}; + struct Type { Type() {} @@ -347,6 +354,13 @@ struct Cxx11Profile : public Profile {} }; +struct BoostProfile : public Profile +{ + BoostProfile() + : Profile("macx:INCLUDEPATH += /usr/local/include") + {} +}; + struct MacLibCppProfile : public Profile { MacLibCppProfile() @@ -1219,12 +1233,15 @@ void tst_Dumpers::dumper_data() "QDateTime date(QDate(1980, 1, 1), QTime(13, 15, 32), Qt::UTC);\n" "unused(&date);\n") % CoreProfile() - % Check("date", "Tue Jan 1 13:15:32 1980", "@QDateTime") + % Check("date", Value4("Tue Jan 1 13:15:32 1980"), "@QDateTime") + % Check("date", Value5("Tue Jan 1 13:15:32 1980 GMT"), "@QDateTime") % Check("date.(ISO)", "\"1980-01-01T13:15:32Z\"", "@QString") % CheckType("date.(Locale)", "@QString") % CheckType("date.(SystemLocale)", "@QString") - % Check("date.toString", "\"Tue Jan 1 13:15:32 1980\"", "@QString") - % Check("date.toUTC", "Tue Jan 1 13:15:32 1980", "@QDateTime"); + % Check("date.toString", Value4("\"Tue Jan 1 13:15:32 1980\""), "@QString") + % Check("date.toString", Value5("\"Tue Jan 1 13:15:32 1980 GMT\""), "@QString") + % Check("date.toUTC", Value4("Tue Jan 1 13:15:32 1980"), "@QDateTime") + % Check("date.toUTC", Value5("Tue Jan 1 13:15:32 1980 GMT"), "@QDateTime"); #ifdef Q_OS_WIN QByteArray tempDir = "\"C:/Program Files\""; @@ -1429,7 +1446,9 @@ void tst_Dumpers::dumper_data() QTest::newRow("QHostAddress1") << Data("#include <QHostAddress>\n", "QHostAddress ha1(129u * 256u * 256u * 256u + 130u);\n" - "QHostAddress ha2(\"127.0.0.1\");\n") + "QHostAddress ha2;\n" + "ha2.setAddress(\"127.0.0.1\");\n" + "unused(&ha1, &ha2);\n") % CoreProfile() % Profile("QT += network\n") % Check("ha1", "129.0.0.130", "@QHostAddress") @@ -1454,7 +1473,8 @@ void tst_Dumpers::dumper_data() "addr.c[13] = 0;\n" "addr.c[14] = 0;\n" "addr.c[15] = 0;\n" - "QHostAddress ha1(addr);\n") + "QHostAddress ha1(addr);\n" + "unused(&ha1);\n") % CoreProfile() % Profile("QT += network\n") % Check("addr", "1:203:506:0:809:a0b:0:0", "@QIPv6Address"); @@ -2224,9 +2244,7 @@ void tst_Dumpers::dumper_data() % Check("s", "(100.5, 200.5)", "@QSizeF"); QTest::newRow("QRegion") - << Data("#include <QRegion>\n" - "#include <QString> // Dummy for namespace\n", - "QString dummy;\n" + << Data("#include <QRegion>\n", "QRegion region, region0, region1, region2;\n" "region0 = region;\n" "region += QRect(100, 100, 200, 200);\n" @@ -2242,7 +2260,7 @@ void tst_Dumpers::dumper_data() % Check("region1.innerArea", "40000", "int") % Check("region1.innerRect", "200x200+100+100", "@QRect") % Check("region1.numRects", "1", "int") - % Check("region1.rects", "<0 items>", "@QVector<@QRect>") + % Check("region1.rects", "<1 items>", "@QVector<@QRect>") % Check("region2", "<2 items>", "@QRegion") % Check("region2.extents", "600x700+100+100", "@QRect") % Check("region2.innerArea", "200000", "int") @@ -3171,10 +3189,18 @@ void tst_Dumpers::dumper_data() QTest::newRow("QUrl") << Data("#include <QUrl>", - "QUrl url = QUrl::fromEncoded(\"http://qt-project.org/have_fun\");\n" + "QUrl url = QUrl::fromEncoded(\"http://foo@qt-project.org:10/have_fun\");\n" "unused(&url);\n") % CoreProfile() - % Check("url", "\"http://qt-project.org/have_fun\"", "@QUrl"); + % Check("url", UnsubstitutedValue("\"http://foo@qt-project.org:10/have_fun\""), "@QUrl") + % Check("url.port", Value5("10"), "int") + % Check("url.scheme", Value5("\"http\""), "@QString") + % Check("url.userName", Value5("\"foo\""), "@QString") + % Check("url.password", Value5("\"\""), "@QString") + % Check("url.host", Value5("\"qt-project.org\""), "@QString") + % Check("url.path", Value5("\"/have_fun\""), "@QString") + //% Check("url.query", Value5("\"\""), "@QString") That's a QByteArray in Qt 4 + % Check("url.fragment", Value5("\"\""), "@QString"); QTest::newRow("QStringQuotes") << Data("#include <QString>\n", @@ -3378,8 +3404,6 @@ void tst_Dumpers::dumper_data() "value = QVariant(t, (void*)0);\n" "*(QString*)value.data() = QString(\"Some string\");\n") % CoreProfile() - % LldbOnly() - % Check("t", "String", "@QVariant::Type") % Check("value", "\"Some string\"", "@QVariant (QString)"); QTest::newRow("QVariant2") @@ -3453,26 +3477,25 @@ void tst_Dumpers::dumper_data() "#include <QVariant>\n" "Q_DECLARE_METATYPE(QHostAddress)\n", "QVariant var;\n" - "QHostAddress ha(\"127.0.0.1\");\n" + "QHostAddress ha;\n" + "ha.setAddress(\"127.0.0.1\");\n" "var.setValue(ha);\n" "QHostAddress ha1 = var.value<QHostAddress>();\n" "unused(&ha1);\n") % CoreProfile() % Profile("QT += network\n") % Check("ha", "\"127.0.0.1\"", "@QHostAddress") - % Check("ha.a", "0", "@quint32") - % Check("ha.a6", "0:0:0:0:0:0:0:0", "@Q_IPV6ADDR") + % Check("ha.a", "2130706433", "@quint32") % Check("ha.ipString", "\"127.0.0.1\"", "@QString") - % Check("ha.isParsed", "false", "bool") - % Check("ha.protocol", "@QAbstractSocket::UnknownNetworkLayerProtocol (-1)", + % Check("ha.isParsed", "true", "bool") + % Check("ha.protocol", "@QAbstractSocket::IPv4Protocol (0)", "@QAbstractSocket::NetworkLayerProtocol") % Check("ha.scopeId", "\"\"", "@QString") % Check("ha1", "\"127.0.0.1\"", "@QHostAddress") - % Check("ha1.a", "0", "@quint32") - % Check("ha1.a6", "0:0:0:0:0:0:0:0", "@Q_IPV6ADDR") + % Check("ha1.a", "2130706433", "@quint32") % Check("ha1.ipString", "\"127.0.0.1\"", "@QString") - % Check("ha1.isParsed", "false", "bool") - % Check("ha1.protocol", "@QAbstractSocket::UnknownNetworkLayerProtocol (-1)", + % Check("ha1.isParsed", "true", "bool") + % Check("ha1.protocol", "@QAbstractSocket::IPv4Protocol (0)", "@QAbstractSocket::NetworkLayerProtocol") % Check("ha1.scopeId", "\"\"", "@QString") % Check("var", "", "@QVariant (@QHostAddress)") @@ -3486,14 +3509,16 @@ void tst_Dumpers::dumper_data() "typedef QMap<uint, QStringList> MyType;\n" "Q_DECLARE_METATYPE(QList<int>)\n" "Q_DECLARE_METATYPE(QStringList)\n" - "#define COMMA ,\n" - "Q_DECLARE_METATYPE(QMap<uint COMMA QStringList>)\n", + "Q_DECLARE_METATYPE(MyType)\n", "MyType my;\n" "my[1] = (QStringList() << \"Hello\");\n" "my[3] = (QStringList() << \"World\");\n" "QVariant var;\n" "var.setValue(my);\n" - "breakHere();\n") + "int t = QMetaType::type(\"MyType\");\n" + "const char *s = QMetaType::typeName(t);\n" + "breakHere();\n" + "unused(&var, &t, &s);\n") % CoreProfile() % Check("my", "<2 items>", "MyType") % Check("my.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>") @@ -3504,8 +3529,8 @@ void tst_Dumpers::dumper_data() % Check("my.1.key", "3", "unsigned int") % Check("my.1.value", "<1 items>", "@QStringList") % Check("my.1.value.0", "[0]", "\"World\"", "@QString") - % CheckType("var", "@QVariant (@QMap<unsigned int, @QStringList>)") - % Check("var.data", "<2 items>", "@QMap<unsigned int, @QStringList>") + % CheckType("var", "@QVariant (MyType)") + % Check("var.data", "<2 items>", "MyType") % Check("var.data.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>") % Check("var.data.0.key", "1", "unsigned int") % Check("var.data.0.value", "<1 items>", "@QStringList") @@ -3868,12 +3893,12 @@ void tst_Dumpers::dumper_data() "#include <QString>\n", "quint64 u64 = ULLONG_MAX;\n" "qint64 s64 = LLONG_MAX;\n" - "quint32 u32 = ULONG_MAX;\n" - "qint32 s32 = LONG_MAX;\n" + "quint32 u32 = UINT_MAX;\n" + "qint32 s32 = INT_MAX;\n" "quint64 u64s = 0;\n" "qint64 s64s = LLONG_MIN;\n" "quint32 u32s = 0;\n" - "qint32 s32s = LONG_MIN;\n" + "qint32 s32s = INT_MIN;\n" "QString dummy; // needed to get namespace\n" "unused(&u64, &s64, &u32, &s32, &u64s, &s64s, &u32s, &s32s, &dummy);\n") % CoreProfile() @@ -3946,7 +3971,7 @@ void tst_Dumpers::dumper_data() % Check("foo.9", "[9]", "", "Foo"); - QTest::newRow("Bitfields") + QTest::newRow("BitfieldsGdb") << Data("struct S\n" "{\n" " S() : x(0), y(0), c(0), b(0), f(0), d(0), i(0) {}\n" @@ -3959,6 +3984,7 @@ void tst_Dumpers::dumper_data() " int i;\n" "} s;\n" "unused(&s);\n") + % GdbOnly() % Check("s", "", "S") % Check("s.b", "false", "bool") % Check("s.c", "false", "bool") @@ -3968,6 +3994,29 @@ void tst_Dumpers::dumper_data() % Check("s.x", "0", "unsigned int") % Check("s.y", "0", "unsigned int"); + QTest::newRow("BitfieldsLldb") + << Data("struct S\n" + "{\n" + " S() : x(0), y(0), c(0), b(0), f(0), d(0), i(0) {}\n" + " unsigned int x : 1;\n" + " unsigned int y : 1;\n" + " bool c : 1;\n" + " bool b;\n" + " float f;\n" + " double d;\n" + " int i;\n" + "} s;\n" + "unused(&s);\n") + % LldbOnly() + % Check("s", "", "S") + % Check("s.b", "false", "bool") + % Check("s.c", "false", "bool:1") + % Check("s.d", "0", "double") + % Check("s.f", "0", "float") + % Check("s.i", "0", "int") + % Check("s.x", "0", "unsigned int:1") + % Check("s.y", "0", "unsigned int:1"); + QTest::newRow("Function") << Data("#include <QByteArray>\n" @@ -4311,6 +4360,7 @@ void tst_Dumpers::dumper_data() "boost::optional<int> i0, i1;\n" "i1 = 1;\n" "unused(&i0, &i1);\n") + % BoostProfile() % Check("i0", "<uninitialized>", "boost::optional<int>") % Check("i1", "1", "boost::optional<int>"); @@ -4321,6 +4371,7 @@ void tst_Dumpers::dumper_data() "sl = (QStringList() << \"xxx\" << \"yyy\");\n" "sl.get().append(\"zzz\");\n" "unused(&sl);\n") + % BoostProfile() % Check("sl", "<3 items>", "boost::optional<@QStringList>"); QTest::newRow("BoostSharedPtr") @@ -4331,6 +4382,7 @@ void tst_Dumpers::dumper_data() "boost::shared_ptr<int> j = i;\n" "boost::shared_ptr<QStringList> sl(new QStringList(QStringList() << \"HUH!\"));\n" "unused(&s, &i, &j, &sl);\n") + % BoostProfile() % Check("s", "(null)", "boost::shared_ptr<int>") % Check("i", "43", "boost::shared_ptr<int>") % Check("j", "43", "boost::shared_ptr<int>") @@ -4353,6 +4405,7 @@ void tst_Dumpers::dumper_data() "// Not where we started (expected in boost)\n" "date d5 = d -= months(4);\n" "unused(&d1, &d2, &d3, &d4, &d5);\n") + % BoostProfile() % Check("d0", "Tue Nov 29 2005", "boost::gregorian::date") % Check("d1", "Thu Dec 29 2005", "boost::gregorian::date") % Check("d2", "Sun Jan 29 2006", "boost::gregorian::date") @@ -4370,6 +4423,7 @@ void tst_Dumpers::dumper_data() "time_duration d2(0, 1, 0);\n" "time_duration d3(0, 0, 1);\n" "unused(&d1, &d2, &d3);\n") + % BoostProfile() % Check("d1", "01:00:00", "boost::posix_time::time_duration") % Check("d2", "00:01:00", "boost::posix_time::time_duration") % Check("d3", "00:00:01", "boost::posix_time::time_duration"); @@ -4383,6 +4437,7 @@ void tst_Dumpers::dumper_data() "int l = it->first;\n" "int r = it->second;\n" "unused(&l, &r);\n") + % BoostProfile() % Check("b", "<1 items>", "B"); QTest::newRow("BoostPosixTimePtime") @@ -4395,7 +4450,8 @@ void tst_Dumpers::dumper_data() "ptime p1(date(2002, 1, 10), time_duration(1, 0, 0));\n" "ptime p2(date(2002, 1, 10), time_duration(0, 0, 0));\n" "ptime p3(date(1970, 1, 1), time_duration(0, 0, 0));\n" - "unused(&p1, &p2, p3);\n") + "unused(&p1, &p2, &p3);\n") + % BoostProfile() % Check("p1", "Thu Jan 10 01:00:00 2002", "boost::posix_time::ptime") % Check("p2", "Thu Jan 10 00:00:00 2002", "boost::posix_time::ptime") % Check("p3", "Thu Jan 1 00:00:00 1970", "boost::posix_time::ptime"); @@ -4833,6 +4889,7 @@ void tst_Dumpers::dumper_data() "#endif\n" "unused(&ptrConst, &ref, &refConst, &ptrToPtr, &sharedPtr);\n") % GdbVersion(70500) + % BoostProfile() % Check("d", "", "Derived") % Check("d.@1", "[Base]", "", "Base") % Check("d.b", "2", "int") @@ -4905,7 +4962,7 @@ void tst_Dumpers::dumper_data() int main(int argc, char *argv[]) { - QApplication app(argc, argv); + QCoreApplication app(argc, argv); tst_Dumpers test; return QTest::qExec(&test, argc, argv); } diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index 76960dfa24dad7139aed15b80a6311a72c542470..88facd246c89f3dcf14033580cdb194797dabedb 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -4168,6 +4168,7 @@ namespace qvariant { // FIXME: Known to break //QString type = var.typeName(); var.setValue(my); + const char *name = QMetaType::typeName(var.userType()); BREAK_HERE; // Expand my my.0 my.0.value my.1 my.1.value var var.data var.data.0 var.data.0.value var.data.1 var.data.1.value. // Check my <2 items> qvariant::MyType. @@ -4193,7 +4194,7 @@ namespace qvariant { var.setValue(my); var.setValue(my); var.setValue(my); - dummyStatement(&var); + dummyStatement(&var, &name); } void testQVariant6()