Commit a13ef73d authored by hjk's avatar hjk
Browse files

DiffEditor: Merge the two construction paths



Change-Id: I3c0c750517c9000dffe13de724b063008fd426b7
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent ceb6f543
...@@ -193,9 +193,8 @@ void DescriptionEditorWidget::handleCurrentContents() ...@@ -193,9 +193,8 @@ void DescriptionEditorWidget::handleCurrentContents()
///////////////////////////////// DiffEditor ////////////////////////////////// ///////////////////////////////// DiffEditor //////////////////////////////////
DiffEditor::DiffEditor() DiffEditor::DiffEditor(const QSharedPointer<DiffEditorDocument> &doc)
: IEditor(0) : m_document(doc)
, m_document(new DiffEditorDocument())
, m_descriptionWidget(0) , m_descriptionWidget(0)
, m_stackedWidget(0) , m_stackedWidget(0)
, m_sideBySideEditor(0) , m_sideBySideEditor(0)
...@@ -208,30 +207,6 @@ DiffEditor::DiffEditor() ...@@ -208,30 +207,6 @@ DiffEditor::DiffEditor()
, m_toggleDescriptionAction(0) , m_toggleDescriptionAction(0)
, m_reloadAction(0) , m_reloadAction(0)
, m_diffEditorSwitcher(0) , m_diffEditorSwitcher(0)
{
ctor();
}
DiffEditor::DiffEditor(DiffEditor *other)
: IEditor(0)
, m_document(other->m_document)
, m_descriptionWidget(0)
, m_stackedWidget(0)
, m_sideBySideEditor(0)
, m_unifiedEditor(0)
, m_currentEditor(0)
, m_controller(0)
, m_guiController(0)
, m_toolBar(0)
, m_entriesComboBox(0)
, m_toggleDescriptionAction(0)
, m_reloadAction(0)
, m_diffEditorSwitcher(0)
{
ctor();
}
void DiffEditor::ctor()
{ {
setDuplicateSupported(true); setDuplicateSupported(true);
...@@ -303,7 +278,7 @@ DiffEditor::~DiffEditor() ...@@ -303,7 +278,7 @@ DiffEditor::~DiffEditor()
Core::IEditor *DiffEditor::duplicate() Core::IEditor *DiffEditor::duplicate()
{ {
return new DiffEditor(this); return new DiffEditor(m_document);
} }
bool DiffEditor::open(QString *errorString, bool DiffEditor::open(QString *errorString,
......
...@@ -55,10 +55,10 @@ class UnifiedDiffEditorWidget; ...@@ -55,10 +55,10 @@ class UnifiedDiffEditorWidget;
class DIFFEDITOR_EXPORT DiffEditor : public Core::IEditor class DIFFEDITOR_EXPORT DiffEditor : public Core::IEditor
{ {
Q_OBJECT Q_OBJECT
public: public:
DiffEditor(); DiffEditor(const QSharedPointer<DiffEditorDocument> &doc);
DiffEditor(DiffEditor *other); ~DiffEditor();
virtual ~DiffEditor();
public: public:
DiffEditorController *controller() const; DiffEditorController *controller() const;
...@@ -86,7 +86,6 @@ private slots: ...@@ -86,7 +86,6 @@ private slots:
void slotDiffEditorSwitched(); void slotDiffEditorSwitched();
private: private:
void ctor();
void updateEntryToolTip(); void updateEntryToolTip();
void showDiffEditor(QWidget *newEditor); void showDiffEditor(QWidget *newEditor);
void updateDiffEditorSwitcher(); void updateDiffEditorSwitcher();
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "diffeditor.h" #include "diffeditor.h"
#include "diffeditorconstants.h" #include "diffeditorconstants.h"
#include "diffeditordocument.h"
#include "diffeditorfactory.h" #include "diffeditorfactory.h"
#include "sidebysidediffeditorwidget.h" #include "sidebysidediffeditorwidget.h"
...@@ -48,7 +49,7 @@ DiffEditorFactory::DiffEditorFactory(QObject *parent) ...@@ -48,7 +49,7 @@ DiffEditorFactory::DiffEditorFactory(QObject *parent)
Core::IEditor *DiffEditorFactory::createEditor() Core::IEditor *DiffEditorFactory::createEditor()
{ {
return new DiffEditor(); return new DiffEditor(QSharedPointer<DiffEditorDocument>(new DiffEditorDocument));
} }
} // namespace Internal } // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment