Results 1 to 11 of 11

Thread: Dynamically adding resources

  1. #1
    Join Date
    Jan 2014
    Posts
    76
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Dynamically adding resources

    Hi,

    I use rcc compiler resource and QResource::registerResource() to add dynamically external resources as it is describes here The Qt Resource System

    It works fine but I would like to embed this registered resources in my executable file.
    Is any way to do this without recompile project?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Dynamically adding resources

    Is any way to do this without recompile project?
    No. How do you think the resource system gets embedded resources into the executable?

    And think of what a security hole you would have for malware if changing the executable was possible without rebuilding.

  3. The following user says thank you to d_stranz for this useful post:

    atomic (17th July 2015)

  4. #3
    Join Date
    Jan 2014
    Posts
    76
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dynamically adding resources

    Thank you very much,

    so if I would like to allow my end users embed dynamically resources and recompile project on their machine, what I must also provides? It is enough qmake and for example mingw32-make? or i must have on their machine all Qt?

  5. #4
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Dynamically adding resources

    You must have everything required to build your application. What type of resources do you want users to provide? Most (all?) resources that I've used in a Qt resource file can be directly loaded via other methods.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  6. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Dynamically adding resources

    so if I would like to allow my end users embed dynamically resources
    Why do you need to provide a way for users to embed resources?

    Do you really want to force your users to become programmers just to be able to use your application?

    Are your users going to redistribute your application after it has been changed to include their custom resources?

    Why can't these resources live on the user's own hard drives somewhere and simply be dynamically loaded by your application?

    Are you confused about how to implement something that lets users define their own resources and use them in your application?

  7. #6
    Join Date
    Jan 2014
    Posts
    76
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dynamically adding resources

    I writting a program which allows users create animations from images or videos with text and then they can share with friends what they have done. And it would be great if users can send to their friends only one file with effects works.

  8. #7
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dynamically adding resources

    Quote Originally Posted by atomic View Post
    I writting a program which allows users create animations from images or videos with text and then they can share with friends what they have done. And it would be great if users can send to their friends only one file with effects works.
    But don't you have that already?
    What other file than the resource file does another user currently need?

    Cheers,
    -

  9. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Dynamically adding resources

    I writting a program which allows users create animations from images or videos with text and then they can share with friends what they have done. And it would be great if users can send to their friends only one file with effects works.
    So you are saying that your program allows users to edit a video file to add something to it, but the only way they can share it with others is to send them a copy of your program? Why don't you just write out a new video file with the changes the user has made?

  10. #9
    Join Date
    Oct 2014
    Posts
    81
    Thanks
    20
    Thanked 9 Times in 9 Posts
    Qt products
    Qt5
    Platforms
    Windows
    Wiki edits
    7

    Default Re: Dynamically adding resources

    You can append data to the end of the executable file:
    http://oroboro.com/packing-data-compiled-binar/

  11. The following user says thank you to Kryzon for this useful post:

    atomic (21st July 2015)

  12. #10
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Dynamically adding resources

    This is all well and good, but it is unlikely you can get away with this at runtime on a Windows app, both because Windows locks apps (and their DLLs) while they are executing, and because Windows security won't let you write to the application install directory except during installation.

    So, to do this in practice, the program would have to create a copy of itself somewhere with the new data appended, and then users would have to send each other the new program along with all of the Qt DLLs it depends on, and then get it installed correctly on their machines.

    And each time a user wanted to edit a new image or video, they would have to create another copy of the program and data and Qt DLLs and ship that off to their friends.

    I mean, really?

  13. The following user says thank you to d_stranz for this useful post:

    atomic (21st July 2015)

  14. #11
    Join Date
    Jan 2014
    Posts
    76
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dynamically adding resources

    Yes, you are right, my app has two parts, one main part for create animations from images and texts and one small program for "read-only" effects and now the second small program must be provide with separate file( resources.rcc) which is dynamically loaded when user want see this animation and run this program. And i want embed this resource file inside this small program and I think I must read content from above link.

    Thanks,

Similar Threads

  1. adding files to resources by code
    By Malisha100ka in forum Newbie
    Replies: 5
    Last Post: 12th January 2015, 09:33
  2. Add files to resources dynamically
    By juracist in forum Qt Programming
    Replies: 2
    Last Post: 25th June 2014, 15:29
  3. Replies: 0
    Last Post: 27th October 2010, 16:57
  4. Adding directories to resources
    By roxton in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2008, 13:00
  5. Replies: 9
    Last Post: 11th January 2007, 16:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.