forked from qt-creator/qt-creator
DiffEditorController: Remove unused stuff
Change-Id: Ie4d5b0b3bac3e46c5db647263757222979b982be Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -7,8 +7,6 @@
|
|||||||
#include "diffeditordocument.h"
|
#include "diffeditordocument.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <coreplugin/progressmanager/taskprogress.h>
|
#include <coreplugin/progressmanager/taskprogress.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -29,7 +27,7 @@ DiffEditorController::DiffEditorController(IDocument *document)
|
|||||||
|
|
||||||
bool DiffEditorController::isReloading() const
|
bool DiffEditorController::isReloading() const
|
||||||
{
|
{
|
||||||
return m_isReloading;
|
return m_taskTree.get() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath DiffEditorController::workingDirectory() const
|
FilePath DiffEditorController::workingDirectory() const
|
||||||
@@ -86,11 +84,6 @@ void DiffEditorController::setDescription(const QString &description)
|
|||||||
m_document->setDescription(description);
|
m_document->setDescription(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DiffEditorController::description() const
|
|
||||||
{
|
|
||||||
return m_document->description();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Force the lines of context to the given number.
|
* @brief Force the lines of context to the given number.
|
||||||
*
|
*
|
||||||
@@ -104,11 +97,6 @@ void DiffEditorController::forceContextLineCount(int lines)
|
|||||||
m_document->forceContextLineCount(lines);
|
m_document->forceContextLineCount(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiffEditorController::setReloader(const std::function<void ()> &reloader)
|
|
||||||
{
|
|
||||||
m_reloader = reloader;
|
|
||||||
}
|
|
||||||
|
|
||||||
IDocument *DiffEditorController::document() const
|
IDocument *DiffEditorController::document() const
|
||||||
{
|
{
|
||||||
return m_document;
|
return m_document;
|
||||||
@@ -119,17 +107,12 @@ IDocument *DiffEditorController::document() const
|
|||||||
*/
|
*/
|
||||||
void DiffEditorController::requestReload()
|
void DiffEditorController::requestReload()
|
||||||
{
|
{
|
||||||
m_isReloading = true;
|
|
||||||
m_document->beginReload();
|
m_document->beginReload();
|
||||||
if (m_reloader) {
|
|
||||||
m_reloader();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_taskTree.reset(new TaskTree(m_reloadRecipe));
|
m_taskTree.reset(new TaskTree(m_reloadRecipe));
|
||||||
connect(m_taskTree.get(), &TaskTree::done, this, [this] { reloadFinished(true); });
|
connect(m_taskTree.get(), &TaskTree::done, this, [this] { reloadFinished(true); });
|
||||||
connect(m_taskTree.get(), &TaskTree::errorOccurred, this, [this] { reloadFinished(false); });
|
connect(m_taskTree.get(), &TaskTree::errorOccurred, this, [this] { reloadFinished(false); });
|
||||||
auto progress = new TaskProgress(m_taskTree.get());
|
auto progress = new TaskProgress(m_taskTree.get());
|
||||||
progress->setDisplayName(displayName());
|
progress->setDisplayName(m_displayName);
|
||||||
m_taskTree->start();
|
m_taskTree->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +121,6 @@ void DiffEditorController::reloadFinished(bool success)
|
|||||||
if (m_taskTree)
|
if (m_taskTree)
|
||||||
m_taskTree.release()->deleteLater();
|
m_taskTree.release()->deleteLater();
|
||||||
m_document->endReload(success);
|
m_document->endReload(success);
|
||||||
m_isReloading = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiffEditorController::setStartupFile(const QString &startupFile)
|
void DiffEditorController::setStartupFile(const QString &startupFile)
|
||||||
|
@@ -60,31 +60,22 @@ signals:
|
|||||||
const ChunkSelection &selection);
|
const ChunkSelection &selection);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setDisplayName(const QString &name) { m_displayName = name; }
|
// Core functions:
|
||||||
QString displayName() const { return m_displayName; }
|
|
||||||
|
|
||||||
void setReloadRecipe(const Utils::Tasking::Group &recipe) { m_reloadRecipe = recipe; }
|
void setReloadRecipe(const Utils::Tasking::Group &recipe) { m_reloadRecipe = recipe; }
|
||||||
|
|
||||||
// reloadFinished() should be called inside the reloader (for synchronous reload)
|
|
||||||
// or later (for asynchronous reload)
|
|
||||||
void setReloader(const std::function<void ()> &reloader);
|
|
||||||
void reloadFinished(bool success);
|
|
||||||
|
|
||||||
void setStartupFile(const QString &startupFile);
|
|
||||||
void setDiffFiles(const QList<FileData> &diffFileList);
|
void setDiffFiles(const QList<FileData> &diffFileList);
|
||||||
|
// Optional:
|
||||||
|
void setDisplayName(const QString &name) { m_displayName = name; }
|
||||||
void setDescription(const QString &description);
|
void setDescription(const QString &description);
|
||||||
QString description() const;
|
void setStartupFile(const QString &startupFile);
|
||||||
void forceContextLineCount(int lines);
|
void forceContextLineCount(int lines);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void reloadFinished(bool success);
|
||||||
|
|
||||||
Internal::DiffEditorDocument *const m_document;
|
Internal::DiffEditorDocument *const m_document;
|
||||||
bool m_isReloading = false;
|
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
std::function<void()> m_reloader;
|
|
||||||
std::unique_ptr<Utils::TaskTree> m_taskTree;
|
std::unique_ptr<Utils::TaskTree> m_taskTree;
|
||||||
Utils::Tasking::Group m_reloadRecipe;
|
Utils::Tasking::Group m_reloadRecipe;
|
||||||
|
|
||||||
friend class Internal::DiffEditorDocument;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(DiffEditorController::PatchOptions)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(DiffEditorController::PatchOptions)
|
||||||
|
Reference in New Issue
Block a user