Our article on the creation of bitmap icons for Symbian applications is one of the most-read and most-linked ones on Forum Nokia – if that doesn’t give a clear indication that people are fed up with SVG crap, what does?
The introduction of Qt has not done much about the issue. Instead, it made our life even more difficult as we no longer control the rss and mmp files – QMake generates them out of the information found in the .pro file. Fortunately, there is a way around – read on to find out more about bitmap icons for Symbian Qt applications.
Step 1 – create icon files
This has largely been explained in the first part of the article. This time, I just assume that the following six files are present in the folder structure as shown below:
- 24.134 bigicon.bmp
- 18.254 bigicon_mask.bmp
- 14.054 midicon.bmp
- 10.654 midicon_mask.bmp
- 6.138 smlicon.bmp
- 6.138 smlicon_mask.bmp
Step 2 – create icon MBM
Next up is the MBM, which will contain the images when done. In traditional Symnbian C++, creating an MBM file is easy – not here. Fortunately, the syntax for the creation of an MBM file is relatively dumb – so why not add it to the MMP file ourselves. Adding stuff to an MMP file is straightforward – edit the .pro file to look like this, and run QMake again:
TARGET.UID3 = 0x2002CAC7
MMP_RULES += "START BITMAP QtBallZ_icons.mbm"
"SOURCE c24,1 midicon.bmp midicon_mask.bmp smlicon.bmp smlicon_mask.bmp bigicon.bmp bigicon_mask.bmp"
If you now recompile the app in various build configurations (try WINSCP and GCCE debug), you will end up with the MBM file named above – the example above creates QtBallZ_icons.mbm.
Step 3 – deploy MBM file
Adding the MBM file to the sis is also easy. This happens via the .pro file, too – it will then update the PKG automatically. This step is somewhat sensitive – no extra spaces allowed!!!!
TARGET.UID3 = 0x2002CAC7
moreFiles.pkg_postrules = ""$(EPOCROOT)epoc32\data\z\resource\apps\QtBallZ_icons.mbm" -"!:\resource\apps\QtBallZ_icons.mbm""
DEPLOYMENT += moreFiles
Step 4 – connect
The final step is the most annoying one. It involves looking for the bold segment in ALL project files, and adding the two lines indented in the sample below:
RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info
short_caption = STRING_r_short_caption;
caption = STRING_r_caption;
number_of_icons = 2;
This is annoying for one reason: qmake will undo it whenever it gets called. This means that you need to redo it every time before you compile a SIS build (CVS is helpful here).
Step 5 – test
Compile the program – if something is wrong, it will usually show up in the console. Just open it in full screen, and look at every line – it may be boring but helps. Then, deploy the sis to the phone, install it AND TURN OFF THE PHONE TO FLUSH THE ICON CACHE. After a reboot, your icon should be there!
Looks like we’ve beaten the SVG mafia one more time. The hoops the SVG fetishists put up get higher and higher – but trust good ole Tamster to show you the way to bitmap icon goodness…