Vcs: Move handling of settings from VcsBaseClient to VcsBaseClientImpl

... and update users of that functionality accordingly.

Unexpected plus: Now every supported VCS actually saves their setting
when requested.

Change-Id: I02db7b2ce14e5f52d26409b2a01aea290c2a294a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2015-03-26 12:22:29 +01:00
parent d3100774f9
commit 90ce38da39
49 changed files with 342 additions and 383 deletions

View File

@@ -274,14 +274,15 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
Context context(Constants::GIT_CONTEXT);
m_settings.readSettings(ICore::settings());
m_gitClient = new GitClient(&m_settings);
m_gitClient = new GitClient;
initializeVcs(new GitVersionControl(m_gitClient), context);
// Create the settings Page
addAutoReleasedObject(new SettingsPage());
SettingsPage *options = new SettingsPage;
connect(options, &SettingsPage::settingsChanged,
versionControl(), &IVersionControl::configurationChanged);
addAutoReleasedObject(options);
static const char *describeSlot = SLOT(show(QString,QString));
const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]);
@@ -1109,7 +1110,7 @@ void GitPlugin::pull()
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QString topLevel = state.topLevel();
bool rebase = m_settings.boolValue(GitSettings::pullRebaseKey);
bool rebase = gitClient()->settings().boolValue(GitSettings::pullRebaseKey);
if (!rebase) {
QString currentBranch = m_gitClient->synchronousCurrentLocalBranch(topLevel);
@@ -1415,26 +1416,11 @@ void GitPlugin::updateBranches(const QString &repository)
void GitPlugin::updateRepositoryBrowserAction()
{
const bool repositoryEnabled = currentState().hasTopLevel();
const bool hasRepositoryBrowserCmd = !m_settings.stringValue(GitSettings::repositoryBrowserCmd).isEmpty();
const bool hasRepositoryBrowserCmd
= !gitClient()->settings().stringValue(GitSettings::repositoryBrowserCmd).isEmpty();
m_repositoryBrowserAction->setEnabled(repositoryEnabled && hasRepositoryBrowserCmd);
}
const GitSettings &GitPlugin::settings() const
{
return m_settings;
}
void GitPlugin::setSettings(const GitSettings &s)
{
if (s == m_settings)
return;
m_settings = s;
m_gitClient->saveSettings();
static_cast<GitVersionControl *>(versionControl())->emitConfigurationChanged();
updateRepositoryBrowserAction();
}
GitClient *GitPlugin::gitClient() const
{
return m_gitClient;