separate EM::setCurrentEditor and EM::activateEditor

This commit is contained in:
mae
2009-01-26 16:36:02 +01:00
parent 1b345cfa0f
commit ebcb9dce5a
9 changed files with 17 additions and 117 deletions

View File

@@ -252,9 +252,9 @@ Core::IEditor *EditorManagerPrototype::currentEditor() const
return callee()->currentEditor();
}
void EditorManagerPrototype::setCurrentEditor(Core::IEditor *editor)
void EditorManagerPrototype::activateEditor(Core::IEditor *editor)
{
callee()->setCurrentEditor(editor);
callee()->activateEditor(editor);
}
QList<Core::IEditor*> EditorManagerPrototype::openedEditors() const
@@ -267,11 +267,6 @@ QList<Core::IEditor*> EditorManagerPrototype::editorHistory() const
return callee()->editorHistory();
}
//QList<Core::EditorGroup *> EditorManagerPrototype::editorGroups() const
//{
// return callee()->editorGroups();
//}
QList<Core::IEditor*> EditorManagerPrototype::editorsForFiles(QList<Core::IFile*> files) const
{
return callee()->editorsForFiles(files);
@@ -376,70 +371,6 @@ QString EditorPrototype::toString() const
return rc;
}
// ----------- EditorGroupPrototype
EditorGroupPrototype::EditorGroupPrototype(QObject *parent) :
QObject(parent)
{
}
int EditorGroupPrototype::editorCount() const
{
return callee()->editorCount();
}
Core::IEditor *EditorGroupPrototype::currentEditor() const
{
return callee()->currentEditor();
}
void EditorGroupPrototype::setCurrentEditor(Core::IEditor *editor)
{
callee()->setCurrentEditor(editor);
}
QList<Core::IEditor*> EditorGroupPrototype::editors() const
{
return callee()->editors();
}
void EditorGroupPrototype::addEditor(Core::IEditor *editor)
{
callee()->addEditor(editor);
}
void EditorGroupPrototype::insertEditor(int i, Core::IEditor *editor)
{
callee()->insertEditor(i, editor);
}
void EditorGroupPrototype::removeEditor(Core::IEditor *editor)
{
callee()->removeEditor(editor);
}
void EditorGroupPrototype::moveEditorsFromGroup(Core::EditorGroup *group)
{
callee()->moveEditorsFromGroup(group);
}
void EditorGroupPrototype::moveEditorFromGroup(Core::EditorGroup *group, Core::IEditor *editor)
{
callee()->moveEditorFromGroup(group, editor);
}
QString EditorGroupPrototype::toString() const
{
return QLatin1String("EditorGroup");
}
Core::EditorGroup *EditorGroupPrototype::callee() const
{
EditorGroup *rc = qscriptvalue_cast<EditorGroup *>(thisObject());
QTC_ASSERT(rc, return 0);
return rc;
}
} // namespace Internal
} // namespace Core

View File

@@ -167,20 +167,18 @@ private:
class EditorManagerPrototype : public QObject, public QScriptable
{
Q_OBJECT
Q_PROPERTY(Core::IEditor* currentEditor READ currentEditor WRITE setCurrentEditor DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(Core::IEditor* currentEditor READ currentEditor WRITE activateEditor DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QList<Core::IEditor*> openedEditors READ openedEditors DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QList<Core::IEditor*> editorHistory READ editorHistory DESIGNABLE false SCRIPTABLE true STORED false)
// Q_PROPERTY(QList<Core::EditorGroup *> editorGroups READ editorGroups DESIGNABLE false SCRIPTABLE true STORED false)
public:
typedef Core::EditorManager EditorManager;
EditorManagerPrototype(QObject *parent = 0);
Core::IEditor *currentEditor() const;
void setCurrentEditor(Core::IEditor *editor);
void activateEditor(Core::IEditor *editor);
QList<Core::IEditor*> openedEditors() const;
QList<Core::IEditor*> editorHistory() const;
// QList<Core::EditorGroup *> editorGroups() const;
public slots:
QList<Core::IEditor*> editorsForFiles(QList<Core::IFile*> files) const;
@@ -229,37 +227,6 @@ private:
Core::IEditor *callee() const;
};
// Script prototype for the editor group interface with Script-managed life cycle.
class EditorGroupPrototype : public QObject, public QScriptable
{
Q_OBJECT
Q_PROPERTY(int editorCount READ editorCount DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(Core::IEditor* currentEditor READ currentEditor WRITE setCurrentEditor DESIGNABLE false SCRIPTABLE true STORED false)
Q_PROPERTY(QList<Core::IEditor*> editors READ editors DESIGNABLE false SCRIPTABLE true STORED false)
public:
EditorGroupPrototype(QObject *parent = 0);
int editorCount() const;
Core::IEditor *currentEditor() const;
void setCurrentEditor(Core::IEditor *editor);
QList<Core::IEditor*> editors() const;
public slots:
void addEditor(Core::IEditor *editor);
void insertEditor(int i, Core::IEditor *editor);
void removeEditor(Core::IEditor *editor);
void moveEditorsFromGroup(Core::EditorGroup *group);
void moveEditorFromGroup(Core::EditorGroup *group, Core::IEditor *editor);
QString toString() const;
private:
Core::EditorGroup *callee() const;
};
} // namespace Internal
} // namespace Core