Git: Support change links on commit editor

Useful for commit messages with "reverts <hash>" for example.

Can later be extended for interactive rebase

Change-Id: Ibf77433ecddfacbd8d443636ddbc406bda474aa7
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-05-28 20:19:53 +03:00
committed by Orgad Shaneh
parent b90e3bbd8b
commit 05a6fc48ba
6 changed files with 46 additions and 2 deletions

View File

@@ -663,6 +663,17 @@ void VcsBaseEditorWidget::setLogEntryPattern(const QRegExp &pattern)
d->m_logEntryPattern = pattern;
}
bool VcsBaseEditorWidget::supportChangeLinks() const
{
switch (d->m_parameters->type) {
case LogOutput:
case AnnotateOutput:
return true;
default:
return false;
}
}
void VcsBaseEditorWidget::init()
{
d->m_editor = editor();
@@ -963,7 +974,7 @@ void VcsBaseEditorWidget::mouseMoveEvent(QMouseEvent *e)
bool overrideCursor = false;
Qt::CursorShape cursorShape;
if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) {
if (supportChangeLinks()) {
// Link emulation behaviour for 'click on change-interaction'
const QTextCursor cursor = cursorForPosition(e->pos());
Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor);
@@ -987,7 +998,7 @@ void VcsBaseEditorWidget::mouseReleaseEvent(QMouseEvent *e)
{
const bool wasDragging = d->m_mouseDragging;
d->m_mouseDragging = false;
if (!wasDragging && (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput)) {
if (!wasDragging && supportChangeLinks()) {
if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) {
const QTextCursor cursor = cursorForPosition(e->pos());
Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor);