forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.9'
Change-Id: I5e5536a7dbaa22e94a14d371917e62fcf92bf6dc
This commit is contained in:
@@ -396,7 +396,7 @@ CodeActionResult::CodeActionResult(const QJsonValue &val)
|
||||
{
|
||||
using ResultArray = QList<Utils::variant<Command, CodeAction>>;
|
||||
if (val.isArray()) {
|
||||
QJsonArray array = val.toArray();
|
||||
const QJsonArray array = val.toArray();
|
||||
ResultArray result;
|
||||
for (const QJsonValue &val : array) {
|
||||
Command command(val);
|
||||
|
@@ -482,7 +482,7 @@ void PluginDumper::runQmlDump(const QmlJS::ModelManagerInterface::ProjectInfo &i
|
||||
process->setEnvironment(info.qmlDumpEnvironment.toStringList());
|
||||
QString workingDir = wd.canonicalPath();
|
||||
process->setWorkingDirectory(workingDir);
|
||||
connect(process, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
|
||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, &PluginDumper::qmlPluginTypeDumpDone);
|
||||
connect(process, &QProcess::errorOccurred, this, &PluginDumper::qmlPluginTypeDumpError);
|
||||
process->start(info.qmlDumpPath, arguments);
|
||||
|
@@ -119,7 +119,7 @@ SftpSession::SftpSession(const QStringList &connectionArgs) : d(new SftpSessionP
|
||||
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;
|
||||
if (d->sftpProc.exitStatus() != QProcess::NormalExit) {
|
||||
emit done(tr("sftp crashed."));
|
||||
|
@@ -114,7 +114,7 @@ SftpTransfer::SftpTransfer(const FilesToTransfer &files, Internal::FileTransferT
|
||||
if (error == QProcess::FailedToStart)
|
||||
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) {
|
||||
emitError(tr("sftp crashed."));
|
||||
return;
|
||||
|
@@ -202,7 +202,7 @@ SshConnection::SshConnection(const SshConnectionParameters &serverInfo, QObject
|
||||
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) {
|
||||
emitDisconnected();
|
||||
return;
|
||||
|
@@ -93,7 +93,7 @@ static QPixmap segmentPixmap(CrumblePathButton::SegmentType type, QStyle::State
|
||||
const QString pixmapKey = QStringLiteral("crumblePath-segment-%1-iconMode-%2-hover-%3")
|
||||
.arg(segmentName).arg(iconMode).arg(hover);
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(pixmapKey, pixmap)) {
|
||||
if (!QPixmapCache::find(pixmapKey, &pixmap)) {
|
||||
const QString maskFileName = QStringLiteral(":/utils/images/crumblepath-segment-%1%2.png")
|
||||
.arg(segmentName).arg(QLatin1String(hover ? "-hover" : ""));
|
||||
pixmap = Icon({{maskFileName, Theme::IconsBaseColor}}).pixmap(iconMode);
|
||||
|
@@ -82,7 +82,7 @@ bool FileUtils::removeRecursively(const FileName &filePath, QString *error)
|
||||
QFile::setPermissions(filePath.toString(), fileInfo.permissions() | QFile::WriteUser);
|
||||
if (fileInfo.isDir()) {
|
||||
QDir dir(filePath.toString());
|
||||
dir = dir.canonicalPath();
|
||||
dir.setPath(dir.canonicalPath());
|
||||
if (dir.isRoot()) {
|
||||
if (error) {
|
||||
*error = QCoreApplication::translate("Utils::FileUtils",
|
||||
|
@@ -58,19 +58,11 @@ public:
|
||||
|
||||
void QtColorButtonPrivate::slotEditColor()
|
||||
{
|
||||
QColor newColor;
|
||||
if (m_alphaAllowed) {
|
||||
bool ok;
|
||||
const QRgb rgba = QColorDialog::getRgba(m_color.rgba(), &ok, q_ptr);
|
||||
if (!ok)
|
||||
return;
|
||||
newColor = QColor::fromRgba(rgba);
|
||||
} else {
|
||||
newColor = QColorDialog::getColor(m_color, q_ptr);
|
||||
if (!newColor.isValid())
|
||||
return;
|
||||
}
|
||||
if (newColor == q_ptr->color())
|
||||
QColorDialog::ColorDialogOptions options;
|
||||
if (m_alphaAllowed)
|
||||
options |= QColorDialog::ShowAlphaChannel;
|
||||
const QColor newColor = QColorDialog::getColor(m_color, q_ptr, QString(), options);
|
||||
if (!newColor.isValid() || newColor == q_ptr->color())
|
||||
return;
|
||||
q_ptr->setColor(newColor);
|
||||
emit q_ptr->colorChanged(m_color);
|
||||
@@ -243,7 +235,7 @@ void QtColorButton::mouseMoveEvent(QMouseEvent *event)
|
||||
drg->setPixmap(d_ptr->generatePixmap());
|
||||
setDown(false);
|
||||
event->accept();
|
||||
drg->start();
|
||||
drg->exec(Qt::CopyAction);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@@ -216,7 +216,7 @@ void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, con
|
||||
clipRect.height(), keyColor.rgb());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, pixmap)) {
|
||||
if (!QPixmapCache::find(key, &pixmap)) {
|
||||
pixmap = QPixmap(clipRect.size());
|
||||
QPainter p(&pixmap);
|
||||
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());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, pixmap)) {
|
||||
if (!QPixmapCache::find(key, &pixmap)) {
|
||||
pixmap = QPixmap(clipRect.size());
|
||||
QPainter p(&pixmap);
|
||||
QRect rect = QRect(0, 0, clipRect.width(), clipRect.height());
|
||||
@@ -312,7 +312,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
||||
QString pixmapName;
|
||||
pixmapName.sprintf("StyleHelper::drawArrow-%d-%d-%d-%f",
|
||||
element, size, enabled, devicePixelRatio);
|
||||
if (!QPixmapCache::find(pixmapName, pixmap)) {
|
||||
if (!QPixmapCache::find(pixmapName, &pixmap)) {
|
||||
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
|
||||
image.fill(Qt::transparent);
|
||||
QPainter painter(&image);
|
||||
@@ -357,7 +357,7 @@ void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const Q
|
||||
clipRect.height(), StyleHelper::baseColor().rgb());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, pixmap)) {
|
||||
if (!QPixmapCache::find(key, &pixmap)) {
|
||||
pixmap = QPixmap(clipRect.size());
|
||||
QPainter p(&pixmap);
|
||||
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")
|
||||
.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
|
||||
// device-independent pixels. The call to QIcon::pixmap() below might
|
||||
// return a high-dpi pixmap, which will in that case have a devicePixelRatio
|
||||
|
@@ -132,8 +132,8 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
if (!m_selectedPixmap)
|
||||
generateGradientPixmap(lwidth, fm.height()+1, backgroundColor, selected);
|
||||
} else {
|
||||
painter->setBrush(opt.palette.background().color());
|
||||
backgroundColor = opt.palette.background().color();
|
||||
backgroundColor = opt.palette.window().color();
|
||||
painter->setBrush(backgroundColor);
|
||||
if (!m_normalPixmap)
|
||||
generateGradientPixmap(lwidth, fm.height(), backgroundColor, selected);
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QHash>
|
||||
#include <QLabel>
|
||||
#include <QScreen>
|
||||
#include <QTextDocument>
|
||||
#include <QUrl>
|
||||
|
||||
@@ -385,7 +386,10 @@ private:
|
||||
|
||||
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:
|
||||
|
@@ -27,33 +27,30 @@
|
||||
#include "ui_externaltoolconfig.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/environmentdialog.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/environmentdialog.h>
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/variablechooser.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QTextStream>
|
||||
#include <QMimeData>
|
||||
#include <QMenu>
|
||||
#include <QMimeData>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QTextStream>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
|
||||
|
||||
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 TOOL_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsEditable;
|
||||
|
||||
// #pragma mark -- ExternalToolModel
|
||||
|
||||
ExternalToolModel::ExternalToolModel(QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
{
|
||||
@@ -133,7 +130,7 @@ QMimeData *ExternalToolModel::mimeData(const QModelIndexList &indexes) const
|
||||
QByteArray ba;
|
||||
QDataStream stream(&ba, QIODevice::WriteOnly);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -149,7 +146,7 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data,
|
||||
bool found;
|
||||
QString toCategory = categoryForIndex(parent, &found);
|
||||
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())
|
||||
return false;
|
||||
QDataStream stream(&ba, QIODevice::ReadOnly);
|
||||
@@ -309,7 +306,7 @@ void ExternalToolModel::revertTool(const QModelIndex &modelIndex)
|
||||
ExternalTool *tool = toolForIndex(modelIndex);
|
||||
QTC_ASSERT(tool, 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());
|
||||
(*tool) = (*resetTool);
|
||||
delete resetTool;
|
||||
@@ -350,10 +347,10 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
|
||||
//: Sample external tool text
|
||||
const QString text = tr("Useful text");
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
tool->setExecutables(QStringList(QLatin1String("cmd")));
|
||||
tool->setArguments(QLatin1String("/c echo ") + text);
|
||||
tool->setExecutables({"cmd"});
|
||||
tool->setArguments("/c echo " + text);
|
||||
} else {
|
||||
tool->setExecutables(QStringList(QLatin1String("echo")));
|
||||
tool->setExecutables({"echo"});
|
||||
tool->setArguments(text);
|
||||
}
|
||||
|
||||
@@ -395,8 +392,6 @@ void ExternalToolModel::removeTool(const QModelIndex &modelIndex)
|
||||
delete tool;
|
||||
}
|
||||
|
||||
// #pragma mark -- ExternalToolConfig
|
||||
|
||||
static void fillBaseEnvironmentComboBox(QComboBox *box)
|
||||
{
|
||||
box->clear();
|
||||
@@ -411,6 +406,7 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
|
||||
m_model(new ExternalToolModel(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->executable->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
ui->scrollArea->viewport()->setAutoFillBackground(false);
|
||||
ui->scrollAreaWidgetContents->setAutoFillBackground(false);
|
||||
ui->toolTree->setModel(m_model);
|
||||
@@ -433,7 +429,8 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
|
||||
this, &ExternalToolConfig::updateCurrentItem);
|
||||
connect(ui->executable, &Utils::PathChooser::browsingFinished,
|
||||
this, &ExternalToolConfig::updateCurrentItem);
|
||||
connect(ui->arguments, &QLineEdit::editingFinished, this, &ExternalToolConfig::updateCurrentItem);
|
||||
connect(ui->arguments, &QLineEdit::editingFinished,
|
||||
this, &ExternalToolConfig::updateCurrentItem);
|
||||
connect(ui->arguments, &QLineEdit::editingFinished,
|
||||
this, &ExternalToolConfig::updateEffectiveArguments);
|
||||
connect(ui->workingDirectory, &Utils::PathChooser::editingFinished,
|
||||
@@ -442,28 +439,30 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
|
||||
this, &ExternalToolConfig::updateCurrentItem);
|
||||
connect(ui->environmentButton, &QAbstractButton::clicked,
|
||||
this, &ExternalToolConfig::editEnvironmentChanges);
|
||||
connect(ui->outputBehavior, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
|
||||
connect(ui->outputBehavior, QOverload<int>::of(&QComboBox::activated),
|
||||
this, &ExternalToolConfig::updateCurrentItem);
|
||||
connect(ui->errorOutputBehavior, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
|
||||
connect(ui->errorOutputBehavior, QOverload<int>::of(&QComboBox::activated),
|
||||
this, &ExternalToolConfig::updateCurrentItem);
|
||||
connect(ui->modifiesDocumentCheckbox, &QAbstractButton::clicked,
|
||||
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->removeButton, &QAbstractButton::clicked, this, &ExternalToolConfig::removeTool);
|
||||
connect(ui->revertButton, &QAbstractButton::clicked,
|
||||
this, &ExternalToolConfig::revertCurrentItem);
|
||||
connect(ui->removeButton, &QAbstractButton::clicked,
|
||||
this, &ExternalToolConfig::removeTool);
|
||||
|
||||
auto menu = new QMenu(ui->addButton);
|
||||
ui->addButton->setMenu(menu);
|
||||
QAction *addTool = new QAction(tr("Add Tool"), this);
|
||||
auto addTool = new QAction(tr("Add Tool"), this);
|
||||
menu->addAction(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);
|
||||
connect(addCategory, &QAction::triggered, this, &ExternalToolConfig::addCategory);
|
||||
|
||||
showInfoForItem(QModelIndex());
|
||||
|
||||
}
|
||||
|
||||
ExternalToolConfig::~ExternalToolConfig()
|
||||
@@ -478,7 +477,7 @@ void ExternalToolConfig::setTools(const QMap<QString, QList<ExternalTool *> > &t
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
QList<ExternalTool *> itemCopy;
|
||||
foreach (ExternalTool *tool, it.value())
|
||||
for (ExternalTool *tool : it.value())
|
||||
itemCopy.append(new ExternalTool(tool));
|
||||
toolsCopy.insert(it.key(), itemCopy);
|
||||
}
|
||||
@@ -648,7 +647,7 @@ void ExternalToolConfig::editEnvironmentChanges()
|
||||
|
||||
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());
|
||||
shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, ui->environmentLabel->width());
|
||||
ui->environmentLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") : shortSummary);
|
||||
|
@@ -27,9 +27,9 @@
|
||||
|
||||
#include "../externaltool.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QPlainTextEdit)
|
||||
|
||||
|
@@ -552,7 +552,7 @@ bool ShortcutSettingsWidget::markCollisions(ShortcutItem *item)
|
||||
}
|
||||
item->m_item->setForeground(2, hasCollision
|
||||
? Utils::creatorTheme()->color(Utils::Theme::TextColorError)
|
||||
: commandList()->palette().foreground());
|
||||
: commandList()->palette().window());
|
||||
return hasCollision;
|
||||
}
|
||||
|
||||
|
@@ -104,7 +104,7 @@ bool HelpItem::isValid() const
|
||||
{
|
||||
if (m_helpUrl.isEmpty() && m_helpIds.isEmpty())
|
||||
return false;
|
||||
return !links().isEmpty();
|
||||
return !links().empty();
|
||||
}
|
||||
|
||||
QString HelpItem::extractContent(bool extended) const
|
||||
@@ -116,7 +116,8 @@ QString HelpItem::extractContent(bool extended) const
|
||||
htmlExtractor.setMode(Utils::HtmlDocExtractor::FirstParagraph);
|
||||
|
||||
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));
|
||||
switch (m_category) {
|
||||
case Brief:
|
||||
@@ -157,50 +158,124 @@ QString HelpItem::extractContent(bool extended) const
|
||||
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_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 {
|
||||
m_helpLinks.emplace(); // set a value even if there are no help IDs
|
||||
QMap<QString, QUrl> helpLinks;
|
||||
for (const QString &id : m_helpIds) {
|
||||
m_helpLinks = Core::HelpManager::linksForIdentifier(id);
|
||||
if (!m_helpLinks->isEmpty())
|
||||
helpLinks = Core::HelpManager::linksForIdentifier(id);
|
||||
if (!helpLinks.isEmpty()) {
|
||||
m_keyword = id;
|
||||
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;
|
||||
}
|
||||
|
||||
static QUrl findBestLink(const QMap<QString, QUrl> &links)
|
||||
static const HelpItem::Links getBestLinks(const HelpItem::Links &links)
|
||||
{
|
||||
if (links.isEmpty())
|
||||
return QUrl();
|
||||
if (links.size() == 1)
|
||||
return links.first();
|
||||
QUrl source = links.first();
|
||||
// workaround to show the latest Qt version
|
||||
int version = 0;
|
||||
QRegExp exp("(\\d+)");
|
||||
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;
|
||||
}
|
||||
}
|
||||
// extract the highest version (== first) link of each individual topic
|
||||
HelpItem::Links bestLinks;
|
||||
QUrl currentUnversionedUrl;
|
||||
for (const HelpItem::Link &link : links) {
|
||||
const QUrl unversionedUrl = extractVersion(link.second).first;
|
||||
if (unversionedUrl != currentUnversionedUrl) {
|
||||
currentUnversionedUrl = unversionedUrl;
|
||||
bestLinks.push_back(link);
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@@ -29,16 +29,20 @@
|
||||
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class CORE_EXPORT HelpItem
|
||||
{
|
||||
public:
|
||||
using Link = std::pair<QString, QUrl>;
|
||||
using Links = std::vector<Link>;
|
||||
|
||||
enum Category {
|
||||
ClassOrNamespace,
|
||||
Enum,
|
||||
@@ -77,15 +81,18 @@ public:
|
||||
|
||||
QString extractContent(bool extended) const;
|
||||
|
||||
const QMap<QString, QUrl> &links() const;
|
||||
const QUrl bestLink() const;
|
||||
const Links &links() const;
|
||||
const Links bestLinks() const;
|
||||
const QString keyword() const;
|
||||
|
||||
private:
|
||||
QUrl m_helpUrl;
|
||||
QStringList m_helpIds;
|
||||
QString m_docMark;
|
||||
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
|
||||
|
@@ -91,6 +91,11 @@ QMap<QString, QUrl> linksForIdentifier(const QString &id)
|
||||
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)
|
||||
{
|
||||
return checkInstance() ? m_instance->fileData(url) : QByteArray();
|
||||
|
@@ -64,6 +64,7 @@ CORE_EXPORT void registerDocumentation(const QStringList &fileNames);
|
||||
CORE_EXPORT void unregisterDocumentation(const QStringList &nameSpaces);
|
||||
|
||||
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 void showHelpUrl(const QUrl &url, HelpViewerLocation location = HelpModeAlways);
|
||||
|
@@ -41,6 +41,7 @@ public:
|
||||
virtual void registerDocumentation(const QStringList &fileNames) = 0;
|
||||
virtual void unregisterDocumentation(const QStringList &nameSpaces) = 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 void showHelpUrl(const QUrl &url, HelpViewerLocation location = HelpModeAlways) = 0;
|
||||
};
|
||||
|
@@ -53,7 +53,7 @@ CppcheckRunner::CppcheckRunner(CppcheckTool &tool) :
|
||||
this, &CppcheckRunner::readError);
|
||||
connect(m_process, &QProcess::started,
|
||||
this, &CppcheckRunner::handleStarted);
|
||||
connect(m_process, QOverload<int>::of(&QProcess::finished),
|
||||
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, &CppcheckRunner::handleFinished);
|
||||
|
||||
m_queueTimer.setSingleShot(true);
|
||||
|
@@ -203,7 +203,7 @@ CdbEngine::CdbEngine() :
|
||||
|
||||
connect(action(CreateFullBacktrace), &QAction::triggered,
|
||||
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);
|
||||
connect(&m_process, &QProcess::errorOccurred, this, &CdbEngine::processError);
|
||||
connect(&m_process, &QProcess::readyReadStandardOutput,
|
||||
|
@@ -105,7 +105,7 @@ public:
|
||||
this, &LocalProcessRunner::handleStandardOutput);
|
||||
connect(&m_proc, &QProcess::readyReadStandardError,
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ private:
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
const QString msg = DebuggerRunTool::tr("Unpacking core file to %1");
|
||||
|
@@ -62,6 +62,7 @@
|
||||
#include <QDesktopWidget>
|
||||
#include <QFileInfo>
|
||||
#include <QLabel>
|
||||
#include <QScreen>
|
||||
#include <QScrollBar>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStack>
|
||||
@@ -624,7 +625,10 @@ void DebuggerToolTipWidget::computeSize()
|
||||
// touch the border of the screen.
|
||||
QPoint pos(x(), y());
|
||||
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 maxHeight = desktopRect.bottom() - pos.y() - 5 - 5;
|
||||
|
||||
|
@@ -409,7 +409,7 @@ void ThreadsHandler::setThreads(const GdbMi &data)
|
||||
if (!m_currentThread && threads.childCount() > 0)
|
||||
m_currentThread = rootItem()->childAt(0);
|
||||
|
||||
if (!m_currentThread) {
|
||||
if (m_currentThread) {
|
||||
const QModelIndex currentThreadIndex = m_currentThread->index();
|
||||
threadSwitcher()->setCurrentIndex(currentThreadIndex.row());
|
||||
}
|
||||
|
@@ -396,7 +396,7 @@ void SideDiffEditorWidget::paintSeparator(QPainter &painter,
|
||||
if (!foreground.isValid())
|
||||
foreground = m_textForeground;
|
||||
if (!foreground.isValid())
|
||||
foreground = palette().foreground().color();
|
||||
foreground = palette().windowText().color();
|
||||
|
||||
painter.setPen(foreground);
|
||||
|
||||
|
@@ -248,7 +248,7 @@ void ChangeSelectionDialog::recalculateDetails()
|
||||
m_process->setWorkingDirectory(workingDir);
|
||||
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);
|
||||
|
||||
m_process->start(m_gitExecutable.toString(), {"show", "--decorate", "--stat=80", ref});
|
||||
|
@@ -2386,7 +2386,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
process->start(binary, arguments);
|
||||
success = process->waitForStarted();
|
||||
if (success)
|
||||
connect(process, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
|
||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
process, &QProcess::deleteLater);
|
||||
else
|
||||
delete process;
|
||||
|
@@ -65,7 +65,8 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
|
||||
VcsOutputWindow::appendCommand(workingDirectory, binary, arguments);
|
||||
m_process->start(binary.toString(), arguments);
|
||||
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);
|
||||
} else {
|
||||
delete m_process;
|
||||
|
@@ -141,7 +141,7 @@ void HelpIndexFilter::accept(LocatorFilterEntry selection,
|
||||
Q_UNUSED(selectionStart)
|
||||
Q_UNUSED(selectionLength)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -54,8 +54,8 @@ public:
|
||||
static void registerUserDocumentation(const QStringList &filePaths);
|
||||
static QSet<QString> userDocumentationPaths();
|
||||
|
||||
static QMap<QString, QUrl> linksForKeyword(const QString &key);
|
||||
QMap<QString, QUrl> linksForIdentifier(const QString &id) override;
|
||||
QMap<QString, QUrl> linksForKeyword(const QString &key) override;
|
||||
|
||||
static QUrl findFile(const QUrl &url);
|
||||
QByteArray fileData(const QUrl &url) override;
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include "searchwidget.h"
|
||||
#include "searchtaskhandler.h"
|
||||
#include "textbrowserhelpviewer.h"
|
||||
#include "topicchooser.h"
|
||||
|
||||
#ifdef QTC_MAC_NATIVE_HELPVIEWER
|
||||
#include "macwebkithelpviewer.h"
|
||||
@@ -636,8 +637,8 @@ void HelpPluginPrivate::requestContextHelp()
|
||||
|
||||
void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp)
|
||||
{
|
||||
const QUrl source = contextHelp.bestLink();
|
||||
if (!source.isValid()) {
|
||||
const HelpItem::Links links = contextHelp.bestLinks();
|
||||
if (links.empty()) {
|
||||
// No link found or no context object
|
||||
HelpViewer *viewer = showHelpUrl(QUrl(Help::Constants::AboutBlank),
|
||||
LocalHelpManager::contextHelpOption());
|
||||
@@ -653,8 +654,19 @@ void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp)
|
||||
.arg(contextHelp.helpIds().join(", "))
|
||||
.arg(HelpPlugin::tr("No documentation available.")));
|
||||
}
|
||||
} else if (links.size() == 1) {
|
||||
showHelpUrl(links.front().second, LocalHelpManager::contextHelpOption());
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -112,6 +112,7 @@ static void setupPreregisteredOsFlavors() {
|
||||
registerOsFlavor(Abi::WindowsMsvc2013Flavor, "msvc2013", {Abi::OS::WindowsOS});
|
||||
registerOsFlavor(Abi::WindowsMsvc2015Flavor, "msvc2015", {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::WindowsCEFlavor, "ce", {Abi::OS::WindowsOS});
|
||||
registerOsFlavor(Abi::VxWorksFlavor, "vxworks", {Abi::OS::VxWorks});
|
||||
@@ -279,12 +280,15 @@ static QList<Abi> parseCoffHeader(const QByteArray &data)
|
||||
flavor = Abi::WindowsMsvc2013Flavor;
|
||||
break;
|
||||
case 14:
|
||||
flavor = minorLinker >= quint8(10)
|
||||
? Abi::WindowsMsvc2017Flavor // MSVC2017 RC
|
||||
: Abi::WindowsMsvc2015Flavor;
|
||||
if (minorLinker >= quint8(20))
|
||||
flavor = Abi::WindowsMsvc2019Flavor;
|
||||
else if (minorLinker >= quint8(10))
|
||||
flavor = Abi::WindowsMsvc2017Flavor;
|
||||
else
|
||||
flavor = Abi::WindowsMsvc2015Flavor;
|
||||
break;
|
||||
case 15:
|
||||
flavor = Abi::WindowsMsvc2017Flavor;
|
||||
flavor = Abi::WindowsMsvc2019Flavor;
|
||||
break;
|
||||
default: // Keep unknown flavor
|
||||
if (minorLinker != 0)
|
||||
@@ -589,6 +593,13 @@ bool Abi::operator == (const Abi &other) const
|
||||
&& 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
|
||||
{
|
||||
// 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))
|
||||
isCompat = (architecture() == other.architecture()) && (osFlavor() == other.osFlavor());
|
||||
|
||||
// MSVC2017 is compatible with MSVC2015
|
||||
if (!isCompat
|
||||
&& ((osFlavor() == WindowsMsvc2015Flavor && other.osFlavor() == WindowsMsvc2017Flavor)
|
||||
|| (osFlavor() == WindowsMsvc2017Flavor && other.osFlavor() == WindowsMsvc2015Flavor))) {
|
||||
if (!isCompat && compatibleMSVCFlavors(osFlavor(), other.osFlavor()))
|
||||
isCompat = true;
|
||||
}
|
||||
|
||||
return isCompat;
|
||||
}
|
||||
|
||||
@@ -896,6 +904,8 @@ bool Abi::osSupportsFlavor(const Abi::OS &os, const Abi::OSFlavor &flavor)
|
||||
|
||||
Abi::OSFlavor Abi::flavorForMsvcVersion(int version)
|
||||
{
|
||||
if (version >= 1920)
|
||||
return WindowsMsvc2019Flavor;
|
||||
if (version >= 1910)
|
||||
return WindowsMsvc2017Flavor;
|
||||
switch (version) {
|
||||
|
@@ -89,6 +89,7 @@ public:
|
||||
WindowsMsvc2013Flavor,
|
||||
WindowsMsvc2015Flavor,
|
||||
WindowsMsvc2017Flavor,
|
||||
WindowsMsvc2019Flavor,
|
||||
WindowsMSysFlavor,
|
||||
WindowsCEFlavor,
|
||||
|
||||
|
@@ -185,7 +185,7 @@ bool BuildStepList::removeStep(int position)
|
||||
|
||||
void BuildStepList::moveStepUp(int position)
|
||||
{
|
||||
m_steps.swap(position - 1, position);
|
||||
m_steps.swapItemsAt(position - 1, position);
|
||||
emit stepMoved(position, position - 1);
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ DesktopDeviceProcess::DesktopDeviceProcess(const QSharedPointer<const IDevice> &
|
||||
: DeviceProcess(device, parent)
|
||||
{
|
||||
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);
|
||||
connect(&m_process, &QProcess::readyReadStandardOutput,
|
||||
this, &DeviceProcess::readyReadStandardOutput);
|
||||
|
@@ -384,7 +384,9 @@ static Abi findAbiOfMsvc(MsvcToolChain::Type type,
|
||||
else if (version == QLatin1String("v7.0A") || version == QLatin1String("v7.1"))
|
||||
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;
|
||||
else if (msvcVersionString.startsWith(QLatin1String("14.")))
|
||||
flavor = Abi::WindowsMsvc2015Flavor;
|
||||
@@ -955,6 +957,12 @@ Utils::FileNameList MsvcToolChain::suggestedMkspecList() const
|
||||
<< Utils::FileName::fromLatin1("winrt-x86-msvc2017")
|
||||
<< Utils::FileName::fromLatin1("winrt-x64-msvc2017");
|
||||
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:
|
||||
result.clear();
|
||||
break;
|
||||
|
@@ -1176,7 +1176,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
|
||||
|
||||
// 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,
|
||||
projecTreeContext);
|
||||
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
|
||||
|
@@ -758,8 +758,8 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
painter->setBrush(opt.palette.highlight().color());
|
||||
backgroundColor = opt.palette.highlight().color();
|
||||
} else {
|
||||
painter->setBrush(opt.palette.background().color());
|
||||
backgroundColor = opt.palette.background().color();
|
||||
painter->setBrush(opt.palette.window().color());
|
||||
backgroundColor = opt.palette.window().color();
|
||||
}
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->drawRect(opt.rect);
|
||||
|
@@ -105,6 +105,14 @@ void DesktopQmakeRunConfiguration::updateTargetInformation()
|
||||
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 &)
|
||||
{
|
||||
updateTargetInformation();
|
||||
|
@@ -43,6 +43,7 @@ public:
|
||||
|
||||
private:
|
||||
void updateTargetInformation();
|
||||
bool fromMap(const QVariantMap &map) final;
|
||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
|
||||
|
||||
QString defaultDisplayName();
|
||||
|
@@ -1098,7 +1098,7 @@ QString InternalLibraryDetailsController::snippet() const
|
||||
QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
|
||||
if (ProjectExplorer::Target *t = project->activeTarget())
|
||||
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
|
||||
QFileInfo pfi(rootBuildDir.filePath(proRelavitePath));
|
||||
|
@@ -147,7 +147,6 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum
|
||||
{
|
||||
QString moduleName = getModuleName(scopeChain, qmlDocument, value);
|
||||
|
||||
QString helpId;
|
||||
QStringList helpIdCandidates;
|
||||
|
||||
QStringList helpIdPieces(qName);
|
||||
@@ -168,7 +167,7 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum
|
||||
helpIdCandidates += helpIdPieces.join('.');
|
||||
|
||||
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.
|
||||
QRegularExpression version("^([^\\d]*)(\\d+)\\.*\\d*$");
|
||||
@@ -176,10 +175,10 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum
|
||||
if (m.hasMatch()) {
|
||||
QMap<QString, QUrl> filteredUrlMap;
|
||||
QStringRef maj = m.capturedRef(2);
|
||||
for (auto x = urlMap.begin(); x != urlMap.end(); ++x) {
|
||||
QString urlModuleName = x.value().path().split('/')[1];
|
||||
for (const HelpItem::Link &link : links) {
|
||||
QString urlModuleName = link.second.path().split('/')[1];
|
||||
if (urlModuleName.contains(maj))
|
||||
filteredUrlMap.insert(x.key(), x.value());
|
||||
filteredUrlMap.insert(link.first, link.second);
|
||||
}
|
||||
if (!filteredUrlMap.isEmpty()) {
|
||||
// Use the URL, to disambiguate different versions
|
||||
|
@@ -1634,7 +1634,7 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<ProKey, ProString> &ve
|
||||
}
|
||||
if (!qt5) {
|
||||
//resolve mkspec link
|
||||
QString rspec = mkspecFullPath.toFileInfo().readLink();
|
||||
QString rspec = mkspecFullPath.toFileInfo().symLinkTarget();
|
||||
if (!rspec.isEmpty())
|
||||
mkspecFullPath = FileName::fromUserInput(
|
||||
QDir(baseMkspecDir.toString()).absoluteFilePath(rspec));
|
||||
@@ -1963,6 +1963,8 @@ static Abi refineAbiFromBuildString(const QByteArray &buildString, const Abi &pr
|
||||
flavor = Abi::WindowsMsvc2015Flavor;
|
||||
} else if (compiler.startsWith("MSVC 2017") && os == Abi::WindowsOS) {
|
||||
flavor = Abi::WindowsMsvc2017Flavor;
|
||||
} else if (compiler.startsWith("MSVC 2019") && os == Abi::WindowsOS) {
|
||||
flavor = Abi::WindowsMsvc2019Flavor;
|
||||
}
|
||||
|
||||
return Abi(arch, os, flavor, format, wordWidth);
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <QDesktopWidget>
|
||||
#include <QKeyEvent>
|
||||
#include <QPointer>
|
||||
#include <QScreen>
|
||||
|
||||
namespace TextEditor {
|
||||
|
||||
@@ -366,9 +367,10 @@ void FunctionHintProposalWidget::updateContent()
|
||||
void FunctionHintProposalWidget::updatePosition()
|
||||
{
|
||||
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()
|
||||
? desktop->availableGeometry(desktop->screenNumber(d->m_underlyingWidget))
|
||||
: desktop->screenGeometry(desktop->screenNumber(d->m_underlyingWidget));
|
||||
? widgetScreen->availableGeometry() : widgetScreen->geometry();
|
||||
|
||||
d->m_pager->setFixedWidth(d->m_pager->minimumSizeHint().width());
|
||||
|
||||
|
@@ -254,16 +254,16 @@ QColor FormatDescription::defaultForeground(TextStyle id)
|
||||
{
|
||||
if (id == C_LINE_NUMBER) {
|
||||
const QPalette palette = Utils::Theme::initialPalette();
|
||||
const QColor bg = palette.background().color();
|
||||
const QColor bg = palette.window().color();
|
||||
if (bg.value() < 128)
|
||||
return palette.foreground().color();
|
||||
return palette.windowText().color();
|
||||
else
|
||||
return palette.dark().color();
|
||||
} else if (id == C_CURRENT_LINE_NUMBER) {
|
||||
const QPalette palette = Utils::Theme::initialPalette();
|
||||
const QColor bg = palette.background().color();
|
||||
const QColor bg = palette.window().color();
|
||||
if (bg.value() < 128)
|
||||
return palette.foreground().color();
|
||||
return palette.windowText().color();
|
||||
else
|
||||
return QColor();
|
||||
} else if (id == C_PARENTHESES) {
|
||||
@@ -279,7 +279,7 @@ QColor FormatDescription::defaultBackground(TextStyle id)
|
||||
if (id == C_TEXT) {
|
||||
return Qt::white;
|
||||
} else if (id == C_LINE_NUMBER) {
|
||||
return Utils::Theme::initialPalette().background().color();
|
||||
return Utils::Theme::initialPalette().window().color();
|
||||
} else if (id == C_SEARCH_RESULT) {
|
||||
return QColor(0xffef0b);
|
||||
} else if (id == C_PARENTHESES) {
|
||||
|
@@ -431,7 +431,7 @@ struct PaintEventData
|
||||
, searchResultFormat(fontSettings.toTextCharFormat(C_SEARCH_RESULT))
|
||||
, visualWhitespaceFormat(fontSettings.toTextCharFormat(C_VISUAL_WHITESPACE))
|
||||
, ifdefedOutFormat(fontSettings.toTextCharFormat(C_DISABLED_CODE))
|
||||
, suppressSyntaxInIfdefedOutBlock(ifdefedOutFormat.foreground() != editor->palette().foreground())
|
||||
, suppressSyntaxInIfdefedOutBlock(ifdefedOutFormat.foreground() != editor->palette().windowText())
|
||||
{ }
|
||||
QPointF offset;
|
||||
const QRect viewportRect;
|
||||
@@ -4719,7 +4719,7 @@ void TextEditorWidgetPrivate::paintWidgetBackground(const PaintEventData &data,
|
||||
&& (q->centerOnScroll() || q->verticalScrollBar()->maximum() == q->verticalScrollBar()->minimum())) {
|
||||
const QRect backGroundRect(QPoint(data.eventRect.left(), int(data.offset.y())),
|
||||
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.
|
||||
qreal charWidth = QFontMetricsF(q->font()).width(QLatin1Char(' '));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -346,7 +346,7 @@ void Visualization::setText(const QString &message)
|
||||
d->m_scene.clear();
|
||||
|
||||
QGraphicsSimpleTextItem *textItem = d->m_scene.addSimpleText(message);
|
||||
textItem->setBrush(palette().foreground());
|
||||
textItem->setBrush(palette().windowText());
|
||||
textItem->setPos((d->sceneWidth() - textItem->boundingRect().width()) / 2,
|
||||
(d->sceneHeight() - textItem->boundingRect().height()) / 2);
|
||||
textItem->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
|
@@ -179,7 +179,7 @@ QString ProWriter::compileScope(const QString &scope)
|
||||
ProFile *includeFile = parser.parsedProBlock(QStringRef(&scope), 0, QLatin1String("no-file"), 1);
|
||||
if (!includeFile)
|
||||
return QString();
|
||||
QString result = includeFile->items();
|
||||
const QString result = includeFile->items();
|
||||
includeFile->deref();
|
||||
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 &continuationIndent)
|
||||
{
|
||||
QString indent = scope.isEmpty() ? QString() : continuationIndent;
|
||||
const QString indent = scope.isEmpty() ? QString() : continuationIndent;
|
||||
const auto effectiveContIndent = [indent, continuationIndent](const ContinuationInfo &ci) {
|
||||
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
|
||||
|
||||
valuesToFind.clear();
|
||||
QDir baseDir = QFileInfo(profile->fileName()).absoluteDir();
|
||||
QString prefixPwd = QLatin1String("$$PWD/");
|
||||
const QDir baseDir = QFileInfo(profile->fileName()).absoluteDir();
|
||||
const QString prefixPwd = QLatin1String("$$PWD/");
|
||||
foreach (const QString &absoluteFilePath, notYetChanged)
|
||||
valuesToFind << (prefixPwd + baseDir.relativeFilePath(absoluteFilePath));
|
||||
|
||||
|
@@ -55,6 +55,7 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True):
|
||||
test.warning("Expected error text found, but is not of type: 'error'")
|
||||
return False
|
||||
else:
|
||||
test.log("Found expected error (%s)" % expectedText)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@@ -54,7 +54,7 @@ def main():
|
||||
ensureChecked(waitForObject(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton"))
|
||||
issuesView = waitForObject(":Qt Creator.Issues_QListView")
|
||||
# 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.")
|
||||
# exit qt creator
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
@@ -41,7 +41,7 @@ def clickItemVerifyHelpCombo(button, expectedHelpComboRegex, testDetails):
|
||||
"Verifying: '%s' button is being displayed." % getStarted)
|
||||
def buttonActive(button):
|
||||
# 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)
|
||||
enumQPaletteWindow = 10
|
||||
color = button.palette.color(enumQPaletteWindow)
|
||||
|
@@ -49,6 +49,7 @@ public:
|
||||
WindowsMsvc2013Flavor,
|
||||
WindowsMsvc2015Flavor,
|
||||
WindowsMsvc2017Flavor,
|
||||
WindowsMsvc2019Flavor,
|
||||
WindowsMSysFlavor,
|
||||
WindowsCEFlavor,
|
||||
|
||||
|
Reference in New Issue
Block a user