Merge remote-tracking branch 'origin/4.9' into 4.10

Change-Id: I6f1bc9381dc8c0ce8abc5a6c006087076d8fc1bc
This commit is contained in:
Eike Ziller
2019-06-18 11:48:32 +02:00
7 changed files with 19 additions and 23 deletions

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().window()); : commandList()->palette().windowText());
return hasCollision; return hasCollision;
} }

View File

@@ -295,8 +295,10 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags)
{ {
d->m_isStandalone = flags & FlagsStandalone; d->m_isStandalone = flags & FlagsStandalone;
if (d->m_isStandalone) { if (d->m_isStandalone) {
connect(EditorManager::instance(), &EditorManager::currentEditorChanged, connect(EditorManager::instance(),
this, &EditorToolBar::updateEditorListSelection); &EditorManager::currentEditorChanged,
this,
&EditorToolBar::setCurrentEditor);
disconnect(d->m_editorList, QOverload<int>::of(&QComboBox::activated), disconnect(d->m_editorList, QOverload<int>::of(&QComboBox::activated),
this, &EditorToolBar::listSelectionActivated); this, &EditorToolBar::listSelectionActivated);
@@ -327,15 +329,6 @@ void EditorToolBar::setCurrentEditor(IEditor *editor)
updateDocumentStatus(document); updateDocumentStatus(document);
} }
void EditorToolBar::updateEditorListSelection(IEditor *newSelection)
{
if (newSelection) {
const Utils::optional<int> index = DocumentModel::rowOfDocument(newSelection->document());
if (QTC_GUARD(index))
d->m_editorList->setCurrentIndex(index.value());
}
}
void EditorToolBar::changeActiveEditor(int row) void EditorToolBar::changeActiveEditor(int row)
{ {
EditorManager::activateEditorForEntry(DocumentModel::entryAtRow(row)); EditorManager::activateEditorForEntry(DocumentModel::entryAtRow(row));

View File

@@ -105,7 +105,6 @@ private:
void updateActionShortcuts(); void updateActionShortcuts();
void updateDocumentStatus(IDocument *document); void updateDocumentStatus(IDocument *document);
void updateEditorListSelection(IEditor *newSelection);
void fillListContextMenu(QMenu *menu); void fillListContextMenu(QMenu *menu);
void updateToolBar(QWidget *toolBar); void updateToolBar(QWidget *toolBar);

View File

@@ -169,6 +169,7 @@ static bool keyWordReplacement(const QString &keyWord,
const QChar ypsilon = QLatin1Char('y'); const QChar ypsilon = QLatin1Char('y');
if (format.count(ypsilon) == 2) if (format.count(ypsilon) == 2)
format.insert(format.indexOf(ypsilon), QString(2, ypsilon)); format.insert(format.indexOf(ypsilon), QString(2, ypsilon));
format.replace('/', "\\/");
} }
*value = QString::fromLatin1("%{CurrentDate:") + format + QLatin1Char('}'); *value = QString::fromLatin1("%{CurrentDate:") + format + QLatin1Char('}');
return true; return true;
@@ -193,7 +194,6 @@ static void parseLicenseTemplatePlaceholders(QString *t)
{ {
int pos = 0; int pos = 0;
const QChar placeHolder = QLatin1Char('%'); const QChar placeHolder = QLatin1Char('%');
bool isCompatibilityStyle = false;
do { do {
const int placeHolderPos = t->indexOf(placeHolder, pos); const int placeHolderPos = t->indexOf(placeHolder, pos);
if (placeHolderPos == -1) if (placeHolderPos == -1)
@@ -208,7 +208,6 @@ static void parseLicenseTemplatePlaceholders(QString *t)
const QString keyWord = t->mid(placeHolderPos, endPlaceHolderPos + 1 - placeHolderPos); const QString keyWord = t->mid(placeHolderPos, endPlaceHolderPos + 1 - placeHolderPos);
QString replacement; QString replacement;
if (keyWordReplacement(keyWord, &replacement)) { if (keyWordReplacement(keyWord, &replacement)) {
isCompatibilityStyle = true;
t->replace(placeHolderPos, keyWord.size(), replacement); t->replace(placeHolderPos, keyWord.size(), replacement);
pos = placeHolderPos + replacement.size(); pos = placeHolderPos + replacement.size();
} else { } else {
@@ -218,8 +217,6 @@ static void parseLicenseTemplatePlaceholders(QString *t)
} }
} while (pos < t->size()); } while (pos < t->size());
if (isCompatibilityStyle)
t->replace(QLatin1Char('\\'), QLatin1String("\\\\"));
} }
// Convenience that returns the formatted license template. // Convenience that returns the formatted license template.

View File

@@ -293,7 +293,7 @@ HelpPluginPrivate::HelpPluginPrivate()
cmd = ActionManager::registerAction(action, "Help.ReportBug"); cmd = ActionManager::registerAction(action, "Help.ReportBug");
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT);
connect(action, &QAction::triggered, this, [] { connect(action, &QAction::triggered, this, [] {
QDesktopServices::openUrl(QUrl("https://bugreports.qt.io")); QDesktopServices::openUrl(QUrl("https://bugreports.qt.io/secure/CreateIssue.jspa?pid=10512"));
}); });
action = new QAction(HelpPlugin::tr("System Information..."), this); action = new QAction(HelpPlugin::tr("System Information..."), this);

View File

@@ -140,8 +140,9 @@ void PerfResourceCounterTest::testUnitSized()
QList<int> ids; QList<int> ids;
for (int i = 0; i < 10000; ++i) { for (int i = 0; i < 10000; ++i) {
counter.request(1); counter.request(1);
int id = qrand(); const int id = qrand();
counter.obtain(id); counter.obtain(id);
if (id != 0) // Otherwise it's the invalid ID and that means the allocation "failed".
ids.append(id); ids.append(id);
QCOMPARE(counter.currentTotal(), ids.length()); QCOMPARE(counter.currentTotal(), ids.length());
} }

View File

@@ -389,9 +389,15 @@ void ProjectTree::applyTreeManager(FolderNode *folder)
bool ProjectTree::hasNode(const Node *node) bool ProjectTree::hasNode(const Node *node)
{ {
return Utils::contains(SessionManager::projects(), [node](const Project *p) { return Utils::contains(SessionManager::projects(), [node](const Project *p) {
return p && p->rootProjectNode() && ( if (!p)
p->containerNode() == node return false;
|| p->rootProjectNode()->findNode([node](const Node *n) { return n == node; })); if (p->containerNode() == node)
return true;
// When parsing fails we have a living container node but no rootProjectNode.
ProjectNode *pn = p->rootProjectNode();
if (!pn)
return false;
return pn->findNode([node](const Node *n) { return n == node; }) != nullptr;
}); });
} }