如何在QT安装程序框架中区分每用户安装和系统范围安装? [英] How to distinguish per-user vs. system-wide installation in QT installer framework?

查看:126
本文介绍了如何在QT安装程序框架中区分每用户安装和系统范围安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个名为pgModeler的应用程序,它的当前版本提供了基于QT安装程序框架的安装程序. Windows上该安装程序的问题在于,它仅按用户安装开始菜单项并且也仅按用户注册应用本身.对于像我这样的人来说,这是一个问题,他们使用显式的admin用户进行系统维护,而使用非admin用户进行日常工作.重要的是,实际上使用了两个不同的用户名(Administratortschoening),而不是Windows的默认行为来限制一个仅使用UAC的用户.

I'm using some app called pgModeler and it's current version provides an installer based on QT installer framework. The problem with that installer on Windows is that it installs start menu entries per-user only and registers the app itself per-user only as well. That's a problem for people like me using an explicit admin-user for system maintenance vs. a non-admin user for daily work. The important thing is that really two different user names are used (Administrator vs. tschoening) instead of Windows' default behaviour to restrict one user using UAC only.

在切换到QT安装程序框架之前,已经使用了Inno Setup,它具有以下概念:

Before switching to QT installer framework, Inno Setup has been used and that has some concept of distinguishing between administrative and system-wide vs. per-user installation. The switch simply was to execute the installer as admin or not, everything else worked automatically and is not the case anymore with QT.

我也发现了用于QT的预定义常量到不同的路径,例如对于开始菜单:

What I did find for QT as well are pre-defined constants to different paths e.g. for the start menu:

UserStartMenuProgramsPath
AllUsersStartMenuProgramsPath

我还没有发现是否有像Inno这样的自动模式?诸如简单的设置,告诉安装程序总是喜欢系统范围的开始菜单和填充,实际上是安装程序能够区分的所有内容.还是开发人员需要自行构建正确的路径?如以下示例所示:

What I did NOT find yet is if there's some automatic mode like Inno provided? Something like a simple setting telling the installer to prefer system-wide start menu and stuff always, really everything which the installer is able to distinguish. Or do developers need to build proper paths on their own? Like in the following example:

component.addOperation("CreateShortcut", "@TargetDir@/pgmodeler.exe", "@StartMenuDir@/pgModeler.lnk"

vs.

component.addOperation("CreateShortcut", "@TargetDir@/pgmodeler.exe", "@AllUsersStartMenuProgramsPath@/@StartMenuDir@/pgModeler.lnk"

对于后者,如何在控制面板中的每个用户和系统范围的Programs and Features之间进行切换?

In the case of the latter, how does one switch between per-user and system-wide Programs and Features in the control panel as well?

谢谢!

推荐答案

可以使用名为AllUsers的设置来完成当前用户和所有用户的安装之间的切换,该设置支持truefalse.重要的事情是在何时何地提供它:一种方法实际上是在使用以下方法调用安装程序时提早实现:

Switching between installation for current and all users can be done using a setting called AllUsers, which supports true and false. The important things are where and when to provide that: One way is really early when invoking the installer using the following:

installer.exe AllUsers=true

这样,用于选择开始菜单组的GUI实际上已经显示了所有用户可用的所有条目,而不仅仅是像以前一样的用户专用开始菜单的条目.另一种方法是在运行时在安装程序上设置值.但重要的是,这也必须在解决路径之前发生.在以下位置可以看到一个示例:

That way the GUI to select a start menu group really already shows all entries available to all users, not only those of the user-private start menu, like has been before. Another way is setting values on the installer at runtime. But it's important that this needs to happen BEFORE paths get resolved as well. An example can be seen at the following place:

function Controller()
{
    [...]
        //store all users and online/offline info
        installer.setValue("allUsers", isAdmin ? "true" : "false");
        installer.setValue("isOffline", installer.isOfflineOnly() ? "true" : "false");
    [...]
}

https://github.com /Skycoder42/QtIFW-Advanced-Setup/blob/master/installer/config/controller.js

这些内容在过去也得到了增强,即使我尚未在文档中找到有关确切含义以及如何使用它的任何解释.

These things have been enhanced in the past as well, even though I didn't find any explanation about what exactly and how to use it in the docs yet.

https://bugreports.qt.io/browse/QTIFW-124

此外,该软件未在Programs and Features中正确注册,它仅以管理员身份出现:

Additionally, the software is not properly registered in Programs and Features, it only occurs admin-only:

这篇关于如何在QT安装程序框架中区分每用户安装和系统范围安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆