xvno / blog

个人博客, 不定期发布技术笔记和个人随笔.
0 stars 0 forks source link

Qt: Installer Framework: Controller Scripting #69

Open xvno opened 4 years ago

xvno commented 4 years ago

Predefined Installer Pages, 预定义的安装程序页面组

xvno commented 4 years ago

Introduction Page

编写 Controller.prototype.IntroductionPageCallback() 这个方法来和 说明页 交互

Buttons

ErrorLabel Displays an error message.
NextButton '...'
CancelButton '...'

Widgets

ErrorLabel Displays an error message.
MessageLabel Displays a message. By default, it displays the "Welcome to the  Setup Wizard" message.
InformationLabel Displays progress information.

Radio Buttons

Radio Buttons Brief Description
PackageManagerRadioButton The package manager radio button shown on the page while running as maintenance tool.
UpdaterRadioButton The updater radio button shown on the page while running as maintenance tool.
UninstallerRadioButton The uninstaller radio button shown on the page while running as maintenance tool. Selected by default.

Progress Bar

Progress Bar Brief Description
InformationProgressBar The progress bar shown while fetching remote packages.

Qt Core Feature

Qt Core Feature Brief Description
packageManagerCoreTypeChanged() Connect to this signal if you want to be notified when the type of maintenance tool changes. Note: The signal is only emitted when the user has started the binary as so called maintenance tool (after the installation) and switches between the radio buttons.
function Controller () {
}

Controller.prototype.IntroductionPageCallback = function () {
    var widget = gui.currentPageWidget(); // get the current wizard page
    if (widget != null) {
        widget.title = "New title."; // set the page title
        widget.MessageLabel.setText("New Message."); // set the welcome text
    }
}

Controller.prototype.TargetDirectoryPageCallback = function () {
    gui.clickButton(buttons.NextButton); // automatically click the Next button
}
function Controller () {
    var widget = gui.pageById(QInstaller.Introduction); // get the introduction wizard page
    if (widget != null)
        widget.packageManagerCoreTypeChanged.connect(onPackageManagerCoreTypeChanged);
}

onPackageManagerCoreTypeChanged = function () {
    console.log("Is Updater: " + installer.isUpdater());
    console.log("Is Uninstaller: " + installer.isUninstaller());
    console.log("Is Package Manager: " + installer.isPackageManager());
}
xvno commented 4 years ago

License Agreement Page

编写这个函数来与widgets交互 Controller.prototype.LicenseAgreementPageCallback()

Buttons

Button Description
NextButton '...'
CancelButton '...'
BackButton '...'

Widgets

Widgets Brief Description
LicenseListWidget Lists the available licenses.
LicenseTextBrowser Shows the content of the selected license file.
AcceptLicenseLabel Shows the text next to the accept license radio button.
RejectLicenseLabel Shows the text next to the reject license radio button.

Radio Buttons

Radio Buttons Brief Description
AcceptLicenseRadioButton Accepts the license agreement.
RejectLicenseRadioButton Rejects the license agreement. Selected by default.
xvno commented 4 years ago

Component Selection Page

编写函数 Controller.prototype.ComponentSelectionPageCallback()

Wizard buttons:

Button Description

NextButton CancelButton BackButton

Methods

Methods Brief Description
selectAll() Selects all available packages if possible.
deselectAll() Deselects all available packages if possible.
selectDefault() Resets the checked state of available packages to their initial state.
selectComponent(id) Selects the package with id (string).
deselectComponent(id) Deselects the package with id (string).

Push Buttons

Push Buttons Brief Description
SelectAllComponentsButton Selects all available packages if possible.
DeselectAllComponentsButton Deselects all available packages if possible.
SelectDefaultComponentsButton Resets the checked state of available packages to their initial state.
ResetComponentsButton Resets to already installed components.
xvno commented 4 years ago

Start Menu Directory Page

Wizard buttons:

Button Description

NextButton CancelButton BackButton

Widgets

Widgets Brief Description
StartMenuPathLineEdit Shows the directory where to create the program's shortcut.
xvno commented 4 years ago

Ready for Installation Page

Implement the Controller.prototype.ReadyForInstallationPageCallback() function to interact with widgets on the ready for installation page.

Wizard buttons:

Wizard button Desc

CommitButton CancelButton BackButton

Widgets

Widgets Brief Description
MessageLabel Displays a message.
TaskDetailsBrowser Displays some more detailed information about the installation.
xvno commented 4 years ago

Perform Installation Page

Implement the Controller.prototype.PerformInstallationPageCallback() function to interact with widgets on the perform installation page.

Wizard buttons:

Wizard Button Description

CommitButton CancelButton

xvno commented 4 years ago

Finished Page

Implement the Controller.prototype.FinishedPageCallback() function to interact with widgets on the installation finished page.

Wizard buttons:

Wizard button Description

CommitButton CancelButton FinishButton

Widgets

Widgets Brief Description
MessageLabel Displays a message.
RunItCheckBox Text field that informs users that they can start an application after the installation process has finished.