diff --git a/src/plugins/vcsbase/vcsbasesettingspage.h b/src/plugins/vcsbase/vcsbasesettingspage.h index 4492f665444af240ea6933b399262c0da4278541..9c271c561e9dcb710eb0fddc472e8c0143e1695a 100644 --- a/src/plugins/vcsbase/vcsbasesettingspage.h +++ b/src/plugins/vcsbase/vcsbasesettingspage.h @@ -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; diff --git a/src/plugins/vcsbase/vcsbasesettingspage.ui b/src/plugins/vcsbase/vcsbasesettingspage.ui index 01e478f8176983f6434ace1814a772c40d6352ae..0585c680e3e259c00bd6b16cdeabf9ae249a7dfa 100644 --- a/src/plugins/vcsbase/vcsbasesettingspage.ui +++ b/src/plugins/vcsbase/vcsbasesettingspage.ui @@ -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 <email> alias <email></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 "Reviewed-By:" 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 "Reviewed-By:" 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> diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 46ae4374cf71a9c339c8d9b7e97e2319e86a8c07..555e7576a61f9538c0c0792ddfe8e7747a723782 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -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(); diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.h b/src/plugins/vcsbase/vcsbasesubmiteditor.h index 4a02d262a29f8fd5311d347b0a1ec6e3be9cc0b7..3cd2e62bcba6785a61eaef47450695cd737f9bde 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.h +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.h @@ -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