forked from qt-creator/qt-creator
Vcs: Code cosmetics
Drop some Utils:: and rely on some aspects' operator()() Change-Id: I40d2c2973c1c9eff443bb74b8da44e0824d8d5c6 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -433,7 +433,7 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const FilePath &workin
|
||||
RepositorySettings repoSettings;
|
||||
repoSettings.user = synchronousUserDefaultQuery(workingDirectory);
|
||||
if (repoSettings.user.isEmpty())
|
||||
repoSettings.user = settings().userName.value();
|
||||
repoSettings.user = settings().userName();
|
||||
|
||||
for (const QString &line : output.split('\n', Qt::SkipEmptyParts)) {
|
||||
// parse settings line:
|
||||
@@ -587,7 +587,7 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory,
|
||||
|
||||
const QString repoName = workingDirectory.fileName().simplified();
|
||||
const FilePath repoPath = settings().defaultRepoPath();
|
||||
const QString adminUser = settings().userName.value();
|
||||
const QString adminUser = settings().userName();
|
||||
|
||||
if (repoName.isEmpty() || repoPath.isEmpty())
|
||||
return false;
|
||||
|
@@ -50,7 +50,7 @@ QString FossilJsExtension::defaultAdminUser() const
|
||||
if (!isConfigured())
|
||||
return QString();
|
||||
|
||||
return settings().userName.value();
|
||||
return settings().userName();
|
||||
}
|
||||
|
||||
QString FossilJsExtension::defaultSslIdentityFile() const
|
||||
@@ -74,7 +74,7 @@ bool FossilJsExtension::defaultDisableAutosync() const
|
||||
if (!isConfigured())
|
||||
return false;
|
||||
|
||||
return settings().disableAutosync.value();
|
||||
return settings().disableAutosync();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -115,7 +115,7 @@ BranchView::BranchView()
|
||||
connect(m_includeOldEntriesAction, &QAction::toggled,
|
||||
this, &BranchView::setIncludeOldEntries);
|
||||
m_includeTagsAction->setCheckable(true);
|
||||
m_includeTagsAction->setChecked(settings().showTags.value());
|
||||
m_includeTagsAction->setChecked(settings().showTags());
|
||||
connect(m_includeTagsAction, &QAction::toggled,
|
||||
this, &BranchView::setIncludeTags);
|
||||
|
||||
|
@@ -2110,7 +2110,7 @@ Environment GitClient::processEnvironment() const
|
||||
Environment environment = VcsBaseClientImpl::processEnvironment();
|
||||
const FilePath gitPath = settings().path();
|
||||
environment.prependOrSetPath(gitPath);
|
||||
if (HostOsInfo::isWindowsHost() && settings().winSetHomeEnvironment.value()) {
|
||||
if (HostOsInfo::isWindowsHost() && settings().winSetHomeEnvironment()) {
|
||||
QString homePath;
|
||||
if (qtcEnvironmentVariableIsEmpty("HOMESHARE")) {
|
||||
homePath = QDir::toNativeSeparators(QDir::homePath());
|
||||
@@ -2448,7 +2448,7 @@ void GitClient::tryLaunchingGitK(const Environment &env,
|
||||
binary = wish;
|
||||
}
|
||||
}
|
||||
const QString gitkOpts = settings().gitkOptions.value();
|
||||
const QString gitkOpts = settings().gitkOptions();
|
||||
if (!gitkOpts.isEmpty())
|
||||
arguments.append(ProcessArgs::splitArgs(gitkOpts, HostOsInfo::hostOs()));
|
||||
if (!fileName.isEmpty())
|
||||
|
@@ -132,7 +132,7 @@ static QString sanitizeBlameOutput(const QString &b)
|
||||
if (b.isEmpty())
|
||||
return b;
|
||||
|
||||
const bool omitDate = settings().omitAnnotationDate.value();
|
||||
const bool omitDate = settings().omitAnnotationDate();
|
||||
const QChar space(' ');
|
||||
const int parenPos = b.indexOf(')');
|
||||
if (parenPos == -1)
|
||||
|
@@ -1437,7 +1437,7 @@ void GitPluginPrivate::setupInstantBlame()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!settings().instantBlame.value()) {
|
||||
if (!settings().instantBlame()) {
|
||||
m_lastVisitedEditorLine = -1;
|
||||
stopInstantBlame();
|
||||
return;
|
||||
@@ -1456,7 +1456,7 @@ void GitPluginPrivate::setupInstantBlame()
|
||||
|
||||
m_blameCursorPosConn = connect(widget, &QPlainTextEdit::cursorPositionChanged, this,
|
||||
[this] {
|
||||
if (!settings().instantBlame.value()) {
|
||||
if (!settings().instantBlame()) {
|
||||
disconnect(m_blameCursorPosConn);
|
||||
return;
|
||||
}
|
||||
@@ -1515,7 +1515,7 @@ CommitInfo parseBlameOutput(const QStringList &blame, const Utils::FilePath &fil
|
||||
|
||||
void GitPluginPrivate::instantBlameOnce()
|
||||
{
|
||||
if (!settings().instantBlame.value()) {
|
||||
if (!settings().instantBlame()) {
|
||||
const TextEditorWidget *widget = TextEditorWidget::currentTextEditorWidget();
|
||||
if (!widget)
|
||||
return;
|
||||
@@ -1725,7 +1725,7 @@ void GitPluginPrivate::pull()
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
FilePath topLevel = state.topLevel();
|
||||
bool rebase = settings().pullRebase.value();
|
||||
bool rebase = settings().pullRebase();
|
||||
|
||||
if (!rebase) {
|
||||
QString currentBranch = m_gitClient.synchronousCurrentLocalBranch(topLevel);
|
||||
|
@@ -69,19 +69,19 @@ GitLabServerWidget::GitLabServerWidget(Mode m, QWidget *parent)
|
||||
, m_mode(m)
|
||||
{
|
||||
m_host.setLabelText(Tr::tr("Host:"));
|
||||
m_host.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay
|
||||
: Utils::StringAspect::LineEditDisplay);
|
||||
m_host.setValidationFunction([](Utils::FancyLineEdit *l, QString *) {
|
||||
m_host.setDisplayStyle(m == Display ? StringAspect::LabelDisplay
|
||||
: StringAspect::LineEditDisplay);
|
||||
m_host.setValidationFunction([](FancyLineEdit *l, QString *) {
|
||||
return hostValid(l->text());
|
||||
});
|
||||
|
||||
m_description.setLabelText(Tr::tr("Description:"));
|
||||
m_description.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay
|
||||
: Utils::StringAspect::LineEditDisplay);
|
||||
m_description.setDisplayStyle(m == Display ? StringAspect::LabelDisplay
|
||||
: StringAspect::LineEditDisplay);
|
||||
|
||||
m_token.setLabelText(Tr::tr("Access token:"));
|
||||
m_token.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay
|
||||
: Utils::StringAspect::LineEditDisplay);
|
||||
m_token.setDisplayStyle(m == Display ? StringAspect::LabelDisplay
|
||||
: StringAspect::LineEditDisplay);
|
||||
m_token.setVisible(m == Edit);
|
||||
|
||||
m_port.setLabelText(Tr::tr("Port:"));
|
||||
@@ -89,7 +89,7 @@ GitLabServerWidget::GitLabServerWidget(Mode m, QWidget *parent)
|
||||
m_port.setValue(GitLabServer::defaultPort);
|
||||
m_port.setEnabled(m == Edit);
|
||||
m_secure.setLabelText(Tr::tr("HTTPS:"));
|
||||
m_secure.setLabelPlacement(Utils::BoolAspect::LabelPlacement::InExtraLabel);
|
||||
m_secure.setLabelPlacement(BoolAspect::LabelPlacement::InExtraLabel);
|
||||
m_secure.setDefaultValue(true);
|
||||
m_secure.setEnabled(m == Edit);
|
||||
|
||||
@@ -110,12 +110,12 @@ GitLabServerWidget::GitLabServerWidget(Mode m, QWidget *parent)
|
||||
GitLabServer GitLabServerWidget::gitLabServer() const
|
||||
{
|
||||
GitLabServer result;
|
||||
result.id = m_mode == Edit ? Utils::Id::fromName(QUuid::createUuid().toByteArray()) : m_id;
|
||||
result.host = m_host.value();
|
||||
result.description = m_description.value();
|
||||
result.token = m_token.value();
|
||||
result.port = m_port.value();
|
||||
result.secure = m_secure.value();
|
||||
result.id = m_mode == Edit ? Id::fromName(QUuid::createUuid().toByteArray()) : m_id;
|
||||
result.host = m_host();
|
||||
result.description = m_description();
|
||||
result.token = m_token();
|
||||
result.port = m_port();
|
||||
result.secure = m_secure();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -1152,7 +1152,7 @@ bool PerforcePluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
IVersionControl::SettingsFlags PerforcePluginPrivate::settingsFlags() const
|
||||
{
|
||||
SettingsFlags rc;
|
||||
if (m_settings.autoOpen.value())
|
||||
if (m_settings.autoOpen())
|
||||
rc |= AutoOpen;
|
||||
return rc;
|
||||
}
|
||||
@@ -1689,7 +1689,7 @@ void PerforcePluginPrivate::slotTopLevelFailed(const QString &errorMessage)
|
||||
void PerforcePluginPrivate::getTopLevel(const FilePath &workingDirectory, bool isSync)
|
||||
{
|
||||
// Run a new checker
|
||||
if (m_settings.p4BinaryPath.value().isEmpty())
|
||||
if (m_settings.p4BinaryPath().isEmpty())
|
||||
return;
|
||||
auto checker = new PerforceChecker(dd);
|
||||
connect(checker, &PerforceChecker::failed, dd, &PerforcePluginPrivate::slotTopLevelFailed);
|
||||
|
@@ -149,13 +149,13 @@ PerforceSettings::~PerforceSettings()
|
||||
QStringList PerforceSettings::commonP4Arguments() const
|
||||
{
|
||||
QStringList lst;
|
||||
if (customEnv.value()) {
|
||||
if (!p4Client.value().isEmpty())
|
||||
lst << "-c" << p4Client.value();
|
||||
if (!p4Port.value().isEmpty())
|
||||
lst << "-p" << p4Port.value();
|
||||
if (!p4User.value().isEmpty())
|
||||
lst << "-u" << p4User.value();
|
||||
if (customEnv()) {
|
||||
if (!p4Client().isEmpty())
|
||||
lst << "-c" << p4Client();
|
||||
if (!p4Port().isEmpty())
|
||||
lst << "-p" << p4Port();
|
||||
if (!p4User().isEmpty())
|
||||
lst << "-u" << p4User();
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ QStringList PerforceSettings::commonP4Arguments_volatile() const
|
||||
|
||||
bool PerforceSettings::isValid() const
|
||||
{
|
||||
return !m_topLevel.isEmpty() && !p4BinaryPath.value().isEmpty();
|
||||
return !m_topLevel.isEmpty() && !p4BinaryPath().isEmpty();
|
||||
}
|
||||
|
||||
bool PerforceSettings::defaultEnv() const
|
||||
|
Reference in New Issue
Block a user