Commit f9051e6f authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Renamed VCSBaseSettingsPage to CommonSettingsPage

To free up the name for an upcoming VCSBaseOptionsPage class that forms
the base for all version control option pages.

Reviewed-by: Friedemann Kleint
parent 9454fe56
......@@ -54,7 +54,7 @@ static QString defaultCommand()
}
namespace CVS {
namespace Internal {
namespace Internal {
CVSSettings::CVSSettings() :
cvsCommand(defaultCommand()),
......@@ -111,5 +111,5 @@ QStringList CVSSettings::addOptions(const QStringList &args) const
return rc;
}
}
}
} // namespace Internal
} // namespace CVS
......@@ -47,7 +47,8 @@ namespace Internal {
struct CVSSettings;
class SettingsPageWidget : public QWidget {
class SettingsPageWidget : public QWidget
{
Q_OBJECT
public:
explicit SettingsPageWidget(QWidget *parent = 0);
......@@ -88,4 +89,4 @@ private:
} // namespace CVS
} // namespace Internal
#endif // SETTINGSPAGE_H
#endif // SETTINGSPAGE_H
......@@ -27,11 +27,11 @@
**
**************************************************************************/
#include "vcsbasesettingspage.h"
#include "commonsettingspage.h"
#include "vcsbaseconstants.h"
#include "nicknamedialog.h"
#include "ui_vcsbasesettingspage.h"
#include "ui_commonsettingspage.h"
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
......@@ -45,9 +45,9 @@ namespace Internal {
// ------------------ VCSBaseSettingsWidget
VCSBaseSettingsWidget::VCSBaseSettingsWidget(QWidget *parent) :
CommonSettingsWidget::CommonSettingsWidget(QWidget *parent) :
QWidget(parent),
m_ui(new Ui::VCSBaseSettingsPage)
m_ui(new Ui::CommonSettingsPage)
{
m_ui->setupUi(this);
m_ui->submitMessageCheckScriptChooser->setExpectedKind(Utils::PathChooser::Command);
......@@ -55,14 +55,14 @@ VCSBaseSettingsWidget::VCSBaseSettingsWidget(QWidget *parent) :
m_ui->nickNameMailMapChooser->setExpectedKind(Utils::PathChooser::File);
}
VCSBaseSettingsWidget::~VCSBaseSettingsWidget()
CommonSettingsWidget::~CommonSettingsWidget()
{
delete m_ui;
}
VCSBaseSettings VCSBaseSettingsWidget::settings() const
CommonVcsSettings CommonSettingsWidget::settings() const
{
VCSBaseSettings rc;
CommonVcsSettings rc;
rc.nickNameMailMap = m_ui->nickNameMailMapChooser->path();
rc.nickNameFieldListFile = m_ui->nickNameFieldsFileChooser->path();
rc.submitMessageCheckScript = m_ui->submitMessageCheckScriptChooser->path();
......@@ -71,7 +71,7 @@ VCSBaseSettings VCSBaseSettingsWidget::settings() const
return rc;
}
void VCSBaseSettingsWidget::setSettings(const VCSBaseSettings &s)
void CommonSettingsWidget::setSettings(const CommonVcsSettings &s)
{
m_ui->nickNameMailMapChooser->setPath(s.nickNameMailMap);
m_ui->nickNameFieldsFileChooser->setPath(s.nickNameFieldListFile);
......@@ -80,7 +80,7 @@ void VCSBaseSettingsWidget::setSettings(const VCSBaseSettings &s)
m_ui->lineWrapSpinBox->setValue(s.lineWrapWidth);
}
QString VCSBaseSettingsWidget::searchKeyWordMatchString() const
QString CommonSettingsWidget::searchKeyWordMatchString() const
{
const QChar blank = QLatin1Char(' ');
QString rc = m_ui->submitMessageCheckScriptLabel->text();
......@@ -93,58 +93,58 @@ QString VCSBaseSettingsWidget::searchKeyWordMatchString() const
}
// --------------- VCSBaseSettingsPage
VCSBaseSettingsPage::VCSBaseSettingsPage(QObject *parent) :
CommonOptionsPage::CommonOptionsPage(QObject *parent) :
Core::IOptionsPage(parent)
{
m_settings.fromSettings(Core::ICore::instance()->settings());
}
void VCSBaseSettingsPage::updateNickNames()
void CommonOptionsPage::updateNickNames()
{
}
VCSBaseSettingsPage::~VCSBaseSettingsPage()
CommonOptionsPage::~CommonOptionsPage()
{
}
QString VCSBaseSettingsPage::id() const
QString CommonOptionsPage::id() const
{
return QLatin1String(Constants::VCS_COMMON_SETTINGS_ID);
}
QString VCSBaseSettingsPage::displayName() const
QString CommonOptionsPage::displayName() const
{
return QCoreApplication::translate("VCSBase", Constants::VCS_COMMON_SETTINGS_NAME);
}
QString VCSBaseSettingsPage::category() const
QString CommonOptionsPage::category() const
{
return QLatin1String(Constants::VCS_SETTINGS_CATEGORY);
}
QString VCSBaseSettingsPage::displayCategory() const
QString CommonOptionsPage::displayCategory() const
{
return QCoreApplication::translate("VCSBase", Constants::VCS_SETTINGS_TR_CATEGORY);
}
QIcon VCSBaseSettingsPage::categoryIcon() const
QIcon CommonOptionsPage::categoryIcon() const
{
return QIcon(); // TODO: Icon for Version Control
}
QWidget *VCSBaseSettingsPage::createPage(QWidget *parent)
QWidget *CommonOptionsPage::createPage(QWidget *parent)
{
m_widget = new VCSBaseSettingsWidget(parent);
m_widget = new CommonSettingsWidget(parent);
m_widget->setSettings(m_settings);
if (m_searchKeyWords.isEmpty())
m_searchKeyWords = m_widget->searchKeyWordMatchString();
return m_widget;
}
void VCSBaseSettingsPage::apply()
void CommonOptionsPage::apply()
{
if (m_widget) {
const VCSBaseSettings newSettings = m_widget->settings();
const CommonVcsSettings newSettings = m_widget->settings();
if (newSettings != m_settings) {
m_settings = newSettings;
m_settings.toSettings(Core::ICore::instance()->settings());
......@@ -153,10 +153,10 @@ void VCSBaseSettingsPage::apply()
}
}
bool VCSBaseSettingsPage::matches(const QString &key) const
bool CommonOptionsPage::matches(const QString &key) const
{
return m_searchKeyWords.contains(key, Qt::CaseInsensitive);
}
}
}
} // namespace Internal
} // namespace VCSBase
......@@ -27,44 +27,46 @@
**
**************************************************************************/
#ifndef VCSBASESETTINGSPAGE_H
#define VCSBASESETTINGSPAGE_H
#ifndef COMMONOPTIONSPAGE_H
#define COMMONOPTIONSPAGE_H
#include "commonvcssettings.h"
#include "vcsbasesettings.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QPointer>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
namespace Ui {
class VCSBaseSettingsPage;
class CommonSettingsPage;
}
QT_END_NAMESPACE
namespace VCSBase {
namespace Internal {
class VCSBaseSettingsWidget : public QWidget {
class CommonSettingsWidget : public QWidget
{
Q_OBJECT
public:
explicit VCSBaseSettingsWidget(QWidget *parent = 0);
virtual ~VCSBaseSettingsWidget();
explicit CommonSettingsWidget(QWidget *parent = 0);
virtual ~CommonSettingsWidget();
VCSBaseSettings settings() const;
void setSettings(const VCSBaseSettings &s);
CommonVcsSettings settings() const;
void setSettings(const CommonVcsSettings &s);
QString searchKeyWordMatchString() const;
private:
Ui::VCSBaseSettingsPage *m_ui;
Ui::CommonSettingsPage *m_ui;
};
class VCSBaseSettingsPage : public Core::IOptionsPage
class CommonOptionsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
explicit VCSBaseSettingsPage(QObject *parent = 0);
virtual ~VCSBaseSettingsPage();
explicit CommonOptionsPage(QObject *parent = 0);
virtual ~CommonOptionsPage();
virtual QString id() const;
virtual QString displayName() const;
......@@ -77,20 +79,20 @@ public:
virtual void finish() { }
virtual bool matches(const QString &key) const;
VCSBaseSettings settings() const { return m_settings; }
CommonVcsSettings settings() const { return m_settings; }
signals:
void settingsChanged(const VCSBase::Internal::VCSBaseSettings &s);
void settingsChanged(const VCSBase::Internal::CommonVcsSettings &s);
private:
void updateNickNames();
VCSBaseSettingsWidget* m_widget;
VCSBaseSettings m_settings;
CommonSettingsWidget* m_widget;
CommonVcsSettings m_settings;
QString m_searchKeyWords;
};
} // namespace Internal
} // namespace VCSBase
#endif // VCSBASESETTINGSPAGE_H
#endif // COMMONOPTIONSPAGE_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VCSBaseSettingsPage</class>
<widget class="QWidget" name="VCSBaseSettingsPage">
<class>CommonSettingsPage</class>
<widget class="QWidget" name="CommonSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>408</width>
<height>148</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="commonGroupBox">
<layout class="QFormLayout" name="formLayout">
<property name="rowWrapPolicy">
<enum>QFormLayout::WrapLongRows</enum>
</property>
<property name="title">
<string>Common Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="lineWrapCheckBox">
<property name="text">
<string>Wrap submit message at:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="lineWrapSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> characters</string>
</property>
<property name="minimum">
<number>40</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="value">
<number>72</number>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="submitMessageCheckScriptLabel">
<property name="toolTip">
......@@ -19,8 +66,8 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Utils::PathChooser" name="submitMessageCheckScriptChooser"/>
<item row="1" column="1" colspan="2">
<widget class="Utils::PathChooser" name="submitMessageCheckScriptChooser" native="true"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="nickNameMailMapLabel">
......@@ -33,8 +80,8 @@ name &lt;email&gt; alias &lt;email&gt;</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="nickNameMailMapChooser"/>
<item row="2" column="1" colspan="2">
<widget class="Utils::PathChooser" name="nickNameMailMapChooser" native="true"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="nickNameFieldsFileLabel">
......@@ -46,34 +93,8 @@ name &lt;email&gt; alias &lt;email&gt;</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Utils::PathChooser" name="nickNameFieldsFileChooser"/>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="lineWrapCheckBox">
<property name="text">
<string>Wrap submit message at:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="lineWrapSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> characters</string>
</property>
<property name="minimum">
<number>40</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="value">
<number>72</number>
</property>
</widget>
<item row="3" column="1" colspan="2">
<widget class="Utils::PathChooser" name="nickNameFieldsFileChooser" native="true"/>
</item>
</layout>
</widget>
......
......@@ -27,7 +27,7 @@
**
**************************************************************************/
#include "vcsbasesettings.h"
#include "commonvcssettings.h"
#include <QtCore/QSettings>
#include <QtCore/QDebug>
......@@ -45,13 +45,13 @@ static const bool lineWrapDefault = true;
namespace VCSBase {
namespace Internal {
VCSBaseSettings::VCSBaseSettings() :
CommonVcsSettings::CommonVcsSettings() :
lineWrap(lineWrapDefault),
lineWrapWidth(lineWrapWidthDefault)
{
}
void VCSBaseSettings::toSettings(QSettings *s) const
void CommonVcsSettings::toSettings(QSettings *s) const
{
s->beginGroup(QLatin1String(settingsGroupC));
s->setValue(QLatin1String(nickNameMailMapKeyC), nickNameMailMap);
......@@ -62,7 +62,7 @@ void VCSBaseSettings::toSettings(QSettings *s) const
s->endGroup();
}
void VCSBaseSettings::fromSettings(QSettings *s)
void CommonVcsSettings::fromSettings(QSettings *s)
{
s->beginGroup(QLatin1String(settingsGroupC));
nickNameMailMap = s->value(QLatin1String(nickNameMailMapKeyC), QString()).toString();
......@@ -73,7 +73,7 @@ void VCSBaseSettings::fromSettings(QSettings *s)
s->endGroup();
}
bool VCSBaseSettings::equals(const VCSBaseSettings &rhs) const
bool CommonVcsSettings::equals(const CommonVcsSettings &rhs) const
{
return lineWrap == rhs.lineWrap
&& lineWrapWidth == rhs.lineWrapWidth
......@@ -82,7 +82,7 @@ bool VCSBaseSettings::equals(const VCSBaseSettings &rhs) const
&& submitMessageCheckScript == rhs.submitMessageCheckScript;
}
QDebug operator<<(QDebug d,const VCSBaseSettings& s)
QDebug operator<<(QDebug d,const CommonVcsSettings& s)
{
d.nospace() << " lineWrap=" << s.lineWrap
<< " lineWrapWidth=" << s.lineWrapWidth
......@@ -91,5 +91,6 @@ QDebug operator<<(QDebug d,const VCSBaseSettings& s)
<< "'submitMessageCheckScript='" << s.submitMessageCheckScript << "'\n";
return d;
}
}
}
} // namespace Internal
} // namespace VCSBase
......@@ -27,8 +27,8 @@
**
**************************************************************************/
#ifndef VCSBASESETTINGS_H
#define VCSBASESETTINGS_H
#ifndef COMMONVCSSETTINGS_H
#define COMMONVCSSETTINGS_H
#include <QtCore/QString>
#include <QtGui/QWidget>
......@@ -42,8 +42,9 @@ namespace VCSBase {
namespace Internal {
// Common VCS settings, message check script and user nick names.
struct VCSBaseSettings {
VCSBaseSettings();
struct CommonVcsSettings
{
CommonVcsSettings();
QString nickNameMailMap;
QString nickNameFieldListFile;
......@@ -56,14 +57,15 @@ struct VCSBaseSettings {
void toSettings(QSettings *) const;
void fromSettings(QSettings *);
bool equals(const VCSBaseSettings &rhs) const;
bool equals(const CommonVcsSettings &rhs) const;
};
inline bool operator==(const VCSBaseSettings &s1, const VCSBaseSettings &s2) { return s1.equals(s2); }
inline bool operator!=(const VCSBaseSettings &s1, const VCSBaseSettings &s2) { return !s1.equals(s2); }
inline bool operator==(const CommonVcsSettings &s1, const CommonVcsSettings &s2) { return s1.equals(s2); }
inline bool operator!=(const CommonVcsSettings &s1, const CommonVcsSettings &s2) { return !s1.equals(s2); }
QDebug operator<<(QDebug, const CommonVcsSettings &);
QDebug operator<<(QDebug,const VCSBaseSettings& );
} // namespace Internal
} // namespace VCSBase
#endif // VCSBASESETTINGS_H
#endif // COMMONVCSSETTINGS_H
......@@ -17,8 +17,8 @@ HEADERS += vcsbase_global.h \
submiteditorfile.h \
basevcssubmiteditorfactory.h \
submitfilemodel.h \
vcsbasesettings.h \
vcsbasesettingspage.h \
commonvcssettings.h \
commonsettingspage.h \
nicknamedialog.h \
basecheckoutwizard.h \
checkoutwizarddialog.h \
......@@ -40,8 +40,8 @@ SOURCES += vcsplugin.cpp \
submiteditorfile.cpp \
basevcssubmiteditorfactory.cpp \
submitfilemodel.cpp \
vcsbasesettings.cpp \
vcsbasesettingspage.cpp \
commonvcssettings.cpp \
commonsettingspage.cpp \
nicknamedialog.cpp \
basecheckoutwizard.cpp \
checkoutwizarddialog.cpp \
......@@ -53,7 +53,7 @@ SOURCES += vcsplugin.cpp \
RESOURCES += vcsbase.qrc
FORMS += vcsbasesettingspage.ui \
FORMS += commonsettingspage.ui \
nicknamedialog.ui \
checkoutprogresswizardpage.ui \
basecheckoutwizardpage.ui \
......
......@@ -28,8 +28,9 @@
**************************************************************************/
#include "vcsbasesubmiteditor.h"
#include "commonvcssettings.h"
#include "vcsbaseoutputwindow.h"
#include "vcsbasesettings.h"
#include "vcsplugin.h"
#include "nicknamedialog.h"
#include "submiteditorfile.h"
......@@ -130,7 +131,7 @@ VCSBaseSubmitEditor::VCSBaseSubmitEditor(const VCSBaseSubmitEditorParameters *pa
connect(m_d->m_widget, SIGNAL(diffSelected(QStringList)), this, SLOT(slotDiffSelectedVCSFiles(QStringList)));
connect(m_d->m_widget->descriptionEdit(), SIGNAL(textChanged()), this, SLOT(slotDescriptionChanged()));
const Internal::VCSBaseSettings settings = Internal::VCSPlugin::instance()->settings();
const Internal::CommonVcsSettings settings = Internal::VCSPlugin::instance()->settings();
// Add additional context menu settings
if (!settings.submitMessageCheckScript.isEmpty() || !settings.nickNameMailMap.isEmpty()) {
QAction *sep = new QAction(this);
......@@ -156,8 +157,8 @@ VCSBaseSubmitEditor::VCSBaseSubmitEditor(const VCSBaseSubmitEditorParameters *pa
// wrapping. etc
slotUpdateEditorSettings(settings);
connect(Internal::VCSPlugin::instance(),
SIGNAL(settingsChanged(VCSBase::Internal::VCSBaseSettings)),
this, SLOT(slotUpdateEditorSettings(VCSBase::Internal::VCSBaseSettings)));
SIGNAL(settingsChanged(VCSBase::Internal::CommonVcsSettings)),
this, SLOT(slotUpdateEditorSettings(VCSBase::Internal::CommonVcsSettings)));
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
aggregate->add(new Find::BaseTextFind(m_d->m_widget->descriptionEdit()));
......@@ -171,7 +172,7 @@ VCSBaseSubmitEditor::~VCSBaseSubmitEditor()
delete m_d;
}
void VCSBaseSubmitEditor::slotUpdateEditorSettings(const Internal::VCSBaseSettings &s)
void VCSBaseSubmitEditor::slotUpdateEditorSettings(const Internal::CommonVcsSettings &s)
{
setLineWrapWidth(s.lineWrapWidth);
setLineWrap(s.lineWrap);
......
......@@ -49,7 +49,7 @@ namespace Utils {
namespace VCSBase {
namespace Internal {
struct VCSBaseSettings;
struct CommonVcsSettings;
}
struct VCSBaseSubmitEditorPrivate;
......@@ -183,7 +183,7 @@ private slots:
void slotCheckSubmitMessage();
void slotInsertNickName();
void slotSetFieldNickName(int);
void slotUpdateEditorSettings(const VCSBase::Internal::VCSBaseSettings &);
void slotUpdateEditorSettings(const VCSBase::Internal::CommonVcsSettings &);
protected:
/* These hooks allow for modifying the contents that goes to
......
......@@ -29,7 +29,7 @@
#include "vcsplugin.h"
#include "diffhighlighter.h"
#include "vcsbasesettingspage.h"
#include "commonsettingspage.h"
#include "nicknamedialog.h"
#include "vcsbaseoutputwindow.h"
#include "corelistener.h"
......@@ -72,12 +72,12 @@ bool VCSPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_coreListener = new CoreListener;
addAutoReleasedObject(m_coreListener);
m_settingsPage = new VCSBaseSettingsPage;
m_settingsPage = new CommonOptionsPage;
addAutoReleasedObject(m_settingsPage);
addAutoReleasedObject(VCSBaseOutputWindow::instance());
connect(m_settingsPage, SIGNAL(settingsChanged(VCSBase::Internal::VCSBaseSettings)),
this, SIGNAL(settingsChanged(VCSBase::Internal::VCSBaseSettings)));
connect(m_settingsPage, SIGNAL(settingsChanged(VCSBase::Internal::VCSBaseSettings)),
connect(m_settingsPage, SIGNAL(settingsChanged(VCSBase::Internal::CommonVcsSettings)),
this, SIGNAL(settingsChanged(VCSBase::Internal::CommonVcsSettings)));
connect(m_settingsPage, SIGNAL(settingsChanged(VCSBase::Internal::CommonVcsSettings)),
this, SLOT(slotSettingsChanged()));
slotSettingsChanged();
return true;
......@@ -97,7 +97,7 @@ CoreListener *VCSPlugin::coreListener() const
return m_coreListener;
}
VCSBaseSettings VCSPlugin::settings() const
CommonVcsSettings VCSPlugin::settings() const
{
return m_settingsPage->settings();