forked from qt-creator/qt-creator
Display "Waiting for data" properly
Display "Waiting for data" instead of "No differences" when creating new instance of an editor for the same document (e.g. by splitting the view) during document reload. Change-Id: If254006de3914ad4416c7405874e8cbea57ddd8d Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -663,10 +663,6 @@ void DiffEditor::setupView(IDiffView *view)
|
|||||||
|
|
||||||
view->setDocument(m_document.data());
|
view->setDocument(m_document.data());
|
||||||
view->setSync(m_sync);
|
view->setSync(m_sync);
|
||||||
|
|
||||||
view->beginOperation();
|
|
||||||
view->setDiff(m_document->diffFiles(), m_document->baseDirectory());
|
|
||||||
view->endOperation(true);
|
|
||||||
view->setCurrentDiffFileIndex(m_currentDiffFileIndex);
|
view->setCurrentDiffFileIndex(m_currentDiffFileIndex);
|
||||||
|
|
||||||
m_stackedWidget->setCurrentWidget(view->widget());
|
m_stackedWidget->setCurrentWidget(view->widget());
|
||||||
|
@@ -98,6 +98,11 @@ void DiffEditorWidgetController::setDocument(DiffEditorDocument *document)
|
|||||||
hideProgress();
|
hideProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DiffEditorDocument *DiffEditorWidgetController::document() const
|
||||||
|
{
|
||||||
|
return m_document;
|
||||||
|
}
|
||||||
|
|
||||||
void DiffEditorWidgetController::scheduleShowProgress()
|
void DiffEditorWidgetController::scheduleShowProgress()
|
||||||
{
|
{
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
|
@@ -50,6 +50,7 @@ public:
|
|||||||
explicit DiffEditorWidgetController(QWidget *diffEditorWidget);
|
explicit DiffEditorWidgetController(QWidget *diffEditorWidget);
|
||||||
|
|
||||||
void setDocument(DiffEditorDocument *document);
|
void setDocument(DiffEditorDocument *document);
|
||||||
|
DiffEditorDocument *document() const;
|
||||||
|
|
||||||
void patch(bool revert);
|
void patch(bool revert);
|
||||||
void jumpToOriginalFile(const QString &fileName, int lineNumber,
|
void jumpToOriginalFile(const QString &fileName, int lineNumber,
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "diffview.h"
|
#include "diffview.h"
|
||||||
|
|
||||||
|
#include "diffeditordocument.h"
|
||||||
#include "diffeditoricons.h"
|
#include "diffeditoricons.h"
|
||||||
#include "unifieddiffeditorwidget.h"
|
#include "unifieddiffeditorwidget.h"
|
||||||
#include "sidebysidediffeditorwidget.h"
|
#include "sidebysidediffeditorwidget.h"
|
||||||
@@ -110,11 +111,15 @@ void UnifiedView::setDocument(DiffEditorDocument *document)
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(m_widget, return);
|
QTC_ASSERT(m_widget, return);
|
||||||
m_widget->setDocument(document);
|
m_widget->setDocument(document);
|
||||||
|
if (document && document->isReloading())
|
||||||
|
m_widget->clear(tr("Waiting for data..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnifiedView::beginOperation()
|
void UnifiedView::beginOperation()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_widget, return);
|
QTC_ASSERT(m_widget, return);
|
||||||
|
DiffEditorDocument *document = m_widget->diffDocument();
|
||||||
|
if (document && !document->isReloading())
|
||||||
m_widget->saveState();
|
m_widget->saveState();
|
||||||
m_widget->clear(tr("Waiting for data..."));
|
m_widget->clear(tr("Waiting for data..."));
|
||||||
}
|
}
|
||||||
@@ -169,11 +174,15 @@ void SideBySideView::setDocument(DiffEditorDocument *document)
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(m_widget, return);
|
QTC_ASSERT(m_widget, return);
|
||||||
m_widget->setDocument(document);
|
m_widget->setDocument(document);
|
||||||
|
if (document && document->isReloading())
|
||||||
|
m_widget->clear(tr("Waiting for data..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBySideView::beginOperation()
|
void SideBySideView::beginOperation()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_widget, return);
|
QTC_ASSERT(m_widget, return);
|
||||||
|
DiffEditorDocument *document = m_widget->diffDocument();
|
||||||
|
if (document && !document->isReloading())
|
||||||
m_widget->saveState();
|
m_widget->saveState();
|
||||||
m_widget->clear(tr("Waiting for data..."));
|
m_widget->clear(tr("Waiting for data..."));
|
||||||
}
|
}
|
||||||
|
@@ -562,6 +562,19 @@ SideBySideDiffEditorWidget::SideBySideDiffEditorWidget(QWidget *parent)
|
|||||||
void SideBySideDiffEditorWidget::setDocument(DiffEditorDocument *document)
|
void SideBySideDiffEditorWidget::setDocument(DiffEditorDocument *document)
|
||||||
{
|
{
|
||||||
m_controller.setDocument(document);
|
m_controller.setDocument(document);
|
||||||
|
clear();
|
||||||
|
QList<FileData> diffFileList;
|
||||||
|
QString workingDirectory;
|
||||||
|
if (document) {
|
||||||
|
diffFileList = document->diffFiles();
|
||||||
|
workingDirectory = document->baseDirectory();
|
||||||
|
}
|
||||||
|
setDiff(diffFileList, workingDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
DiffEditorDocument *SideBySideDiffEditorWidget::diffDocument() const
|
||||||
|
{
|
||||||
|
return m_controller.document();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBySideDiffEditorWidget::clear(const QString &message)
|
void SideBySideDiffEditorWidget::clear(const QString &message)
|
||||||
|
@@ -54,6 +54,7 @@ public:
|
|||||||
explicit SideBySideDiffEditorWidget(QWidget *parent = 0);
|
explicit SideBySideDiffEditorWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
void setDocument(DiffEditorDocument *document);
|
void setDocument(DiffEditorDocument *document);
|
||||||
|
DiffEditorDocument *diffDocument() const;
|
||||||
|
|
||||||
void setDiff(const QList<FileData> &diffFileList,
|
void setDiff(const QList<FileData> &diffFileList,
|
||||||
const QString &workingDirectory);
|
const QString &workingDirectory);
|
||||||
|
@@ -78,6 +78,19 @@ UnifiedDiffEditorWidget::UnifiedDiffEditorWidget(QWidget *parent)
|
|||||||
void UnifiedDiffEditorWidget::setDocument(DiffEditorDocument *document)
|
void UnifiedDiffEditorWidget::setDocument(DiffEditorDocument *document)
|
||||||
{
|
{
|
||||||
m_controller.setDocument(document);
|
m_controller.setDocument(document);
|
||||||
|
clear();
|
||||||
|
QList<FileData> diffFileList;
|
||||||
|
QString workingDirectory;
|
||||||
|
if (document) {
|
||||||
|
diffFileList = document->diffFiles();
|
||||||
|
workingDirectory = document->baseDirectory();
|
||||||
|
}
|
||||||
|
setDiff(diffFileList, workingDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
DiffEditorDocument *UnifiedDiffEditorWidget::diffDocument() const
|
||||||
|
{
|
||||||
|
return m_controller.document();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnifiedDiffEditorWidget::saveState()
|
void UnifiedDiffEditorWidget::saveState()
|
||||||
@@ -173,7 +186,7 @@ void UnifiedDiffEditorWidget::clear(const QString &message)
|
|||||||
const bool oldIgnore = m_controller.m_ignoreCurrentIndexChange;
|
const bool oldIgnore = m_controller.m_ignoreCurrentIndexChange;
|
||||||
m_controller.m_ignoreCurrentIndexChange = true;
|
m_controller.m_ignoreCurrentIndexChange = true;
|
||||||
SelectableTextEditorWidget::clear();
|
SelectableTextEditorWidget::clear();
|
||||||
setDiff(QList<FileData>(), QString());
|
m_controller.m_contextFileData.clear();
|
||||||
setPlainText(message);
|
setPlainText(message);
|
||||||
m_controller.m_ignoreCurrentIndexChange = oldIgnore;
|
m_controller.m_ignoreCurrentIndexChange = oldIgnore;
|
||||||
}
|
}
|
||||||
@@ -243,8 +256,8 @@ void UnifiedDiffEditorWidget::setDiff(const QList<FileData> &diffFileList,
|
|||||||
{
|
{
|
||||||
Q_UNUSED(workingDirectory)
|
Q_UNUSED(workingDirectory)
|
||||||
|
|
||||||
|
clear();
|
||||||
m_controller.m_contextFileData = diffFileList;
|
m_controller.m_contextFileData = diffFileList;
|
||||||
|
|
||||||
showDiff();
|
showDiff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,6 +54,7 @@ public:
|
|||||||
UnifiedDiffEditorWidget(QWidget *parent = 0);
|
UnifiedDiffEditorWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
void setDocument(DiffEditorDocument *document);
|
void setDocument(DiffEditorDocument *document);
|
||||||
|
DiffEditorDocument *diffDocument() const;
|
||||||
|
|
||||||
void setDiff(const QList<FileData> &diffFileList,
|
void setDiff(const QList<FileData> &diffFileList,
|
||||||
const QString &workingDirectory);
|
const QString &workingDirectory);
|
||||||
|
Reference in New Issue
Block a user