forked from qt-creator/qt-creator
Basic integration of diff editor inside git plugin
Change-Id: I7675fc1d994020f94f42f6bd7b4f75aa29e6edf6 Reviewed-by: David Schulz <david.schulz@digia.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -30,86 +30,22 @@
|
||||
#ifndef DIFFEDITORPLUGIN_H
|
||||
#define DIFFEDITORPLUGIN_H
|
||||
|
||||
#include "diffeditor_global.h"
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QPointer>
|
||||
#include <QStringList>
|
||||
#include <QAction>
|
||||
#include <QToolBar>
|
||||
|
||||
namespace Core { class IEditor; }
|
||||
|
||||
namespace DiffEditor {
|
||||
|
||||
class DiffEditorWidget;
|
||||
|
||||
namespace Internal {
|
||||
class DiffFile;
|
||||
|
||||
class DiffEditorEditable : public Core::IEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DiffEditorEditable(DiffEditorWidget *editorWidget);
|
||||
virtual ~DiffEditorEditable();
|
||||
|
||||
public:
|
||||
// Core::IEditor
|
||||
bool createNew(const QString &contents);
|
||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
Core::IDocument *document();
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &title);
|
||||
bool duplicateSupported() const;
|
||||
Core::IEditor *duplicate(QWidget *parent);
|
||||
Core::Id id() const;
|
||||
bool isTemporary() const { return true; }
|
||||
DiffEditorWidget *editorWidget() const { return m_editorWidget; }
|
||||
|
||||
QWidget *toolBar();
|
||||
|
||||
QByteArray saveState() const;
|
||||
bool restoreState(const QByteArray &state);
|
||||
|
||||
private:
|
||||
DiffFile *m_file;
|
||||
DiffEditorWidget *m_editorWidget;
|
||||
QToolBar *m_toolWidget;
|
||||
mutable QString m_displayName;
|
||||
};
|
||||
|
||||
class DiffFile : public Core::IDocument
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DiffFile(const QString &mimeType,
|
||||
QObject *parent = 0);
|
||||
|
||||
QString fileName() const { return m_fileName; }
|
||||
QString defaultPath() const { return QString(); }
|
||||
QString suggestedFileName() const { return QString(); }
|
||||
|
||||
bool isModified() const { return m_modified; }
|
||||
QString mimeType() const;
|
||||
bool isSaveAsAllowed() const { return false; }
|
||||
bool save(QString *errorString, const QString &fileName, bool autoSave);
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
|
||||
void rename(const QString &newName);
|
||||
|
||||
void setFileName(const QString &name);
|
||||
void setModified(bool modified = true);
|
||||
|
||||
signals:
|
||||
void saveMe(QString *errorString, const QString &fileName, bool autoSave);
|
||||
|
||||
private:
|
||||
const QString m_mimeType;
|
||||
bool m_modified;
|
||||
QString m_fileName;
|
||||
};
|
||||
|
||||
class DiffEditorPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user