2013-02-15 12:49:50 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2013-02-15 12:49:50 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2013-02-15 12:49:50 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2013-02-15 12:49:50 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2013-02-15 12:49:50 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2014-01-30 14:27:50 +01:00
|
|
|
#ifndef SIDEBYSIDEDIFFEDITORWIDGET_H
|
|
|
|
|
#define SIDEBYSIDEDIFFEDITORWIDGET_H
|
2013-02-15 12:49:50 +01:00
|
|
|
|
|
|
|
|
#include "diffeditor_global.h"
|
|
|
|
|
#include "differ.h"
|
2013-12-16 16:19:40 +01:00
|
|
|
#include "diffeditorcontroller.h"
|
2014-03-10 12:57:48 +01:00
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QTextCharFormat>
|
2013-02-15 12:49:50 +01:00
|
|
|
|
2014-02-11 13:00:35 +01:00
|
|
|
namespace TextEditor { class FontSettings; }
|
2013-02-15 12:49:50 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QSplitter;
|
2014-02-13 16:43:28 +01:00
|
|
|
class QMenu;
|
2013-02-15 12:49:50 +01:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
|
2013-02-21 17:03:00 +01:00
|
|
|
namespace DiffEditor {
|
2014-02-24 11:10:17 +01:00
|
|
|
class DiffEditorGuiController;
|
2014-01-30 14:27:50 +01:00
|
|
|
class SideDiffEditorWidget;
|
2014-01-17 11:17:46 +01:00
|
|
|
class ChunkData;
|
|
|
|
|
class FileData;
|
2013-02-15 12:49:50 +01:00
|
|
|
|
2014-01-30 14:27:50 +01:00
|
|
|
class DIFFEDITOR_EXPORT SideBySideDiffEditorWidget : public QWidget
|
2013-02-15 12:49:50 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2015-01-30 11:18:08 +01:00
|
|
|
explicit SideBySideDiffEditorWidget(QWidget *parent = 0);
|
2013-02-15 12:49:50 +01:00
|
|
|
|
2014-02-24 11:10:17 +01:00
|
|
|
void setDiffEditorGuiController(DiffEditorGuiController *controller);
|
2013-12-16 16:19:40 +01:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void clear(const QString &message = QString());
|
2014-02-13 16:43:28 +01:00
|
|
|
void clearAll(const QString &message = QString());
|
|
|
|
|
void setDiff(const QList<FileData> &diffFileList,
|
|
|
|
|
const QString &workingDirectory);
|
2013-12-16 16:19:40 +01:00
|
|
|
|
|
|
|
|
void setCurrentDiffFileIndex(int diffFileIndex);
|
2013-02-15 12:49:50 +01:00
|
|
|
|
2013-06-05 15:25:42 +02:00
|
|
|
void setFontSettings(const TextEditor::FontSettings &fontSettings);
|
2014-02-13 16:43:28 +01:00
|
|
|
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();
|
2013-05-22 16:33:44 +02:00
|
|
|
void leftVSliderChanged();
|
|
|
|
|
void rightVSliderChanged();
|
|
|
|
|
void leftHSliderChanged();
|
|
|
|
|
void rightHSliderChanged();
|
2013-05-23 13:36:27 +02:00
|
|
|
void leftCursorPositionChanged();
|
|
|
|
|
void rightCursorPositionChanged();
|
2014-02-13 16:43:28 +01:00
|
|
|
// void leftDocumentSizeChanged();
|
|
|
|
|
// void rightDocumentSizeChanged();
|
2013-02-15 12:49:50 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void showDiff();
|
2014-02-13 16:43:28 +01:00
|
|
|
// void synchronizeFoldings(SideDiffEditorWidget *source, SideDiffEditorWidget *destination);
|
|
|
|
|
void jumpToOriginalFile(const QString &fileName,
|
|
|
|
|
int lineNumber, int columnNumber);
|
2014-07-28 23:25:49 +03:00
|
|
|
void patch(bool revert);
|
2013-02-15 12:49:50 +01:00
|
|
|
|
2014-02-24 11:10:17 +01:00
|
|
|
DiffEditorGuiController *m_guiController;
|
2013-12-16 16:19:40 +01:00
|
|
|
DiffEditorController *m_controller;
|
2014-01-30 14:27:50 +01:00
|
|
|
SideDiffEditorWidget *m_leftEditor;
|
|
|
|
|
SideDiffEditorWidget *m_rightEditor;
|
2013-02-15 12:49:50 +01:00
|
|
|
QSplitter *m_splitter;
|
|
|
|
|
|
2014-02-13 16:43:28 +01:00
|
|
|
QList<FileData> m_contextFileData; // ultimate data to be shown, contextLinesNumber taken into account
|
2013-02-15 12:49:50 +01:00
|
|
|
|
2014-02-13 16:43:28 +01:00
|
|
|
bool m_ignoreCurrentIndexChange;
|
2013-04-10 13:51:04 +02:00
|
|
|
bool m_foldingBlocker;
|
2014-02-13 16:43:28 +01:00
|
|
|
int m_contextMenuFileIndex;
|
|
|
|
|
int m_contextMenuChunkIndex;
|
2013-06-05 15:25:42 +02:00
|
|
|
|
2014-02-13 16:43:28 +01:00
|
|
|
QTextCharFormat m_spanLineFormat;
|
2013-06-05 15:25:42 +02:00
|
|
|
QTextCharFormat m_fileLineFormat;
|
|
|
|
|
QTextCharFormat m_chunkLineFormat;
|
|
|
|
|
QTextCharFormat m_leftLineFormat;
|
|
|
|
|
QTextCharFormat m_leftCharFormat;
|
|
|
|
|
QTextCharFormat m_rightLineFormat;
|
|
|
|
|
QTextCharFormat m_rightCharFormat;
|
2013-02-15 12:49:50 +01:00
|
|
|
};
|
|
|
|
|
|
2013-02-21 17:03:00 +01:00
|
|
|
} // namespace DiffEditor
|
2013-02-15 12:49:50 +01:00
|
|
|
|
2014-01-30 14:27:50 +01:00
|
|
|
#endif // SIDEBYSIDEDIFFEDITORWIDGET_H
|