diff options
author | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-01-30 16:59:25 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-03-10 10:25:52 +0000 |
commit | b2b8b867d68e95e9421a15549c1a7bb83949186d (patch) | |
tree | 5acf5ac984dae16bb7404cfd6a85910f1ae76f0a /src/plugins/diffeditor/diffeditor.h | |
parent | 59640aa7aaf1220a2739de021203f14834fc12b9 (diff) |
DiffEditor: Refactor the user-facing parts
* Move all data handling into DiffEditorDocument
* Move much of the logic of how to update views into the
DiffEditor.
* Introduce a base class for the different views on the diff
to implement.
* Remove DiffEditorGuiController
* Make DiffEditorController smaller and merge the DiffEditorReloader
into the class
* Simplify communication between the classes involved
* Make much of the implementation private to the plugin
Change-Id: I7ccb9df6061923bcb34cf3090d6d8331895e83c7
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src/plugins/diffeditor/diffeditor.h')
-rw-r--r-- | src/plugins/diffeditor/diffeditor.h | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/plugins/diffeditor/diffeditor.h b/src/plugins/diffeditor/diffeditor.h index 3a10abdbab..78134cc24c 100644 --- a/src/plugins/diffeditor/diffeditor.h +++ b/src/plugins/diffeditor/diffeditor.h @@ -38,6 +38,7 @@ QT_BEGIN_NAMESPACE class QComboBox; +class QSpinBox; class QToolBar; class QToolButton; class QStackedWidget; @@ -50,7 +51,6 @@ namespace DiffEditor { namespace Internal { class DescriptionEditorWidget; class DiffEditorDocument; -class DiffEditorGuiController; class IDiffView; class DiffEditor : public Core::IEditor @@ -62,8 +62,6 @@ public: ~DiffEditor(); public: - DiffEditorController *controller() const; - Core::IEditor *duplicate(); bool open(QString *errorString, @@ -73,44 +71,52 @@ public: QWidget *toolBar(); -public slots: - void activateEntry(int index); - private slots: - void slotCleared(const QString &message); - void slotDiffFilesChanged(const QList<FileData> &diffFileList, - const QString &workingDirectory); - void entryActivated(int index); - void slotDescriptionChanged(const QString &description); - void slotDescriptionVisibilityChanged(); - void slotReloaderChanged(); + void documentHasChanged(); + void toggleDescription(); + void updateDescription(); + void contextLineCountHasChanged(int lines); + void ignoreWhitespaceHasChanged(bool ignore); + void prepareForReload(); + void reloadHasFinished(bool success); + void setCurrentDiffFileIndex(int index); + void documentStateChanged(); + + void toggleSync(); private: + void loadSettings(); + void saveSetting(const QString &key, const QVariant &value) const; void updateEntryToolTip(); - void showDiffView(IDiffView *newEditor); + void showDiffView(IDiffView *view); void updateDiffEditorSwitcher(); void addView(IDiffView *view); IDiffView *currentView() const; void setCurrentView(IDiffView *view); IDiffView *nextView(); - IDiffView *readLegacyCurrentDiffEditorSetting(); - IDiffView *readCurrentDiffEditorSetting(); - void writeCurrentDiffEditorSetting(IDiffView *currentEditor); + void setupView(IDiffView *view); QSharedPointer<DiffEditorDocument> m_document; DescriptionEditorWidget *m_descriptionWidget; QStackedWidget *m_stackedWidget; QVector<IDiffView *> m_views; - int m_currentViewIndex; - DiffEditorGuiController *m_guiController; QToolBar *m_toolBar; QComboBox *m_entriesComboBox; + QToolButton *m_whitespaceButton; + QSpinBox *m_contextSpinBox; + QAction *m_toggleSyncAction; QAction *m_whitespaceButtonAction; QAction *m_contextLabelAction; QAction *m_contextSpinBoxAction; QAction *m_toggleDescriptionAction; QAction *m_reloadAction; QToolButton *m_diffEditorSwitcher; + QPair<QString, QString> m_currentFileChunk; + int m_currentViewIndex; + int m_currentDiffFileIndex; + bool m_sync; + bool m_showDescription; + bool m_ignoreChanges; }; } // namespace Internal |