[Kde-games-devel] KScoreDialog

Matt Williams matt at milliams.com
Mon Apr 28 20:13:33 CEST 2008


On Monday 28 April 2008 18:16:41 Fela Winkelmolen wrote:
> On Monday 28 April 2008, Matt Williams wrote:
> > On Monday 28 April 2008 15:40:37 Fela Winkelmolen wrote:
> > > 2. If the same instance of KScoreDialog is used (I create a new
> > > instance every time the dialog is showed as that seems to work better)
> > > the caption comment in the dialog isn't shown correctly. For example in
> > > KMines, the capiton "Well Done...." will remain if press Show Highscore
> > > after having won the game.
> >
> > I can see that using the same instance of KScoreDialog would cause this
> > but I don't see how that would happen? Clicking "Show Highscore" will
> > surely call a function which will create it's own KScoreDialog and then
> > show it?
> >
> > Ah, sorry. Now I look at the KMines code I see that the dialog is saved
> > as a member object of the mainwindow class. I hadn't really expected
> > people to use it like that.
>
> So either we need to make it work right this way, or fix all programs that
> use the same KScoreDialog objects. I think the former is a better idea.

I understand that there's nothing in the API/code to stop someone reusing the 
same object but it's just against the use case. KScoreDialog is a dialog, not 
a highscore management system. The use cases are:
 * Create a KScoreDialog and then show it - this will display the current 
scores
 * Create a KScoreDialog, tell it you want to add a new score to it's list, 
then show it - this will provide the editable interface if necessary

Now, I admit that perhaps a nicer API _would_ be a highscore management 
system. That management system would then handle adding new scores etc. and 
that management system would provide a function call which will display the 
dialog in either display mode or in 'adding sore mode'.

I can have a look at twisting KScoreDialog into being able to handle using 1 
object for all functions for 4.1 since the full rewrite which handles i18n 
etc. will not be around until 4.2 and also I can't yet see a way to handle 
the group name translations for the rewrite.

Regards,
Matt Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20080428/6affb3a3/attachment.pgp 


More information about the kde-games-devel mailing list