Svens Blog

Things that really matter...
...at least for me ;-)
February 2010
SunMonTueWedThuFriSat
12356
7910111213
14151617181920
21222324252627
28
< Jan   Mar >

[Recent Entries]
[Entry Index]

Administration
[Login]
Recent Entries
Topics
Andere Blogs
RSS 2.0 Feed

Valid CSS!
Valid XHTML 1.0!
Valid RSS!

No software patents!
Campaign for a Non-Browser Specific WWW
darkerradio - DIE Alternative im Netz - Tune In, Turn On, Burn Out
Some rights reserved
Aktion UBERWACH!
Play Ogg!
  GSoC status update June/3
24. June 2009, 06:04PM
Posted By Sven Krohlas
Now the infrastructure for providing bindings exlusively for test scripts in debug builds is in place. This required some CMake magic to set a preprocessor variable DEBUG in debug builds which then can be used in various #ifdefs to make public slots out of public object members, which then can be accessed from scripts. In the beginning the idea was to do this more elegantly, by putting the slot definitions into other preprocessor defines, like AMAROK_DEBUG_EXPORT. This way a lot of #ifdefs could be saved and the code would be much better to read. Sadly the moc preprocessor required to offer the bindings doesn't understand many commands and #define is one of those it lacks. So now you might stumble upon things like:
#if defined(DEBUG)
  public slots:
#else
  public:
#endif
Sorry, I couldn't find a less ugly way currently.
With that working I started adding bindings to Amarok classes to the script engine for test scripts. Playlist::Actions, Playlist::Controller, PlaylistManager and Meta:TrackPtr are there now. The next problem I stumbled upon was that some more classes have to be known to scripts to write reasonable tests. Currently I'm about to provide a prototype for KUrl, which doesn't work yet, but I think I know what went wrong there.

As of this writing I'm sitting in the train to LinuxTag in Berlin, where I'll be until Saturday, but hopefully some code can nevertheless be written. Feel free to visit our booth or one of our talks and workshops.
[Permalink]   [Comments (3)]   [Add Comment]   [Trackback]   [Google]   (246 Words)
24. June 2009, 6:44PM
Comment by Prasad

I do not know much about C++, but if this was C, I'd put something like this in my header files:

#if defined(DEBUG)#define PUBLIC public slots#else#define PUBLIC public#endif

and end up replacing all public: with PUBLIC:

But there are people who frown upon things like this! :-)
  [Permalink]  [Reply]    (44 Words)
28. June 2009, 11:56AM
Comment by Sven Krohlas

Sadly that doesn't work here. The moc preprocessor needs to be run first to generate code to be able to use signals and slots, which then gets included in the normal source files. But that moc preprocessor doesn't understand #define. So the #defines are then interrpeted by the normal preprocessor which adds the slot definitions and... well, then it's too late, the moc preprocessor already ran. :-/
  [Permalink]  [Reply]    (67 Words)
29. June 2009, 12:33AM
Comment by Prasad

Too late, too bad!
  [Permalink]  [Reply]    (4 Words)