forked from qt-creator/qt-creator
VcsPlugin: Simplify return statements
Change-Id: Icdf580fb1ca6860a82f3594e4676fb450b55d174 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -215,7 +215,7 @@ QString NickNameDialog::nickName() const
|
|||||||
if (const QStandardItem *item = m_model->itemFromIndex(sourceIndex))
|
if (const QStandardItem *item = m_model->itemFromIndex(sourceIndex))
|
||||||
return NickNameEntry::nickNameOf(item);
|
return NickNameEntry::nickNameOf(item);
|
||||||
}
|
}
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QStandardItemModel *NickNameDialog::createModel(QObject *parent)
|
QStandardItemModel *NickNameDialog::createModel(QObject *parent)
|
||||||
|
|||||||
@@ -121,14 +121,14 @@ QList<QStandardItem *> SubmitFileModel::addFile(const QString &fileName, const Q
|
|||||||
QString SubmitFileModel::state(int row) const
|
QString SubmitFileModel::state(int row) const
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= rowCount())
|
if (row < 0 || row >= rowCount())
|
||||||
return QString();
|
return {};
|
||||||
return item(row)->text();
|
return item(row)->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SubmitFileModel::file(int row) const
|
QString SubmitFileModel::file(int row) const
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= rowCount())
|
if (row < 0 || row >= rowCount())
|
||||||
return QString();
|
return {};
|
||||||
return item(row, FileColumn)->text();
|
return item(row, FileColumn)->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ QString VcsBaseClient::vcsCommandString(VcsCommandTag cmd) const
|
|||||||
case LogCommand: return QLatin1String("log");
|
case LogCommand: return QLatin1String("log");
|
||||||
case StatusCommand: return QLatin1String("status");
|
case StatusCommand: return QLatin1String("status");
|
||||||
}
|
}
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ExitCodeInterpreter VcsBaseClient::exitCodeInterpreter(VcsCommandTag cmd) const
|
ExitCodeInterpreter VcsBaseClient::exitCodeInterpreter(VcsCommandTag cmd) const
|
||||||
|
|||||||
@@ -1554,7 +1554,7 @@ bool VcsBaseEditorWidget::isValidRevision(const QString &revision) const
|
|||||||
QString VcsBaseEditorWidget::revisionSubject(const QTextBlock &inBlock) const
|
QString VcsBaseEditorWidget::revisionSubject(const QTextBlock &inBlock) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(inBlock)
|
Q_UNUSED(inBlock)
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VcsBaseEditorWidget::hasDiff() const
|
bool VcsBaseEditorWidget::hasDiff() const
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ QString StateListener::windowTitleVcsTopic(const FilePath &filePath)
|
|||||||
searchPath = projects.first()->projectDirectory();
|
searchPath = projects.first()->projectDirectory();
|
||||||
}
|
}
|
||||||
if (searchPath.isEmpty())
|
if (searchPath.isEmpty())
|
||||||
return QString();
|
return {};
|
||||||
FilePath topLevelPath;
|
FilePath topLevelPath;
|
||||||
IVersionControl *vc = VcsManager::findVersionControlForDirectory(
|
IVersionControl *vc = VcsManager::findVersionControlForDirectory(
|
||||||
searchPath, &topLevelPath);
|
searchPath, &topLevelPath);
|
||||||
@@ -232,7 +232,7 @@ static inline QString displayNameOfEditor(const FilePath &fileName)
|
|||||||
IDocument *document = DocumentModel::documentForFilePath(fileName);
|
IDocument *document = DocumentModel::documentForFilePath(fileName);
|
||||||
if (document)
|
if (document)
|
||||||
return document->displayName();
|
return document->displayName();
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void StateListener::slotStateChanged()
|
void StateListener::slotStateChanged()
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ QString VcsBaseSubmitEditor::promptForNickName()
|
|||||||
d->m_nickNameDialog = new NickNameDialog(VcsPlugin::instance()->nickNameModel(), d->m_widget);
|
d->m_nickNameDialog = new NickNameDialog(VcsPlugin::instance()->nickNameModel(), d->m_widget);
|
||||||
if (d->m_nickNameDialog->exec() == QDialog::Accepted)
|
if (d->m_nickNameDialog->exec() == QDialog::Accepted)
|
||||||
return d->m_nickNameDialog->nickName();
|
return d->m_nickNameDialog->nickName();
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsBaseSubmitEditor::slotInsertNickName()
|
void VcsBaseSubmitEditor::slotInsertNickName()
|
||||||
|
|||||||
@@ -123,13 +123,13 @@ QString OutputWindowPlainTextEdit::identifierUnderCursor(const QPoint &widgetPos
|
|||||||
const int cursorDocumentPos = cursor.position();
|
const int cursorDocumentPos = cursor.position();
|
||||||
cursor.select(QTextCursor::BlockUnderCursor);
|
cursor.select(QTextCursor::BlockUnderCursor);
|
||||||
if (!cursor.hasSelection())
|
if (!cursor.hasSelection())
|
||||||
return QString();
|
return {};
|
||||||
const QString block = cursor.selectedText();
|
const QString block = cursor.selectedText();
|
||||||
// Determine cursor position within line and find blank-delimited word
|
// Determine cursor position within line and find blank-delimited word
|
||||||
const int cursorPos = cursorDocumentPos - cursor.block().position();
|
const int cursorPos = cursorDocumentPos - cursor.block().position();
|
||||||
const int blockSize = block.size();
|
const int blockSize = block.size();
|
||||||
if (cursorPos < 0 || cursorPos >= blockSize || block.at(cursorPos).isSpace())
|
if (cursorPos < 0 || cursorPos >= blockSize || block.at(cursorPos).isSpace())
|
||||||
return QString();
|
return {};
|
||||||
// Retrieve repository if desired
|
// Retrieve repository if desired
|
||||||
if (repository)
|
if (repository)
|
||||||
if (QTextBlockUserData *data = cursor.block().userData())
|
if (QTextBlockUserData *data = cursor.block().userData())
|
||||||
|
|||||||
@@ -107,8 +107,7 @@ void VcsPlugin::initialize()
|
|||||||
|
|
||||||
MacroExpander *expander = globalMacroExpander();
|
MacroExpander *expander = globalMacroExpander();
|
||||||
expander->registerVariable(Constants::VAR_VCS_NAME,
|
expander->registerVariable(Constants::VAR_VCS_NAME,
|
||||||
Tr::tr("Name of the version control system in use by the current project."),
|
Tr::tr("Name of the version control system in use by the current project."), [] {
|
||||||
[]() -> QString {
|
|
||||||
IVersionControl *vc = nullptr;
|
IVersionControl *vc = nullptr;
|
||||||
if (Project *project = ProjectTree::currentProject())
|
if (Project *project = ProjectTree::currentProject())
|
||||||
vc = VcsManager::findVersionControlForDirectory(project->projectDirectory());
|
vc = VcsManager::findVersionControlForDirectory(project->projectDirectory());
|
||||||
@@ -116,8 +115,8 @@ void VcsPlugin::initialize()
|
|||||||
});
|
});
|
||||||
|
|
||||||
expander->registerVariable(Constants::VAR_VCS_TOPIC,
|
expander->registerVariable(Constants::VAR_VCS_TOPIC,
|
||||||
Tr::tr("The current version control topic (branch or tag) identification of the current project."),
|
Tr::tr("The current version control topic (branch or tag) identification "
|
||||||
[]() -> QString {
|
"of the current project."), [] {
|
||||||
IVersionControl *vc = nullptr;
|
IVersionControl *vc = nullptr;
|
||||||
FilePath topLevel;
|
FilePath topLevel;
|
||||||
if (Project *project = ProjectTree::currentProject())
|
if (Project *project = ProjectTree::currentProject())
|
||||||
@@ -126,8 +125,7 @@ void VcsPlugin::initialize()
|
|||||||
});
|
});
|
||||||
|
|
||||||
expander->registerVariable(Constants::VAR_VCS_TOPLEVELPATH,
|
expander->registerVariable(Constants::VAR_VCS_TOPLEVELPATH,
|
||||||
Tr::tr("The top level path to the repository the current project is in."),
|
Tr::tr("The top level path to the repository the current project is in."), [] {
|
||||||
[]() -> QString {
|
|
||||||
if (Project *project = ProjectTree::currentProject())
|
if (Project *project = ProjectTree::currentProject())
|
||||||
return VcsManager::findTopLevelForDirectory(project->projectDirectory()).toString();
|
return VcsManager::findTopLevelForDirectory(project->projectDirectory()).toString();
|
||||||
return QString();
|
return QString();
|
||||||
|
|||||||
Reference in New Issue
Block a user