forked from qt-creator/qt-creator
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:
@@ -646,7 +646,7 @@ void BranchModel::parseOutputLine(const QString &line)
|
||||
const QString fullName = lineParts.at(1);
|
||||
|
||||
bool current = (sha == m_currentSha);
|
||||
bool showTags = m_client->settings()->boolValue(GitSettings::showTagsKey);
|
||||
bool showTags = m_client->settings().boolValue(GitSettings::showTagsKey);
|
||||
|
||||
// insert node into tree:
|
||||
QStringList nameParts = fullName.split(QLatin1Char('/'));
|
||||
|
||||
@@ -393,21 +393,19 @@ class BaseGitDiffArgumentsWidget : public VcsBaseEditorParameterWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BaseGitDiffArgumentsWidget(GitSettings *settings, QWidget *parent = 0) :
|
||||
BaseGitDiffArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) :
|
||||
VcsBaseEditorParameterWidget(parent)
|
||||
{
|
||||
QTC_ASSERT(settings, return);
|
||||
|
||||
m_patienceButton = addToggleButton(
|
||||
QLatin1String("--patience"),
|
||||
tr("Patience"),
|
||||
tr("Use the patience algorithm for calculating the differences."));
|
||||
mapSetting(m_patienceButton, settings->boolPointer(GitSettings::diffPatienceKey));
|
||||
mapSetting(m_patienceButton, settings.boolPointer(GitSettings::diffPatienceKey));
|
||||
m_ignoreWSButton = addToggleButton(
|
||||
QLatin1String("--ignore-space-change"), tr("Ignore Whitespace"),
|
||||
tr("Ignore whitespace only changes."));
|
||||
mapSetting(m_ignoreWSButton,
|
||||
settings->boolPointer(GitSettings::ignoreSpaceChangesInDiffKey));
|
||||
settings.boolPointer(GitSettings::ignoreSpaceChangesInDiffKey));
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -420,15 +418,15 @@ class GitBlameArgumentsWidget : public VcsBaseEditorParameterWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GitBlameArgumentsWidget(GitSettings *settings, QWidget *parent = 0) :
|
||||
GitBlameArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) :
|
||||
VcsBaseEditorParameterWidget(parent)
|
||||
{
|
||||
mapSetting(addToggleButton(QString(), tr("Omit Date"),
|
||||
tr("Hide the date of a change from the output.")),
|
||||
settings->boolPointer(GitSettings::omitAnnotationDateKey));
|
||||
settings.boolPointer(GitSettings::omitAnnotationDateKey));
|
||||
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace"),
|
||||
tr("Ignore whitespace only changes.")),
|
||||
settings->boolPointer(GitSettings::ignoreSpaceChangesInBlameKey));
|
||||
settings.boolPointer(GitSettings::ignoreSpaceChangesInBlameKey));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -437,12 +435,12 @@ class GitLogArgumentsWidget : public BaseGitDiffArgumentsWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GitLogArgumentsWidget(GitSettings *settings, QWidget *parent = 0) :
|
||||
GitLogArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) :
|
||||
BaseGitDiffArgumentsWidget(settings, parent)
|
||||
{
|
||||
QToolButton *diffButton = addToggleButton(QLatin1String("--patch"), tr("Show Diff"),
|
||||
tr("Show difference."));
|
||||
mapSetting(diffButton, settings->boolPointer(GitSettings::logDiffKey));
|
||||
mapSetting(diffButton, settings.boolPointer(GitSettings::logDiffKey));
|
||||
connect(diffButton, &QToolButton::toggled, m_patienceButton, &QToolButton::setVisible);
|
||||
connect(diffButton, &QToolButton::toggled, m_ignoreWSButton, &QToolButton::setVisible);
|
||||
m_patienceButton->setVisible(diffButton->isChecked());
|
||||
@@ -452,7 +450,7 @@ public:
|
||||
graphArguments << (QLatin1String("--pretty=format:") + QLatin1String(graphLogFormatC));
|
||||
QToolButton *graphButton = addToggleButton(graphArguments, tr("Graph"),
|
||||
tr("Show textual graph log."));
|
||||
mapSetting(graphButton, settings->boolPointer(GitSettings::graphLogKey));
|
||||
mapSetting(graphButton, settings.boolPointer(GitSettings::graphLogKey));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -605,13 +603,10 @@ static inline void msgCannotRun(const QStringList &args, const QString &workingD
|
||||
|
||||
const char *GitClient::stashNamePrefix = "stash@{";
|
||||
|
||||
GitClient::GitClient(GitSettings *settings) :
|
||||
GitClient::GitClient() : VcsBase::VcsBaseClientImpl(new GitSettings),
|
||||
m_cachedGitVersion(0),
|
||||
m_settings(settings),
|
||||
m_disableEditor(false)
|
||||
{
|
||||
QTC_CHECK(settings);
|
||||
connect(ICore::instance(), &ICore::saveSettingsRequested, this, &GitClient::saveSettings);
|
||||
m_gitQtcEditor = QString::fromLatin1("\"%1\" -client -block -pid %2")
|
||||
.arg(QCoreApplication::applicationFilePath())
|
||||
.arg(QCoreApplication::applicationPid());
|
||||
@@ -908,7 +903,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
||||
arguments << QLatin1String("log") << QLatin1String(noColorOption)
|
||||
<< QLatin1String(decorateOption);
|
||||
|
||||
int logCount = settings()->intValue(GitSettings::logCountKey);
|
||||
int logCount = settings().intValue(GitSettings::logCountKey);
|
||||
if (logCount > 0)
|
||||
arguments << QLatin1String("-n") << QString::number(logCount);
|
||||
|
||||
@@ -939,7 +934,7 @@ void GitClient::reflog(const QString &workingDirectory)
|
||||
arguments << QLatin1String("reflog") << QLatin1String(noColorOption)
|
||||
<< QLatin1String(decorateOption);
|
||||
|
||||
int logCount = settings()->intValue(GitSettings::logCountKey);
|
||||
int logCount = settings().intValue(GitSettings::logCountKey);
|
||||
if (logCount > 0)
|
||||
arguments << QLatin1String("-n") << QString::number(logCount);
|
||||
|
||||
@@ -983,11 +978,6 @@ void GitClient::show(const QString &source, const QString &id, const QString &na
|
||||
});
|
||||
}
|
||||
|
||||
void GitClient::saveSettings()
|
||||
{
|
||||
settings()->writeSettings(ICore::settings());
|
||||
}
|
||||
|
||||
void GitClient::slotBlameRevisionRequested(const QString &workingDirectory, const QString &file,
|
||||
QString change, int lineNumber)
|
||||
{
|
||||
@@ -2027,14 +2017,14 @@ VcsCommand *GitClient::executeGit(const QString &workingDirectory,
|
||||
QProcessEnvironment GitClient::processEnvironment() const
|
||||
{
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString gitPath = settings()->stringValue(GitSettings::pathKey);
|
||||
QString gitPath = settings().stringValue(GitSettings::pathKey);
|
||||
if (!gitPath.isEmpty()) {
|
||||
gitPath += HostOsInfo::pathListSeparator();
|
||||
gitPath += environment.value(QLatin1String("PATH"));
|
||||
environment.insert(QLatin1String("PATH"), gitPath);
|
||||
}
|
||||
if (HostOsInfo::isWindowsHost()
|
||||
&& settings()->boolValue(GitSettings::winSetHomeEnvironmentKey)) {
|
||||
&& settings().boolValue(GitSettings::winSetHomeEnvironmentKey)) {
|
||||
environment.insert(QLatin1String("HOME"), QDir::toNativeSeparators(QDir::homePath()));
|
||||
}
|
||||
environment.insert(QLatin1String("GIT_EDITOR"), m_disableEditor ? QLatin1String("true") : m_gitQtcEditor);
|
||||
@@ -2414,7 +2404,7 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
|
||||
|
||||
void GitClient::launchRepositoryBrowser(const QString &workingDirectory)
|
||||
{
|
||||
const QString repBrowserBinary = settings()->stringValue(GitSettings::repositoryBrowserCmd);
|
||||
const QString repBrowserBinary = settings().stringValue(GitSettings::repositoryBrowserCmd);
|
||||
if (!repBrowserBinary.isEmpty())
|
||||
QProcess::startDetached(repBrowserBinary, QStringList(workingDirectory), workingDirectory);
|
||||
}
|
||||
@@ -2434,7 +2424,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
binary = wish;
|
||||
}
|
||||
}
|
||||
const QString gitkOpts = settings()->stringValue(GitSettings::gitkOptionsKey);
|
||||
const QString gitkOpts = settings().stringValue(GitSettings::gitkOptionsKey);
|
||||
if (!gitkOpts.isEmpty())
|
||||
arguments.append(QtcProcess::splitArgs(gitkOpts, HostOsInfo::hostOs()));
|
||||
if (!fileName.isEmpty())
|
||||
@@ -2443,7 +2433,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
// This should always use QProcess::startDetached (as not to kill
|
||||
// the child), but that does not have an environment parameter.
|
||||
bool success = false;
|
||||
if (!settings()->stringValue(GitSettings::pathKey).isEmpty()) {
|
||||
if (!settings().stringValue(GitSettings::pathKey).isEmpty()) {
|
||||
auto process = new QProcess(this);
|
||||
process->setWorkingDirectory(workingDirectory);
|
||||
process->setProcessEnvironment(env);
|
||||
@@ -2495,12 +2485,12 @@ FileName GitClient::gitBinDirectory()
|
||||
|
||||
FileName GitClient::vcsBinary(bool *ok, QString *errorMessage) const
|
||||
{
|
||||
return settings()->gitExecutable(ok, errorMessage);
|
||||
return static_cast<GitSettings &>(settings()).gitExecutable(ok, errorMessage);
|
||||
}
|
||||
|
||||
int GitClient::vcsTimeout() const
|
||||
{
|
||||
return settings()->intValue(GitSettings::timeoutKey);
|
||||
return settings().intValue(GitSettings::timeoutKey);
|
||||
}
|
||||
|
||||
QTextCodec *GitClient::encoding(const QString &workingDirectory, const QByteArray &configVar) const
|
||||
@@ -3060,7 +3050,7 @@ void GitClient::subversionLog(const QString &workingDirectory)
|
||||
{
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("svn") << QLatin1String("log");
|
||||
int logCount = settings()->intValue(GitSettings::logCountKey);
|
||||
int logCount = settings().intValue(GitSettings::logCountKey);
|
||||
if (logCount > 0)
|
||||
arguments << (QLatin1String("--limit=") + QString::number(logCount));
|
||||
|
||||
@@ -3131,7 +3121,7 @@ void GitClient::asyncCommand(const QString &workingDirectory, const QStringList
|
||||
// Git might request an editor, so this must be done asynchronously
|
||||
// and without timeout
|
||||
QString gitCommand = arguments.first();
|
||||
VcsOutputWindow::appendCommand(workingDirectory, settings()->binaryPath(), arguments);
|
||||
VcsOutputWindow::appendCommand(workingDirectory, vcsBinary(), arguments);
|
||||
VcsCommand *command = createCommand(workingDirectory, 0, VcsWindowOutputBind);
|
||||
new ConflictHandler(command, workingDirectory, gitCommand);
|
||||
if (hasProgress)
|
||||
@@ -3176,7 +3166,7 @@ void GitClient::interactiveRebase(const QString &workingDirectory, const QString
|
||||
if (fixup)
|
||||
arguments << QLatin1String("--autosquash");
|
||||
arguments << commit + QLatin1Char('^');
|
||||
VcsOutputWindow::appendCommand(workingDirectory, settings()->binaryPath(), arguments);
|
||||
VcsOutputWindow::appendCommand(workingDirectory, vcsBinary(), arguments);
|
||||
if (fixup)
|
||||
m_disableEditor = true;
|
||||
asyncCommand(workingDirectory, arguments, true);
|
||||
@@ -3333,11 +3323,6 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
|
||||
}
|
||||
}
|
||||
|
||||
GitSettings *GitClient::settings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
|
||||
unsigned GitClient::gitVersion(QString *errorMessage) const
|
||||
{
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
|
||||
static const char *stashNamePrefix;
|
||||
|
||||
explicit GitClient(GitSettings *settings);
|
||||
explicit GitClient();
|
||||
|
||||
Utils::FileName vcsBinary(bool *ok = 0, QString *errorMessage = 0) const;
|
||||
int vcsTimeout() const;
|
||||
@@ -331,8 +331,6 @@ public:
|
||||
QStringList synchronousRepositoryBranches(const QString &repositoryURL,
|
||||
const QString &workingDirectory = QString()) const;
|
||||
|
||||
GitSettings *settings() const;
|
||||
|
||||
QProcessEnvironment processEnvironment() const;
|
||||
|
||||
bool beginStashScope(const QString &workingDirectory, const QString &command,
|
||||
@@ -350,7 +348,6 @@ public slots:
|
||||
void show(const QString &source,
|
||||
const QString &id,
|
||||
const QString &name = QString());
|
||||
void saveSettings();
|
||||
|
||||
private slots:
|
||||
void slotBlameRevisionRequested(const QString &workingDirectory, const QString &file,
|
||||
@@ -441,7 +438,6 @@ private:
|
||||
mutable Utils::FileName m_gitVersionForBinary;
|
||||
mutable unsigned m_cachedGitVersion;
|
||||
|
||||
GitSettings *m_settings;
|
||||
QString m_gitQtcEditor;
|
||||
QMap<QString, StashInfo> m_stashInfo;
|
||||
QStringList m_updatedSubmodules;
|
||||
|
||||
@@ -184,7 +184,8 @@ void GitEditorWidget::setPlainTextFiltered(const QString &text)
|
||||
switch (contentType())
|
||||
{
|
||||
case AnnotateOutput: {
|
||||
const bool omitAnnotationDate = plugin->settings().boolValue(GitSettings::omitAnnotationDateKey);
|
||||
const bool omitAnnotationDate
|
||||
= plugin->gitClient()->settings().boolValue(GitSettings::omitAnnotationDateKey);
|
||||
if (omitAnnotationDate)
|
||||
modText = removeAnnotationDate(text);
|
||||
break;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -85,9 +85,6 @@ public:
|
||||
|
||||
GitVersionControl *gitVersionControl() const;
|
||||
|
||||
const GitSettings &settings() const;
|
||||
void setSettings(const GitSettings &s);
|
||||
|
||||
GitClient *gitClient() const;
|
||||
Gerrit::Internal::GerritPlugin *gerritPlugin() const;
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ QString GitVersionControl::vcsTopic(const QString &directory)
|
||||
|
||||
QStringList GitVersionControl::additionalToolsPath() const
|
||||
{
|
||||
QStringList res = m_client->settings()->searchPathList();
|
||||
QStringList res = m_client->settings().searchPathList();
|
||||
const QString binaryPath = m_client->gitBinDirectory().toString();
|
||||
if (!binaryPath.isEmpty() && !res.contains(binaryPath))
|
||||
res << binaryPath;
|
||||
@@ -180,10 +180,5 @@ void GitVersionControl::emitRepositoryChanged(const QString &r)
|
||||
emit repositoryChanged(r);
|
||||
}
|
||||
|
||||
void GitVersionControl::emitConfigurationChanged()
|
||||
{
|
||||
emit configurationChanged();
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // Git
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
|
||||
void emitFilesChanged(const QStringList &);
|
||||
void emitRepositoryChanged(const QString &);
|
||||
void emitConfigurationChanged();
|
||||
|
||||
private:
|
||||
GitClient *m_client;
|
||||
|
||||
@@ -217,7 +217,7 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
|
||||
m_resetTypeComboBox->addItem(tr("Mixed"), QLatin1String("--mixed"));
|
||||
m_resetTypeComboBox->addItem(tr("Soft"), QLatin1String("--soft"));
|
||||
GitClient *client = GitPlugin::instance()->gitClient();
|
||||
m_resetTypeComboBox->setCurrentIndex(client->settings()->intValue(
|
||||
m_resetTypeComboBox->setCurrentIndex(client->settings().intValue(
|
||||
GitSettings::lastResetIndexKey));
|
||||
popUpLayout->addWidget(m_resetTypeComboBox);
|
||||
popUpLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
|
||||
@@ -247,8 +247,8 @@ bool LogChangeDialog::runDialog(const QString &repository,
|
||||
if (QDialog::exec() == QDialog::Accepted) {
|
||||
if (m_resetTypeComboBox) {
|
||||
GitClient *client = GitPlugin::instance()->gitClient();
|
||||
client->settings()->setValue(GitSettings::lastResetIndexKey,
|
||||
m_resetTypeComboBox->currentIndex());
|
||||
client->settings().setValue(GitSettings::lastResetIndexKey,
|
||||
m_resetTypeComboBox->currentIndex());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "gitplugin.h"
|
||||
#include "gitclient.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <coreplugin/messagebox.h>
|
||||
@@ -41,6 +42,8 @@
|
||||
#include <QDebug>
|
||||
#include <QTextStream>
|
||||
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -66,7 +69,7 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
||||
m_ui.repBrowserCommandPathChooser->setPromptDialogTitle(tr("Git Repository Browser Command"));
|
||||
}
|
||||
|
||||
GitSettings SettingsPageWidget::settings() const
|
||||
VcsBaseClientSettings SettingsPageWidget::settings() const
|
||||
{
|
||||
GitSettings rc;
|
||||
rc.setValue(GitSettings::pathKey, m_ui.pathLineEdit->text());
|
||||
@@ -80,7 +83,7 @@ GitSettings SettingsPageWidget::settings() const
|
||||
return rc;
|
||||
}
|
||||
|
||||
void SettingsPageWidget::setSettings(const GitSettings &s)
|
||||
void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
{
|
||||
m_ui.pathLineEdit->setText(s.stringValue(GitSettings::pathKey));
|
||||
m_ui.logCountSpinBox->setValue(s.intValue(GitSettings::logCountKey));
|
||||
@@ -104,24 +107,29 @@ QWidget *SettingsPage::widget()
|
||||
{
|
||||
if (!m_widget) {
|
||||
m_widget = new SettingsPageWidget;
|
||||
m_widget->setSettings(GitPlugin::instance()->settings());
|
||||
m_widget->setSettings(GitPlugin::instance()->gitClient()->settings());
|
||||
}
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void SettingsPage::apply()
|
||||
{
|
||||
const GitSettings newSettings = m_widget->settings();
|
||||
// Warn if git cannot be found in path if the widget is on top
|
||||
const VcsBaseClientSettings newSettings = m_widget->settings();
|
||||
if (m_widget->isVisible()) {
|
||||
bool gitFoundOk;
|
||||
QString errorMessage;
|
||||
newSettings.gitExecutable(&gitFoundOk, &errorMessage);
|
||||
static_cast<const GitSettings &>(newSettings).gitExecutable(&gitFoundOk, &errorMessage);
|
||||
if (!gitFoundOk)
|
||||
Core::AsynchronousMessageBox::warning(tr("Git Settings"), errorMessage);
|
||||
}
|
||||
|
||||
GitPlugin::instance()->setSettings(newSettings);
|
||||
VcsBaseClientSettings &s = GitPlugin::instance()->gitClient()->settings();
|
||||
if (s != newSettings) {
|
||||
s = newSettings;
|
||||
s.writeSettings(Core::ICore::settings());
|
||||
emit settingsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsPage::finish()
|
||||
|
||||
@@ -42,18 +42,20 @@ QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace VcsBase {
|
||||
class VcsBaseClientSettings;
|
||||
} // namespace VcsBase
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
class GitSettings;
|
||||
|
||||
class SettingsPageWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SettingsPageWidget(QWidget *parent = 0);
|
||||
|
||||
GitSettings settings() const;
|
||||
void setSettings(const GitSettings &);
|
||||
VcsBase::VcsBaseClientSettings settings() const;
|
||||
void setSettings(const VcsBase::VcsBaseClientSettings &s);
|
||||
|
||||
private:
|
||||
Ui::SettingsPage m_ui;
|
||||
@@ -70,6 +72,9 @@ public:
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
signals:
|
||||
void settingsChanged();
|
||||
|
||||
private:
|
||||
QPointer<SettingsPageWidget> m_widget;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user