[Kde-games-devel] Review Request 127284: KBlocks: Port sound to KgSound

Frederik Schwarzer schwarzer at kde.org
Wed Mar 9 05:31:30 UTC 2016



> On March 6, 2016, 9:37 a.m., Frederik Schwarzer wrote:
> > Do you have any reason to move the enum outside of the class?
> > I am using C++ for some years now but have only started serious reading about it a few months ago. Meaning, my knowledge is pretty limited and I would like to understand, if there is a reason for that.
> > 
> > Same goes for "virtual". I have not advanced to the "virtual" chapter of the book I am reading. So ... well, at least I cannot comment on that change. :D
> > 
> > Otherwise I would say: "Ship it!", but you may want to wait a few days for others to comment.
> 
> Julian Helfferich wrote:
>     Before I learned about enum classes, I always put enums in a namespace or inside a class to protect their scope. Thankfully, with enum classes this is no longer necessary.
>     
>     If I had left the enum inside the class, it would be necessary to call
>     ```cpp
>     KBlocksSound mSnd;
>     mSnd->playSound(KBlocksSound::Sound::BlockMove);
>     ```
>     which I find redundant. If the enum is outside the class you can call
>     
>     ```cpp
>     mSnd->playSound(Sound::BlockMove);
>     ```
>     which I find much nicer.
>     
>     Virtual destructors are necessary if there are child classes. When you have
>     ```cpp
>     BaseClass *pointer = new ChildClass();
>     delete pointer;
>     ```
>     will the ChildClass destructor be called? If you have a virtual destructor in BaseClass the answer is yes. If you don't have a virtual destructor then nobody knows.
>     
>     In this case, KBlocksSound is not designed to be inherited from. I have seen people declaring all destructors virtual. I do not have a strong opinion on this, but I prefer to omit unnecessary keywords.

Thanks for the explanation. :)


- Frederik


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127284/#review93222
-----------------------------------------------------------


On March 9, 2016, 3:32 a.m., Julian Helfferich wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127284/
> -----------------------------------------------------------
> 
> (Updated March 9, 2016, 3:32 a.m.)
> 
> 
> Review request for KDE Games.
> 
> 
> Repository: kblocks
> 
> 
> Description
> -------
> 
> Port sound in KBlocksSound from Phonon to KgSound. Note that neither before nor after this port sounds are played (the KBlocksSound::playSound() function is not called). I have also re-enabled the sound and will post the patch here once the port to KgSound is approved and pushed.
> 
> The new KBlocksSound uses the sounds from the sounds/ directory. Previously it was intended (at least it seams so to me) that the sound is part of the theme. However, there are only two of three sounds in the themes/ directory (default theme). Thus, unless there are any themed sounds, I suggest to simply use the sounds from the sounds/ directory.
> 
> 
> Diffs
> -----
> 
>   CMakeLists.txt 38fdfd3 
>   KBlocksScene.cpp 07cd457 
>   KBlocksSound.h dc02775 
>   KBlocksSound.cpp 1346bc6 
>   sounds/CMakeLists.txt PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/127284/diff/
> 
> 
> Testing
> -------
> 
> The testing were done for this patch plus the next patch enabling the sounds.
>  
> * Played single game -> Sounds play correctly.
> * Played Human vs AI -> Sounds play only for human player (as intended).
> * Turned off/on sounds -> Sounds off/on correctly.
> 
> 
> Thanks,
> 
> Julian Helfferich
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20160309/92e4e4a8/attachment.html>


More information about the kde-games-devel mailing list