forked from qt-creator/qt-creator
QmlJSEditor: Some renaming
Call the timer and its slot for what they do, not how they are triggered. Remove unneeded function/slot. Change-Id: I6060f0b59149eb7e5cfdf1d7ea0a993a2104f012 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -140,19 +140,17 @@ void QmlJSTextEditorWidget::ctor()
|
|||||||
m_updateOutlineIndexTimer->setSingleShot(true);
|
m_updateOutlineIndexTimer->setSingleShot(true);
|
||||||
connect(m_updateOutlineIndexTimer, SIGNAL(timeout()), this, SLOT(updateOutlineIndexNow()));
|
connect(m_updateOutlineIndexTimer, SIGNAL(timeout()), this, SLOT(updateOutlineIndexNow()));
|
||||||
|
|
||||||
m_cursorPositionTimer = new QTimer(this);
|
|
||||||
m_cursorPositionTimer->setInterval(UPDATE_OUTLINE_INTERVAL);
|
|
||||||
m_cursorPositionTimer->setSingleShot(true);
|
|
||||||
connect(m_cursorPositionTimer, SIGNAL(timeout()), this, SLOT(updateCursorPositionNow()));
|
|
||||||
|
|
||||||
baseTextDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
baseTextDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
||||||
|
|
||||||
m_modelManager = QmlJS::ModelManagerInterface::instance();
|
m_modelManager = QmlJS::ModelManagerInterface::instance();
|
||||||
m_contextPane = ExtensionSystem::PluginManager::getObject<QmlJS::IContextPane>();
|
m_contextPane = ExtensionSystem::PluginManager::getObject<QmlJS::IContextPane>();
|
||||||
|
|
||||||
|
m_contextPaneTimer = new QTimer(this);
|
||||||
|
m_contextPaneTimer->setInterval(UPDATE_OUTLINE_INTERVAL);
|
||||||
|
m_contextPaneTimer->setSingleShot(true);
|
||||||
|
connect(m_contextPaneTimer, SIGNAL(timeout()), this, SLOT(updateContextPane()));
|
||||||
if (m_contextPane) {
|
if (m_contextPane) {
|
||||||
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged()));
|
connect(this, SIGNAL(cursorPositionChanged()), m_contextPaneTimer, SLOT(start()));
|
||||||
connect(m_contextPane, SIGNAL(closed()), this, SLOT(showTextMarker()));
|
connect(m_contextPane, SIGNAL(closed()), this, SLOT(showTextMarker()));
|
||||||
}
|
}
|
||||||
m_oldCursorPosition = -1;
|
m_oldCursorPosition = -1;
|
||||||
@@ -366,7 +364,7 @@ static QList<TextEditor::RefactorMarker> removeMarkersOfType(const QList<TextEdi
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSTextEditorWidget::updateCursorPositionNow()
|
void QmlJSTextEditorWidget::updateContextPane()
|
||||||
{
|
{
|
||||||
const SemanticInfo info = m_qmlJsEditorDocument->semanticInfo();
|
const SemanticInfo info = m_qmlJsEditorDocument->semanticInfo();
|
||||||
if (m_contextPane && document() && info.isValid()
|
if (m_contextPane && document() && info.isValid()
|
||||||
@@ -410,7 +408,7 @@ void QmlJSTextEditorWidget::updateCursorPositionNow()
|
|||||||
void QmlJSTextEditorWidget::showTextMarker()
|
void QmlJSTextEditorWidget::showTextMarker()
|
||||||
{
|
{
|
||||||
m_oldCursorPosition = -1;
|
m_oldCursorPosition = -1;
|
||||||
updateCursorPositionNow();
|
updateContextPane();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSTextEditorWidget::updateUses()
|
void QmlJSTextEditorWidget::updateUses()
|
||||||
@@ -865,7 +863,7 @@ void QmlJSTextEditorWidget::semanticInfoUpdated(const SemanticInfo &semanticInfo
|
|||||||
Node *newNode = semanticInfo.declaringMemberNoProperties(position());
|
Node *newNode = semanticInfo.declaringMemberNoProperties(position());
|
||||||
if (newNode) {
|
if (newNode) {
|
||||||
m_contextPane->apply(editor(), semanticInfo.document, 0, newNode, true);
|
m_contextPane->apply(editor(), semanticInfo.document, 0, newNode, true);
|
||||||
m_cursorPositionTimer->start(); //update text marker
|
m_contextPaneTimer->start(); //update text marker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -881,11 +879,6 @@ void QmlJSTextEditorWidget::onRefactorMarkerClicked(const TextEditor::RefactorMa
|
|||||||
showContextPane();
|
showContextPane();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSTextEditorWidget::onCursorPositionChanged()
|
|
||||||
{
|
|
||||||
m_cursorPositionTimer->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
QModelIndex QmlJSTextEditorWidget::indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex) const
|
QModelIndex QmlJSTextEditorWidget::indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex) const
|
||||||
{
|
{
|
||||||
QModelIndex lastIndex = rootIndex;
|
QModelIndex lastIndex = rootIndex;
|
||||||
|
|||||||
@@ -128,13 +128,12 @@ private slots:
|
|||||||
void jumpToOutlineElement(int index);
|
void jumpToOutlineElement(int index);
|
||||||
void updateOutlineNow();
|
void updateOutlineNow();
|
||||||
void updateOutlineIndexNow();
|
void updateOutlineIndexNow();
|
||||||
void updateCursorPositionNow();
|
void updateContextPane();
|
||||||
void showTextMarker();
|
void showTextMarker();
|
||||||
|
|
||||||
void updateUses();
|
void updateUses();
|
||||||
|
|
||||||
void semanticInfoUpdated(const QmlJSTools::SemanticInfo &semanticInfo);
|
void semanticInfoUpdated(const QmlJSTools::SemanticInfo &semanticInfo);
|
||||||
void onCursorPositionChanged();
|
|
||||||
void onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker);
|
void onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker);
|
||||||
|
|
||||||
void performQuickFix(int index);
|
void performQuickFix(int index);
|
||||||
@@ -169,7 +168,7 @@ private:
|
|||||||
QTimer *m_updateUsesTimer; // to wait for multiple text cursor position changes
|
QTimer *m_updateUsesTimer; // to wait for multiple text cursor position changes
|
||||||
QTimer *m_updateOutlineTimer;
|
QTimer *m_updateOutlineTimer;
|
||||||
QTimer *m_updateOutlineIndexTimer;
|
QTimer *m_updateOutlineIndexTimer;
|
||||||
QTimer *m_cursorPositionTimer;
|
QTimer *m_contextPaneTimer;
|
||||||
QComboBox *m_outlineCombo;
|
QComboBox *m_outlineCombo;
|
||||||
Internal::QmlOutlineModel *m_outlineModel;
|
Internal::QmlOutlineModel *m_outlineModel;
|
||||||
QModelIndex m_outlineModelIndex;
|
QModelIndex m_outlineModelIndex;
|
||||||
|
|||||||
Reference in New Issue
Block a user