forked from qt-creator/qt-creator
DiffEditor: Refactor the user-facing parts
* Move all data handling into DiffEditorDocument * Move much of the logic of how to update views into the DiffEditor. * Introduce a base class for the different views on the diff to implement. * Remove DiffEditorGuiController * Make DiffEditorController smaller and merge the DiffEditorReloader into the class * Simplify communication between the classes involved * Make much of the implementation private to the plugin Change-Id: I7ccb9df6061923bcb34cf3090d6d8331895e83c7 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
This commit is contained in:
@@ -47,9 +47,8 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace DiffEditor {
|
||||
|
||||
namespace Internal { class DiffEditorGuiController; }
|
||||
|
||||
class ChunkData;
|
||||
class DiffEditorController;
|
||||
class FileData;
|
||||
|
||||
namespace Internal {
|
||||
@@ -60,7 +59,19 @@ class UnifiedDiffEditorWidget : public SelectableTextEditorWidget
|
||||
public:
|
||||
UnifiedDiffEditorWidget(QWidget *parent = 0);
|
||||
|
||||
void setDiffEditorGuiController(Internal::DiffEditorGuiController *controller);
|
||||
void setDocument(DiffEditorDocument *document);
|
||||
|
||||
void setDiff(const QList<FileData> &diffFileList,
|
||||
const QString &workingDirectory);
|
||||
void setCurrentDiffFileIndex(int diffFileIndex);
|
||||
|
||||
void saveState();
|
||||
void restoreState();
|
||||
|
||||
void clear(const QString &message = QString());
|
||||
|
||||
signals:
|
||||
void currentDiffFileIndexChanged(int index);
|
||||
|
||||
public slots:
|
||||
void setDisplaySettings(const TextEditor::DisplaySettings &ds);
|
||||
@@ -72,13 +83,6 @@ protected:
|
||||
int lineNumberDigits() const;
|
||||
|
||||
private slots:
|
||||
void clear(const QString &message = QString());
|
||||
void clearAll(const QString &message = QString());
|
||||
void setDiff(const QList<FileData> &diffFileList,
|
||||
const QString &workingDirectory);
|
||||
|
||||
void setCurrentDiffFileIndex(int diffFileIndex);
|
||||
|
||||
void setFontSettings(const TextEditor::FontSettings &fontSettings);
|
||||
|
||||
void slotCursorPositionChangedInEditor();
|
||||
@@ -86,8 +90,6 @@ private slots:
|
||||
void slotSendChunkToCodePaster();
|
||||
void slotApplyChunk();
|
||||
void slotRevertChunk();
|
||||
void saveStateRequested();
|
||||
void restoreStateRequested();
|
||||
|
||||
private:
|
||||
void setLeftLineNumber(int blockNumber, int lineNumber);
|
||||
@@ -114,8 +116,7 @@ private:
|
||||
int chunkIndex);
|
||||
void patch(bool revert);
|
||||
|
||||
Internal::DiffEditorGuiController *m_guiController;
|
||||
DiffEditorController *m_controller;
|
||||
DiffEditorDocument *m_document;
|
||||
|
||||
// block number, visual line number.
|
||||
QMap<int, int> m_leftLineNumbers;
|
||||
@@ -132,7 +133,7 @@ private:
|
||||
QMap<int, QPair<int, int> > m_chunkInfo;
|
||||
|
||||
QList<FileData> m_contextFileData; // ultimate data to be shown
|
||||
// contextLinesNumber taken into account
|
||||
// contextLineCount taken into account
|
||||
|
||||
QTextCharFormat m_fileLineFormat;
|
||||
QTextCharFormat m_chunkLineFormat;
|
||||
|
||||
Reference in New Issue
Block a user