Results 1 to 5 of 5

Thread: Qt Installer Framework - Reading downloaded package version

  1. #1
    Join Date
    Jan 2015
    Location
    Tremp, Spain
    Posts
    14
    Thanks
    6
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Qt Installer Framework - Reading downloaded package version

    Hi all,

    I posted this few hours ago in the Qt Tools forum, but I think here, having more movement, I can get some help.

    There seems to be very few folks using this tool (Qt Installer Framework), but I'll ask before migrating to a third party tool.
    Using QtIFW-1.5.0, so far I am able to generate an online installer for my Qt application on Windows. The installer downloads the appropriate package from my web server and performs some operations defined in the control script installscript.qs, e.g. writing some keys into registry and creating a desktop shortcut with an icon:
    Qt Code:
    1. Component.prototype.createOperations = function()
    2. {
    3. try {
    4.  
    5. // call the base create operations function
    6.  
    7. component.createOperations();
    8.  
    9. // Add some keys to registry;
    10.  
    11. var userProfile = installer.environmentVariable("USERPROFILE");
    12. installer.setValue("UserProfile", userProfile);
    13. var reg = installer.environmentVariable("SystemRoot") + "\\System32\\reg.exe";
    14. var key= "HKCU\\Software\\Company\\Product";
    15. component.addOperation("Execute", reg, "ADD", key, "/f");
    16. component.addOperation("Execute", reg, "ADD", key, "/v", "productId", "/t", "REG_BINARY");
    17.  
    18. // Add a desktop shortcut with icon:
    19. component.addOperation("CreateShortcut", "@TargetDir@\\MyExecutable.exe", "@UserProfile@\\Desktop\\MyExecutable.lnk",
    20. "workingDirectory=@TargetDir@", "iconPath=@TargetDir@\\MyIcon.ico");
    21.  
    22. } catch (e) {
    23.  
    24. print(e);
    25.  
    26. }
    27. }
    To copy to clipboard, switch view to plain text mode 
    All right, but another key I need to write into registry is the package VERSION NUMBER, defined in the installer configuration file config.xml in tag <Version></Version>
    How can I get this value from installscript.qs ? I read --I'd said more: studied-- the docs https://doc-snapshots.qt.io/qtifw-ma...component.html and https://doc-snapshots.qt.io/qtifw-ma...installer.html and I have not found any reference to version, except:
    Qt Code:
    1. boolean versionMatches(string version, string requirement)
    To copy to clipboard, switch view to plain text mode 
    which is useless for me, because you have to know the version, which is precisely what I find.

    So any help would be appreciated.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt Installer Framework - Reading downloaded package version

    I have never tried to use the tool, so this is a wild guess.

    Is the "Version" available through the value() function of either class?

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

    Laureta (9th April 2015)

  4. #3
    Join Date
    Jan 2015
    Location
    Tremp, Spain
    Posts
    14
    Thanks
    6
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Qt Installer Framework - Reading downloaded package version

    Quote Originally Posted by ChrisW67 View Post
    Is the "Version" available through the value() function of either class?
    Finally, I found the way --asking elsewhere:
    Qt Code:
    1. var version = installer.value("ProductVersion");
    To copy to clipboard, switch view to plain text mode 
    As you can see, the variable name (ProductVersion) does not match the Tag name (Version). Is there any quick guide with the config variables accessible from the installation script?

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt Installer Framework - Reading downloaded package version


  6. #5
    Join Date
    Jan 2015
    Location
    Tremp, Spain
    Posts
    14
    Thanks
    6
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Qt Installer Framework - Reading downloaded package version

    I have read this documentation dozens of times without seeing it! Thank You.

Similar Threads

  1. Replies: 1
    Last Post: 11th April 2015, 18:40
  2. Replies: 3
    Last Post: 1st September 2012, 03:41
  3. make installer package
    By babygal in forum Qt Programming
    Replies: 5
    Last Post: 6th June 2011, 07:24
  4. Trojan in Qt 4.7.1 Windows Installer (Non Creator) downloaded from Qt Website
    By Gavin Harper in forum Installation and Deployment
    Replies: 2
    Last Post: 17th November 2010, 22:54
  5. Creating Package Installer
    By AP.Sakkthivel in forum General Programming
    Replies: 3
    Last Post: 18th July 2007, 20:18

Tags for this Thread

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.