diff options
author | Eike Ziller <[email protected]> | 2019-10-02 07:32:57 +0200 |
---|---|---|
committer | Eike Ziller <[email protected]> | 2019-10-02 07:32:57 +0200 |
commit | ac014e38759286725d671c0f0f8bef02bb0c8b9b (patch) | |
tree | 766d62e3b2a0926ec9ae0789567b00bfcb00e98f /src | |
parent | 93e725c17cda7ee3b9218a6da9f704464e917711 (diff) | |
parent | 312ff692b02d6b19f39303591c7dc0156bf46661 (diff) |
Merge remote-tracking branch 'origin/4.10' into 4.11
Conflicts:
src/plugins/projectexplorer/projectnodes.h
Change-Id: I10a749cca38c2d0929cf4d2b74ab089e14b6157b
Diffstat (limited to 'src')
-rw-r--r-- | src/app/main.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp | 2 | ||||
-rw-r--r-- | src/plugins/coreplugin/outputwindow.cpp | 5 | ||||
-rw-r--r-- | src/plugins/debugger/watchhandler.cpp | 23 | ||||
-rw-r--r-- | src/plugins/designer/resourcehandler.cpp | 33 | ||||
-rw-r--r-- | src/plugins/projectexplorer/projectnodes.h | 9 | ||||
-rw-r--r-- | src/plugins/qbsprojectmanager/qbsnodes.cpp | 9 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakenodes.cpp | 9 |
8 files changed, 65 insertions, 27 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp index 359bb673b58..c7b5aff49c3 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -523,6 +523,8 @@ int main(int argc, char **argv) } } + app.setDesktopFileName("org.qt-project.qtcreator.desktop"); + // Make sure we honor the system's proxy settings QNetworkProxyFactory::setUseSystemConfiguration(true); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp index aeee344aeae..6c29cf53fd1 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp @@ -174,7 +174,7 @@ CMakeTargetNode::CMakeTargetNode(const Utils::FilePath &directory, const QString setPriority(Node::DefaultProjectPriority + 900); setIcon(QIcon(":/projectexplorer/images/build.png")); // TODO: Use proper icon! setListInProject(false); - setIsProduct(); + setProductType(ProductType::Other); } QString CMakeTargetNode::tooltip() const diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index 6c33b8dafe2..f920ffc3891 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -117,7 +117,10 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget connect(copyAction, &QAction::triggered, this, &QPlainTextEdit::copy); connect(pasteAction, &QAction::triggered, this, &QPlainTextEdit::paste); connect(selectAllAction, &QAction::triggered, this, &QPlainTextEdit::selectAll); - connect(this, &QPlainTextEdit::blockCountChanged, this, &OutputWindow::filterNewContent); + connect(this, &QPlainTextEdit::blockCountChanged, this, [this] { + if (!d->filterText.isEmpty()) + filterNewContent(); + }); connect(this, &QPlainTextEdit::undoAvailable, undoAction, &QAction::setEnabled); connect(this, &QPlainTextEdit::redoAvailable, redoAction, &QAction::setEnabled); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 66dc416f1ba..8201e13a71e 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -2288,15 +2288,20 @@ void WatchModel::showEditValue(const WatchItem *item) QTC_ASSERT(0 < nbytes && nbytes < 10000 * 10000, return); QTC_ASSERT(0 < imformat && imformat < 32, return); QImage im(width, height, QImage::Format(imformat)); - std::memcpy(im.bits(), bits, nbytes); - auto v = m_separatedView->prepareObject<ImageViewer>(item); - v->setInfo(item->address ? - tr("%1 Object at %2").arg(item->type, item->hexAddress()) : - tr("%1 Object at Unknown Address").arg(item->type) + " " + - ImageViewer::tr("Size: %1x%2, %3 byte, format: %4, depth: %5") - .arg(width).arg(height).arg(nbytes).arg(im.format()).arg(im.depth()) - ); - v->setImage(im); + const qsizetype size = im.sizeInBytes(); + // If our computation of image size doesn't fit the client's + // chances are that we can't properly display it either. + if (size == nbytes) { + std::memcpy(im.bits(), bits, nbytes); + auto v = m_separatedView->prepareObject<ImageViewer>(item); + v->setInfo(item->address ? + tr("%1 Object at %2").arg(item->type, item->hexAddress()) : + tr("%1 Object at Unknown Address").arg(item->type) + " " + + ImageViewer::tr("Size: %1x%2, %3 byte, format: %4, depth: %5") + .arg(width).arg(height).arg(nbytes).arg(im.format()).arg(im.depth()) + ); + v->setImage(im); + } } else if (format == DisplayLatin1String || format == DisplayUtf8String || format == DisplayUtf16String diff --git a/src/plugins/designer/resourcehandler.cpp b/src/plugins/designer/resourcehandler.cpp index a86bf217927..392b632a8f8 100644 --- a/src/plugins/designer/resourcehandler.cpp +++ b/src/plugins/designer/resourcehandler.cpp @@ -103,26 +103,37 @@ void ResourceHandler::updateResourcesHelper(bool updateProjectResources) // Find the (sub-)project the file belongs to. We don't want to find resources // from other parts of the project tree, e.g. via a qmake subdirs project. - ProjectNode *projectNode = project->rootProjectNode(); - Node * const fileNode = projectNode->findNode([&fileName](const Node *n) { + Node * const fileNode = project->rootProjectNode()->findNode([&fileName](const Node *n) { return n->filePath().toString() == fileName; }); + ProjectNode *projectNodeForUiFile = nullptr; if (fileNode) { // We do not want qbs groups or qmake .pri files here, as they contain only a subset // of the relevant files. - projectNode = fileNode->parentProjectNode(); - while (projectNode && !projectNode->isProduct()) - projectNode = projectNode->parentProjectNode(); + projectNodeForUiFile = fileNode->parentProjectNode(); + while (projectNodeForUiFile && !projectNodeForUiFile->isProduct()) + projectNodeForUiFile = projectNodeForUiFile->parentProjectNode(); } - if (!projectNode) - projectNode = project->rootProjectNode(); + if (!projectNodeForUiFile) + projectNodeForUiFile = project->rootProjectNode(); + + const auto useQrcFile = [projectNodeForUiFile, project](const Node *qrcNode) { + if (projectNodeForUiFile == project->rootProjectNode()) + return true; + ProjectNode *projectNodeForQrcFile = qrcNode->parentProjectNode(); + while (projectNodeForQrcFile && !projectNodeForQrcFile->isProduct()) + projectNodeForQrcFile = projectNodeForQrcFile->parentProjectNode(); + return !projectNodeForQrcFile + || projectNodeForQrcFile == projectNodeForUiFile + || projectNodeForQrcFile->productType() != ProductType::App; + }; QStringList projectQrcFiles; - projectNode->forEachNode([&](FileNode *node) { - if (node->fileType() == FileType::Resource) + project->rootProjectNode()->forEachNode([&](FileNode *node) { + if (node->fileType() == FileType::Resource && useQrcFile(node)) projectQrcFiles.append(node->filePath().toString()); }, [&](FolderNode *node) { - if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(node)) + if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(node) && useQrcFile(node)) projectQrcFiles.append(node->filePath().toString()); }); // Check if the user has chosen to update the lacking resource inside designer @@ -134,7 +145,7 @@ void ResourceHandler::updateResourcesHelper(bool updateProjectResources) } if (!qrcPathsToBeAdded.isEmpty()) { m_handlingResources = true; - projectNode->addFiles(qrcPathsToBeAdded); + projectNodeForUiFile->addFiles(qrcPathsToBeAdded); m_handlingResources = false; projectQrcFiles += qrcPathsToBeAdded; } diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h index 0bea9c38102..68e11a178de 100644 --- a/src/plugins/projectexplorer/projectnodes.h +++ b/src/plugins/projectexplorer/projectnodes.h @@ -57,6 +57,8 @@ enum class FileType : quint16 { FileTypeSize }; +enum class ProductType { App, Lib, Other, None }; + enum ProjectAction { // Special value to indicate that the actions are handled by the parent InheritedFromParent, @@ -379,7 +381,8 @@ public: virtual QVariant data(Core::Id role) const; virtual bool setData(Core::Id role, const QVariant &value) const; - bool isProduct() const { return m_isProduct; } + bool isProduct() const { return m_productType != ProductType::None; } + ProductType productType() const { return m_productType; } // TODO: Currently used only for "Build for current run config" functionality, but we should // probably use it to centralize the node-specific "Build" functionality that @@ -391,13 +394,13 @@ public: void setFallbackData(Core::Id key, const QVariant &value); protected: - void setIsProduct() { m_isProduct = true; } + void setProductType(ProductType type) { m_productType = type; } QString m_target; private: - bool m_isProduct = false; QHash<Core::Id, QVariant> m_fallbackData; // Used in data(), unless overridden. + ProductType m_productType = ProductType::None; }; class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode diff --git a/src/plugins/qbsprojectmanager/qbsnodes.cpp b/src/plugins/qbsprojectmanager/qbsnodes.cpp index 719897ec78a..4a7f5fa5418 100644 --- a/src/plugins/qbsprojectmanager/qbsnodes.cpp +++ b/src/plugins/qbsprojectmanager/qbsnodes.cpp @@ -328,7 +328,14 @@ QbsProductNode::QbsProductNode(const qbs::ProductData &prd) : { static QIcon productIcon = Core::FileIconProvider::directoryIcon(Constants::QBS_PRODUCT_OVERLAY_ICON); setIcon(productIcon); - setIsProduct(); + if (m_qbsProductData.isRunnable()) { + setProductType(ProductType::App); + } else if (m_qbsProductData.type().contains("dynamiclibrary") + || m_qbsProductData.type().contains("staticlibrary")) { + setProductType(ProductType::Lib); + } else { + setProductType(ProductType::Other); + } } bool QbsProductNode::supportsAction(ProjectAction action, const Node *node) const diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index a51c09f0ac2..c2a15c9eaf9 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -257,7 +257,14 @@ FolderNode::AddNewInformation QmakePriFileNode::addNewInformation(const QStringL QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FilePath &filePath, QmakeProFile *pf) : QmakePriFileNode(project, this, filePath, pf) { - setIsProduct(); + if (projectType() == ProjectType::ApplicationTemplate) { + setProductType(ProductType::App); + } else if (projectType() == ProjectType::SharedLibraryTemplate + || projectType() == ProjectType::StaticLibraryTemplate) { + setProductType(ProductType::Lib); + } else if (projectType() != ProjectType::SubDirsTemplate) { + setProductType(ProductType::Other); + } } bool QmakeProFileNode::showInSimpleTree() const |