Re: Re: [cvsgui] WinCvs storage of configuration data?

Jens Miltner <[email protected]> Mon, 7 Feb 2005 10:10:04 +0100
Newsgroups gmane.comp.version-control.cvs.gui.devel
Message-ID <[email protected]>

Am 06.02.2005 um 00:05 schrieb Oliver Giesen:

>
> Bo Berglund wrote:
>> Jerzy,
>
> FYI: He told me he'll be away for the next two or three weeks.
>
>
>> I am trying to implement the log message template function I asked
>> about before. To do so I need to read the location of the template
>> file from the registry, but being a C++ novice I am on thin ice so I
>> thought that I would look at how WinCvs reads/writes the config data
>> to the registry and copy some good code from that.
>> Problem is I can't find wher it is done...
>> Can you just tell me the file (and possibly function) that reads back
>> the config data?
>
> A more appropriate place for all this would have been the cvsgui-dev
> list I think. CC set.
>
> Anyway, look for references to CvsPrefs or gCvsPrefs (from
> common/CvsPrefs.h/cpp). I guess the recommended way to implement a new
> setting like the one you propose would be to add appropriate members to
> this class and then use those to set and get it. Right,
> Jerzy/Kalle/Richard/Jens?

The way preferences are implemented in cvsgui is via subclasses of 
CPersistent. There are a couple of subclasses for various data types 
(integer values, boolean values, string values, string lists, etc.). 
Usually, one can just use one of the existing subclasses and 
instantiate a static/global variable, which will do all the magic for 
you, e.g.:

static CPersistentInt gKserverPort("P_KserverPort", -1, kAddSettings);

or

static CPersistentBool gQuietOption("P_QuietOption", false);


You can use the persitent value objects just like their underlying data 
type (since they provide conversion operators), e.g.

if ( gQuietOption ) {
	// do something quiet
}

common/CvsPrefs.cpp instantiates the globally known preferences, but 
you can just put the persistent objects as static instances in any 
place you want.
If you specify the 'kAddSettings' parameter, the prefs are per-sandbox, 
otherwise, they're app-global.

HTH,
</jum>



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/cvsgui-dev/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/