Merge remote-tracking branch 'origin/4.9'

Change-Id: I5e5536a7dbaa22e94a14d371917e62fcf92bf6dc
This commit is contained in:
Eike Ziller
2019-02-11 10:48:15 +01:00
52 changed files with 279 additions and 145 deletions

View File

@@ -396,7 +396,7 @@ CodeActionResult::CodeActionResult(const QJsonValue &val)
{ {
using ResultArray = QList<Utils::variant<Command, CodeAction>>; using ResultArray = QList<Utils::variant<Command, CodeAction>>;
if (val.isArray()) { if (val.isArray()) {
QJsonArray array = val.toArray(); const QJsonArray array = val.toArray();
ResultArray result; ResultArray result;
for (const QJsonValue &val : array) { for (const QJsonValue &val : array) {
Command command(val); Command command(val);

View File

@@ -482,7 +482,7 @@ void PluginDumper::runQmlDump(const QmlJS::ModelManagerInterface::ProjectInfo &i
process->setEnvironment(info.qmlDumpEnvironment.toStringList()); process->setEnvironment(info.qmlDumpEnvironment.toStringList());
QString workingDir = wd.canonicalPath(); QString workingDir = wd.canonicalPath();
process->setWorkingDirectory(workingDir); process->setWorkingDirectory(workingDir);
connect(process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &PluginDumper::qmlPluginTypeDumpDone); this, &PluginDumper::qmlPluginTypeDumpDone);
connect(process, &QProcess::errorOccurred, this, &PluginDumper::qmlPluginTypeDumpError); connect(process, &QProcess::errorOccurred, this, &PluginDumper::qmlPluginTypeDumpError);
process->start(info.qmlDumpPath, arguments); process->start(info.qmlDumpPath, arguments);

View File

@@ -119,7 +119,7 @@ SftpSession::SftpSession(const QStringList &connectionArgs) : d(new SftpSessionP
emit done(tr("sftp failed to start: %1").arg(d->sftpProc.errorString())); emit done(tr("sftp failed to start: %1").arg(d->sftpProc.errorString()));
} }
}); });
connect(&d->sftpProc, static_cast<void (QProcess::*)(int)>(&QProcess::finished), [this] { connect(&d->sftpProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [this] {
d->state = State::Inactive; d->state = State::Inactive;
if (d->sftpProc.exitStatus() != QProcess::NormalExit) { if (d->sftpProc.exitStatus() != QProcess::NormalExit) {
emit done(tr("sftp crashed.")); emit done(tr("sftp crashed."));

View File

@@ -114,7 +114,7 @@ SftpTransfer::SftpTransfer(const FilesToTransfer &files, Internal::FileTransferT
if (error == QProcess::FailedToStart) if (error == QProcess::FailedToStart)
emitError(tr("sftp failed to start: %1").arg(d->sftpProc.errorString())); emitError(tr("sftp failed to start: %1").arg(d->sftpProc.errorString()));
}); });
connect(&d->sftpProc, static_cast<void (QProcess::*)(int)>(&QProcess::finished), [this] { connect(&d->sftpProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [this] {
if (d->sftpProc.exitStatus() != QProcess::NormalExit) { if (d->sftpProc.exitStatus() != QProcess::NormalExit) {
emitError(tr("sftp crashed.")); emitError(tr("sftp crashed."));
return; return;

View File

@@ -202,7 +202,7 @@ SshConnection::SshConnection(const SshConnectionParameters &serverInfo, QObject
break; // Cannot happen. break; // Cannot happen.
} }
}); });
connect(&d->masterProcess, static_cast<void (QProcess::*)(int)>(&QProcess::finished), [this] { connect(&d->masterProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [this] {
if (d->state == Disconnecting) { if (d->state == Disconnecting) {
emitDisconnected(); emitDisconnected();
return; return;

View File

@@ -93,7 +93,7 @@ static QPixmap segmentPixmap(CrumblePathButton::SegmentType type, QStyle::State
const QString pixmapKey = QStringLiteral("crumblePath-segment-%1-iconMode-%2-hover-%3") const QString pixmapKey = QStringLiteral("crumblePath-segment-%1-iconMode-%2-hover-%3")
.arg(segmentName).arg(iconMode).arg(hover); .arg(segmentName).arg(iconMode).arg(hover);
QPixmap pixmap; QPixmap pixmap;
if (!QPixmapCache::find(pixmapKey, pixmap)) { if (!QPixmapCache::find(pixmapKey, &pixmap)) {
const QString maskFileName = QStringLiteral(":/utils/images/crumblepath-segment-%1%2.png") const QString maskFileName = QStringLiteral(":/utils/images/crumblepath-segment-%1%2.png")
.arg(segmentName).arg(QLatin1String(hover ? "-hover" : "")); .arg(segmentName).arg(QLatin1String(hover ? "-hover" : ""));
pixmap = Icon({{maskFileName, Theme::IconsBaseColor}}).pixmap(iconMode); pixmap = Icon({{maskFileName, Theme::IconsBaseColor}}).pixmap(iconMode);

View File

@@ -82,7 +82,7 @@ bool FileUtils::removeRecursively(const FileName &filePath, QString *error)
QFile::setPermissions(filePath.toString(), fileInfo.permissions() | QFile::WriteUser); QFile::setPermissions(filePath.toString(), fileInfo.permissions() | QFile::WriteUser);
if (fileInfo.isDir()) { if (fileInfo.isDir()) {
QDir dir(filePath.toString()); QDir dir(filePath.toString());
dir = dir.canonicalPath(); dir.setPath(dir.canonicalPath());
if (dir.isRoot()) { if (dir.isRoot()) {
if (error) { if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", *error = QCoreApplication::translate("Utils::FileUtils",

View File

@@ -58,19 +58,11 @@ public:
void QtColorButtonPrivate::slotEditColor() void QtColorButtonPrivate::slotEditColor()
{ {
QColor newColor; QColorDialog::ColorDialogOptions options;
if (m_alphaAllowed) { if (m_alphaAllowed)
bool ok; options |= QColorDialog::ShowAlphaChannel;
const QRgb rgba = QColorDialog::getRgba(m_color.rgba(), &ok, q_ptr); const QColor newColor = QColorDialog::getColor(m_color, q_ptr, QString(), options);
if (!ok) if (!newColor.isValid() || newColor == q_ptr->color())
return;
newColor = QColor::fromRgba(rgba);
} else {
newColor = QColorDialog::getColor(m_color, q_ptr);
if (!newColor.isValid())
return;
}
if (newColor == q_ptr->color())
return; return;
q_ptr->setColor(newColor); q_ptr->setColor(newColor);
emit q_ptr->colorChanged(m_color); emit q_ptr->colorChanged(m_color);
@@ -243,7 +235,7 @@ void QtColorButton::mouseMoveEvent(QMouseEvent *event)
drg->setPixmap(d_ptr->generatePixmap()); drg->setPixmap(d_ptr->generatePixmap());
setDown(false); setDown(false);
event->accept(); event->accept();
drg->start(); drg->exec(Qt::CopyAction);
return; return;
} }
#endif #endif

View File

@@ -216,7 +216,7 @@ void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, con
clipRect.height(), keyColor.rgb()); clipRect.height(), keyColor.rgb());
QPixmap pixmap; QPixmap pixmap;
if (!QPixmapCache::find(key, pixmap)) { if (!QPixmapCache::find(key, &pixmap)) {
pixmap = QPixmap(clipRect.size()); pixmap = QPixmap(clipRect.size());
QPainter p(&pixmap); QPainter p(&pixmap);
QRect rect(0, 0, clipRect.width(), clipRect.height()); QRect rect(0, 0, clipRect.width(), clipRect.height());
@@ -274,7 +274,7 @@ void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, c
clipRect.height(), keyColor.rgb(), spanRect.x()); clipRect.height(), keyColor.rgb(), spanRect.x());
QPixmap pixmap; QPixmap pixmap;
if (!QPixmapCache::find(key, pixmap)) { if (!QPixmapCache::find(key, &pixmap)) {
pixmap = QPixmap(clipRect.size()); pixmap = QPixmap(clipRect.size());
QPainter p(&pixmap); QPainter p(&pixmap);
QRect rect = QRect(0, 0, clipRect.width(), clipRect.height()); QRect rect = QRect(0, 0, clipRect.width(), clipRect.height());
@@ -312,7 +312,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
QString pixmapName; QString pixmapName;
pixmapName.sprintf("StyleHelper::drawArrow-%d-%d-%d-%f", pixmapName.sprintf("StyleHelper::drawArrow-%d-%d-%d-%f",
element, size, enabled, devicePixelRatio); element, size, enabled, devicePixelRatio);
if (!QPixmapCache::find(pixmapName, pixmap)) { if (!QPixmapCache::find(pixmapName, &pixmap)) {
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied); QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
image.fill(Qt::transparent); image.fill(Qt::transparent);
QPainter painter(&image); QPainter painter(&image);
@@ -357,7 +357,7 @@ void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const Q
clipRect.height(), StyleHelper::baseColor().rgb()); clipRect.height(), StyleHelper::baseColor().rgb());
QPixmap pixmap; QPixmap pixmap;
if (!QPixmapCache::find(key, pixmap)) { if (!QPixmapCache::find(key, &pixmap)) {
pixmap = QPixmap(clipRect.size()); pixmap = QPixmap(clipRect.size());
QPainter p(&pixmap); QPainter p(&pixmap);
QRect rect = QRect(0, 0, clipRect.width(), clipRect.height()); QRect rect = QRect(0, 0, clipRect.width(), clipRect.height());
@@ -396,7 +396,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
QString pixmapName = QString::fromLatin1("icon %0 %1 %2 %3") QString pixmapName = QString::fromLatin1("icon %0 %1 %2 %3")
.arg(icon.cacheKey()).arg(iconMode).arg(rect.height()).arg(devicePixelRatio); .arg(icon.cacheKey()).arg(iconMode).arg(rect.height()).arg(devicePixelRatio);
if (!QPixmapCache::find(pixmapName, cache)) { if (!QPixmapCache::find(pixmapName, &cache)) {
// High-dpi support: The in parameters (rect, radius, offset) are in // High-dpi support: The in parameters (rect, radius, offset) are in
// device-independent pixels. The call to QIcon::pixmap() below might // device-independent pixels. The call to QIcon::pixmap() below might
// return a high-dpi pixmap, which will in that case have a devicePixelRatio // return a high-dpi pixmap, which will in that case have a devicePixelRatio

View File

@@ -132,8 +132,8 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
if (!m_selectedPixmap) if (!m_selectedPixmap)
generateGradientPixmap(lwidth, fm.height()+1, backgroundColor, selected); generateGradientPixmap(lwidth, fm.height()+1, backgroundColor, selected);
} else { } else {
painter->setBrush(opt.palette.background().color()); backgroundColor = opt.palette.window().color();
backgroundColor = opt.palette.background().color(); painter->setBrush(backgroundColor);
if (!m_normalPixmap) if (!m_normalPixmap)
generateGradientPixmap(lwidth, fm.height(), backgroundColor, selected); generateGradientPixmap(lwidth, fm.height(), backgroundColor, selected);
} }

View File

@@ -40,6 +40,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QHash> #include <QHash>
#include <QLabel> #include <QLabel>
#include <QScreen>
#include <QTextDocument> #include <QTextDocument>
#include <QUrl> #include <QUrl>
@@ -385,7 +386,10 @@ private:
static int widthLimit() static int widthLimit()
{ {
return QApplication::desktop()->availableGeometry(QCursor::pos()).width() / 2; auto screen = QGuiApplication::screenAt(QCursor::pos());
if (!screen)
screen = QGuiApplication::primaryScreen();
return screen->availableGeometry().width() / 2;
} }
private: private:

View File

@@ -27,33 +27,30 @@
#include "ui_externaltoolconfig.h" #include "ui_externaltoolconfig.h"
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/environment.h>
#include <utils/environmentdialog.h>
#include <utils/fancylineedit.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/macroexpander.h> #include <utils/macroexpander.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/fancylineedit.h>
#include <utils/environment.h>
#include <utils/environmentdialog.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/variablechooser.h> #include <coreplugin/variablechooser.h>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QTextStream>
#include <QMimeData>
#include <QMenu> #include <QMenu>
#include <QMimeData>
#include <QPlainTextEdit> #include <QPlainTextEdit>
#include <QTextStream>
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
static const Qt::ItemFlags TOOLSMENU_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled; static const Qt::ItemFlags TOOLSMENU_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled;
static const Qt::ItemFlags CATEGORY_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable; static const Qt::ItemFlags CATEGORY_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable;
static const Qt::ItemFlags TOOL_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsEditable; static const Qt::ItemFlags TOOL_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsEditable;
// #pragma mark -- ExternalToolModel
ExternalToolModel::ExternalToolModel(QObject *parent) ExternalToolModel::ExternalToolModel(QObject *parent)
: QAbstractItemModel(parent) : QAbstractItemModel(parent)
{ {
@@ -133,7 +130,7 @@ QMimeData *ExternalToolModel::mimeData(const QModelIndexList &indexes) const
QByteArray ba; QByteArray ba;
QDataStream stream(&ba, QIODevice::WriteOnly); QDataStream stream(&ba, QIODevice::WriteOnly);
stream << category << m_tools.value(category).indexOf(tool); stream << category << m_tools.value(category).indexOf(tool);
md->setData(QLatin1String("application/qtcreator-externaltool-config"), ba); md->setData("application/qtcreator-externaltool-config", ba);
return md; return md;
} }
@@ -149,7 +146,7 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data,
bool found; bool found;
QString toCategory = categoryForIndex(parent, &found); QString toCategory = categoryForIndex(parent, &found);
QTC_ASSERT(found, return false); QTC_ASSERT(found, return false);
QByteArray ba = data->data(QLatin1String("application/qtcreator-externaltool-config")); QByteArray ba = data->data("application/qtcreator-externaltool-config");
if (ba.isEmpty()) if (ba.isEmpty())
return false; return false;
QDataStream stream(&ba, QIODevice::ReadOnly); QDataStream stream(&ba, QIODevice::ReadOnly);
@@ -309,7 +306,7 @@ void ExternalToolModel::revertTool(const QModelIndex &modelIndex)
ExternalTool *tool = toolForIndex(modelIndex); ExternalTool *tool = toolForIndex(modelIndex);
QTC_ASSERT(tool, return); QTC_ASSERT(tool, return);
QTC_ASSERT(tool->preset() && !tool->preset()->fileName().isEmpty(), return); QTC_ASSERT(tool->preset() && !tool->preset()->fileName().isEmpty(), return);
ExternalTool *resetTool = new ExternalTool(tool->preset().data()); auto resetTool = new ExternalTool(tool->preset().data());
resetTool->setPreset(tool->preset()); resetTool->setPreset(tool->preset());
(*tool) = (*resetTool); (*tool) = (*resetTool);
delete resetTool; delete resetTool;
@@ -350,10 +347,10 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
//: Sample external tool text //: Sample external tool text
const QString text = tr("Useful text"); const QString text = tr("Useful text");
if (Utils::HostOsInfo::isWindowsHost()) { if (Utils::HostOsInfo::isWindowsHost()) {
tool->setExecutables(QStringList(QLatin1String("cmd"))); tool->setExecutables({"cmd"});
tool->setArguments(QLatin1String("/c echo ") + text); tool->setArguments("/c echo " + text);
} else { } else {
tool->setExecutables(QStringList(QLatin1String("echo"))); tool->setExecutables({"echo"});
tool->setArguments(text); tool->setArguments(text);
} }
@@ -395,8 +392,6 @@ void ExternalToolModel::removeTool(const QModelIndex &modelIndex)
delete tool; delete tool;
} }
// #pragma mark -- ExternalToolConfig
static void fillBaseEnvironmentComboBox(QComboBox *box) static void fillBaseEnvironmentComboBox(QComboBox *box)
{ {
box->clear(); box->clear();
@@ -411,6 +406,7 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
m_model(new ExternalToolModel(this)) m_model(new ExternalToolModel(this))
{ {
ui->setupUi(this); ui->setupUi(this);
ui->executable->setExpectedKind(Utils::PathChooser::ExistingCommand);
ui->scrollArea->viewport()->setAutoFillBackground(false); ui->scrollArea->viewport()->setAutoFillBackground(false);
ui->scrollAreaWidgetContents->setAutoFillBackground(false); ui->scrollAreaWidgetContents->setAutoFillBackground(false);
ui->toolTree->setModel(m_model); ui->toolTree->setModel(m_model);
@@ -433,7 +429,8 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);
connect(ui->executable, &Utils::PathChooser::browsingFinished, connect(ui->executable, &Utils::PathChooser::browsingFinished,
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);
connect(ui->arguments, &QLineEdit::editingFinished, this, &ExternalToolConfig::updateCurrentItem); connect(ui->arguments, &QLineEdit::editingFinished,
this, &ExternalToolConfig::updateCurrentItem);
connect(ui->arguments, &QLineEdit::editingFinished, connect(ui->arguments, &QLineEdit::editingFinished,
this, &ExternalToolConfig::updateEffectiveArguments); this, &ExternalToolConfig::updateEffectiveArguments);
connect(ui->workingDirectory, &Utils::PathChooser::editingFinished, connect(ui->workingDirectory, &Utils::PathChooser::editingFinished,
@@ -442,28 +439,30 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);
connect(ui->environmentButton, &QAbstractButton::clicked, connect(ui->environmentButton, &QAbstractButton::clicked,
this, &ExternalToolConfig::editEnvironmentChanges); this, &ExternalToolConfig::editEnvironmentChanges);
connect(ui->outputBehavior, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), connect(ui->outputBehavior, QOverload<int>::of(&QComboBox::activated),
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);
connect(ui->errorOutputBehavior, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), connect(ui->errorOutputBehavior, QOverload<int>::of(&QComboBox::activated),
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);
connect(ui->modifiesDocumentCheckbox, &QAbstractButton::clicked, connect(ui->modifiesDocumentCheckbox, &QAbstractButton::clicked,
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);
connect(ui->inputText, &QPlainTextEdit::textChanged, this, &ExternalToolConfig::updateCurrentItem); connect(ui->inputText, &QPlainTextEdit::textChanged,
this, &ExternalToolConfig::updateCurrentItem);
connect(ui->revertButton, &QAbstractButton::clicked, this, &ExternalToolConfig::revertCurrentItem); connect(ui->revertButton, &QAbstractButton::clicked,
connect(ui->removeButton, &QAbstractButton::clicked, this, &ExternalToolConfig::removeTool); this, &ExternalToolConfig::revertCurrentItem);
connect(ui->removeButton, &QAbstractButton::clicked,
this, &ExternalToolConfig::removeTool);
auto menu = new QMenu(ui->addButton); auto menu = new QMenu(ui->addButton);
ui->addButton->setMenu(menu); ui->addButton->setMenu(menu);
QAction *addTool = new QAction(tr("Add Tool"), this); auto addTool = new QAction(tr("Add Tool"), this);
menu->addAction(addTool); menu->addAction(addTool);
connect(addTool, &QAction::triggered, this, &ExternalToolConfig::addTool); connect(addTool, &QAction::triggered, this, &ExternalToolConfig::addTool);
QAction *addCategory = new QAction(tr("Add Category"), this); auto addCategory = new QAction(tr("Add Category"), this);
menu->addAction(addCategory); menu->addAction(addCategory);
connect(addCategory, &QAction::triggered, this, &ExternalToolConfig::addCategory); connect(addCategory, &QAction::triggered, this, &ExternalToolConfig::addCategory);
showInfoForItem(QModelIndex()); showInfoForItem(QModelIndex());
} }
ExternalToolConfig::~ExternalToolConfig() ExternalToolConfig::~ExternalToolConfig()
@@ -478,7 +477,7 @@ void ExternalToolConfig::setTools(const QMap<QString, QList<ExternalTool *> > &t
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
QList<ExternalTool *> itemCopy; QList<ExternalTool *> itemCopy;
foreach (ExternalTool *tool, it.value()) for (ExternalTool *tool : it.value())
itemCopy.append(new ExternalTool(tool)); itemCopy.append(new ExternalTool(tool));
toolsCopy.insert(it.key(), itemCopy); toolsCopy.insert(it.key(), itemCopy);
} }
@@ -648,7 +647,7 @@ void ExternalToolConfig::editEnvironmentChanges()
void ExternalToolConfig::updateEnvironmentLabel() void ExternalToolConfig::updateEnvironmentLabel()
{ {
QString shortSummary = Utils::EnvironmentItem::toStringList(m_environment).join(QLatin1String("; ")); QString shortSummary = Utils::EnvironmentItem::toStringList(m_environment).join("; ");
QFontMetrics fm(ui->environmentLabel->font()); QFontMetrics fm(ui->environmentLabel->font());
shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, ui->environmentLabel->width()); shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, ui->environmentLabel->width());
ui->environmentLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") : shortSummary); ui->environmentLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") : shortSummary);

View File

@@ -27,9 +27,9 @@
#include "../externaltool.h" #include "../externaltool.h"
#include <QWidget>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QDialog> #include <QDialog>
#include <QWidget>
QT_FORWARD_DECLARE_CLASS(QPlainTextEdit) QT_FORWARD_DECLARE_CLASS(QPlainTextEdit)

View File

@@ -552,7 +552,7 @@ bool ShortcutSettingsWidget::markCollisions(ShortcutItem *item)
} }
item->m_item->setForeground(2, hasCollision item->m_item->setForeground(2, hasCollision
? Utils::creatorTheme()->color(Utils::Theme::TextColorError) ? Utils::creatorTheme()->color(Utils::Theme::TextColorError)
: commandList()->palette().foreground()); : commandList()->palette().window());
return hasCollision; return hasCollision;
} }

View File

@@ -104,7 +104,7 @@ bool HelpItem::isValid() const
{ {
if (m_helpUrl.isEmpty() && m_helpIds.isEmpty()) if (m_helpUrl.isEmpty() && m_helpIds.isEmpty())
return false; return false;
return !links().isEmpty(); return !links().empty();
} }
QString HelpItem::extractContent(bool extended) const QString HelpItem::extractContent(bool extended) const
@@ -116,7 +116,8 @@ QString HelpItem::extractContent(bool extended) const
htmlExtractor.setMode(Utils::HtmlDocExtractor::FirstParagraph); htmlExtractor.setMode(Utils::HtmlDocExtractor::FirstParagraph);
QString contents; QString contents;
for (const QUrl &url : links()) { for (const Link &item : links()) {
const QUrl url = item.second;
const QString html = QString::fromUtf8(Core::HelpManager::fileData(url)); const QString html = QString::fromUtf8(Core::HelpManager::fileData(url));
switch (m_category) { switch (m_category) {
case Brief: case Brief:
@@ -157,50 +158,124 @@ QString HelpItem::extractContent(bool extended) const
return contents; return contents;
} }
const QMap<QString, QUrl> &HelpItem::links() const static std::pair<QUrl, int> extractVersion(const QUrl &url)
{
const QString host = url.host();
const QStringList hostParts = host.split('.');
if (hostParts.size() == 4 && (host.startsWith("com.trolltech.")
|| host.startsWith("org.qt-project."))) {
bool ok = false;
// the following is only correct under the specific current conditions, and it will
// always be quite some guessing as long as the version information does not
// include separators for major vs minor vs patch version
const int version = hostParts.at(3).toInt(&ok);
if (ok) {
QUrl urlWithoutVersion(url);
urlWithoutVersion.setHost(hostParts.mid(0, 3).join('.'));
return {urlWithoutVersion, version};
}
}
return {url, 0};
}
// sort primary by "url without version" and seconday by "version"
static bool helpUrlLessThan(const QUrl &a, const QUrl &b)
{
const std::pair<QUrl, int> va = extractVersion(a);
const std::pair<QUrl, int> vb = extractVersion(b);
const QString sa = va.first.toString();
const QString sb = vb.first.toString();
if (sa == sb)
return va.second > vb.second;
return sa < sb;
}
static bool linkLessThan(const HelpItem::Link &a, const HelpItem::Link &b)
{
return helpUrlLessThan(a.second, b.second);
}
// links are sorted with highest "version" first (for Qt help urls)
const HelpItem::Links &HelpItem::links() const
{ {
if (!m_helpLinks) { if (!m_helpLinks) {
if (!m_helpUrl.isEmpty()) { if (!m_helpUrl.isEmpty()) {
m_helpLinks.emplace(QMap<QString, QUrl>({{m_helpUrl.toString(), m_helpUrl}})); m_keyword = m_helpUrl.toString();
m_helpLinks.emplace(Links{{m_keyword, m_helpUrl}});
} else { } else {
m_helpLinks.emplace(); // set a value even if there are no help IDs m_helpLinks.emplace(); // set a value even if there are no help IDs
QMap<QString, QUrl> helpLinks;
for (const QString &id : m_helpIds) { for (const QString &id : m_helpIds) {
m_helpLinks = Core::HelpManager::linksForIdentifier(id); helpLinks = Core::HelpManager::linksForIdentifier(id);
if (!m_helpLinks->isEmpty()) if (!helpLinks.isEmpty()) {
m_keyword = id;
break; break;
}
}
if (helpLinks.isEmpty()) { // perform keyword lookup as well as a fallback
for (const QString &id : m_helpIds) {
helpLinks = Core::HelpManager::linksForKeyword(id);
if (!helpLinks.isEmpty()) {
m_keyword = id;
m_isFuzzyMatch = true;
break;
}
}
}
QMapIterator<QString, QUrl> it(helpLinks);
while (it.hasNext()) {
it.next();
m_helpLinks->emplace_back(it.key(), it.value());
} }
} }
Utils::sort(*m_helpLinks, linkLessThan);
} }
return *m_helpLinks; return *m_helpLinks;
} }
static QUrl findBestLink(const QMap<QString, QUrl> &links) static const HelpItem::Links getBestLinks(const HelpItem::Links &links)
{ {
if (links.isEmpty()) // extract the highest version (== first) link of each individual topic
return QUrl(); HelpItem::Links bestLinks;
if (links.size() == 1) QUrl currentUnversionedUrl;
return links.first(); for (const HelpItem::Link &link : links) {
QUrl source = links.first(); const QUrl unversionedUrl = extractVersion(link.second).first;
// workaround to show the latest Qt version if (unversionedUrl != currentUnversionedUrl) {
int version = 0; currentUnversionedUrl = unversionedUrl;
QRegExp exp("(\\d+)"); bestLinks.push_back(link);
foreach (const QUrl &link, links) {
const QString &authority = link.authority();
if (authority.startsWith("com.trolltech.")
|| authority.startsWith("org.qt-project.")) {
if (exp.indexIn(authority) >= 0) {
const int tmpVersion = exp.cap(1).toInt();
if (tmpVersion > version) {
source = link;
version = tmpVersion;
}
}
} }
} }
return source; return bestLinks;
} }
const QUrl HelpItem::bestLink() const static const HelpItem::Links getBestLink(const HelpItem::Links &links)
{ {
return findBestLink(links()); if (links.empty())
return {};
// Extract single link with highest version, from all topics.
// This is to ensure that if we succeeded with an ID lookup, and we have e.g. Qt5 and Qt4
// documentation, that we only return the Qt5 link even though the Qt5 and Qt4 URLs look
// different.
int highestVersion = -1;
HelpItem::Link bestLink;
for (const HelpItem::Link &link : links) {
const int version = extractVersion(link.second).second;
if (version > highestVersion) {
highestVersion = version;
bestLink = link;
}
}
return {bestLink};
}
const HelpItem::Links HelpItem::bestLinks() const
{
if (m_isFuzzyMatch)
return getBestLinks(links());
return getBestLink(links());
}
const QString HelpItem::keyword() const
{
return m_keyword;
} }

View File

@@ -29,16 +29,20 @@
#include <utils/optional.h> #include <utils/optional.h>
#include <QMap>
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
#include <QVariant> #include <QVariant>
#include <vector>
namespace Core { namespace Core {
class CORE_EXPORT HelpItem class CORE_EXPORT HelpItem
{ {
public: public:
using Link = std::pair<QString, QUrl>;
using Links = std::vector<Link>;
enum Category { enum Category {
ClassOrNamespace, ClassOrNamespace,
Enum, Enum,
@@ -77,15 +81,18 @@ public:
QString extractContent(bool extended) const; QString extractContent(bool extended) const;
const QMap<QString, QUrl> &links() const; const Links &links() const;
const QUrl bestLink() const; const Links bestLinks() const;
const QString keyword() const;
private: private:
QUrl m_helpUrl; QUrl m_helpUrl;
QStringList m_helpIds; QStringList m_helpIds;
QString m_docMark; QString m_docMark;
Category m_category = Unknown; Category m_category = Unknown;
mutable Utils::optional<QMap<QString, QUrl>> m_helpLinks; // cached help links mutable Utils::optional<Links> m_helpLinks; // cached help links
mutable QString m_keyword;
mutable bool m_isFuzzyMatch = false;
}; };
} // namespace Core } // namespace Core

View File

@@ -91,6 +91,11 @@ QMap<QString, QUrl> linksForIdentifier(const QString &id)
return checkInstance() ? m_instance->linksForIdentifier(id) : QMap<QString, QUrl>(); return checkInstance() ? m_instance->linksForIdentifier(id) : QMap<QString, QUrl>();
} }
QMap<QString, QUrl> linksForKeyword(const QString &keyword)
{
return checkInstance() ? m_instance->linksForKeyword(keyword) : QMap<QString, QUrl>();
}
QByteArray fileData(const QUrl &url) QByteArray fileData(const QUrl &url)
{ {
return checkInstance() ? m_instance->fileData(url) : QByteArray(); return checkInstance() ? m_instance->fileData(url) : QByteArray();

View File

@@ -64,6 +64,7 @@ CORE_EXPORT void registerDocumentation(const QStringList &fileNames);
CORE_EXPORT void unregisterDocumentation(const QStringList &nameSpaces); CORE_EXPORT void unregisterDocumentation(const QStringList &nameSpaces);
CORE_EXPORT QMap<QString, QUrl> linksForIdentifier(const QString &id); CORE_EXPORT QMap<QString, QUrl> linksForIdentifier(const QString &id);
CORE_EXPORT QMap<QString, QUrl> linksForKeyword(const QString &id);
CORE_EXPORT QByteArray fileData(const QUrl &url); CORE_EXPORT QByteArray fileData(const QUrl &url);
CORE_EXPORT void showHelpUrl(const QUrl &url, HelpViewerLocation location = HelpModeAlways); CORE_EXPORT void showHelpUrl(const QUrl &url, HelpViewerLocation location = HelpModeAlways);

View File

@@ -41,6 +41,7 @@ public:
virtual void registerDocumentation(const QStringList &fileNames) = 0; virtual void registerDocumentation(const QStringList &fileNames) = 0;
virtual void unregisterDocumentation(const QStringList &nameSpaces) = 0; virtual void unregisterDocumentation(const QStringList &nameSpaces) = 0;
virtual QMap<QString, QUrl> linksForIdentifier(const QString &id) = 0; virtual QMap<QString, QUrl> linksForIdentifier(const QString &id) = 0;
virtual QMap<QString, QUrl> linksForKeyword(const QString &keyword) = 0;
virtual QByteArray fileData(const QUrl &url) = 0; virtual QByteArray fileData(const QUrl &url) = 0;
virtual void showHelpUrl(const QUrl &url, HelpViewerLocation location = HelpModeAlways) = 0; virtual void showHelpUrl(const QUrl &url, HelpViewerLocation location = HelpModeAlways) = 0;
}; };

View File

@@ -53,7 +53,7 @@ CppcheckRunner::CppcheckRunner(CppcheckTool &tool) :
this, &CppcheckRunner::readError); this, &CppcheckRunner::readError);
connect(m_process, &QProcess::started, connect(m_process, &QProcess::started,
this, &CppcheckRunner::handleStarted); this, &CppcheckRunner::handleStarted);
connect(m_process, QOverload<int>::of(&QProcess::finished), connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &CppcheckRunner::handleFinished); this, &CppcheckRunner::handleFinished);
m_queueTimer.setSingleShot(true); m_queueTimer.setSingleShot(true);

View File

@@ -203,7 +203,7 @@ CdbEngine::CdbEngine() :
connect(action(CreateFullBacktrace), &QAction::triggered, connect(action(CreateFullBacktrace), &QAction::triggered,
this, &CdbEngine::createFullBacktrace); this, &CdbEngine::createFullBacktrace);
connect(&m_process, static_cast<void(QProcess::*)(int)>(&QProcess::finished), connect(&m_process, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
this, &CdbEngine::processFinished); this, &CdbEngine::processFinished);
connect(&m_process, &QProcess::errorOccurred, this, &CdbEngine::processError); connect(&m_process, &QProcess::errorOccurred, this, &CdbEngine::processError);
connect(&m_process, &QProcess::readyReadStandardOutput, connect(&m_process, &QProcess::readyReadStandardOutput,

View File

@@ -105,7 +105,7 @@ public:
this, &LocalProcessRunner::handleStandardOutput); this, &LocalProcessRunner::handleStandardOutput);
connect(&m_proc, &QProcess::readyReadStandardError, connect(&m_proc, &QProcess::readyReadStandardError,
this, &LocalProcessRunner::handleStandardError); this, &LocalProcessRunner::handleStandardError);
connect(&m_proc, static_cast<void (QProcess::*)(int)>(&QProcess::finished), connect(&m_proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &LocalProcessRunner::handleFinished); this, &LocalProcessRunner::handleFinished);
} }
@@ -213,7 +213,7 @@ private:
} }
m_coreUnpackProcess.setWorkingDirectory(TemporaryDirectory::masterDirectoryPath()); m_coreUnpackProcess.setWorkingDirectory(TemporaryDirectory::masterDirectoryPath());
connect(&m_coreUnpackProcess, static_cast<void (QProcess::*)(int)>(&QProcess::finished), connect(&m_coreUnpackProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &CoreUnpacker::reportStarted); this, &CoreUnpacker::reportStarted);
const QString msg = DebuggerRunTool::tr("Unpacking core file to %1"); const QString msg = DebuggerRunTool::tr("Unpacking core file to %1");

View File

@@ -62,6 +62,7 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QFileInfo> #include <QFileInfo>
#include <QLabel> #include <QLabel>
#include <QScreen>
#include <QScrollBar> #include <QScrollBar>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <QStack> #include <QStack>
@@ -624,7 +625,10 @@ void DebuggerToolTipWidget::computeSize()
// touch the border of the screen. // touch the border of the screen.
QPoint pos(x(), y()); QPoint pos(x(), y());
QTC_ASSERT(QApplication::desktop(), return); QTC_ASSERT(QApplication::desktop(), return);
QRect desktopRect = QApplication::desktop()->availableGeometry(pos); auto screen = QGuiApplication::screenAt(pos);
if (!screen)
screen = QGuiApplication::primaryScreen();
QRect desktopRect = screen->availableGeometry();
const int maxWidth = desktopRect.right() - pos.x() - 5 - 5; const int maxWidth = desktopRect.right() - pos.x() - 5 - 5;
const int maxHeight = desktopRect.bottom() - pos.y() - 5 - 5; const int maxHeight = desktopRect.bottom() - pos.y() - 5 - 5;

View File

@@ -409,7 +409,7 @@ void ThreadsHandler::setThreads(const GdbMi &data)
if (!m_currentThread && threads.childCount() > 0) if (!m_currentThread && threads.childCount() > 0)
m_currentThread = rootItem()->childAt(0); m_currentThread = rootItem()->childAt(0);
if (!m_currentThread) { if (m_currentThread) {
const QModelIndex currentThreadIndex = m_currentThread->index(); const QModelIndex currentThreadIndex = m_currentThread->index();
threadSwitcher()->setCurrentIndex(currentThreadIndex.row()); threadSwitcher()->setCurrentIndex(currentThreadIndex.row());
} }

View File

@@ -396,7 +396,7 @@ void SideDiffEditorWidget::paintSeparator(QPainter &painter,
if (!foreground.isValid()) if (!foreground.isValid())
foreground = m_textForeground; foreground = m_textForeground;
if (!foreground.isValid()) if (!foreground.isValid())
foreground = palette().foreground().color(); foreground = palette().windowText().color();
painter.setPen(foreground); painter.setPen(foreground);

View File

@@ -248,7 +248,7 @@ void ChangeSelectionDialog::recalculateDetails()
m_process->setWorkingDirectory(workingDir); m_process->setWorkingDirectory(workingDir);
m_process->setProcessEnvironment(m_gitEnvironment); m_process->setProcessEnvironment(m_gitEnvironment);
connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &ChangeSelectionDialog::setDetails); this, &ChangeSelectionDialog::setDetails);
m_process->start(m_gitExecutable.toString(), {"show", "--decorate", "--stat=80", ref}); m_process->start(m_gitExecutable.toString(), {"show", "--decorate", "--stat=80", ref});

View File

@@ -2386,7 +2386,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
process->start(binary, arguments); process->start(binary, arguments);
success = process->waitForStarted(); success = process->waitForStarted();
if (success) if (success)
connect(process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
process, &QProcess::deleteLater); process, &QProcess::deleteLater);
else else
delete process; delete process;

View File

@@ -65,7 +65,8 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
VcsOutputWindow::appendCommand(workingDirectory, binary, arguments); VcsOutputWindow::appendCommand(workingDirectory, binary, arguments);
m_process->start(binary.toString(), arguments); m_process->start(binary.toString(), arguments);
if (m_process->waitForStarted()) { if (m_process->waitForStarted()) {
connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, &MergeTool::done); connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &MergeTool::done);
connect(m_process, &QIODevice::readyRead, this, &MergeTool::readData); connect(m_process, &QIODevice::readyRead, this, &MergeTool::readData);
} else { } else {
delete m_process; delete m_process;

View File

@@ -141,7 +141,7 @@ void HelpIndexFilter::accept(LocatorFilterEntry selection,
Q_UNUSED(selectionStart) Q_UNUSED(selectionStart)
Q_UNUSED(selectionLength) Q_UNUSED(selectionLength)
const QString &key = selection.displayName; const QString &key = selection.displayName;
const QMap<QString, QUrl> &links = HelpManager::linksForKeyword(key); const QMap<QString, QUrl> &links = HelpManager::instance()->linksForKeyword(key);
emit linksActivated(links, key); emit linksActivated(links, key);
} }

View File

@@ -54,8 +54,8 @@ public:
static void registerUserDocumentation(const QStringList &filePaths); static void registerUserDocumentation(const QStringList &filePaths);
static QSet<QString> userDocumentationPaths(); static QSet<QString> userDocumentationPaths();
static QMap<QString, QUrl> linksForKeyword(const QString &key);
QMap<QString, QUrl> linksForIdentifier(const QString &id) override; QMap<QString, QUrl> linksForIdentifier(const QString &id) override;
QMap<QString, QUrl> linksForKeyword(const QString &key) override;
static QUrl findFile(const QUrl &url); static QUrl findFile(const QUrl &url);
QByteArray fileData(const QUrl &url) override; QByteArray fileData(const QUrl &url) override;

View File

@@ -44,6 +44,7 @@
#include "searchwidget.h" #include "searchwidget.h"
#include "searchtaskhandler.h" #include "searchtaskhandler.h"
#include "textbrowserhelpviewer.h" #include "textbrowserhelpviewer.h"
#include "topicchooser.h"
#ifdef QTC_MAC_NATIVE_HELPVIEWER #ifdef QTC_MAC_NATIVE_HELPVIEWER
#include "macwebkithelpviewer.h" #include "macwebkithelpviewer.h"
@@ -636,8 +637,8 @@ void HelpPluginPrivate::requestContextHelp()
void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp) void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp)
{ {
const QUrl source = contextHelp.bestLink(); const HelpItem::Links links = contextHelp.bestLinks();
if (!source.isValid()) { if (links.empty()) {
// No link found or no context object // No link found or no context object
HelpViewer *viewer = showHelpUrl(QUrl(Help::Constants::AboutBlank), HelpViewer *viewer = showHelpUrl(QUrl(Help::Constants::AboutBlank),
LocalHelpManager::contextHelpOption()); LocalHelpManager::contextHelpOption());
@@ -653,8 +654,19 @@ void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp)
.arg(contextHelp.helpIds().join(", ")) .arg(contextHelp.helpIds().join(", "))
.arg(HelpPlugin::tr("No documentation available."))); .arg(HelpPlugin::tr("No documentation available.")));
} }
} else if (links.size() == 1) {
showHelpUrl(links.front().second, LocalHelpManager::contextHelpOption());
} else { } else {
showHelpUrl(source, LocalHelpManager::contextHelpOption()); QMap<QString, QUrl> map;
for (const HelpItem::Link &link : links)
map.insert(link.first, link.second);
auto tc = new TopicChooser(ICore::dialogParent(), contextHelp.keyword(), map);
tc->setModal(true);
connect(tc, &QDialog::accepted, this, [this, tc] {
showHelpUrl(tc->link(), LocalHelpManager::contextHelpOption());
});
connect(tc, &QDialog::finished, tc, [tc] { tc->deleteLater(); });
tc->show();
} }
} }

View File

@@ -112,6 +112,7 @@ static void setupPreregisteredOsFlavors() {
registerOsFlavor(Abi::WindowsMsvc2013Flavor, "msvc2013", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::WindowsMsvc2013Flavor, "msvc2013", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsMsvc2015Flavor, "msvc2015", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::WindowsMsvc2015Flavor, "msvc2015", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsMsvc2017Flavor, "msvc2017", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::WindowsMsvc2017Flavor, "msvc2017", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsMsvc2019Flavor, "msvc2019", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsMSysFlavor, "msys", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::WindowsMSysFlavor, "msys", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsCEFlavor, "ce", {Abi::OS::WindowsOS}); registerOsFlavor(Abi::WindowsCEFlavor, "ce", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::VxWorksFlavor, "vxworks", {Abi::OS::VxWorks}); registerOsFlavor(Abi::VxWorksFlavor, "vxworks", {Abi::OS::VxWorks});
@@ -279,12 +280,15 @@ static QList<Abi> parseCoffHeader(const QByteArray &data)
flavor = Abi::WindowsMsvc2013Flavor; flavor = Abi::WindowsMsvc2013Flavor;
break; break;
case 14: case 14:
flavor = minorLinker >= quint8(10) if (minorLinker >= quint8(20))
? Abi::WindowsMsvc2017Flavor // MSVC2017 RC flavor = Abi::WindowsMsvc2019Flavor;
: Abi::WindowsMsvc2015Flavor; else if (minorLinker >= quint8(10))
flavor = Abi::WindowsMsvc2017Flavor;
else
flavor = Abi::WindowsMsvc2015Flavor;
break; break;
case 15: case 15:
flavor = Abi::WindowsMsvc2017Flavor; flavor = Abi::WindowsMsvc2019Flavor;
break; break;
default: // Keep unknown flavor default: // Keep unknown flavor
if (minorLinker != 0) if (minorLinker != 0)
@@ -589,6 +593,13 @@ bool Abi::operator == (const Abi &other) const
&& m_wordWidth == other.m_wordWidth; && m_wordWidth == other.m_wordWidth;
} }
static bool compatibleMSVCFlavors(const Abi::OSFlavor &left, const Abi ::OSFlavor &right)
{
// MSVC 2019, 2017 and 2015 are compatible
return left >= Abi::WindowsMsvc2015Flavor && left <= Abi::WindowsMsvc2019Flavor
&& right >= Abi::WindowsMsvc2015Flavor && right <= Abi::WindowsMsvc2019Flavor;
}
bool Abi::isCompatibleWith(const Abi &other) const bool Abi::isCompatibleWith(const Abi &other) const
{ {
// Generic match: If stuff is identical or the other side is unknown, then this is a match. // Generic match: If stuff is identical or the other side is unknown, then this is a match.
@@ -615,12 +626,9 @@ bool Abi::isCompatibleWith(const Abi &other) const
if (isCompat && (osFlavor() == AndroidLinuxFlavor || other.osFlavor() == AndroidLinuxFlavor)) if (isCompat && (osFlavor() == AndroidLinuxFlavor || other.osFlavor() == AndroidLinuxFlavor))
isCompat = (architecture() == other.architecture()) && (osFlavor() == other.osFlavor()); isCompat = (architecture() == other.architecture()) && (osFlavor() == other.osFlavor());
// MSVC2017 is compatible with MSVC2015 if (!isCompat && compatibleMSVCFlavors(osFlavor(), other.osFlavor()))
if (!isCompat
&& ((osFlavor() == WindowsMsvc2015Flavor && other.osFlavor() == WindowsMsvc2017Flavor)
|| (osFlavor() == WindowsMsvc2017Flavor && other.osFlavor() == WindowsMsvc2015Flavor))) {
isCompat = true; isCompat = true;
}
return isCompat; return isCompat;
} }
@@ -896,6 +904,8 @@ bool Abi::osSupportsFlavor(const Abi::OS &os, const Abi::OSFlavor &flavor)
Abi::OSFlavor Abi::flavorForMsvcVersion(int version) Abi::OSFlavor Abi::flavorForMsvcVersion(int version)
{ {
if (version >= 1920)
return WindowsMsvc2019Flavor;
if (version >= 1910) if (version >= 1910)
return WindowsMsvc2017Flavor; return WindowsMsvc2017Flavor;
switch (version) { switch (version) {

View File

@@ -89,6 +89,7 @@ public:
WindowsMsvc2013Flavor, WindowsMsvc2013Flavor,
WindowsMsvc2015Flavor, WindowsMsvc2015Flavor,
WindowsMsvc2017Flavor, WindowsMsvc2017Flavor,
WindowsMsvc2019Flavor,
WindowsMSysFlavor, WindowsMSysFlavor,
WindowsCEFlavor, WindowsCEFlavor,

View File

@@ -185,7 +185,7 @@ bool BuildStepList::removeStep(int position)
void BuildStepList::moveStepUp(int position) void BuildStepList::moveStepUp(int position)
{ {
m_steps.swap(position - 1, position); m_steps.swapItemsAt(position - 1, position);
emit stepMoved(position, position - 1); emit stepMoved(position, position - 1);
} }

View File

@@ -40,7 +40,7 @@ DesktopDeviceProcess::DesktopDeviceProcess(const QSharedPointer<const IDevice> &
: DeviceProcess(device, parent) : DeviceProcess(device, parent)
{ {
connect(&m_process, &QProcess::errorOccurred, this, &DeviceProcess::error); connect(&m_process, &QProcess::errorOccurred, this, &DeviceProcess::error);
connect(&m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), connect(&m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &DeviceProcess::finished); this, &DeviceProcess::finished);
connect(&m_process, &QProcess::readyReadStandardOutput, connect(&m_process, &QProcess::readyReadStandardOutput,
this, &DeviceProcess::readyReadStandardOutput); this, &DeviceProcess::readyReadStandardOutput);

View File

@@ -384,7 +384,9 @@ static Abi findAbiOfMsvc(MsvcToolChain::Type type,
else if (version == QLatin1String("v7.0A") || version == QLatin1String("v7.1")) else if (version == QLatin1String("v7.0A") || version == QLatin1String("v7.1"))
msvcVersionString = QLatin1String("10.0"); msvcVersionString = QLatin1String("10.0");
} }
if (msvcVersionString.startsWith(QLatin1String("15."))) if (msvcVersionString.startsWith(QLatin1String("16.")))
flavor = Abi::WindowsMsvc2019Flavor;
else if (msvcVersionString.startsWith(QLatin1String("15.")))
flavor = Abi::WindowsMsvc2017Flavor; flavor = Abi::WindowsMsvc2017Flavor;
else if (msvcVersionString.startsWith(QLatin1String("14."))) else if (msvcVersionString.startsWith(QLatin1String("14.")))
flavor = Abi::WindowsMsvc2015Flavor; flavor = Abi::WindowsMsvc2015Flavor;
@@ -955,6 +957,12 @@ Utils::FileNameList MsvcToolChain::suggestedMkspecList() const
<< Utils::FileName::fromLatin1("winrt-x86-msvc2017") << Utils::FileName::fromLatin1("winrt-x86-msvc2017")
<< Utils::FileName::fromLatin1("winrt-x64-msvc2017"); << Utils::FileName::fromLatin1("winrt-x64-msvc2017");
break; break;
case Abi::WindowsMsvc2019Flavor:
result << Utils::FileName::fromLatin1("win32-msvc2019")
<< Utils::FileName::fromLatin1("winrt-arm-msvc2019")
<< Utils::FileName::fromLatin1("winrt-x86-msvc2019")
<< Utils::FileName::fromLatin1("winrt-x64-msvc2019");
break;
default: default:
result.clear(); result.clear();
break; break;

View File

@@ -1176,7 +1176,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
// duplicate file action // duplicate file action
dd->m_duplicateFileAction = new QAction(tr("Duplicate File..."), this); dd->m_duplicateFileAction = new QAction(tr("Duplicate File"), this);
cmd = ActionManager::registerAction(dd->m_duplicateFileAction, Constants::DUPLICATEFILE, cmd = ActionManager::registerAction(dd->m_duplicateFileAction, Constants::DUPLICATEFILE,
projecTreeContext); projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);

View File

@@ -758,8 +758,8 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->setBrush(opt.palette.highlight().color()); painter->setBrush(opt.palette.highlight().color());
backgroundColor = opt.palette.highlight().color(); backgroundColor = opt.palette.highlight().color();
} else { } else {
painter->setBrush(opt.palette.background().color()); painter->setBrush(opt.palette.window().color());
backgroundColor = opt.palette.background().color(); backgroundColor = opt.palette.window().color();
} }
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
painter->drawRect(opt.rect); painter->drawRect(opt.rect);

View File

@@ -105,6 +105,14 @@ void DesktopQmakeRunConfiguration::updateTargetInformation()
aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath); aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
} }
bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map)
{
if (!RunConfiguration::fromMap(map))
return false;
updateTargetInformation();
return true;
}
void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &)
{ {
updateTargetInformation(); updateTargetInformation();

View File

@@ -43,6 +43,7 @@ public:
private: private:
void updateTargetInformation(); void updateTargetInformation();
bool fromMap(const QVariantMap &map) final;
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final; void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
QString defaultDisplayName(); QString defaultDisplayName();

View File

@@ -1098,7 +1098,7 @@ QString InternalLibraryDetailsController::snippet() const
QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
if (ProjectExplorer::Target *t = project->activeTarget()) if (ProjectExplorer::Target *t = project->activeTarget())
if (ProjectExplorer::BuildConfiguration *bc = t->activeBuildConfiguration()) if (ProjectExplorer::BuildConfiguration *bc = t->activeBuildConfiguration())
rootBuildDir = bc->buildDirectory().toString(); rootBuildDir.setPath(bc->buildDirectory().toString());
// the project for which we insert the snippet inside build tree // the project for which we insert the snippet inside build tree
QFileInfo pfi(rootBuildDir.filePath(proRelavitePath)); QFileInfo pfi(rootBuildDir.filePath(proRelavitePath));

View File

@@ -147,7 +147,6 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum
{ {
QString moduleName = getModuleName(scopeChain, qmlDocument, value); QString moduleName = getModuleName(scopeChain, qmlDocument, value);
QString helpId;
QStringList helpIdCandidates; QStringList helpIdCandidates;
QStringList helpIdPieces(qName); QStringList helpIdPieces(qName);
@@ -168,7 +167,7 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum
helpIdCandidates += helpIdPieces.join('.'); helpIdCandidates += helpIdPieces.join('.');
const HelpItem helpItem(helpIdCandidates, qName.join('.'), HelpItem::QmlComponent); const HelpItem helpItem(helpIdCandidates, qName.join('.'), HelpItem::QmlComponent);
const QMap<QString, QUrl> urlMap = helpItem.links(); const HelpItem::Links links = helpItem.links();
// Check if the module name contains a major version. // Check if the module name contains a major version.
QRegularExpression version("^([^\\d]*)(\\d+)\\.*\\d*$"); QRegularExpression version("^([^\\d]*)(\\d+)\\.*\\d*$");
@@ -176,10 +175,10 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum
if (m.hasMatch()) { if (m.hasMatch()) {
QMap<QString, QUrl> filteredUrlMap; QMap<QString, QUrl> filteredUrlMap;
QStringRef maj = m.capturedRef(2); QStringRef maj = m.capturedRef(2);
for (auto x = urlMap.begin(); x != urlMap.end(); ++x) { for (const HelpItem::Link &link : links) {
QString urlModuleName = x.value().path().split('/')[1]; QString urlModuleName = link.second.path().split('/')[1];
if (urlModuleName.contains(maj)) if (urlModuleName.contains(maj))
filteredUrlMap.insert(x.key(), x.value()); filteredUrlMap.insert(link.first, link.second);
} }
if (!filteredUrlMap.isEmpty()) { if (!filteredUrlMap.isEmpty()) {
// Use the URL, to disambiguate different versions // Use the URL, to disambiguate different versions

View File

@@ -1634,7 +1634,7 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<ProKey, ProString> &ve
} }
if (!qt5) { if (!qt5) {
//resolve mkspec link //resolve mkspec link
QString rspec = mkspecFullPath.toFileInfo().readLink(); QString rspec = mkspecFullPath.toFileInfo().symLinkTarget();
if (!rspec.isEmpty()) if (!rspec.isEmpty())
mkspecFullPath = FileName::fromUserInput( mkspecFullPath = FileName::fromUserInput(
QDir(baseMkspecDir.toString()).absoluteFilePath(rspec)); QDir(baseMkspecDir.toString()).absoluteFilePath(rspec));
@@ -1963,6 +1963,8 @@ static Abi refineAbiFromBuildString(const QByteArray &buildString, const Abi &pr
flavor = Abi::WindowsMsvc2015Flavor; flavor = Abi::WindowsMsvc2015Flavor;
} else if (compiler.startsWith("MSVC 2017") && os == Abi::WindowsOS) { } else if (compiler.startsWith("MSVC 2017") && os == Abi::WindowsOS) {
flavor = Abi::WindowsMsvc2017Flavor; flavor = Abi::WindowsMsvc2017Flavor;
} else if (compiler.startsWith("MSVC 2019") && os == Abi::WindowsOS) {
flavor = Abi::WindowsMsvc2019Flavor;
} }
return Abi(arch, os, flavor, format, wordWidth); return Abi(arch, os, flavor, format, wordWidth);

View File

@@ -40,6 +40,7 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QKeyEvent> #include <QKeyEvent>
#include <QPointer> #include <QPointer>
#include <QScreen>
namespace TextEditor { namespace TextEditor {
@@ -366,9 +367,10 @@ void FunctionHintProposalWidget::updateContent()
void FunctionHintProposalWidget::updatePosition() void FunctionHintProposalWidget::updatePosition()
{ {
const QDesktopWidget *desktop = QApplication::desktop(); const QDesktopWidget *desktop = QApplication::desktop();
const int screenNumber = desktop->screenNumber(d->m_underlyingWidget);
auto widgetScreen = QGuiApplication::screens().value(screenNumber, QGuiApplication::primaryScreen());
const QRect &screen = Utils::HostOsInfo::isMacHost() const QRect &screen = Utils::HostOsInfo::isMacHost()
? desktop->availableGeometry(desktop->screenNumber(d->m_underlyingWidget)) ? widgetScreen->availableGeometry() : widgetScreen->geometry();
: desktop->screenGeometry(desktop->screenNumber(d->m_underlyingWidget));
d->m_pager->setFixedWidth(d->m_pager->minimumSizeHint().width()); d->m_pager->setFixedWidth(d->m_pager->minimumSizeHint().width());

View File

@@ -254,16 +254,16 @@ QColor FormatDescription::defaultForeground(TextStyle id)
{ {
if (id == C_LINE_NUMBER) { if (id == C_LINE_NUMBER) {
const QPalette palette = Utils::Theme::initialPalette(); const QPalette palette = Utils::Theme::initialPalette();
const QColor bg = palette.background().color(); const QColor bg = palette.window().color();
if (bg.value() < 128) if (bg.value() < 128)
return palette.foreground().color(); return palette.windowText().color();
else else
return palette.dark().color(); return palette.dark().color();
} else if (id == C_CURRENT_LINE_NUMBER) { } else if (id == C_CURRENT_LINE_NUMBER) {
const QPalette palette = Utils::Theme::initialPalette(); const QPalette palette = Utils::Theme::initialPalette();
const QColor bg = palette.background().color(); const QColor bg = palette.window().color();
if (bg.value() < 128) if (bg.value() < 128)
return palette.foreground().color(); return palette.windowText().color();
else else
return QColor(); return QColor();
} else if (id == C_PARENTHESES) { } else if (id == C_PARENTHESES) {
@@ -279,7 +279,7 @@ QColor FormatDescription::defaultBackground(TextStyle id)
if (id == C_TEXT) { if (id == C_TEXT) {
return Qt::white; return Qt::white;
} else if (id == C_LINE_NUMBER) { } else if (id == C_LINE_NUMBER) {
return Utils::Theme::initialPalette().background().color(); return Utils::Theme::initialPalette().window().color();
} else if (id == C_SEARCH_RESULT) { } else if (id == C_SEARCH_RESULT) {
return QColor(0xffef0b); return QColor(0xffef0b);
} else if (id == C_PARENTHESES) { } else if (id == C_PARENTHESES) {

View File

@@ -431,7 +431,7 @@ struct PaintEventData
, searchResultFormat(fontSettings.toTextCharFormat(C_SEARCH_RESULT)) , searchResultFormat(fontSettings.toTextCharFormat(C_SEARCH_RESULT))
, visualWhitespaceFormat(fontSettings.toTextCharFormat(C_VISUAL_WHITESPACE)) , visualWhitespaceFormat(fontSettings.toTextCharFormat(C_VISUAL_WHITESPACE))
, ifdefedOutFormat(fontSettings.toTextCharFormat(C_DISABLED_CODE)) , ifdefedOutFormat(fontSettings.toTextCharFormat(C_DISABLED_CODE))
, suppressSyntaxInIfdefedOutBlock(ifdefedOutFormat.foreground() != editor->palette().foreground()) , suppressSyntaxInIfdefedOutBlock(ifdefedOutFormat.foreground() != editor->palette().windowText())
{ } { }
QPointF offset; QPointF offset;
const QRect viewportRect; const QRect viewportRect;
@@ -4719,7 +4719,7 @@ void TextEditorWidgetPrivate::paintWidgetBackground(const PaintEventData &data,
&& (q->centerOnScroll() || q->verticalScrollBar()->maximum() == q->verticalScrollBar()->minimum())) { && (q->centerOnScroll() || q->verticalScrollBar()->maximum() == q->verticalScrollBar()->minimum())) {
const QRect backGroundRect(QPoint(data.eventRect.left(), int(data.offset.y())), const QRect backGroundRect(QPoint(data.eventRect.left(), int(data.offset.y())),
data.eventRect.bottomRight()); data.eventRect.bottomRight());
painter.fillRect(backGroundRect, q->palette().background()); painter.fillRect(backGroundRect, q->palette().window());
} }
} }
@@ -8236,7 +8236,7 @@ void TextEditorWidgetPrivate::updateTabStops()
// to be set as an int. A work around is to access directly the QTextOption. // to be set as an int. A work around is to access directly the QTextOption.
qreal charWidth = QFontMetricsF(q->font()).width(QLatin1Char(' ')); qreal charWidth = QFontMetricsF(q->font()).width(QLatin1Char(' '));
QTextOption option = q->document()->defaultTextOption(); QTextOption option = q->document()->defaultTextOption();
option.setTabStop(charWidth * m_document->tabSettings().m_tabSize); option.setTabStopDistance(charWidth * m_document->tabSettings().m_tabSize);
q->document()->setDefaultTextOption(option); q->document()->setDefaultTextOption(option);
} }

View File

@@ -346,7 +346,7 @@ void Visualization::setText(const QString &message)
d->m_scene.clear(); d->m_scene.clear();
QGraphicsSimpleTextItem *textItem = d->m_scene.addSimpleText(message); QGraphicsSimpleTextItem *textItem = d->m_scene.addSimpleText(message);
textItem->setBrush(palette().foreground()); textItem->setBrush(palette().windowText());
textItem->setPos((d->sceneWidth() - textItem->boundingRect().width()) / 2, textItem->setPos((d->sceneWidth() - textItem->boundingRect().width()) / 2,
(d->sceneHeight() - textItem->boundingRect().height()) / 2); (d->sceneHeight() - textItem->boundingRect().height()) / 2);
textItem->setFlag(QGraphicsItem::ItemIgnoresTransformations); textItem->setFlag(QGraphicsItem::ItemIgnoresTransformations);

View File

@@ -179,7 +179,7 @@ QString ProWriter::compileScope(const QString &scope)
ProFile *includeFile = parser.parsedProBlock(QStringRef(&scope), 0, QLatin1String("no-file"), 1); ProFile *includeFile = parser.parsedProBlock(QStringRef(&scope), 0, QLatin1String("no-file"), 1);
if (!includeFile) if (!includeFile)
return QString(); return QString();
QString result = includeFile->items(); const QString result = includeFile->items();
includeFile->deref(); includeFile->deref();
return result.mid(2); // chop of TokLine + linenumber return result.mid(2); // chop of TokLine + linenumber
} }
@@ -307,7 +307,7 @@ void ProWriter::putVarValues(ProFile *profile, QStringList *lines, const QString
const QString &var, PutFlags flags, const QString &scope, const QString &var, PutFlags flags, const QString &scope,
const QString &continuationIndent) const QString &continuationIndent)
{ {
QString indent = scope.isEmpty() ? QString() : continuationIndent; const QString indent = scope.isEmpty() ? QString() : continuationIndent;
const auto effectiveContIndent = [indent, continuationIndent](const ContinuationInfo &ci) { const auto effectiveContIndent = [indent, continuationIndent](const ContinuationInfo &ci) {
return !ci.indent.isEmpty() ? ci.indent : continuationIndent + indent; return !ci.indent.isEmpty() ? ci.indent : continuationIndent + indent;
}; };
@@ -576,8 +576,8 @@ QStringList ProWriter::removeFiles(ProFile *profile, QStringList *lines,
// maybe those files can be found via $$PWD/relativeToPriFile // maybe those files can be found via $$PWD/relativeToPriFile
valuesToFind.clear(); valuesToFind.clear();
QDir baseDir = QFileInfo(profile->fileName()).absoluteDir(); const QDir baseDir = QFileInfo(profile->fileName()).absoluteDir();
QString prefixPwd = QLatin1String("$$PWD/"); const QString prefixPwd = QLatin1String("$$PWD/");
foreach (const QString &absoluteFilePath, notYetChanged) foreach (const QString &absoluteFilePath, notYetChanged)
valuesToFind << (prefixPwd + baseDir.relativeFilePath(absoluteFilePath)); valuesToFind << (prefixPwd + baseDir.relativeFilePath(absoluteFilePath));

View File

@@ -55,6 +55,7 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True):
test.warning("Expected error text found, but is not of type: 'error'") test.warning("Expected error text found, but is not of type: 'error'")
return False return False
else: else:
test.log("Found expected error (%s)" % expectedText)
return True return True
return False return False

View File

@@ -54,7 +54,7 @@ def main():
ensureChecked(waitForObject(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")) ensureChecked(waitForObject(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton"))
issuesView = waitForObject(":Qt Creator.Issues_QListView") issuesView = waitForObject(":Qt Creator.Issues_QListView")
# verify that error is properly reported # verify that error is properly reported
test.verify(checkSyntaxError(issuesView, ["Syntax error"], True), test.verify(checkSyntaxError(issuesView, ["Expected token `:'"], True),
"Verifying QML syntax error while parsing complex qt quick application.") "Verifying QML syntax error while parsing complex qt quick application.")
# exit qt creator # exit qt creator
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")

View File

@@ -41,7 +41,7 @@ def clickItemVerifyHelpCombo(button, expectedHelpComboRegex, testDetails):
"Verifying: '%s' button is being displayed." % getStarted) "Verifying: '%s' button is being displayed." % getStarted)
def buttonActive(button): def buttonActive(button):
# colors of the default theme for active button on Welcome page # colors of the default theme for active button on Welcome page
(activeRed, activeGreen, activeBlue) = (64, 66, 68) (activeRed, activeGreen, activeBlue) = (64, 65, 66)
# QPalette::Window (used background color of Welcome page buttons) # QPalette::Window (used background color of Welcome page buttons)
enumQPaletteWindow = 10 enumQPaletteWindow = 10
color = button.palette.color(enumQPaletteWindow) color = button.palette.color(enumQPaletteWindow)

View File

@@ -49,6 +49,7 @@ public:
WindowsMsvc2013Flavor, WindowsMsvc2013Flavor,
WindowsMsvc2015Flavor, WindowsMsvc2015Flavor,
WindowsMsvc2017Flavor, WindowsMsvc2017Flavor,
WindowsMsvc2019Flavor,
WindowsMSysFlavor, WindowsMSysFlavor,
WindowsCEFlavor, WindowsCEFlavor,