Merge remote-tracking branch 'origin/4.3'

Change-Id: Idcd88f9ef7183779751e64cb878fe5c383d9ef8a
This commit is contained in:
Orgad Shaneh
2017-03-17 09:36:03 +02:00
30 changed files with 333 additions and 132 deletions

View File

@@ -24,6 +24,7 @@
############################################################################ ############################################################################
import os import os
import codecs
import copy import copy
import collections import collections
import struct import struct
@@ -436,7 +437,7 @@ class DumperBase:
elif self.currentValue.encoding == 'utf8': elif self.currentValue.encoding == 'utf8':
value = self.hexdecode(value) value = self.hexdecode(value)
elif self.currentValue.encoding == 'utf16': elif self.currentValue.encoding == 'utf16':
b = bytes.fromhex(value) b = bytes(bytearray.fromhex(value))
value = codecs.decode(b, 'utf-16') value = codecs.decode(b, 'utf-16')
self.put('"%s"' % value) self.put('"%s"' % value)
if self.currentValue.elided: if self.currentValue.elided:
@@ -1501,20 +1502,20 @@ class DumperBase:
return customEventFunc in (self.qtCustomEventFunc, self.qtCustomEventPltFunc) return customEventFunc in (self.qtCustomEventFunc, self.qtCustomEventPltFunc)
def extractQObjectProperty(objectPtr): # def extractQObjectProperty(objectPtr):
vtablePtr = self.extractPointer(objectPtr) # vtablePtr = self.extractPointer(objectPtr)
metaObjectFunc = self.extractPointer(vtablePtr) # metaObjectFunc = self.extractPointer(vtablePtr)
cmd = '((void*(*)(void*))0x%x)((void*)0x%x)' % (metaObjectFunc, objectPtr) # cmd = '((void*(*)(void*))0x%x)((void*)0x%x)' % (metaObjectFunc, objectPtr)
try: # try:
#warn('MO CMD: %s' % cmd) # #warn('MO CMD: %s' % cmd)
res = self.parseAndEvaluate(cmd) # res = self.parseAndEvaluate(cmd)
#warn('MO RES: %s' % res) # #warn('MO RES: %s' % res)
self.bump('successfulMetaObjectCall') # self.bump('successfulMetaObjectCall')
return res.pointer() # return res.pointer()
except: # except:
self.bump('failedMetaObjectCall') # self.bump('failedMetaObjectCall')
#warn('COULD NOT EXECUTE: %s' % cmd) # #warn('COULD NOT EXECUTE: %s' % cmd)
return 0 # return 0
def extractMetaObjectPtr(self, objectPtr, typeobj): def extractMetaObjectPtr(self, objectPtr, typeobj):
""" objectPtr - address of *potential* instance of QObject derived class """ objectPtr - address of *potential* instance of QObject derived class
@@ -1863,10 +1864,6 @@ class DumperBase:
self.putTypedPointer('[extraData]', extraData, self.putTypedPointer('[extraData]', extraData,
ns + 'QObjectPrivate::ExtraData') ns + 'QObjectPrivate::ExtraData')
if connectionListsPtr:
self.putTypedPointer('[connectionLists]', connectionListsPtr,
ns + 'QObjectConnectionListVector')
with SubItem(self, '[metaObject]'): with SubItem(self, '[metaObject]'):
self.putAddress(metaObjectPtr) self.putAddress(metaObjectPtr)
self.putNumChild(1) self.putNumChild(1)
@@ -1874,6 +1871,40 @@ class DumperBase:
with Children(self): with Children(self):
self.putQObjectGutsHelper(0, 0, -1, metaObjectPtr, 'QMetaObject') self.putQObjectGutsHelper(0, 0, -1, metaObjectPtr, 'QMetaObject')
with SubItem(self, '[connections]'):
if connectionListsPtr:
typeName = ns + 'QVector<' + ns + 'QObjectPrivate::ConnectionList>'
self.putItem(self.createValue(connectionListsPtr, typeName))
else:
self.putItemCount(0)
with SubItem(self, '[signals]'):
self.putItemCount(signalCount)
if self.isExpanded():
with Children(self):
j = -1
for i in range(signalCount):
t = self.split('IIIII', dataPtr + 56 + 20 * i)
flags = t[4]
if flags != 0x06:
continue
j += 1
with SubItem(self, j):
name = self.metaString(metaObjectPtr, t[0], revision)
self.putType(' ')
self.putValue(name)
self.putNumChild(1)
with Children(self):
putt('[nameindex]', t[0])
#putt('[type]', 'signal')
putt('[argc]', t[1])
putt('[parameter]', t[2])
putt('[tag]', t[3])
putt('[flags]', t[4])
putt('[localindex]', str(i))
putt('[globalindex]', str(globalOffset + i))
#self.putQObjectConnections(dd)
if isQMetaObject or isQObject: if isQMetaObject or isQObject:
with SubItem(self, '[properties]'): with SubItem(self, '[properties]'):
@@ -2012,20 +2043,6 @@ class DumperBase:
self.putValue(globalOffset + localIndex) self.putValue(globalOffset + localIndex)
#with SubItem(self, '[signals]'):
# self.putItemCount(signalCount)
# signalNames = metaData(52, -14, 5)
# warn('NAMES: %s' % signalNames)
# if self.isExpanded():
# with Children(self):
# putt('A', 'b')
# for i in range(signalCount):
# k = signalNames[i]
# with SubItem(self, k):
# self.putEmptyValue()
# if dd:
# self.putQObjectConnections(dd)
def putQObjectConnections(self, dd): def putQObjectConnections(self, dd):
with SubItem(self, '[connections]'): with SubItem(self, '[connections]'):
ptrSize = self.ptrSize() ptrSize = self.ptrSize()

View File

@@ -1078,6 +1078,26 @@ def qdump__QMetaObject(d, value):
d.putMembersItem(value) d.putMembersItem(value)
def qdump__QObjectPrivate__ConnectionList(d, value):
d.putNumChild(1)
if d.isExpanded():
i = 0
with Children(d):
first, last = value.split('pp')
currentConnection = first
connectionType = d.createType('QObjectPrivate::Connection')
while currentConnection and currentConnection != last:
sender, receiver, slotObj, nextConnectionList, nextp, prev = \
d.split('pppppp', currentConnection)
d.putSubItem(i, d.createValue(currentConnection, connectionType))
currentConnection = nextp
i += 1
d.putFields(value)
d.putItemCount(i)
else:
d.putSpecialValue('minimumitemcount', 0)
def qdump__QPixmap(d, value): def qdump__QPixmap(d, value):
if d.qtVersion() < 0x050000: if d.qtVersion() < 0x050000:
(vtbl, painters, dataPtr) = value.split('ppp'); (vtbl, painters, dataPtr) = value.split('ppp');

View File

@@ -618,26 +618,6 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
return QProxyStyle::drawControl(element, option, painter, widget); return QProxyStyle::drawControl(element, option, painter, widget);
switch (element) { switch (element) {
case CE_TabBarTabShape:
// Most styles draw a single dark outline. This looks rather ugly when combined with our
// single pixel dark separator so we adjust the first tab to compensate for this
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
QStyleOptionTab adjustedTab = *tab;
if (tab->cornerWidgets == QStyleOptionTab::NoCornerWidgets && (
tab->position == QStyleOptionTab::Beginning ||
tab->position == QStyleOptionTab::OnlyOneTab))
{
if (option->direction == Qt::LeftToRight)
adjustedTab.rect = adjustedTab.rect.adjusted(-1, 0, 0, 0);
else
adjustedTab.rect = adjustedTab.rect.adjusted(0, 0, 1 ,0);
}
QProxyStyle::drawControl(element, &adjustedTab, painter, widget);
return;
}
break;
case CE_MenuItem: case CE_MenuItem:
painter->save(); painter->save();
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {

View File

@@ -208,7 +208,14 @@ const char pp_configuration[] =
"#define __finally\n" "#define __finally\n"
"#define __inline inline\n" "#define __inline inline\n"
"#define __forceinline inline\n" "#define __forceinline inline\n"
"#define __pragma(x)\n"; "#define __pragma(x)\n"
"#define __w64\n"
"#define __int64 long long\n"
"#define __int32 long\n"
"#define __int16 short\n"
"#define __int8 char\n"
"#define __ptr32\n"
"#define __ptr64\n";
QSet<QString> CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck) QSet<QString> CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck)
{ {

View File

@@ -303,7 +303,7 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
connect(d->connection, &QmlDebugConnection::logStateChange, connect(d->connection, &QmlDebugConnection::logStateChange,
this, &QmlEngine::showConnectionStateMessage); this, &QmlEngine::showConnectionStateMessage);
connect(d->connection, &QmlDebugConnection::logError, this, connect(d->connection, &QmlDebugConnection::logError, this,
[this](const QString &error) { showMessage("QML Debugger: " + error, StatusBar); }); [this](const QString &error) { showMessage("QML Debugger: " + error, LogWarning); });
connect(d->connection, &QmlDebugConnection::connectionFailed, connect(d->connection, &QmlDebugConnection::connectionFailed,
this, &QmlEngine::connectionFailed); this, &QmlEngine::connectionFailed);
@@ -1261,6 +1261,8 @@ void QmlEngine::connectionFailed()
{ {
// this is only an error if we are already connected and something goes wrong. // this is only an error if we are already connected and something goes wrong.
if (isConnected()) { if (isConnected()) {
showMessage(tr("QML Debugger: Connection failed."), StatusBar);
if (!isSlaveEngine()) { // normal flow for slave engine when gdb exits if (!isSlaveEngine()) { // normal flow for slave engine when gdb exits
notifyInferiorSpontaneousStop(); notifyInferiorSpontaneousStop();
notifyInferiorIll(); notifyInferiorIll();

View File

@@ -606,7 +606,15 @@ void QmlInspectorAgent::addWatchData(const ObjectReference &obj,
name = obj.className(); name = obj.className();
if (name.isEmpty()) if (name.isEmpty())
return; name = obj.name();
if (name.isEmpty()) {
FileReference file = obj.source();
name = file.url().fileName() + ':' + QString::number(file.lineNumber());
}
if (name.isEmpty())
name = tr("<anonymous>");
// object // object
auto objWatch = new WatchItem; auto objWatch = new WatchItem;

View File

@@ -498,7 +498,8 @@ void IosConfigurations::loadProvisioningData(bool notify)
} }
const QDir provisioningProflesDir(provisioningProfileDirPath); const QDir provisioningProflesDir(provisioningProfileDirPath);
foreach (QFileInfo fileInfo, provisioningProflesDir.entryInfoList({"*.mobileprovision"}, QDir::NoDotAndDotDot | QDir::Files)) { const QStringList filters = {"*.mobileprovision"};
foreach (QFileInfo fileInfo, provisioningProflesDir.entryInfoList(filters, QDir::NoDotAndDotDot | QDir::Files)) {
QDomDocument provisioningDoc; QDomDocument provisioningDoc;
auto profile = std::make_shared<ProvisioningProfile>(); auto profile = std::make_shared<ProvisioningProfile>();
QString teamID; QString teamID;

View File

@@ -382,6 +382,9 @@ void ModelIndexer::onProjectFileListChanged(ProjectExplorer::Project *project)
void ModelIndexer::scanProject(ProjectExplorer::Project *project) void ModelIndexer::scanProject(ProjectExplorer::Project *project)
{ {
if (!project->rootProjectNode())
return;
// TODO harmonize following code with findFirstModel()? // TODO harmonize following code with findFirstModel()?
QStringList files = project->files(ProjectExplorer::Project::SourceFiles); QStringList files = project->files(ProjectExplorer::Project::SourceFiles);
QQueue<QueuedFile> filesQueue; QQueue<QueuedFile> filesQueue;

View File

@@ -270,23 +270,10 @@ bool AbstractMsvcToolChain::canClone() const
} }
// Function must be thread-safe! // Function must be thread-safe!
QByteArray AbstractMsvcToolChain::msvcPredefinedMacros(const QStringList cxxflags, QByteArray AbstractMsvcToolChain::msvcPredefinedMacros(const QStringList,
const Utils::Environment& env) const const Utils::Environment&) const
{ {
Q_UNUSED(cxxflags); return QByteArray();
Q_UNUSED(env);
static const QByteArray predefinedMacros(
"#define __MSVCRT__\n"
"#define __w64\n"
"#define __int64 long long\n"
"#define __int32 long\n"
"#define __int16 short\n"
"#define __int8 char\n"
"#define __ptr32\n"
"#define __ptr64\n");
return predefinedMacros;
} }
bool AbstractMsvcToolChain::generateEnvironmentSettings(const Utils::Environment &env, bool AbstractMsvcToolChain::generateEnvironmentSettings(const Utils::Environment &env,

View File

@@ -260,22 +260,85 @@ static QString generateDisplayName(const QString &name,
static QByteArray msvcCompilationFile() static QByteArray msvcCompilationFile()
{ {
static const char* macros[] = {"_ATL_VER", "_CHAR_UNSIGNED", "__CLR_VER", static const char* macros[] = {
"__cplusplus_cli", "__COUNTER__", "__cplusplus", "_ATL_VER",
"_CPPLIB_VER", "_CPPRTTI", "_CPPUNWIND", "__ATOM__",
"_DEBUG", "_DLL", "__FUNCDNAME__", "__AVX__",
"__FUNCSIG__", "__FUNCTION__", "_INTEGRAL_MAX_BITS", "__AVX2__",
"_M_ALPHA", "_M_AAMD64", "_M_CEE", "_M_CEE_PURE", "_CHAR_UNSIGNED",
"_M_CEE_SAFE", "_M_IX86", "_M_IA64", "__CLR_VER",
"_M_IX86_FP", "_M_MPPC", "_M_MRX000", "_CMMN_INTRIN_FUNC",
"_M_PPC", "_M_X64", "_MANAGED", "_CONTROL_FLOW_GUARD",
"_MFC_VER", "_MSC_BUILD", "_MSC_EXTENSIONS", "__COUNTER__",
"_MSC_FULL_VER", "_MSC_VER", "__MSVC_RUNTIME_CHECKS", "__cplusplus",
"_MT", "_NATIVE_WCHAR_T_DEFINED", "_OPENMP", "__cplusplus_cli",
"_VC_NODEFAULTLIB", "_WCHAR_T_DEFINED", "_WIN32", "__cplusplus_winrt",
"_WIN32_WCE", "_WIN64", "_Wp64", "_CPPLIB_VER",
"__DATE__", "__TIME__", "__TIMESTAMP__", "_CPPRTTI",
0}; "_CPPUNWIND",
"__DATE__",
"_DEBUG",
"_DLL",
"__FILE__",
"__func__",
"__FUNCDNAME__",
"__FUNCSIG__",
"__FUNCTION__",
"_INTEGRAL_MAX_BITS",
"__INTELLISENSE__",
"_ISO_VOLATILE",
"_KERNEL_MODE",
"__LINE__",
"_M_AAMD64",
"_M_ALPHA",
"_M_AMD64",
"_MANAGED",
"_M_ARM",
"_M_ARM64",
"_M_ARM_ARMV7VE",
"_M_ARM_FP",
"_M_ARM_NT",
"_M_ARMT",
"_M_CEE",
"_M_CEE_PURE",
"_M_CEE_SAFE",
"_MFC_VER",
"_M_FP_EXCEPT",
"_M_FP_FAST",
"_M_FP_PRECISE",
"_M_FP_STRICT",
"_M_IA64",
"_M_IX86",
"_M_IX86_FP",
"_M_MPPC",
"_M_MRX000",
"_M_PPC",
"_MSC_BUILD",
"_MSC_EXTENSIONS",
"_MSC_FULL_VER",
"_MSC_VER",
"_MSVC_LANG",
"__MSVC_RUNTIME_CHECKS",
"_MT",
"_M_THUMB",
"_M_X64",
"_NATIVE_WCHAR_T_DEFINED",
"_OPENMP",
"_PREFAST_",
"__STDC__",
"__STDC_HOSTED__",
"__STDCPP_THREADS__",
"__TIME__",
"__TIMESTAMP__",
"_VC_NODEFAULTLIB",
"_WCHAR_T_DEFINED",
"_WIN32",
"_WIN32_WCE",
"_WIN64",
"_WINRT_DLL",
"_Wp64",
0
};
QByteArray file = "#define __PPOUT__(x) V##x=x\n\n"; QByteArray file = "#define __PPOUT__(x) V##x=x\n\n";
for (int i = 0; macros[i] != 0; ++i) { for (int i = 0; macros[i] != 0; ++i) {
const QByteArray macro(macros[i]); const QByteArray macro(macros[i]);
@@ -287,11 +350,66 @@ static QByteArray msvcCompilationFile()
} }
// Run MSVC 'cl' compiler to obtain #defines. // Run MSVC 'cl' compiler to obtain #defines.
// Function must be thread-safe! // This function must be thread-safe!
//
// Some notes regarding the used approach:
//
// It seems that there is no reliable way to get all the
// predefined macros for a cl invocation. The following two
// approaches are unfortunately limited since both lead to an
// incomplete list of actually predefined macros and come with
// other problems, too.
//
// 1) Maintain a list of predefined macros from the official
// documentation (for MSVC2015, e.g. [1]). Feed cl with a
// temporary file that queries the values of those macros.
//
// Problems:
// * Maintaining that list.
// * The documentation is incomplete, we do not get all
// predefined macros. E.g. the cl from MSVC2015, set up
// with "vcvars.bat x86_arm", predefines among others
// _M_ARMT, but that's not reflected in the
// documentation.
//
// 2) Run cl with the undocumented options /B1 and /Bx, as
// described in [2].
//
// Note: With qmake from Qt >= 5.8 it's possible to print
// the macros formatted as preprocessor code in an easy to
// read/compare/diff way:
//
// > cl /nologo /c /TC /B1 qmake NUL
// > cl /nologo /c /TP /Bx qmake NUL
//
// Problems:
// * Using undocumented options.
// * Resulting macros are incomplete.
// For example, the nowadays default option /Zc:wchar_t
// predefines _WCHAR_T_DEFINED, but this is not reflected
// with this approach.
//
// To work around this we would need extra cl invocations
// to get the actual values of the missing macros
// (approach 1).
//
// Currently we combine both approaches in this way:
// * As base, maintain the list from the documentation and
// update it once a new MSVC version is released.
// * Enrich it with macros that we discover with approach 2
// once a new MSVC version is released.
// * Enrich it further with macros that are not covered with
// the above points.
//
// TODO: Update the predefined macros for MSVC 2017 once the
// page exists.
//
// [1] https://msdn.microsoft.com/en-us/library/b0084kay.aspx
// [2] http://stackoverflow.com/questions/3665537/how-to-find-out-cl-exes-built-in-macros
QByteArray MsvcToolChain::msvcPredefinedMacros(const QStringList cxxflags, QByteArray MsvcToolChain::msvcPredefinedMacros(const QStringList cxxflags,
const Utils::Environment &env) const const Utils::Environment &env) const
{ {
QByteArray predefinedMacros = AbstractMsvcToolChain::msvcPredefinedMacros(cxxflags, env); QByteArray predefinedMacros;
QStringList toProcess; QStringList toProcess;
foreach (const QString &arg, cxxflags) { foreach (const QString &arg, cxxflags) {

View File

@@ -419,7 +419,7 @@ void Project::setDocument(Core::IDocument *doc)
d->m_document = doc; d->m_document = doc;
if (!d->m_rootProjectNode) { if (!d->m_rootProjectNode) {
auto newRoot = new ProjectNode(projectFilePath()); auto newRoot = new ProjectNode(projectDirectory());
newRoot->setDisplayName(displayName()); newRoot->setDisplayName(displayName());
newRoot->addNode(new FileNode(projectFilePath(), FileType::Project, false)); newRoot->addNode(new FileNode(projectFilePath(), FileType::Project, false));
setRootProjectNode(newRoot); setRootProjectNode(newRoot);

View File

@@ -124,7 +124,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
case Qt::FontRole: { case Qt::FontRole: {
QFont font; QFont font;
if (Project *project = SessionManager::startupProject()) { if (Project *project = SessionManager::startupProject()) {
if (node == project->rootProjectNode()) if (node == SessionManager::nodeForProject(project))
font.setBold(true); font.setBold(true);
} }
result = font; result = font;
@@ -227,7 +227,7 @@ ExpandData FlatModel::expandDataForNode(const Node *node) const
void FlatModel::handleProjectAdded(Project *project) void FlatModel::handleProjectAdded(Project *project)
{ {
Node *node = project->rootProjectNode(); Node *node = SessionManager::nodeForProject(project);
m_toExpand.insert(expandDataForNode(node)); m_toExpand.insert(expandDataForNode(node));
if (WrapperNode *wrapper = wrapperForNode(node)) { if (WrapperNode *wrapper = wrapperForNode(node)) {
wrapper->forFirstLevelChildren([this](WrapperNode *child) { wrapper->forFirstLevelChildren([this](WrapperNode *child) {

View File

@@ -637,6 +637,7 @@ FolderNode::AddNewInformation FolderNode::addNewInformation(const QStringList &f
void FolderNode::addNode(Node *node) void FolderNode::addNode(Node *node)
{ {
QTC_ASSERT(node, return);
QTC_ASSERT(!node->parentFolderNode(), qDebug("File node has already a parent folder")); QTC_ASSERT(!node->parentFolderNode(), qDebug("File node has already a parent folder"));
node->setParentFolderNode(this); node->setParentFolderNode(this);
m_nodes.append(node); m_nodes.append(node);

View File

@@ -680,6 +680,15 @@ Project *SessionManager::projectForNode(Node *node)
return nullptr; return nullptr;
} }
Node *SessionManager::nodeForProject(Project *project)
{
for (const QPair<Project *,ProjectNode*> &pair : d->m_projects) {
if (pair.first == project)
return pair.second;
}
return nullptr;
}
Project *SessionManager::projectForFile(const Utils::FileName &fileName) Project *SessionManager::projectForFile(const Utils::FileName &fileName)
{ {
const QList<Project *> &projectList = projects(); const QList<Project *> &projectList = projects();

View File

@@ -116,6 +116,7 @@ public:
static SessionNode *sessionNode(); static SessionNode *sessionNode();
static Project *projectForNode(Node *node); static Project *projectForNode(Node *node);
static Node *nodeForProject(Project *project);
static Node *nodeForFile(const Utils::FileName &fileName); static Node *nodeForFile(const Utils::FileName &fileName);
static Project *projectForFile(const Utils::FileName &fileName); static Project *projectForFile(const Utils::FileName &fileName);

View File

@@ -442,7 +442,8 @@ QmakeProFileNode *DesktopQmakeRunConfiguration::projectNode() const
QmakeProject *project = qmakeProject(); QmakeProject *project = qmakeProject();
QTC_ASSERT(project, return nullptr); QTC_ASSERT(project, return nullptr);
QmakeProFileNode *rootNode = project->rootProjectNode(); QmakeProFileNode *rootNode = project->rootProjectNode();
QTC_ASSERT(rootNode, return nullptr); if (!rootNode)
return nullptr;
return rootNode->findProFileFor(m_proFilePath); return rootNode->findProFileFor(m_proFilePath);
} }

View File

@@ -69,10 +69,10 @@ public:
QmakeProFileNode *proFileNode() const; QmakeProFileNode *proFileNode() const;
protected: protected:
QmakeProject *m_project; QmakeProject *m_project = nullptr;
private: private:
QmakeProFileNode *m_qmakeProFileNode; QmakeProFileNode *m_qmakeProFileNode = nullptr;
}; };
// Implements ProjectNode for qmake .pro files // Implements ProjectNode for qmake .pro files

View File

@@ -37,17 +37,17 @@
#include <designmodecontext.h> #include <designmodecontext.h>
#include <modelnode.h> #include <modelnode.h>
#include <model.h> #include <model.h>
#include <QDebug>
#include <QPair>
#include <QString>
#include <QTimer>
#include <zoomaction.h>
#include <nodeabstractproperty.h> #include <nodeabstractproperty.h>
#include <nodelistproperty.h> #include <nodelistproperty.h>
#include <rewriterview.h>
#include <zoomaction.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <QDebug>
#include <QPair>
#include <QString>
#include <QTimer> #include <QTimer>
namespace QmlDesigner { namespace QmlDesigner {
@@ -81,6 +81,14 @@ void FormEditorView::modelAttached(Model *model)
setupFormEditorItemTree(rootModelNode()); setupFormEditorItemTree(rootModelNode());
m_formEditorWidget->updateActions(); m_formEditorWidget->updateActions();
if (!rewriterView()->errors().isEmpty())
formEditorWidget()->showErrorMessageBox(rewriterView()->errors());
else
formEditorWidget()->hideErrorMessageBox();
if (!rewriterView()->warnings().isEmpty())
formEditorWidget()->showWarningMessageBox(rewriterView()->warnings());
} }

View File

@@ -114,6 +114,10 @@ void TextEditorView::modelAttached(Model *model)
void TextEditorView::modelAboutToBeDetached(Model *model) void TextEditorView::modelAboutToBeDetached(Model *model)
{ {
AbstractView::modelAboutToBeDetached(model); AbstractView::modelAboutToBeDetached(model);
m_widget->setTextEditor(0);
QmlDesignerPlugin::instance()->emitCurrentTextEditorChanged(QmlDesignerPlugin::instance()->currentDesignDocument()->textEditor());
} }
void TextEditorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/) void TextEditorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)

View File

@@ -68,6 +68,8 @@ void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor)
{ {
TextEditor::BaseTextEditor *oldEditor = m_textEditor.release(); TextEditor::BaseTextEditor *oldEditor = m_textEditor.release();
m_textEditor.reset(textEditor); m_textEditor.reset(textEditor);
if (textEditor) {
layout()->removeWidget(m_statusBar); layout()->removeWidget(m_statusBar);
layout()->addWidget(textEditor->editorWidget()); layout()->addWidget(textEditor->editorWidget());
layout()->addWidget(m_statusBar); layout()->addWidget(m_statusBar);
@@ -83,6 +85,7 @@ void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor)
}); });
textEditor->editorWidget()->installEventFilter(this); textEditor->editorWidget()->installEventFilter(this);
}
if (oldEditor) if (oldEditor)
oldEditor->deleteLater(); oldEditor->deleteLater();
@@ -113,6 +116,12 @@ void TextEditorWidget::jumpTextCursorToSelectedModelNode()
{ {
ModelNode selectedNode; ModelNode selectedNode;
if (hasFocus())
return;
if (m_textEditor && m_textEditor->editorWidget()->hasFocus())
return;
if (!m_textEditorView->selectedModelNodes().isEmpty()) if (!m_textEditorView->selectedModelNodes().isEmpty())
selectedNode = m_textEditorView->selectedModelNodes().first(); selectedNode = m_textEditorView->selectedModelNodes().first();

View File

@@ -371,6 +371,8 @@ bool itemIsMovable(const ModelNode &modelNode)
if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab")) if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab"))
return false; return false;
if (!modelNode.parentProperty().isNodeListProperty())
return false;
return NodeHints::fromModelNode(modelNode).isMovable(); return NodeHints::fromModelNode(modelNode).isMovable();
} }

View File

@@ -283,16 +283,15 @@ void QmlDesignerPlugin::integrateIntoQtCreator(QWidget *modeWidget)
if (d && currentEditor && checkIfEditorIsQtQuick(currentEditor) && if (d && currentEditor && checkIfEditorIsQtQuick(currentEditor) &&
!documentIsAlreadyOpen(currentDesignDocument(), currentEditor, newMode)) { !documentIsAlreadyOpen(currentDesignDocument(), currentEditor, newMode)) {
if (!isDesignerMode(newMode) && isDesignerMode(oldMode)) if (isDesignerMode(newMode)) {
hideDesigner();
else if (currentEditor && isDesignerMode(newMode))
showDesigner(); showDesigner();
else if (currentDesignDocument()) } else if (currentDesignDocument() ||
(!isDesignerMode(newMode) && isDesignerMode(oldMode))) {
hideDesigner(); hideDesigner();
} }
}
}); });
d->viewManager.designerActionManager().polishActions(); d->viewManager.designerActionManager().polishActions();
} }

View File

@@ -33,10 +33,9 @@ namespace Internal {
QmlProfilerTextMark::QmlProfilerTextMark(QmlProfilerTool *tool, int typeId, const QString &fileName, QmlProfilerTextMark::QmlProfilerTextMark(QmlProfilerTool *tool, int typeId, const QString &fileName,
int lineNumber) : int lineNumber) :
TextMark(fileName, lineNumber, Constants::TEXT_MARK_CATEGORY), m_tool(tool), TextMark(fileName, lineNumber, Constants::TEXT_MARK_CATEGORY, 3.5), m_tool(tool),
m_typeIds(1, typeId) m_typeIds(1, typeId)
{ {
setWidthFactor(3.5);
} }
void QmlProfilerTextMark::addTypeId(int typeId) void QmlProfilerTextMark::addTypeId(int typeId)

View File

@@ -44,10 +44,11 @@ void SilverSearcherPlugin::extensionsInitialized()
{ {
} }
#ifdef WITH_TESTS
QList<QObject *> SilverSearcherPlugin::createTestObjects() const QList<QObject *> SilverSearcherPlugin::createTestObjects() const
{ {
return {new OutputParserTest}; return {new OutputParserTest};
} }
#endif
} // namespace Internal } // namespace Internal
} // namespace SilverSearcher } // namespace SilverSearcher

View File

@@ -36,8 +36,8 @@ class SilverSearcherPlugin : public ExtensionSystem::IPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "SilverSearcher.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "SilverSearcher.json")
public: public:
bool initialize(const QStringList &arguments, QString *errorString); bool initialize(const QStringList &arguments, QString *errorString) override;
void extensionsInitialized(); void extensionsInitialized() override;
#ifdef WITH_TESTS #ifdef WITH_TESTS
private: private:
QList<QObject *> createTestObjects() const override; QList<QObject *> createTestObjects() const override;

View File

@@ -41,14 +41,14 @@ using namespace TextEditor::Internal;
namespace TextEditor { namespace TextEditor {
TextMark::TextMark(const QString &fileName, int lineNumber, Id category) TextMark::TextMark(const QString &fileName, int lineNumber, Id category, double widthFactor)
: m_baseTextDocument(0), : m_baseTextDocument(0),
m_fileName(fileName), m_fileName(fileName),
m_lineNumber(lineNumber), m_lineNumber(lineNumber),
m_priority(NormalPriority), m_priority(NormalPriority),
m_visible(true), m_visible(true),
m_category(category), m_category(category),
m_widthFactor(1.0) m_widthFactor(widthFactor)
{ {
if (!m_fileName.isEmpty()) if (!m_fileName.isEmpty())
TextEditorPlugin::baseTextMarkRegistry()->add(this); TextEditorPlugin::baseTextMarkRegistry()->add(this);

View File

@@ -50,7 +50,7 @@ namespace Internal { class TextMarkRegistry; }
class TEXTEDITOR_EXPORT TextMark class TEXTEDITOR_EXPORT TextMark
{ {
public: public:
TextMark(const QString &fileName, int lineNumber, Core::Id category); TextMark(const QString &fileName, int lineNumber, Core::Id category, double widthFactor = 1.0);
virtual ~TextMark(); virtual ~TextMark();
// determine order on markers on the same line. // determine order on markers on the same line.

View File

@@ -42,11 +42,10 @@ namespace Constants { const char CALLGRIND_TEXT_MARK_CATEGORY[] = "Callgrind.Tex
CallgrindTextMark::CallgrindTextMark(const QPersistentModelIndex &index, CallgrindTextMark::CallgrindTextMark(const QPersistentModelIndex &index,
const QString &fileName, int lineNumber) const QString &fileName, int lineNumber)
: TextEditor::TextMark(fileName, lineNumber, Constants::CALLGRIND_TEXT_MARK_CATEGORY) : TextEditor::TextMark(fileName, lineNumber, Constants::CALLGRIND_TEXT_MARK_CATEGORY, 4.0)
, m_modelIndex(index) , m_modelIndex(index)
{ {
setPriority(TextEditor::TextMark::HighPriority); setPriority(TextEditor::TextMark::HighPriority);
setWidthFactor(4.0);
} }
void CallgrindTextMark::paint(QPainter *painter, const QRect &paintRect) const void CallgrindTextMark::paint(QPainter *painter, const QRect &paintRect) const

View File

@@ -47,6 +47,7 @@ const char ID[] = "ProjectExplorer.ToolChain.Id";
const char DISPLAYNAME[] = "ProjectExplorer.ToolChain.DisplayName"; const char DISPLAYNAME[] = "ProjectExplorer.ToolChain.DisplayName";
const char AUTODETECTED[] = "ProjectExplorer.ToolChain.Autodetect"; const char AUTODETECTED[] = "ProjectExplorer.ToolChain.Autodetect";
const char LANGUAGE_KEY[] = "ProjectExplorer.ToolChain.Language"; const char LANGUAGE_KEY[] = "ProjectExplorer.ToolChain.Language";
const char LANGUAGE_KEY_V2[] = "ProjectExplorer.ToolChain.LanguageV2";
// GCC ToolChain: // GCC ToolChain:
const char PATH[] = "ProjectExplorer.GccToolChain.Path"; const char PATH[] = "ProjectExplorer.GccToolChain.Path";
@@ -265,7 +266,30 @@ QVariantMap AddToolChainOperation::addToolChain(const QVariantMap &map, const QS
KeyValuePairList data; KeyValuePairList data;
data << KeyValuePair({tc, ID}, QVariant(id)); data << KeyValuePair({tc, ID}, QVariant(id));
data << KeyValuePair({tc, LANGUAGE_KEY}, QVariant(lang));
// Language compatibility hack for 4.2:
QString newLang; // QtC 4.3 and later
QString oldLang; // QtC 4.2
int langInt = lang.toInt(&ok);
Q_UNUSED(langInt);
if (lang == "2" || lang == "Cxx") {
newLang = "Cxx";
oldLang = "2";
} else if (lang == "1" || lang == "C") {
newLang = "C";
oldLang = "1";
} else if (ok) {
std::cerr << "Error: Language ID must be 1 for C, 2 for Cxx "
<< "or a string like (\"C\", \"Cxx\", \"Nim\", etc.)" << std::endl;
return {};
} else if (!ok) {
newLang = lang;
oldLang = "";
}
if (!oldLang.isEmpty())
data << KeyValuePair({tc, LANGUAGE_KEY}, QVariant(oldLang));
if (!newLang.isEmpty())
data << KeyValuePair({tc, LANGUAGE_KEY_V2}, QVariant(newLang));
data << KeyValuePair({tc, DISPLAYNAME}, QVariant(uniqueName)); data << KeyValuePair({tc, DISPLAYNAME}, QVariant(uniqueName));
data << KeyValuePair({tc, AUTODETECTED}, QVariant(true)); data << KeyValuePair({tc, AUTODETECTED}, QVariant(true));
data << KeyValuePair({tc, PATH}, QVariant(path)); data << KeyValuePair({tc, PATH}, QVariant(path));

View File

@@ -2723,7 +2723,8 @@ void tst_Dumpers::dumper_data()
+ Check("ob", "\"An Object\"", "@QWidget") + Check("ob", "\"An Object\"", "@QWidget")
+ Check("ob1", "\"Another Object\"", "@QObject") + Check("ob1", "\"Another Object\"", "@QObject")
+ Check("ob2", "\"A Subobject\"", "@QObject"); + Check("ob2", "\"A Subobject\"", "@QObject")
+ Check("ob.[extra].[connections].0.0.receiver", "\"Another Object\"", "@QObject");
QString senderData = QString senderData =