forked from qt-creator/qt-creator
Renamed the QmlEditor::ScriptEditor class to QmlEditor::QmlTextEditor.
This commit is contained in:
@@ -65,7 +65,7 @@ void QmlCodeCompletion::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
|
|||||||
|
|
||||||
bool QmlCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
|
bool QmlCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
|
||||||
{
|
{
|
||||||
if (qobject_cast<ScriptEditor *>(editor->widget()))
|
if (qobject_cast<QmlTextEditor *>(editor->widget()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -78,7 +78,7 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
{
|
{
|
||||||
m_editor = editor;
|
m_editor = editor;
|
||||||
|
|
||||||
ScriptEditor *edit = qobject_cast<ScriptEditor *>(m_editor->widget());
|
QmlTextEditor *edit = qobject_cast<QmlTextEditor *>(m_editor->widget());
|
||||||
if (! edit)
|
if (! edit)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@@ -273,7 +273,7 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
ScriptEditorEditable::ScriptEditorEditable(ScriptEditor *editor)
|
ScriptEditorEditable::ScriptEditorEditable(QmlTextEditor *editor)
|
||||||
: BaseTextEditorEditable(editor)
|
: BaseTextEditorEditable(editor)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ ScriptEditorEditable::ScriptEditorEditable(ScriptEditor *editor)
|
|||||||
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptEditor::ScriptEditor(QWidget *parent) :
|
QmlTextEditor::QmlTextEditor(QWidget *parent) :
|
||||||
TextEditor::BaseTextEditor(parent),
|
TextEditor::BaseTextEditor(parent),
|
||||||
m_methodCombo(0),
|
m_methodCombo(0),
|
||||||
m_modelManager(0),
|
m_modelManager(0),
|
||||||
@@ -313,16 +313,16 @@ ScriptEditor::ScriptEditor(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptEditor::~ScriptEditor()
|
QmlTextEditor::~QmlTextEditor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Declaration> ScriptEditor::declarations() const
|
QList<Declaration> QmlTextEditor::declarations() const
|
||||||
{ return m_declarations; }
|
{ return m_declarations; }
|
||||||
|
|
||||||
Core::IEditor *ScriptEditorEditable::duplicate(QWidget *parent)
|
Core::IEditor *ScriptEditorEditable::duplicate(QWidget *parent)
|
||||||
{
|
{
|
||||||
ScriptEditor *newEditor = new ScriptEditor(parent);
|
QmlTextEditor *newEditor = new QmlTextEditor(parent);
|
||||||
newEditor->duplicateFrom(editor());
|
newEditor->duplicateFrom(editor());
|
||||||
QmlEditorPlugin::instance()->initializeEditor(newEditor);
|
QmlEditorPlugin::instance()->initializeEditor(newEditor);
|
||||||
return newEditor->editableInterface();
|
return newEditor->editableInterface();
|
||||||
@@ -333,17 +333,17 @@ const char *ScriptEditorEditable::kind() const
|
|||||||
return QmlEditor::Constants::C_QMLEDITOR;
|
return QmlEditor::Constants::C_QMLEDITOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptEditor::Context ScriptEditorEditable::context() const
|
QmlTextEditor::Context ScriptEditorEditable::context() const
|
||||||
{
|
{
|
||||||
return m_context;
|
return m_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::updateDocument()
|
void QmlTextEditor::updateDocument()
|
||||||
{
|
{
|
||||||
m_updateDocumentTimer->start(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
|
m_updateDocumentTimer->start(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::updateDocumentNow()
|
void QmlTextEditor::updateDocumentNow()
|
||||||
{
|
{
|
||||||
// ### move in the parser thread.
|
// ### move in the parser thread.
|
||||||
|
|
||||||
@@ -354,7 +354,7 @@ void ScriptEditor::updateDocumentNow()
|
|||||||
m_modelManager->updateSourceFiles(QStringList() << fileName);
|
m_modelManager->updateSourceFiles(QStringList() << fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::onDocumentUpdated(QmlEditor::QmlDocument::Ptr doc)
|
void QmlTextEditor::onDocumentUpdated(QmlEditor::QmlDocument::Ptr doc)
|
||||||
{
|
{
|
||||||
if (file()->fileName() != doc->fileName())
|
if (file()->fileName() != doc->fileName())
|
||||||
return;
|
return;
|
||||||
@@ -413,7 +413,7 @@ void ScriptEditor::onDocumentUpdated(QmlEditor::QmlDocument::Ptr doc)
|
|||||||
setExtraSelections(CodeWarningsSelection, selections);
|
setExtraSelections(CodeWarningsSelection, selections);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::jumpToMethod(int index)
|
void QmlTextEditor::jumpToMethod(int index)
|
||||||
{
|
{
|
||||||
if (index) {
|
if (index) {
|
||||||
Declaration d = m_declarations.at(index - 1);
|
Declaration d = m_declarations.at(index - 1);
|
||||||
@@ -422,7 +422,7 @@ void ScriptEditor::jumpToMethod(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::updateMethodBoxIndex()
|
void QmlTextEditor::updateMethodBoxIndex()
|
||||||
{
|
{
|
||||||
int line = 0, column = 0;
|
int line = 0, column = 0;
|
||||||
convertPosition(position(), &line, &column);
|
convertPosition(position(), &line, &column);
|
||||||
@@ -457,15 +457,15 @@ void ScriptEditor::updateMethodBoxIndex()
|
|||||||
setExtraSelections(CodeSemanticsSelection, selections);
|
setExtraSelections(CodeSemanticsSelection, selections);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::updateMethodBoxToolTip()
|
void QmlTextEditor::updateMethodBoxToolTip()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::updateFileName()
|
void QmlTextEditor::updateFileName()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::renameIdUnderCursor()
|
void QmlTextEditor::renameIdUnderCursor()
|
||||||
{
|
{
|
||||||
const QString id = wordUnderCursor();
|
const QString id = wordUnderCursor();
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@@ -486,7 +486,7 @@ void ScriptEditor::renameIdUnderCursor()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ScriptEditor::keywords() const
|
QStringList QmlTextEditor::keywords() const
|
||||||
{
|
{
|
||||||
QStringList words;
|
QStringList words;
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ QStringList ScriptEditor::keywords() const
|
|||||||
return words;
|
return words;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::setFontSettings(const TextEditor::FontSettings &fs)
|
void QmlTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
|
||||||
{
|
{
|
||||||
TextEditor::BaseTextEditor::setFontSettings(fs);
|
TextEditor::BaseTextEditor::setFontSettings(fs);
|
||||||
QmlHighlighter *highlighter = qobject_cast<QmlHighlighter*>(baseTextDocument()->syntaxHighlighter());
|
QmlHighlighter *highlighter = qobject_cast<QmlHighlighter*>(baseTextDocument()->syntaxHighlighter());
|
||||||
@@ -519,7 +519,7 @@ void ScriptEditor::setFontSettings(const TextEditor::FontSettings &fs)
|
|||||||
highlighter->rehighlight();
|
highlighter->rehighlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ScriptEditor::wordUnderCursor() const
|
QString QmlTextEditor::wordUnderCursor() const
|
||||||
{
|
{
|
||||||
QTextCursor tc = textCursor();
|
QTextCursor tc = textCursor();
|
||||||
tc.movePosition(QTextCursor::StartOfWord);
|
tc.movePosition(QTextCursor::StartOfWord);
|
||||||
@@ -528,7 +528,7 @@ QString ScriptEditor::wordUnderCursor() const
|
|||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScriptEditor::isElectricCharacter(const QChar &ch) const
|
bool QmlTextEditor::isElectricCharacter(const QChar &ch) const
|
||||||
{
|
{
|
||||||
if (ch == QLatin1Char('}')
|
if (ch == QLatin1Char('}')
|
||||||
|| ch == QLatin1Char(']'))
|
|| ch == QLatin1Char(']'))
|
||||||
@@ -536,7 +536,7 @@ bool ScriptEditor::isElectricCharacter(const QChar &ch) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScriptEditor::isClosingBrace(const QList<QScriptIncrementalScanner::Token> &tokens) const
|
bool QmlTextEditor::isClosingBrace(const QList<QScriptIncrementalScanner::Token> &tokens) const
|
||||||
{
|
{
|
||||||
|
|
||||||
if (tokens.size() == 1) {
|
if (tokens.size() == 1) {
|
||||||
@@ -567,7 +567,7 @@ static int blockStartState(const QTextBlock &block)
|
|||||||
return state & 0xff;
|
return state & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar /*typedChar*/)
|
void QmlTextEditor::indentBlock(QTextDocument *, QTextBlock block, QChar /*typedChar*/)
|
||||||
{
|
{
|
||||||
TextEditor::TabSettings ts = tabSettings();
|
TextEditor::TabSettings ts = tabSettings();
|
||||||
|
|
||||||
@@ -610,14 +610,14 @@ void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar /*typedC
|
|||||||
ts.indentLine(block, indent);
|
ts.indentLine(block, indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor::BaseTextEditorEditable *ScriptEditor::createEditableInterface()
|
TextEditor::BaseTextEditorEditable *QmlTextEditor::createEditableInterface()
|
||||||
{
|
{
|
||||||
ScriptEditorEditable *editable = new ScriptEditorEditable(this);
|
ScriptEditorEditable *editable = new ScriptEditorEditable(this);
|
||||||
createToolBar(editable);
|
createToolBar(editable);
|
||||||
return editable;
|
return editable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::createToolBar(ScriptEditorEditable *editable)
|
void QmlTextEditor::createToolBar(ScriptEditorEditable *editable)
|
||||||
{
|
{
|
||||||
m_methodCombo = new QComboBox;
|
m_methodCombo = new QComboBox;
|
||||||
m_methodCombo->setMinimumContentsLength(22);
|
m_methodCombo->setMinimumContentsLength(22);
|
||||||
@@ -640,7 +640,7 @@ void ScriptEditor::createToolBar(ScriptEditorEditable *editable)
|
|||||||
toolBar->insertWidget(actions.first(), m_methodCombo);
|
toolBar->insertWidget(actions.first(), m_methodCombo);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor::BaseTextEditor::Link ScriptEditor::findLinkAt(const QTextCursor &cursor, bool /*resolveTarget*/)
|
TextEditor::BaseTextEditor::Link QmlTextEditor::findLinkAt(const QTextCursor &cursor, bool /*resolveTarget*/)
|
||||||
{
|
{
|
||||||
Link link;
|
Link link;
|
||||||
|
|
||||||
@@ -691,7 +691,7 @@ TextEditor::BaseTextEditor::Link ScriptEditor::findLinkAt(const QTextCursor &cur
|
|||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::contextMenuEvent(QContextMenuEvent *e)
|
void QmlTextEditor::contextMenuEvent(QContextMenuEvent *e)
|
||||||
{
|
{
|
||||||
QMenu *menu = new QMenu();
|
QMenu *menu = new QMenu();
|
||||||
|
|
||||||
@@ -715,7 +715,7 @@ void ScriptEditor::contextMenuEvent(QContextMenuEvent *e)
|
|||||||
menu->deleteLater();
|
menu->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::unCommentSelection()
|
void QmlTextEditor::unCommentSelection()
|
||||||
{
|
{
|
||||||
Utils::unCommentSelection(this);
|
Utils::unCommentSelection(this);
|
||||||
}
|
}
|
||||||
|
@@ -54,14 +54,14 @@ class QmlModelManagerInterface;
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlHighlighter;
|
class QmlHighlighter;
|
||||||
class ScriptEditor;
|
class QmlTextEditor;
|
||||||
|
|
||||||
class ScriptEditorEditable : public TextEditor::BaseTextEditorEditable
|
class ScriptEditorEditable : public TextEditor::BaseTextEditorEditable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScriptEditorEditable(ScriptEditor *);
|
ScriptEditorEditable(QmlTextEditor *);
|
||||||
QList<int> context() const;
|
QList<int> context() const;
|
||||||
|
|
||||||
bool duplicateSupported() const { return true; }
|
bool duplicateSupported() const { return true; }
|
||||||
@@ -90,15 +90,15 @@ struct Declaration
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScriptEditor : public TextEditor::BaseTextEditor
|
class QmlTextEditor : public TextEditor::BaseTextEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef QList<int> Context;
|
typedef QList<int> Context;
|
||||||
|
|
||||||
ScriptEditor(QWidget *parent = 0);
|
QmlTextEditor(QWidget *parent = 0);
|
||||||
~ScriptEditor();
|
~QmlTextEditor();
|
||||||
|
|
||||||
QList<Declaration> declarations() const;
|
QList<Declaration> declarations() const;
|
||||||
QStringList keywords() const;
|
QStringList keywords() const;
|
||||||
|
@@ -69,7 +69,7 @@ Core::IFile *QmlEditorFactory::open(const QString &fileName)
|
|||||||
|
|
||||||
Core::IEditor *QmlEditorFactory::createEditor(QWidget *parent)
|
Core::IEditor *QmlEditorFactory::createEditor(QWidget *parent)
|
||||||
{
|
{
|
||||||
ScriptEditor *rc = new ScriptEditor(parent);
|
QmlTextEditor *rc = new QmlTextEditor(parent);
|
||||||
QmlEditorPlugin::instance()->initializeEditor(rc);
|
QmlEditorPlugin::instance()->initializeEditor(rc);
|
||||||
return rc->editableInterface();
|
return rc->editableInterface();
|
||||||
}
|
}
|
||||||
|
@@ -166,7 +166,7 @@ void QmlEditorPlugin::extensionsInitialized()
|
|||||||
helpManager->registerDocumentation(QStringList(qmlHelpFile));
|
helpManager->registerDocumentation(QStringList(qmlHelpFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEditorPlugin::initializeEditor(QmlEditor::Internal::ScriptEditor *editor)
|
void QmlEditorPlugin::initializeEditor(QmlEditor::Internal::QmlTextEditor *editor)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_instance, /**/);
|
QTC_ASSERT(m_instance, /**/);
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ namespace Internal {
|
|||||||
|
|
||||||
class QmlEditorFactory;
|
class QmlEditorFactory;
|
||||||
class QmlCodeCompletion;
|
class QmlCodeCompletion;
|
||||||
class ScriptEditor;
|
class QmlTextEditor;
|
||||||
|
|
||||||
class QmlEditorPlugin : public ExtensionSystem::IPlugin
|
class QmlEditorPlugin : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
static QmlEditorPlugin *instance()
|
static QmlEditorPlugin *instance()
|
||||||
{ return m_instance; }
|
{ return m_instance; }
|
||||||
|
|
||||||
void initializeEditor(ScriptEditor *editor);
|
void initializeEditor(QmlTextEditor *editor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QmlEditorPlugin *m_instance;
|
static QmlEditorPlugin *m_instance;
|
||||||
|
@@ -146,7 +146,7 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
|||||||
if (!m_modelManager)
|
if (!m_modelManager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ScriptEditor *scriptEditor = qobject_cast<ScriptEditor *>(editor->widget());
|
QmlTextEditor *scriptEditor = qobject_cast<QmlTextEditor *>(editor->widget());
|
||||||
if (!scriptEditor)
|
if (!scriptEditor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user