Bug 85676 - Wish for 0.99/1.0: allow datasources to have configuration dialog/settings
Summary: Wish for 0.99/1.0: allow datasources to have configuration dialog/settings
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Solaris
: HI wishlist
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-22 09:19 UTC by Nicolas Brisset
Modified: 2004-11-01 16:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Brisset 2004-07-22 09:19:44 UTC
Version:           0.99 (using KDE KDE 3.2.2)
Installed from:    Compiled From Sources
Compiler:          gcc 3 
OS:                Solaris

It would be most useful to allow datasources to query options from the user by means of keys in a configuration file (kstrc ?) probably associated with a nice dialog :-)
The first obvious use of this is for ASCII files, which are often made up of:
1) a given number of header lines that should be skipped when looking for the real data
2) a line containing variable names with a common separator (one or more spaces, a tab, a semicolon, a comma) that could be parsed to offer the user of nicer choice from the wizard than plain numbers !
3) units in the same format as variables in another line, or possibly associated with the variable names (in which case they do not need to be handled specifically)

I suppose it is also quite common to have fixed-width columns, which could be another option that the user can activate (a boolean saying the data is fixed-width + a spinbox to select the width) as I suppose it would make parsing the file much faster.
Comment 1 George Staikos 2004-10-19 08:07:56 UTC
Already started, almost there.  I just need to sort out a layouting issue.
Comment 2 George Staikos 2004-10-19 22:50:39 UTC
I think there is another issue to deal with.

The most useful config widget here would be per-source-instance, not per-source, right?  That means the config would apply to kstdatasource_ascii(/home/gyrodata.dat), not kstdatasource_ascii(*).  In this case, we need to provide config before we load the source, but we don't load the source until after the location in the UI where the config goes.  This leads me to believe that the widget it returns will have to have a way to attach the data after it dies, meaning it has to be stored by the caller (Vector dialog, or data wizard presently).  This tells me it needs to have a base class.  Sound reasonable?  I will proceed down this road now, but please respond so I know if it's correct.
Comment 3 Nicolas Brisset 2004-10-20 11:23:06 UTC
Yes, each instance needs to have its own options stored in private variables as I may e.g. want to work with 2 ASCII files with different formats simultaneously.
It sounds like there are 2 ways to achieve the user interface to pass options to the datasource instance:
1) provide options through a widget from which you have to get the data (does it necessarily have to die before the source is loaded, can't it just be hidden and destroyed later when the data has been read ?)
2) provide options by means of keys in the config file and a separate/stand-alone config dialog to set them

2 things make me think we should favor 2):
- we have to store options anyway so that the user does not need to change them as long as he does not use files requiring a same type of datasource with different options (I suppose 99% of the time, a given user will use a same file format)
- it would probably make it easier to code as the datasource will know where to look for options and the caller only needs to know how to bring up the options dialog upon user request. How this option dialog is coded (other class needed ?) is another issue taht I leave to you to decide :-)

As far as the UI is concerned, we could add a "[Name of datasource] options..." button in the first page of the datawizard that is activated once the file has been selected by the user and the right type of datasource has been found (in other words, the same conditions as for activation of the "Next" button, plus the config widget is not null). We'd probably also have to find a way to add the same kind of button in the vector dialog, though I am not sure it is OK to change options once the vector exists ?
Doing it this way means that in the general case the user will proceed through the wizard as he currently does because options are the same as the previous time so he doesn't need to set them. But if he has to load data from a file with special options, he can set them "just in time" before the file is processed (and choose whether to use the new values as new default).
Sounds good to me !

 
Comment 4 George Staikos 2004-10-20 18:55:41 UTC
On Wednesday 20 October 2004 05:23, Nicolas Brisset wrote:
> 11:23 ------- Yes, each instance needs to have its own options stored in
> private variables as I may e.g. want to work with 2 ASCII files with
> different formats simultaneously. It sounds like there are 2 ways to
> achieve the user interface to pass options to the datasource instance: 1)
> provide options through a widget from which you have to get the data (does
> it necessarily have to die before the source is loaded, can't it just be
> hidden and destroyed later when the data has been read ?) 2) provide
> options by means of keys in the config file and a separate/stand-alone
> config dialog to set them
>
> 2 things make me think we should favor 2):
> - we have to store options anyway so that the user does not need to change
> them as long as he does not use files requiring a same type of datasource
> with different options (I suppose 99% of the time, a given user will use a
> same file format) - it would probably make it easier to code as the
> datasource will know where to look for options and the caller only needs to
> know how to bring up the options dialog upon user request. How this option
> dialog is coded (other class needed ?) is another issue taht I leave to you
> to decide :-)

  Ok let's do it like this then.  Dialog is launched and passed a KConfig* to 
configure itself with, along with the *URL* of the filename it is working on.  
It will have to use KIO if it isn't a local file, but at this point we don't 
support that anyway.  Later on, the datasource is instantiated and it gets 
the KConfig* again, which it reads the settings from.  This gets us 
persistence, KIO support, a config dialog, and no messy data passing.  Sound 
like a plan?


Comment 5 Nicolas Brisset 2004-10-20 19:02:53 UTC
As far as I understand Chinese (or C++ese for that matter), this sounds good :-)
The only thing that's not very clear to me is that your proposal sounds like there's always going to be a config dialog, while I thought it'd be shown only optionally if the user clicks the (new) "Configure [datasource]" button on the first page of the wizard. But maybe that's what you're also saying...
Comment 6 George Staikos 2004-11-01 16:22:58 UTC
Fixed in CVS.  One more integration of this is pending.