Commit 9fcd43ed authored by Eike Ziller's avatar Eike Ziller

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: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent 82401803
......@@ -140,19 +140,17 @@ void QmlJSTextEditorWidget::ctor()
m_updateOutlineIndexTimer->setSingleShot(true);
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
m_modelManager = QmlJS::ModelManagerInterface::instance();
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) {
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged()));
connect(this, SIGNAL(cursorPositionChanged()), m_contextPaneTimer, SLOT(start()));
connect(m_contextPane, SIGNAL(closed()), this, SLOT(showTextMarker()));
}
m_oldCursorPosition = -1;
......@@ -366,7 +364,7 @@ static QList<TextEditor::RefactorMarker> removeMarkersOfType(const QList<TextEdi
return result;
}
void QmlJSTextEditorWidget::updateCursorPositionNow()
void QmlJSTextEditorWidget::updateContextPane()
{
const SemanticInfo info = m_qmlJsEditorDocument->semanticInfo();
if (m_contextPane && document() && info.isValid()
......@@ -410,7 +408,7 @@ void QmlJSTextEditorWidget::updateCursorPositionNow()
void QmlJSTextEditorWidget::showTextMarker()
{
m_oldCursorPosition = -1;
updateCursorPositionNow();
updateContextPane();
}
void QmlJSTextEditorWidget::updateUses()
......@@ -865,7 +863,7 @@ void QmlJSTextEditorWidget::semanticInfoUpdated(const SemanticInfo &semanticInfo
Node *newNode = semanticInfo.declaringMemberNoProperties(position());
if (newNode) {
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();
}
void QmlJSTextEditorWidget::onCursorPositionChanged()
{
m_cursorPositionTimer->start();
}
QModelIndex QmlJSTextEditorWidget::indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex) const
{
QModelIndex lastIndex = rootIndex;
......
......@@ -128,13 +128,12 @@ private slots:
void jumpToOutlineElement(int index);
void updateOutlineNow();
void updateOutlineIndexNow();
void updateCursorPositionNow();
void updateContextPane();
void showTextMarker();
void updateUses();
void semanticInfoUpdated(const QmlJSTools::SemanticInfo &semanticInfo);
void onCursorPositionChanged();
void onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker);
void performQuickFix(int index);
......@@ -169,7 +168,7 @@ private:
QTimer *m_updateUsesTimer; // to wait for multiple text cursor position changes
QTimer *m_updateOutlineTimer;
QTimer *m_updateOutlineIndexTimer;
QTimer *m_cursorPositionTimer;
QTimer *m_contextPaneTimer;
QComboBox *m_outlineCombo;
Internal::QmlOutlineModel *m_outlineModel;
QModelIndex m_outlineModelIndex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment