aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmljseditor
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2014-01-30 15:48:24 +0100
committerEike Ziller <eike.ziller@digia.com>2014-02-10 12:42:54 +0100
commit9fcd43ed050aa0c8b1c7b4b21f7f4ce8050860f0 (patch)
tree98f9dda72fae5a8395d06d962395b5d6e14fd23a /src/plugins/qmljseditor
parent82401803b389237433d6d54acb18c6febc628280 (diff)
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>
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp23
-rw-r--r--src/plugins/qmljseditor/qmljseditor.h5
2 files changed, 10 insertions, 18 deletions
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index 2b7814d08a7..c7f66c758b9 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -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;
diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h
index 5b6c6c69776..e31d9084589 100644
--- a/src/plugins/qmljseditor/qmljseditor.h
+++ b/src/plugins/qmljseditor/qmljseditor.h
@@ -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;