[Kst] Progress indication when loading from file...

Peter Kümmel syntheticpp at gmx.net
Mon Mar 3 19:49:54 UTC 2014


On 01.03.2014 19:00, Nicolas Brisset wrote:
> Hi,
>
> I've been looking at this issue that there was no longer any progress feedback when loading a .kst file.
> As already discussed here, I am not sure what we should do with this progress status. What I had first implemented was simple:
> - progress bar from 0 to 100 % while parsing lines (slow)
> - status message for each variable being read (fairly fast for each variable)
> I found it sufficient and it had the benefit that it didn't require too many API changes.
>
> Now Peter went one step further and extended the datasource vector API with a prepareRead(int) method informing the datasource how many vectors will be read, and the first 50 % of the progress bar correspond to the line parsing step, the rest being vector loading. The issue I have with that is that it works well only when using the datawizard, not the other dialogs used to create a datasource (loading from file, change data file, create vector).
> In the past I had got it to work for all by connecting the progress signal to the status bar from the datasourcepluginfactory. I got it to work again by adding a dummy call to prepareRead() as follows. The issue is that at this stage the code does not have any idea how many vectors will be read.
>
> diff --git a/src/libkstapp/datasourcepluginfactory.cpp b/src/libkstapp/datasourcepluginfactory.cpp
> index 63f641e..a476213 100644
> --- a/src/libkstapp/datasourcepluginfactory.cpp
> +++ b/src/libkstapp/datasourcepluginfactory.cpp
> @@ -80,6 +80,7 @@ DataSourcePtr DataSourcePluginFactory::generateDataSource(ObjectStore *store, QX
>       dataSource = DataSourcePluginManager::loadSource(store, fileName, fileType);
>       if (dataSource) {
>         QObject::connect(dataSource, SIGNAL(progress(int,QString)), kstApp->mainWindow(), SLOT(updateProgress(int,QString)));
> +      dataSource->vector().prepareRead(0);
>         dataSource->parseProperties(propertyAttributes);
>         if (fileName != alternate_filename) {
>           dataSource->setAlternateFilename(alternate_filename);
>
> So now my question: what should we do?
> 1) Add the above call, where 50% does not really mean 50%
> 2) Put the call elsewhere to cover all cases where a datasource is created
> 3) Modify the code so that prepareRead(-1) means "I don't know how many vectors will be read" and then we scale the progress differently
> 4) Revert to the previous "naive" approach of indicating line parsing progress with the bar and the vector reading with only a status message
>
> Thoughts?

Facts! ;)
see last commit:
after the 50% reached the progress bar only indicates busy (the bar scrolls from left to right and back),
similar to your point 3).

Hope we could release 2.0.8 now.

>
> Nicolas
>
> P.S.: I'm getting worried about the complexity of the ASCII source... We have to be careful to keep it maintainable!

The multi-thread box is now open, so it's no surprise to be more complicated.

> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
>



More information about the Kst mailing list