forked from qt-creator/qt-creator
Vcs: Move settings ownership from VcsBaseClientImpl to plugin
Turns out CVS and Bazaar already had an unused copy there... Change-Id: I512c4d6322620e2b55d9008600ac676ce09032aa Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -101,13 +101,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
BazaarClient::BazaarClient() : VcsBaseClient(new BazaarSettings)
|
||||
BazaarClient::BazaarClient(BazaarSettings *settings) : VcsBaseClient(settings)
|
||||
{
|
||||
setDiffConfigCreator([this](QToolBar *toolBar) {
|
||||
return new BazaarDiffConfig(settings(), toolBar);
|
||||
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
||||
return new BazaarDiffConfig(*settings, toolBar);
|
||||
});
|
||||
setLogConfigCreator([this](QToolBar *toolBar) {
|
||||
return new BazaarLogConfig(settings(), toolBar);
|
||||
setLogConfigCreator([settings](QToolBar *toolBar) {
|
||||
return new BazaarLogConfig(*settings, toolBar);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ class BazaarClient : public VcsBase::VcsBaseClient
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BazaarClient();
|
||||
explicit BazaarClient(BazaarSettings *settings);
|
||||
|
||||
bool synchronousSetUserId();
|
||||
BranchInfo synchronousBranchQuery(const QString &repositoryRoot) const;
|
||||
|
@@ -162,7 +162,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
|
||||
|
||||
Context context(Constants::BAZAAR_CONTEXT);
|
||||
|
||||
m_client = new BazaarClient;
|
||||
m_client = new BazaarClient(&m_bazaarSettings);
|
||||
auto vcsCtrl = new BazaarControl(m_client);
|
||||
initializeVcs(vcsCtrl, context);
|
||||
|
||||
|
@@ -73,10 +73,10 @@ QStringList CvsDiffConfig::arguments() const
|
||||
return args;
|
||||
}
|
||||
|
||||
CvsClient::CvsClient() : VcsBaseClient(new CvsSettings)
|
||||
CvsClient::CvsClient(CvsSettings *settings) : VcsBaseClient(settings)
|
||||
{
|
||||
setDiffConfigCreator([this](QToolBar *toolBar) {
|
||||
return new CvsDiffConfig(settings(), toolBar);
|
||||
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
||||
return new CvsDiffConfig(*settings, toolBar);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ class CvsClient : public VcsBase::VcsBaseClient
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CvsClient();
|
||||
explicit CvsClient(CvsSettings *settings);
|
||||
|
||||
CvsSettings &settings() const;
|
||||
void diff(const QString &workingDir, const QStringList &files,
|
||||
|
@@ -218,7 +218,7 @@ CvsPluginPrivate::CvsPluginPrivate()
|
||||
auto vcsCtrl = new CvsControl(this);
|
||||
initializeVcs(vcsCtrl, context);
|
||||
|
||||
m_client = new CvsClient;
|
||||
m_client = new CvsClient(&m_settings);
|
||||
|
||||
new SettingsPage(versionControl(), this);
|
||||
|
||||
|
@@ -141,7 +141,7 @@ public:
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
MercurialClient::MercurialClient() : VcsBaseClient(new MercurialSettings)
|
||||
MercurialClient::MercurialClient(MercurialSettings *settings) : VcsBaseClient(settings)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ class MercurialClient : public VcsBase::VcsBaseClient
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MercurialClient();
|
||||
explicit MercurialClient(MercurialSettings *settings);
|
||||
|
||||
bool synchronousClone(const QString &workingDir,
|
||||
const QString &srcLocation,
|
||||
|
@@ -140,7 +140,7 @@ MercurialPluginPrivate::MercurialPluginPrivate()
|
||||
dd = this;
|
||||
Core::Context context(Constants::MERCURIAL_CONTEXT);
|
||||
|
||||
m_client = new MercurialClient;
|
||||
m_client = new MercurialClient(&m_settings);
|
||||
auto vc = new MercurialControl(m_client);
|
||||
initializeVcs(vc, context);
|
||||
|
||||
|
@@ -111,6 +111,7 @@ private:
|
||||
void createRepositoryActions(const Core::Context &context);
|
||||
|
||||
// Variables
|
||||
MercurialSettings m_settings;
|
||||
OptionsPage *optionsPage = nullptr;
|
||||
MercurialClient *m_client = nullptr;
|
||||
|
||||
|
@@ -69,10 +69,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
SubversionClient::SubversionClient() : VcsBaseClient(new SubversionSettings)
|
||||
SubversionClient::SubversionClient(SubversionSettings *settings) : VcsBaseClient(settings)
|
||||
{
|
||||
setLogConfigCreator([this](QToolBar *toolBar) {
|
||||
return new SubversionLogConfig(settings(), toolBar);
|
||||
setLogConfigCreator([settings](QToolBar *toolBar) {
|
||||
return new SubversionLogConfig(*settings, toolBar);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -35,13 +35,14 @@ namespace Subversion {
|
||||
namespace Internal {
|
||||
|
||||
class SubversionDiffEditorController;
|
||||
class SubversionSettings;
|
||||
|
||||
class SubversionClient : public VcsBase::VcsBaseClient
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubversionClient();
|
||||
SubversionClient(SubversionSettings *settings);
|
||||
|
||||
bool doCommit(const QString &repositoryRoot,
|
||||
const QStringList &files,
|
||||
|
@@ -229,7 +229,7 @@ SubversionPluginPrivate::SubversionPluginPrivate() :
|
||||
auto vcsCtrl = new SubversionControl(this);
|
||||
initializeVcs(vcsCtrl, context);
|
||||
|
||||
m_client = new SubversionClient;
|
||||
m_client = new SubversionClient(&m_settings);
|
||||
|
||||
new SettingsPage(versionControl(), this);
|
||||
|
||||
|
@@ -138,6 +138,7 @@ private:
|
||||
|
||||
const QStringList m_svnDirectories;
|
||||
|
||||
SubversionSettings m_settings;
|
||||
SubversionClient *m_client = nullptr;
|
||||
QString m_commitMessageFileName;
|
||||
QString m_commitRepository;
|
||||
|
@@ -81,11 +81,6 @@ VcsBaseClientImpl::VcsBaseClientImpl(VcsBaseClientSettings *settings) :
|
||||
this, &VcsBaseClientImpl::saveSettings);
|
||||
}
|
||||
|
||||
VcsBaseClientImpl::~VcsBaseClientImpl()
|
||||
{
|
||||
delete m_clientSettings;
|
||||
}
|
||||
|
||||
VcsBaseClientSettings &VcsBaseClientImpl::settings() const
|
||||
{
|
||||
return *m_clientSettings;
|
||||
|
@@ -60,7 +60,7 @@ class VCSBASE_EXPORT VcsBaseClientImpl : public QObject
|
||||
|
||||
public:
|
||||
explicit VcsBaseClientImpl(VcsBaseClientSettings *settings);
|
||||
~VcsBaseClientImpl() override;
|
||||
~VcsBaseClientImpl() override = default;
|
||||
|
||||
VcsBaseClientSettings &settings() const;
|
||||
|
||||
|
Reference in New Issue
Block a user