forked from qt-creator/qt-creator
Implement unified diff editor
Change-Id: I93e0bfd71a8a650afbe2ca9e0f1f3dbfc9d57db0 Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
This commit is contained in:
@@ -40,17 +40,15 @@ namespace TextEditor { class FontSettings; }
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSplitter;
|
||||
class QMenu;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
namespace DiffEditor {
|
||||
class DiffEditorGuiController;
|
||||
class SideDiffEditorWidget;
|
||||
|
||||
namespace Internal {
|
||||
class ChunkData;
|
||||
class FileData;
|
||||
}
|
||||
|
||||
class DIFFEDITOR_EXPORT SideBySideDiffEditorWidget : public QWidget
|
||||
{
|
||||
@@ -64,40 +62,39 @@ public:
|
||||
|
||||
private slots:
|
||||
void clear(const QString &message = QString());
|
||||
void setDiff(const QList<DiffEditorController::DiffFilesContents> &diffFileList, const QString &workingDirectory);
|
||||
void clearAll(const QString &message = QString());
|
||||
void setDiff(const QList<FileData> &diffFileList,
|
||||
const QString &workingDirectory);
|
||||
|
||||
void setContextLinesNumber(int lines);
|
||||
void setIgnoreWhitespaces(bool ignore);
|
||||
void setCurrentDiffFileIndex(int diffFileIndex);
|
||||
|
||||
void setFontSettings(const TextEditor::FontSettings &fontSettings);
|
||||
void slotLeftJumpToOriginalFileRequested(int diffFileIndex, int lineNumber, int columnNumber);
|
||||
void slotRightJumpToOriginalFileRequested(int diffFileIndex, int lineNumber, int columnNumber);
|
||||
void slotLeftJumpToOriginalFileRequested(int diffFileIndex,
|
||||
int lineNumber, int columnNumber);
|
||||
void slotRightJumpToOriginalFileRequested(int diffFileIndex,
|
||||
int lineNumber, int columnNumber);
|
||||
void slotLeftContextMenuRequested(QMenu *menu, int diffFileIndex,
|
||||
int chunkIndex);
|
||||
void slotRightContextMenuRequested(QMenu *menu, int diffFileIndex,
|
||||
int chunkIndex);
|
||||
void slotSendChunkToCodePaster();
|
||||
void slotApplyChunk();
|
||||
void slotRevertChunk();
|
||||
void leftVSliderChanged();
|
||||
void rightVSliderChanged();
|
||||
void leftHSliderChanged();
|
||||
void rightHSliderChanged();
|
||||
void leftCursorPositionChanged();
|
||||
void rightCursorPositionChanged();
|
||||
void leftDocumentSizeChanged();
|
||||
void rightDocumentSizeChanged();
|
||||
// void leftDocumentSizeChanged();
|
||||
// void rightDocumentSizeChanged();
|
||||
|
||||
private:
|
||||
class DiffList {
|
||||
public:
|
||||
DiffEditorController::DiffFileInfo leftFileInfo;
|
||||
DiffEditorController::DiffFileInfo rightFileInfo;
|
||||
QList<Diff> diffList;
|
||||
};
|
||||
|
||||
void setDiff(const QList<DiffList> &diffList);
|
||||
void handleWhitespaces(const QList<Diff> &input,
|
||||
QList<Diff> *leftOutput,
|
||||
QList<Diff> *rightOutput) const;
|
||||
void colorDiff(const QList<Internal::FileData> &fileDataList);
|
||||
void showDiff();
|
||||
void synchronizeFoldings(SideDiffEditorWidget *source, SideDiffEditorWidget *destination);
|
||||
void jumpToOriginalFile(const QString &fileName, int lineNumber, int columnNumber);
|
||||
// void synchronizeFoldings(SideDiffEditorWidget *source, SideDiffEditorWidget *destination);
|
||||
void jumpToOriginalFile(const QString &fileName,
|
||||
int lineNumber, int columnNumber);
|
||||
void patch(int diffFileIndex, int chunkIndex, bool revert);
|
||||
|
||||
DiffEditorGuiController *m_guiController;
|
||||
DiffEditorController *m_controller;
|
||||
@@ -105,12 +102,14 @@ private:
|
||||
SideDiffEditorWidget *m_rightEditor;
|
||||
QSplitter *m_splitter;
|
||||
|
||||
QList<DiffList> m_diffList; // list of original outputs from differ
|
||||
QList<Internal::ChunkData> m_originalChunkData; // one big chunk for every file, ignoreWhitespace taken into account
|
||||
QList<Internal::FileData> m_contextFileData; // ultimate data to be shown, contextLinesNumber taken into account
|
||||
QList<FileData> m_contextFileData; // ultimate data to be shown, contextLinesNumber taken into account
|
||||
|
||||
bool m_ignoreCurrentIndexChange;
|
||||
bool m_foldingBlocker;
|
||||
int m_contextMenuFileIndex;
|
||||
int m_contextMenuChunkIndex;
|
||||
|
||||
QTextCharFormat m_spanLineFormat;
|
||||
QTextCharFormat m_fileLineFormat;
|
||||
QTextCharFormat m_chunkLineFormat;
|
||||
QTextCharFormat m_leftLineFormat;
|
||||
|
||||
Reference in New Issue
Block a user