forked from qt-creator/qt-creator
EditorFactory: Replace some virtual functions with data members
Change-Id: I014cb57460c4e3a36bf7403960908b5ffec867ff Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -44,21 +44,9 @@ AndroidManifestEditorFactory::AndroidManifestEditorFactory(QObject *parent)
|
|||||||
: Core::IEditorFactory(parent),
|
: Core::IEditorFactory(parent),
|
||||||
m_actionHandler(new TextEditor::TextEditorActionHandler(Constants::ANDROID_MANIFEST_EDITOR_CONTEXT))
|
m_actionHandler(new TextEditor::TextEditorActionHandler(Constants::ANDROID_MANIFEST_EDITOR_CONTEXT))
|
||||||
{
|
{
|
||||||
}
|
setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
|
||||||
|
setDisplayName(tr("Android Manifest editor"));
|
||||||
QStringList AndroidManifestEditorFactory::mimeTypes() const
|
addMimeType(Constants::ANDROID_MANIFEST_MIME_TYPE);
|
||||||
{
|
|
||||||
return QStringList() << QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id AndroidManifestEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return Constants::ANDROID_MANIFEST_EDITOR_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AndroidManifestEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Android Manifest editor");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *AndroidManifestEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *AndroidManifestEditorFactory::createEditor(QWidget *parent)
|
||||||
|
@@ -40,14 +40,12 @@ namespace Internal {
|
|||||||
class AndroidManifestEditorFactory : public Core::IEditorFactory
|
class AndroidManifestEditorFactory : public Core::IEditorFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AndroidManifestEditorFactory(QObject *parent = 0);
|
explicit AndroidManifestEditorFactory(QObject *parent = 0);
|
||||||
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextEditor::TextEditorActionHandler *m_actionHandler;
|
TextEditor::TextEditorActionHandler *m_actionHandler;
|
||||||
};
|
};
|
||||||
|
@@ -402,19 +402,11 @@ private:
|
|||||||
///////////////////////////////// BinEditorFactory //////////////////////////////////
|
///////////////////////////////// BinEditorFactory //////////////////////////////////
|
||||||
|
|
||||||
BinEditorFactory::BinEditorFactory(BinEditorPlugin *owner) :
|
BinEditorFactory::BinEditorFactory(BinEditorPlugin *owner) :
|
||||||
m_mimeTypes(QLatin1String(Constants::C_BINEDITOR_MIMETYPE)),
|
|
||||||
m_owner(owner)
|
m_owner(owner)
|
||||||
{
|
{
|
||||||
}
|
setId(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
|
||||||
|
setDisplayName(qApp->translate("OpenWith::Editors", Constants::C_BINEDITOR_DISPLAY_NAME));
|
||||||
Core::Id BinEditorFactory::id() const
|
addMimeType(Constants::C_BINEDITOR_MIMETYPE);
|
||||||
{
|
|
||||||
return Core::Id(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BinEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return qApp->translate("OpenWith::Editors", Constants::C_BINEDITOR_DISPLAY_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *BinEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *BinEditorFactory::createEditor(QWidget *parent)
|
||||||
@@ -426,10 +418,6 @@ Core::IEditor *BinEditorFactory::createEditor(QWidget *parent)
|
|||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList BinEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class BINEditor::BinEditorWidgetFactory
|
\class BINEditor::BinEditorWidgetFactory
|
||||||
|
@@ -102,13 +102,9 @@ class BinEditorFactory : public Core::IEditorFactory
|
|||||||
public:
|
public:
|
||||||
explicit BinEditorFactory(BinEditorPlugin *owner);
|
explicit BinEditorFactory(BinEditorPlugin *owner);
|
||||||
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QStringList m_mimeTypes;
|
|
||||||
BinEditorPlugin *m_owner;
|
BinEditorPlugin *m_owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -43,12 +43,15 @@ using namespace CMakeProjectManager;
|
|||||||
using namespace CMakeProjectManager::Internal;
|
using namespace CMakeProjectManager::Internal;
|
||||||
|
|
||||||
CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
|
CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
|
||||||
: m_mimeTypes(QStringList() << QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE)),
|
: m_manager(manager)
|
||||||
m_manager(manager)
|
|
||||||
{
|
{
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
|
setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
|
||||||
|
setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME));
|
||||||
|
addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
|
||||||
|
|
||||||
m_actionHandler =
|
m_actionHandler =
|
||||||
new TextEditorActionHandler(Constants::C_CMAKEEDITOR,
|
new TextEditorActionHandler(Constants::C_CMAKEEDITOR,
|
||||||
TextEditorActionHandler::UnCommentSelection
|
TextEditorActionHandler::UnCommentSelection
|
||||||
@@ -67,24 +70,9 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
|
|||||||
contextMenu->addAction(cmd);
|
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)
|
Core::IEditor *CMakeEditorFactory::createEditor(QWidget *parent)
|
||||||
{
|
{
|
||||||
CMakeEditorWidget *rc = new CMakeEditorWidget(parent, this, m_actionHandler);
|
CMakeEditorWidget *rc = new CMakeEditorWidget(parent, this, m_actionHandler);
|
||||||
TextEditor::TextEditorSettings::instance()->initializeEditor(rc);
|
TextEditor::TextEditorSettings::instance()->initializeEditor(rc);
|
||||||
return rc->editor();
|
return rc->editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CMakeEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
@@ -34,11 +34,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
|
|
||||||
#include <QStringList>
|
namespace TextEditor { class TextEditorActionHandler; }
|
||||||
|
|
||||||
namespace TextEditor {
|
|
||||||
class TextEditorActionHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CMakeProjectManager {
|
namespace CMakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -49,11 +45,6 @@ class CMakeEditorFactory : public Core::IEditorFactory
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CMakeEditorFactory(CMakeManager *parent);
|
CMakeEditorFactory(CMakeManager *parent);
|
||||||
|
|
||||||
// IEditorFactory
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -30,18 +30,14 @@
|
|||||||
#ifndef IDOCUMENTFACTORY_H
|
#ifndef IDOCUMENTFACTORY_H
|
||||||
#define IDOCUMENTFACTORY_H
|
#define IDOCUMENTFACTORY_H
|
||||||
|
|
||||||
#include "core_global.h"
|
#include "id.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QStringList>
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QStringList;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class IDocument;
|
class IDocument;
|
||||||
class Id;
|
|
||||||
|
|
||||||
class CORE_EXPORT IDocumentFactory : public QObject
|
class CORE_EXPORT IDocumentFactory : public QObject
|
||||||
{
|
{
|
||||||
@@ -50,10 +46,23 @@ class CORE_EXPORT IDocumentFactory : public QObject
|
|||||||
public:
|
public:
|
||||||
IDocumentFactory(QObject *parent = 0) : QObject(parent) {}
|
IDocumentFactory(QObject *parent = 0) : QObject(parent) {}
|
||||||
|
|
||||||
virtual QStringList mimeTypes() const = 0;
|
|
||||||
virtual Id id() const = 0;
|
|
||||||
virtual QString displayName() const = 0;
|
|
||||||
virtual IDocument *open(const QString &fileName) = 0;
|
virtual IDocument *open(const QString &fileName) = 0;
|
||||||
|
|
||||||
|
Id id() const { return m_id; }
|
||||||
|
QStringList mimeTypes() const { return m_mimeTypes; }
|
||||||
|
QString displayName() const { return m_displayName; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setId(Id id) { m_id = id; }
|
||||||
|
void setDisplayName(const QString &displayName) { m_displayName = displayName; }
|
||||||
|
void setMimeTypes(const QStringList &mimeTypes) { m_mimeTypes = mimeTypes; }
|
||||||
|
void addMimeType(const char *mimeType) { m_mimeTypes.append(QLatin1String(mimeType)); }
|
||||||
|
void addMimeType(const QString &mimeType) { m_mimeTypes.append(mimeType); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Id m_id;
|
||||||
|
QStringList m_mimeTypes;
|
||||||
|
QString m_displayName;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
@@ -68,10 +68,12 @@ enum { QUICKFIX_INTERVAL = 20 };
|
|||||||
CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
|
CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
|
||||||
m_owner(owner)
|
m_owner(owner)
|
||||||
{
|
{
|
||||||
m_mimeTypes << QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)
|
setId(CppEditor::Constants::CPPEDITOR_ID);
|
||||||
<< QLatin1String(CppEditor::Constants::C_HEADER_MIMETYPE)
|
setDisplayName(qApp->translate("OpenWith::Editors", CppEditor::Constants::CPPEDITOR_DISPLAY_NAME));
|
||||||
<< QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)
|
addMimeType(CppEditor::Constants::C_SOURCE_MIMETYPE);
|
||||||
<< QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
addMimeType(CppEditor::Constants::C_HEADER_MIMETYPE);
|
||||||
|
addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
|
||||||
|
addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
||||||
|
|
||||||
if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
|
if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
|
||||||
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
||||||
@@ -85,16 +87,6 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id CppEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(CppEditor::Constants::CPPEDITOR_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CppEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return qApp->translate("OpenWith::Editors", CppEditor::Constants::CPPEDITOR_DISPLAY_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
|
||||||
{
|
{
|
||||||
CPPEditorWidget *editor = new CPPEditorWidget(parent);
|
CPPEditorWidget *editor = new CPPEditorWidget(parent);
|
||||||
@@ -103,11 +95,6 @@ Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
|
|||||||
return editor->editor();
|
return editor->editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CppEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////// CppEditorPlugin //////////////////////////////////
|
///////////////////////////////// CppEditorPlugin //////////////////////////////////
|
||||||
|
|
||||||
CppEditorPlugin *CppEditorPlugin::m_instance = 0;
|
CppEditorPlugin *CppEditorPlugin::m_instance = 0;
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QStringList>
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
@@ -286,15 +285,10 @@ class CppEditorFactory : public Core::IEditorFactory
|
|||||||
public:
|
public:
|
||||||
CppEditorFactory(CppEditorPlugin *owner);
|
CppEditorFactory(CppEditorPlugin *owner);
|
||||||
|
|
||||||
// IEditorFactory
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CppEditorPlugin *m_owner;
|
CppEditorPlugin *m_owner;
|
||||||
QStringList m_mimeTypes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -48,24 +48,17 @@ namespace Designer {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
FormEditorFactory::FormEditorFactory()
|
FormEditorFactory::FormEditorFactory()
|
||||||
: Core::IEditorFactory(Core::ICore::instance()),
|
: Core::IEditorFactory(Core::ICore::instance())
|
||||||
m_mimeTypes(QLatin1String(FORM_MIMETYPE))
|
|
||||||
{
|
{
|
||||||
|
setId(K_DESIGNER_XML_EDITOR_ID);
|
||||||
|
setDisplayName(qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME));
|
||||||
|
addMimeType(FORM_MIMETYPE);
|
||||||
|
|
||||||
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
||||||
iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/formeditor/images/qt_ui.png")),
|
iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/formeditor/images/qt_ui.png")),
|
||||||
QLatin1String("ui"));
|
QLatin1String("ui"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id FormEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(K_DESIGNER_XML_EDITOR_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString FormEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IEditor *FormEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *FormEditorFactory::createEditor(QWidget *parent)
|
||||||
{
|
{
|
||||||
const EditorData data = FormEditorW::instance()->createEditor(parent);
|
const EditorData data = FormEditorW::instance()->createEditor(parent);
|
||||||
@@ -78,11 +71,6 @@ Core::IEditor *FormEditorFactory::createEditor(QWidget *parent)
|
|||||||
return data.formWindowEditor;
|
return data.formWindowEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList FormEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FormEditorFactory::designerModeClicked()
|
void FormEditorFactory::designerModeClicked()
|
||||||
{
|
{
|
||||||
Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
|
Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
|
||||||
@@ -90,5 +78,3 @@ void FormEditorFactory::designerModeClicked()
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Designer
|
} // namespace Designer
|
||||||
|
|
||||||
|
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -44,17 +42,10 @@ class FormEditorFactory : public Core::IEditorFactory
|
|||||||
public:
|
public:
|
||||||
FormEditorFactory();
|
FormEditorFactory();
|
||||||
|
|
||||||
// IEditorFactory
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void designerModeClicked();
|
void designerModeClicked();
|
||||||
|
|
||||||
private:
|
|
||||||
const QStringList m_mimeTypes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -45,7 +45,6 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
namespace DiffEditor {
|
namespace DiffEditor {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
DiffEditorPlugin::DiffEditorPlugin()
|
DiffEditorPlugin::DiffEditorPlugin()
|
||||||
|
@@ -54,9 +54,11 @@ ProjectFilesFactory::ProjectFilesFactory(Manager *manager, TextEditorActionHandl
|
|||||||
: Core::IEditorFactory(manager),
|
: Core::IEditorFactory(manager),
|
||||||
m_actionHandler(handler)
|
m_actionHandler(handler)
|
||||||
{
|
{
|
||||||
m_mimeTypes.append(QLatin1String(Constants::FILES_MIMETYPE));
|
setId(Constants::FILES_EDITOR_ID);
|
||||||
m_mimeTypes.append(QLatin1String(Constants::INCLUDES_MIMETYPE));
|
setDisplayName(QCoreApplication::translate("OpenWith::Editors", ".files Editor"));
|
||||||
m_mimeTypes.append(QLatin1String(Constants::CONFIG_MIMETYPE));
|
addMimeType(Constants::FILES_MIMETYPE);
|
||||||
|
addMimeType(Constants::INCLUDES_MIMETYPE);
|
||||||
|
addMimeType(Constants::CONFIG_MIMETYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent)
|
Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent)
|
||||||
@@ -66,21 +68,6 @@ Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent)
|
|||||||
return ed->editor();
|
return ed->editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ProjectFilesFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id ProjectFilesFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(Constants::FILES_EDITOR_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ProjectFilesFactory::displayName() const
|
|
||||||
{
|
|
||||||
return QCoreApplication::translate("OpenWith::Editors", ".files Editor");
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// ProjectFilesEditable
|
// ProjectFilesEditable
|
||||||
|
@@ -56,13 +56,8 @@ public:
|
|||||||
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextEditor::TextEditorActionHandler *m_actionHandler;
|
TextEditor::TextEditorActionHandler *m_actionHandler;
|
||||||
QStringList m_mimeTypes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProjectFilesEditor : public TextEditor::BaseTextEditor
|
class ProjectFilesEditor : public TextEditor::BaseTextEditor
|
||||||
|
@@ -37,14 +37,9 @@
|
|||||||
#include <extensionsystem/pluginspec.h>
|
#include <extensionsystem/pluginspec.h>
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
using namespace GLSLEditor::Internal;
|
using namespace GLSLEditor::Internal;
|
||||||
using namespace GLSLEditor::Constants;
|
using namespace GLSLEditor::Constants;
|
||||||
@@ -52,23 +47,13 @@ using namespace GLSLEditor::Constants;
|
|||||||
GLSLEditorFactory::GLSLEditorFactory(QObject *parent)
|
GLSLEditorFactory::GLSLEditorFactory(QObject *parent)
|
||||||
: Core::IEditorFactory(parent)
|
: Core::IEditorFactory(parent)
|
||||||
{
|
{
|
||||||
m_mimeTypes
|
setId(C_GLSLEDITOR_ID);
|
||||||
<< QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE)
|
setDisplayName(qApp->translate("OpenWith::Editors", C_GLSLEDITOR_DISPLAY_NAME));
|
||||||
<< QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_VERT)
|
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE);
|
||||||
<< QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG)
|
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT);
|
||||||
<< QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES)
|
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG);
|
||||||
<< QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES)
|
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES);
|
||||||
;
|
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES);
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id GLSLEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(C_GLSLEDITOR_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString GLSLEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return qApp->translate("OpenWith::Editors", C_GLSLEDITOR_DISPLAY_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent)
|
||||||
@@ -78,11 +63,6 @@ Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent)
|
|||||||
return rc->editor();
|
return rc->editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList GLSLEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLSLEditorFactory::updateEditorInfoBar(Core::IEditor *)
|
void GLSLEditorFactory::updateEditorInfoBar(Core::IEditor *)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
namespace GLSLEditor {
|
namespace GLSLEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -44,17 +42,10 @@ class GLSLEditorFactory : public Core::IEditorFactory
|
|||||||
public:
|
public:
|
||||||
GLSLEditorFactory(QObject *parent);
|
GLSLEditorFactory(QObject *parent);
|
||||||
|
|
||||||
// IEditorFactory
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateEditorInfoBar(Core::IEditor *editor);
|
void updateEditorInfoBar(Core::IEditor *editor);
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList m_mimeTypes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -43,7 +43,6 @@ namespace Internal {
|
|||||||
|
|
||||||
struct ImageViewerFactoryPrivate
|
struct ImageViewerFactoryPrivate
|
||||||
{
|
{
|
||||||
QStringList mimeTypes;
|
|
||||||
QPointer<ImageViewerActionHandler> actionHandler;
|
QPointer<ImageViewerActionHandler> actionHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,30 +50,33 @@ ImageViewerFactory::ImageViewerFactory(QObject *parent) :
|
|||||||
Core::IEditorFactory(parent),
|
Core::IEditorFactory(parent),
|
||||||
d(new ImageViewerFactoryPrivate)
|
d(new ImageViewerFactoryPrivate)
|
||||||
{
|
{
|
||||||
|
setId(Constants::IMAGEVIEWER_ID);
|
||||||
|
setDisplayName(qApp->translate("OpenWith::Editors", Constants::IMAGEVIEWER_DISPLAY_NAME));
|
||||||
|
|
||||||
d->actionHandler = new ImageViewerActionHandler(this);
|
d->actionHandler = new ImageViewerActionHandler(this);
|
||||||
|
|
||||||
QMap<QByteArray, QString> possibleMimeTypes;
|
QMap<QByteArray, const char *> possibleMimeTypes;
|
||||||
possibleMimeTypes.insert("bmp", QLatin1String("image/bmp"));
|
possibleMimeTypes.insert("bmp", "image/bmp");
|
||||||
possibleMimeTypes.insert("gif", QLatin1String("image/gif"));
|
possibleMimeTypes.insert("gif", "image/gif");
|
||||||
possibleMimeTypes.insert("ico", QLatin1String("image/x-icon"));
|
possibleMimeTypes.insert("ico", "image/x-icon");
|
||||||
possibleMimeTypes.insert("jpeg", QLatin1String("image/jpeg"));
|
possibleMimeTypes.insert("jpeg","image/jpeg");
|
||||||
possibleMimeTypes.insert("jpg", QLatin1String("image/jpeg"));
|
possibleMimeTypes.insert("jpg", "image/jpeg");
|
||||||
possibleMimeTypes.insert("mng", QLatin1String("video/x-mng"));
|
possibleMimeTypes.insert("mng", "video/x-mng");
|
||||||
possibleMimeTypes.insert("pbm", QLatin1String("image/x-portable-bitmap"));
|
possibleMimeTypes.insert("pbm", "image/x-portable-bitmap");
|
||||||
possibleMimeTypes.insert("pgm", QLatin1String("image/x-portable-graymap"));
|
possibleMimeTypes.insert("pgm", "image/x-portable-graymap");
|
||||||
possibleMimeTypes.insert("png", QLatin1String("image/png"));
|
possibleMimeTypes.insert("png", "image/png");
|
||||||
possibleMimeTypes.insert("ppm", QLatin1String("image/x-portable-pixmap"));
|
possibleMimeTypes.insert("ppm", "image/x-portable-pixmap");
|
||||||
possibleMimeTypes.insert("svg", QLatin1String("image/svg+xml"));
|
possibleMimeTypes.insert("svg", "image/svg+xml");
|
||||||
possibleMimeTypes.insert("tif", QLatin1String("image/tiff"));
|
possibleMimeTypes.insert("tif", "image/tiff");
|
||||||
possibleMimeTypes.insert("tiff", QLatin1String("image/tiff"));
|
possibleMimeTypes.insert("tiff","image/tiff");
|
||||||
possibleMimeTypes.insert("xbm", QLatin1String("image/xbm"));
|
possibleMimeTypes.insert("xbm", "image/xbm");
|
||||||
possibleMimeTypes.insert("xpm", QLatin1String("image/xpm"));
|
possibleMimeTypes.insert("xpm", "image/xpm");
|
||||||
|
|
||||||
QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats();
|
QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats();
|
||||||
foreach (const QByteArray &format, supportedFormats) {
|
foreach (const QByteArray &format, supportedFormats) {
|
||||||
const QString &value = possibleMimeTypes.value(format);
|
const char *value = possibleMimeTypes.value(format);
|
||||||
if (!value.isEmpty())
|
if (value)
|
||||||
d->mimeTypes.append(value);
|
addMimeType(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,21 +90,6 @@ Core::IEditor *ImageViewerFactory::createEditor(QWidget *parent)
|
|||||||
return new ImageViewer(parent);
|
return new ImageViewer(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ImageViewerFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return d->mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id ImageViewerFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(Constants::IMAGEVIEWER_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ImageViewerFactory::displayName() const
|
|
||||||
{
|
|
||||||
return qApp->translate("OpenWith::Editors", Constants::IMAGEVIEWER_DISPLAY_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageViewerFactory::extensionsInitialized()
|
void ImageViewerFactory::extensionsInitialized()
|
||||||
{
|
{
|
||||||
d->actionHandler->createActions();
|
d->actionHandler->createActions();
|
||||||
|
@@ -47,10 +47,6 @@ public:
|
|||||||
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -49,24 +49,11 @@ using namespace ProjectExplorer::Internal;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ProjectFileFactory::ProjectFileFactory(IProjectManager *manager)
|
ProjectFileFactory::ProjectFileFactory(IProjectManager *manager)
|
||||||
: m_mimeTypes(manager->mimeType()),
|
: m_manager(manager)
|
||||||
m_manager(manager)
|
|
||||||
{
|
{
|
||||||
}
|
setId(Constants::FILE_FACTORY_ID);
|
||||||
|
setDisplayName(tr("Project File Factory", "ProjectExplorer::ProjectFileFactory display name."));
|
||||||
QStringList ProjectFileFactory::mimeTypes() const
|
addMimeType(manager->mimeType());
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id ProjectFileFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(Constants::FILE_FACTORY_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ProjectFileFactory::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Project File Factory", "ProjectExplorer::ProjectFileFactory display name.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IDocument *ProjectFileFactory::open(const QString &fileName)
|
Core::IDocument *ProjectFileFactory::open(const QString &fileName)
|
||||||
|
@@ -48,16 +48,11 @@ class ProjectFileFactory : public Core::IDocumentFactory
|
|||||||
explicit ProjectFileFactory(ProjectExplorer::IProjectManager *manager);
|
explicit ProjectFileFactory(ProjectExplorer::IProjectManager *manager);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
Core::IDocument *open(const QString &fileName);
|
Core::IDocument *open(const QString &fileName);
|
||||||
|
|
||||||
static QList<ProjectFileFactory*> createFactories(QString *filterString);
|
static QList<ProjectFileFactory*> createFactories(QString *filterString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QStringList m_mimeTypes;
|
|
||||||
ProjectExplorer::IProjectManager *m_manager;
|
ProjectExplorer::IProjectManager *m_manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -43,17 +43,9 @@ namespace PythonEditor {
|
|||||||
EditorFactory::EditorFactory(QObject *parent)
|
EditorFactory::EditorFactory(QObject *parent)
|
||||||
: Core::IEditorFactory(parent)
|
: Core::IEditorFactory(parent)
|
||||||
{
|
{
|
||||||
m_mimeTypes << QLatin1String(Constants::C_PY_MIMETYPE);
|
setId(Constants::C_PYTHONEDITOR_ID);
|
||||||
}
|
setDisplayName(tr(Constants::C_EDITOR_DISPLAY_NAME));
|
||||||
|
addMimeType(QLatin1String(Constants::C_PY_MIMETYPE));
|
||||||
Core::Id EditorFactory::id() const
|
|
||||||
{
|
|
||||||
return Constants::C_PYTHONEDITOR_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString EditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return tr(Constants::C_EDITOR_DISPLAY_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *EditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *EditorFactory::createEditor(QWidget *parent)
|
||||||
@@ -64,9 +56,4 @@ Core::IEditor *EditorFactory::createEditor(QWidget *parent)
|
|||||||
return widget->editor();
|
return widget->editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList EditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace PythonEditor
|
} // namespace PythonEditor
|
||||||
|
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include "pythoneditor_global.h"
|
#include "pythoneditor_global.h"
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
namespace PythonEditor {
|
namespace PythonEditor {
|
||||||
|
|
||||||
@@ -43,24 +42,10 @@ class PYEDITOR_EXPORT EditorFactory : public Core::IEditorFactory
|
|||||||
public:
|
public:
|
||||||
EditorFactory(QObject *parent);
|
EditorFactory(QObject *parent);
|
||||||
|
|
||||||
/**
|
|
||||||
Returns MIME types handled by editor
|
|
||||||
*/
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Unique editor class identifier, see Constants::C_PYEDITOR_ID
|
|
||||||
*/
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates and initializes new editor widget
|
Creates and initializes new editor widget
|
||||||
*/
|
*/
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList m_mimeTypes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace PythonEditor
|
} // namespace PythonEditor
|
||||||
|
@@ -35,19 +35,7 @@
|
|||||||
|
|
||||||
#include <qmljstools/qmljstoolsconstants.h>
|
#include <qmljstools/qmljstoolsconstants.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <extensionsystem/pluginspec.h>
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <coreplugin/infobar.h>
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -55,24 +43,15 @@ namespace Internal {
|
|||||||
QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
|
QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
|
||||||
: Core::IEditorFactory(parent)
|
: Core::IEditorFactory(parent)
|
||||||
{
|
{
|
||||||
m_mimeTypes
|
setId(Constants::C_QMLJSEDITOR_ID);
|
||||||
<< QLatin1String(QmlJSTools::Constants::QML_MIMETYPE)
|
setDisplayName(qApp->translate("OpenWith::Editors", Constants::C_QMLJSEDITOR_DISPLAY_NAME));
|
||||||
<< QLatin1String(QmlJSTools::Constants::QMLPROJECT_MIMETYPE)
|
|
||||||
<< QLatin1String(QmlJSTools::Constants::QBS_MIMETYPE)
|
|
||||||
<< QLatin1String(QmlJSTools::Constants::QMLTYPES_MIMETYPE)
|
|
||||||
<< QLatin1String(QmlJSTools::Constants::JS_MIMETYPE)
|
|
||||||
<< QLatin1String(QmlJSTools::Constants::JSON_MIMETYPE)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id QmlJSEditorFactory::id() const
|
addMimeType(QmlJSTools::Constants::QML_MIMETYPE);
|
||||||
{
|
addMimeType(QmlJSTools::Constants::QMLPROJECT_MIMETYPE);
|
||||||
return Core::Id(Constants::C_QMLJSEDITOR_ID);
|
addMimeType(QmlJSTools::Constants::QBS_MIMETYPE);
|
||||||
}
|
addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE);
|
||||||
|
addMimeType(QmlJSTools::Constants::JS_MIMETYPE);
|
||||||
QString QmlJSEditorFactory::displayName() const
|
addMimeType(QmlJSTools::Constants::JSON_MIMETYPE);
|
||||||
{
|
|
||||||
return qApp->translate("OpenWith::Editors", Constants::C_QMLJSEDITOR_DISPLAY_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
|
||||||
@@ -82,10 +61,5 @@ Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
|
|||||||
return rc->editor();
|
return rc->editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QmlJSEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QmlJSEditor
|
} // namespace QmlJSEditor
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -44,14 +42,7 @@ class QmlJSEditorFactory : public Core::IEditorFactory
|
|||||||
public:
|
public:
|
||||||
QmlJSEditorFactory(QObject *parent);
|
QmlJSEditorFactory(QObject *parent);
|
||||||
|
|
||||||
// IEditorFactory
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList m_mimeTypes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -42,23 +42,10 @@ using namespace Qnx::Internal;
|
|||||||
|
|
||||||
BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent)
|
BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent)
|
||||||
: Core::IEditorFactory(parent)
|
: Core::IEditorFactory(parent)
|
||||||
, m_mimeTypes(QStringList() << QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE))
|
|
||||||
{
|
{
|
||||||
}
|
setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID);
|
||||||
|
setDisplayName(tr("Bar descriptor editor"));
|
||||||
QStringList BarDescriptorEditorFactory::mimeTypes() const
|
addMimeType(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE);
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id BarDescriptorEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BarDescriptorEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Bar descriptor editor");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *BarDescriptorEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *BarDescriptorEditorFactory::createEditor(QWidget *parent)
|
||||||
|
@@ -34,25 +34,17 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
|
|
||||||
#include <QtCore/QStringList>
|
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BarDescriptorEditorFactory : public Core::IEditorFactory
|
class BarDescriptorEditorFactory : public Core::IEditorFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BarDescriptorEditorFactory(QObject *parent = 0);
|
explicit BarDescriptorEditorFactory(QObject *parent = 0);
|
||||||
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList m_mimeTypes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -43,12 +43,15 @@ using namespace Qt4ProjectManager;
|
|||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
ProFileEditorFactory::ProFileEditorFactory(Qt4Manager *manager, TextEditor::TextEditorActionHandler *handler) :
|
ProFileEditorFactory::ProFileEditorFactory(Qt4Manager *manager, TextEditor::TextEditorActionHandler *handler) :
|
||||||
m_mimeTypes(QStringList() << QLatin1String(Qt4ProjectManager::Constants::PROFILE_MIMETYPE)
|
|
||||||
<< QLatin1String(Qt4ProjectManager::Constants::PROINCLUDEFILE_MIMETYPE)
|
|
||||||
<< QLatin1String(Qt4ProjectManager::Constants::PROFEATUREFILE_MIMETYPE)),
|
|
||||||
m_manager(manager),
|
m_manager(manager),
|
||||||
m_actionHandler(handler)
|
m_actionHandler(handler)
|
||||||
{
|
{
|
||||||
|
setId(Qt4ProjectManager::Constants::PROFILE_EDITOR_ID);
|
||||||
|
setDisplayName(qApp->translate("OpenWith::Editors", Qt4ProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME));
|
||||||
|
addMimeType(Qt4ProjectManager::Constants::PROFILE_MIMETYPE);
|
||||||
|
addMimeType(Qt4ProjectManager::Constants::PROINCLUDEFILE_MIMETYPE);
|
||||||
|
addMimeType(Qt4ProjectManager::Constants::PROFEATUREFILE_MIMETYPE);
|
||||||
|
|
||||||
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
||||||
iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(QtSupport::Constants::ICON_QT_PROJECT)),
|
iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(QtSupport::Constants::ICON_QT_PROJECT)),
|
||||||
QLatin1String("pro"));
|
QLatin1String("pro"));
|
||||||
@@ -58,28 +61,9 @@ ProFileEditorFactory::ProFileEditorFactory(Qt4Manager *manager, TextEditor::Text
|
|||||||
QLatin1String("prf"));
|
QLatin1String("prf"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProFileEditorFactory::~ProFileEditorFactory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id ProFileEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(Qt4ProjectManager::Constants::PROFILE_EDITOR_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ProFileEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return qApp->translate("OpenWith::Editors", Qt4ProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IEditor *ProFileEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *ProFileEditorFactory::createEditor(QWidget *parent)
|
||||||
{
|
{
|
||||||
ProFileEditorWidget *editor = new ProFileEditorWidget(parent, this, m_actionHandler);
|
ProFileEditorWidget *editor = new ProFileEditorWidget(parent, this, m_actionHandler);
|
||||||
TextEditor::TextEditorSettings::instance()->initializeEditor(editor);
|
TextEditor::TextEditorSettings::instance()->initializeEditor(editor);
|
||||||
return editor->editor();
|
return editor->editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ProFileEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
@@ -32,11 +32,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
|
|
||||||
#include <QStringList>
|
namespace TextEditor { class TextEditorActionHandler; }
|
||||||
|
|
||||||
namespace TextEditor {
|
|
||||||
class TextEditorActionHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
|
|
||||||
@@ -50,18 +46,12 @@ class ProFileEditorFactory : public Core::IEditorFactory
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ProFileEditorFactory(Qt4Manager *parent, TextEditor::TextEditorActionHandler *handler);
|
ProFileEditorFactory(Qt4Manager *parent, TextEditor::TextEditorActionHandler *handler);
|
||||||
~ProFileEditorFactory();
|
|
||||||
|
|
||||||
// IEditorFactory
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
Qt4Manager *qt4ProjectManager() const { return m_manager; }
|
Qt4Manager *qt4ProjectManager() const { return m_manager; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QStringList m_mimeTypes;
|
|
||||||
Qt4Manager *m_manager;
|
Qt4Manager *m_manager;
|
||||||
TextEditor::TextEditorActionHandler *m_actionHandler;
|
TextEditor::TextEditorActionHandler *m_actionHandler;
|
||||||
};
|
};
|
||||||
|
@@ -44,31 +44,19 @@ using namespace ResourceEditor::Constants;
|
|||||||
|
|
||||||
ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin) :
|
ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin) :
|
||||||
Core::IEditorFactory(plugin),
|
Core::IEditorFactory(plugin),
|
||||||
m_mimeTypes(QStringList(QLatin1String(C_RESOURCE_MIMETYPE))),
|
|
||||||
m_plugin(plugin)
|
m_plugin(plugin)
|
||||||
{
|
{
|
||||||
|
setId(RESOURCEEDITOR_ID);
|
||||||
|
setMimeTypes(QStringList(QLatin1String(C_RESOURCE_MIMETYPE)));
|
||||||
|
setDisplayName(qApp->translate("OpenWith::Editors", C_RESOURCEEDITOR_DISPLAY_NAME));
|
||||||
|
|
||||||
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
||||||
iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/resourceeditor/images/qt_qrc.png")),
|
iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/resourceeditor/images/qt_qrc.png")),
|
||||||
QLatin1String("qrc"));
|
QLatin1String("qrc"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id ResourceEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(RESOURCEEDITOR_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ResourceEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return qApp->translate("OpenWith::Editors", C_RESOURCEEDITOR_DISPLAY_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IEditor *ResourceEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *ResourceEditorFactory::createEditor(QWidget *parent)
|
||||||
{
|
{
|
||||||
Core::Context context(ResourceEditor::Constants::C_RESOURCEEDITOR);
|
Core::Context context(ResourceEditor::Constants::C_RESOURCEEDITOR);
|
||||||
return new ResourceEditorW(context, m_plugin, parent);
|
return new ResourceEditorW(context, m_plugin, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ResourceEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
@@ -47,15 +47,9 @@ class ResourceEditorFactory : public Core::IEditorFactory
|
|||||||
public:
|
public:
|
||||||
explicit ResourceEditorFactory(ResourceEditorPlugin *plugin);
|
explicit ResourceEditorFactory(ResourceEditorPlugin *plugin);
|
||||||
|
|
||||||
virtual QStringList mimeTypes() const;
|
|
||||||
|
|
||||||
// IEditorFactory
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QStringList m_mimeTypes;
|
|
||||||
ResourceEditorPlugin *m_plugin;
|
ResourceEditorPlugin *m_plugin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/id.h>
|
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@@ -45,26 +44,11 @@ using namespace TaskList::Internal;
|
|||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
TaskFileFactory::TaskFileFactory(QObject * parent) :
|
TaskFileFactory::TaskFileFactory(QObject * parent) :
|
||||||
Core::IDocumentFactory(parent),
|
Core::IDocumentFactory(parent)
|
||||||
m_mimeTypes(QStringList() << QLatin1String("text/x-tasklist"))
|
|
||||||
{ }
|
|
||||||
|
|
||||||
TaskFileFactory::~TaskFileFactory()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QStringList TaskFileFactory::mimeTypes() const
|
|
||||||
{
|
{
|
||||||
return m_mimeTypes;
|
setId("ProjectExplorer.TaskFileFactory");
|
||||||
}
|
setDisplayName(tr("Task file reader"));
|
||||||
|
addMimeType(QLatin1String("text/x-tasklist"));
|
||||||
Core::Id TaskFileFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id("ProjectExplorer.TaskFileFactory");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString TaskFileFactory::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Task file reader");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IDocument *TaskFileFactory::open(const QString &fileName)
|
Core::IDocument *TaskFileFactory::open(const QString &fileName)
|
||||||
|
@@ -33,11 +33,7 @@
|
|||||||
#include <coreplugin/idocumentfactory.h>
|
#include <coreplugin/idocumentfactory.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
|
|
||||||
#include <QStringList>
|
namespace ProjectExplorer { class Project; }
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class Project;
|
|
||||||
} // namespace ProjectExplorer
|
|
||||||
|
|
||||||
namespace TaskList {
|
namespace TaskList {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -45,14 +41,9 @@ namespace Internal {
|
|||||||
class TaskFileFactory : public Core::IDocumentFactory
|
class TaskFileFactory : public Core::IDocumentFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TaskFileFactory(QObject *parent = 0);
|
TaskFileFactory(QObject *parent = 0);
|
||||||
~TaskFileFactory();
|
|
||||||
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
Core::IDocument *open(const QString &fileName);
|
Core::IDocument *open(const QString &fileName);
|
||||||
Core::IDocument *open(ProjectExplorer::Project *context, const QString &fileName);
|
Core::IDocument *open(ProjectExplorer::Project *context, const QString &fileName);
|
||||||
@@ -60,7 +51,6 @@ public:
|
|||||||
void closeAllFiles();
|
void closeAllFiles();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_mimeTypes;
|
|
||||||
QList<Core::IDocument *> m_openFiles;
|
QList<Core::IDocument *> m_openFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -46,12 +46,15 @@ using namespace TextEditor::Internal;
|
|||||||
PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
|
PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
|
||||||
: Core::IEditorFactory(parent)
|
: Core::IEditorFactory(parent)
|
||||||
{
|
{
|
||||||
|
setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
|
||||||
|
setDisplayName(qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME));
|
||||||
|
addMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
|
||||||
|
|
||||||
m_actionHandler = new TextEditorActionHandler(
|
m_actionHandler = new TextEditorActionHandler(
|
||||||
TextEditor::Constants::C_TEXTEDITOR,
|
TextEditor::Constants::C_TEXTEDITOR,
|
||||||
TextEditorActionHandler::Format |
|
TextEditorActionHandler::Format |
|
||||||
TextEditorActionHandler::UnCommentSelection |
|
TextEditorActionHandler::UnCommentSelection |
|
||||||
TextEditorActionHandler::UnCollapseAll);
|
TextEditorActionHandler::UnCollapseAll);
|
||||||
m_mimeTypes << QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlainTextEditorFactory::~PlainTextEditorFactory()
|
PlainTextEditorFactory::~PlainTextEditorFactory()
|
||||||
@@ -59,16 +62,6 @@ PlainTextEditorFactory::~PlainTextEditorFactory()
|
|||||||
delete m_actionHandler;
|
delete m_actionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id PlainTextEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PlainTextEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent)
|
||||||
{
|
{
|
||||||
PlainTextEditorWidget *rc = new PlainTextEditorWidget(parent);
|
PlainTextEditorWidget *rc = new PlainTextEditorWidget(parent);
|
||||||
@@ -106,13 +99,3 @@ void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlainTextEditorFactory::addMimeType(const QString &type)
|
|
||||||
{
|
|
||||||
m_mimeTypes.append(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList PlainTextEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
@@ -44,22 +44,16 @@ class PlainTextEditorFactory : public Core::IEditorFactory
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PlainTextEditorFactory(QObject *parent = 0);
|
PlainTextEditorFactory(QObject *parent = 0);
|
||||||
virtual ~PlainTextEditorFactory();
|
~PlainTextEditorFactory();
|
||||||
|
|
||||||
void addMimeType(const QString &type);
|
using Core::IEditorFactory::addMimeType;
|
||||||
virtual QStringList mimeTypes() const;
|
|
||||||
//Core::IEditorFactory
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
TextEditor::TextEditorActionHandler *actionHandler() const { return m_actionHandler; }
|
TextEditor::TextEditorActionHandler *actionHandler() const { return m_actionHandler; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateEditorInfoBar(Core::IEditor *editor);
|
void updateEditorInfoBar(Core::IEditor *editor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_mimeTypes;
|
|
||||||
TextEditor::TextEditorActionHandler *m_actionHandler;
|
TextEditor::TextEditorActionHandler *m_actionHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -54,16 +54,11 @@ public:
|
|||||||
BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t);
|
BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t);
|
||||||
|
|
||||||
const VcsBaseEditorParameters *m_type;
|
const VcsBaseEditorParameters *m_type;
|
||||||
const Core::Id m_id;
|
|
||||||
QString m_displayName;
|
|
||||||
const QStringList m_mimeTypes;
|
|
||||||
TextEditor::TextEditorActionHandler *m_editorHandler;
|
TextEditor::TextEditorActionHandler *m_editorHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseVcsEditorFactoryPrivate::BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t) :
|
BaseVcsEditorFactoryPrivate::BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t) :
|
||||||
m_type(t),
|
m_type(t),
|
||||||
m_id(t->id),
|
|
||||||
m_mimeTypes(QStringList(QLatin1String(t->mimeType))),
|
|
||||||
m_editorHandler(new TextEditor::TextEditorActionHandler(t->context))
|
m_editorHandler(new TextEditor::TextEditorActionHandler(t->context))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -73,7 +68,9 @@ BaseVcsEditorFactoryPrivate::BaseVcsEditorFactoryPrivate(const VcsBaseEditorPara
|
|||||||
BaseVcsEditorFactory::BaseVcsEditorFactory(const VcsBaseEditorParameters *t)
|
BaseVcsEditorFactory::BaseVcsEditorFactory(const VcsBaseEditorParameters *t)
|
||||||
: d(new Internal::BaseVcsEditorFactoryPrivate(t))
|
: d(new Internal::BaseVcsEditorFactoryPrivate(t))
|
||||||
{
|
{
|
||||||
d->m_displayName = QCoreApplication::translate("VCS", t->displayName);
|
setId(t->id);
|
||||||
|
setDisplayName(QCoreApplication::translate("VCS", t->displayName));
|
||||||
|
addMimeType(t->mimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseVcsEditorFactory::~BaseVcsEditorFactory()
|
BaseVcsEditorFactory::~BaseVcsEditorFactory()
|
||||||
@@ -81,26 +78,11 @@ BaseVcsEditorFactory::~BaseVcsEditorFactory()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList BaseVcsEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return d->m_mimeTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id BaseVcsEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return d->m_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BaseVcsEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return d->m_displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IEditor *BaseVcsEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *BaseVcsEditorFactory::createEditor(QWidget *parent)
|
||||||
{
|
{
|
||||||
VcsBaseEditorWidget *vcsEditor = createVcsBaseEditor(d->m_type, parent);
|
VcsBaseEditorWidget *vcsEditor = createVcsBaseEditor(d->m_type, parent);
|
||||||
|
|
||||||
vcsEditor ->setMimeType(d->m_mimeTypes.front());
|
vcsEditor->setMimeType(mimeTypes().front());
|
||||||
d->m_editorHandler->setupActions(vcsEditor);
|
d->m_editorHandler->setupActions(vcsEditor);
|
||||||
|
|
||||||
// Wire font settings and set initial values
|
// Wire font settings and set initial values
|
||||||
|
@@ -35,8 +35,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QStringList)
|
|
||||||
|
|
||||||
namespace VcsBase {
|
namespace VcsBase {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class BaseVcsEditorFactoryPrivate;
|
class BaseVcsEditorFactoryPrivate;
|
||||||
@@ -45,15 +43,11 @@ class BaseVcsEditorFactoryPrivate;
|
|||||||
class VCSBASE_EXPORT BaseVcsEditorFactory : public Core::IEditorFactory
|
class VCSBASE_EXPORT BaseVcsEditorFactory : public Core::IEditorFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BaseVcsEditorFactory(const VcsBaseEditorParameters *type);
|
explicit BaseVcsEditorFactory(const VcsBaseEditorParameters *type);
|
||||||
~BaseVcsEditorFactory();
|
~BaseVcsEditorFactory();
|
||||||
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
// IEditorFactory
|
|
||||||
|
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -32,58 +32,21 @@
|
|||||||
|
|
||||||
namespace VcsBase {
|
namespace VcsBase {
|
||||||
|
|
||||||
namespace Internal {
|
BaseVcsSubmitEditorFactory::BaseVcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters)
|
||||||
|
: m_parameters(parameters)
|
||||||
class BaseVcsSubmitEditorFactoryPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BaseVcsSubmitEditorFactoryPrivate(const VcsBaseSubmitEditorParameters *parameters);
|
|
||||||
|
|
||||||
const VcsBaseSubmitEditorParameters *m_parameters;
|
|
||||||
const Core::Id m_id;
|
|
||||||
const QString m_displayName;
|
|
||||||
const QStringList m_mimeTypes;
|
|
||||||
};
|
|
||||||
|
|
||||||
BaseVcsSubmitEditorFactoryPrivate::BaseVcsSubmitEditorFactoryPrivate(const VcsBaseSubmitEditorParameters *parameters) :
|
|
||||||
m_parameters(parameters),
|
|
||||||
m_id(parameters->id),
|
|
||||||
m_displayName(QLatin1String(parameters->displayName)),
|
|
||||||
m_mimeTypes(QLatin1String(parameters->mimeType))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
|
|
||||||
BaseVcsSubmitEditorFactory::BaseVcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters) :
|
|
||||||
d(new Internal::BaseVcsSubmitEditorFactoryPrivate(parameters))
|
|
||||||
{
|
{
|
||||||
|
setId(parameters->id);
|
||||||
|
setDisplayName(QLatin1String(parameters->displayName));
|
||||||
|
addMimeType(parameters->mimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseVcsSubmitEditorFactory::~BaseVcsSubmitEditorFactory()
|
BaseVcsSubmitEditorFactory::~BaseVcsSubmitEditorFactory()
|
||||||
{
|
{
|
||||||
delete d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *BaseVcsSubmitEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *BaseVcsSubmitEditorFactory::createEditor(QWidget *parent)
|
||||||
{
|
{
|
||||||
return createBaseSubmitEditor(d->m_parameters, parent);
|
return createBaseSubmitEditor(m_parameters, parent);
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id BaseVcsSubmitEditorFactory::id() const
|
|
||||||
{
|
|
||||||
return d->m_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BaseVcsSubmitEditorFactory::displayName() const
|
|
||||||
{
|
|
||||||
return d->m_displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList BaseVcsSubmitEditorFactory::mimeTypes() const
|
|
||||||
{
|
|
||||||
return d->m_mimeTypes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VcsBase
|
} // namespace VcsBase
|
||||||
|
@@ -39,10 +39,6 @@ namespace VcsBase {
|
|||||||
class VcsBaseSubmitEditor;
|
class VcsBaseSubmitEditor;
|
||||||
class VcsBaseSubmitEditorParameters;
|
class VcsBaseSubmitEditorParameters;
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
class BaseVcsSubmitEditorFactoryPrivate;
|
|
||||||
} // namespace Internal
|
|
||||||
|
|
||||||
// Parametrizable base class for editor factories creating instances of
|
// Parametrizable base class for editor factories creating instances of
|
||||||
// VcsBaseSubmitEditor subclasses.
|
// VcsBaseSubmitEditor subclasses.
|
||||||
class VCSBASE_EXPORT BaseVcsSubmitEditorFactory : public Core::IEditorFactory
|
class VCSBASE_EXPORT BaseVcsSubmitEditorFactory : public Core::IEditorFactory
|
||||||
@@ -51,21 +47,17 @@ class VCSBASE_EXPORT BaseVcsSubmitEditorFactory : public Core::IEditorFactory
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit BaseVcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters);
|
explicit BaseVcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters);
|
||||||
|
|
||||||
public:
|
|
||||||
~BaseVcsSubmitEditorFactory();
|
~BaseVcsSubmitEditorFactory();
|
||||||
|
|
||||||
|
public:
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
Core::Id id() const;
|
|
||||||
QString displayName() const;
|
|
||||||
QStringList mimeTypes() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual VcsBaseSubmitEditor
|
virtual VcsBaseSubmitEditor
|
||||||
*createBaseSubmitEditor(const VcsBaseSubmitEditorParameters *parameters,
|
*createBaseSubmitEditor(const VcsBaseSubmitEditorParameters *parameters,
|
||||||
QWidget *parent) = 0;
|
QWidget *parent) = 0;
|
||||||
|
|
||||||
Internal::BaseVcsSubmitEditorFactoryPrivate *const d;
|
const VcsBaseSubmitEditorParameters *const m_parameters; // Not owned.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Utility template to create an editor that has a constructor taking the
|
// Utility template to create an editor that has a constructor taking the
|
||||||
|
Reference in New Issue
Block a user