Merge remote-tracking branch 'origin/4.12'

Conflicts:
	src/plugins/cmakeprojectmanager/tealeafreader.cpp
	src/plugins/cmakeprojectmanager/tealeafreader.h
	src/plugins/projectexplorer/miniprojecttargetselector.cpp

Change-Id: I88d85be3903f57a55fddb7901e771a4822db1b85
This commit is contained in:
Eike Ziller
2020-03-04 08:15:50 +01:00
368 changed files with 8945 additions and 6485 deletions

View File

@@ -622,16 +622,6 @@ void SubmitEditorWidget::checkAllToggled()
d->m_ui.checkAllCheckBox->setTristate(false);
}
void SubmitEditorWidget::checkAll()
{
fileModel()->setAllChecked(true);
}
void SubmitEditorWidget::uncheckAll()
{
fileModel()->setAllChecked(false);
}
void SubmitEditorWidget::fileListCustomContextMenuRequested(const QPoint & pos)
{
// Execute menu offering to check/uncheck all
@@ -642,11 +632,11 @@ void SubmitEditorWidget::fileListCustomContextMenuRequested(const QPoint & pos)
QAction *uncheckAllAction = menu.addAction(tr("Unselect All"));
QAction *action = menu.exec(d->m_ui.fileView->mapToGlobal(pos));
if (action == checkAllAction) {
checkAll();
fileModel()->setAllChecked(true);;
return;
}
if (action == uncheckAllAction) {
uncheckAll();
fileModel()->setAllChecked(false);
return;
}
}

View File

@@ -124,8 +124,6 @@ protected slots:
private:
void updateCheckAllComboBox();
void checkAllToggled();
void checkAll();
void uncheckAll();
void triggerDiffSelected();
void diffActivated(const QModelIndex &index);

View File

@@ -255,7 +255,7 @@ private slots:
void slotCopyRevision();
private:
QAction *createDescribeAction(const QString &change) const;
void addDescribeAction(QMenu *menu, const QString &change) const;
QAction *createAnnotateAction(const QString &change, bool previous) const;
QAction *createCopyRevisionAction(const QString &change) const;
@@ -299,7 +299,7 @@ void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType typ
menu->addSeparator();
menu->addAction(createCopyRevisionAction(m_currentChange));
if (currentValid)
menu->addAction(createDescribeAction(m_currentChange));
addDescribeAction(menu, m_currentChange);
menu->addSeparator();
if (currentValid)
menu->addAction(createAnnotateAction(widget->decorateVersion(m_currentChange), false));
@@ -313,7 +313,7 @@ void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType typ
default: // Describe current / Annotate file of current
menu->addSeparator();
menu->addAction(createCopyRevisionAction(m_currentChange));
menu->addAction(createDescribeAction(m_currentChange));
addDescribeAction(menu, m_currentChange);
if (widget->isFileLogAnnotateEnabled())
menu->addAction(createAnnotateAction(m_currentChange, false));
break;
@@ -336,11 +336,12 @@ void ChangeTextCursorHandler::slotCopyRevision()
QApplication::clipboard()->setText(m_currentChange);
}
QAction *ChangeTextCursorHandler::createDescribeAction(const QString &change) const
void ChangeTextCursorHandler::addDescribeAction(QMenu *menu, const QString &change) const
{
auto a = new QAction(VcsBaseEditorWidget::tr("&Describe Change %1").arg(change), nullptr);
connect(a, &QAction::triggered, this, &ChangeTextCursorHandler::slotDescribe);
return a;
menu->addAction(a);
menu->setDefaultAction(a);
}
QAction *ChangeTextCursorHandler::createAnnotateAction(const QString &change, bool previous) const
@@ -358,7 +359,7 @@ QAction *ChangeTextCursorHandler::createAnnotateAction(const QString &change, bo
QAction *ChangeTextCursorHandler::createCopyRevisionAction(const QString &change) const
{
auto a = new QAction(editorWidget()->copyRevisionTextFormat().arg(change), nullptr);
auto a = new QAction(VcsBaseEditorWidget::tr("Copy \"%1\"").arg(change), nullptr);
a->setData(change);
connect(a, &QAction::triggered, this, &ChangeTextCursorHandler::slotCopyRevision);
return a;
@@ -564,7 +565,6 @@ public:
int m_firstLineNumber = -1;
QString m_annotateRevisionTextFormat;
QString m_annotatePreviousRevisionTextFormat;
QString m_copyRevisionTextFormat;
VcsBaseEditorConfig *m_config = nullptr;
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
QPointer<VcsCommand> m_command;
@@ -579,8 +579,7 @@ private:
VcsBaseEditorWidgetPrivate::VcsBaseEditorWidgetPrivate(VcsBaseEditorWidget *editorWidget) :
q(editorWidget),
m_annotateRevisionTextFormat(VcsBaseEditorWidget::tr("Annotate \"%1\"")),
m_copyRevisionTextFormat(VcsBaseEditorWidget::tr("Copy \"%1\""))
m_annotateRevisionTextFormat(VcsBaseEditorWidget::tr("Annotate \"%1\""))
{
m_textCursorHandlers.append(new ChangeTextCursorHandler(editorWidget));
m_textCursorHandlers.append(new UrlTextCursorHandler(editorWidget));
@@ -819,16 +818,6 @@ void VcsBaseEditorWidget::setAnnotatePreviousRevisionTextFormat(const QString &f
d->m_annotatePreviousRevisionTextFormat = f;
}
QString VcsBaseEditorWidget::copyRevisionTextFormat() const
{
return d->m_copyRevisionTextFormat;
}
void VcsBaseEditorWidget::setCopyRevisionTextFormat(const QString &f)
{
d->m_copyRevisionTextFormat = f;
}
bool VcsBaseEditorWidget::isFileLogAnnotateEnabled() const
{
return d->m_fileLogAnnotateEnabled;
@@ -976,13 +965,17 @@ void VcsBaseEditorWidget::slotCursorPositionChanged()
void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
{
QPointer<QMenu> menu = createStandardContextMenu();
QPointer<QMenu> menu;
// 'click on change-interaction'
if (supportChangeLinks()) {
const QTextCursor cursor = cursorForPosition(e->pos());
if (Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor))
if (Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor)) {
menu = new QMenu;
handler->fillContextMenu(menu, d->m_parameters->type);
}
}
if (!menu)
menu = createStandardContextMenu();
switch (d->m_parameters->type) {
case LogOutput: // log might have diff
case DiffOutput: {

View File

@@ -135,7 +135,6 @@ class VCSBASE_EXPORT VcsBaseEditorWidget : public TextEditor::TextEditorWidget
Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory)
Q_PROPERTY(QTextCodec *codec READ codec WRITE setCodec)
Q_PROPERTY(QString annotateRevisionTextFormat READ annotateRevisionTextFormat WRITE setAnnotateRevisionTextFormat)
Q_PROPERTY(QString copyRevisionTextFormat READ copyRevisionTextFormat WRITE setCopyRevisionTextFormat)
Q_PROPERTY(bool isFileLogAnnotateEnabled READ isFileLogAnnotateEnabled WRITE setFileLogAnnotateEnabled)
Q_OBJECT
@@ -188,10 +187,6 @@ public:
QString annotatePreviousRevisionTextFormat() const;
void setAnnotatePreviousRevisionTextFormat(const QString &);
// Format for "Copy" revision menu entries. Should contain '%1" placeholder
QString copyRevisionTextFormat() const;
void setCopyRevisionTextFormat(const QString &);
// Enable "Annotate" context menu in file log view
// (set to true if the source is a single file and the VCS implements it)
bool isFileLogAnnotateEnabled() const;

View File

@@ -23,7 +23,11 @@
****************************************************************************/
#include "vcsoutputformatter.h"
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h>
#include <QDesktopServices>
#include <QMenu>
#include <QPlainTextEdit>
#include <QTextCursor>
#include <QUrl>
@@ -68,4 +72,18 @@ void VcsOutputFormatter::handleLink(const QString &href)
emit referenceClicked(href);
}
void VcsOutputFormatter::fillLinkContextMenu(
QMenu *menu, const QString &workingDirectory, const QString &href)
{
if (href.isEmpty() || href.startsWith("http://") || href.startsWith("https://")) {
QAction *action = menu->addAction(
tr("&Open \"%1\"").arg(href),
[href] { QDesktopServices::openUrl(QUrl(href)); });
menu->setDefaultAction(action);
return;
}
if (Core::IVersionControl *vcs = Core::VcsManager::findVersionControlForDirectory(workingDirectory))
vcs->fillLinkContextMenu(menu, workingDirectory, href);
}
}

View File

@@ -27,6 +27,8 @@
#include <QRegularExpression>
QT_FORWARD_DECLARE_CLASS(QMenu)
namespace VcsBase {
class VcsOutputFormatter : public Utils::OutputFormatter
@@ -37,6 +39,7 @@ public:
~VcsOutputFormatter() override = default;
void appendMessage(const QString &text, Utils::OutputFormat format) override;
void handleLink(const QString &href) override;
void fillLinkContextMenu(QMenu *menu, const QString &workingDirectory, const QString &href);
signals:
void referenceClicked(const QString &reference);

View File

@@ -175,10 +175,17 @@ QString OutputWindowPlainTextEdit::identifierUnderCursor(const QPoint &widgetPos
void OutputWindowPlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
{
QMenu *menu = createStandardContextMenu();
const QString href = anchorAt(event->pos());
QMenu *menu = href.isEmpty() ? createStandardContextMenu(event->pos()) : new QMenu;
// Add 'open file'
QString repository;
const QString token = identifierUnderCursor(event->pos(), &repository);
if (!repository.isEmpty()) {
if (VcsOutputFormatter *f = formatter()) {
if (!href.isEmpty())
f->fillLinkContextMenu(menu, repository, href);
}
}
QAction *openAction = nullptr;
if (!token.isEmpty()) {
// Check for a file, expand via repository if relative
@@ -192,9 +199,12 @@ void OutputWindowPlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
openAction->setData(fi.absoluteFilePath());
}
}
// Add 'clear'
menu->addSeparator();
QAction *clearAction = menu->addAction(VcsOutputWindow::tr("Clear"));
QAction *clearAction = nullptr;
if (href.isEmpty()) {
// Add 'clear'
menu->addSeparator();
clearAction = menu->addAction(VcsOutputWindow::tr("Clear"));
}
// Run
QAction *action = menu->exec(event->globalPos());