Extending IToolViewFactory to be able to save state information
apaku at gmx.de
Sat Jun 28 10:19:52 UTC 2008
On 28.06.08 12:59:59, Vladimir Prus wrote:
> On Friday 27 June 2008 01:10:51 Andreas Pakulat wrote:
> > Hi,
> > currently when a toolview wants to save some state thats pretty much
> > impossible because there can be n toolviews and the last one overwrites
> > the stuff from the first one as the toolviews don't know about each
> > other.
> > My idea to help with this is providing something like
> > void saveState( KConfigGroup& );
> > void restoreState( KConfigGroup& );
> This signature can't quite work -- one factory can create ten views, and you don't
> pass the view anywhere. Can we derive the view from some interface class?
Aaah right. Hmm, we already have Sublime::View interface, but there's
currently no "Toolview" interface because they're not treated
differently than normal views.
As possibly not all toolviews need to store state, maybe we can do this
with a simple multi-inheritance. So we'd have itoolviewinterface in
interfaces/ which has the above methods and one can then return a widget
that derives from QWidget and if wanted inherits also
IToolViewInterface. The storing-code can then just check with
dynamic_cast<> wether the toolview interface is implemented or not.
Hmm, a better name for now might be IToolViewStateInterface.
You will remember something that you should not have forgotten.
More information about the KDevelop-devel