Hide reload button for diff editor when there is no reloader

Refactor code a bit. Now DiffEditorController has a pointer
to DiffEditorReloader.

Change-Id: I224579127f112923bc665cd59717b0c4d833981b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
jkobus
2014-07-04 13:55:51 +02:00
committed by Jarek Kobus
parent cb7963bc18
commit 91e4271069
8 changed files with 82 additions and 40 deletions

View File

@@ -195,16 +195,16 @@ void DiffEditorPlugin::diff()
const QString documentId = QLatin1String("Diff ") + fileName1
+ QLatin1String(", ") + fileName2;
DiffEditorDocument *document = DiffEditorManager::find(documentId);
if (!document) {
QString title = tr("Diff \"%1\", \"%2\"").arg(fileName1).arg(fileName2);
document = DiffEditorManager::findOrCreate(documentId, title);
if (!document)
return;
QString title = tr("Diff \"%1\", \"%2\"").arg(fileName1).arg(fileName2);
document = DiffEditorManager::findOrCreate(documentId, title);
if (!document)
return;
DiffEditorController *controller = document->controller();
DiffEditorController *controller = document->controller();
if (!controller->reloader()) {
SimpleDiffEditorReloader *reloader =
new SimpleDiffEditorReloader(controller, fileName1, fileName2);
reloader->setDiffEditorController(controller);
controller->setReloader(reloader);
}
Core::EditorManager::activateEditorForDocument(document);