本文整理汇总了C++中Version::truncate方法的典型用法代码示例。如果您正苦于以下问题:C++ Version::truncate方法的具体用法?C++ Version::truncate怎么用?C++ Version::truncate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Version
的用法示例。
在下文中一共展示了Version::truncate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: build
void LibreOffice::build(NSIS *installer, Version version)
{
isError = false;
download(version);
if (!isError) {
QStringList files(tempFiles);
QStringList msiOptions("ADDLOCAL=ALL");
QStringList removeComponents;
if (!getConfig("Use automatic update", true).toBool()) {
removeComponents << "gm_o_Onlineupdate";
}
if (!removeComponents.isEmpty()) {
msiOptions << "REMOVE=" + removeComponents.join(",");
}
msiOptions << QString("CREATEDESKTOPLINK=%1").arg(getConfig("Desktop shortcut", false).toBool());
msiOptions << QString("QUICKSTART=%1").arg(getConfig("Enable Quickstarter by default", false).toBool());
qDebug() << "MSI options:" << msiOptions;
QString src(loadResource(":NSIS/LibreOffice/main.nsh"));
src.replace("${MsiFile}", QFileInfo(tempFiles.first()).fileName());
src.replace("${MsiOptions}", msiOptions.join(" "));
// Use configuration template if configured
QString configTemplate(getConfig("Configuration template").toString());
if (!configTemplate.isEmpty()) {
QFileInfo file(configTemplate);
if (file.isReadable()) {
files << configTemplate;
src += loadResource(":NSIS/LibreOffice/configtemplate.nsh")
.replace("${ConfigTemplate}", file.fileName())
.replace("${ShortVersion}", version.truncate(2))
;
} else {
Application::critical(tr("The configuration template '%1' cannot be read.").arg(configTemplate));
isError = true;
}
}
if (!isError) {
installer->build(
objectName(),
getOutputFile(),
NSIS::Zlib,
800,
QStringList() << "soffice.exe" << "soffice.bin",
files,
src
);
}
}
cleanup();
}
示例2: build
void AdobeReader::build(NSIS *installer, Version version)
{
isError = false;
download(version);
if (!isError) {
// Compose options for msiexec command line
QStringList msiOptions;
if (getConfig("Suppress reboot", false).toBool()) {
msiOptions << "REBOOT=ReallySuppress";
}
if (getConfig("Accept EULA", false).toBool()) {
msiOptions << "EULA_ACCEPT=YES";
}
if (!getConfig("Desktop shortcut", true).toBool()) {
msiOptions << "DISABLEDESKTOPSHORTCUT=1";
}
if (getConfig("Set default PDF viewer", false).toBool()) {
msiOptions << "IW_DEFAULT_VERB=READ";
msiOptions << "LEAVE_PDFOWNERSHIP=NO";
} else {
msiOptions << "LEAVE_PDFOWNERSHIP=YES";
}
if (!getConfig("Install synchronizer", true).toBool()) {
msiOptions << "SYNCHRONIZER=NO";
}
if (!getConfig("Use automatic update", true).toBool()) {
msiOptions << "DISABLE_ARM_SERVICE_INSTALL=1";
}
qDebug() << "MSI options:" << msiOptions;
// Compose main installation routine
Version msiVersion(version.truncate(2).pad(2));
QString src(loadResource(":NSIS/AdobeReader/main.nsh"));
src.replace("${VersionMajor}", msiVersion.part(1));
src.replace("${VersionMinor}", msiVersion.part(2));
src.replace("${MsiFile}", QFileInfo(msiFile).fileName());
src.replace("${MsiOptions}", msiOptions.join(" "));
// Compose patch installation if necessary
QString header;
if (!mspFiles.isEmpty()) {
header = loadResource(":NSIS/AdobeReader/header.nsh");
QPair<Version, QString> mspFile;
foreach (mspFile, mspFiles) {
src += loadResource(":NSIS/AdobeReader/installpatch.nsh")
.replace("${MspVersion}", mspFile.first)
.replace("${MspFile}", QFileInfo(mspFile.second).fileName())
;
}