EditorFactory: Replace some virtual functions with data members

Change-Id: I014cb57460c4e3a36bf7403960908b5ffec867ff
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
hjk
2013-05-31 19:35:37 +02:00
parent be112d853a
commit b772001c82
38 changed files with 132 additions and 545 deletions

View File

@@ -43,12 +43,15 @@ using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
: m_mimeTypes(QStringList() << QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE)),
m_manager(manager)
: m_manager(manager)
{
using namespace Core;
using namespace TextEditor;
setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME));
addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
m_actionHandler =
new TextEditorActionHandler(Constants::C_CMAKEEDITOR,
TextEditorActionHandler::UnCommentSelection
@@ -67,24 +70,9 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
contextMenu->addAction(cmd);
}
Core::Id CMakeEditorFactory::id() const
{
return Core::Id(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
}
QString CMakeEditorFactory::displayName() const
{
return tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME);
}
Core::IEditor *CMakeEditorFactory::createEditor(QWidget *parent)
{
CMakeEditorWidget *rc = new CMakeEditorWidget(parent, this, m_actionHandler);
TextEditor::TextEditorSettings::instance()->initializeEditor(rc);
return rc->editor();
}
QStringList CMakeEditorFactory::mimeTypes() const
{
return m_mimeTypes;
}

View File

@@ -34,11 +34,7 @@
#include <coreplugin/editormanager/ieditorfactory.h>
#include <QStringList>
namespace TextEditor {
class TextEditorActionHandler;
}
namespace TextEditor { class TextEditorActionHandler; }
namespace CMakeProjectManager {
namespace Internal {
@@ -49,11 +45,6 @@ class CMakeEditorFactory : public Core::IEditorFactory
public:
CMakeEditorFactory(CMakeManager *parent);
// IEditorFactory
QStringList mimeTypes() const;
Core::Id id() const;
QString displayName() const;
Core::IEditor *createEditor(QWidget *parent);
private: