[Kde-games-devel] Review Request: deprecate KGameDifficulty, add KgDifficulty

Stefan Majewsky majewsky at gmx.net
Mon Feb 20 21:44:00 UTC 2012



> On Feb. 15, 2012, 11:32 p.m., Albert Astals Cid wrote:
> > trunk/KDE/kdegames/kdiamond/src/main.cpp, line 46
> > <http://svn.reviewboard.kde.org/r/6903/diff/1/?file=47664#file47664line46>
> >
> >     We do not support setting the difficulty level through a command line option anymore?

I'm not a friend of dropping features, either, but seriously: Who uses this? If it's worth the effort, one can consider adding functionality to the library to autogenerate the options from the KgDifficulty object, but it's not my top priority.


> On Feb. 15, 2012, 11:32 p.m., Albert Astals Cid wrote:
> > trunk/KDE/kdegames/libkdegames/kgdifficulty.h, line 33
> > <http://svn.reviewboard.kde.org/r/6903/diff/1/?file=47671#file47671line33>
> >
> >     I'm not a fan of two classes in the same header, could i convince you to split it?

I don't see the added value. I usually split headers when one of both classes can be used without the other one, but that's clearly not the case. Also, splitting increases compilation time.


> On Feb. 15, 2012, 11:32 p.m., Albert Astals Cid wrote:
> > trunk/KDE/kdegames/libkdegames/kgdifficulty.h, line 36
> > <http://svn.reviewboard.kde.org/r/6903/diff/1/?file=47671#file47671line36>
> >
> >     QDISABLE_COPY?
> >     QProperties?

Will be added.


> On Feb. 15, 2012, 11:32 p.m., Albert Astals Cid wrote:
> > trunk/KDE/kdegames/libkdegames/kgdifficulty.h, line 90
> > <http://svn.reviewboard.kde.org/r/6903/diff/1/?file=47671#file47671line90>
> >
> >     I think it's a good practive if you get the notify signals to be the property name + changed, i.e. currentLevel -> currentLevelChanged
> >     this way from QML you can do the typical
> >     onCurrentLevelChanged: console.log("foo", currentLevel)

Good point. Without the properties, selected() and changed() sounded concise and to the point, but the QML argument is convincing.


> On Feb. 15, 2012, 11:32 p.m., Albert Astals Cid wrote:
> > trunk/KDE/kdegames/libkdegames/kgdifficulty.h, line 95
> > <http://svn.reviewboard.kde.org/r/6903/diff/1/?file=47671#file47671line95>
> >
> >     Mark as explicit?

Yes.


> On Feb. 15, 2012, 11:32 p.m., Albert Astals Cid wrote:
> > trunk/KDE/kdegames/libkdegames/kgdifficulty.h, line 111
> > <http://svn.reviewboard.kde.org/r/6903/diff/1/?file=47671#file47671line111>
> >
> >     Can we get a addStandardLevel again? in case i just want to add Easy and Hard? I guess I could call addStandardLevelRange(Easy, Easy) but
> >     addStandardLevelRange(Easy) is much more natural
> 
> Albert Astals Cid wrote:
>     "but addStandardLevelRange(Easy) is much more natural" should read "but addStandardLevel(Easy) is much more natural"

I did not consider addLevel(new KgDifficultyLevel(level)) too chatty, but I'll add addStandardLevel().


- Stefan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/6903/#review10686
-----------------------------------------------------------


On Feb. 15, 2012, 9:33 p.m., Stefan Majewsky wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/6903/
> -----------------------------------------------------------
> 
> (Updated Feb. 15, 2012, 9:33 p.m.)
> 
> 
> Review request for KDE Games.
> 
> 
> Description
> -------
> 
> Another day, another updated libkdegames component. KgDifficulty is a rewrite of KGameDifficulty which splits logic from GUI and provides a cleaner API for the logic part.
> 
> New features:
> * KgDifficulty automatically saves and restores the level selection across application runs.
> * The new KgDifficultyLevel base class allows applications to add more data and logic to their difficulty levels. (Usage of standard difficulty levels is simple as ever, and even simpler, thanks to the new addStandardLevelRange method.)
> * Everything in KgDifficulty is exposed through Q_PROPERTY for QML-readiness.
> 
> Removed features:
> * The standard level KGameDifficulty::Configurable has been removed since it's the same as ::Custom from the KgDifficulty point of view.
> * setRestartOnChange() has been removed. If you want that behavior, call setGameRunning() as appropriate. If you don't want that behavior, just don't.
> * The localization API (e.g. localizedLevelStrings) has been removed. The information can be retrieved by iterating over the levels(). This is the only point where application code is going to be more complex right now, but I plan to make KgDifficulty a first class citizen of KScoreDialog when I merge my old KScore2 branch (then as KgScore).
> 
> Compatibility: Highscore data which was created using KGameDifficulty metadata continues to work since the same data values, translations etc. are used internally. Since the difficulty level selection logic moves from the application to the library, compatibility cannot be retained, but that's a minor one-time issue caused by the update. I do not consider that problematic.
> 
> The fine print: The QtWidgets-dependent part has been separated into the KgDifficultyGUI namespace containing the single method KgDifficultyGUI::init. I intend to move this to a separate library once all QtWidgets dependencies are split from the core libkdegames.
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdegames/kdiamond/src/board.h 1280243 
>   trunk/KDE/kdegames/kdiamond/src/board.cpp 1280243 
>   trunk/KDE/kdegames/kdiamond/src/game.h 1280243 
>   trunk/KDE/kdegames/kdiamond/src/game.cpp 1280243 
>   trunk/KDE/kdegames/kdiamond/src/main.cpp 1280243 
>   trunk/KDE/kdegames/kdiamond/src/mainwindow.h 1280243 
>   trunk/KDE/kdegames/kdiamond/src/mainwindow.cpp 1280243 
>   trunk/KDE/kdegames/libkdegames/CMakeLists.txt 1280243 
>   trunk/KDE/kdegames/libkdegames/includes/CMakeLists.txt 1280243 
>   trunk/KDE/kdegames/libkdegames/includes/KgDifficulty PRE-CREATION 
>   trunk/KDE/kdegames/libkdegames/kgamedifficulty.h 1280243 
>   trunk/KDE/kdegames/libkdegames/kgdifficulty.h PRE-CREATION 
>   trunk/KDE/kdegames/libkdegames/kgdifficulty.cpp PRE-CREATION 
> 
> Diff: http://svn.reviewboard.kde.org/r/6903/diff/
> 
> 
> Testing
> -------
> 
> My usual guinea pig (KDiamond) behaves fine. The tab selection in KScoreDialog (through setConfigGroup()) is broken for some reason, but I confirmed that it was already broken before the port. Might have to do with the deprecation warning for KScoreDialog::setConfigGroup().
> 
> 
> Thanks,
> 
> Stefan Majewsky
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20120220/1b0b73cb/attachment-0001.html>


More information about the kde-games-devel mailing list