GSoC/GCI Archive
Google Code-in 2011 Haiku

Update Layout Building Code in Misc. Apps

completed by: Hannah

mentors: Alex Wilson

 

During early development of the Haiku Layout API, helper classes were developed to make it easier to code your layout, these classes are:

  • BGridLayoutBuilder
  • BGroupLayoutBuilder
  • BSplitLayoutBuilder

As time progressed, so did the Layout API, and a new approach was developed. The classes above have been replaced with similarly-named inner classes of BLayoutBuilder. These classes are documented on api.haiku-os.org, with an overview of the classes here. As the layout API progresses towards being made public, the older layout builder classes must go. (This is where you come in!!) Luckily, the two approaches end up looking very similar in code, so it isn't too tricky to transition to the new classes.

For this task, you need to replace the usage of the old builder classes with the new ones in various GUIs

  • src/apps/mediaplayer/settings/SettingsWindow.cpp
  • src/apps/installer
  • src/apps/charactermap/CharacterWindow.cpp
  • src/apps/screenshot/ScreenshotWindow.cpp

There are many places in the preflet you'll need to work on, but don't worry, once you get the hang of it, you will be able to make these changes very quickly. (Feel free to carry that momentum on to the other tasks of this type Haiku has provided :) ).

Tip: Make use of tools such as grep, or the code search app here: http://haiku.it.su.se:8180/source/ for better productivity.

One issue to keep in mind is that many apps/preflets use code like this:

SetLayout(new BGroupLayout(...));
AddChild(BGroupLayoutBuilder(...)
     .Add(foo)
     .Add(bar)
     );

Which should be translated to this:


BGroupLayout* layout = new BGroupLayout();
SetLayout(layout);

BLayoutBuilder::Group<>(layout)
     .Add(foo)
     .Add(bar); 

good luck, and god speed. Please remember to test your changes before adding the patch here :)