Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -193,9 +193,8 @@ void DescriptionEditorWidget::handleCurrentContents()
///////////////////////////////// DiffEditor //////////////////////////////////
DiffEditor::DiffEditor()
: IEditor(0)
, m_document(new DiffEditorDocument())
DiffEditor::DiffEditor(const QSharedPointer<DiffEditorDocument> &doc)
: m_document(doc)
, m_descriptionWidget(0)
, m_stackedWidget(0)
, m_sideBySideEditor(0)
......@@ -208,30 +207,6 @@ DiffEditor::DiffEditor()
, m_toggleDescriptionAction(0)
, m_reloadAction(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);
......@@ -303,7 +278,7 @@ DiffEditor::~DiffEditor()
Core::IEditor *DiffEditor::duplicate()
{
return new DiffEditor(this);
return new DiffEditor(m_document);
}
bool DiffEditor::open(QString *errorString,
......
......@@ -55,10 +55,10 @@ class UnifiedDiffEditorWidget;
class DIFFEDITOR_EXPORT DiffEditor : public Core::IEditor
{
Q_OBJECT
public:
DiffEditor();
DiffEditor(DiffEditor *other);
virtual ~DiffEditor();
DiffEditor(const QSharedPointer<DiffEditorDocument> &doc);
~DiffEditor();
public:
DiffEditorController *controller() const;
......@@ -86,7 +86,6 @@ private slots:
void slotDiffEditorSwitched();
private:
void ctor();
void updateEntryToolTip();
void showDiffEditor(QWidget *newEditor);
void updateDiffEditorSwitcher();
......
......@@ -29,6 +29,7 @@
#include "diffeditor.h"
#include "diffeditorconstants.h"
#include "diffeditordocument.h"
#include "diffeditorfactory.h"
#include "sidebysidediffeditorwidget.h"
......@@ -48,7 +49,7 @@ DiffEditorFactory::DiffEditorFactory(QObject *parent)
Core::IEditor *DiffEditorFactory::createEditor()
{
return new DiffEditor();
return new DiffEditor(QSharedPointer<DiffEditorDocument>(new DiffEditorDocument));
}
} // namespace Internal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment