Diff/Vcs: Use a function object for reloading

Helps with slimming down the user code side.

Change-Id: I4b0aac76c0d1516eb05bff9c18594e64f8b41a7a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2020-02-06 11:52:59 +01:00
parent 0737291d54
commit b22768e980
6 changed files with 94 additions and 156 deletions

View File

@@ -72,15 +72,15 @@ public:
bool chunkExists(int fileIndex, int chunkIndex) const;
Core::IDocument *document() const;
// reloadFinished() should be called inside the reloader (for synchronous reload)
// or later (for asynchronous reload)
void setReloader(const std::function<void ()> &reloader);
signals:
void chunkActionsRequested(QMenu *menu, int fileIndex, int chunkIndex,
const ChunkSelection &selection);
protected:
// reloadFinished() should be called
// inside reload() (for synchronous reload)
// or later (for asynchronous reload)
virtual void reload() = 0;
void reloadFinished(bool success);
void setDiffFiles(const QList<FileData> &diffFileList,
@@ -93,6 +93,7 @@ protected:
private:
Internal::DiffEditorDocument *const m_document;
bool m_isReloading = false;
std::function<void()> m_reloader;
friend class Internal::DiffEditorDocument;
};