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

Create a single parent options page for the Version Control category

Cleans up some duplication for each page.

Reviewed-by: Friedemann Kleint
parent f9051e6f
......@@ -98,21 +98,6 @@ QString SettingsPage::displayName() const
return tr("CVS");
}
QString SettingsPage::category() const
{
return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY);
}
QString SettingsPage::displayCategory() const
{
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_TR_CATEGORY);
}
QIcon SettingsPage::categoryIcon() const
{
return QIcon(); // TODO: Icon for Version Control
}
QWidget *SettingsPage::createPage(QWidget *parent)
{
m_widget = new SettingsPageWidget(parent);
......
......@@ -32,7 +32,7 @@
#include "ui_settingspage.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <vcsbase/vcsbaseoptionspage.h>
#include <QtGui/QWidget>
#include <QtCore/QPointer>
......@@ -50,6 +50,7 @@ struct CVSSettings;
class SettingsPageWidget : public QWidget
{
Q_OBJECT
public:
explicit SettingsPageWidget(QWidget *parent = 0);
......@@ -63,7 +64,7 @@ private:
};
class SettingsPage : public Core::IOptionsPage
class SettingsPage : public VCSBase::VCSBaseOptionsPage
{
Q_OBJECT
......@@ -72,9 +73,6 @@ public:
QString id() const;
QString displayName() const;
QString category() const;
QString displayCategory() const;
QIcon categoryIcon() const;
QWidget *createPage(QWidget *parent);
void apply();
......
......@@ -112,21 +112,6 @@ QString SettingsPage::displayName() const
return tr("Git");
}
QString SettingsPage::category() const
{
return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY);
}
QString SettingsPage::displayCategory() const
{
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_TR_CATEGORY);
}
QIcon SettingsPage::categoryIcon() const
{
return QIcon(); // TODO: Icon for Version Control
}
QWidget *SettingsPage::createPage(QWidget *parent)
{
m_widget = new SettingsPageWidget(parent);
......
......@@ -33,7 +33,7 @@
#include <QtGui/QWidget>
#include <QtCore/QPointer>
#include <coreplugin/dialogs/ioptionspage.h>
#include <vcsbase/vcsbaseoptionspage.h>
#include "ui_settingspage.h"
......@@ -63,7 +63,7 @@ private:
Ui::SettingsPage m_ui;
};
class SettingsPage : public Core::IOptionsPage
class SettingsPage : public VCSBase::VCSBaseOptionsPage
{
Q_OBJECT
......@@ -72,9 +72,6 @@ public:
QString id() const;
QString displayName() const;
QString category() const;
QString displayCategory() const;
QIcon categoryIcon() const;
QWidget *createPage(QWidget *parent);
void apply();
......
......@@ -142,8 +142,8 @@ void MercurialSettings::readSettings(const QSettings *settings)
bool MercurialSettings::equals(const MercurialSettings &rhs) const
{
return m_binary == rhs.m_binary && m_standardArguments == rhs.m_standardArguments
&& m_user == rhs.m_user && m_mail == rhs.m_mail
&& m_logCount == rhs.m_logCount && m_timeoutSeconds == rhs.m_timeoutSeconds
&& m_prompt == rhs.m_prompt;
return m_binary == rhs.m_binary && m_standardArguments == rhs.m_standardArguments
&& m_user == rhs.m_user && m_mail == rhs.m_mail
&& m_logCount == rhs.m_logCount && m_timeoutSeconds == rhs.m_timeoutSeconds
&& m_prompt == rhs.m_prompt;
}
......@@ -73,7 +73,6 @@ public:
bool equals(const MercurialSettings &rhs) const;
private:
void readSettings();
QString m_binary;
......@@ -90,7 +89,7 @@ inline bool operator==(const MercurialSettings &s1, const MercurialSettings &s2)
inline bool operator!=(const MercurialSettings &s1, const MercurialSettings &s2)
{ return !s1.equals(s2); }
} //namespace Internal
} //namespace Mercurial
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIALSETTINGS_H
......@@ -97,21 +97,6 @@ QString OptionsPage::displayName() const
return tr("Mercurial");
}
QString OptionsPage::category() const
{
return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY);
}
QString OptionsPage::displayCategory() const
{
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_TR_CATEGORY);
}
QIcon OptionsPage::categoryIcon() const
{
return QIcon(); // TODO: Icon for Version Control
}
QWidget *OptionsPage::createPage(QWidget *parent)
{
if (!optionsPageWidget)
......
......@@ -32,7 +32,7 @@
#include "ui_optionspage.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <vcsbase/vcsbaseoptionspage.h>
#include <QtGui/QWidget>
#include <QtCore/QPointer>
......@@ -45,6 +45,7 @@ class MercurialSettings;
class OptionsPageWidget : public QWidget
{
Q_OBJECT
public:
explicit OptionsPageWidget(QWidget *parent = 0);
......@@ -57,7 +58,7 @@ private:
};
class OptionsPage : public Core::IOptionsPage
class OptionsPage : public VCSBase::VCSBaseOptionsPage
{
Q_OBJECT
......@@ -65,9 +66,6 @@ public:
OptionsPage();
QString id() const;
QString displayName() const;
QString category() const;
QString displayCategory() const;
QIcon categoryIcon() const;
QWidget *createPage(QWidget *parent);
void apply();
......
......@@ -136,21 +136,6 @@ QString SettingsPage::displayName() const
return tr("Perforce");
}
QString SettingsPage::category() const
{
return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY);
}
QString SettingsPage::displayCategory() const
{
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_TR_CATEGORY);
}
QIcon SettingsPage::categoryIcon() const
{
return QIcon(); // TODO: Icon for Version Control
}
QWidget *SettingsPage::createPage(QWidget *parent)
{
m_widget = new SettingsPageWidget(parent);
......
......@@ -33,7 +33,7 @@
#include <QtCore/QPointer>
#include <QtGui/QWidget>
#include <coreplugin/dialogs/ioptionspage.h>
#include <vcsbase/vcsbaseoptionspage.h>
#include "ui_settingspage.h"
......@@ -44,8 +44,10 @@ class PerforceSettings;
class PerforceChecker;
struct Settings;
class SettingsPageWidget : public QWidget {
class SettingsPageWidget : public QWidget
{
Q_OBJECT
public:
explicit SettingsPageWidget(QWidget *parent);
......@@ -66,7 +68,7 @@ private:
QPointer<PerforceChecker> m_checker;
};
class SettingsPage : public Core::IOptionsPage
class SettingsPage : public VCSBase::VCSBaseOptionsPage
{
Q_OBJECT
......@@ -75,9 +77,6 @@ public:
QString id() const;
QString displayName() const;
QString category() const;
QString displayCategory() const;
QIcon categoryIcon() const;
QWidget *createPage(QWidget *parent);
void apply();
......
......@@ -106,21 +106,6 @@ QString SettingsPage::displayName() const
return tr("Subversion");
}
QString SettingsPage::category() const
{
return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY);
}
QString SettingsPage::displayCategory() const
{
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_TR_CATEGORY);
}
QIcon SettingsPage::categoryIcon() const
{
return QIcon(); // TODO: Icon for Version Control
}
QWidget *SettingsPage::createPage(QWidget *parent)
{
m_widget = new SettingsPageWidget(parent);
......
......@@ -32,7 +32,7 @@
#include "ui_settingspage.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <vcsbase/vcsbaseoptionspage.h>
#include <QtGui/QWidget>
#include <QtCore/QPointer>
......@@ -47,8 +47,10 @@ namespace Internal {
struct SubversionSettings;
class SettingsPageWidget : public QWidget {
class SettingsPageWidget : public QWidget
{
Q_OBJECT
public:
explicit SettingsPageWidget(QWidget *parent = 0);
......@@ -62,7 +64,7 @@ private:
};
class SettingsPage : public Core::IOptionsPage
class SettingsPage : public VCSBase::VCSBaseOptionsPage
{
Q_OBJECT
......@@ -71,9 +73,6 @@ public:
QString id() const;
QString displayName() const;
QString category() const;
QString displayCategory() const;
QIcon categoryIcon() const;
QWidget *createPage(QWidget *parent);
void apply();
......
......@@ -94,7 +94,7 @@ QString CommonSettingsWidget::searchKeyWordMatchString() const
// --------------- VCSBaseSettingsPage
CommonOptionsPage::CommonOptionsPage(QObject *parent) :
Core::IOptionsPage(parent)
VCSBaseOptionsPage(parent)
{
m_settings.fromSettings(Core::ICore::instance()->settings());
}
......@@ -117,21 +117,6 @@ QString CommonOptionsPage::displayName() const
return QCoreApplication::translate("VCSBase", Constants::VCS_COMMON_SETTINGS_NAME);
}
QString CommonOptionsPage::category() const
{
return QLatin1String(Constants::VCS_SETTINGS_CATEGORY);
}
QString CommonOptionsPage::displayCategory() const
{
return QCoreApplication::translate("VCSBase", Constants::VCS_SETTINGS_TR_CATEGORY);
}
QIcon CommonOptionsPage::categoryIcon() const
{
return QIcon(); // TODO: Icon for Version Control
}
QWidget *CommonOptionsPage::createPage(QWidget *parent)
{
m_widget = new CommonSettingsWidget(parent);
......
......@@ -32,7 +32,8 @@
#include "commonvcssettings.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include "vcsbaseoptionspage.h"
#include <QtCore/QPointer>
#include <QtGui/QWidget>
......@@ -48,6 +49,7 @@ namespace Internal {
class CommonSettingsWidget : public QWidget
{
Q_OBJECT
public:
explicit CommonSettingsWidget(QWidget *parent = 0);
virtual ~CommonSettingsWidget();
......@@ -61,18 +63,16 @@ private:
Ui::CommonSettingsPage *m_ui;
};
class CommonOptionsPage : public Core::IOptionsPage
class CommonOptionsPage : public VCSBaseOptionsPage
{
Q_OBJECT
public:
explicit CommonOptionsPage(QObject *parent = 0);
virtual ~CommonOptionsPage();
virtual QString id() const;
virtual QString displayName() const;
virtual QString category() const;
virtual QString displayCategory() const;
virtual QIcon categoryIcon() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
......
......@@ -26,7 +26,8 @@ HEADERS += vcsbase_global.h \
checkoutjobs.h \
basecheckoutwizardpage.h \
vcsbaseoutputwindow.h \
cleandialog.h
cleandialog.h \
vcsbaseoptionspage.h
SOURCES += vcsplugin.cpp \
vcsbaseplugin.cpp \
......@@ -49,7 +50,8 @@ SOURCES += vcsplugin.cpp \
checkoutjobs.cpp \
basecheckoutwizardpage.cpp \
vcsbaseoutputwindow.cpp \
cleandialog.cpp
cleandialog.cpp \
vcsbaseoptionspage.cpp
RESOURCES += vcsbase.qrc
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "vcsbaseoptionspage.h"
#include "vcsbaseconstants.h"
#include <QCoreApplication>
namespace VCSBase {
VCSBaseOptionsPage::VCSBaseOptionsPage(QObject *parent) :
Core::IOptionsPage(parent)
{
}
QString VCSBaseOptionsPage::category() const
{
return QLatin1String(Constants::VCS_SETTINGS_CATEGORY);
}
QString VCSBaseOptionsPage::displayCategory() const
{
return QCoreApplication::translate("VCSBase", Constants::VCS_SETTINGS_TR_CATEGORY);
}
QIcon VCSBaseOptionsPage::categoryIcon() const
{
return QIcon(); // TODO: Icon for Version Control
}
} // namespace VCSBase
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef VCSBASEOPTIONSPAGE_H
#define VCSBASEOPTIONSPAGE_H
#include <coreplugin/dialogs/ioptionspage.h>
#include "vcsbase_global.h"
namespace VCSBase {
/**
* An abstract options page in the Version Control category.
*/
class VCSBASE_EXPORT VCSBaseOptionsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
explicit VCSBaseOptionsPage(QObject *parent = 0);
QString category() const;
QString displayCategory() const;
QIcon categoryIcon() const;
};
} // namespace VCSBase
#endif // VCSBASEOPTIONSPAGE_H
Supports Markdown
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