[Kst] Proper way of providing progress feedback from datasources to the status bar
nicolas.brisset at free.fr
Sun Nov 3 21:34:37 UTC 2013
It seems my last commit broke compilation (in fact the final linking stage of the ASCII data source) under Windows...
And the way the feedback mechanism is implemented is quite a hack and I don't feel confortable leaving it like this.
I'd like to trigger the discussion on how we could do it properly.
My - maybe naive - approach would be to add signals to the datasource class to provide the GUI with status messages and progress feedback during init and possibly vector loading. It's already derived from QObject, so it should support it without the need for major breakage.
I think the connect() call in Qt is robust to non-existing signals and slots, so we shouldn't have too much trouble even if not all datasources implement them, or by adding an empty virtual implementation in the datasource class. And if a datasource is used in GUI-less code later, it would emit signals nobody is connected to, I don't think it is an issue either.
We would then need to identify the right places in the GUI code to hook those signals to the status bar widget slots (status message and progress bar), and in the datasource we could simply implement signal emission, pretty much like it's done right now in ASCII, without caring for the rest. I even believe signals and slots are possible across threads since Qt4. So unless I've missed something, it would allow keeping the nice separation between GUI and datasource modules.
More information about the Kst