[GSoC 2017] First two weeks of Community Bonding

Blog post by AkshayAgarwal007 on Thu, 2017-05-18 08:51

Hello Everyone!

In my previous post I introduced you all to the Calendar Application project that I would be working upon as a part of GSoC 2017. In this post I would be focusing on my first two weeks of the community bonding period.

Getting to know people

The first few days were spent in exploring more about the Haiku community, getting to know the mentors and fellow students, and learning in details about their project through their blog posts. All the projects are geared to take Haiku forward and it would indeed be an awesome summer for Haiku.

I would like to thank the community members for their feedback on my introduction blog post. Their excitement for a Calendar application makes me even more excited to develop a lovely Calendar application for the community.

Haiku has a beautiful community. All the members are cool and helpful, I would like to mention about a few of them.

  • PulkoMandy: He's always there for you. Any issue you face and he'll resolve it in seconds. I am getting to learn a lot from him.
  • Scott: Very helpful and motivating, will always point you to the right direction. I have a nice time talking to him.
  • waddlesplash and humdinger: Always ready to help, and have helped me a lot with my PRs to apps in Haiku Software Archives.
  • anirudhm, digib0y and vivek: Awesome guys, it's nice discussing stuff with them.

Things successfully done

I worked on fixing style formatting issue with BDurationFormat and BTimeUnitFormat classes which are a part of Locale Kit.

BDurationFormat is used to format time intervals in a localised way i.e it takes in a time interval and converts it to a string such as "10 hour, 2 minutes, 28 seconds". There are two formatting styles supported: full name and abbreviated name. For example, for English, the full name for hour duration is "3 minutes", and the abbreviated name is "3 min".

But the abbreviated style didn't work because the BTimeUnitFormat class didn't incorporate the same. I submitted a patch to resolve this and it got successfully merged (thanks to PulkoMandy). The abbreviated style works fine now.

Screenshot of TimeTracker app showing abbreviated style:

TimeTracker

Issues that I faced and how I resolved them:

  • I faced difficulties in pointing to the changed headers (rather than the one in system/develop) while compiling the test application. I used the -I flag with gcc pointing to the changed headers to get it done.
  • I was not able to link the test application to the newly built libbe.so. I fixed it by adding the newly built libbe.so inside a lib folder next to my executable.
  • For getting a new build of libbe.so after my changes to files in the locale kit, I simply did jam libbe.so from within root of my Haiku clone instead of compiling the entire source. Initially I was compiling the entire source and it was taking a lot of time.

I was able to resolve the issues quickly with PulkoMandy's help.

The Calendar App

I have started experimenting with the GUI. I am currently putting my code here: AkshayAgarwal007/Calendar . I started with adding a simple toolbar to a window and adding some vector icons to the toolbar buttons.

Issues that I faced and how I resolved them:

  • I took one of the icons from here, exported it as HVIF Rdef using Icon-O-Matic, copied the hex representation into a .rdef file. Loaded the vector icon into a BBitmap object and passed it as a parameter to BToolBar::AddAction(). But the icons were not aligning properly in the toolbar buttons.

    The reason for the same was that the icons have transparent area to the right and bottom i.e they are 32x32px in size but only a 22x22px area in the corner is used.

    So I rendered the icon to a 32x32px bitmap and copied the required region in the corner to a 22x22px bitmap using BBitmap::ImportBits(). Finally, it got aligned perfectly.

  • <li> Also I wasn't the handling the BBitmap object properly. BBitmaps are 
    expensive, since they create a full drawing context and thread in the 
    app_server. B_BITMAP_NO_SERVER_LINK flag can be used while creating a 
    BBitmap object to make it cheap to create but such a bitmap is not drawable. 
    BBitmap::ImportBits() would work fine with this bitmap.<br><br> The 
    following two commits can be helpful for anyone facing similar issues: 
    <a href="https://github.com/AkshayAgarwal007/Calendar/commit/3f565bdeda85cb6aa07ddb255a99ad808364a41f">AkshayAgarwal007/Calendar@3f565bd</a><br>
    <a href="https://github.com/AkshayAgarwal007/Calendar/commit/8b7128f76a6cdbb51eed3701a57d7dc65424762d">AkshayAgarwal007/Calendar@8b7128f</a></li>
    

Stippi and PulkoMandy helped me in getting it done right.

Calendar

The icons are just placeholder icons.

Next I would be doing some more experimentation with the GUI, and dive into doing some base work/research towards the Google Calendar integration and storage part. Also would be working towards finalising the left mockups.

Learnings

  • Bitmaps are expensive and should be handled properly. While creating a BBitmap object, B_BITMAP_NO_SERVER_LINK flag can be used when calling the constructor to make it less costly, but they are not drawable.
  • i18n and L10n in general, ICU, and Haiku Locale kit.
  • Writing good software (source: Haiku HIG).
  • Compiling Haiku components and testing them.

Altogether, it's a nice experience till now, and I am enjoying working on the project very much.