forked from qt-creator/qt-creator
Bazaar, Cvs, Fossil, Mercurial, Perforce, Svn: Simplify returns
Change-Id: Ic0d6a7510a26a4a9db180594f140156b036c5090 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -19,7 +19,7 @@ QString BazaarAnnotationHighlighter::changeNumber(const QString &block) const
|
||||
const QRegularExpressionMatch match = m_changeset.match(block);
|
||||
if (match.hasMatch())
|
||||
return match.captured(1);
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
} // Bazaar::Internal
|
||||
|
||||
@@ -159,7 +159,7 @@ QString BazaarCommitWidget::committer() const
|
||||
const QString author = m_bazaarCommitPanel->authorLineEdit->text();
|
||||
const QString email = m_bazaarCommitPanel->emailLineEdit->text();
|
||||
if (author.isEmpty())
|
||||
return QString();
|
||||
return {};
|
||||
|
||||
QString user = author;
|
||||
if (!email.isEmpty()) {
|
||||
|
||||
@@ -56,7 +56,7 @@ QString BazaarEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const
|
||||
}
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
VcsBase::BaseAnnotationHighlighter *BazaarEditorWidget::createAnnotationHighlighter(const QSet<QString> &changes) const
|
||||
|
||||
@@ -112,7 +112,7 @@ PullOrPushDialog::~PullOrPushDialog() = default;
|
||||
QString PullOrPushDialog::branchLocation() const
|
||||
{
|
||||
if (m_defaultButton->isChecked())
|
||||
return QString();
|
||||
return {};
|
||||
if (m_localButton->isChecked())
|
||||
return m_localPathChooser->filePath().toString();
|
||||
return m_urlLineEdit->text();
|
||||
|
||||
@@ -90,7 +90,7 @@ QString CvsEditorWidget::changeUnderCursor(const QTextCursor &c) const
|
||||
}
|
||||
break;
|
||||
}
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
VcsBase::BaseAnnotationHighlighter *CvsEditorWidget::createAnnotationHighlighter(const QSet<QString> &changes) const
|
||||
|
||||
@@ -29,7 +29,7 @@ QString CvsSubmitEditor::stateName(State st) const
|
||||
case LocallyRemoved:
|
||||
return m_msgRemoved;
|
||||
}
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
void CvsSubmitEditor::setStateList(const StateFilePairs &statusOutput)
|
||||
|
||||
@@ -82,7 +82,7 @@ PullOrPushDialog::PullOrPushDialog(Mode mode, QWidget *parent)
|
||||
QString PullOrPushDialog::remoteLocation() const
|
||||
{
|
||||
if (m_defaultButton->isChecked())
|
||||
return QString();
|
||||
return {};
|
||||
if (m_localButton->isChecked())
|
||||
return m_localPathChooser->filePath().toString();
|
||||
return m_urlLineEdit->text();
|
||||
|
||||
@@ -47,26 +47,17 @@ QString FossilJsExtension::displayName() const
|
||||
|
||||
QString FossilJsExtension::defaultAdminUser() const
|
||||
{
|
||||
if (!isConfigured())
|
||||
return QString();
|
||||
|
||||
return settings().userName();
|
||||
return isConfigured() ? settings().userName() : QString();
|
||||
}
|
||||
|
||||
QString FossilJsExtension::defaultSslIdentityFile() const
|
||||
{
|
||||
if (!isConfigured())
|
||||
return QString();
|
||||
|
||||
return settings().sslIdentityFile().toFSPathString();
|
||||
return isConfigured() ? settings().sslIdentityFile().toFSPathString() : QString();
|
||||
}
|
||||
|
||||
QString FossilJsExtension::defaultLocalRepoPath() const
|
||||
{
|
||||
if (!isConfigured())
|
||||
return QString();
|
||||
|
||||
return settings().defaultRepoPath().toFSPathString();
|
||||
return isConfigured() ? settings().defaultRepoPath().toFSPathString() : QString();
|
||||
}
|
||||
|
||||
bool FossilJsExtension::defaultDisableAutosync() const
|
||||
|
||||
@@ -18,7 +18,7 @@ QString MercurialAnnotationHighlighter::changeNumber(const QString &block) const
|
||||
const QRegularExpressionMatch match = changeset.match(block);
|
||||
if (match.hasMatch())
|
||||
return match.captured(1);
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
} // Mercurial::Internal
|
||||
|
||||
@@ -151,7 +151,7 @@ QString MercurialCommitWidget::committer() const
|
||||
const QString author = mercurialCommitPanel->m_authorLineEdit->text();
|
||||
const QString email = mercurialCommitPanel->m_emailLineEdit->text();
|
||||
if (author.isEmpty())
|
||||
return QString();
|
||||
return {};
|
||||
|
||||
QString user = author;
|
||||
if (!email.isEmpty()) {
|
||||
|
||||
@@ -45,7 +45,7 @@ QString MercurialEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) co
|
||||
if (exactIdentifier40.match(change).hasMatch())
|
||||
return change;
|
||||
}
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
VcsBase::BaseAnnotationHighlighter *MercurialEditorWidget::createAnnotationHighlighter(const QSet<QString> &changes) const
|
||||
|
||||
@@ -46,7 +46,7 @@ QString PerforceEditorWidget::changeUnderCursor(const QTextCursor &c) const
|
||||
// Any number is regarded as change number.
|
||||
cursor.select(QTextCursor::WordUnderCursor);
|
||||
if (!cursor.hasSelection())
|
||||
return QString();
|
||||
return {};
|
||||
const QString change = cursor.selectedText();
|
||||
return m_changeNumberPattern.match(change).hasMatch() ? change : QString();
|
||||
}
|
||||
|
||||
@@ -1589,7 +1589,7 @@ QString PerforcePluginPrivate::clientFilePath(const QString &serverFilePath)
|
||||
const PerforceResponse response = runP4Cmd(m_settings.topLevelSymLinkTarget(), args,
|
||||
ShowBusyCursor|RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow);
|
||||
if (response.error)
|
||||
return QString();
|
||||
return {};
|
||||
|
||||
const QRegularExpression r("\\.\\.\\.\\sclientFile\\s(.+?)\n");
|
||||
const QRegularExpressionMatch match = r.match(response.stdOut);
|
||||
@@ -1604,14 +1604,14 @@ QString PerforcePluginPrivate::pendingChangesData()
|
||||
const PerforceResponse userResponse = runP4Cmd(m_settings.topLevelSymLinkTarget(), args,
|
||||
RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow);
|
||||
if (userResponse.error)
|
||||
return QString();
|
||||
return {};
|
||||
|
||||
const QRegularExpression r("User\\sname:\\s(\\S+?)\\s*?\n");
|
||||
QTC_ASSERT(r.isValid(), return QString());
|
||||
const QRegularExpressionMatch match = r.match(userResponse.stdOut);
|
||||
const QString user = match.hasMatch() ? match.captured(1).trimmed() : QString();
|
||||
if (user.isEmpty())
|
||||
return QString();
|
||||
return {};
|
||||
args.clear();
|
||||
args << QLatin1String("changes") << QLatin1String("-s") << QLatin1String("pending") << QLatin1String("-u") << user;
|
||||
const PerforceResponse dataResponse = runP4Cmd(m_settings.topLevelSymLinkTarget(), args,
|
||||
@@ -1644,7 +1644,7 @@ QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
|
||||
const PerforceResponse response = dd->runP4Cmd(dd->m_settings.topLevelSymLinkTarget(), args, flags);
|
||||
if (response.error) {
|
||||
*errorMessage = msgWhereFailed(perforceName, response.message);
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
QString output = response.stdOut;
|
||||
@@ -1656,7 +1656,7 @@ QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
|
||||
if (output.isEmpty()) {
|
||||
//: File is not managed by Perforce
|
||||
*errorMessage = msgWhereFailed(perforceName, Tr::tr("The file is not mapped"));
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
const QString p4fileSpec = output.mid(output.lastIndexOf(QLatin1Char(' ')) + 1);
|
||||
return dd->m_settings.mapToFileSystem(p4fileSpec);
|
||||
|
||||
@@ -89,7 +89,7 @@ Id SubversionClient::vcsEditorKind(VcsCommandTag cmd) const
|
||||
case VcsBaseClient::LogCommand: return Constants::SUBVERSION_LOG_EDITOR_ID;
|
||||
case VcsBaseClient::AnnotateCommand: return Constants::SUBVERSION_BLAME_EDITOR_ID;
|
||||
default:
|
||||
return Id();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ QString SubversionEditorWidget::changeUnderCursor(const QTextCursor &c) const
|
||||
// Any number is regarded as change number.
|
||||
cursor.select(QTextCursor::LineUnderCursor);
|
||||
if (!cursor.hasSelection())
|
||||
return QString();
|
||||
return {};
|
||||
const QString change = cursor.selectedText();
|
||||
const int pos = c.position() - cursor.selectionStart() + 1;
|
||||
// Annotation output has number, log output has revision numbers,
|
||||
@@ -72,7 +72,7 @@ QString SubversionEditorWidget::changeUnderCursor(const QTextCursor &c) const
|
||||
if (pos > start && pos <= end)
|
||||
return rev;
|
||||
}
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
VcsBase::BaseAnnotationHighlighter *SubversionEditorWidget::createAnnotationHighlighter(const QSet<QString> &changes) const
|
||||
|
||||
@@ -994,7 +994,7 @@ QString SubversionPluginPrivate::monitorFile(const FilePath &repository) const
|
||||
return fi.absoluteFilePath();
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
QString SubversionPluginPrivate::synchronousTopic(const FilePath &repository) const
|
||||
|
||||
Reference in New Issue
Block a user