Vcs: Move editor construction over to new scheme

Change-Id: I491b9f37bfe15ebc800fedd5c683bfaf24e63889
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-08-21 01:24:38 +02:00
parent 461a54bd2d
commit 2481e71d18
25 changed files with 145 additions and 148 deletions

View File

@@ -34,48 +34,28 @@
#include "vcsbaseeditor.h"
#include <coreplugin/editormanager/ieditorfactory.h>
#include <texteditor/basetexteditor.h>
namespace VcsBase {
namespace Internal { class BaseVcsEditorFactoryPrivate; }
class VCSBASE_EXPORT BaseVcsEditorFactory : public Core::IEditorFactory
class VCSBASE_EXPORT VcsEditorFactory : public Core::IEditorFactory
{
Q_OBJECT
public:
explicit BaseVcsEditorFactory(const VcsBaseEditorParameters *type,
QObject *describeReceiver,
const char *describeSlot);
~BaseVcsEditorFactory();
VcsEditorFactory(const VcsBaseEditorParameters *type,
const TextEditor::BaseTextEditor::WidgetCreator &creator,
QObject *describeReceiver,
const char *describeSlot);
~VcsEditorFactory();
Core::IEditor *createEditor();
private:
// Implement to create and initialize (call init()) a VcsBaseEditor subclass.
virtual VcsBaseEditorWidget *createVcsBaseEditor(const VcsBaseEditorParameters *type) = 0;
Internal::BaseVcsEditorFactoryPrivate *const d;
};
// Utility template to create an editor.
template <class Editor>
class VcsEditorFactory : public BaseVcsEditorFactory
{
public:
explicit VcsEditorFactory(const VcsBaseEditorParameters *type,
QObject *describeReceiver = 0,
const char *describeSlot = 0)
: BaseVcsEditorFactory(type, describeReceiver, describeSlot)
{
}
private:
VcsBaseEditorWidget *createVcsBaseEditor(const VcsBaseEditorParameters *type)
{
return new Editor(type, 0);
}
};
} // namespace VcsBase
#endif // BASEVCSEDITORFACTORY_H