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) {
|
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
||||||
return new BazaarDiffConfig(settings(), toolBar);
|
return new BazaarDiffConfig(*settings, toolBar);
|
||||||
});
|
});
|
||||||
setLogConfigCreator([this](QToolBar *toolBar) {
|
setLogConfigCreator([settings](QToolBar *toolBar) {
|
||||||
return new BazaarLogConfig(settings(), toolBar);
|
return new BazaarLogConfig(*settings, toolBar);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ class BazaarClient : public VcsBase::VcsBaseClient
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BazaarClient();
|
explicit BazaarClient(BazaarSettings *settings);
|
||||||
|
|
||||||
bool synchronousSetUserId();
|
bool synchronousSetUserId();
|
||||||
BranchInfo synchronousBranchQuery(const QString &repositoryRoot) const;
|
BranchInfo synchronousBranchQuery(const QString &repositoryRoot) const;
|
||||||
|
@@ -162,7 +162,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
|
|||||||
|
|
||||||
Context context(Constants::BAZAAR_CONTEXT);
|
Context context(Constants::BAZAAR_CONTEXT);
|
||||||
|
|
||||||
m_client = new BazaarClient;
|
m_client = new BazaarClient(&m_bazaarSettings);
|
||||||
auto vcsCtrl = new BazaarControl(m_client);
|
auto vcsCtrl = new BazaarControl(m_client);
|
||||||
initializeVcs(vcsCtrl, context);
|
initializeVcs(vcsCtrl, context);
|
||||||
|
|
||||||
|
@@ -73,10 +73,10 @@ QStringList CvsDiffConfig::arguments() const
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
CvsClient::CvsClient() : VcsBaseClient(new CvsSettings)
|
CvsClient::CvsClient(CvsSettings *settings) : VcsBaseClient(settings)
|
||||||
{
|
{
|
||||||
setDiffConfigCreator([this](QToolBar *toolBar) {
|
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
||||||
return new CvsDiffConfig(settings(), toolBar);
|
return new CvsDiffConfig(*settings, toolBar);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ class CvsClient : public VcsBase::VcsBaseClient
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CvsClient();
|
explicit CvsClient(CvsSettings *settings);
|
||||||
|
|
||||||
CvsSettings &settings() const;
|
CvsSettings &settings() const;
|
||||||
void diff(const QString &workingDir, const QStringList &files,
|
void diff(const QString &workingDir, const QStringList &files,
|
||||||
|
@@ -218,7 +218,7 @@ CvsPluginPrivate::CvsPluginPrivate()
|
|||||||
auto vcsCtrl = new CvsControl(this);
|
auto vcsCtrl = new CvsControl(this);
|
||||||
initializeVcs(vcsCtrl, context);
|
initializeVcs(vcsCtrl, context);
|
||||||
|
|
||||||
m_client = new CvsClient;
|
m_client = new CvsClient(&m_settings);
|
||||||
|
|
||||||
new SettingsPage(versionControl(), this);
|
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
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MercurialClient();
|
explicit MercurialClient(MercurialSettings *settings);
|
||||||
|
|
||||||
bool synchronousClone(const QString &workingDir,
|
bool synchronousClone(const QString &workingDir,
|
||||||
const QString &srcLocation,
|
const QString &srcLocation,
|
||||||
|
@@ -140,7 +140,7 @@ MercurialPluginPrivate::MercurialPluginPrivate()
|
|||||||
dd = this;
|
dd = this;
|
||||||
Core::Context context(Constants::MERCURIAL_CONTEXT);
|
Core::Context context(Constants::MERCURIAL_CONTEXT);
|
||||||
|
|
||||||
m_client = new MercurialClient;
|
m_client = new MercurialClient(&m_settings);
|
||||||
auto vc = new MercurialControl(m_client);
|
auto vc = new MercurialControl(m_client);
|
||||||
initializeVcs(vc, context);
|
initializeVcs(vc, context);
|
||||||
|
|
||||||
|
@@ -111,6 +111,7 @@ private:
|
|||||||
void createRepositoryActions(const Core::Context &context);
|
void createRepositoryActions(const Core::Context &context);
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
|
MercurialSettings m_settings;
|
||||||
OptionsPage *optionsPage = nullptr;
|
OptionsPage *optionsPage = nullptr;
|
||||||
MercurialClient *m_client = 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) {
|
setLogConfigCreator([settings](QToolBar *toolBar) {
|
||||||
return new SubversionLogConfig(settings(), toolBar);
|
return new SubversionLogConfig(*settings, toolBar);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,13 +35,14 @@ namespace Subversion {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class SubversionDiffEditorController;
|
class SubversionDiffEditorController;
|
||||||
|
class SubversionSettings;
|
||||||
|
|
||||||
class SubversionClient : public VcsBase::VcsBaseClient
|
class SubversionClient : public VcsBase::VcsBaseClient
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SubversionClient();
|
SubversionClient(SubversionSettings *settings);
|
||||||
|
|
||||||
bool doCommit(const QString &repositoryRoot,
|
bool doCommit(const QString &repositoryRoot,
|
||||||
const QStringList &files,
|
const QStringList &files,
|
||||||
|
@@ -229,7 +229,7 @@ SubversionPluginPrivate::SubversionPluginPrivate() :
|
|||||||
auto vcsCtrl = new SubversionControl(this);
|
auto vcsCtrl = new SubversionControl(this);
|
||||||
initializeVcs(vcsCtrl, context);
|
initializeVcs(vcsCtrl, context);
|
||||||
|
|
||||||
m_client = new SubversionClient;
|
m_client = new SubversionClient(&m_settings);
|
||||||
|
|
||||||
new SettingsPage(versionControl(), this);
|
new SettingsPage(versionControl(), this);
|
||||||
|
|
||||||
|
@@ -138,6 +138,7 @@ private:
|
|||||||
|
|
||||||
const QStringList m_svnDirectories;
|
const QStringList m_svnDirectories;
|
||||||
|
|
||||||
|
SubversionSettings m_settings;
|
||||||
SubversionClient *m_client = nullptr;
|
SubversionClient *m_client = nullptr;
|
||||||
QString m_commitMessageFileName;
|
QString m_commitMessageFileName;
|
||||||
QString m_commitRepository;
|
QString m_commitRepository;
|
||||||
|
@@ -81,11 +81,6 @@ VcsBaseClientImpl::VcsBaseClientImpl(VcsBaseClientSettings *settings) :
|
|||||||
this, &VcsBaseClientImpl::saveSettings);
|
this, &VcsBaseClientImpl::saveSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsBaseClientImpl::~VcsBaseClientImpl()
|
|
||||||
{
|
|
||||||
delete m_clientSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
VcsBaseClientSettings &VcsBaseClientImpl::settings() const
|
VcsBaseClientSettings &VcsBaseClientImpl::settings() const
|
||||||
{
|
{
|
||||||
return *m_clientSettings;
|
return *m_clientSettings;
|
||||||
|
@@ -60,7 +60,7 @@ class VCSBASE_EXPORT VcsBaseClientImpl : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VcsBaseClientImpl(VcsBaseClientSettings *settings);
|
explicit VcsBaseClientImpl(VcsBaseClientSettings *settings);
|
||||||
~VcsBaseClientImpl() override;
|
~VcsBaseClientImpl() override = default;
|
||||||
|
|
||||||
VcsBaseClientSettings &settings() const;
|
VcsBaseClientSettings &settings() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user