[Kst] kst_hfi_calib_branch: kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Fri Nov 12 15:21:46 CET 2004


CVS commit by staikos: 

delay document loading until after the UI is constructed to make it more clear
what is happening on startup


  M +26 -1     kst.cpp   1.256.2.1
  M +10 -1     kst.h   1.113.2.1
  M +2 -1      main.cpp   1.90.2.2


--- kdeextragear-2/kst/kst/kst.cpp  #1.256:1.256.2.1
@@ -19,4 +19,5 @@
 
 // include files for Qt
+#include <qdeepcopy.h>
 #include <qeventloop.h>
 #include <qpaintdevicemetrics.h>
@@ -772,6 +773,30 @@ void KstApp::addRecentFile(const KURL& u
 }
 
+
+void KstApp::doDelayedOpens() {
+  QValueList<KstOpen> queueCopy = QDeepCopy<QValueList<KstOpen> >(_openQueue);
+  _openQueue.clear();
+
+  for (QValueList<KstOpen>::ConstIterator i = queueCopy.begin(); i != queueCopy.end(); ++i) {
+    openDocumentFile((*i).filename, (*i).file, (*i).n, (*i).f, (*i).s, (*i).ave);
+  }
+}
+
+
 bool KstApp::openDocumentFile(const QString& in_filename,
-                              const QString& o_file, int o_n, int o_f, int o_s, bool o_ave) {
+    const QString& o_file, int o_n, int o_f, int o_s, bool o_ave, bool delayed) {
+  if (delayed) {
+    KstOpen job;
+    job.filename = in_filename;
+    job.file = o_file;
+    job.n = o_n;
+    job.f = o_f;
+    job.s = o_s;
+    job.ave = o_ave;
+    _openQueue.append(job);
+    QTimer::singleShot(0, this, SLOT(doDelayedOpens()));
+    return true;
+  }
+
   KURL url;
   QFileInfo finfo(in_filename);

--- kdeextragear-2/kst/kst/kst.h  #1.113:1.113.2.1
@@ -60,4 +60,11 @@ class QLabel;
 class QProgressBar;
 
+class KstOpen {
+  public:
+    QString filename, file;
+    int n, f, s;
+    bool ave;
+};
+
 /** The base class for Kst application windows. It sets up the main
   * window frame, reads the config file.
@@ -88,5 +95,5 @@ class KstApp : public KMdiMainFrm {
     bool openDocumentFile(const QString& _cmdl = QString::null,
         const QString& o_file = "|", int o_n = -2, int o_f = -2,
-        int o_s = -1, bool o_ave = false);
+        int o_s = -1, bool o_ave = false, bool delayed = false);
 
     /** returns a pointer to the current document connected to the
@@ -323,4 +330,5 @@ class KstApp : public KMdiMainFrm {
   private slots:
     void updateMemoryStatus();
+    void doDelayedOpens();
 
   private:
@@ -471,4 +479,5 @@ class KstApp : public KMdiMainFrm {
     QString _defaultFont;
     KConfig *_dataSourceConfig;
+    QValueList<KstOpen> _openQueue;
 };
 

--- kdeextragear-2/kst/kst/main.cpp  #1.90.2.1:1.90.2.2
@@ -682,5 +682,6 @@ int main(int argc, char *argv[]) {
           args->getOption("f").toInt(&nOK), // override starting frame
           args->getOption("s").toInt(&nOK), // override skip
-          args->isSet("a"));                // add averaging
+          args->isSet("a"),                 // add averaging
+          !print_and_exit);                 // delayed
     } else {
       //kst->openDocumentFile();





More information about the Kst mailing list