Vcs: Register settings aspects more directly

Change-Id: I8049f71456b8e8573a2dcfce68a14fb12545865b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2023-05-26 09:41:47 +02:00
parent 419f5416c5
commit 426a9a7037
18 changed files with 71 additions and 174 deletions

View File

@@ -32,48 +32,37 @@ BazaarSettings::BazaarSettings()
setDisplayName(Tr::tr("Bazaar")); setDisplayName(Tr::tr("Bazaar"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
registerAspect(&binaryPath);
binaryPath.setExpectedKind(PathChooser::ExistingCommand); binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setDefaultValue(Constants::BAZAARDEFAULT); binaryPath.setDefaultValue(Constants::BAZAARDEFAULT);
binaryPath.setDisplayName(Tr::tr("Bazaar Command")); binaryPath.setDisplayName(Tr::tr("Bazaar Command"));
binaryPath.setHistoryCompleter("Bazaar.Command.History"); binaryPath.setHistoryCompleter("Bazaar.Command.History");
binaryPath.setLabelText(Tr::tr("Command:")); binaryPath.setLabelText(Tr::tr("Command:"));
registerAspect(&diffIgnoreWhiteSpace);
diffIgnoreWhiteSpace.setSettingsKey("diffIgnoreWhiteSpace"); diffIgnoreWhiteSpace.setSettingsKey("diffIgnoreWhiteSpace");
registerAspect(&diffIgnoreBlankLines);
diffIgnoreBlankLines.setSettingsKey("diffIgnoreBlankLines"); diffIgnoreBlankLines.setSettingsKey("diffIgnoreBlankLines");
registerAspect(&logVerbose);
logVerbose.setSettingsKey("logVerbose"); logVerbose.setSettingsKey("logVerbose");
registerAspect(&logFormat);
logForward.setSettingsKey("logForward"); logForward.setSettingsKey("logForward");
registerAspect(&logIncludeMerges);
logIncludeMerges.setSettingsKey("logIncludeMerges"); logIncludeMerges.setSettingsKey("logIncludeMerges");
registerAspect(&logFormat);
logFormat.setDisplayStyle(StringAspect::LineEditDisplay); logFormat.setDisplayStyle(StringAspect::LineEditDisplay);
logFormat.setSettingsKey("logFormat"); logFormat.setSettingsKey("logFormat");
logFormat.setDefaultValue("long"); logFormat.setDefaultValue("long");
registerAspect(&userName);
userName.setDisplayStyle(StringAspect::LineEditDisplay); userName.setDisplayStyle(StringAspect::LineEditDisplay);
userName.setLabelText(Tr::tr("Default username:")); userName.setLabelText(Tr::tr("Default username:"));
userName.setToolTip(Tr::tr("Username to use by default on commit.")); userName.setToolTip(Tr::tr("Username to use by default on commit."));
registerAspect(&userEmail);
userEmail.setDisplayStyle(StringAspect::LineEditDisplay); userEmail.setDisplayStyle(StringAspect::LineEditDisplay);
userEmail.setLabelText(Tr::tr("Default email:")); userEmail.setLabelText(Tr::tr("Default email:"));
userEmail.setToolTip(Tr::tr("Email to use by default on commit.")); userEmail.setToolTip(Tr::tr("Email to use by default on commit."));
registerAspect(&logCount);
logCount.setLabelText(Tr::tr("Log count:")); logCount.setLabelText(Tr::tr("Log count:"));
logCount.setToolTip(Tr::tr("The number of recent commit logs to show. Choose 0 to see all entries.")); logCount.setToolTip(Tr::tr("The number of recent commit logs to show. Choose 0 to see all entries."));
registerAspect(&logCount);
timeout.setLabelText(Tr::tr("Timeout:")); timeout.setLabelText(Tr::tr("Timeout:"));
timeout.setSuffix(Tr::tr("s")); timeout.setSuffix(Tr::tr("s"));

View File

@@ -12,12 +12,12 @@ class BazaarSettings final : public VcsBase::VcsBaseSettings
public: public:
BazaarSettings(); BazaarSettings();
Utils::BoolAspect diffIgnoreWhiteSpace; Utils::BoolAspect diffIgnoreWhiteSpace{this};
Utils::BoolAspect diffIgnoreBlankLines; Utils::BoolAspect diffIgnoreBlankLines{this};
Utils::BoolAspect logVerbose; Utils::BoolAspect logVerbose{this};
Utils::BoolAspect logForward; Utils::BoolAspect logForward{this};
Utils::BoolAspect logIncludeMerges; Utils::BoolAspect logIncludeMerges{this};
Utils::StringAspect logFormat; Utils::StringAspect logFormat{this};
}; };
BazaarSettings &settings(); BazaarSettings &settings();

View File

@@ -33,25 +33,21 @@ CvsSettings::CvsSettings()
setDisplayName(Tr::tr("CVS")); setDisplayName(Tr::tr("CVS"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
registerAspect(&binaryPath);
binaryPath.setDefaultValue("cvs" QTC_HOST_EXE_SUFFIX); binaryPath.setDefaultValue("cvs" QTC_HOST_EXE_SUFFIX);
binaryPath.setExpectedKind(PathChooser::ExistingCommand); binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setHistoryCompleter(QLatin1String("Cvs.Command.History")); binaryPath.setHistoryCompleter(QLatin1String("Cvs.Command.History"));
binaryPath.setDisplayName(Tr::tr("CVS Command")); binaryPath.setDisplayName(Tr::tr("CVS Command"));
binaryPath.setLabelText(Tr::tr("CVS command:")); binaryPath.setLabelText(Tr::tr("CVS command:"));
registerAspect(&cvsRoot);
cvsRoot.setDisplayStyle(StringAspect::LineEditDisplay); cvsRoot.setDisplayStyle(StringAspect::LineEditDisplay);
cvsRoot.setSettingsKey("Root"); cvsRoot.setSettingsKey("Root");
cvsRoot.setLabelText(Tr::tr("CVS root:")); cvsRoot.setLabelText(Tr::tr("CVS root:"));
registerAspect(&diffOptions);
diffOptions.setDisplayStyle(StringAspect::LineEditDisplay); diffOptions.setDisplayStyle(StringAspect::LineEditDisplay);
diffOptions.setSettingsKey("DiffOptions"); diffOptions.setSettingsKey("DiffOptions");
diffOptions.setDefaultValue("-du"); diffOptions.setDefaultValue("-du");
diffOptions.setLabelText("Diff options:"); diffOptions.setLabelText("Diff options:");
registerAspect(&describeByCommitId);
describeByCommitId.setSettingsKey("DescribeByCommitId"); describeByCommitId.setSettingsKey("DescribeByCommitId");
describeByCommitId.setDefaultValue(true); describeByCommitId.setDefaultValue(true);
describeByCommitId.setLabelText(Tr::tr("Describe all files matching commit id")); describeByCommitId.setLabelText(Tr::tr("Describe all files matching commit id"));
@@ -59,10 +55,8 @@ CvsSettings::CvsSettings()
"displayed when clicking on a revision number in the annotation view " "displayed when clicking on a revision number in the annotation view "
"(retrieved via commit ID). Otherwise, only the respective file will be displayed.")); "(retrieved via commit ID). Otherwise, only the respective file will be displayed."));
registerAspect(&diffIgnoreWhiteSpace);
diffIgnoreWhiteSpace.setSettingsKey("DiffIgnoreWhiteSpace"); diffIgnoreWhiteSpace.setSettingsKey("DiffIgnoreWhiteSpace");
registerAspect(&diffIgnoreBlankLines);
diffIgnoreBlankLines.setSettingsKey("DiffIgnoreBlankLines"); diffIgnoreBlankLines.setSettingsKey("DiffIgnoreBlankLines");
setLayouter([this](QWidget *widget) { setLayouter([this](QWidget *widget) {

View File

@@ -12,11 +12,11 @@ class CvsSettings : public VcsBase::VcsBaseSettings
public: public:
CvsSettings(); CvsSettings();
Utils::StringAspect cvsRoot; Utils::StringAspect cvsRoot{this};
Utils::StringAspect diffOptions; Utils::StringAspect diffOptions{this};
Utils::BoolAspect diffIgnoreWhiteSpace; Utils::BoolAspect diffIgnoreWhiteSpace{this};
Utils::BoolAspect diffIgnoreBlankLines; Utils::BoolAspect diffIgnoreBlankLines{this};
Utils::BoolAspect describeByCommitId; Utils::BoolAspect describeByCommitId{this};
QStringList addOptions(const QStringList &args) const; QStringList addOptions(const QStringList &args) const;
}; };

View File

@@ -33,72 +33,57 @@ FossilSettings::FossilSettings()
setDisplayName(Tr::tr("Fossil")); setDisplayName(Tr::tr("Fossil"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
registerAspect(&binaryPath);
binaryPath.setExpectedKind(PathChooser::ExistingCommand); binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setDefaultValue(Constants::FOSSILDEFAULT); binaryPath.setDefaultValue(Constants::FOSSILDEFAULT);
binaryPath.setDisplayName(Tr::tr("Fossil Command")); binaryPath.setDisplayName(Tr::tr("Fossil Command"));
binaryPath.setHistoryCompleter("Fossil.Command.History"); binaryPath.setHistoryCompleter("Fossil.Command.History");
binaryPath.setLabelText(Tr::tr("Command:")); binaryPath.setLabelText(Tr::tr("Command:"));
registerAspect(&defaultRepoPath);
defaultRepoPath.setSettingsKey("defaultRepoPath"); defaultRepoPath.setSettingsKey("defaultRepoPath");
defaultRepoPath.setExpectedKind(PathChooser::Directory); defaultRepoPath.setExpectedKind(PathChooser::Directory);
defaultRepoPath.setDisplayName(Tr::tr("Fossil Repositories")); defaultRepoPath.setDisplayName(Tr::tr("Fossil Repositories"));
defaultRepoPath.setLabelText(Tr::tr("Default path:")); defaultRepoPath.setLabelText(Tr::tr("Default path:"));
defaultRepoPath.setToolTip(Tr::tr("Directory to store local repositories by default.")); defaultRepoPath.setToolTip(Tr::tr("Directory to store local repositories by default."));
registerAspect(&userName);
userName.setDisplayStyle(StringAspect::LineEditDisplay); userName.setDisplayStyle(StringAspect::LineEditDisplay);
userName.setLabelText(Tr::tr("Default user:")); userName.setLabelText(Tr::tr("Default user:"));
userName.setToolTip(Tr::tr("Existing user to become an author of changes made to the repository.")); userName.setToolTip(Tr::tr("Existing user to become an author of changes made to the repository."));
registerAspect(&sslIdentityFile);
sslIdentityFile.setSettingsKey("sslIdentityFile"); sslIdentityFile.setSettingsKey("sslIdentityFile");
sslIdentityFile.setExpectedKind(PathChooser::File); sslIdentityFile.setExpectedKind(PathChooser::File);
sslIdentityFile.setDisplayName(Tr::tr("SSL/TLS Identity Key")); sslIdentityFile.setDisplayName(Tr::tr("SSL/TLS Identity Key"));
sslIdentityFile.setLabelText(Tr::tr("SSL/TLS identity:")); sslIdentityFile.setLabelText(Tr::tr("SSL/TLS identity:"));
sslIdentityFile.setToolTip(Tr::tr("SSL/TLS client identity key to use if requested by the server.")); sslIdentityFile.setToolTip(Tr::tr("SSL/TLS client identity key to use if requested by the server."));
registerAspect(&diffIgnoreAllWhiteSpace);
diffIgnoreAllWhiteSpace.setSettingsKey("diffIgnoreAllWhiteSpace"); diffIgnoreAllWhiteSpace.setSettingsKey("diffIgnoreAllWhiteSpace");
registerAspect(&diffStripTrailingCR);
diffStripTrailingCR.setSettingsKey("diffStripTrailingCR"); diffStripTrailingCR.setSettingsKey("diffStripTrailingCR");
registerAspect(&annotateShowCommitters);
annotateShowCommitters.setSettingsKey("annotateShowCommitters"); annotateShowCommitters.setSettingsKey("annotateShowCommitters");
registerAspect(&annotateListVersions);
annotateListVersions.setSettingsKey("annotateListVersions"); annotateListVersions.setSettingsKey("annotateListVersions");
registerAspect(&timelineWidth);
timelineWidth.setSettingsKey("timelineWidth"); timelineWidth.setSettingsKey("timelineWidth");
timelineWidth.setLabelText(Tr::tr("Log width:")); timelineWidth.setLabelText(Tr::tr("Log width:"));
timelineWidth.setToolTip(Tr::tr("The width of log entry line (>20). " timelineWidth.setToolTip(Tr::tr("The width of log entry line (>20). "
"Choose 0 to see a single line per entry.")); "Choose 0 to see a single line per entry."));
registerAspect(&timelineLineageFilter);
timelineLineageFilter.setSettingsKey("timelineLineageFilter"); timelineLineageFilter.setSettingsKey("timelineLineageFilter");
registerAspect(&timelineVerbose);
timelineVerbose.setSettingsKey("timelineVerbose"); timelineVerbose.setSettingsKey("timelineVerbose");
registerAspect(&timelineItemType);
timelineItemType.setDefaultValue("all"); timelineItemType.setDefaultValue("all");
timelineItemType.setSettingsKey("timelineItemType"); timelineItemType.setSettingsKey("timelineItemType");
registerAspect(&disableAutosync);
disableAutosync.setSettingsKey("disableAutosync"); disableAutosync.setSettingsKey("disableAutosync");
disableAutosync.setDefaultValue(true); disableAutosync.setDefaultValue(true);
disableAutosync.setLabelText(Tr::tr("Disable auto-sync")); disableAutosync.setLabelText(Tr::tr("Disable auto-sync"));
disableAutosync.setToolTip(Tr::tr("Disable automatic pull prior to commit or update and " disableAutosync.setToolTip(Tr::tr("Disable automatic pull prior to commit or update and "
"automatic push after commit or tag or branch creation.")); "automatic push after commit or tag or branch creation."));
registerAspect(&timeout);
timeout.setLabelText(Tr::tr("Timeout:")); timeout.setLabelText(Tr::tr("Timeout:"));
timeout.setSuffix(Tr::tr("s")); timeout.setSuffix(Tr::tr("s"));
registerAspect(&logCount);
logCount.setLabelText(Tr::tr("Log count:")); logCount.setLabelText(Tr::tr("Log count:"));
logCount.setToolTip(Tr::tr("The number of recent commit log entries to show. " logCount.setToolTip(Tr::tr("The number of recent commit log entries to show. "
"Choose 0 to see all entries.")); "Choose 0 to see all entries."));

View File

@@ -12,17 +12,17 @@ class FossilSettings : public VcsBase::VcsBaseSettings
public: public:
FossilSettings(); FossilSettings();
Utils::FilePathAspect defaultRepoPath; Utils::FilePathAspect defaultRepoPath{this};
Utils::FilePathAspect sslIdentityFile; Utils::FilePathAspect sslIdentityFile{this};
Utils::BoolAspect diffIgnoreAllWhiteSpace; Utils::BoolAspect diffIgnoreAllWhiteSpace{this};
Utils::BoolAspect diffStripTrailingCR; Utils::BoolAspect diffStripTrailingCR{this};
Utils::BoolAspect annotateShowCommitters; Utils::BoolAspect annotateShowCommitters{this};
Utils::BoolAspect annotateListVersions; Utils::BoolAspect annotateListVersions{this};
Utils::IntegerAspect timelineWidth; Utils::IntegerAspect timelineWidth{this};
Utils::StringAspect timelineLineageFilter; Utils::StringAspect timelineLineageFilter{this};
Utils::BoolAspect timelineVerbose; Utils::BoolAspect timelineVerbose{this};
Utils::StringAspect timelineItemType; Utils::StringAspect timelineItemType{this};
Utils::BoolAspect disableAutosync; Utils::BoolAspect disableAutosync{this};
}; };
FossilSettings &settings(); FossilSettings &settings();

View File

@@ -31,42 +31,32 @@ GitSettings::GitSettings()
setId(VcsBase::Constants::VCS_ID_GIT); setId(VcsBase::Constants::VCS_ID_GIT);
setDisplayName(Tr::tr("Git")); setDisplayName(Tr::tr("Git"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
setSettingsGroup("Git"); setSettingsGroup("Git");
path.setDisplayStyle(StringAspect::LineEditDisplay); path.setDisplayStyle(StringAspect::LineEditDisplay);
path.setLabelText(Tr::tr("Prepend to PATH:")); path.setLabelText(Tr::tr("Prepend to PATH:"));
registerAspect(&binaryPath);
binaryPath.setDefaultValue("git"); binaryPath.setDefaultValue("git");
registerAspect(&pullRebase);
pullRebase.setSettingsKey("PullRebase"); pullRebase.setSettingsKey("PullRebase");
pullRebase.setLabelText(Tr::tr("Pull with rebase")); pullRebase.setLabelText(Tr::tr("Pull with rebase"));
registerAspect(&showTags);
showTags.setSettingsKey("ShowTags"); showTags.setSettingsKey("ShowTags");
registerAspect(&omitAnnotationDate);
omitAnnotationDate.setSettingsKey("OmitAnnotationDate"); omitAnnotationDate.setSettingsKey("OmitAnnotationDate");
registerAspect(&ignoreSpaceChangesInDiff);
ignoreSpaceChangesInDiff.setSettingsKey("SpaceIgnorantDiff"); ignoreSpaceChangesInDiff.setSettingsKey("SpaceIgnorantDiff");
ignoreSpaceChangesInDiff.setDefaultValue(true); ignoreSpaceChangesInDiff.setDefaultValue(true);
registerAspect(&ignoreSpaceChangesInBlame);
ignoreSpaceChangesInBlame.setSettingsKey("SpaceIgnorantBlame"); ignoreSpaceChangesInBlame.setSettingsKey("SpaceIgnorantBlame");
ignoreSpaceChangesInBlame.setDefaultValue(true); ignoreSpaceChangesInBlame.setDefaultValue(true);
registerAspect(&blameMoveDetection);
blameMoveDetection.setSettingsKey("BlameDetectMove"); blameMoveDetection.setSettingsKey("BlameDetectMove");
blameMoveDetection.setDefaultValue(0); blameMoveDetection.setDefaultValue(0);
registerAspect(&diffPatience);
diffPatience.setSettingsKey("DiffPatience"); diffPatience.setSettingsKey("DiffPatience");
diffPatience.setDefaultValue(true); diffPatience.setDefaultValue(true);
registerAspect(&winSetHomeEnvironment);
winSetHomeEnvironment.setSettingsKey("WinSetHomeEnvironment"); winSetHomeEnvironment.setSettingsKey("WinSetHomeEnvironment");
winSetHomeEnvironment.setDefaultValue(true); winSetHomeEnvironment.setDefaultValue(true);
winSetHomeEnvironment.setLabelText(Tr::tr("Set \"HOME\" environment variable")); winSetHomeEnvironment.setLabelText(Tr::tr("Set \"HOME\" environment variable"));
@@ -84,47 +74,37 @@ GitSettings::GitSettings()
winSetHomeEnvironment.setVisible(false); winSetHomeEnvironment.setVisible(false);
} }
registerAspect(&gitkOptions);
gitkOptions.setDisplayStyle(StringAspect::LineEditDisplay); gitkOptions.setDisplayStyle(StringAspect::LineEditDisplay);
gitkOptions.setSettingsKey("GitKOptions"); gitkOptions.setSettingsKey("GitKOptions");
gitkOptions.setLabelText(Tr::tr("Arguments:")); gitkOptions.setLabelText(Tr::tr("Arguments:"));
registerAspect(&logDiff);
logDiff.setSettingsKey("LogDiff"); logDiff.setSettingsKey("LogDiff");
logDiff.setToolTip(Tr::tr("Note that huge amount of commits might take some time.")); logDiff.setToolTip(Tr::tr("Note that huge amount of commits might take some time."));
registerAspect(&repositoryBrowserCmd);
repositoryBrowserCmd.setSettingsKey("RepositoryBrowserCmd"); repositoryBrowserCmd.setSettingsKey("RepositoryBrowserCmd");
repositoryBrowserCmd.setExpectedKind(PathChooser::ExistingCommand); repositoryBrowserCmd.setExpectedKind(PathChooser::ExistingCommand);
repositoryBrowserCmd.setHistoryCompleter("Git.RepoCommand.History"); repositoryBrowserCmd.setHistoryCompleter("Git.RepoCommand.History");
repositoryBrowserCmd.setDisplayName(Tr::tr("Git Repository Browser Command")); repositoryBrowserCmd.setDisplayName(Tr::tr("Git Repository Browser Command"));
repositoryBrowserCmd.setLabelText(Tr::tr("Command:")); repositoryBrowserCmd.setLabelText(Tr::tr("Command:"));
registerAspect(&instantBlame);
instantBlame.setSettingsKey("Git Instant"); instantBlame.setSettingsKey("Git Instant");
instantBlame.setDefaultValue(true); instantBlame.setDefaultValue(true);
instantBlame.setLabelText(Tr::tr("Add instant blame annotations to editor")); instantBlame.setLabelText(Tr::tr("Add instant blame annotations to editor"));
instantBlame.setToolTip(Tr::tr("Directly annotate each line in the editor " instantBlame.setToolTip(Tr::tr("Directly annotate each line in the editor "
"when scrolling through the document.")); "when scrolling through the document."));
registerAspect(&graphLog);
graphLog.setSettingsKey("GraphLog"); graphLog.setSettingsKey("GraphLog");
registerAspect(&colorLog);
colorLog.setSettingsKey("ColorLog"); colorLog.setSettingsKey("ColorLog");
colorLog.setDefaultValue(true); colorLog.setDefaultValue(true);
registerAspect(&firstParent);
firstParent.setSettingsKey("FirstParent"); firstParent.setSettingsKey("FirstParent");
registerAspect(&followRenames);
followRenames.setSettingsKey("FollowRenames"); followRenames.setSettingsKey("FollowRenames");
followRenames.setDefaultValue(true); followRenames.setDefaultValue(true);
registerAspect(&lastResetIndex);
lastResetIndex.setSettingsKey("LastResetIndex"); lastResetIndex.setSettingsKey("LastResetIndex");
registerAspect(&refLogShowDate);
refLogShowDate.setSettingsKey("RefLogShowDate"); refLogShowDate.setSettingsKey("RefLogShowDate");
timeout.setDefaultValue(Utils::HostOsInfo::isWindowsHost() ? 60 : 30); timeout.setDefaultValue(Utils::HostOsInfo::isWindowsHost() ? 60 : 30);

View File

@@ -20,24 +20,24 @@ class GitSettings : public VcsBase::VcsBaseSettings
public: public:
GitSettings(); GitSettings();
Utils::BoolAspect pullRebase; Utils::BoolAspect pullRebase{this};
Utils::BoolAspect showTags; Utils::BoolAspect showTags{this};
Utils::BoolAspect omitAnnotationDate; Utils::BoolAspect omitAnnotationDate{this};
Utils::BoolAspect ignoreSpaceChangesInDiff; Utils::BoolAspect ignoreSpaceChangesInDiff{this};
Utils::BoolAspect ignoreSpaceChangesInBlame; Utils::BoolAspect ignoreSpaceChangesInBlame{this};
Utils::IntegerAspect blameMoveDetection; Utils::IntegerAspect blameMoveDetection{this};
Utils::BoolAspect diffPatience; Utils::BoolAspect diffPatience{this};
Utils::BoolAspect winSetHomeEnvironment; Utils::BoolAspect winSetHomeEnvironment{this};
Utils::StringAspect gitkOptions; Utils::StringAspect gitkOptions{this};
Utils::BoolAspect logDiff; Utils::BoolAspect logDiff{this};
Utils::FilePathAspect repositoryBrowserCmd; Utils::FilePathAspect repositoryBrowserCmd{this};
Utils::BoolAspect graphLog; Utils::BoolAspect graphLog{this};
Utils::BoolAspect colorLog; Utils::BoolAspect colorLog{this};
Utils::BoolAspect firstParent; Utils::BoolAspect firstParent{this};
Utils::BoolAspect followRenames; Utils::BoolAspect followRenames{this};
Utils::IntegerAspect lastResetIndex; Utils::IntegerAspect lastResetIndex{this};
Utils::BoolAspect refLogShowDate; Utils::BoolAspect refLogShowDate{this};
Utils::BoolAspect instantBlame; Utils::BoolAspect instantBlame{this};
mutable Utils::FilePath resolvedBinPath; mutable Utils::FilePath resolvedBinPath;
mutable bool tryResolve = true; mutable bool tryResolve = true;

View File

@@ -28,32 +28,24 @@ MercurialSettings::MercurialSettings()
setId(VcsBase::Constants::VCS_ID_MERCURIAL); setId(VcsBase::Constants::VCS_ID_MERCURIAL);
setDisplayName(Tr::tr("Mercurial")); setDisplayName(Tr::tr("Mercurial"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
setSettings(&settings());
setSettingsGroup("Mercurial"); setSettingsGroup("Mercurial");
setAutoApply(false);
registerAspect(&binaryPath);
binaryPath.setExpectedKind(PathChooser::ExistingCommand); binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setDefaultValue(Constants::MERCURIALDEFAULT); binaryPath.setDefaultValue(Constants::MERCURIALDEFAULT);
binaryPath.setDisplayName(Tr::tr("Mercurial Command")); binaryPath.setDisplayName(Tr::tr("Mercurial Command"));
binaryPath.setHistoryCompleter("Bazaar.Command.History"); binaryPath.setHistoryCompleter("Bazaar.Command.History");
binaryPath.setLabelText(Tr::tr("Command:")); binaryPath.setLabelText(Tr::tr("Command:"));
registerAspect(&userName);
userName.setDisplayStyle(StringAspect::LineEditDisplay); userName.setDisplayStyle(StringAspect::LineEditDisplay);
userName.setLabelText(Tr::tr("Default username:")); userName.setLabelText(Tr::tr("Default username:"));
userName.setToolTip(Tr::tr("Username to use by default on commit.")); userName.setToolTip(Tr::tr("Username to use by default on commit."));
registerAspect(&userEmail);
userEmail.setDisplayStyle(StringAspect::LineEditDisplay); userEmail.setDisplayStyle(StringAspect::LineEditDisplay);
userEmail.setLabelText(Tr::tr("Default email:")); userEmail.setLabelText(Tr::tr("Default email:"));
userEmail.setToolTip(Tr::tr("Email to use by default on commit.")); userEmail.setToolTip(Tr::tr("Email to use by default on commit."));
registerAspect(&diffIgnoreWhiteSpace);
diffIgnoreWhiteSpace.setSettingsKey("diffIgnoreWhiteSpace"); diffIgnoreWhiteSpace.setSettingsKey("diffIgnoreWhiteSpace");
registerAspect(&diffIgnoreBlankLines);
diffIgnoreBlankLines.setSettingsKey("diffIgnoreBlankLines"); diffIgnoreBlankLines.setSettingsKey("diffIgnoreBlankLines");
setLayouter([this](QWidget *widget) { setLayouter([this](QWidget *widget) {

View File

@@ -12,8 +12,8 @@ class MercurialSettings : public VcsBase::VcsBaseSettings
public: public:
MercurialSettings(); MercurialSettings();
Utils::StringAspect diffIgnoreWhiteSpace; Utils::StringAspect diffIgnoreWhiteSpace{this};
Utils::StringAspect diffIgnoreBlankLines; Utils::StringAspect diffIgnoreBlankLines{this};
}; };
MercurialSettings &settings(); MercurialSettings &settings();

View File

@@ -35,7 +35,6 @@ PerforceSettings::PerforceSettings()
setSettingsGroup("Perforce"); setSettingsGroup("Perforce");
setAutoApply(false); setAutoApply(false);
registerAspect(&p4BinaryPath);
p4BinaryPath.setDisplayStyle(StringAspect::PathChooserDisplay); p4BinaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
p4BinaryPath.setSettingsKey("Command"); p4BinaryPath.setSettingsKey("Command");
p4BinaryPath.setDefaultValue( p4BinaryPath.setDefaultValue(
@@ -45,28 +44,23 @@ PerforceSettings::PerforceSettings()
p4BinaryPath.setDisplayName(Tr::tr("Perforce Command")); p4BinaryPath.setDisplayName(Tr::tr("Perforce Command"));
p4BinaryPath.setLabelText(Tr::tr("P4 command:")); p4BinaryPath.setLabelText(Tr::tr("P4 command:"));
registerAspect(&p4Port);
p4Port.setDisplayStyle(StringAspect::LineEditDisplay); p4Port.setDisplayStyle(StringAspect::LineEditDisplay);
p4Port.setSettingsKey("Port"); p4Port.setSettingsKey("Port");
p4Port.setLabelText(Tr::tr("P4 port:")); p4Port.setLabelText(Tr::tr("P4 port:"));
registerAspect(&p4Client);
p4Client.setDisplayStyle(StringAspect::LineEditDisplay); p4Client.setDisplayStyle(StringAspect::LineEditDisplay);
p4Client.setSettingsKey("Client"); p4Client.setSettingsKey("Client");
p4Client.setLabelText(Tr::tr("P4 client:")); p4Client.setLabelText(Tr::tr("P4 client:"));
registerAspect(&p4User);
p4User.setDisplayStyle(StringAspect::LineEditDisplay); p4User.setDisplayStyle(StringAspect::LineEditDisplay);
p4User.setSettingsKey("User"); p4User.setSettingsKey("User");
p4User.setLabelText(Tr::tr("P4 user:")); p4User.setLabelText(Tr::tr("P4 user:"));
registerAspect(&logCount);
logCount.setSettingsKey("LogCount"); logCount.setSettingsKey("LogCount");
logCount.setRange(1000, 10000); logCount.setRange(1000, 10000);
logCount.setDefaultValue(1000); logCount.setDefaultValue(1000);
logCount.setLabelText(Tr::tr("Log count:")); logCount.setLabelText(Tr::tr("Log count:"));
registerAspect(&customEnv);
// The settings value has been stored with the opposite meaning for a while. // The settings value has been stored with the opposite meaning for a while.
// Avoid changing the stored value, but flip it on read/write: // Avoid changing the stored value, but flip it on read/write:
customEnv.setSettingsKey("Default"); customEnv.setSettingsKey("Default");
@@ -74,14 +68,12 @@ PerforceSettings::PerforceSettings()
customEnv.setFromSettingsTransformation(invertBoolVariant); customEnv.setFromSettingsTransformation(invertBoolVariant);
customEnv.setToSettingsTransformation(invertBoolVariant); customEnv.setToSettingsTransformation(invertBoolVariant);
registerAspect(&timeOutS);
timeOutS.setSettingsKey("TimeOut"); timeOutS.setSettingsKey("TimeOut");
timeOutS.setRange(1, 360); timeOutS.setRange(1, 360);
timeOutS.setDefaultValue(30); timeOutS.setDefaultValue(30);
timeOutS.setLabelText(Tr::tr("Timeout:")); timeOutS.setLabelText(Tr::tr("Timeout:"));
timeOutS.setSuffix(Tr::tr("s")); timeOutS.setSuffix(Tr::tr("s"));
registerAspect(&autoOpen);
autoOpen.setSettingsKey("PromptToOpen"); autoOpen.setSettingsKey("PromptToOpen");
autoOpen.setDefaultValue(true); autoOpen.setDefaultValue(true);
autoOpen.setLabelText(Tr::tr("Automatically open files when editing")); autoOpen.setLabelText(Tr::tr("Automatically open files when editing"));

View File

@@ -68,14 +68,14 @@ public:
void clearTopLevel(); void clearTopLevel();
Utils::StringAspect p4BinaryPath; Utils::StringAspect p4BinaryPath{this};
Utils::StringAspect p4Port; Utils::StringAspect p4Port{this};
Utils::StringAspect p4Client; Utils::StringAspect p4Client{this};
Utils::StringAspect p4User; Utils::StringAspect p4User{this};
Utils::IntegerAspect logCount; Utils::IntegerAspect logCount{this};
Utils::BoolAspect customEnv; Utils::BoolAspect customEnv{this};
Utils::IntegerAspect timeOutS; Utils::IntegerAspect timeOutS{this};
Utils::BoolAspect autoOpen; Utils::BoolAspect autoOpen{this};
private: private:
QStringList workingDirectoryArguments(const QString &workingDir) const; QStringList workingDirectoryArguments(const QString &workingDir) const;

View File

@@ -32,43 +32,34 @@ SubversionSettings::SubversionSettings()
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY); setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
setSettingsGroup("Subversion"); setSettingsGroup("Subversion");
registerAspect(&binaryPath);
binaryPath.setExpectedKind(PathChooser::ExistingCommand); binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setHistoryCompleter("Subversion.Command.History"); binaryPath.setHistoryCompleter("Subversion.Command.History");
binaryPath.setDefaultValue("svn" QTC_HOST_EXE_SUFFIX); binaryPath.setDefaultValue("svn" QTC_HOST_EXE_SUFFIX);
binaryPath.setDisplayName(Tr::tr("Subversion Command")); binaryPath.setDisplayName(Tr::tr("Subversion Command"));
binaryPath.setLabelText(Tr::tr("Subversion command:")); binaryPath.setLabelText(Tr::tr("Subversion command:"));
registerAspect(&useAuthentication);
useAuthentication.setSettingsKey("Authentication"); useAuthentication.setSettingsKey("Authentication");
useAuthentication.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox); useAuthentication.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
registerAspect(&userName);
userName.setSettingsKey("User"); userName.setSettingsKey("User");
userName.setDisplayStyle(StringAspect::LineEditDisplay); userName.setDisplayStyle(StringAspect::LineEditDisplay);
userName.setLabelText(Tr::tr("Username:")); userName.setLabelText(Tr::tr("Username:"));
registerAspect(&password);
password.setSettingsKey("Password"); password.setSettingsKey("Password");
password.setDisplayStyle(StringAspect::LineEditDisplay); password.setDisplayStyle(StringAspect::LineEditDisplay);
password.setLabelText(Tr::tr("Password:")); password.setLabelText(Tr::tr("Password:"));
registerAspect(&spaceIgnorantAnnotation);
spaceIgnorantAnnotation.setSettingsKey("SpaceIgnorantAnnotation"); spaceIgnorantAnnotation.setSettingsKey("SpaceIgnorantAnnotation");
spaceIgnorantAnnotation.setDefaultValue(true); spaceIgnorantAnnotation.setDefaultValue(true);
spaceIgnorantAnnotation.setLabelText(Tr::tr("Ignore whitespace changes in annotation")); spaceIgnorantAnnotation.setLabelText(Tr::tr("Ignore whitespace changes in annotation"));
registerAspect(&diffIgnoreWhiteSpace);
diffIgnoreWhiteSpace.setSettingsKey("DiffIgnoreWhiteSpace"); diffIgnoreWhiteSpace.setSettingsKey("DiffIgnoreWhiteSpace");
registerAspect(&logVerbose);
logVerbose.setSettingsKey("LogVerbose"); logVerbose.setSettingsKey("LogVerbose");
registerAspect(&logCount);
logCount.setDefaultValue(1000); logCount.setDefaultValue(1000);
logCount.setLabelText(Tr::tr("Log count:")); logCount.setLabelText(Tr::tr("Log count:"));
registerAspect(&timeout);
timeout.setLabelText(Tr::tr("Timeout:")); timeout.setLabelText(Tr::tr("Timeout:"));
timeout.setSuffix(Tr::tr("s")); timeout.setSuffix(Tr::tr("s"));

View File

@@ -14,11 +14,11 @@ public:
bool hasAuthentication() const; bool hasAuthentication() const;
Utils::BoolAspect useAuthentication; Utils::BoolAspect useAuthentication{this};
Utils::StringAspect password; Utils::StringAspect password{this};
Utils::BoolAspect spaceIgnorantAnnotation; Utils::BoolAspect spaceIgnorantAnnotation{this};
Utils::BoolAspect diffIgnoreWhiteSpace; Utils::BoolAspect diffIgnoreWhiteSpace{this};
Utils::BoolAspect logVerbose; Utils::BoolAspect logVerbose{this};
}; };
SubversionSettings &settings(); SubversionSettings &settings();

View File

@@ -20,8 +20,7 @@
using namespace Utils; using namespace Utils;
namespace VcsBase { namespace VcsBase::Internal {
namespace Internal {
// Return default for the ssh-askpass command (default to environment) // Return default for the ssh-askpass command (default to environment)
static QString sshPasswordPromptDefault() static QString sshPasswordPromptDefault()
@@ -39,7 +38,6 @@ CommonVcsSettings::CommonVcsSettings()
setSettingsGroup("VCS"); setSettingsGroup("VCS");
setAutoApply(false); setAutoApply(false);
registerAspect(&nickNameMailMap);
nickNameMailMap.setSettingsKey("NickNameMailMap"); nickNameMailMap.setSettingsKey("NickNameMailMap");
nickNameMailMap.setDisplayStyle(StringAspect::PathChooserDisplay); nickNameMailMap.setDisplayStyle(StringAspect::PathChooserDisplay);
nickNameMailMap.setExpectedKind(PathChooser::File); nickNameMailMap.setExpectedKind(PathChooser::File);
@@ -48,7 +46,6 @@ CommonVcsSettings::CommonVcsSettings()
nickNameMailMap.setToolTip(Tr::tr("A file listing nicknames in a 4-column mailmap format:\n" nickNameMailMap.setToolTip(Tr::tr("A file listing nicknames in a 4-column mailmap format:\n"
"'name <email> alias <email>'.")); "'name <email> alias <email>'."));
registerAspect(&nickNameFieldListFile);
nickNameFieldListFile.setSettingsKey("NickNameFieldListFile"); nickNameFieldListFile.setSettingsKey("NickNameFieldListFile");
nickNameFieldListFile.setDisplayStyle(StringAspect::PathChooserDisplay); nickNameFieldListFile.setDisplayStyle(StringAspect::PathChooserDisplay);
nickNameFieldListFile.setExpectedKind(PathChooser::File); nickNameFieldListFile.setExpectedKind(PathChooser::File);
@@ -57,7 +54,6 @@ CommonVcsSettings::CommonVcsSettings()
nickNameFieldListFile.setToolTip(Tr::tr("A simple file containing lines with field names like " nickNameFieldListFile.setToolTip(Tr::tr("A simple file containing lines with field names like "
"\"Reviewed-By:\" which will be added below the submit editor.")); "\"Reviewed-By:\" which will be added below the submit editor."));
registerAspect(&submitMessageCheckScript);
submitMessageCheckScript.setSettingsKey("SubmitMessageCheckScript"); submitMessageCheckScript.setSettingsKey("SubmitMessageCheckScript");
submitMessageCheckScript.setDisplayStyle(StringAspect::PathChooserDisplay); submitMessageCheckScript.setDisplayStyle(StringAspect::PathChooserDisplay);
submitMessageCheckScript.setExpectedKind(PathChooser::ExistingCommand); submitMessageCheckScript.setExpectedKind(PathChooser::ExistingCommand);
@@ -67,7 +63,6 @@ CommonVcsSettings::CommonVcsSettings()
"in a temporary file as first argument. It should return with an exit != 0 and a message " "in a temporary file as first argument. It should return with an exit != 0 and a message "
"on standard error to indicate failure.")); "on standard error to indicate failure."));
registerAspect(&sshPasswordPrompt);
sshPasswordPrompt.setSettingsKey("SshPasswordPrompt"); sshPasswordPrompt.setSettingsKey("SshPasswordPrompt");
sshPasswordPrompt.setDisplayStyle(StringAspect::PathChooserDisplay); sshPasswordPrompt.setDisplayStyle(StringAspect::PathChooserDisplay);
sshPasswordPrompt.setExpectedKind(PathChooser::ExistingCommand); sshPasswordPrompt.setExpectedKind(PathChooser::ExistingCommand);
@@ -78,12 +73,10 @@ CommonVcsSettings::CommonVcsSettings()
"for a password,\nshould a repository require SSH-authentication " "for a password,\nshould a repository require SSH-authentication "
"(see documentation on SSH and the environment variable SSH_ASKPASS).")); "(see documentation on SSH and the environment variable SSH_ASKPASS)."));
registerAspect(&lineWrap);
lineWrap.setSettingsKey("LineWrap"); lineWrap.setSettingsKey("LineWrap");
lineWrap.setDefaultValue(true); lineWrap.setDefaultValue(true);
lineWrap.setLabelText(Tr::tr("Wrap submit message at:")); lineWrap.setLabelText(Tr::tr("Wrap submit message at:"));
registerAspect(&lineWrapWidth);
lineWrapWidth.setSettingsKey("LineWrapWidth"); lineWrapWidth.setSettingsKey("LineWrapWidth");
lineWrapWidth.setSuffix(Tr::tr(" characters")); lineWrapWidth.setSuffix(Tr::tr(" characters"));
lineWrapWidth.setDefaultValue(72); lineWrapWidth.setDefaultValue(72);
@@ -152,5 +145,4 @@ CommonOptionsPage::CommonOptionsPage()
setWidgetCreator([this] { return new CommonSettingsWidget(this); }); setWidgetCreator([this] { return new CommonSettingsWidget(this); });
} }
} // namespace Internal } // VcsBase::Internal
} // namespace VcsBase

View File

@@ -7,8 +7,7 @@
#include <utils/aspects.h> #include <utils/aspects.h>
namespace VcsBase { namespace VcsBase::Internal {
namespace Internal {
class CommonVcsSettings : public Utils::AspectContainer class CommonVcsSettings : public Utils::AspectContainer
{ {
@@ -17,16 +16,16 @@ class CommonVcsSettings : public Utils::AspectContainer
public: public:
CommonVcsSettings(); CommonVcsSettings();
Utils::StringAspect nickNameMailMap; Utils::StringAspect nickNameMailMap{this};
Utils::StringAspect nickNameFieldListFile; Utils::StringAspect nickNameFieldListFile{this};
Utils::StringAspect submitMessageCheckScript; Utils::StringAspect submitMessageCheckScript{this};
// Executable run to graphically prompt for a SSH-password. // Executable run to graphically prompt for a SSH-password.
Utils::StringAspect sshPasswordPrompt; Utils::StringAspect sshPasswordPrompt{this};
Utils::BoolAspect lineWrap; Utils::BoolAspect lineWrap{this};
Utils::IntegerAspect lineWrapWidth; Utils::IntegerAspect lineWrapWidth{this};
signals: signals:
void settingsChanged(); void settingsChanged();
@@ -43,5 +42,4 @@ private:
CommonVcsSettings m_settings; CommonVcsSettings m_settings;
}; };
} // namespace Internal } // VcsBase::Internal
} // namespace VcsBase

View File

@@ -6,15 +6,7 @@
#include "vcsbasetr.h" #include "vcsbasetr.h"
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/qtcsettings.h>
#include <utils/stringutils.h>
#include <QSettings>
#include <QVariant>
using namespace Utils; using namespace Utils;
@@ -22,27 +14,19 @@ namespace VcsBase {
VcsBaseSettings::VcsBaseSettings() VcsBaseSettings::VcsBaseSettings()
{ {
setAutoApply(false);
registerAspect(&binaryPath);
binaryPath.setSettingsKey("BinaryPath"); binaryPath.setSettingsKey("BinaryPath");
registerAspect(&userName);
userName.setSettingsKey("Username"); userName.setSettingsKey("Username");
registerAspect(&userEmail);
userEmail.setSettingsKey("UserEmail"); userEmail.setSettingsKey("UserEmail");
registerAspect(&logCount);
logCount.setSettingsKey("LogCount"); logCount.setSettingsKey("LogCount");
logCount.setRange(0, 1000 * 1000); logCount.setRange(0, 1000 * 1000);
logCount.setDefaultValue(100); logCount.setDefaultValue(100);
logCount.setLabelText(Tr::tr("Log count:")); logCount.setLabelText(Tr::tr("Log count:"));
registerAspect(&path);
path.setSettingsKey("Path"); path.setSettingsKey("Path");
registerAspect(&timeout);
timeout.setSettingsKey("Timeout"); timeout.setSettingsKey("Timeout");
timeout.setRange(0, 3600 * 24 * 365); timeout.setRange(0, 3600 * 24 * 365);
timeout.setDefaultValue(30); timeout.setDefaultValue(30);

View File

@@ -15,12 +15,12 @@ public:
VcsBaseSettings(); VcsBaseSettings();
~VcsBaseSettings(); ~VcsBaseSettings();
Utils::FilePathAspect binaryPath; Utils::FilePathAspect binaryPath{this};
Utils::StringAspect userName; Utils::StringAspect userName{this};
Utils::StringAspect userEmail; Utils::StringAspect userEmail{this};
Utils::IntegerAspect logCount; Utils::IntegerAspect logCount{this};
Utils::IntegerAspect timeout; // Seconds Utils::IntegerAspect timeout{this}; // Seconds
Utils::StringAspect path; Utils::StringAspect path{this};
Utils::FilePaths searchPathList() const; Utils::FilePaths searchPathList() const;
}; };