Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt Installer Framework creating multiple entries in Windows Add or Remove Programs
Forum Updated to NodeBB v4.3 + New Features

Qt Installer Framework creating multiple entries in Windows Add or Remove Programs

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
4 Posts 3 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Allstar12345
    wrote on 4 Jul 2021, 18:27 last edited by
    #1

    Hi guys,

    I have a punched together Qt Installer Framework for my Windows App, it all installs fine and overwrites fine when I update the App but it creates a new entry in the Windows Add or remove programs list on every install; I guess it thinks it's installing a clean copy instead of a replacement.

    This is my installer script:

    var targetDirectoryPage = null;
    
    
    function Component()
    {
        installer.gainAdminRights();
        component.loaded.connect(this, this.installerLoaded);
        installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
    }
    
    Component.prototype.createOperations = function()
    {
        component.createOperations();
    
        if (systemInfo.productType === "windows") {
            component.addOperation("CreateShortcut", "@TargetDir@/sRadioWindows.exe","@AllUsersStartMenuProgramsPath@/sRadio.lnk",
                "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/icon.ico",
                "iconId=2", "description=sRadio Executable");
        }
    }
    
    
    Component.prototype.installerLoaded = function()
    {
        installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);
        installer.addWizardPage(component, "TargetWidget", QInstaller.TargetDirectory);
        targetDirectoryPage = gui.pageWidgetByObjectName("DynamicTargetWidget");
        targetDirectoryPage.windowTitle = "Choose Installation Directory";
        targetDirectoryPage.description.setText("Please select where the sRadio will be installed:");
        targetDirectoryPage.targetDirectory.textChanged.connect(this, this.targetDirectoryChanged);
        targetDirectoryPage.targetDirectory.setText(installer.value("TargetDir"));
        targetDirectoryPage.targetChooser.released.connect(this, this.targetChooserClicked);
        gui.pageById(QInstaller.ComponentSelection).entered.connect(this, this.componentSelectionPageEntered);
    }
    
    Component.prototype.targetChooserClicked = function()
    {
        var dir = QFileDialog.getExistingDirectory("", targetDirectoryPage.targetDirectory.text);
        targetDirectoryPage.targetDirectory.setText(dir);
    }
    
    Component.prototype.targetDirectoryChanged = function()
    {
        var dir = targetDirectoryPage.targetDirectory.text;
        if (installer.fileExists(dir) && installer.fileExists(dir + "/maintenancetool.exe")) {
            targetDirectoryPage.warning.setText("<p style=\"color: red\">Existing installation detected and will be overwritten.</p>");
        }
        else if (installer.fileExists(dir)) {
            targetDirectoryPage.warning.setText("<p style=\"color: red\">Installing in existing directory. It will be wiped on uninstallation.</p>");
        }
        else {
            targetDirectoryPage.warning.setText("");
        }
        installer.setValue("TargetDir", dir);
    }
    
    
    Component.prototype.componentSelectionPageEntered = function()
    {
        var dir = installer.value("TargetDir");
        if (installer.fileExists(dir) && installer.fileExists(dir + "/maintenancetool.exe")) {
            installer.execute(dir + "/maintenancetool.exe", "--script=" + dir + "/scripts/auto_uninstall.qs");
        }
    }
    
    
    
    

    Config.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <Installer>
        <Name>sRadio</Name>
        <Version>1.1.0</Version>
        <Title>sRadio</Title>
        <Publisher>Allstar Software</Publisher>
        <MaintenanceToolName>maintenancetool</MaintenanceToolName>
        <ProductUrl>https://allstarsoftware.co.uk/sradiowindows</ProductUrl>
        <WizardStyle>Aero</WizardStyle>
        <!--  <RunProgram>@TargetDir/sRadioWindows.exe</RunProgram>-->
        <Logo>logo.png</Logo>
        <SupportsModify>true</SupportsModify>
        <DisableAuthorizationFallback>true</DisableAuthorizationFallback>
        <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>
        <!-- Directory name is used in component.xml -->
        <StartMenuDir>sRadio</StartMenuDir>
        <TargetDir>@ApplicationsDir@/AllstarSoftware/sRadio</TargetDir>
        <RepositorySettingsPageVisible>false</RepositorySettingsPageVisible>
    </Installer>
    
    

    Package.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <Package>
        <DisplayName>sRadio</DisplayName>
        <Description>sRadio SHOUTcast Internet radio client</Description>
        <Version>1.1.0-0</Version>
        <ReleaseDate>2021-05-22</ReleaseDate>
        <Default>true</Default>
        <Required>true</Required>
        <Script>installscript.qs</Script>
        <UserInterfaces>
               <UserInterface>targetwidget.ui</UserInterface>
           </UserInterfaces>
    </Package>
    
    

    Untitled.png

    Does anyone know how to prevent it creating a new entry every time?

    Thanks.

    1 Reply Last reply
    1
    • R Offline
      R Offline
      Reddevil1310
      wrote on 16 Jan 2023, 07:49 last edited by
      #2

      I have the same problem. Did you solve this problem?

      A 1 Reply Last reply 5 Feb 2023, 17:33
      0
      • R Reddevil1310
        16 Jan 2023, 07:49

        I have the same problem. Did you solve this problem?

        A Offline
        A Offline
        Allstar12345
        wrote on 5 Feb 2023, 17:33 last edited by
        #3

        @Reddevil1310 said in Qt Installer Framework creating multiple entries in Windows Add or Remove Programs:

        I have the same problem. Did you solve this problem?

        No, I ended up creating my own custom in-App updater that just replaces the files changed where necessary, it's not ideal by any means but it's better than this.

        1 Reply Last reply
        0
        • E Offline
          E Offline
          EndrII 0
          wrote on 15 Feb 2024, 11:13 last edited by
          #4

          I have the same problem too. Somebody found solution ?
          it looks as installer generate new appId when started. How we can freeze appId for our application.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved