summaryrefslogtreecommitdiffstats
path: root/plugins/fossil/fossileditor.cpp
diff options
context:
space:
mode:
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;
}