[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Mon Dec 13 03:44:17 CET 2004


CVS commit by staikos: 

call update on menu events again.  this keeps dialogs in sync, but is much
more efficient:

kst: Dialogs updated in 442ms
kst: Dialogs updated in 25ms
kst: Dialogs updated in 321ms
kst: Dialogs updated in 0ms


  M +57 -18    kst.cpp   1.267
  M +2 -1      kst.h   1.116
  M +2 -4      kstviewwidget.cpp   1.58


--- kdeextragear-2/kst/kst/kst.cpp  #1.266:1.267
@@ -1431,25 +1431,64 @@ void KstApp::updateDataDialogs(bool dm) 
 
 
-void KstApp::updateDialogs() {
+void KstApp::updateVisibleDialogs() {
+  updateDialogs(true);
+}
+
+
+void KstApp::updateDialogs(bool onlyVisible) {
   if (!_stopping) {
     QTime t;
     t.start();
+    if (!onlyVisible || KstVectorDialogI::globalInstance()->isShown()) {
     KstVectorDialogI::globalInstance()->update();
+    }
+    if (!onlyVisible || KstPluginDialogI::globalInstance()->isShown()) {
     KstPluginDialogI::globalInstance()->updateForm();
+    }
+    if (!onlyVisible || KstFitDialogI::globalInstance()->isShown()) {
     KstFitDialogI::globalInstance()->update();
+    }
+    if (!onlyVisible || KstFilterDialogI::globalInstance()->isShown()) {
     KstFilterDialogI::globalInstance()->update();
+    }
+    if (!onlyVisible || KstEqDialogI::globalInstance()->isShown()) {
     KstEqDialogI::globalInstance()->update();
+    }
+    if (!onlyVisible || KstHsDialogI::globalInstance()->isShown()) {
     KstHsDialogI::globalInstance()->update();
+    }
+    if (!onlyVisible || KstPsdDialogI::globalInstance()->isShown()) {
     KstPsdDialogI::globalInstance()->update();
+    }
+    if (!onlyVisible || KstCurveDialogI::globalInstance()->isShown()) {
     KstCurveDialogI::globalInstance()->update();
+    }
+    if (!onlyVisible || KstEventMonitorI::globalInstance()->isShown()) {
     KstEventMonitorI::globalInstance()->update();
+    }
+    if (!onlyVisible || KstImageDialogI::globalInstance()->isShown()) {
     KstImageDialogI::globalInstance()->update();
+    }
+    if (!onlyVisible || KstMatrixDialogI::globalInstance()->isShown()) {
     KstMatrixDialogI::globalInstance()->update();
+    }
+    if (!onlyVisible || _plotDialog->isShown()) {
     _plotDialog->update();
+    }
+    if (!onlyVisible || changeFileDialog->isShown()) {
     changeFileDialog->updateChangeFileDialog();
+    }
+    if (!onlyVisible || changeNptsDialog->isShown()) {
     changeNptsDialog->updateChangeNptsDialog();
+    }
+    if (!onlyVisible) { // FIXME: might want to make this sensible one day
     updateDataDialogs(false);
+    }
+    if (!onlyVisible || vectorSaveDialog->isShown()) {
     vectorSaveDialog->init();
+    }
+    if (!onlyVisible || dataManager->isShown()) {
     dataManager->update();
+    }
     kdDebug() << "Dialogs updated in " << t.elapsed() << "ms" << endl;
   }

--- kdeextragear-2/kst/kst/kst.h  #1.115:1.116
@@ -308,5 +308,6 @@ class KstApp : public KMdiMainFrm {
 
     /** calls update on all the dialogs */
-    void updateDialogs();
+    void updateVisibleDialogs();
+    void updateDialogs(bool onlyVisible = false);
     void updateDataDialogs(bool dataManager = true);
     void updateDialogsForWindow();

--- kdeextragear-2/kst/kst/kstviewwidget.cpp  #1.57:1.58
@@ -256,8 +256,5 @@ void KstViewWidget::contextMenuEvent(QCo
     }
     // for convenience, let's update the dialogs
-    // NO: updateDialogs takes ~250ms... and I don't think we need it here...
-    // but this means that if any of the events need an update, they
-    // will have to generate it themselves...
-    //QTimer::singleShot(0, KstApp::inst(), SLOT(updateDialogs()));
+    QTimer::singleShot(0, KstApp::inst(), SLOT(updateVisibleDialogs()));
   } else {
     delete _menu;





More information about the Kst mailing list