summaryrefslogtreecommitdiffstats
path: root/plugins/fossil/fossileditor.cpp
diff options
context:
space:
mode:
authorArtur Shepilko <artur.shepilko@nomadbyte.com>2017-04-20 02:21:51 -0500
committerArtur Shepilko <artur.shepilko@nomadbyte.com>2017-04-26 15:56:36 +0000
commit8cc9b5c57d453ea0de7fe9838b22824c7f9eec21 (patch)
treebfac6f0dcaf0626dae29e1c6680d6c36d7899bf8 /plugins/fossil/fossileditor.cpp
parentac8005190d5fa26d3488392aa560a3afd196e99c (diff)
Vcs: Jump to the current source line in Fossil Annotate editorv4.3.04.3
* Keep track of the current source line number and pass it to Annotate action. * Add a 'List Versions' toggle in Annotate editor to prepend a list of commits that make up the annotated source. * By default do not show the version list so that annotated line number could be matched to the source line. NOTE: VcsBaseEditorWidget::configurationWidget() query is no longer available, yet Fossil client needs it in order to process the effective arguments. So we re-implement it in FossilEditorWidget sub-class. Change-Id: Idc4c21d074ccf4e1c6d041cce2abceb78665c8f2 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'plugins/fossil/fossileditor.cpp')
-rw-r--r--plugins/fossil/fossileditor.cpp57
1 files changed, 47 insertions, 10 deletions
diff --git a/plugins/fossil/fossileditor.cpp b/plugins/fossil/fossileditor.cpp
index c379fd9..2c36f3b 100644
--- a/plugins/fossil/fossileditor.cpp
+++ b/plugins/fossil/fossileditor.cpp
@@ -34,6 +34,7 @@
#include <utils/synchronousprocess.h>
#include <vcsbase/diffandloghighlighter.h>
+#include <QRegularExpression>
#include <QRegExp>
#include <QString>
#include <QTextCursor>
@@ -44,15 +45,31 @@
namespace Fossil {
namespace Internal {
-FossilEditorWidget::FossilEditorWidget() :
- m_exactChangesetId(Constants::CHANGESET_ID_EXACT),
- m_firstChangesetId(QString("\n") + Constants::CHANGESET_ID + " "),
- m_nextChangesetId(m_firstChangesetId)
+class FossilEditorWidgetPrivate
{
- QTC_ASSERT(m_exactChangesetId.isValid(), return);
- QTC_ASSERT(m_firstChangesetId.isValid(), return);
- QTC_ASSERT(m_nextChangesetId.isValid(), return);
+public:
+ FossilEditorWidgetPrivate() :
+ m_exactChangesetId(Constants::CHANGESET_ID_EXACT),
+ m_firstChangesetId(QString("\n") + Constants::CHANGESET_ID + " "),
+ m_nextChangesetId(m_firstChangesetId),
+ m_configurationWidget(nullptr)
+ {
+ QTC_ASSERT(m_exactChangesetId.isValid(), return);
+ QTC_ASSERT(m_firstChangesetId.isValid(), return);
+ QTC_ASSERT(m_nextChangesetId.isValid(), return);
+ }
+
+
+ const QRegularExpression m_exactChangesetId;
+ const QRegularExpression m_firstChangesetId;
+ const QRegularExpression m_nextChangesetId;
+
+ VcsBase::VcsBaseEditorConfig *m_configurationWidget;
+};
+FossilEditorWidget::FossilEditorWidget() :
+ d(new FossilEditorWidgetPrivate)
+{
setAnnotateRevisionTextFormat(tr("&Annotate %1"));
setAnnotatePreviousRevisionTextFormat(tr("Annotate &Parent Revision %1"));
@@ -65,6 +82,26 @@ FossilEditorWidget::FossilEditorWidget() :
setLogEntryPattern(logChangePattern);
}
+FossilEditorWidget::~FossilEditorWidget()
+{
+ delete d;
+}
+
+bool FossilEditorWidget::setConfigurationWidget(VcsBase::VcsBaseEditorConfig *w)
+{
+ if (configurationAdded())
+ return false;
+
+ d->m_configurationWidget = w;
+ setConfigurationAdded();
+ return true;
+}
+
+VcsBase::VcsBaseEditorConfig *FossilEditorWidget::configurationWidget() const
+{
+ return d->m_configurationWidget;
+}
+
QSet<QString> FossilEditorWidget::annotationChanges() const
{
@@ -77,12 +114,12 @@ QSet<QString> FossilEditorWidget::annotationChanges() const
QSet<QString> changes;
- QRegularExpressionMatch firstChangesetIdMatch = m_firstChangesetId.match(txt);
+ QRegularExpressionMatch firstChangesetIdMatch = d->m_firstChangesetId.match(txt);
if (firstChangesetIdMatch.hasMatch()) {
QString changeId = firstChangesetIdMatch.captured(1);
changes.insert(changeId);
- QRegularExpressionMatchIterator i = m_nextChangesetId.globalMatch(txt);
+ QRegularExpressionMatchIterator i = d->m_nextChangesetId.globalMatch(txt);
while (i.hasNext()) {
const QRegularExpressionMatch nextChangesetIdMatch = i.next();
changeId = nextChangesetIdMatch.captured(1);
@@ -98,7 +135,7 @@ QString FossilEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const
cursor.select(QTextCursor::WordUnderCursor);
if (cursor.hasSelection()) {
const QString change = cursor.selectedText();
- QRegularExpressionMatch exactChangesetIdMatch = m_exactChangesetId.match(change);
+ QRegularExpressionMatch exactChangesetIdMatch = d->m_exactChangesetId.match(change);
if (exactChangesetIdMatch.hasMatch())
return change;
}