CVS commit by amantia: Delayed update of structure and attribute tree. Update only if the user hasn't pressed any key for xxx ms. M +6 -6 quanta.kdevelop 1.66 M +15 -6 quanta/quanta.cpp 1.325 [POSSIBLY UNSAFE: printf] M +5 -0 quanta/quanta.h 1.153 M +2 -0 quanta/quanta_init.cpp 1.321 --- quanta/quanta.kdevelop #1.65:1.66 @@ -33,5 +33,5 @@ true - 4 + 30 false @@ -137,5 +137,5 @@ false - + true @@ -200,11 +200,11 @@ -f - + -dP - + -f -u3 -p - - + + -C -d -P --- quanta/quanta/quanta.cpp #1.324:1.325 @@ -1204,4 +1204,15 @@ void QuantaApp::slotNewLineColumn() oldCursorCol = cursorCol; m_view->write()->viewCursorIf->cursorPositionReal(&cursorLine, &cursorCol); + idleTimer->start(250, true); + linenumber.sprintf(i18n("Line: %d Col: %d"),cursorLine+1,cursorCol+1); + + statusBar()->changeItem(linenumber, IDS_STATUS_CLM); +} + +void QuantaApp::slotIdleTimerExpired() +{ + if (m_view->writeExists()) + { + m_view->write()->viewCursorIf->cursorPositionReal(&cursorLine, &cursorCol); Node *node = parser->nodeAt(cursorLine, cursorCol); if (node) @@ -1210,7 +1221,5 @@ void QuantaApp::slotNewLineColumn() } aTab->setCurrentNode(node); - linenumber.sprintf(i18n("Line: %d Col: %d"),cursorLine+1,cursorCol+1); - - statusBar()->changeItem(linenumber, IDS_STATUS_CLM); + } } --- quanta/quanta/quanta.h #1.152:1.153 @@ -342,4 +342,6 @@ protected slots: void slotUploadFile(); void slotUploadOpenedFiles(); + /** Called after there was no user activity - cursor movement - for xx ms*/ + void slotIdleTimerExpired(); protected: @@ -486,4 +488,7 @@ protected: // Protected attributes /** Timer to refresh the structure tree. */ QTimer *refreshTimer; + /** Timer to detect idle periods. Every time the cursor moves the timer is + restarted.*/ + QTimer *idleTimer; QString scriptBeginRxStr; QString scriptEndRxStr; --- quanta/quanta/quanta_init.cpp #1.320:1.321 @@ -122,4 +122,6 @@ QuantaApp::QuantaApp() : KDockMainWindow qConfig.spellConfig = new KSpellConfig(); m_spellChecker = new SpellChecker(); + idleTimer = new QTimer(this); + connect(idleTimer, SIGNAL(timeout()), SLOT(slotIdleTimerExpired())); }