appleremote02 (part6)
Time for code review, last step for the cws before to be ready for QA.Philipp Lohmann agreed the changes in vcl ( and thus, the corresponding changes in apple_remote module)
Several problems had to be fixed :
* Christian Lippka suggested the use of MEDIA_COMMAND_VOLUME (UP and DOWN ) had to be changed, for other OS than Mac OS S X [fixed]
* protect the popup menu case [fixed]
* Andre Fischer asked about the eventlistener [partially fixed]: is not exactly at the right place, because I add the eventlistener at the end of GetState(SfxItemSet&) method, and this would result in multiple calls to Application::AddEventListener(const Link&). The Application class stores event listeners in a list, not in a set, and thus, more than one eventlistener may be registered for a single SdModule object. Fortunaly, when the (one) listener is removed in ~SdModule the Application::RemoveEventListener(const Link&) removes all listeners (that's what I verified using leaks on Mac)
The possible solutions :
Add the listener directly in the SdModule Ctor : Does not work (maybe my fault), because this leads to a sort of chicken-egg problem, and after some tests, it seems to be unbuildable ( I gve up with that).
Philipp proposed a solution I tested already, based on a singleton pattern [done, works already]
Investigating on another more complicated, but elegant solution Andre proposed. the idea is to create a static Create() method for SdModule, that creates and initializes an SdModule object.
This needs to make the constructor private (no side effects ?) and finally to have SdDLL::Init() calling this new Create() method. Work in progress ...
A big thank you for the code review, and for the time they spend helping me to Andre Fischer,Christian Lippka, Philipp Lohmann and Thorsten Behrens ( kindly answering my questions on the #education.openoffice.org channel)
Libellés : Apple, development, High-Tech, Mac OS X, Teaching OpenSource