×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    How to set the application icon if qmake overwrites the pkg file?

    I'm developing a Qt app for S60 (3rd edition FP2) and I'd like to use my own application icon.

    I know this has been discussed elsewhere, but the documentation seems to be conflicting. I've tried...

    http://wiki.forum.nokia.com/index.ph...60_3rd_edition

    and


    http://wiki.forum.nokia.com/index.php/How_to_define_application_icon


    ...but neither works for me. I've tried creating my own SVGs and tried using the SVG file from an existing example app. I've also rebuilding from clean, restarting the phone, deleting the app and reinstalling, etc.

    mifconv seems to work fine (and, yes, I've checked to make sure I've used the right file names and paths).

    I guess the problem is that qmake is overwriting the pkg file(s). How can I set the values for the mif and mbm files (to use the bitmap example) if not in the pkg file?

    Are there definitive instructions somewhere, explaining how to set a custom application icon?

    Sam Dutton

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: How to set the application icon if qmake overwrites the pkg file?

    Whatever qmake does generate is based on instructions found in the *.pro file. Your question becomes thus what statement should be added to *.pro that inserts the needed *.mif in the pkg file.

    Until we find the answer to this question the workaround is to make a copy of the PKG file, edit it according to your needs and then call "createsis create <file>.pkg" in order to generate a self-signed package. (for advanced use cases see makesis.exe and signsis.exe)
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  3. #3
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: How to set the application icon if qmake overwrites the pkg file?

    Solution #2: add an icon to all the Qt for S60 projects by modifying bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config) in \qmake\generators\symbian\symmake.cpp
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  4. #4
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to set the application icon if qmake overwrites the pkg file?

    You can simply make changes to one of the generated package files and save it with a different name, then use the same 'createpackage' convenience script provided with the Qt for S60 releases.

    There should be a way to add the necessary files to the .pkg via the DEPLOYMENT keyword in the .pro file but I haven't had a chance to try it out yet. You could check to see if it's used in any of the examples/demos.

    Mark

  5. #5
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    Re: How to set the application icon if qmake overwrites the pkg file?

    Thanks for all the suggestions, but I still haven't managed to get this to work.

    This is what I've done so far...

    1. Followed the instructions for creating using bitmap icons here: http://wiki.forum.nokia.com/index.ph...plication_icon

    2. Created a copy of my pkg file, added the following and saved:

    "test.mif" -"!:\resource\apps\test_reg.mif"
    "test.mbm" -"!:\resource\apps\test_reg.mbm"

    3. Ran createpackage on the new pkg file.

    4. Deleted existing applications from my (N96) phone.

    5. Copied the new application onto the phone, having changed some text to make sure it was actually the new version.

    6. Turned off the phone and turned it on again.

    I've done all this without errors, but the icon stays with the default 'jigsaw piece'.

    Just a thought -- does it matter that the application is self-signed?

  6. #6
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to set the application icon if qmake overwrites the pkg file?

    Hi,

    Possibly your problem here is that the application registration file is also getting overwritten by qmake? It's certainly generated.

    ICON handling seems to be somewhat platform specific in Qt, so I expect we'll get something easy to use in a future release.

    It should be possible to hack around it in the way you're attempting though. Perhaps you'll have to create a copy of the app reg file and modify the package to install that one instead too?

    Mark

    P.S. No, self-signed is fine for changing icons.

  7. #7
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: How to set the application icon if qmake overwrites the pkg file?

    As Sorcery said the key must be in the resource files, they must contain a valid registration resource and the icon file (which is either mif or mbm, not both) properly specified there (name, number of icon frames). I would not expect the resource file to be overwritten but, as indicated above, you can if needed modify qmake's generators to ensure that the icon definition is persistent.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  8. #8
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    Re: How to set the application icon if qmake overwrites the pkg file?

    You're right: qmake overwrites myapp_reg.rss (I take it this is the reg file?) so it looks for the moment like you have to rebuild qmake...

    Here's a response from Janne Anttila on the QtS60-feedback list:

    At the moment QtS60 does not have build-in support for custom application icons - the work is in progress. In upcoming releases there will be mechanism to set custom application icon via pro file by giving the SVG icon name.

    Meanwhile you should be able to set the application icon by following the instructions in S60 help.
    In addition, you will need to modify files generated by qmake to take the icon in use and to deploy it correctly to device.
    Sam

  9. #9
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to set the application icon if qmake overwrites the pkg file?

    Yes, myapp_reg.rss is the application registration file. Without it an application, while present in the file system, doesn't appear in the applications menu anywhere.

    So, you can probably solve the problem with a separate copy of the registration file. Since this isn't the way you'll need to do it in the longer term, it might not be worth bothering and just put up with the default icon for now?

    Mark

  10. #10
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    Re: How to set the application icon if qmake overwrites the pkg file?

    I'm going to wait for the ability to do this in the .pro file -- as you suggest...

    I tried creating a separate reg file with the icon stuff and changing the .pro file to reference this, but it didn't work.

    There are several places in hacking this where I'm not sure what I'm doing, or may have made a silly mistake, so I'm going to give up and put up with the default icon for now!

  11. #11
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: How to set the application icon if qmake overwrites the pkg file?

    As this discussion was continuing on the feedback mailing list it is better to put it back in the public space and fix it (at least as a temporary hack). The following changes are to be made to project files which then are to be set as read-only as to prevent them from being overwritten by qmake.

    =================

    It is advisable to use an SVG icon and to get you started use the one from the S60 SDK's HelloWorld.

    Modify bld.inf in order to add a make script that will build the icon (unless you want to do this manually each time you change the icon, not very often anyway). Just copy the make script from one SDK example and edit the source file names in it according to your project layout.

    Once you have the *.mif file (or the *.mk that will build it) you will have to modify the following files:

    - *.rss - ensure icon_file and number_of_icons are set properly

    Code:
    RESOURCE LOCALISABLE_APP_INFO r_helloworldbasic_localisable_app_info
        {
        short_caption = STRING_r_hewb_caption_string; // or "AppName"
        caption_and_icon =
        CAPTION_AND_ICON_INFO
            {
            caption = STRING_r_hewb_caption_string; // or "Long App Name"
            number_of_icons = 1; // 1 for MIF, could be more, of different sizes for MBM (count image + mask pair as one icon)
            icon_file = "\\resource\\apps\\Helloworldbasic_aif.mif";
    	  };
        }
    - *_reg.rss - ensure localisable_resource_id points to the localized resource defined above (name CAPITALIZED)

    Code:
    RESOURCE APP_REGISTRATION_INFO
      {
      app_file="HelloWorldBasic";
      localisable_resource_file =  STRING_r_helloworldbasic_loc_resource_file_1;
      localisable_resource_id = R_HELLOWORLDBASIC_LOCALISABLE_APP_INFO;
    
      embeddability=KAppNotEmbeddable;
      newfile=KAppDoesNotSupportNewFile;
      }
    finally, modify the *.pkg adding a line that will package the icon file to deployment

    Code:
    "$(EPOCROOT)\epoc32\data\z\resource\apps\helloworldbasic_aif.mif" -"!:\resource\apps\helloworldbasic_aif.mif"
    If all this is in place your icon will show up.
    Last edited by ltomuta; 2009-01-23 at 22:51.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  12. #12
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    Re: How to set the application icon if qmake overwrites the pkg file?

    Thanks, ltomuta, for your detailed reply.

    I don't want to waste (more of) your time, but one basic question: when creating a Qt project from Carbide, only a *_reg.rss is created: not a *.rss file.

    What part of the build process creates the *.rss rile? How can I add this resource to the Qt project -- or should I include the RESOURCE LOCALISABLE_APP_INFO code elsewhere?

    Sam

  13. #13
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: How to set the application icon if qmake overwrites the pkg file?

    Ups, that's the problem of solving a problem "in theory" and not verifying it in practice. That was more of a "normal" resource linking for a Symbian C++ project.

    Put the structure intended for the *.RSS file in the *_reg.RSS and then compile the project again.

    I will try this myself some time this evening and I promise to bring you a working solution tomorrow
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  14. #14
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    Re: How to set the application icon if qmake overwrites the pkg file?

    Thanks again.

    Sam

  15. #15
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: How to set the application icon if qmake overwrites the pkg file?

    Ok, here's the solution. It is in fact the same as desribed above, with a new file *_loc.rss added to the project and holding the localizable registration resource.

    Code:
     #include <appinfo.rh>
    
    RESOURCE LOCALISABLE_APP_INFO r_local_qtmwappwithicon
        {
        short_caption = "AppIcon";
        caption_and_icon =
            {
            CAPTION_AND_ICON_INFO
                {
                caption = "App With Icon";
                number_of_icons = 1; // each icon must be a bitmap/mask pair
                icon_file = "\\resource\\apps\\qtmwappwithicon.mif";
                }
            }; 
        }
    That is then linked to the *_reg.rss as described above.

    Code:
    #include <appinfo.rh>
    #include <QtMWAppWithIcon_loc.rsg>
    
    UID2 KUidAppRegistrationResourceFile
    UID3 0xE44F599D
    
    RESOURCE APP_REGISTRATION_INFO
    {
    	app_file="QtMWAppWithIcon";
    	
    	localisable_resource_file="\\resource\\apps\\QtMWAppWithIcon_loc";    
    	localisable_resource_id = R_LOCAL_QTMWAPPWITHICON;
    
    	embeddability=KAppNotEmbeddable;
    	newfile=KAppDoesNotSupportNewFile;
    }
    The *.mif file I've used is one built already for the helloworldbasic example, I've just make a copy of it in place (at \epoc32\release\winscw\udeb\z\resource\apps ).

    The additions to the MMP file:
    Code:
    ...
    SOURCEPATH		 .
    
    start resource  QtMWAppWithIcon_loc.rss
    targetpath      \resource\apps 
    lang            01
    HEADER
    end
     
    START RESOURCE		"QtMWAppWithIcon_reg.rss"
    ...

    Finally, the new built files should be added to the package (*.pkg), in my case

    Code:
    "\S60\devices\S60_5th_Edition_SDK_v0.9\epoc32\data\z\resource\apps\QtMWAppWithIcon.mif" -"!:\resource\apps\QtMWAppWithIcon.mif"
    
    "\S60\devices\S60_5th_Edition_SDK_v0.9\epoc32\data\z\resource\apps\QtMWAppWithIcon_loc.r01" -"!:\resource\apps\QtMWAppWithIcon_loc.r01"
    Remember to set all modified files as read only and as you don't really want to prevent to make legitimate changes to them you will have to apply the hacks only when the project is otherwise completed.

    Attached Files Attached Files
    Last edited by ltomuta; 2009-01-26 at 21:52.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

Similar Threads

  1. Trusted Application
    By damien_a in forum Mobile Java General
    Replies: 11
    Last Post: 2012-02-17, 20:49
  2. #include in pkg file
    By davidmaxwaterman in forum Symbian
    Replies: 3
    Last Post: 2007-03-21, 09:54
  3. how to install an sisx application by including the file in image through iby file
    By arun_stmicro in forum Mobile Web Site Development
    Replies: 3
    Last Post: 2006-10-27, 08:52
  4. Replies: 0
    Last Post: 2006-10-16, 17:31
  5. Replies: 1
    Last Post: 2005-05-26, 14:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •