Hi,

i was just searching for an Controller example, that's why i didn't answer that question more specific.

On 25.03.2014 12:12, Sandeep wrote:

Hi,

Question2: What is the difference between "function Component" and "function Controller" in the installer.qs scripts used in examples? Basically what are they? I tried registering for the IntroductionPageCallback but never got called.

function Component()

{

}

Component.prototype.IntroductionPageCallback=function()

{

}

Or?

function Controller()

{

}

Controller.prototype.IntroductionPageCallback = function()

{

}

Neither of them worked for me, Callbacks are not even called. what is the correct way to get a callback?


Here we go, your script could look like the following and you need to call your installer that way:

your_installer --script your_script.qs

var installerTargetDirectory="c:\\auto-test-installation";

function Controller()
{
    installer.autoRejectMessageBoxes;
installer.setMessageBoxAutomaticAnswer( "OverwriteTargetDirectory", QMessageBox.Yes);
    //maybe we want something like this
//installer.execute("D:\\cleanup_directory.bat", new Array(installerTargetDirectory)); installer.setMessageBoxAutomaticAnswer( "stopProcessesForUpdates", QMessageBox.Ignore);
}

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

Controller.prototype.TargetDirectoryPageCallback = function()
{
    var page = gui.pageWidgetByObjectName("TargetDirectoryPage");
page.TargetDirectoryLineEdit.setText(installerTargetDirectory);
    gui.clickButton(buttons.NextButton);
}

Controller.prototype.ComponentSelectionPageCallback = function()
{
}

Controller.prototype.LicenseAgreementPageCallback = function() {}
Controller.prototype.StartMenuDirectoryPageCallback = function() {}
Controller.prototype.ReadyForInstallationPageCallback = function() {}
Controller.prototype.PerformInstallationPageCallback = function(){}
Controller.prototype.FinishedPageCallback = function() {}

In my last response I forgot to tell that there is a global "gui" object as well. So to sum it up, depending on your needs you need to use the global objects and either connect them, call some functions or just access member like the status enums. Basically all Q_PROPERTY, Q_INVOKABLE , SIGNALS and SLOTS should be available from inside the scripts.

Thanks for responding at length for each of my questions. And btw, you explained me the difference between component and controller, but could you also answer for me why are my callbacks not getting called. Would it be possible to help me with a bare minimal script showing how to get callbacks.

I am coming up with more questions in my subsequent mails, hope to get similar support.

Thanks in advance,

-Sandeep


-- Karsten
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to