summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-08-15 13:53:28 +0200
committerEike Ziller <eike.ziller@qt.io>2018-08-15 13:53:28 +0200
commitdb9837fa6c9401e898ac8e7492081a6e21c71790 (patch)
treed542a089711257402ac4fe70813fa0e7de825f2e /src/plugins
parent7bc14bf3498ea6b1c19abacf85a5103772da26bc (diff)
parent58747b2de107e8f6ac00daeb431ecbf3e603fd34 (diff)
downloadqt-creator-db9837fa6c9401e898ac8e7492081a6e21c71790.tar.gz
Merge remote-tracking branch 'origin/4.7'
Conflicts: src/plugins/clangtools/clangtoolruncontrol.cpp src/plugins/cpptools/compileroptionsbuilder.cpp Change-Id: Ib1e8abf066898b50c90fc1ccba4697fe983e8a8f
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/autotest/gtest/gtesttreeitem.cpp7
-rw-r--r--src/plugins/autotest/gtest/gtesttreeitem.h1
-rw-r--r--src/plugins/autotest/qtest/qttesttreeitem.cpp5
-rw-r--r--src/plugins/autotest/qtest/qttesttreeitem.h1
-rw-r--r--src/plugins/autotest/quick/quicktesttreeitem.cpp10
-rw-r--r--src/plugins/autotest/quick/quicktesttreeitem.h1
-rw-r--r--src/plugins/autotest/testtreeitem.cpp5
-rw-r--r--src/plugins/autotest/testtreeitem.h1
-rw-r--r--src/plugins/autotest/testtreemodel.cpp4
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp2
-rw-r--r--src/plugins/projectexplorer/foldernavigationwidget.cpp12
-rw-r--r--src/plugins/projectexplorer/foldernavigationwidget.h1
-rw-r--r--src/plugins/projectexplorer/msvctoolchain.cpp17
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.cpp26
-rw-r--r--src/plugins/texteditor/generichighlighter/highlighter.cpp44
-rw-r--r--src/plugins/texteditor/texteditor.cpp3
-rw-r--r--src/plugins/valgrind/memchecktool.cpp3
17 files changed, 115 insertions, 28 deletions
diff --git a/src/plugins/autotest/gtest/gtesttreeitem.cpp b/src/plugins/autotest/gtest/gtesttreeitem.cpp
index 0039b3868b..335979131a 100644
--- a/src/plugins/autotest/gtest/gtesttreeitem.cpp
+++ b/src/plugins/autotest/gtest/gtesttreeitem.cpp
@@ -403,8 +403,6 @@ bool GTestTreeItem::modify(const TestParseResult *result)
TestTreeItem *GTestTreeItem::createParentGroupNode() const
{
- if (type() != TestCase)
- return nullptr;
if (GTestFramework::groupMode() == GTest::Constants::Directory) {
const QFileInfo fileInfo(filePath());
const QFileInfo base(fileInfo.absolutePath());
@@ -511,6 +509,11 @@ bool GTestTreeItem::isGroupNodeFor(const TestTreeItem *other) const
}
}
+bool GTestTreeItem::isGroupable() const
+{
+ return type() == TestCase;
+}
+
TestTreeItem *GTestTreeItem::applyFilters()
{
if (type() != TestCase)
diff --git a/src/plugins/autotest/gtest/gtesttreeitem.h b/src/plugins/autotest/gtest/gtesttreeitem.h
index 22225ae7f5..8f1300007f 100644
--- a/src/plugins/autotest/gtest/gtesttreeitem.h
+++ b/src/plugins/autotest/gtest/gtesttreeitem.h
@@ -72,6 +72,7 @@ public:
QString nameSuffix() const;
QSet<QString> internalTargets() const override;
bool isGroupNodeFor(const TestTreeItem *other) const override;
+ bool isGroupable() const override;
TestTreeItem *applyFilters() override;
private:
bool modifyTestSetContent(const GTestParseResult *result);
diff --git a/src/plugins/autotest/qtest/qttesttreeitem.cpp b/src/plugins/autotest/qtest/qttesttreeitem.cpp
index 0657727b75..3fe96b6f39 100644
--- a/src/plugins/autotest/qtest/qttesttreeitem.cpp
+++ b/src/plugins/autotest/qtest/qttesttreeitem.cpp
@@ -345,6 +345,11 @@ TestTreeItem *QtTestTreeItem::createParentGroupNode() const
return new QtTestTreeItem(base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
}
+bool QtTestTreeItem::isGroupable() const
+{
+ return type() == TestCase;
+}
+
TestTreeItem *QtTestTreeItem::findChildByNameAndInheritance(const QString &name, bool inherited) const
{
return findFirstLevelChild([name, inherited](const TestTreeItem *other) {
diff --git a/src/plugins/autotest/qtest/qttesttreeitem.h b/src/plugins/autotest/qtest/qttesttreeitem.h
index 2de8eb8f82..3c7f9c4bd7 100644
--- a/src/plugins/autotest/qtest/qttesttreeitem.h
+++ b/src/plugins/autotest/qtest/qttesttreeitem.h
@@ -52,6 +52,7 @@ public:
void setInherited(bool inherited) { m_inherited = inherited; }
bool inherited() const { return m_inherited; }
TestTreeItem *createParentGroupNode() const override;
+ bool isGroupable() const override;
private:
TestTreeItem *findChildByNameAndInheritance(const QString &name, bool inherited) const;
QString nameSuffix() const;
diff --git a/src/plugins/autotest/quick/quicktesttreeitem.cpp b/src/plugins/autotest/quick/quicktesttreeitem.cpp
index 682caecf68..6bc57a0e38 100644
--- a/src/plugins/autotest/quick/quicktesttreeitem.cpp
+++ b/src/plugins/autotest/quick/quicktesttreeitem.cpp
@@ -401,16 +401,16 @@ bool QuickTestTreeItem::removeOnSweepIfEmpty() const
TestTreeItem *QuickTestTreeItem::createParentGroupNode() const
{
- if (filePath().isEmpty() || name().isEmpty())
- return nullptr;
- if (type() == TestFunctionOrSet)
- return nullptr;
-
const QFileInfo fileInfo(filePath());
const QFileInfo base(fileInfo.absolutePath());
return new QuickTestTreeItem(base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
}
+bool QuickTestTreeItem::isGroupable() const
+{
+ return type() == TestCase && !name().isEmpty() && !filePath().isEmpty();
+}
+
QSet<QString> QuickTestTreeItem::internalTargets() const
{
QSet<QString> result;
diff --git a/src/plugins/autotest/quick/quicktesttreeitem.h b/src/plugins/autotest/quick/quicktesttreeitem.h
index 97c287f38f..b1d49065f3 100644
--- a/src/plugins/autotest/quick/quicktesttreeitem.h
+++ b/src/plugins/autotest/quick/quicktesttreeitem.h
@@ -53,6 +53,7 @@ public:
bool isGroupNodeFor(const TestTreeItem *other) const override;
bool removeOnSweepIfEmpty() const override;
TestTreeItem *createParentGroupNode() const override;
+ bool isGroupable() const override;
QSet<QString> internalTargets() const override;
void markForRemovalRecursively(const QString &filePath) override;
private:
diff --git a/src/plugins/autotest/testtreeitem.cpp b/src/plugins/autotest/testtreeitem.cpp
index 39dfe5b65d..e1c1debe9c 100644
--- a/src/plugins/autotest/testtreeitem.cpp
+++ b/src/plugins/autotest/testtreeitem.cpp
@@ -297,6 +297,11 @@ bool TestTreeItem::isGroupNodeFor(const TestTreeItem *other) const
return QFileInfo(other->filePath()).absolutePath() == filePath();
}
+bool TestTreeItem::isGroupable() const
+{
+ return true;
+}
+
QSet<QString> TestTreeItem::internalTargets() const
{
auto cppMM = CppTools::CppModelManager::instance();
diff --git a/src/plugins/autotest/testtreeitem.h b/src/plugins/autotest/testtreeitem.h
index e2a9062e30..74e6c98d8f 100644
--- a/src/plugins/autotest/testtreeitem.h
+++ b/src/plugins/autotest/testtreeitem.h
@@ -121,6 +121,7 @@ public:
virtual TestTreeItem *findChild(const TestTreeItem *other) = 0;
virtual bool modify(const TestParseResult *result) = 0;
virtual bool isGroupNodeFor(const TestTreeItem *other) const;
+ virtual bool isGroupable() const;
virtual TestTreeItem *createParentGroupNode() const = 0;
// based on (internal) filters this will be used to filter out sub items (and remove them)
// returns a copy of the item that contains the filtered out children or nullptr
diff --git a/src/plugins/autotest/testtreemodel.cpp b/src/plugins/autotest/testtreemodel.cpp
index b5b2c845fc..7e4e577812 100644
--- a/src/plugins/autotest/testtreemodel.cpp
+++ b/src/plugins/autotest/testtreemodel.cpp
@@ -346,13 +346,13 @@ static void applyParentCheckState(TestTreeItem *parent, TestTreeItem *newItem)
void TestTreeModel::insertItemInParent(TestTreeItem *item, TestTreeItem *root, bool groupingEnabled)
{
TestTreeItem *parentNode = root;
- if (groupingEnabled) {
+ if (groupingEnabled && item->isGroupable()) {
parentNode = root->findFirstLevelChild([item] (const TestTreeItem *it) {
return it->isGroupNodeFor(item);
});
if (!parentNode) {
parentNode = item->createParentGroupNode();
- if (!parentNode) // we might not get a group node at all
+ if (!QTC_GUARD(parentNode)) // we might not get a group node at all
parentNode = root;
else
root->appendChild(parentNode);
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 5ff1a89812..3c94e2339b 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1188,7 +1188,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
kit = KitManager::kit(Utils::equal(&Kit::displayName, val));
} else if (key == "server") {
startMode = AttachToRemoteServer;
- remoteChannel = remoteChannel;
+ remoteChannel = val;
} else if (key == "core") {
startMode = AttachCore;
coreFile = val;
diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp
index cc838a143b..07ff03be6a 100644
--- a/src/plugins/projectexplorer/foldernavigationwidget.cpp
+++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp
@@ -295,6 +295,7 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
m_toggleSync(new QToolButton(this)),
m_toggleRootSync(new QToolButton(this)),
m_rootSelector(new QComboBox),
+ m_crumbContainer(new QWidget(this)),
m_crumbLabel(new DelayedFileCrumbLabel(this))
{
m_context = new Core::IContext(this);
@@ -337,16 +338,21 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
selectorLayout->setContentsMargins(0, 0, 0, 0);
selectorLayout->addWidget(m_rootSelector, 10);
+ auto crumbContainerLayout = new QVBoxLayout;
+ crumbContainerLayout->setSpacing(0);
+ crumbContainerLayout->setContentsMargins(0, 0, 0, 0);
+ m_crumbContainer->setLayout(crumbContainerLayout);
auto crumbLayout = new QVBoxLayout;
crumbLayout->setSpacing(0);
crumbLayout->setContentsMargins(4, 4, 4, 4);
crumbLayout->addWidget(m_crumbLabel);
+ crumbContainerLayout->addLayout(crumbLayout);
+ crumbContainerLayout->addWidget(createHLine());
m_crumbLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
auto layout = new QVBoxLayout();
layout->addWidget(selectorWidget);
- layout->addLayout(crumbLayout);
- layout->addWidget(createHLine());
+ layout->addWidget(m_crumbContainer);
layout->addWidget(m_listView);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
@@ -432,7 +438,7 @@ void FolderNavigationWidget::toggleAutoSynchronization()
void FolderNavigationWidget::setShowBreadCrumbs(bool show)
{
m_showBreadCrumbsAction->setChecked(show);
- m_crumbLabel->setVisible(show);
+ m_crumbContainer->setVisible(show);
}
void FolderNavigationWidget::setShowFoldersOnTop(bool onTop)
diff --git a/src/plugins/projectexplorer/foldernavigationwidget.h b/src/plugins/projectexplorer/foldernavigationwidget.h
index 1e55bbe83a..8f428863eb 100644
--- a/src/plugins/projectexplorer/foldernavigationwidget.h
+++ b/src/plugins/projectexplorer/foldernavigationwidget.h
@@ -145,6 +145,7 @@ private:
QToolButton *m_toggleSync = nullptr;
QToolButton *m_toggleRootSync = nullptr;
QComboBox *m_rootSelector = nullptr;
+ QWidget *m_crumbContainer = nullptr;
DelayedFileCrumbLabel *m_crumbLabel = nullptr;
// FolderNavigationWidgetFactory needs private members to build a menu
diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp
index 95b6bcbdaf..9a68a59689 100644
--- a/src/plugins/projectexplorer/msvctoolchain.cpp
+++ b/src/plugins/projectexplorer/msvctoolchain.cpp
@@ -26,6 +26,7 @@
#include "msvctoolchain.h"
#include "msvcparser.h"
+#include "projectexplorer.h"
#include "projectexplorerconstants.h"
#include "taskhub.h"
#include "toolchainmanager.h"
@@ -68,6 +69,16 @@ namespace Internal {
// Helpers:
// --------------------------------------------------------------------------
+static QThreadPool *envModThreadPool()
+{
+ static QThreadPool *pool = nullptr;
+ if (!pool) {
+ pool = new QThreadPool(ProjectExplorerPlugin::instance());
+ pool->setMaxThreadCount(1);
+ }
+ return pool;
+}
+
struct MsvcPlatform {
MsvcToolChain::Platform platform;
const char *name;
@@ -652,7 +663,8 @@ MsvcToolChain::MsvcToolChain(Core::Id typeId, const QString &name, const Abi &ab
: AbstractMsvcToolChain(typeId, l, d, abi, varsBat)
, m_varsBatArg(varsBatArg)
{
- initEnvModWatcher(Utils::runAsync(&MsvcToolChain::environmentModifications,
+ initEnvModWatcher(Utils::runAsync(envModThreadPool(),
+ &MsvcToolChain::environmentModifications,
varsBat, varsBatArg));
Q_ASSERT(!name.isEmpty());
@@ -744,7 +756,8 @@ bool MsvcToolChain::fromMap(const QVariantMap &data)
m_environmentModifications = Utils::EnvironmentItem::itemsFromVariantList(
data.value(QLatin1String(environModsKeyC)).toList());
- initEnvModWatcher(Utils::runAsync(&MsvcToolChain::environmentModifications,
+ initEnvModWatcher(Utils::runAsync(envModThreadPool(),
+ &MsvcToolChain::environmentModifications,
m_vcvarsBat, m_varsBatArg));
return !m_vcvarsBat.isEmpty() && m_abi.isValid();
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp
index 5740483c27..22fcfc9dfa 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.cpp
+++ b/src/plugins/qbsprojectmanager/qbsproject.cpp
@@ -822,13 +822,15 @@ static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags,
}
cFlags = cxxFlags = commonFlags;
- const QString cxxLanguageVersion = getCppProp("cxxLanguageVersion").toString();
- if (cxxLanguageVersion == "c++11")
- cxxFlags << "-std=c++0x";
- else if (cxxLanguageVersion == "c++14")
- cxxFlags << "-std=c++1y";
+ const auto cxxLanguageVersion = getCppProp("cxxLanguageVersion").toStringList();
+ if (cxxLanguageVersion.contains("c++17"))
+ cxxFlags << "-std=c++17";
+ else if (cxxLanguageVersion.contains("c++14"))
+ cxxFlags << "-std=c++14";
+ else if (cxxLanguageVersion.contains("c++11"))
+ cxxFlags << "-std=c++11";
else if (!cxxLanguageVersion.isEmpty())
- cxxFlags << ("-std=" + cxxLanguageVersion);
+ cxxFlags << ("-std=" + cxxLanguageVersion.first());
const QString cxxStandardLibrary = getCppProp("cxxStandardLibrary").toString();
if (!cxxStandardLibrary.isEmpty() && toolchain.contains("clang"))
cxxFlags << ("-stdlib=" + cxxStandardLibrary);
@@ -839,11 +841,13 @@ static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags,
if (enableRtti.isValid())
cxxFlags << QLatin1String(enableRtti.toBool() ? "-frtti" : "-fno-rtti");
- const QString cLanguageVersion = getCppProp("cLanguageVersion").toString();
- if (cLanguageVersion == "c11")
- cFlags << "-std=c1x";
+ const auto cLanguageVersion = getCppProp("cLanguageVersion").toStringList();
+ if (cLanguageVersion.contains("c11"))
+ cFlags << "-std=c11";
+ else if (cLanguageVersion.contains("c99"))
+ cFlags << "-std=c99";
else if (!cLanguageVersion.isEmpty())
- cFlags << ("-std=" + cLanguageVersion);
+ cFlags << ("-std=" + cLanguageVersion.first());
} else if (toolchain.contains("msvc")) {
if (enableExceptions.toBool()) {
const QString exceptionModel = getCppProp("exceptionHandlingModel").toString();
@@ -859,6 +863,8 @@ static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags,
cxxFlags << "/TP";
if (enableRtti.isValid())
cxxFlags << QLatin1String(enableRtti.toBool() ? "/GR" : "/GR-");
+ if (getCppProp("cxxLanguageVersion").toStringList().contains("c++17"))
+ cxxFlags << "/std:c++17";
}
}
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp
index fd875eae28..e7e5e713ab 100644
--- a/src/plugins/texteditor/generichighlighter/highlighter.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp
@@ -38,6 +38,8 @@
#include <QCoreApplication>
+#include <cmath>
+
using namespace TextEditor;
using namespace Internal;
@@ -498,6 +500,43 @@ void Highlighter::handleContextChange(const QString &contextName,
changeContext(contextName, definition, setCurrent);
}
+
+static double luminance(const QColor &color)
+{
+ // calculate the luminance based on
+ // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
+ auto val = [](const double &colorVal) {
+ return colorVal < 0.03928 ? colorVal / 12.92 : std::pow((colorVal + 0.055) / 1.055, 2.4);
+ };
+
+ static QHash<QRgb, double> cache;
+ QHash<QRgb, double>::iterator it = cache.find(color.rgb());
+ if (it == cache.end()) {
+ it = cache.insert(color.rgb(), 0.2126 * val(color.redF())
+ + 0.7152 * val(color.greenF())
+ + 0.0722 * val(color.blueF()));
+ }
+ return it.value();
+}
+
+static float contrastRatio(const QColor &color1, const QColor &color2)
+{
+ // calculate the contrast ratio based on
+ // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
+ auto contrast = (luminance(color1) + 0.05) / (luminance(color2) + 0.05);
+ if (contrast < 1)
+ return 1 / contrast;
+ return contrast;
+}
+
+
+static bool isReadableOn(const QColor &background, const QColor &foreground)
+{
+ // following the W3C Recommendation on contrast for large Text
+ // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
+ return contrastRatio(background, foreground) > 3;
+}
+
void Highlighter::applyFormat(int offset,
int count,
const QString &itemDataName,
@@ -526,7 +565,10 @@ void Highlighter::applyFormat(int offset,
// strategy). This is because the highlighter does not really know on which
// definition(s) it is working. Since not many item data specify customizations I
// think this approach would fit better. If there are other ideas...
- if (itemData->color().isValid())
+ QBrush bg = format.background();
+ if (bg.style() == Qt::NoBrush)
+ bg = formatForCategory(C_TEXT).background();
+ if (itemData->color().isValid() && isReadableOn(bg.color(), itemData->color()))
format.setForeground(itemData->color());
if (itemData->isItalicSpecified())
format.setFontItalic(itemData->isItalic());
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 8ad2cacf56..5e3d952db7 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -83,6 +83,7 @@
#include <utils/hostosinfo.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
+#include <utils/styledbar.h>
#include <utils/stylehelper.h>
#include <utils/tooltip/tooltip.h>
#include <utils/uncommentselection.h>
@@ -804,7 +805,7 @@ TextEditorWidgetPrivate::TextEditorWidgetPrivate(TextEditorWidget *parent)
auto toolBarLayout = new QHBoxLayout;
toolBarLayout->setContentsMargins(0, 0, 0, 0);
toolBarLayout->setSpacing(0);
- m_toolBarWidget = new QWidget;
+ m_toolBarWidget = new Utils::StyledBar;
m_toolBarWidget->setLayout(toolBarLayout);
m_stretchWidget = new QWidget;
m_stretchWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp
index 4eb2b4c734..534de63d3d 100644
--- a/src/plugins/valgrind/memchecktool.cpp
+++ b/src/plugins/valgrind/memchecktool.cpp
@@ -753,7 +753,8 @@ void MemcheckTool::heobAction()
TaskHub::requestPopup();
return;
}
- if (!QFile::exists(executable)) {
+ if (!QFile::exists(executable)
+ && !QFile::exists(Utils::HostOsInfo::withExecutableSuffix(executable))) {
const QString msg = tr("Heob: Cannot find %1.").arg(executable);
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();