[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    quanta [POSSIBLY UNSAFE]
From:       Andras Mantia <amantia () freemail ! hu>
Date:       2003-08-27 10:12:43
[Download RAW message or body]

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 @@
     <make>
       <abortonerror>true</abortonerror>
-      <numberofjobs>4</numberofjobs>
+      <numberofjobs>30</numberofjobs>
       <dontact>false</dontact>
       <makebin></makebin>
@@ -137,5 +137,5 @@
     <tree>
       <hidenonprojectfiles>false</hidenonprojectfiles>
-      <hidepatterns></hidepatterns>
+      <hidepatterns/>
       <showvcsfields>true</showvcsfields>
     </tree>
@@ -200,11 +200,11 @@
   <kdevcvs>
     <cvsoptions>-f</cvsoptions>
-    <commitoptions></commitoptions>
+    <commitoptions/>
     <updateoptions>-dP</updateoptions>
-    <addoptions></addoptions>
+    <addoptions/>
     <removeoptions>-f</removeoptions>
     <diffoptions>-u3 -p</diffoptions>
-    <logoptions></logoptions>
-    <rshoptions></rshoptions>
+    <logoptions/>
+    <rshoptions/>
     <revertoptions>-C -d -P</revertoptions>
   </kdevcvs>

--- 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()));
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic