[Kst] kst_hfi_calib_branch: kdeextragear-2/kst/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Fri Nov 12 21:12:59 CET 2004
How about an informative pop-up which just tells us what it is doing (loading
vector INDEX, etc) rather than the whole interface...
On November 12, 2004 11:17 am, George Staikos wrote:
> CVS commit by staikos:
>
> Make document loading appear to be completely asynchronous. I don't feel
> entirely comfortable with this patch yet, but it seems to work well enough
> to use here, and the long delay on loading is a major issue. Here's how it
> works:
>
> 1) openDocument() is guarded against reentrancy. It just fails in KstDoc
> if you call it while it's running already. (maybe silently)
> 2) DCOP is disabled while opening a document to avoid reentrancy and races.
> 3) events up to 10ms are processed in the loading loop
> 4) the document does at sometimes exist in an invalid state
> 5) the user can shoot his own foot by deleting objects while the document
> is loading. Too bad. (A solution is to add a read-only lock during loading
> but this is very messy I think.)
> 6) We hope that I haven't missed any possible events that can cause a
> reentrance somehow
> 7) We slowly offload more of this updating onto the update thread from
> KstDoc in the future.
>
>
> M +5 -1 kst.cpp 1.256.2.3
> M +23 -4 kstdoc.cpp 1.135.2.2
>
>
> --- kdeextragear-2/kst/kst/kst.cpp #1.256.2.2:1.256.2.3
> @@ -786,5 +786,7 @@ void KstApp::doDelayedOpens() {
> bool KstApp::openDocumentFile(const QString& in_filename,
> const QString& o_file, int o_n, int o_f, int o_s, bool o_ave, bool
> delayed) { - if (delayed) {
> + static bool opening = false;
> +
> + if (delayed || opening) {
> KstOpen job;
> job.filename = in_filename;
> @@ -799,4 +801,5 @@ bool KstApp::openDocumentFile(const QStr
> }
>
> + opening = true;
> KURL url;
> QFileInfo finfo(in_filename);
> @@ -816,4 +819,5 @@ bool KstApp::openDocumentFile(const QStr
> }
> slotUpdateStatusMsg(i18n("Ready"));
> + opening = false;
> return rc;
> }
>
> --- kdeextragear-2/kst/kst/kstdoc.cpp #1.135.2.1:1.135.2.2
> @@ -28,7 +28,9 @@
> // include files for Qt
> #include <qdeepcopy.h>
> +#include <qeventloop.h>
> #include <qstylesheet.h>
>
> // include files for KDE
> +#include <dcopclient.h>
> #include <kdebug.h>
> #include <kfiledialog.h>
> @@ -147,8 +149,11 @@ bool KstDoc::newDocument() {
> bool KstDoc::openDocument(const KURL& url, const QString& o_file,
> int o_n, int o_f, int o_s, bool o_ave) {
> - KstRVectorPtr vector;
> - KstApp *app = KstApp::inst();
> - QString readingDocument = i18n("Reading document");
> - QString openingDocument = i18n("Opening document");
> + static bool opening = false;
> +
> + if (opening) {
> + return false;
> + }
> +
> + opening = true;
>
> deleteContents();
> @@ -156,4 +161,5 @@ bool KstDoc::openDocument(const KURL& ur
> if (!f.exists()) {
> KMessageBox::sorry(0L, i18n("%1: There is no file with that name to
> open.").arg(url.path())); + opening = false;
> return false;
> }
> @@ -168,4 +174,5 @@ bool KstDoc::openDocument(const KURL& ur
> if (!f.open(IO_ReadOnly)) {
> KMessageBox::sorry(0L, i18n("%1: File exists, but kst could not open
> it.").arg(url.path())); + opening = false;
> return false;
> }
> @@ -174,4 +181,5 @@ bool KstDoc::openDocument(const KURL& ur
> KMessageBox::sorry(0L, i18n("%1: Not a valid kst plot specification
> file.").arg(url.path())); f.close();
> + opening = false;
> return false;
> }
> @@ -184,4 +192,9 @@ bool KstDoc::openDocument(const KURL& ur
> int handled = 0;
> bool warnOldKstFile = false;
> + KstRVectorPtr vector;
> + KstApp *app = KstApp::inst();
> + QString readingDocument = i18n("Reading document");
> + QString openingDocument = i18n("Opening document");
> +
>
> QDomNode n = docElem.firstChild();
> @@ -189,4 +202,5 @@ bool KstDoc::openDocument(const KURL& ur
> app->slotUpdateProgress(count, handled, readingDocument);
>
> + kapp->dcopClient()->setAcceptCalls(false);
> while (!n.isNull()) {
> QDomElement e = n.toElement(); // try to convert the node to an
> element. @@ -329,4 +343,5 @@ bool KstDoc::openDocument(const KURL& ur
> app->slotUpdateProgress(count, handled, readingDocument);
> n = n.nextSibling();
> + kapp->eventLoop()->processEvents(QEventLoop::ExcludeSocketNotifiers,
> 10); }
> app->slotUpdateProgress(0, 0, openingDocument);
> @@ -394,4 +409,5 @@ bool KstDoc::openDocument(const KURL& ur
> bitBucket.append(*i);
> }
> + kapp->eventLoop()->processEvents(QEventLoop::ExcludeSocketNotifiers,
> 10); }
> }
> @@ -419,4 +435,5 @@ bool KstDoc::openDocument(const KURL& ur
> for (Kst2DPlotList::Iterator i = allplots.begin(); i !=
> allplots.end(); ++i) { (*i)->draw();
> +
> kapp->eventLoop()->processEvents(QEventLoop::ExcludeSocketNotifiers, 10); }
> }
> @@ -424,4 +441,5 @@ bool KstDoc::openDocument(const KURL& ur
> }
> KstApp::inst()->deleteIterator(it);
> + kapp->dcopClient()->setAcceptCalls(true);
>
> emit updateDialogs();
> @@ -431,4 +449,5 @@ bool KstDoc::openDocument(const KURL& ur
> _modified = false;
>
> + opening = false;
> return true;
> }
>
>
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
More information about the Kst
mailing list