Commit 56233f67 authored by Eike Ziller's avatar Eike Ziller

Merge remote-tracking branch 'origin/4.3'

Change-Id: I01d7d8aa282f2bca94f85f55c832c76672e229f7
parents 73f210da e574860c
......@@ -6,9 +6,9 @@
isEmpty(VERSION): error("Include qtcreator.pri before including docs.pri!")
qtcver.name = QTC_VERSION
qtcver.value = $$VERSION
qtcver.value = $$QTCREATOR_DISPLAY_VERSION
qtcvertag.name = QTC_VERSION_TAG
qtcvertag.value = $$replace(qtcver.value, \.,)
qtcvertag.value = $$replace(VERSION, \.,)
qtdocs.name = QT_INSTALL_DOCS
qtdocs.value = $$[QT_INSTALL_DOCS/src]
qdocindex.name = QDOC_INDEX_DIR
......
......@@ -1304,6 +1304,17 @@ class DumperBase:
self.putFormattedPointerX(value)
self.ping('formattedPointer')
def putDerefedPointer(self, value):
derefValue = value.dereference()
innerType = value.type.target() #.unqualified()
self.putType(innerType)
savedCurrentChildType = self.currentChildType
self.currentChildType = innerType.name
derefValue.name = '*'
self.putItem(derefValue)
self.currentChildType = savedCurrentChildType
self.putOriginalAddress(value.pointer())
def putFormattedPointerX(self, value):
#warn("PUT FORMATTED: %s" % value)
pointer = value.pointer()
......@@ -1328,6 +1339,10 @@ class DumperBase:
self.putNumChild(0)
return
if self.currentIName.endswith('.this'):
self.putDerefedPointer(value)
return
displayFormat = self.currentItemFormat(value.type.name)
innerType = value.type.target() #.unqualified()
......@@ -1375,18 +1390,10 @@ class DumperBase:
#warn('AUTODEREF: %s' % self.autoDerefPointers)
#warn('INAME: %s' % self.currentIName)
#warn('INNER: %s' % innerType.name)
if self.autoDerefPointers or self.currentIName.endswith('.this'):
derefValue = value.dereference()
# Never dereference char types.
if self.autoDerefPointers:
# Generic pointer type with AutomaticFormat, but never dereference char types:
if innerType.name not in ('char', 'signed char', 'unsigned char', 'wchar_t'):
# Generic pointer type with AutomaticFormat.
self.putType(innerType)
savedCurrentChildType = self.currentChildType
self.currentChildType = innerType.name
derefValue.name = '*'
self.putItem(derefValue)
self.currentChildType = savedCurrentChildType
self.putOriginalAddress(pointer)
self.putDerefedPointer(value)
return
#warn('GENERIC PLAIN POINTER: %s' % value.type)
......
......@@ -264,7 +264,10 @@ class Dumper(DumperBase):
y = nativeValue.cast(chars.array(0, int(nativeType.sizeof - 1)))
buf = bytearray(struct.pack('x' * size))
for i in range(size):
buf[i] = int(y[i])
try:
buf[i] = int(y[i])
except:
pass
val.ldata = bytes(buf)
val.type = self.fromNativeType(nativeType)
......
This diff is collapsed.
......@@ -2,7 +2,7 @@ TEMPLATE = aux
include(../../../qtcreator.pri)
LANGUAGES = cs de fr ja pl ru sl uk zh_CN zh_TW
LANGUAGES = cs da de fr ja pl ru sl uk zh_CN zh_TW
# *don't* re-enable these without a prior rework
BAD_LANGUAGES = hu
......
......@@ -283,7 +283,7 @@ extern "C" HRESULT CALLBACK pid(CIDebugClient *client, PCSTR args)
int token;
commandTokens<StringList>(args, &token);
dprintf("Qt Creator CDB extension version 4.2 %d bit.\n",
dprintf("Qt Creator CDB extension version 4.3 %d bit.\n",
sizeof(void *) * 8);
if (const ULONG pid = currentProcessId(client))
ExtensionContext::instance().report('R', token, 0, "pid", "%u", pid);
......
......@@ -693,14 +693,14 @@ void Utils::setGlobPatternsForMimeType(const MimeType &mimeType, const QStringLi
{
auto d = MimeDatabasePrivate::instance();
QMutexLocker locker(&d->mutex);
return d->provider()->setGlobPatternsForMimeType(mimeType, patterns);
d->provider()->setGlobPatternsForMimeType(mimeType, patterns);
}
void Utils::setMagicRulesForMimeType(const MimeType &mimeType, const QMap<int, QList<MimeMagicRule> > &rules)
{
auto d = MimeDatabasePrivate::instance();
QMutexLocker locker(&d->mutex);
return d->provider()->setMagicRulesForMimeType(mimeType, rules);
d->provider()->setMagicRulesForMimeType(mimeType, rules);
}
void Utils::setMimeStartupPhase(MimeStartupPhase phase)
......
......@@ -145,7 +145,7 @@ void CMakeBuildConfiguration::ctor()
connect(m_buildDirManager.get(), &BuildDirManager::dataAvailable,
this, [this, project]() {
project->updateProjectData(this);
emit enabledChanged();
clearError();
emit dataAvailable();
});
connect(m_buildDirManager.get(), &BuildDirManager::errorOccured,
......@@ -153,7 +153,7 @@ void CMakeBuildConfiguration::ctor()
connect(m_buildDirManager.get(), &BuildDirManager::configurationStarted,
this, [this, project]() {
project->handleParsingStarted();
emit enabledChanged();
clearError(ForceEnabledChanged::True);
emit parsingStarted();
});
......@@ -176,6 +176,7 @@ bool CMakeBuildConfiguration::isParsing() const
void CMakeBuildConfiguration::resetData()
{
clearError();
m_buildDirManager->resetData();
}
......@@ -342,12 +343,14 @@ void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QList<ConfigMod
m_buildDirManager->forceReparse();
}
void CMakeBuildConfiguration::clearError()
void CMakeBuildConfiguration::clearError(ForceEnabledChanged fec)
{
if (!m_error.isEmpty()) {
m_error.clear();
emit enabledChanged();
fec = ForceEnabledChanged::True;
}
if (fec == ForceEnabledChanged::True)
emit enabledChanged();
}
void CMakeBuildConfiguration::emitBuildTypeChanged()
......
......@@ -109,10 +109,12 @@ protected:
private:
void ctor();
enum ForceEnabledChanged : quint8 { False, True };
void clearError(ForceEnabledChanged fec = ForceEnabledChanged::False);
QList<ConfigModel::DataItem> completeCMakeConfiguration() const;
void setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items);
void clearError();
void setError(const QString &message);
void setWarning(const QString &message);
......
......@@ -172,6 +172,13 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
emit addTask(Task::buildConfigurationMissingTask());
canInit = false;
}
if (!bc->isEnabled()) {
emit addTask(Task(Task::Error,
QCoreApplication::translate("CMakeProjectManager::CMakeBuildStep",
"The build configuration is currently disabled."),
Utils::FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
canInit = false;
}
CMakeTool *tool = CMakeKitInformation::cmakeTool(target()->kit());
if (!tool || !tool->isValid()) {
......@@ -185,7 +192,7 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
}
CMakeRunConfiguration *rc = targetsActiveRunConfiguration();
if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->title().isEmpty())) {
if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->buildSystemTarget().isEmpty())) {
emit addTask(Task(Task::Error,
QCoreApplication::translate("ProjectExplorer::Task",
"You asked to build the current Run Configuration's build target only, "
......@@ -232,7 +239,7 @@ void CMakeBuildStep::run(QFutureInterface<bool> &fi)
// Make sure CMake state was written to disk before trying to build:
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
if (!bc)
bc = qobject_cast<CMakeBuildConfiguration *>(target()->activeBuildConfiguration());
bc = targetsActiveBuildConfiguration();
QTC_ASSERT(bc, return);
bool mustDelay = false;
......@@ -348,7 +355,7 @@ QString CMakeBuildStep::allArguments(const CMakeRunConfiguration *rc) const
if (isCurrentExecutableTarget(m_buildTarget)) {
if (rc)
target = rc->title();
target = rc->buildSystemTarget();
else
target = QLatin1String("<i>&lt;") + tr(ADD_RUNCONFIGURATION_TEXT) + QLatin1String("&gt;</i>");
} else {
......
......@@ -40,6 +40,7 @@
#include <projectexplorer/taskhub.h>
#include <utils/algorithm.h>
#include <utils/asconst.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
......@@ -294,7 +295,7 @@ void ServerModeReader::generateProjectTree(CMakeProjectNode *root,
void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps)
{
int counter = 0;
foreach (const FileGroup *fg, m_fileGroups) {
for (const FileGroup *fg : Utils::asConst(m_fileGroups)) {
++counter;
const QString defineArg
= transform(fg->defines, [](const QString &s) -> QString {
......@@ -469,6 +470,8 @@ ServerModeReader::Target *ServerModeReader::extractTargetData(const QVariantMap
target->fileGroups.append(extractFileGroupData(fgData, srcDir, target));
}
fixTarget(target);
m_targets.append(target);
return target;
}
......@@ -547,6 +550,49 @@ void ServerModeReader::extractCacheData(const QVariantMap &data)
m_cmakeCache = config;
}
void ServerModeReader::fixTarget(ServerModeReader::Target *target) const
{
QHash<QString, const FileGroup *> languageFallbacks;
for (const FileGroup *group : Utils::asConst(target->fileGroups)) {
if (group->includePaths.isEmpty() && group->compileFlags.isEmpty()
&& group->defines.isEmpty())
continue;
const FileGroup *fallback = languageFallbacks.value(group->language);
if (!fallback || fallback->sources.count() < group->sources.count())
languageFallbacks.insert(group->language, group);
}
if (!languageFallbacks.value(""))
return; // No empty language groups found, no need to proceed.
const FileGroup *fallback = languageFallbacks.value("CXX");
if (!fallback)
fallback = languageFallbacks.value("C");
if (!fallback)
fallback = languageFallbacks.value("");
if (!fallback)
return;
for (auto it = target->fileGroups.begin(); it != target->fileGroups.end(); ++it) {
if (!(*it)->language.isEmpty())
continue;
(*it)->language = fallback->language.isEmpty() ? "CXX" : fallback->language;
if (*it == fallback
|| !(*it)->includePaths.isEmpty() || !(*it)->defines.isEmpty()
|| !(*it)->compileFlags.isEmpty())
continue;
for (const IncludePath *ip : fallback->includePaths)
(*it)->includePaths.append(new IncludePath(*ip));
(*it)->defines = fallback->defines;
(*it)->compileFlags = fallback->compileFlags;
}
}
QHash<Utils::FileName, ProjectNode *>
ServerModeReader::addCMakeLists(CMakeProjectNode *root, const QList<FileNode *> &cmakeLists)
{
......
......@@ -113,6 +113,8 @@ private:
void extractCMakeInputsData(const QVariantMap &data);
void extractCacheData(const QVariantMap &data);
void fixTarget(Target *target) const;
QHash<Utils::FileName, ProjectExplorer::ProjectNode *>
addCMakeLists(CMakeProjectNode *root, const QList<ProjectExplorer::FileNode *> &cmakeLists);
void addProjects(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
......
......@@ -1397,6 +1397,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
m_snapshotHandler = new SnapshotHandler;
m_snapshotView = new SnapshotTreeView(m_snapshotHandler);
m_snapshotView->setSettings(settings, "Debugger.SnapshotView");
m_snapshotView->setIconSize(QSize(10, 10));
m_snapshotView->setModel(m_snapshotHandler->model());
m_snapshotWindow = addSearch(m_snapshotView, tr("Snapshots"), DOCKWIDGET_SNAPSHOTS);
......
......@@ -3867,7 +3867,7 @@ void GdbEngine::startGdb(const QStringList &args)
QString msg;
QString wd = m_gdbProc.workingDirectory();
if (!QFileInfo(wd).isDir())
msg = failedToStartMessage() + ' ' + tr("The working directory \"%s\" is not usable.").arg(wd);
msg = failedToStartMessage() + ' ' + tr("The working directory \"%1\" is not usable.").arg(wd);
else
msg = errorMessage(QProcess::FailedToStart);
handleAdapterStartFailed(msg);
......
......@@ -158,7 +158,7 @@ void AbstractProcessStep::setIgnoreReturnValue(bool b)
bool AbstractProcessStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
return true;
return !m_process;
}
/*!
......@@ -205,6 +205,7 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi)
if (!m_process->waitForStarted()) {
processStartupFailed();
m_process.reset();
m_outputParserChain.reset();
reportRunResult(fi, false);
return;
}
......
......@@ -555,13 +555,19 @@ QStringList Project::files(Project::FilesMode fileMode,
if (!rootProjectNode())
return result;
QSet<QString> alreadySeen;
rootProjectNode()->forEachNode([&](const FileNode *fn) {
if (filter && !filter(fn))
return;
const QString path = fn->filePath().toString();
const int count = alreadySeen.count();
alreadySeen.insert(path);
if (count == alreadySeen.count())
return; // skip duplicates
if ((fileMode == AllFiles)
|| (fileMode == SourceFiles && !fn->isGenerated())
|| (fileMode == GeneratedFiles && fn->isGenerated()))
result.append(fn->filePath().toString());
result.append(path);
});
return result;
}
......
......@@ -82,6 +82,7 @@ FlatModel::FlatModel(QObject *parent)
connect(sm, &SessionManager::aboutToSaveSession, this, &FlatModel::saveExpandData);
connect(sm, &SessionManager::projectAdded, this, &FlatModel::handleProjectAdded);
connect(sm, &SessionManager::startupProjectChanged, this, [this] { layoutChanged(); });
rebuildModel();
}
QVariant FlatModel::data(const QModelIndex &index, int role) const
......@@ -104,10 +105,15 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
break;
}
case Qt::DecorationRole: {
if (folderNode)
if (folderNode) {
result = folderNode->icon();
else
if (ContainerNode *containerNode = folderNode->asContainerNode()) {
if (ProjectNode *projectNode = containerNode->rootProjectNode())
result = projectNode->icon();
}
} else {
result = Core::FileIconProvider::icon(node->filePath().toString());
}
break;
}
case Qt::FontRole: {
......
......@@ -987,6 +987,12 @@ void addTabBarToStackedContainer(const SelectionContext &selectionContext)
const int maxValue = container.directSubModelNodes().count();
QmlItemNode tabBarItem(tabBarNode);
tabBarItem.anchors().setAnchor(AnchorLineLeft, containerItemNode, AnchorLineLeft);
tabBarItem.anchors().setAnchor(AnchorLineRight, containerItemNode, AnchorLineRight);
tabBarItem.anchors().setAnchor(AnchorLineBottom, containerItemNode, AnchorLineTop);
for (int i = 0; i < maxValue; ++i) {
ModelNode tabButtonNode =
view->createModelNode("QtQuick.Controls.TabButton",
......@@ -997,12 +1003,6 @@ void addTabBarToStackedContainer(const SelectionContext &selectionContext)
tabBarNode.defaultNodeListProperty().reparentHere(tabButtonNode);
}
QmlItemNode tabBarItem(tabBarNode);
tabBarItem.anchors().setAnchor(AnchorLineLeft, containerItemNode, AnchorLineLeft);
tabBarItem.anchors().setAnchor(AnchorLineRight, containerItemNode, AnchorLineRight);
tabBarItem.anchors().setAnchor(AnchorLineBottom, containerItemNode, AnchorLineTop);
const QString id = tabBarNode.validId();
container.removeProperty(indexPropertyName);
......
......@@ -43,6 +43,7 @@
#include <QTime>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
namespace QmlDesigner {
......@@ -85,7 +86,7 @@ void FormEditorScene::resetScene()
FormEditorItem* FormEditorScene::itemForQmlItemNode(const QmlItemNode &qmlItemNode) const
{
Q_ASSERT(qmlItemNode.isValid());
QTC_ASSERT(qmlItemNode.isValid(), return 0);
return m_qmlItemNodeItemHash.value(qmlItemNode);
}
......
......@@ -27,6 +27,7 @@
#include "itemlibrarywidget.h"
#include <import.h>
#include <importmanagerview.h>
#include <rewriterview.h>
namespace QmlDesigner {
......@@ -69,6 +70,7 @@ void ItemLibraryView::modelAttached(Model *model)
m_widget->setModel(model);
updateImports();
model->attachView(m_importManagerView);
m_hasErrors = !rewriterView()->errors().isEmpty();
}
void ItemLibraryView::modelAboutToBeDetached(Model *model)
......@@ -93,6 +95,15 @@ void ItemLibraryView::setResourcePath(const QString &resourcePath)
m_widget->setResourcePath(resourcePath);
}
void ItemLibraryView::documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &)
{
if (m_hasErrors && errors.isEmpty())
/* For some reason we have to call update from the event loop */
QTimer::singleShot(0, m_widget, &ItemLibraryWidget::updateModel);
m_hasErrors = !errors.isEmpty();
}
void ItemLibraryView::updateImports()
{
m_widget->updateModel();
......
......@@ -50,6 +50,7 @@ public:
void modelAttached(Model *model) override;
void modelAboutToBeDetached(Model *model) override;
void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports) override;
void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override;
void setResourcePath(const QString &resourcePath);
......@@ -59,6 +60,7 @@ protected:
private:
QPointer<ItemLibraryWidget> m_widget;
ImportManagerView *m_importManagerView;
bool m_hasErrors = false;
};
}
......@@ -177,7 +177,7 @@ bool TextEditorWidget::eventFilter( QObject *, QEvent *event)
{
static std::vector<int> overrideKeys = { Qt::Key_Delete, Qt::Key_Backspace, Qt::Key_Left,
Qt::Key_Right, Qt::Key_Up, Qt::Key_Down, Qt::Key_Insert,
Qt::Key_Escape, Qt::Key_Home, Qt::Key_End };
Qt::Key_Escape };
static std::vector<QKeySequence> overrideSequences = { QKeySequence::SelectAll, QKeySequence::Cut,
QKeySequence::Copy, QKeySequence::Delete,
......
......@@ -575,10 +575,10 @@ private:
void initialiseProperties();
TypeName m_qualfiedTypeName;
int m_majorVersion;
int m_minorVersion;
bool m_isValid;
bool m_isFileComponent;
int m_majorVersion = -1;
int m_minorVersion = -1;
bool m_isValid = false;
bool m_isFileComponent = false;
PropertyNameList m_properties;
PropertyNameList m_signals;
QList<TypeName> m_propertyTypes;
......@@ -673,10 +673,11 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate() : m_isValid(false)
}
NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, int min) :
m_qualfiedTypeName(type), m_majorVersion(maj),
m_minorVersion(min), m_isValid(false), m_isFileComponent(false),
m_model(model)
NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, int min)
: m_qualfiedTypeName(type)
, m_majorVersion(maj)
, m_minorVersion(min)
, m_model(model)
{
if (context()) {
const CppComponentValue *cppObjectValue = getCppComponentValue();
......@@ -1003,7 +1004,7 @@ static QByteArray getPackage(const QByteArray &name)
bool NodeMetaInfoPrivate::cleverCheckType(const TypeName &otherType) const
{
if (otherType == qualfiedTypeName())
return true;
return true;
if (isFileComponent())
return false;
......@@ -1177,8 +1178,8 @@ QString NodeMetaInfoPrivate::lookupName() const
QStringList NodeMetaInfoPrivate::lookupNameComponent() const
{
QString tempString = fullQualifiedImportAliasType();
return tempString.split('.');
QString tempString = fullQualifiedImportAliasType();
return tempString.split('.');
}
......@@ -1415,7 +1416,6 @@ QStringList NodeMetaInfo::propertyKeysForEnum(const PropertyName &propertyName)
QVariant NodeMetaInfo::propertyCastedValue(const PropertyName &propertyName, const QVariant &value) const
{
const QVariant variant = value;
QVariant copyVariant = variant;
if (propertyIsEnumType(propertyName)
......@@ -1489,10 +1489,12 @@ TypeName NodeMetaInfo::typeName() const
{
return m_privateData->qualfiedTypeName();
}
int NodeMetaInfo::majorVersion() const
{
return m_privateData->majorVersion();
}
int NodeMetaInfo::minorVersion() const
{
return m_privateData->minorVersion();
......@@ -1537,8 +1539,7 @@ bool NodeMetaInfo::isSubclassOf(const TypeName &type, int majorVersion, int mino
if (typeName().isEmpty())
return false;
if (typeName() == type
&& availableInVersion(majorVersion, minorVersion))
if (typeName() == type && availableInVersion(majorVersion, minorVersion))
return true;
if (m_privateData->prototypeCachePositives().contains(Internal::stringIdentifier(type, majorVersion, minorVersion)))
......@@ -1549,8 +1550,8 @@ bool NodeMetaInfo::isSubclassOf(const TypeName &type, int majorVersion, int mino
foreach (const NodeMetaInfo &superClass, superClasses()) {
if (superClass.m_privateData->cleverCheckType(type)
&& superClass.availableInVersion(majorVersion, minorVersion)) {
m_privateData->prototypeCachePositives().insert(Internal::stringIdentifier(type, majorVersion, minorVersion));
&& superClass.availableInVersion(majorVersion, minorVersion)) {
m_privateData->prototypeCachePositives().insert(Internal::stringIdentifier(type, majorVersion, minorVersion));
return true;
}
}
......
......@@ -357,6 +357,7 @@ void QmlProject::generateProjectTree()
fileType = FileType::Project;
newRoot->addNestedNode(new FileNode(Utils::FileName::fromString(f), fileType, false));
}
newRoot->addNestedNode(new FileNode(projectFilePath(), FileType::Project, false));
setRootProjectNode(newRoot);
}
......
......@@ -596,6 +596,8 @@ BookmarkModel* BookmarkManager::listBookmarkModel() const
void BookmarkManager::saveBookmarks()
{
if (!m_isModelSetup)
return;
QByteArray bookmarks;
QDataStream stream(&bookmarks, QIODevice::WriteOnly);
......@@ -708,6 +710,7 @@ void BookmarkManager::itemChanged(QStandardItem *item)
void BookmarkManager::setupBookmarkModels()
{
m_isModelSetup = true;
treeModel->clear();
listModel->clear();
......
......@@ -176,4 +176,5 @@ private:
BookmarkModel *treeModel;
BookmarkModel *listModel;
QStandardItem *renameItem;
bool m_isModelSetup = false;
};
Subproject commit cc99f7de4e1578feb1ca8e5a2ca7384b25b6d427
Subproject commit 96f182fd975c7fe90f4e54de887d04b633c85383
......@@ -1282,7 +1282,8 @@ void tst_Dumpers::dumper()
"\n\n#if defined(_MSC_VER)" + (data.useQt ?
"\n#include <qt_windows.h>" :