2013-05-07 14:02:08 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2013-05-07 14:02:08 +02: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-05-07 14:02:08 +02: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-05-07 14:02:08 +02: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-05-07 14:02:08 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2013-06-17 13:55:31 +02:00
|
|
|
#ifndef DIFFEDITOR_H
|
|
|
|
|
#define DIFFEDITOR_H
|
2013-05-07 14:02:08 +02:00
|
|
|
|
2013-12-16 16:19:40 +01:00
|
|
|
#include "diffeditorcontroller.h"
|
2013-05-07 14:02:08 +02:00
|
|
|
|
|
|
|
|
#include <coreplugin/editormanager/ieditor.h>
|
|
|
|
|
#include <coreplugin/idocument.h>
|
|
|
|
|
|
2013-05-23 13:36:27 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QComboBox;
|
2015-03-10 12:50:43 +01:00
|
|
|
class QLabel;
|
2015-01-30 16:59:25 +01:00
|
|
|
class QSpinBox;
|
2014-02-13 16:43:28 +01:00
|
|
|
class QToolBar;
|
2014-01-30 17:04:54 +01:00
|
|
|
class QToolButton;
|
2014-02-13 16:43:28 +01:00
|
|
|
class QStackedWidget;
|
2013-05-23 13:36:27 +02:00
|
|
|
QT_END_NAMESPACE
|
2013-05-07 14:02:08 +02:00
|
|
|
|
2014-09-26 11:37:54 +02:00
|
|
|
namespace TextEditor { class TextEditorWidget; }
|
2014-01-30 17:04:54 +01:00
|
|
|
|
2013-05-07 14:02:08 +02:00
|
|
|
namespace DiffEditor {
|
|
|
|
|
|
2015-01-30 14:33:39 +01:00
|
|
|
namespace Internal {
|
|
|
|
|
class DescriptionEditorWidget;
|
2014-02-11 13:00:35 +01:00
|
|
|
class DiffEditorDocument;
|
2015-01-30 16:10:04 +01:00
|
|
|
class IDiffView;
|
2013-05-07 14:02:08 +02:00
|
|
|
|
2015-01-30 14:59:41 +01:00
|
|
|
class DiffEditor : public Core::IEditor
|
2013-05-07 14:02:08 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2014-08-21 21:12:04 +02:00
|
|
|
|
2013-05-07 14:02:08 +02:00
|
|
|
public:
|
2015-03-11 15:22:40 +01:00
|
|
|
DiffEditor(DiffEditorDocument *doc);
|
2014-08-21 21:12:04 +02:00
|
|
|
~DiffEditor();
|
2013-05-07 14:02:08 +02:00
|
|
|
|
2014-01-31 09:01:49 +01:00
|
|
|
Core::IEditor *duplicate();
|
|
|
|
|
|
2014-02-13 16:43:28 +01:00
|
|
|
bool open(QString *errorString,
|
|
|
|
|
const QString &fileName,
|
|
|
|
|
const QString &realFileName);
|
2013-05-07 14:02:08 +02:00
|
|
|
Core::IDocument *document();
|
|
|
|
|
|
|
|
|
|
QWidget *toolBar();
|
|
|
|
|
|
2013-05-23 13:36:27 +02:00
|
|
|
private slots:
|
2015-01-30 16:59:25 +01:00
|
|
|
void documentHasChanged();
|
|
|
|
|
void toggleDescription();
|
|
|
|
|
void updateDescription();
|
|
|
|
|
void contextLineCountHasChanged(int lines);
|
2015-03-10 12:50:43 +01:00
|
|
|
void ignoreWhitespaceHasChanged();
|
2015-01-30 16:59:25 +01:00
|
|
|
void prepareForReload();
|
|
|
|
|
void reloadHasFinished(bool success);
|
|
|
|
|
void setCurrentDiffFileIndex(int index);
|
|
|
|
|
void documentStateChanged();
|
|
|
|
|
|
|
|
|
|
void toggleSync();
|
2013-05-07 14:02:08 +02:00
|
|
|
|
|
|
|
|
private:
|
2015-03-11 15:22:40 +01:00
|
|
|
DiffEditor();
|
|
|
|
|
void setDocument(QSharedPointer<DiffEditorDocument> doc);
|
|
|
|
|
|
|
|
|
|
IDiffView *loadSettings();
|
2015-01-30 16:59:25 +01:00
|
|
|
void saveSetting(const QString &key, const QVariant &value) const;
|
2013-05-23 13:36:27 +02:00
|
|
|
void updateEntryToolTip();
|
2015-01-30 16:59:25 +01:00
|
|
|
void showDiffView(IDiffView *view);
|
2014-02-13 16:43:28 +01:00
|
|
|
void updateDiffEditorSwitcher();
|
2015-01-30 16:10:04 +01:00
|
|
|
void addView(IDiffView *view);
|
|
|
|
|
IDiffView *currentView() const;
|
|
|
|
|
void setCurrentView(IDiffView *view);
|
|
|
|
|
IDiffView *nextView();
|
2015-01-30 16:59:25 +01:00
|
|
|
void setupView(IDiffView *view);
|
2013-05-23 13:36:27 +02:00
|
|
|
|
2015-01-30 14:59:41 +01:00
|
|
|
QSharedPointer<DiffEditorDocument> m_document;
|
|
|
|
|
DescriptionEditorWidget *m_descriptionWidget;
|
2014-02-13 16:43:28 +01:00
|
|
|
QStackedWidget *m_stackedWidget;
|
2015-01-30 16:10:04 +01:00
|
|
|
QVector<IDiffView *> m_views;
|
2014-01-31 09:01:49 +01:00
|
|
|
QToolBar *m_toolBar;
|
2013-05-23 13:36:27 +02:00
|
|
|
QComboBox *m_entriesComboBox;
|
2015-01-30 16:59:25 +01:00
|
|
|
QSpinBox *m_contextSpinBox;
|
|
|
|
|
QAction *m_toggleSyncAction;
|
2014-10-24 14:11:12 +02:00
|
|
|
QAction *m_whitespaceButtonAction;
|
2014-01-30 17:04:54 +01:00
|
|
|
QAction *m_toggleDescriptionAction;
|
2014-07-04 13:55:51 +02:00
|
|
|
QAction *m_reloadAction;
|
2015-03-10 12:50:43 +01:00
|
|
|
QLabel *m_contextLabel;
|
|
|
|
|
QAction *m_viewSwitcherAction;
|
2015-01-30 16:59:25 +01:00
|
|
|
QPair<QString, QString> m_currentFileChunk;
|
|
|
|
|
int m_currentViewIndex;
|
|
|
|
|
int m_currentDiffFileIndex;
|
2015-03-10 12:50:43 +01:00
|
|
|
int m_ignoreChanges;
|
2015-01-30 16:59:25 +01:00
|
|
|
bool m_sync;
|
|
|
|
|
bool m_showDescription;
|
2013-05-07 14:02:08 +02:00
|
|
|
};
|
|
|
|
|
|
2015-01-30 14:59:41 +01:00
|
|
|
} // namespace Internal
|
2013-05-07 14:02:08 +02:00
|
|
|
} // namespace DiffEditor
|
|
|
|
|
|
2013-06-17 13:55:31 +02:00
|
|
|
#endif // DIFFEDITOR_H
|