forked from qt-creator/qt-creator
use Core::Id for IEditorFactory::id
Change-Id: Iefd67a0461d9016b8ba0f3371df7ec6d42e188c5 Reviewed-on: http://codereview.qt-project.org/4321 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -573,7 +573,7 @@ void BazaarPlugin::showCommitWidget(const QList<VCSBase::VCSBaseClient::StatusIt
|
||||
}
|
||||
|
||||
Core::IEditor *editor = m_core->editorManager()->openEditor(m_changeLog->fileName(),
|
||||
QLatin1String(Constants::COMMIT_ID),
|
||||
Constants::COMMIT_ID,
|
||||
Core::EditorManager::ModeSwitch);
|
||||
if (!editor) {
|
||||
outputWindow->appendError(tr("Unable to create an editor for the commit."));
|
||||
|
||||
@@ -416,9 +416,9 @@ BinEditorFactory::BinEditorFactory(BinEditorPlugin *owner) :
|
||||
{
|
||||
}
|
||||
|
||||
QString BinEditorFactory::id() const
|
||||
Core::Id BinEditorFactory::id() const
|
||||
{
|
||||
return QLatin1String(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
|
||||
return Core::Constants::K_DEFAULT_BINARY_EDITOR_ID;
|
||||
}
|
||||
|
||||
QString BinEditorFactory::displayName() const
|
||||
|
||||
@@ -57,7 +57,6 @@ public:
|
||||
namespace Internal {
|
||||
class BinEditorFactory;
|
||||
|
||||
|
||||
class BinEditorPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -105,10 +104,9 @@ class BinEditorFactory : public Core::IEditorFactory
|
||||
public:
|
||||
explicit BinEditorFactory(BinEditorPlugin *owner);
|
||||
|
||||
virtual QStringList mimeTypes() const;
|
||||
|
||||
QStringList mimeTypes() const;
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
QString id() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
|
||||
|
||||
@@ -48,13 +48,9 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager, TextEditor::TextEd
|
||||
|
||||
}
|
||||
|
||||
CMakeEditorFactory::~CMakeEditorFactory()
|
||||
Core::Id CMakeEditorFactory::id() const
|
||||
{
|
||||
}
|
||||
|
||||
QString CMakeEditorFactory::id() const
|
||||
{
|
||||
return QLatin1String(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
|
||||
return CMakeProjectManager::Constants::CMAKE_EDITOR_ID;
|
||||
}
|
||||
|
||||
QString CMakeEditorFactory::displayName() const
|
||||
|
||||
@@ -33,21 +33,17 @@
|
||||
#ifndef CMAKEEDITORFACTORY_H
|
||||
#define CMAKEEDITORFACTORY_H
|
||||
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
#include "cmakeprojectmanager.h"
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
QT_END_NAMESPACE
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
namespace TextEditor {
|
||||
class TextEditorActionHandler;
|
||||
}
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class CMakeEditorFactory : public Core::IEditorFactory
|
||||
@@ -56,11 +52,11 @@ class CMakeEditorFactory : public Core::IEditorFactory
|
||||
|
||||
public:
|
||||
CMakeEditorFactory(CMakeManager *parent, TextEditor::TextEditorActionHandler *handler);
|
||||
~CMakeEditorFactory();
|
||||
|
||||
virtual QStringList mimeTypes() const;
|
||||
virtual QString id() const;
|
||||
virtual QString displayName() const;
|
||||
// IEditorFactory
|
||||
QStringList mimeTypes() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
|
||||
@@ -1148,8 +1148,7 @@ EditorManager::ExternalEditorList
|
||||
/* For something that has a 'QString id' (IEditorFactory
|
||||
* or IExternalEditor), find the one matching a id. */
|
||||
template <class EditorFactoryLike>
|
||||
inline EditorFactoryLike *findById(ExtensionSystem::PluginManager *pm,
|
||||
const QString &id)
|
||||
EditorFactoryLike *findById(ExtensionSystem::PluginManager *pm, const Core::Id &id)
|
||||
{
|
||||
const QList<EditorFactoryLike *> factories = pm->template getObjects<EditorFactoryLike>();
|
||||
foreach(EditorFactoryLike *efl, factories)
|
||||
@@ -1158,20 +1157,19 @@ template <class EditorFactoryLike>
|
||||
return 0;
|
||||
}
|
||||
|
||||
IEditor *EditorManager::createEditor(const QString &editorId,
|
||||
const QString &fileName)
|
||||
IEditor *EditorManager::createEditor(const Id &editorId, const QString &fileName)
|
||||
{
|
||||
if (debugEditorManager)
|
||||
qDebug() << Q_FUNC_INFO << editorId << fileName;
|
||||
qDebug() << Q_FUNC_INFO << editorId.name() << fileName;
|
||||
|
||||
EditorFactoryList factories;
|
||||
if (editorId.isEmpty()) {
|
||||
if (!editorId.isValid()) {
|
||||
const QFileInfo fileInfo(fileName);
|
||||
// Find by mime type
|
||||
MimeType mimeType = d->m_core->mimeDatabase()->findByFile(fileInfo);
|
||||
if (!mimeType) {
|
||||
qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain",
|
||||
Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.toUtf8().constData());
|
||||
Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.name().constData());
|
||||
mimeType = d->m_core->mimeDatabase()->findByType(QLatin1String("text/plain"));
|
||||
}
|
||||
// open text files > 48 MB in binary editor
|
||||
@@ -1185,7 +1183,7 @@ IEditor *EditorManager::createEditor(const QString &editorId,
|
||||
}
|
||||
if (factories.empty()) {
|
||||
qWarning("%s: unable to find an editor factory for the file '%s', editor Id '%s'.",
|
||||
Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.toUtf8().constData());
|
||||
Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.name().constData());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1217,7 +1215,7 @@ void EditorManager::addEditor(IEditor *editor, bool isDuplicate)
|
||||
|
||||
// Run the OpenWithDialog and return the editor id
|
||||
// selected by the user.
|
||||
QString EditorManager::getOpenWithEditorId(const QString &fileName,
|
||||
Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
|
||||
bool *isExternalEditor) const
|
||||
{
|
||||
// Collect editors that can open the file
|
||||
@@ -1230,14 +1228,14 @@ QString EditorManager::getOpenWithEditorId(const QString &fileName,
|
||||
const EditorFactoryList editors = editorFactories(mt, false);
|
||||
const int size = editors.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
allEditorIds.push_back(editors.at(i)->id());
|
||||
allEditorIds.push_back(editors.at(i)->id().toString());
|
||||
}
|
||||
// External editors
|
||||
const ExternalEditorList exEditors = externalEditors(mt, false);
|
||||
const int esize = exEditors.size();
|
||||
for (int i = 0; i < esize; i++) {
|
||||
externalEditorIds.push_back(exEditors.at(i)->id());
|
||||
allEditorIds.push_back(exEditors.at(i)->id());
|
||||
externalEditorIds.push_back(exEditors.at(i)->id().toString());
|
||||
allEditorIds.push_back(exEditors.at(i)->id().toString());
|
||||
}
|
||||
if (allEditorIds.empty())
|
||||
return QString();
|
||||
@@ -1253,7 +1251,7 @@ QString EditorManager::getOpenWithEditorId(const QString &fileName,
|
||||
return selectedId;
|
||||
}
|
||||
|
||||
IEditor *EditorManager::openEditor(const QString &fileName, const QString &editorId,
|
||||
IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId,
|
||||
OpenEditorFlags flags, bool *newEditor)
|
||||
{
|
||||
return openEditor(currentEditorView(), fileName, editorId, flags, newEditor);
|
||||
@@ -1284,10 +1282,10 @@ static QString autoSaveName(const QString &fileName)
|
||||
}
|
||||
|
||||
IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QString &fileName,
|
||||
const QString &editorId, OpenEditorFlags flags, bool *newEditor)
|
||||
const Id &editorId, OpenEditorFlags flags, bool *newEditor)
|
||||
{
|
||||
if (debugEditorManager)
|
||||
qDebug() << Q_FUNC_INFO << fileName << editorId;
|
||||
qDebug() << Q_FUNC_INFO << fileName << editorId.name();
|
||||
|
||||
QString fn = fileName;
|
||||
int lineNumber = -1;
|
||||
@@ -1350,7 +1348,7 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
|
||||
return result;
|
||||
}
|
||||
|
||||
bool EditorManager::openExternalEditor(const QString &fileName, const QString &editorId)
|
||||
bool EditorManager::openExternalEditor(const QString &fileName, const Core::Id &editorId)
|
||||
{
|
||||
IExternalEditor *ee = findById<IExternalEditor>(pluginManager(), editorId);
|
||||
if (!ee)
|
||||
@@ -1389,12 +1387,12 @@ void EditorManager::switchToPreferedMode()
|
||||
ModeManager::instance()->activateModeType(preferedMode);
|
||||
}
|
||||
|
||||
IEditor *EditorManager::openEditorWithContents(const QString &editorId,
|
||||
IEditor *EditorManager::openEditorWithContents(const Id &editorId,
|
||||
QString *titlePattern,
|
||||
const QString &contents)
|
||||
{
|
||||
if (debugEditorManager)
|
||||
qDebug() << Q_FUNC_INFO << editorId << titlePattern << contents;
|
||||
qDebug() << Q_FUNC_INFO << editorId.name() << titlePattern << contents;
|
||||
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
@@ -1905,7 +1903,7 @@ QByteArray EditorManager::saveState() const
|
||||
|
||||
foreach (const OpenEditorsModel::Entry &entry, entries) {
|
||||
if (!entry.editor || !entry.editor->isTemporary())
|
||||
stream << entry.fileName() << entry.displayName() << entry.id().toUtf8();
|
||||
stream << entry.fileName() << entry.displayName() << entry.id().name();
|
||||
}
|
||||
|
||||
stream << d->m_splitter->saveState();
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "../core_global.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/ifile.h> // enumerations
|
||||
|
||||
#include <QtCore/QList>
|
||||
@@ -117,18 +118,15 @@ public:
|
||||
};
|
||||
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)
|
||||
|
||||
IEditor *openEditor(const QString &fileName,
|
||||
const QString &editorId = QString(),
|
||||
OpenEditorFlags flags = 0,
|
||||
bool *newEditor = 0);
|
||||
IEditor *openEditorWithContents(const QString &editorId,
|
||||
QString *titlePattern = 0,
|
||||
const QString &contents = QString());
|
||||
IEditor *openEditor(const QString &fileName, const Id &editorId = Id(),
|
||||
OpenEditorFlags flags = 0, bool *newEditor = 0);
|
||||
IEditor *openEditorWithContents(const Id &editorId,
|
||||
QString *titlePattern = 0, const QString &contents = QString());
|
||||
|
||||
bool openExternalEditor(const QString &fileName, const QString &editorId);
|
||||
bool openExternalEditor(const QString &fileName, const Id &editorId);
|
||||
|
||||
QStringList getOpenFileNames() const;
|
||||
QString getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const;
|
||||
Id getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const;
|
||||
|
||||
bool hasEditor(const QString &fileName) const;
|
||||
QList<IEditor *> editorsForFileName(const QString &filename) const;
|
||||
@@ -241,8 +239,7 @@ public slots:
|
||||
|
||||
private:
|
||||
QList<IFile *> filesForEditors(QList<IEditor *> editors) const;
|
||||
IEditor *createEditor(const QString &mimeType = QString(),
|
||||
const QString &fileName = QString());
|
||||
IEditor *createEditor(const Id &id = Id(), const QString &fileName = QString());
|
||||
void addEditor(IEditor *editor, bool isDuplicate = false);
|
||||
void removeEditor(IEditor *editor);
|
||||
|
||||
@@ -255,9 +252,7 @@ private:
|
||||
IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = 0);
|
||||
void activateEditorForIndex(Internal::EditorView *view, const QModelIndex &index, OpenEditorFlags = 0);
|
||||
IEditor *openEditor(Internal::EditorView *view, const QString &fileName,
|
||||
const QString &editorId = QString(),
|
||||
OpenEditorFlags flags = 0,
|
||||
bool *newEditor = 0);
|
||||
const Id &id = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0);
|
||||
Internal::SplitterOrView *currentSplitterOrView() const;
|
||||
|
||||
void closeEditor(IEditor *editor);
|
||||
|
||||
@@ -786,7 +786,7 @@ void SplitterOrView::restoreState(const QByteArray &state)
|
||||
stream >> fileName >> id >> editorState;
|
||||
if (!QFile::exists(fileName))
|
||||
return;
|
||||
IEditor *e = em->openEditor(view(), fileName, id, Core::EditorManager::IgnoreNavigationHistory
|
||||
IEditor *e = em->openEditor(view(), fileName, Id(QString(id)), Core::EditorManager::IgnoreNavigationHistory
|
||||
| Core::EditorManager::NoActivate);
|
||||
|
||||
if (!e) {
|
||||
|
||||
@@ -42,9 +42,9 @@ class IEditor;
|
||||
class CORE_EXPORT IEditorFactory : public Core::IFileFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IEditorFactory(QObject *parent = 0) : IFileFactory(parent) {}
|
||||
virtual ~IEditorFactory() {}
|
||||
|
||||
virtual IEditor *createEditor(QWidget *parent) = 0;
|
||||
};
|
||||
|
||||
@@ -39,17 +39,18 @@
|
||||
|
||||
namespace Core {
|
||||
|
||||
class Id;
|
||||
|
||||
class CORE_EXPORT IExternalEditor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IExternalEditor(QObject *parent = 0) : QObject(parent) {}
|
||||
virtual ~IExternalEditor() {}
|
||||
|
||||
virtual QStringList mimeTypes() const = 0;
|
||||
virtual QString id() const = 0;
|
||||
virtual Id id() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
|
||||
virtual bool startEditor(const QString &fileName, QString *errorMessage) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ QString OpenEditorsModel::Entry::displayName() const {
|
||||
return editor ? editor->displayName() : m_displayName;
|
||||
}
|
||||
|
||||
QString OpenEditorsModel::Entry::id() const
|
||||
Id OpenEditorsModel::Entry::id() const
|
||||
{
|
||||
return editor ? editor->id() : m_id;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::UserRole + 1:
|
||||
return e.fileName();
|
||||
case Qt::UserRole + 2:
|
||||
return e.editor ? e.editor->id() : e.id();
|
||||
return QVariant::fromValue(e.editor ? e.editor->id() : e.id());
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define OPENEDITORSMODEL_H
|
||||
|
||||
#include "../core_global.h"
|
||||
#include "../id.h"
|
||||
|
||||
#include <QtCore/QAbstractItemModel>
|
||||
#include <QtCore/QScopedPointer>
|
||||
@@ -71,10 +72,10 @@ public:
|
||||
IEditor *editor;
|
||||
QString fileName() const;
|
||||
QString displayName() const;
|
||||
QString id() const;
|
||||
Id id() const;
|
||||
QString m_fileName;
|
||||
QString m_displayName;
|
||||
QString m_id;
|
||||
Id m_id;
|
||||
};
|
||||
QList<Entry> entries() const;
|
||||
|
||||
|
||||
@@ -280,10 +280,10 @@ void OpenEditorsWindow::selectEditor(QTreeWidgetItem *item)
|
||||
return;
|
||||
if (IFile *file = item->data(0, Qt::UserRole).value<IFile*>()) {
|
||||
EditorView *view = item->data(0, Qt::UserRole+1).value<EditorView*>();
|
||||
EditorManager::instance()->activateEditorForFile(view, file, Core::EditorManager::ModeSwitch);
|
||||
EditorManager::instance()->activateEditorForFile(view, file, EditorManager::ModeSwitch);
|
||||
} else {
|
||||
if (!EditorManager::instance()->openEditor(
|
||||
item->toolTip(0), item->data(0, Qt::UserRole+2).toByteArray(),
|
||||
item->toolTip(0), item->data(0, Qt::UserRole+2).value<Core::Id>(),
|
||||
Core::EditorManager::ModeSwitch)) {
|
||||
EditorManager::instance()->openedEditorsModel()->removeEditor(item->toolTip(0));
|
||||
delete item;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "systemeditor.h"
|
||||
#include "id.h"
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QUrl>
|
||||
@@ -49,9 +50,9 @@ QStringList SystemEditor::mimeTypes() const
|
||||
return QStringList() << QLatin1String("application/octet-stream");
|
||||
}
|
||||
|
||||
QString SystemEditor::id() const
|
||||
Id SystemEditor::id() const
|
||||
{
|
||||
return QLatin1String("CorePlugin.OpenWithSystemEditor");
|
||||
return Id("CorePlugin.OpenWithSystemEditor");
|
||||
}
|
||||
|
||||
QString SystemEditor::displayName() const
|
||||
|
||||
@@ -41,17 +41,18 @@ namespace Internal {
|
||||
class SystemEditor : public IExternalEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SystemEditor(QObject *parent = 0);
|
||||
|
||||
QStringList mimeTypes() const;
|
||||
QString id() const;
|
||||
Id id() const;
|
||||
QString displayName() const;
|
||||
|
||||
bool startEditor(const QString &fileName, QString *errorMessage);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
#endif // SYSTEMEDITOR_H
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "core_global.h"
|
||||
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QtCore/QString>
|
||||
|
||||
namespace Core {
|
||||
@@ -65,4 +66,6 @@ CORE_EXPORT uint qHash(const Id &id);
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_METATYPE(Core::Id);
|
||||
|
||||
#endif // CORE_ID_H
|
||||
|
||||
@@ -44,20 +44,19 @@ QT_END_NAMESPACE
|
||||
namespace Core {
|
||||
|
||||
class IFile;
|
||||
class Id;
|
||||
|
||||
class CORE_EXPORT IFileFactory : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IFileFactory(QObject *parent = 0) : QObject(parent) {}
|
||||
virtual ~IFileFactory() {}
|
||||
|
||||
virtual QStringList mimeTypes() const = 0;
|
||||
|
||||
virtual QString id() const = 0;
|
||||
virtual Id id() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
|
||||
virtual Core::IFile *open(const QString &fileName) = 0;
|
||||
virtual IFile *open(const QString &fileName) = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -1003,8 +1003,8 @@ void MainWindow::openFileWith()
|
||||
QStringList fileNames = editorManager()->getOpenFileNames();
|
||||
foreach (const QString &fileName, fileNames) {
|
||||
bool isExternal;
|
||||
const QString editorId = editorManager()->getOpenWithEditorId(fileName, &isExternal);
|
||||
if (editorId.isEmpty())
|
||||
const Id editorId = editorManager()->getOpenWithEditorId(fileName, &isExternal);
|
||||
if (!editorId.isValid())
|
||||
continue;
|
||||
if (isExternal) {
|
||||
editorManager()->openExternalEditor(fileName, editorId);
|
||||
|
||||
@@ -101,9 +101,9 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
|
||||
#endif
|
||||
}
|
||||
|
||||
QString CppEditorFactory::id() const
|
||||
Core::Id CppEditorFactory::id() const
|
||||
{
|
||||
return QLatin1String(CppEditor::Constants::CPPEDITOR_ID);
|
||||
return CppEditor::Constants::CPPEDITOR_ID;
|
||||
}
|
||||
|
||||
QString CppEditorFactory::displayName() const
|
||||
|
||||
@@ -116,12 +116,11 @@ class CppEditorFactory : public Core::IEditorFactory
|
||||
public:
|
||||
CppEditorFactory(CppPlugin *owner);
|
||||
|
||||
virtual QStringList mimeTypes() const;
|
||||
|
||||
// IEditorFactory
|
||||
QStringList mimeTypes() const;
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
virtual QString id() const;
|
||||
virtual QString displayName() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
|
||||
private:
|
||||
|
||||
@@ -315,7 +315,7 @@ void CppFileSettingsWidget::slotEdit()
|
||||
setLicenseTemplatePath(path);
|
||||
}
|
||||
// Edit (now) existing file with C++
|
||||
Core::EditorManager::instance()->openEditor(path, QLatin1String(CppEditor::Constants::CPPEDITOR_ID),
|
||||
Core::EditorManager::instance()->openEditor(path, CppEditor::Constants::CPPEDITOR_ID,
|
||||
Core::EditorManager::ModeSwitch);
|
||||
}
|
||||
|
||||
|
||||
@@ -631,7 +631,7 @@ void CVSPlugin::cvsDiff(const CvsDiffParameters &p)
|
||||
|
||||
CVSSubmitEditor *CVSPlugin::openCVSSubmitEditor(const QString &fileName)
|
||||
{
|
||||
Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::CVSCOMMITEDITOR_ID),
|
||||
Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, Constants::CVSCOMMITEDITOR_ID,
|
||||
Core::EditorManager::ModeSwitch);
|
||||
CVSSubmitEditor *submitEditor = qobject_cast<CVSSubmitEditor*>(editor);
|
||||
QTC_CHECK(submitEditor);
|
||||
|
||||
@@ -61,9 +61,9 @@ FormEditorFactory::FormEditorFactory()
|
||||
QLatin1String("ui"));
|
||||
}
|
||||
|
||||
QString FormEditorFactory::id() const
|
||||
Core::Id FormEditorFactory::id() const
|
||||
{
|
||||
return QLatin1String(K_DESIGNER_XML_EDITOR_ID);
|
||||
return K_DESIGNER_XML_EDITOR_ID;
|
||||
}
|
||||
|
||||
QString FormEditorFactory::displayName() const
|
||||
|
||||
@@ -37,25 +37,20 @@
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
class IFile;
|
||||
}
|
||||
|
||||
namespace Designer {
|
||||
namespace Internal {
|
||||
|
||||
class FormEditorFactory : public Core::IEditorFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FormEditorFactory();
|
||||
|
||||
virtual QStringList mimeTypes() const;
|
||||
|
||||
// IEditorFactory
|
||||
virtual QString id() const;
|
||||
virtual QString displayName() const;
|
||||
QStringList mimeTypes() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
|
||||
@@ -75,9 +75,9 @@ QStringList ProjectFilesFactory::mimeTypes() const
|
||||
return m_mimeTypes;
|
||||
}
|
||||
|
||||
QString ProjectFilesFactory::id() const
|
||||
Core::Id ProjectFilesFactory::id() const
|
||||
{
|
||||
return QLatin1String(Constants::FILES_EDITOR_ID);
|
||||
return Constants::FILES_EDITOR_ID;
|
||||
}
|
||||
|
||||
QString ProjectFilesFactory::displayName() const
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
virtual Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
virtual QStringList mimeTypes() const;
|
||||
virtual QString id() const;
|
||||
virtual Core::Id id() const;
|
||||
virtual QString displayName() const;
|
||||
virtual Core::IFile *open(const QString &fileName);
|
||||
|
||||
|
||||
@@ -713,7 +713,7 @@ void GitPlugin::startCommit(bool amend)
|
||||
|
||||
Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd, bool amend)
|
||||
{
|
||||
Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, QLatin1String(Constants::GITSUBMITEDITOR_ID),
|
||||
Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, Constants::GITSUBMITEDITOR_ID,
|
||||
Core::EditorManager::ModeSwitch);
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << fileName << editor;
|
||||
|
||||
@@ -65,13 +65,9 @@ GLSLEditorFactory::GLSLEditorFactory(QObject *parent)
|
||||
;
|
||||
}
|
||||
|
||||
GLSLEditorFactory::~GLSLEditorFactory()
|
||||
Core::Id GLSLEditorFactory::id() const
|
||||
{
|
||||
}
|
||||
|
||||
QString GLSLEditorFactory::id() const
|
||||
{
|
||||
return QLatin1String(C_GLSLEDITOR_ID);
|
||||
return C_GLSLEDITOR_ID;
|
||||
}
|
||||
|
||||
QString GLSLEditorFactory::displayName() const
|
||||
@@ -79,7 +75,6 @@ QString GLSLEditorFactory::displayName() const
|
||||
return tr(C_GLSLEDITOR_DISPLAY_NAME);
|
||||
}
|
||||
|
||||
|
||||
Core::IFile *GLSLEditorFactory::open(const QString &fileName)
|
||||
{
|
||||
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
|
||||
|
||||
@@ -37,26 +37,19 @@
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
namespace TextEditor {
|
||||
class TextEditorActionHandler;
|
||||
}
|
||||
|
||||
namespace GLSLEditor {
|
||||
namespace Internal {
|
||||
|
||||
class GLSLEditorActionHandler;
|
||||
|
||||
class GLSLEditorFactory : public Core::IEditorFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GLSLEditorFactory(QObject *parent);
|
||||
~GLSLEditorFactory();
|
||||
|
||||
virtual QStringList mimeTypes() const;
|
||||
// IEditorFactory
|
||||
QString id() const;
|
||||
QStringList mimeTypes() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
@@ -82,6 +82,7 @@ ImageViewerFactory::ImageViewerFactory(QObject *parent) :
|
||||
|
||||
ImageViewerFactory::~ImageViewerFactory()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
Core::IEditor *ImageViewerFactory::createEditor(QWidget *parent)
|
||||
@@ -94,9 +95,9 @@ QStringList ImageViewerFactory::mimeTypes() const
|
||||
return d->mimeTypes;
|
||||
}
|
||||
|
||||
QString ImageViewerFactory::id() const
|
||||
Core::Id ImageViewerFactory::id() const
|
||||
{
|
||||
return QLatin1String(Constants::IMAGEVIEWER_ID);
|
||||
return Constants::IMAGEVIEWER_ID;
|
||||
}
|
||||
|
||||
QString ImageViewerFactory::displayName() const
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <coreplugin/ifile.h>
|
||||
|
||||
#include <QtCore/QScopedPointer>
|
||||
|
||||
namespace ImageViewer {
|
||||
namespace Internal {
|
||||
|
||||
@@ -53,16 +51,14 @@ public:
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
QStringList mimeTypes() const;
|
||||
|
||||
QString id() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
|
||||
Core::IFile *open(const QString &fileName);
|
||||
|
||||
void extensionsInitialized();
|
||||
|
||||
private:
|
||||
QScopedPointer<struct ImageViewerFactoryPrivate> d;
|
||||
struct ImageViewerFactoryPrivate *d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -598,7 +598,7 @@ void MercurialPlugin::showCommitWidget(const QList<VCSBase::VCSBaseClient::Statu
|
||||
}
|
||||
|
||||
Core::IEditor *editor = core->editorManager()->openEditor(changeLog->fileName(),
|
||||
QLatin1String(Constants::COMMIT_ID),
|
||||
Constants::COMMIT_ID,
|
||||
Core::EditorManager::ModeSwitch);
|
||||
if (!editor) {
|
||||
outputWindow->appendError(tr("Unable to create an editor for the commit."));
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
|
||||
@@ -64,9 +65,9 @@ QStringList ProjectFileFactory::mimeTypes() const
|
||||
return m_mimeTypes;
|
||||
}
|
||||
|
||||
QString ProjectFileFactory::id() const
|
||||
Core::Id ProjectFileFactory::id() const
|
||||
{
|
||||
return QLatin1String(Constants::FILE_FACTORY_ID);
|
||||
return Constants::FILE_FACTORY_ID;
|
||||
}
|
||||
|
||||
QString ProjectFileFactory::displayName() const
|
||||
|
||||
@@ -53,7 +53,7 @@ class ProjectFileFactory : public Core::IFileFactory
|
||||
public:
|
||||
virtual QStringList mimeTypes() const;
|
||||
bool canOpen(const QString &fileName);
|
||||
QString id() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
|
||||
Core::IFile *open(const QString &fileName);
|
||||
|
||||
@@ -95,13 +95,9 @@ QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
|
||||
;
|
||||
}
|
||||
|
||||
QmlJSEditorFactory::~QmlJSEditorFactory()
|
||||
Core::Id QmlJSEditorFactory::id() const
|
||||
{
|
||||
}
|
||||
|
||||
QString QmlJSEditorFactory::id() const
|
||||
{
|
||||
return QLatin1String(C_QMLJSEDITOR_ID);
|
||||
return C_QMLJSEDITOR_ID;
|
||||
}
|
||||
|
||||
QString QmlJSEditorFactory::displayName() const
|
||||
|
||||
@@ -37,26 +37,19 @@
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
namespace TextEditor {
|
||||
class TextEditorActionHandler;
|
||||
}
|
||||
|
||||
namespace QmlJSEditor {
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSEditorActionHandler;
|
||||
|
||||
class QmlJSEditorFactory : public Core::IEditorFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlJSEditorFactory(QObject *parent);
|
||||
~QmlJSEditorFactory();
|
||||
|
||||
virtual QStringList mimeTypes() const;
|
||||
// IEditorFactory
|
||||
QString id() const;
|
||||
QStringList mimeTypes() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
@@ -122,7 +122,7 @@ QStringList ExternalQtEditor::mimeTypes() const
|
||||
return m_mimeTypes;
|
||||
}
|
||||
|
||||
QString ExternalQtEditor::id() const
|
||||
Core::Id ExternalQtEditor::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
|
||||
data->binary = Utils::SynchronousProcess::locateBinary(fallbackBinary);
|
||||
}
|
||||
if (data->binary.isEmpty()) {
|
||||
*errorMessage = msgAppNotFound(id());
|
||||
*errorMessage = msgAppNotFound(id().toString());
|
||||
return false;
|
||||
}
|
||||
// Setup binary + arguments, use Mac Open if appropriate
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define DESIGNEREXTERNALEDITOR_H
|
||||
|
||||
#include <coreplugin/editormanager/iexternaleditor.h>
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QMap>
|
||||
@@ -49,11 +50,9 @@ class BaseQtVersion;
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
|
||||
|
||||
namespace Internal {
|
||||
|
||||
/* Convience parametrizable base class for Qt editors/binaries
|
||||
/* Convenience parametrizable base class for Qt editors/binaries
|
||||
* Provides convenience methods that
|
||||
* try to retrieve the binary of the editor from the Qt version
|
||||
* of the project the file belongs to, falling back to path search
|
||||
@@ -62,9 +61,10 @@ namespace Internal {
|
||||
class ExternalQtEditor : public Core::IExternalEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
virtual QStringList mimeTypes() const;
|
||||
virtual QString id() const;
|
||||
virtual Core::Id id() const;
|
||||
virtual QString displayName() const;
|
||||
|
||||
protected:
|
||||
@@ -99,7 +99,7 @@ protected:
|
||||
|
||||
private:
|
||||
const QStringList m_mimeTypes;
|
||||
const QString m_id;
|
||||
const Core::Id m_id;
|
||||
const QString m_displayName;
|
||||
};
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ ProFileEditorFactory::~ProFileEditorFactory()
|
||||
{
|
||||
}
|
||||
|
||||
QString ProFileEditorFactory::id() const
|
||||
Core::Id ProFileEditorFactory::id() const
|
||||
{
|
||||
return QLatin1String(Qt4ProjectManager::Constants::PROFILE_EDITOR_ID);
|
||||
return Qt4ProjectManager::Constants::PROFILE_EDITOR_ID;
|
||||
}
|
||||
|
||||
QString ProFileEditorFactory::displayName() const
|
||||
|
||||
@@ -37,10 +37,6 @@
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace TextEditor {
|
||||
class TextEditorActionHandler;
|
||||
}
|
||||
@@ -59,13 +55,14 @@ public:
|
||||
ProFileEditorFactory(Qt4Manager *parent, TextEditor::TextEditorActionHandler *handler);
|
||||
~ProFileEditorFactory();
|
||||
|
||||
virtual QStringList mimeTypes() const;
|
||||
virtual QString id() const;
|
||||
virtual QString displayName() const;
|
||||
// IEditorFactory
|
||||
QStringList mimeTypes() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
inline Qt4Manager *qt4ProjectManager() const { return m_manager; }
|
||||
Qt4Manager *qt4ProjectManager() const { return m_manager; }
|
||||
|
||||
private:
|
||||
const QStringList m_mimeTypes;
|
||||
|
||||
@@ -54,9 +54,9 @@ ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin) :
|
||||
QLatin1String("qrc"));
|
||||
}
|
||||
|
||||
QString ResourceEditorFactory::id() const
|
||||
Core::Id ResourceEditorFactory::id() const
|
||||
{
|
||||
return QLatin1String(RESOURCEEDITOR_ID);
|
||||
return RESOURCEEDITOR_ID;
|
||||
}
|
||||
|
||||
QString ResourceEditorFactory::displayName() const
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
virtual QStringList mimeTypes() const;
|
||||
|
||||
// IEditorFactory
|
||||
QString id() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
@@ -637,7 +637,7 @@ void SubversionPlugin::svnDiff(const Subversion::Internal::SubversionDiffParamet
|
||||
SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName)
|
||||
{
|
||||
Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName,
|
||||
QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_ID),
|
||||
Constants::SUBVERSIONCOMMITEDITOR_ID,
|
||||
Core::EditorManager::ModeSwitch);
|
||||
SubversionSubmitEditor *submitEditor = qobject_cast<SubversionSubmitEditor*>(editor);
|
||||
QTC_CHECK(submitEditor);
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
|
||||
#include <QtGui/QMainWindow>
|
||||
@@ -60,9 +61,9 @@ QStringList TaskFileFactory::mimeTypes() const
|
||||
return m_mimeTypes;
|
||||
}
|
||||
|
||||
QString TaskFileFactory::id() const
|
||||
Core::Id TaskFileFactory::id() const
|
||||
{
|
||||
return QLatin1String("ProjectExplorer.TaskFileFactory");
|
||||
return "ProjectExplorer.TaskFileFactory";
|
||||
}
|
||||
|
||||
QString TaskFileFactory::displayName() const
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#define TASKFILEFACTORY_H
|
||||
|
||||
#include <coreplugin/ifilefactory.h>
|
||||
|
||||
#include <coreplugin/ifile.h>
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
@@ -55,7 +54,7 @@ public:
|
||||
|
||||
QStringList mimeTypes() const;
|
||||
|
||||
QString id() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
|
||||
Core::IFile *open(const QString &fileName);
|
||||
|
||||
@@ -65,9 +65,9 @@ PlainTextEditorFactory::~PlainTextEditorFactory()
|
||||
delete m_actionHandler;
|
||||
}
|
||||
|
||||
QString PlainTextEditorFactory::id() const
|
||||
Core::Id PlainTextEditorFactory::id() const
|
||||
{
|
||||
return QLatin1String(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
|
||||
return Core::Constants::K_DEFAULT_TEXT_EDITOR_ID;
|
||||
}
|
||||
|
||||
QString PlainTextEditorFactory::displayName() const
|
||||
|
||||
@@ -34,12 +34,8 @@
|
||||
#define PLAINTEXTEDITORFACTORY_H
|
||||
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
class IFile;
|
||||
}
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
namespace TextEditor {
|
||||
class TextEditorActionHandler;
|
||||
@@ -56,7 +52,7 @@ public:
|
||||
void addMimeType(const QString &type);
|
||||
virtual QStringList mimeTypes() const;
|
||||
//Core::IEditorFactory
|
||||
QString id() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
|
||||
Core::IFile *open(const QString &fileName);
|
||||
|
||||
@@ -85,7 +85,7 @@ QStringList BaseVCSEditorFactory::mimeTypes() const
|
||||
return m_d->m_mimeTypes;
|
||||
}
|
||||
|
||||
QString BaseVCSEditorFactory::id() const
|
||||
Core::Id BaseVCSEditorFactory::id() const
|
||||
{
|
||||
return m_d->m_id;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
virtual QStringList mimeTypes() const;
|
||||
// IEditorFactory
|
||||
|
||||
virtual QString id() const;
|
||||
virtual Core::Id id() const;
|
||||
virtual QString displayName() const;
|
||||
|
||||
virtual Core::IFile *open(const QString &fileName);
|
||||
|
||||
@@ -42,7 +42,7 @@ struct BaseVCSSubmitEditorFactoryPrivate
|
||||
BaseVCSSubmitEditorFactoryPrivate(const VCSBaseSubmitEditorParameters *parameters);
|
||||
|
||||
const VCSBaseSubmitEditorParameters *m_parameters;
|
||||
const QString m_id;
|
||||
const Core::Id m_id;
|
||||
const QString m_displayName;
|
||||
const QStringList m_mimeTypes;
|
||||
};
|
||||
@@ -70,7 +70,7 @@ Core::IEditor *BaseVCSSubmitEditorFactory::createEditor(QWidget *parent)
|
||||
return createBaseSubmitEditor(m_d->m_parameters, parent);
|
||||
}
|
||||
|
||||
QString BaseVCSSubmitEditorFactory::id() const
|
||||
Core::Id BaseVCSSubmitEditorFactory::id() const
|
||||
{
|
||||
return m_d->m_id;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
virtual ~BaseVCSSubmitEditorFactory();
|
||||
|
||||
virtual Core::IEditor *createEditor(QWidget *parent);
|
||||
virtual QString id() const;
|
||||
virtual Core::Id id() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QStringList mimeTypes() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
|
||||
Reference in New Issue
Block a user