From aa69415ac780db4789aa36033b5a1fd0d9c6a2fa Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 16 Mar 2021 06:00:25 +0100 Subject: [PATCH] Git: Aspectify settings Change-Id: I87dfeba360967cc77cc230811bcd9f67b3ea6e38 Reviewed-by: Orgad Shaneh --- src/plugins/git/CMakeLists.txt | 1 - src/plugins/git/branchmodel.cpp | 2 +- src/plugins/git/branchview.cpp | 5 +- src/plugins/git/git.pro | 3 - src/plugins/git/git.qbs | 3 - src/plugins/git/gitclient.cpp | 65 ++--- src/plugins/git/gitclient.h | 5 +- src/plugins/git/giteditor.cpp | 3 +- src/plugins/git/gitplugin.cpp | 6 +- src/plugins/git/gitsettings.cpp | 228 ++++++++++++++---- src/plugins/git/gitsettings.h | 46 ++-- src/plugins/git/logchangedialog.cpp | 9 +- src/plugins/git/settingspage.cpp | 138 ----------- src/plugins/git/settingspage.h | 42 ---- src/plugins/git/settingspage.ui | 214 ---------------- src/plugins/vcsbase/vcsbaseclient.cpp | 26 +- src/plugins/vcsbase/vcsbaseclient.h | 9 +- src/plugins/vcsbase/vcsbaseclientsettings.cpp | 70 ++++++ src/plugins/vcsbase/vcsbaseclientsettings.h | 33 ++- 19 files changed, 379 insertions(+), 529 deletions(-) delete mode 100644 src/plugins/git/settingspage.cpp delete mode 100644 src/plugins/git/settingspage.h delete mode 100644 src/plugins/git/settingspage.ui diff --git a/src/plugins/git/CMakeLists.txt b/src/plugins/git/CMakeLists.txt index 03d0d882e5c..8c9bd94ac9b 100644 --- a/src/plugins/git/CMakeLists.txt +++ b/src/plugins/git/CMakeLists.txt @@ -35,6 +35,5 @@ add_qtc_plugin(Git remoteadditiondialog.ui remotedialog.cpp remotedialog.h remotedialog.ui remotemodel.cpp remotemodel.h - settingspage.cpp settingspage.h settingspage.ui stashdialog.cpp stashdialog.h stashdialog.ui ) diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index 61607903840..146c051ea2e 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -793,7 +793,7 @@ void BranchModel::Private::parseOutputLine(const QString &line, bool force) const qint64 age = dateTime.daysTo(QDateTime::currentDateTime()); isOld = age > Constants::OBSOLETE_COMMIT_AGE_IN_DAYS; } - bool showTags = client->settings().boolValue(GitSettings::showTagsKey); + const bool showTags = client->settings().showTags.value(); // insert node into tree: QStringList nameParts = fullName.split('/'); diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp index 959429569f9..aa4aaea214a 100644 --- a/src/plugins/git/branchview.cpp +++ b/src/plugins/git/branchview.cpp @@ -121,8 +121,7 @@ BranchView::BranchView() : connect(m_includeOldEntriesAction, &QAction::toggled, this, &BranchView::setIncludeOldEntries); m_includeTagsAction->setCheckable(true); - m_includeTagsAction->setChecked( - GitClient::instance()->settings().boolValue(GitSettings::showTagsKey)); + m_includeTagsAction->setChecked(GitClient::settings().showTags.value()); connect(m_includeTagsAction, &QAction::toggled, this, &BranchView::setIncludeTags); @@ -309,7 +308,7 @@ void BranchView::setIncludeOldEntries(bool filter) void BranchView::setIncludeTags(bool includeTags) { - GitClient::instance()->settings().setValue(GitSettings::showTagsKey, includeTags); + GitClient::settings().showTags.setValue(includeTags); refreshCurrentRepository(); } diff --git a/src/plugins/git/git.pro b/src/plugins/git/git.pro index c8cdec3dab4..36a7eb04778 100644 --- a/src/plugins/git/git.pro +++ b/src/plugins/git/git.pro @@ -7,7 +7,6 @@ HEADERS += gitplugin.h \ gitclient.h \ changeselectiondialog.h \ commitdata.h \ - settingspage.h \ giteditor.h \ annotationhighlighter.h \ gitsubmiteditorwidget.h \ @@ -30,7 +29,6 @@ SOURCES += gitplugin.cpp \ gitclient.cpp \ changeselectiondialog.cpp \ commitdata.cpp \ - settingspage.cpp \ giteditor.cpp \ annotationhighlighter.cpp \ gitsubmiteditorwidget.cpp \ @@ -50,7 +48,6 @@ SOURCES += gitplugin.cpp \ branchview.cpp FORMS += changeselectiondialog.ui \ - settingspage.ui \ gitsubmitpanel.ui \ stashdialog.ui \ remotedialog.ui \ diff --git a/src/plugins/git/git.qbs b/src/plugins/git/git.qbs index 7f2be51cc6b..de9effea893 100644 --- a/src/plugins/git/git.qbs +++ b/src/plugins/git/git.qbs @@ -62,9 +62,6 @@ QtcPlugin { "remotedialog.ui", "remotemodel.cpp", "remotemodel.h", - "settingspage.cpp", - "settingspage.h", - "settingspage.ui", "stashdialog.cpp", "stashdialog.h", "stashdialog.ui", diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 09053e77ba4..5f9436692b6 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -493,17 +493,16 @@ class BaseGitDiffArgumentsWidget : public VcsBaseEditorConfig Q_OBJECT public: - BaseGitDiffArgumentsWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) : + BaseGitDiffArgumentsWidget(GitSettings &settings, QToolBar *toolBar) : VcsBaseEditorConfig(toolBar) { m_patienceButton = addToggleButton("--patience", tr("Patience"), tr("Use the patience algorithm for calculating the differences.")); - mapSetting(m_patienceButton, settings.boolPointer(GitSettings::diffPatienceKey)); + mapSetting(m_patienceButton, &settings.diffPatience); m_ignoreWSButton = addToggleButton("--ignore-space-change", tr("Ignore Whitespace"), tr("Ignore whitespace only changes.")); - mapSetting(m_ignoreWSButton, - settings.boolPointer(GitSettings::ignoreSpaceChangesInDiffKey)); + mapSetting(m_ignoreWSButton, &settings.ignoreSpaceChangesInDiff); } protected: @@ -516,15 +515,15 @@ class GitBlameArgumentsWidget : public VcsBaseEditorConfig Q_OBJECT public: - GitBlameArgumentsWidget(VcsBaseClientSettings &settings, QToolBar *toolBar) : + GitBlameArgumentsWidget(GitSettings &settings, QToolBar *toolBar) : VcsBaseEditorConfig(toolBar) { mapSetting(addToggleButton(QString(), tr("Omit Date"), tr("Hide the date of a change from the output.")), - settings.boolPointer(GitSettings::omitAnnotationDateKey)); + &settings.omitAnnotationDate); mapSetting(addToggleButton("-w", tr("Ignore Whitespace"), tr("Ignore whitespace only changes.")), - settings.boolPointer(GitSettings::ignoreSpaceChangesInBlameKey)); + &settings.ignoreSpaceChangesInBlame); const QList logChoices = { ChoiceItem(tr("No Move Detection"), ""), @@ -533,7 +532,7 @@ public: ChoiceItem(tr("Detect Moves and Copies Between Files"), "-M -C -C") }; mapSetting(addChoices(tr("Move detection"), {}, logChoices), - settings.intPointer(GitSettings::blameMoveDetection)); + &settings.blameMoveDetection); addReloadButton(); } @@ -544,13 +543,13 @@ class BaseGitLogArgumentsWidget : public BaseGitDiffArgumentsWidget Q_OBJECT public: - BaseGitLogArgumentsWidget(VcsBaseClientSettings &settings, GitEditorWidget *editor) : + BaseGitLogArgumentsWidget(GitSettings &settings, GitEditorWidget *editor) : BaseGitDiffArgumentsWidget(settings, editor->toolBar()) { QToolBar *toolBar = editor->toolBar(); QAction *diffButton = addToggleButton(patchOption, tr("Diff"), tr("Show difference.")); - mapSetting(diffButton, settings.boolPointer(GitSettings::logDiffKey)); + mapSetting(diffButton, &settings.logDiff); connect(diffButton, &QAction::toggled, m_patienceButton, &QAction::setVisible); connect(diffButton, &QAction::toggled, m_ignoreWSButton, &QAction::setVisible); m_patienceButton->setVisible(diffButton->isChecked()); @@ -585,27 +584,27 @@ class GitLogArgumentsWidget : public BaseGitLogArgumentsWidget Q_OBJECT public: - GitLogArgumentsWidget(VcsBaseClientSettings &settings, bool fileRelated, GitEditorWidget *editor) : + GitLogArgumentsWidget(GitSettings &settings, bool fileRelated, GitEditorWidget *editor) : BaseGitLogArgumentsWidget(settings, editor) { QAction *firstParentButton = addToggleButton({"-m", "--first-parent"}, tr("First Parent"), tr("Follow only the first parent on merge commits.")); - mapSetting(firstParentButton, settings.boolPointer(GitSettings::firstParentKey)); + mapSetting(firstParentButton, &settings.firstParent); QAction *graphButton = addToggleButton(graphArguments(), tr("Graph"), tr("Show textual graph log.")); - mapSetting(graphButton, settings.boolPointer(GitSettings::graphLogKey)); + mapSetting(graphButton, &settings.graphLog); QAction *colorButton = addToggleButton(QStringList{colorOption}, tr("Color"), tr("Use colors in log.")); - mapSetting(colorButton, settings.boolPointer(GitSettings::colorLogKey)); + mapSetting(colorButton, &settings.colorLog); if (fileRelated) { QAction *followButton = addToggleButton( "--follow", tr("Follow"), tr("Show log also for previous names of the file.")); - mapSetting(followButton, settings.boolPointer(GitSettings::followRenamesKey)); + mapSetting(followButton, &settings.followRenames); } addReloadButton(); @@ -644,14 +643,14 @@ class GitRefLogArgumentsWidget : public BaseGitLogArgumentsWidget Q_OBJECT public: - GitRefLogArgumentsWidget(VcsBaseClientSettings &settings, GitEditorWidget *editor) : + GitRefLogArgumentsWidget(GitSettings &settings, GitEditorWidget *editor) : BaseGitLogArgumentsWidget(settings, editor) { QAction *showDateButton = addToggleButton("--date=iso", tr("Show Date"), tr("Show date instead of sequence.")); - mapSetting(showDateButton, settings.boolPointer(GitSettings::refLogShowDateKey)); + mapSetting(showDateButton, &settings.refLogShowDate); addReloadButton(); } @@ -784,9 +783,8 @@ static inline void msgCannotRun(const QStringList &args, const QString &workingD // ---------------- GitClient -GitClient::GitClient(GitSettings *settings) : VcsBase::VcsBaseClientImpl(settings), - m_cachedGitVersion(0), - m_disableEditor(false) +GitClient::GitClient(GitSettings *settings) + : VcsBase::VcsBaseClientImpl(nullptr, settings) { m_instance = this; m_gitQtcEditor = QString::fromLatin1("\"%1\" -client -block -pid %2") @@ -799,6 +797,11 @@ GitClient *GitClient::instance() return m_instance; } +GitSettings &GitClient::settings() +{ + return static_cast(m_instance->baseSettings()); +} + QString GitClient::findRepositoryForDirectory(const QString &directory) const { if (directory.isEmpty() || directory.endsWith("/.git") || directory.contains("/.git/")) @@ -977,8 +980,8 @@ void GitClient::requestReload(const QString &documentId, const QString &source, QTC_ASSERT(document, return); GitBaseDiffEditorController *controller = factory(document); QTC_ASSERT(controller, return); - controller->setVcsBinary(settings().binaryPath()); - controller->setVcsTimeoutS(settings().vcsTimeoutS()); + controller->setVcsBinary(settings().binaryPath.filePath()); + controller->setVcsTimeoutS(settings().timeout.value()); controller->setProcessEnvironment(processEnvironment()); controller->setWorkingDirectory(workingDirectory); controller->initialize(); @@ -1118,7 +1121,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName, editor->setWorkingDirectory(workingDir); QStringList arguments = {"log", decorateOption}; - int logCount = settings().intValue(GitSettings::logCountKey); + int logCount = settings().logCount.value(); if (logCount > 0) arguments << "-n" << QString::number(logCount); @@ -1171,7 +1174,7 @@ void GitClient::reflog(const QString &workingDirectory, const QString &ref) QStringList arguments = {"reflog", noColorOption, decorateOption}; arguments << argWidget->arguments(); - int logCount = settings().intValue(GitSettings::logCountKey); + int logCount = settings().logCount.value(); if (logCount > 0) arguments << "-n" << QString::number(logCount); @@ -2194,16 +2197,14 @@ bool GitClient::synchronousApplyPatch(const QString &workingDirectory, QProcessEnvironment GitClient::processEnvironment() const { QProcessEnvironment environment = VcsBaseClientImpl::processEnvironment(); - QString gitPath = settings().stringValue(GitSettings::pathKey); + QString gitPath = settings().path.value(); if (!gitPath.isEmpty()) { gitPath += HostOsInfo::pathListSeparator(); gitPath += environment.value("PATH"); environment.insert("PATH", gitPath); } - if (HostOsInfo::isWindowsHost() - && settings().boolValue(GitSettings::winSetHomeEnvironmentKey)) { + if (HostOsInfo::isWindowsHost() && settings().winSetHomeEnvironment.value()) environment.insert("HOME", QDir::toNativeSeparators(QDir::homePath())); - } environment.insert("GIT_EDITOR", m_disableEditor ? "true" : m_gitQtcEditor); return environment; } @@ -2551,7 +2552,7 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN void GitClient::launchRepositoryBrowser(const QString &workingDirectory) const { - const QString repBrowserBinary = settings().stringValue(GitSettings::repositoryBrowserCmd); + const QString repBrowserBinary = settings().repositoryBrowserCmd.value(); if (!repBrowserBinary.isEmpty()) QProcess::startDetached(repBrowserBinary, {workingDirectory}, workingDirectory); } @@ -2571,7 +2572,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, binary = wish; } } - const QString gitkOpts = settings().stringValue(GitSettings::gitkOptionsKey); + const QString gitkOpts = settings().gitkOptions.value(); if (!gitkOpts.isEmpty()) arguments.append(QtcProcess::splitArgs(gitkOpts, HostOsInfo::hostOs())); if (!fileName.isEmpty()) @@ -2580,7 +2581,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().path.value().isEmpty()) { auto process = new QProcess; process->setWorkingDirectory(workingDirectory); process->setProcessEnvironment(env); @@ -3226,7 +3227,7 @@ void GitClient::synchronousSubversionFetch(const QString &workingDirectory) cons void GitClient::subversionLog(const QString &workingDirectory) const { QStringList arguments = {"svn", "log"}; - int logCount = settings().intValue(GitSettings::logCountKey); + int logCount = settings().logCount.value(); if (logCount > 0) arguments << ("--limit=" + QString::number(logCount)); diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 84ad0cf81ce..c8c4cdf6501 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -140,6 +140,7 @@ public: explicit GitClient(GitSettings *settings); static GitClient *instance(); + static GitSettings &settings(); Utils::FilePath vcsBinary() const override; unsigned gitVersion(QString *errorMessage = nullptr) const; @@ -416,14 +417,14 @@ private: const QString &gitCommand, ContinueCommandMode continueMode); mutable Utils::FilePath m_gitVersionForBinary; - mutable unsigned m_cachedGitVersion; + mutable unsigned m_cachedGitVersion = 0; QString m_gitQtcEditor; QMap m_stashInfo; QString m_pushFallbackCommand; QString m_diffCommit; QStringList m_updatedSubmodules; - bool m_disableEditor; + bool m_disableEditor = false; QFutureSynchronizer m_synchronizer; // for commit updates }; diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index 7a220bae8b8..0904c96c9cd 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -152,8 +152,7 @@ static QString sanitizeBlameOutput(const QString &b) if (b.isEmpty()) return b; - const bool omitDate = GitClient::instance()->settings().boolValue( - GitSettings::omitAnnotationDateKey); + const bool omitDate = GitClient::instance()->settings().omitAnnotationDate.value(); const QChar space(' '); const int parenPos = b.indexOf(')'); if (parenPos == -1) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index ee4992bd756..4caaddbbe16 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -34,7 +34,6 @@ #include "gitsubmiteditor.h" #include "remotedialog.h" #include "stashdialog.h" -#include "settingspage.h" #include "logchangedialog.h" #include "mergetool.h" #include "gitutils.h" @@ -1486,7 +1485,7 @@ void GitPluginPrivate::pull() const VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); QString topLevel = state.topLevel(); - bool rebase = m_settings.boolValue(GitSettings::pullRebaseKey); + bool rebase = m_settings.pullRebase.value(); if (!rebase) { QString currentBranch = m_gitClient.synchronousCurrentLocalBranch(topLevel); @@ -1821,8 +1820,7 @@ QObject *GitPlugin::remoteCommand(const QStringList &options, const QString &wor void GitPluginPrivate::updateRepositoryBrowserAction() { const bool repositoryEnabled = currentState().hasTopLevel(); - const bool hasRepositoryBrowserCmd - = !m_settings.stringValue(GitSettings::repositoryBrowserCmd).isEmpty(); + const bool hasRepositoryBrowserCmd = !m_settings.repositoryBrowserCmd.value().isEmpty(); m_repositoryBrowserAction->setEnabled(repositoryEnabled && hasRepositoryBrowserCmd); } diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp index 39b0cbaffe7..8a16b905a96 100644 --- a/src/plugins/git/gitsettings.cpp +++ b/src/plugins/git/gitsettings.cpp @@ -25,76 +25,214 @@ #include "gitsettings.h" +#include #include #include -#include +#include + +#include + +#include + +using namespace Utils; +using namespace VcsBase; namespace Git { namespace Internal { -const QLatin1String GitSettings::pullRebaseKey("PullRebase"); -const QLatin1String GitSettings::showTagsKey("ShowTags"); -const QLatin1String GitSettings::omitAnnotationDateKey("OmitAnnotationDate"); -const QLatin1String GitSettings::ignoreSpaceChangesInDiffKey("SpaceIgnorantDiff"); -const QLatin1String GitSettings::ignoreSpaceChangesInBlameKey("SpaceIgnorantBlame"); -const QLatin1String GitSettings::blameMoveDetection("BlameDetectMove"); -const QLatin1String GitSettings::diffPatienceKey("DiffPatience"); -const QLatin1String GitSettings::winSetHomeEnvironmentKey("WinSetHomeEnvironment"); -const QLatin1String GitSettings::gitkOptionsKey("GitKOptions"); -const QLatin1String GitSettings::logDiffKey("LogDiff"); -const QLatin1String GitSettings::repositoryBrowserCmd("RepositoryBrowserCmd"); -const QLatin1String GitSettings::graphLogKey("GraphLog"); -const QLatin1String GitSettings::colorLogKey("ColorLog"); -const QLatin1String GitSettings::firstParentKey("FirstParent"); -const QLatin1String GitSettings::followRenamesKey("FollowRenames"); -const QLatin1String GitSettings::lastResetIndexKey("LastResetIndex"); -const QLatin1String GitSettings::refLogShowDateKey("RefLogShowDate"); - GitSettings::GitSettings() { setSettingsGroup("Git"); - declareKey(binaryPathKey, "git"); - declareKey(timeoutKey, Utils::HostOsInfo::isWindowsHost() ? 60 : 30); - declareKey(pullRebaseKey, false); - declareKey(showTagsKey, false); - declareKey(omitAnnotationDateKey, false); - declareKey(ignoreSpaceChangesInDiffKey, true); - declareKey(blameMoveDetection, 0); - declareKey(ignoreSpaceChangesInBlameKey, true); - declareKey(diffPatienceKey, true); - declareKey(winSetHomeEnvironmentKey, true); - declareKey(gitkOptionsKey, QString()); - declareKey(logDiffKey, false); - declareKey(repositoryBrowserCmd, QString()); - declareKey(graphLogKey, false); - declareKey(colorLogKey, true); - declareKey(firstParentKey, false); - declareKey(followRenamesKey, true); - declareKey(lastResetIndexKey, 0); - declareKey(refLogShowDateKey, false); + path.setDisplayStyle(StringAspect::LineEditDisplay); + path.setLabelText(tr("Prepend to PATH:")); + + registerAspect(&binaryPath); + binaryPath.setDefaultValue("git"); + + registerAspect(&pullRebase); + pullRebase.setSettingsKey("PullRebase"); + pullRebase.setLabelText(tr("Pull with rebase")); + + registerAspect(&showTags); + showTags.setSettingsKey("ShowTags"); + + registerAspect(&omitAnnotationDate); + omitAnnotationDate.setSettingsKey("OmitAnnotationDate"); + + registerAspect(&ignoreSpaceChangesInDiff); + ignoreSpaceChangesInDiff.setSettingsKey("SpaceIgnorantDiff"); + ignoreSpaceChangesInDiff.setDefaultValue(true); + + registerAspect(&ignoreSpaceChangesInBlame); + ignoreSpaceChangesInBlame.setSettingsKey("SpaceIgnorantBlame"); + ignoreSpaceChangesInBlame.setDefaultValue(true); + + registerAspect(&blameMoveDetection); + blameMoveDetection.setSettingsKey("BlameDetectMove"); + blameMoveDetection.setDefaultValue(0); + + registerAspect(&diffPatience); + diffPatience.setSettingsKey("DiffPatience"); + diffPatience.setDefaultValue(true); + + registerAspect(&winSetHomeEnvironment); + winSetHomeEnvironment.setSettingsKey("WinSetHomeEnvironment"); + winSetHomeEnvironment.setDefaultValue(true); + winSetHomeEnvironment.setLabelText(tr("Set \"HOME\" environment variable")); + if (true || HostOsInfo::isWindowsHost()) { + const QByteArray currentHome = qgetenv("HOME"); + const QString toolTip + = tr("Set the environment variable HOME to \"%1\"\n(%2).\n" + "This causes Git to look for the SSH-keys in that location\n" + "instead of its installation directory when run outside git bash."). + arg(QDir::homePath(), + currentHome.isEmpty() ? tr("not currently set") : + tr("currently set to \"%1\"").arg(QString::fromLocal8Bit(currentHome))); + winSetHomeEnvironment.setToolTip(toolTip); + } else { + winSetHomeEnvironment.setVisible(false); + } + + registerAspect(&gitkOptions); + gitkOptions.setDisplayStyle(StringAspect::LineEditDisplay); + gitkOptions.setSettingsKey("GitKOptions"); + gitkOptions.setLabelText(tr("Arguments:")); + + registerAspect(&logDiff); + logDiff.setSettingsKey("LogDiff"); + logDiff.setToolTip(tr("Note that huge amount of commits might take some time.")); + + registerAspect(&repositoryBrowserCmd); + repositoryBrowserCmd.setDisplayStyle(StringAspect::PathChooserDisplay); + repositoryBrowserCmd.setSettingsKey("RepositoryBrowserCmd"); + repositoryBrowserCmd.setExpectedKind(PathChooser::ExistingCommand); + repositoryBrowserCmd.setHistoryCompleter("Git.RepoCommand.History"); + repositoryBrowserCmd.setDisplayName(tr("Git Repository Browser Command")); + repositoryBrowserCmd.setLabelText(tr("Command:")); + + registerAspect(&graphLog); + graphLog.setSettingsKey("GraphLog"); + + registerAspect(&colorLog); + colorLog.setSettingsKey("ColorLog"); + colorLog.setDefaultValue(true); + + registerAspect(&firstParent); + firstParent.setSettingsKey("FirstParent"); + + registerAspect(&followRenames); + followRenames.setSettingsKey("FollowRenames"); + followRenames.setDefaultValue(true); + + registerAspect(&lastResetIndex); + lastResetIndex.setSettingsKey("LastResetIndex"); + + registerAspect(&refLogShowDate); + refLogShowDate.setSettingsKey("RefLogShowDate"); + + timeout.setDefaultValue(Utils::HostOsInfo::isWindowsHost() ? 60 : 30); + + note.setText(tr("Note:") + tr("Git needs to find Perl in the environment.")); + + const auto updateNoteField = [this] { + Environment env = Environment::systemEnvironment(); + env.prependOrSetPath(path.value()); + const bool showNote = env.searchInPath("perl").isEmpty(); + note.setVisible(showNote); + }; + + updateNoteField(); + QObject::connect(&path, &BaseAspect::changed, ¬e, updateNoteField); } -Utils::FilePath GitSettings::gitExecutable(bool *ok, QString *errorMessage) const +FilePath GitSettings::gitExecutable(bool *ok, QString *errorMessage) const { - // Locate binary in path if one is specified, otherwise default - // to pathless binary + // Locate binary in path if one is specified, otherwise default to pathless binary. if (ok) *ok = true; if (errorMessage) errorMessage->clear(); - Utils::FilePath binPath = binaryPath(); + FilePath binPath = binaryPath.filePath(); if (binPath.isEmpty()) { if (ok) *ok = false; if (errorMessage) - *errorMessage = QCoreApplication::translate("Git::Internal::GitSettings", - "The binary \"%1\" could not be located in the path \"%2\"") - .arg(stringValue(binaryPathKey), stringValue(pathKey)); + *errorMessage = tr("The binary \"%1\" could not be located in the path \"%2\"") + .arg(binaryPath.value(), path.value()); } return binPath; } + +// GitSettingsPageWidget + +class GitSettingsPageWidget final : public Core::IOptionsPageWidget +{ + Q_DECLARE_TR_FUNCTIONS(Git::Internal::SettingsPageWidget) + +public: + GitSettingsPageWidget(GitSettings *settings, const std::function &onChange); + + void apply() final; + +private: + std::function m_onChange; + GitSettings *m_settings; +}; + +GitSettingsPageWidget::GitSettingsPageWidget(GitSettings *settings, const std::function &onChange) + : m_onChange(onChange), m_settings(settings) +{ + GitSettings &s = *m_settings; + using namespace Layouting; + + Column { + Group { + Title(tr("Configuration")), + Row { s.path }, + s.winSetHomeEnvironment, + }, + + Group { + Title(tr("Miscellaneous")), + Row { s.logCount, s.timeout, Stretch() }, + s.pullRebase + }, + + Group { + Title(tr("Gitk")), + Row { s.gitkOptions } + }, + + Group { + Title(tr("Repository Browser")), + Row { s.repositoryBrowserCmd } + }, + + Stretch() + }.attachTo(this); +} + +void GitSettingsPageWidget::apply() +{ + if (m_settings->isDirty()) { + m_settings->apply(); + m_onChange(); + } +} + + +// GitSettingsPage + +GitSettingsPage::GitSettingsPage(GitSettings *settings, const std::function &onChange) +{ + setId(VcsBase::Constants::VCS_ID_GIT); + setDisplayName(GitSettingsPageWidget::tr("Git")); + setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); + setWidgetCreator([settings, onChange] { return new GitSettingsPageWidget(settings, onChange); }); +} + } // namespace Internal } // namespace Git diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h index 521bb91dbf2..c9917916637 100644 --- a/src/plugins/git/gitsettings.h +++ b/src/plugins/git/gitsettings.h @@ -25,6 +25,7 @@ #pragma once +#include #include namespace Git { @@ -38,32 +39,39 @@ enum CommitType }; // Todo: Add user name and password? -class GitSettings : public VcsBase::VcsBaseClientSettings +class GitSettings : public VcsBase::VcsBaseSettings { + Q_DECLARE_TR_FUNCTIONS(Git::Internal::GitSettings) + public: GitSettings(); - static const QLatin1String pullRebaseKey; - static const QLatin1String showTagsKey; - static const QLatin1String omitAnnotationDateKey; - static const QLatin1String ignoreSpaceChangesInDiffKey; - static const QLatin1String ignoreSpaceChangesInBlameKey; - static const QLatin1String blameMoveDetection; - static const QLatin1String diffPatienceKey; - static const QLatin1String winSetHomeEnvironmentKey; - static const QLatin1String gitkOptionsKey; - static const QLatin1String logDiffKey; - static const QLatin1String repositoryBrowserCmd; - static const QLatin1String graphLogKey; - static const QLatin1String colorLogKey; - static const QLatin1String firstParentKey; - static const QLatin1String followRenamesKey; - static const QLatin1String lastResetIndexKey; - static const QLatin1String refLogShowDateKey; + Utils::BoolAspect pullRebase; + Utils::BoolAspect showTags; + Utils::BoolAspect omitAnnotationDate; + Utils::BoolAspect ignoreSpaceChangesInDiff; + Utils::BoolAspect ignoreSpaceChangesInBlame; + Utils::IntegerAspect blameMoveDetection; + Utils::BoolAspect diffPatience; + Utils::BoolAspect winSetHomeEnvironment; + Utils::StringAspect gitkOptions; + Utils::BoolAspect logDiff; + Utils::StringAspect repositoryBrowserCmd; + Utils::BoolAspect graphLog; + Utils::BoolAspect colorLog; + Utils::BoolAspect firstParent; + Utils::BoolAspect followRenames; + Utils::IntegerAspect lastResetIndex; + Utils::BoolAspect refLogShowDate; + Utils::TextDisplay note; Utils::FilePath gitExecutable(bool *ok = nullptr, QString *errorMessage = nullptr) const; +}; - GitSettings &operator=(const GitSettings &s) = default; +class GitSettingsPage final : public Core::IOptionsPage +{ +public: + GitSettingsPage(GitSettings *settings, const std::function &onChange); }; } // namespace Internal diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp index 6988dd28dd5..bb923ced9df 100644 --- a/src/plugins/git/logchangedialog.cpp +++ b/src/plugins/git/logchangedialog.cpp @@ -244,8 +244,7 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) : m_resetTypeComboBox->addItem(tr("Hard"), "--hard"); m_resetTypeComboBox->addItem(tr("Mixed"), "--mixed"); m_resetTypeComboBox->addItem(tr("Soft"), "--soft"); - m_resetTypeComboBox->setCurrentIndex( - GitClient::instance()->settings().intValue(GitSettings::lastResetIndexKey)); + m_resetTypeComboBox->setCurrentIndex(GitClient::settings().lastResetIndex.value()); popUpLayout->addWidget(m_resetTypeComboBox); popUpLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); } @@ -271,10 +270,8 @@ bool LogChangeDialog::runDialog(const QString &repository, return false; if (QDialog::exec() == QDialog::Accepted) { - if (m_resetTypeComboBox) { - GitClient::instance()->settings().setValue( - GitSettings::lastResetIndexKey, m_resetTypeComboBox->currentIndex()); - } + if (m_resetTypeComboBox) + GitClient::settings().lastResetIndex.setValue(m_resetTypeComboBox->currentIndex()); return true; } return false; diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp deleted file mode 100644 index 8ef14a62869..00000000000 --- a/src/plugins/git/settingspage.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "settingspage.h" -#include "gitsettings.h" -#include "gitplugin.h" -#include "gitclient.h" - -#include "ui_settingspage.h" - -#include -#include -#include - -#include -#include - -#include - -using namespace VcsBase; - -namespace Git { -namespace Internal { - -class GitSettingsPageWidget final : public Core::IOptionsPageWidget -{ - Q_DECLARE_TR_FUNCTIONS(Git::Internal::SettingsPageWidget) - -public: - GitSettingsPageWidget(GitSettings *settings, const std::function &onChange); - - void apply() final; - -private: - void updateNoteField(); - - std::function m_onChange; - GitSettings *m_settings; - Ui::SettingsPage m_ui; -}; - -GitSettingsPageWidget::GitSettingsPageWidget(GitSettings *settings, const std::function &onChange) - : m_onChange(onChange), m_settings(settings) -{ - m_ui.setupUi(this); - if (Utils::HostOsInfo::isWindowsHost()) { - const QByteArray currentHome = qgetenv("HOME"); - const QString toolTip - = tr("Set the environment variable HOME to \"%1\"\n(%2).\n" - "This causes Git to look for the SSH-keys in that location\n" - "instead of its installation directory when run outside git bash."). - arg(QDir::homePath(), - currentHome.isEmpty() ? tr("not currently set") : - tr("currently set to \"%1\"").arg(QString::fromLocal8Bit(currentHome))); - m_ui.winHomeCheckBox->setToolTip(toolTip); - } else { - m_ui.winHomeCheckBox->setVisible(false); - } - updateNoteField(); - - m_ui.repBrowserCommandPathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); - m_ui.repBrowserCommandPathChooser->setHistoryCompleter("Git.RepoCommand.History"); - m_ui.repBrowserCommandPathChooser->setPromptDialogTitle(tr("Git Repository Browser Command")); - - connect(m_ui.pathLineEdit, &QLineEdit::textChanged, this, &GitSettingsPageWidget::updateNoteField); - - GitSettings &s = *m_settings; - m_ui.pathLineEdit->setText(s.stringValue(GitSettings::pathKey)); - m_ui.logCountSpinBox->setValue(s.intValue(GitSettings::logCountKey)); - m_ui.timeoutSpinBox->setValue(s.intValue(GitSettings::timeoutKey)); - m_ui.pullRebaseCheckBox->setChecked(s.boolValue(GitSettings::pullRebaseKey)); - m_ui.winHomeCheckBox->setChecked(s.boolValue(GitSettings::winSetHomeEnvironmentKey)); - m_ui.gitkOptionsLineEdit->setText(s.stringValue(GitSettings::gitkOptionsKey)); - m_ui.repBrowserCommandPathChooser->setPath(s.stringValue(GitSettings::repositoryBrowserCmd)); -} - -void GitSettingsPageWidget::apply() -{ - GitSettings rc = *m_settings; - rc.setValue(GitSettings::pathKey, m_ui.pathLineEdit->text()); - rc.setValue(GitSettings::logCountKey, m_ui.logCountSpinBox->value()); - rc.setValue(GitSettings::timeoutKey, m_ui.timeoutSpinBox->value()); - rc.setValue(GitSettings::pullRebaseKey, m_ui.pullRebaseCheckBox->isChecked()); - rc.setValue(GitSettings::winSetHomeEnvironmentKey, m_ui.winHomeCheckBox->isChecked()); - rc.setValue(GitSettings::gitkOptionsKey, m_ui.gitkOptionsLineEdit->text().trimmed()); - rc.setValue(GitSettings::repositoryBrowserCmd, m_ui.repBrowserCommandPathChooser->path().trimmed()); - - if (rc != *m_settings) { - *m_settings = rc; - m_onChange(); - } -} - -void GitSettingsPageWidget::updateNoteField() -{ - Utils::Environment env = Utils::Environment::systemEnvironment(); - env.prependOrSetPath(m_ui.pathLineEdit->text()); - - bool showNote = env.searchInPath("perl").isEmpty(); - - m_ui.noteFieldlabel->setVisible(showNote); - m_ui.noteLabel->setVisible(showNote); -} - -// -------- SettingsPage - -GitSettingsPage::GitSettingsPage(GitSettings *settings, const std::function &onChange) -{ - setId(VcsBase::Constants::VCS_ID_GIT); - setDisplayName(GitSettingsPageWidget::tr("Git")); - setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); - setWidgetCreator([settings, onChange] { return new GitSettingsPageWidget(settings, onChange); }); -} - -} // namespace Internal -} // namespace Git diff --git a/src/plugins/git/settingspage.h b/src/plugins/git/settingspage.h deleted file mode 100644 index cc6dfba083a..00000000000 --- a/src/plugins/git/settingspage.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace Git { -namespace Internal { - -class GitSettings; - -class GitSettingsPage final : public Core::IOptionsPage -{ -public: - GitSettingsPage(GitSettings *settings, const std::function &onChange); -}; - -} // namespace Internal -} // namespace Git diff --git a/src/plugins/git/settingspage.ui b/src/plugins/git/settingspage.ui deleted file mode 100644 index dd2e447fc9f..00000000000 --- a/src/plugins/git/settingspage.ui +++ /dev/null @@ -1,214 +0,0 @@ - - - Git::Internal::SettingsPage - - - - 0 - 0 - 705 - 403 - - - - - - - true - - - Configuration - - - - - - Prepend to PATH: - - - - - - - - - - Set "HOME" environment variable - - - - - - - <b>Note:</b> - - - - - - - Git needs to find Perl in the environment. - - - - - - - - - - Miscellaneous - - - - - - Pull with rebase - - - - - - - Qt::Horizontal - - - - 211 - 20 - - - - - - - - s - - - 10 - - - 360 - - - 30 - - - - - - - Log count: - - - - - - - Timeout: - - - - - - - Note that huge amount of commits might take some time. - - - 1000 - - - 1000 - - - - - - - - - - Gitk - - - - QFormLayout::ExpandingFieldsGrow - - - - - Arguments: - - - - - - - - - - - - - Repository Browser - - - - - - Command: - - - - - - - - 0 - 0 - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Utils::PathChooser - QWidget -
utils/pathchooser.h
- 1 - - editingFinished() - browsingFinished() - -
-
- - pathLineEdit - winHomeCheckBox - logCountSpinBox - timeoutSpinBox - pullRebaseCheckBox - gitkOptionsLineEdit - - - -
diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 86fc118cbb8..4a478c0afba 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -73,11 +73,15 @@ static Core::IEditor *locateEditor(const char *property, const QString &entry) namespace VcsBase { -VcsBaseClientImpl::VcsBaseClientImpl(VcsBaseClientSettings *settings) : - m_clientSettings(settings) +VcsBaseClientImpl::VcsBaseClientImpl(VcsBaseClientSettings *settings, VcsBaseSettings *baseSettings) : + m_clientSettings(settings), m_baseSettings(baseSettings) { - m_defaultSettings = *m_clientSettings; - m_clientSettings->readSettings(Core::ICore::settings()); + if (settings) { + m_defaultSettings = *m_clientSettings; + m_clientSettings->readSettings(Core::ICore::settings()); + } else { + m_baseSettings->readSettings(Core::ICore::settings()); + } connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested, this, &VcsBaseClientImpl::saveSettings); } @@ -87,6 +91,11 @@ VcsBaseClientSettings &VcsBaseClientImpl::settings() const return *m_clientSettings; } +VcsBaseSettings &VcsBaseClientImpl::baseSettings() const +{ + return *m_baseSettings; +} + FilePath VcsBaseClientImpl::vcsBinary() const { return settings().binaryPath(); @@ -215,7 +224,9 @@ SynchronousProcessResponse VcsBaseClientImpl::vcsSynchronousExec(const QString & int VcsBaseClientImpl::vcsTimeoutS() const { - return m_clientSettings->vcsTimeoutS(); + if (m_clientSettings) + return m_clientSettings->vcsTimeoutS(); + return m_baseSettings->timeout.value(); } VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Utils::Id kind, QString title, @@ -250,7 +261,10 @@ VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Utils::Id kind, QString void VcsBaseClientImpl::saveSettings() { - settings().writeSettings(Core::ICore::settings(), m_defaultSettings); + if (m_clientSettings) + m_clientSettings->writeSettings(Core::ICore::settings(), m_defaultSettings); + else + m_baseSettings->writeSettings(Core::ICore::settings()); } VcsBaseClient::VcsBaseClient(VcsBaseClientSettings *settings) : diff --git a/src/plugins/vcsbase/vcsbaseclient.h b/src/plugins/vcsbase/vcsbaseclient.h index 7d47ed03745..5c1b0eee188 100644 --- a/src/plugins/vcsbase/vcsbaseclient.h +++ b/src/plugins/vcsbase/vcsbaseclient.h @@ -58,10 +58,12 @@ class VCSBASE_EXPORT VcsBaseClientImpl : public QObject Q_OBJECT public: - explicit VcsBaseClientImpl(VcsBaseClientSettings *settings); + explicit VcsBaseClientImpl(VcsBaseClientSettings *settings, + VcsBaseSettings *baseSettings = nullptr); ~VcsBaseClientImpl() override = default; - VcsBaseClientSettings &settings() const; + VcsBaseClientSettings &settings() const; // FIXME: Phase out. + VcsBaseSettings &baseSettings() const; // FIXME: Rename into settings() when the original is gone. virtual Utils::FilePath vcsBinary() const; int vcsTimeoutS() const; @@ -128,8 +130,9 @@ protected: private: void saveSettings(); - VcsBaseClientSettings *m_clientSettings; + VcsBaseClientSettings *m_clientSettings; // "old" style. VcsBaseClientSettings m_defaultSettings; + VcsBaseSettings *m_baseSettings = nullptr; // Aspect based. }; class VCSBASE_EXPORT VcsBaseClient : public VcsBaseClientImpl diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.cpp b/src/plugins/vcsbase/vcsbaseclientsettings.cpp index 42760f77af1..7f30e76023b 100644 --- a/src/plugins/vcsbase/vcsbaseclientsettings.cpp +++ b/src/plugins/vcsbase/vcsbaseclientsettings.cpp @@ -397,4 +397,74 @@ QVariant VcsBaseClientSettings::keyDefaultValue(const QString &key) const return QVariant(valueType(key)); } +// VcsBaseSettings + +VcsBaseSettings::VcsBaseSettings() +{ + setAutoApply(false); + + registerAspect(&binaryPath); + binaryPath.setSettingsKey("BinaryPath"); + + registerAspect(&userName); + userName.setSettingsKey("Username"); + + registerAspect(&userEmail); + userEmail.setSettingsKey("UserEmail"); + + registerAspect(&logCount); + logCount.setSettingsKey("LogCount"); + logCount.setRange(0, 1000 * 1000); + logCount.setDefaultValue(100); + logCount.setLabelText(tr("Log count:")); + + registerAspect(&path); + path.setSettingsKey("Path"); + + registerAspect(&promptOnSubmit); + promptOnSubmit.setSettingsKey("PromptOnSubmit"); + promptOnSubmit.setDefaultValue(true); + promptOnSubmit.setLabelText(tr("Prompt on submit")); + + registerAspect(&timeout); + timeout.setSettingsKey("Timeout"); + timeout.setRange(0, 3600 * 24 * 365); + timeout.setDefaultValue(30); + timeout.setLabelText(tr("Timeout:")); + timeout.setSuffix(tr("s")); +} + +QStringList VcsBaseSettings::searchPathList() const +{ + return path.value().split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts); +} + +void VcsBaseSettings::setSettingsGroup(const QString &key) +{ + m_settingsGroup = key; +} + +void VcsBaseSettings::writeSettings(QSettings *settings) const +{ + QTC_ASSERT(!m_settingsGroup.isEmpty(), return); + + settings->remove(m_settingsGroup); + settings->beginGroup(m_settingsGroup); + forEachAspect([settings](BaseAspect *aspect) { + QtcSettings::setValueWithDefault(settings, aspect->settingsKey(), + aspect->value(), aspect->defaultValue()); + }); + settings->endGroup(); +} + +void VcsBaseSettings::readSettings(const QSettings *settings) +{ + const QString keyRoot = m_settingsGroup + '/'; + forEachAspect([settings, keyRoot](BaseAspect *aspect) { + QString key = aspect->settingsKey(); + const QVariant value = settings->value(keyRoot + key, aspect->defaultValue()); + aspect->setValue(value); + }); +} + } // namespace VcsBase diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.h b/src/plugins/vcsbase/vcsbaseclientsettings.h index 494e726597a..54f542b6936 100644 --- a/src/plugins/vcsbase/vcsbaseclientsettings.h +++ b/src/plugins/vcsbase/vcsbaseclientsettings.h @@ -27,19 +27,42 @@ #include "vcsbase_global.h" +#include + #include #include #include -QT_BEGIN_NAMESPACE -class QSettings; -QT_END_NAMESPACE - -namespace Utils { class FilePath; } namespace VcsBase { namespace Internal { class VcsBaseClientSettingsPrivate; } +class VCSBASE_EXPORT VcsBaseSettings : public Utils::AspectContainer +{ + Q_DECLARE_TR_FUNCTIONS(VcsBase::VcsBaseSettings) + +public: + VcsBaseSettings(); + + Utils::StringAspect binaryPath; + Utils::StringAspect userName; + Utils::StringAspect userEmail; + Utils::IntegerAspect logCount; + Utils::BoolAspect promptOnSubmit; + Utils::IntegerAspect timeout; // Seconds + Utils::StringAspect path; + + QStringList searchPathList() const; + + void writeSettings(QSettings *settings) const; + void readSettings(const QSettings *settings); + + void setSettingsGroup(const QString &key); + +private: + QString m_settingsGroup; +}; + class VCSBASE_EXPORT VcsBaseClientSettings { public: