forked from qt-creator/qt-creator
VcsCommand: Limit the usage of setCookie()
Don't use setCookie() for setting the line number to be shown on annotation. Add setDefaultLineNumber() setter to VcsBaseEditorWidget instead. Change-Id: I6c52874d48532132a27b2a7a9d161705170f7ade Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -557,6 +557,7 @@ public:
|
||||
QList<int> m_entrySections; // line number where this section starts
|
||||
int m_cursorLine = -1;
|
||||
int m_firstLineNumber = -1;
|
||||
int m_defaultLineNumber = -1;
|
||||
QString m_annotateRevisionTextFormat;
|
||||
QString m_annotatePreviousRevisionTextFormat;
|
||||
VcsBaseEditorConfig *m_config = nullptr;
|
||||
@@ -1232,16 +1233,13 @@ DiffChunk VcsBaseEditorWidget::diffChunk(QTextCursor cursor) const
|
||||
return rc;
|
||||
}
|
||||
|
||||
void VcsBaseEditorWidget::reportCommandFinished(bool success, const QVariant &data)
|
||||
void VcsBaseEditorWidget::reportCommandFinished(bool success)
|
||||
{
|
||||
hideProgressIndicator();
|
||||
if (!success) {
|
||||
if (!success)
|
||||
textDocument()->setPlainText(tr("Failed to retrieve data."));
|
||||
} else if (data.type() == QVariant::Int) {
|
||||
const int line = data.toInt();
|
||||
if (line >= 0)
|
||||
gotoLine(line);
|
||||
}
|
||||
else if (d->m_defaultLineNumber >= 0)
|
||||
gotoLine(d->m_defaultLineNumber);
|
||||
}
|
||||
|
||||
const VcsBaseEditorParameters *VcsBaseEditor::findType(const VcsBaseEditorParameters *array,
|
||||
@@ -1423,6 +1421,11 @@ void VcsBaseEditorWidget::setCommand(VcsCommand *command)
|
||||
}
|
||||
}
|
||||
|
||||
void VcsBaseEditorWidget::setDefaultLineNumber(int line)
|
||||
{
|
||||
d->m_defaultLineNumber = line;
|
||||
}
|
||||
|
||||
void VcsBaseEditorWidget::setPlainText(const QString &text)
|
||||
{
|
||||
textDocument()->setPlainText(text);
|
||||
|
||||
Reference in New Issue
Block a user