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:
hjk
2020-01-24 10:13:02 +01:00
parent 1cd936c531
commit e0072ec165
16 changed files with 24 additions and 26 deletions

View File

@@ -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);
});
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
});
}

View File

@@ -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,

View File

@@ -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);

View File

@@ -141,7 +141,7 @@ public:
/////////////////////////////////////////////////////////////
MercurialClient::MercurialClient() : VcsBaseClient(new MercurialSettings)
MercurialClient::MercurialClient(MercurialSettings *settings) : VcsBaseClient(settings)
{
}

View File

@@ -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,

View File

@@ -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);

View File

@@ -111,6 +111,7 @@ private:
void createRepositoryActions(const Core::Context &context);
// Variables
MercurialSettings m_settings;
OptionsPage *optionsPage = nullptr;
MercurialClient *m_client = nullptr;

View File

@@ -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);
});
}

View File

@@ -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,

View File

@@ -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);

View File

@@ -138,6 +138,7 @@ private:
const QStringList m_svnDirectories;
SubversionSettings m_settings;
SubversionClient *m_client = nullptr;
QString m_commitMessageFileName;
QString m_commitRepository;

View File

@@ -81,11 +81,6 @@ VcsBaseClientImpl::VcsBaseClientImpl(VcsBaseClientSettings *settings) :
this, &VcsBaseClientImpl::saveSettings);
}
VcsBaseClientImpl::~VcsBaseClientImpl()
{
delete m_clientSettings;
}
VcsBaseClientSettings &VcsBaseClientImpl::settings() const
{
return *m_clientSettings;

View File

@@ -60,7 +60,7 @@ class VCSBASE_EXPORT VcsBaseClientImpl : public QObject
public:
explicit VcsBaseClientImpl(VcsBaseClientSettings *settings);
~VcsBaseClientImpl() override;
~VcsBaseClientImpl() override = default;
VcsBaseClientSettings &settings() const;