forked from qt-creator/qt-creator
Bazaar: Inline bazaarcommitpanel.ui
Change-Id: I5b72560b283584075b30e4bb313a5c143f5c2548 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -3,7 +3,6 @@ add_qtc_plugin(Bazaar
|
||||
SOURCES
|
||||
annotationhighlighter.cpp annotationhighlighter.h
|
||||
bazaarclient.cpp bazaarclient.h
|
||||
bazaarcommitpanel.ui
|
||||
bazaarcommitwidget.cpp bazaarcommitwidget.h
|
||||
bazaareditor.cpp bazaareditor.h
|
||||
bazaarplugin.cpp bazaarplugin.h
|
||||
|
||||
@@ -15,7 +15,6 @@ QtcPlugin {
|
||||
"annotationhighlighter.h",
|
||||
"bazaarclient.cpp",
|
||||
"bazaarclient.h",
|
||||
"bazaarcommitpanel.ui",
|
||||
"bazaarcommitwidget.cpp",
|
||||
"bazaarcommitwidget.h",
|
||||
"bazaareditor.cpp",
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Bazaar::Internal::BazaarCommitPanel</class>
|
||||
<widget class="QWidget" name="Bazaar::Internal::BazaarCommitPanel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>374</width>
|
||||
<height>229</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="infoGroup">
|
||||
<property name="title">
|
||||
<string>General Information</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="branchLabel">
|
||||
<property name="text">
|
||||
<string>Branch:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="branchLineEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="isLocalCheckBox">
|
||||
<property name="toolTip">
|
||||
<string>Performs a local commit in a bound branch.
|
||||
Local commits are not pushed to the master branch until a normal commit is performed.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Local commit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="editGroup">
|
||||
<property name="title">
|
||||
<string>Commit Information</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="authorLabel">
|
||||
<property name="text">
|
||||
<string>Author:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="authorLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="emailLabel">
|
||||
<property name="text">
|
||||
<string>Email:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="emailLineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="fixedBugsLabel">
|
||||
<property name="text">
|
||||
<string>Fixed bugs:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="fixedBugsLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>161</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -6,15 +6,19 @@
|
||||
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
#include <texteditor/fontsettings.h>
|
||||
|
||||
#include <utils/completingtextedit.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
#include <QLineEdit>
|
||||
#include <QRegularExpression>
|
||||
#include <QSyntaxHighlighter>
|
||||
#include <QTextEdit>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QRegularExpression>
|
||||
|
||||
//see the git submit widget for details of the syntax Highlighter
|
||||
|
||||
//TODO Check to see when the Highlighter has been moved to a base class and use that instead
|
||||
@@ -28,6 +32,52 @@ static QTextCharFormat commentFormat()
|
||||
return TextEditor::TextEditorSettings::fontSettings().toTextCharFormat(TextEditor::C_COMMENT);
|
||||
}
|
||||
|
||||
class BazaarCommitPanel : public QWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Bazaar::Internal::BazaarCommitPanel)
|
||||
|
||||
public:
|
||||
BazaarCommitPanel()
|
||||
{
|
||||
branchLineEdit = new QLineEdit;
|
||||
branchLineEdit->setReadOnly(true);
|
||||
|
||||
isLocalCheckBox = new QCheckBox(tr("Local commit"));
|
||||
isLocalCheckBox->setToolTip(tr("Performs a local commit in a bound branch.\n"
|
||||
"Local commits are not pushed to the master "
|
||||
"branch until a normal commit is performed."));
|
||||
|
||||
authorLineEdit = new QLineEdit;
|
||||
emailLineEdit = new QLineEdit;
|
||||
fixedBugsLineEdit = new QLineEdit;
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Column {
|
||||
Group {
|
||||
title(tr("General Information")),
|
||||
Form {
|
||||
tr("Branch:"), branchLineEdit, br,
|
||||
empty, isLocalCheckBox
|
||||
}
|
||||
},
|
||||
Group {
|
||||
title(tr("Commit Information")),
|
||||
Form {
|
||||
tr("Author:"), authorLineEdit, br,
|
||||
tr("Email:"), emailLineEdit, br,
|
||||
tr("Fixed bugs:"), fixedBugsLineEdit
|
||||
},
|
||||
}
|
||||
}.attachTo(this, WithoutMargins);
|
||||
}
|
||||
|
||||
QLineEdit *branchLineEdit;
|
||||
QCheckBox *isLocalCheckBox;
|
||||
QLineEdit *authorLineEdit;
|
||||
QLineEdit *emailLineEdit;
|
||||
QLineEdit *fixedBugsLineEdit;
|
||||
};
|
||||
|
||||
// Highlighter for Bazaar submit messages. Make the first line bold, indicates
|
||||
// comments as such (retrieving the format from the text editor) and marks up
|
||||
// keywords (words in front of a colon as in 'Task: <bla>').
|
||||
@@ -89,9 +139,9 @@ void BazaarSubmitHighlighter::highlightBlock(const QString &text)
|
||||
}
|
||||
|
||||
|
||||
BazaarCommitWidget::BazaarCommitWidget() : m_bazaarCommitPanel(new QWidget)
|
||||
BazaarCommitWidget::BazaarCommitWidget()
|
||||
: m_bazaarCommitPanel(new BazaarCommitPanel)
|
||||
{
|
||||
m_bazaarCommitPanelUi.setupUi(m_bazaarCommitPanel);
|
||||
insertTopWidget(m_bazaarCommitPanel);
|
||||
new BazaarSubmitHighlighter(descriptionEdit());
|
||||
}
|
||||
@@ -99,16 +149,16 @@ BazaarCommitWidget::BazaarCommitWidget() : m_bazaarCommitPanel(new QWidget)
|
||||
void BazaarCommitWidget::setFields(const BranchInfo &branch,
|
||||
const QString &userName, const QString &email)
|
||||
{
|
||||
m_bazaarCommitPanelUi.branchLineEdit->setText(branch.branchLocation);
|
||||
m_bazaarCommitPanelUi.isLocalCheckBox->setVisible(branch.isBoundToBranch);
|
||||
m_bazaarCommitPanelUi.authorLineEdit->setText(userName);
|
||||
m_bazaarCommitPanelUi.emailLineEdit->setText(email);
|
||||
m_bazaarCommitPanel->branchLineEdit->setText(branch.branchLocation);
|
||||
m_bazaarCommitPanel->isLocalCheckBox->setVisible(branch.isBoundToBranch);
|
||||
m_bazaarCommitPanel->authorLineEdit->setText(userName);
|
||||
m_bazaarCommitPanel->emailLineEdit->setText(email);
|
||||
}
|
||||
|
||||
QString BazaarCommitWidget::committer() const
|
||||
{
|
||||
const QString author = m_bazaarCommitPanelUi.authorLineEdit->text();
|
||||
const QString email = m_bazaarCommitPanelUi.emailLineEdit->text();
|
||||
const QString author = m_bazaarCommitPanel->authorLineEdit->text();
|
||||
const QString email = m_bazaarCommitPanel->emailLineEdit->text();
|
||||
if (author.isEmpty())
|
||||
return QString();
|
||||
|
||||
@@ -123,12 +173,12 @@ QString BazaarCommitWidget::committer() const
|
||||
|
||||
QStringList BazaarCommitWidget::fixedBugs() const
|
||||
{
|
||||
return m_bazaarCommitPanelUi.fixedBugsLineEdit->text().split(QRegularExpression("\\s+"));
|
||||
return m_bazaarCommitPanel->fixedBugsLineEdit->text().split(QRegularExpression("\\s+"));
|
||||
}
|
||||
|
||||
bool BazaarCommitWidget::isLocalOptionEnabled() const
|
||||
{
|
||||
return m_bazaarCommitPanelUi.isLocalCheckBox->isChecked();
|
||||
return m_bazaarCommitPanel->isLocalCheckBox->isChecked();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_bazaarcommitpanel.h"
|
||||
|
||||
#include <vcsbase/submiteditorwidget.h>
|
||||
|
||||
namespace Bazaar {
|
||||
namespace Internal {
|
||||
namespace Bazaar::Internal {
|
||||
|
||||
class BranchInfo;
|
||||
class BazaarCommitPanel;
|
||||
|
||||
/*submit editor widget based on git SubmitEditor
|
||||
Some extra fields have been added to the standard SubmitEditorWidget,
|
||||
@@ -21,17 +19,14 @@ class BazaarCommitWidget : public VcsBase::SubmitEditorWidget
|
||||
public:
|
||||
BazaarCommitWidget();
|
||||
|
||||
void setFields(const BranchInfo &branch,
|
||||
const QString &userName, const QString &email);
|
||||
void setFields(const BranchInfo &branch, const QString &userName, const QString &email);
|
||||
|
||||
QString committer() const;
|
||||
QStringList fixedBugs() const;
|
||||
bool isLocalOptionEnabled() const;
|
||||
|
||||
private:
|
||||
QWidget *m_bazaarCommitPanel;
|
||||
Ui::BazaarCommitPanel m_bazaarCommitPanelUi;
|
||||
BazaarCommitPanel *m_bazaarCommitPanel;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Bazaar
|
||||
} // Bazaar::Insteral
|
||||
|
||||
Reference in New Issue
Block a user