forked from qt-creator/qt-creator
Save / restore state in diff editor when reloading
Task-number: QTCREATORBUG-12650 Change-Id: I0bb25ed39f8a15dd5da798ebf0ce72898a2e3b3d Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -134,6 +134,10 @@ void UnifiedDiffEditorWidget::setDiffEditorGuiController(
|
||||
this, SLOT(clearAll(QString)));
|
||||
disconnect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)),
|
||||
this, SLOT(setDiff(QList<FileData>,QString)));
|
||||
disconnect(m_controller, SIGNAL(saveStateRequested()),
|
||||
this, SLOT(saveStateRequested()));
|
||||
disconnect(m_controller, SIGNAL(restoreStateRequested()),
|
||||
this, SLOT(restoreStateRequested()));
|
||||
|
||||
disconnect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)),
|
||||
this, SLOT(setCurrentDiffFileIndex(int)));
|
||||
@@ -149,6 +153,10 @@ void UnifiedDiffEditorWidget::setDiffEditorGuiController(
|
||||
this, SLOT(clearAll(QString)));
|
||||
connect(m_controller, SIGNAL(diffFilesChanged(QList<FileData>,QString)),
|
||||
this, SLOT(setDiff(QList<FileData>,QString)));
|
||||
connect(m_controller, SIGNAL(saveStateRequested()),
|
||||
this, SLOT(saveStateRequested()));
|
||||
connect(m_controller, SIGNAL(restoreStateRequested()),
|
||||
this, SLOT(restoreStateRequested()));
|
||||
|
||||
connect(m_guiController, SIGNAL(currentDiffFileIndexChanged(int)),
|
||||
this, SLOT(setCurrentDiffFileIndex(int)));
|
||||
@@ -158,6 +166,23 @@ void UnifiedDiffEditorWidget::setDiffEditorGuiController(
|
||||
}
|
||||
}
|
||||
|
||||
void UnifiedDiffEditorWidget::saveStateRequested()
|
||||
{
|
||||
if (!m_state.isNull())
|
||||
return;
|
||||
|
||||
m_state = saveState();
|
||||
}
|
||||
|
||||
void UnifiedDiffEditorWidget::restoreStateRequested()
|
||||
{
|
||||
if (m_state.isNull())
|
||||
return;
|
||||
|
||||
restoreState(m_state);
|
||||
m_state.clear();
|
||||
}
|
||||
|
||||
DiffEditorGuiController *UnifiedDiffEditorWidget::diffEditorGuiController() const
|
||||
{
|
||||
return m_guiController;
|
||||
|
||||
Reference in New Issue
Block a user