diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index fafc85fb175..a8b2b1331b9 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -38,7 +38,7 @@ namespace Internal { class ReloadInput { public: std::array text{}; - std::array fileInfo{}; + DiffFileInfoArray fileInfo{}; FileData::FileOperation fileOperation = FileData::ChangeFile; bool binaryFiles = false; }; diff --git a/src/plugins/diffeditor/diffutils.h b/src/plugins/diffeditor/diffutils.h index 0ff29611c0c..4e09e679dd5 100644 --- a/src/plugins/diffeditor/diffutils.h +++ b/src/plugins/diffeditor/diffutils.h @@ -11,6 +11,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE class QFutureInterfaceBase; QT_END_NAMESPACE @@ -34,6 +36,8 @@ public: PatchBehaviour patchBehaviour = PatchFile; }; +using DiffFileInfoArray = std::array; + class DIFFEDITOR_EXPORT TextLineData { public: enum TextLineType { @@ -98,7 +102,7 @@ public: FileData() = default; FileData(const ChunkData &chunkData) { chunks.append(chunkData); } QList chunks; - std::array fileInfo{}; + DiffFileInfoArray fileInfo{}; FileOperation fileOperation = ChangeFile; bool binaryFiles = false; bool lastChunkAtTheEndOfFile = false; diff --git a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp index 030e74a8b77..da14adfc767 100644 --- a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp +++ b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp @@ -274,12 +274,6 @@ void UnifiedDiffData::setLineNumber(DiffSide side, int blockNumber, int lineNumb m_lineNumberDigits[side] = qMax(m_lineNumberDigits[side], lineNumberString.count()); } -void UnifiedDiffData::setFileInfo(int blockNumber, const DiffFileInfo &leftInfo, - const DiffFileInfo &rightInfo) -{ - m_fileInfo[blockNumber] = {leftInfo, rightInfo}; -} - void UnifiedDiffData::setChunkIndex(int startBlockNumber, int blockCount, int chunkIndex) { m_chunkInfo.insert(startBlockNumber, qMakePair(blockCount, chunkIndex)); @@ -428,7 +422,7 @@ UnifiedDiffOutput UnifiedDiffData::diffOutput(QFutureInterface &fi, int pr for (const FileData &fileData : qAsConst(input.m_contextFileData)) { const QString leftFileInfo = "--- " + fileData.fileInfo[LeftSide].fileName + '\n'; const QString rightFileInfo = "+++ " + fileData.fileInfo[RightSide].fileName + '\n'; - output.diffData.setFileInfo(blockNumber, fileData.fileInfo[LeftSide], fileData.fileInfo[RightSide]); + output.diffData.m_fileInfo[blockNumber] = fileData.fileInfo; output.foldingIndent.insert(blockNumber, 1); output.selections[blockNumber].append({input.m_fileLineFormat}); blockNumber++; diff --git a/src/plugins/diffeditor/unifieddiffeditorwidget.h b/src/plugins/diffeditor/unifieddiffeditorwidget.h index 4a21e16090a..848f5c0e383 100644 --- a/src/plugins/diffeditor/unifieddiffeditorwidget.h +++ b/src/plugins/diffeditor/unifieddiffeditorwidget.h @@ -38,13 +38,12 @@ public: std::array m_lineNumberDigits{1, 1}; // block number, visual line number. - QMap> m_fileInfo; + QMap m_fileInfo; // start block number, block count of a chunk, chunk index inside a file. QMap> m_chunkInfo; private: void setLineNumber(DiffSide side, int blockNumber, int lineNumber, int rowNumberInChunk); - void setFileInfo(int blockNumber, const DiffFileInfo &leftInfo, const DiffFileInfo &rightInfo); void setChunkIndex(int startBlockNumber, int blockCount, int chunkIndex); QString setChunk(const DiffEditorInput &input, const ChunkData &chunkData, bool lastChunk, int *blockNumber, DiffSelections *selections);