Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt installer framework: remove radio buttons from uninstaller

I have created a simple installer for our product with only 1 component and no remote repositories manager.

When I start the uninstaller, the introduction page shows 3 radio buttons:

  • Package manager

  • Update components

  • Remove all components

I need only the third one, so I checked this documentation:

http://doc-snapshot.qt-project.org/qtifw-master/noninteractive.html

As I have understood and being unable to hide the buttons, I added this to my install.qs file:

function Controller()
{
}

Controller.prototype.IntroductionPageCallback = function()
{
    gui.clickButton(buttons.NextButton);
}

This should auto-click Next on the introduction page so it should go directly to the uninstall page.

Nothing happens, what ever I write in the Controller functions, the introduction page shows the 3 radio buttons. I added some messagebox in the function and they are never called.

Somebody knows how to solve it ?

like image 304
marco Avatar asked Dec 04 '14 09:12

marco


1 Answers

I think I have 2 working solutions.

First solution, if you want to have a single page uninstaller:

You need to create a Controller like the one you started before:

function Controller() {
    if (installer.isUninstaller()) {
        installer.setDefaultPageVisible(QInstaller.Introduction, false);
        installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
        installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
    }
}

This will disable all pages in the classic install/uninstall workflow. Make sure to check you're in uninstall mode.

If you want a 2 pages uninstaller:

function Controller()
{

}

Controller.prototype.IntroductionPageCallback = function()
{
    if (installer.isUninstaller()) {
        // Get the current wizard page
        var widget = gui.currentPageWidget(); 
        if (widget != null) {
            // Don't show buttons because we just want to uninstall the software
            widget.findChild("PackageManagerRadioButton").visible = false;
            widget.findChild("UpdaterRadioButton").visible = false;
            widget.findChild("UninstallerRadioButton").visible = false;
        }
    }
}

Bonus

In installer mode, select by default "I accept" the Licence Agreement. Seriously, who doesn't?

Controller.prototype.LicenseAgreementPageCallback = function()
{
    var widget = gui.currentPageWidget();
    if (widget != null) {
        widget.AcceptLicenseRadioButton.checked = true;
    }
}
like image 138
MBach Avatar answered Nov 07 '22 22:11

MBach