Commit b28d55f2 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Missing files of previous commit

parent 0ada412e
......@@ -59,6 +59,7 @@ private:
class VCSBaseSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
explicit VCSBaseSettingsPage(QObject *parent = 0);
virtual ~VCSBaseSettingsPage();
......@@ -74,6 +75,9 @@ public:
VCSBaseSettings settings() const { return m_settings; }
signals:
void settingsChanged(const VCSBase::Internal::VCSBaseSettings &s);
private:
void updateNickNames();
QPointer<VCSBaseSettingsWidget> m_widget;
......
......@@ -13,63 +13,102 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="promptForSubmitLabel">
<property name="text">
<string>Prompt for submit:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="promptForSubmitCheckBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="submitMessageCheckScriptLabel">
<property name="toolTip">
<string>An executable which is called with the submit message in a temporary file as first argument. It should return with an exit != 0 and a message on standard error to indicate failure.</string>
</property>
<property name="text">
<string>Submit message check script:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Core::Utils::PathChooser" name="submitMessageCheckScriptChooser" native="true"/>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="promptForSubmitCheckBox">
<property name="text">
<string>Prompt to submit</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="lineWrapCheckBox">
<property name="text">
<string>Wrap submit message at:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="lineWrapSpinBox">
<property name="minimum">
<number>40</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="value">
<number>72</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="nickNameMailMapLabel">
<property name="toolTip">
<string>A file listing user names and email addresses in a 4-column mailmap format:
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="submitMessageCheckScriptLabel">
<property name="toolTip">
<string>An executable which is called with the submit message in a temporary file as first argument. It should return with an exit != 0 and a message on standard error to indicate failure.</string>
</property>
<property name="text">
<string>Submit message check script:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Core::Utils::PathChooser" name="submitMessageCheckScriptChooser"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="nickNameMailMapLabel">
<property name="toolTip">
<string>A file listing user names and email addresses in a 4-column mailmap format:
name &lt;email&gt; alias &lt;email&gt;</string>
</property>
<property name="text">
<string>User/alias configuration file:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Core::Utils::PathChooser" name="nickNameMailMapChooser" native="true"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="nickNameFieldsFileLabel">
<property name="toolTip">
<string>A simple file containing lines with field names like &quot;Reviewed-By:&quot; which will be added below the submit editor.</string>
</property>
<property name="text">
<string>User fields configuration file:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Core::Utils::PathChooser" name="nickNameFieldsFileChooser" native="true"/>
</property>
<property name="text">
<string>User/alias configuration file:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Core::Utils::PathChooser" name="nickNameMailMapChooser"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="nickNameFieldsFileLabel">
<property name="toolTip">
<string>A simple file containing lines with field names like &quot;Reviewed-By:&quot; which will be added below the submit editor.</string>
</property>
<property name="text">
<string>User fields configuration file:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Core::Utils::PathChooser" name="nickNameFieldsFileChooser"/>
</item>
</layout>
</item>
</layout>
</item>
......
......@@ -136,6 +136,13 @@ VCSBaseSubmitEditor::VCSBaseSubmitEditor(const VCSBaseSubmitEditorParameters *pa
if (!settings.nickNameFieldListFile.isEmpty())
createUserFields(settings.nickNameFieldListFile);
connect(m_d->m_widget, SIGNAL(fieldDialogRequested(int)), this, SLOT(slotSetFieldNickName(int)));
// wrapping. etc
slotUpdateEditorSettings(settings);
connect(Internal::VCSBasePlugin::instance(),
SIGNAL(settingsChanged(VCSBase::Internal::VCSBaseSettings)),
this, SLOT(slotUpdateEditorSettings(VCSBase::Internal::VCSBaseSettings)));
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
aggregate->add(new Find::BaseTextFind(m_d->m_widget->descriptionEdit()));
aggregate->add(this);
......@@ -148,6 +155,12 @@ VCSBaseSubmitEditor::~VCSBaseSubmitEditor()
delete m_d;
}
void VCSBaseSubmitEditor::slotUpdateEditorSettings(const Internal::VCSBaseSettings &s)
{
setLineWrapWidth(s.lineWrapWidth);
setLineWrap(s.lineWrap);
}
void VCSBaseSubmitEditor::createUserFields(const QString &fieldConfigFile)
{
QFile fieldFile(fieldConfigFile);
......@@ -160,7 +173,8 @@ void VCSBaseSubmitEditor::createUserFields(const QString &fieldConfigFile)
if (fields.empty())
return;
// Create a completer on user names
QCompleter *completer = new QCompleter(Internal::NickNameDialog::nickNameList(), this);
const QStandardItemModel *nickNameModel = Internal::VCSBasePlugin::instance()->nickNameModel();
QCompleter *completer = new QCompleter(Internal::NickNameDialog::nickNameList(nickNameModel), this);
foreach(const QString &field, fields) {
const QString trimmedField = field.trimmed();
if (!trimmedField.isEmpty())
......@@ -202,6 +216,26 @@ void VCSBaseSubmitEditor::setFileListSelectionMode(QAbstractItemView::SelectionM
m_d->m_widget->setFileListSelectionMode(sm);
}
bool VCSBaseSubmitEditor::lineWrap() const
{
return m_d->m_widget->lineWrap();
}
void VCSBaseSubmitEditor::setLineWrap(bool w)
{
m_d->m_widget->setLineWrap(w);
}
int VCSBaseSubmitEditor::lineWrapWidth() const
{
return m_d->m_widget->lineWrapWidth();
}
void VCSBaseSubmitEditor::setLineWrapWidth(int w)
{
m_d->m_widget->setLineWrapWidth(w);
}
void VCSBaseSubmitEditor::slotDescriptionChanged()
{
}
......@@ -412,7 +446,7 @@ VCSBaseSubmitEditor::PromptSubmitResult
QString VCSBaseSubmitEditor::promptForNickName()
{
if (!m_d->m_nickNameDialog)
m_d->m_nickNameDialog = new Internal::NickNameDialog(m_d->m_widget);
m_d->m_nickNameDialog = new Internal::NickNameDialog(Internal::VCSBasePlugin::instance()->nickNameModel(), m_d->m_widget);
if (m_d->m_nickNameDialog->exec() == QDialog::Accepted)
return m_d->m_nickNameDialog->nickName();
return QString();
......
......@@ -90,6 +90,8 @@ class VCSBASE_EXPORT VCSBaseSubmitEditor : public Core::IEditor
Q_OBJECT
Q_PROPERTY(int fileNameColumn READ fileNameColumn WRITE setFileNameColumn DESIGNABLE false)
Q_PROPERTY(QAbstractItemView::SelectionMode fileListSelectionMode READ fileListSelectionMode WRITE setFileListSelectionMode DESIGNABLE true)
Q_PROPERTY(bool lineWrap READ lineWrap WRITE setLineWrap DESIGNABLE true);
Q_PROPERTY(int lineWrapWidth READ lineWrapWidth WRITE setLineWrapWidth DESIGNABLE true);
public:
typedef QList<int> Context;
......@@ -121,6 +123,12 @@ public:
QAbstractItemView::SelectionMode fileListSelectionMode() const;
void setFileListSelectionMode(QAbstractItemView::SelectionMode sm);
bool lineWrap() const;
void setLineWrap(bool);
int lineWrapWidth() const;
void setLineWrapWidth(int);
// Core::IEditor
virtual bool createNew(const QString &contents);
virtual bool open(const QString &fileName);
......@@ -161,6 +169,7 @@ private slots:
void slotCheckSubmitMessage();
void slotInsertNickName();
void slotSetFieldNickName(int);
void slotUpdateEditorSettings(const VCSBase::Internal::VCSBaseSettings &);
protected:
/* These hooks allow for modifying the contents that goes to
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment