[Kde-games-devel] KScoreDialog and KGameDifficulty bugs

Matt Williams matt at milliams.com
Tue Apr 29 18:40:32 CEST 2008


On Monday 28 April 2008 22:55:38 Matt Williams wrote:
> On Monday 28 April 2008 21:42:15 Matt Williams wrote:
> > On Monday 28 April 2008 21:39:45 Matt Williams wrote:
> > > Well it turned out he did :) The solution we came up with is, after
> > > creating the KScoreDialog object, to explicitly add translations (by
> > > passing a KLocalizedString) for all the possible group names. When the
> > > class comes to read the config file, it can compare the untranslated
> > > string in the file with the untranslated string from the list of
> > > KLocalizedStrings and extract the localised string hence.
> > >
> > > I've had to add 2 functions to KGameDifficulty. One which returns the
> > > KLocalizedString for the currently active difficulty level and another
> > > which returns a full list of all the difficulty levels'
> > > KLocalizedStrings.
> > >
> > > Once again the patch updates KMines, KSquares, Kollision and KNetwalk
> > > but leaves the rest of the games alone. I'll update the others myself
> > > if this patch is okay.
> > >
> > > When I come to rewrite KScoreDialog (for 4.2) it will need to be
> > > treated in this way too but will rock twice as hard (at least)!
> > >
> > > Comments?
> >
> > Crap, forgot to attach the patch. Here we go...
>
> Albert pointed out that I'd missed some addLocalizedConfigGroupName() calls
> in the ksquares part of the patch. Here's an updated patch with the correct
> calls being made.

Believe it or not, I decided the patch wasn't good enough and have rewritten 
it almost entirely. The key change is that now, instead of passing around a 
KLocalizedString and using the untranslated string stored within to compare 
against config group names etc. I'm now passing around a QPair<QByteArray, 
QString>. Where the QByteArray is the not-to-be-translated group key and the 
QString is the tranlated name. The problem with using KLocalizedString is 
that there was no guarantee that the string wouldn't change, using a 
QByteArray makes it more clear that this is a key and not a UI string.

This is more in line with how KScoreManager will do things and will so make 
the porting precess easier later.

This is almost certainly the one I'll commit.

Comments?

Regards,
Matt Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i18nfixforkscoredialog.patch
Type: text/x-diff
Size: 27456 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20080429/47ca711d/attachment-0001.bin 
-------------- 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/20080429/47ca711d/attachment-0001.pgp 


More information about the kde-games-devel mailing list