本文整理汇总了C++中UpdateInfo::version方法的典型用法代码示例。如果您正苦于以下问题:C++ UpdateInfo::version方法的具体用法?C++ UpdateInfo::version怎么用?C++ UpdateInfo::version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UpdateInfo
的用法示例。
在下文中一共展示了UpdateInfo::version方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: versionInfoArrived
void NSISUpdater::versionInfoArrived(const UpdateInfo &info)
{
ConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
qint64 infoVersion = Helper::stringVersionToInt(info.version());
qint64 seenVersion = Helper::stringVersionToInt(settings.value(seenVersionC).toString());
qint64 currVersion = Helper::currentVersionToInt();
if (info.version().isEmpty()
|| infoVersion <= currVersion
|| infoVersion <= seenVersion) {
qCInfo(lcUpdater) << "Client is on latest version!";
setDownloadState(UpToDate);
} else {
QString url = info.downloadUrl();
qint64 autoUpdateFailedVersion =
Helper::stringVersionToInt(settings.value(autoUpdateFailedVersionC).toString());
if (url.isEmpty() || _showFallbackMessage || infoVersion == autoUpdateFailedVersion) {
showDialog(info);
}
if (!url.isEmpty()) {
_targetFile = cfg.configPath() + url.mid(url.lastIndexOf('/'));
if (QFile(_targetFile).exists()) {
setDownloadState(DownloadComplete);
} else {
QNetworkReply *reply = qnam()->get(QNetworkRequest(QUrl(url)));
connect(reply, &QIODevice::readyRead, this, &NSISUpdater::slotWriteFile);
connect(reply, &QNetworkReply::finished, this, &NSISUpdater::slotDownloadFinished);
setDownloadState(Downloading);
_file.reset(new QTemporaryFile);
_file->setAutoRemove(true);
_file->open();
}
}
}
}
示例2: versionInfoArrived
void PassiveUpdateNotifier::versionInfoArrived(const UpdateInfo &info)
{
if( info.version().isEmpty() ||
Helper::stringVersionToInt(info.version())
>= Helper::currentVersionToInt() )
{
qDebug() << "Client is on latest version!";
setDownloadState(UpToDate);
} else {
setDownloadState(UpdateOnlyAvailableThroughSystem);
}
}
示例3: QVariant
/**
\todo document this function
*/
QDomElement GCF::UpdateInfo::toDomElement(QDomDocument doc, bool forThisSystem) const
{
QDomElement updateE = doc.createElement("Update");
QDomElement nameE = doc.createElement("Name");
nameE.appendChild( doc.createTextNode(d->name) );
updateE.appendChild(nameE);
QDomElement titleE = doc.createElement("Title");
titleE.appendChild( doc.createTextNode(d->title) );
updateE.appendChild(titleE);
QDomElement sourceE = doc.createElement("Source");
sourceE.appendChild( doc.createTextNode(d->source) );
updateE.appendChild(sourceE);
QDomElement iconE = doc.createElement("Icon");
iconE.appendChild( doc.createTextNode(d->iconUrl.toString()) );
updateE.appendChild(iconE);
QDomElement typeE = doc.createElement("Type");
typeE.appendChild( doc.createTextNode(d->type) );
updateE.appendChild(typeE);
QDomElement forceInstallE = doc.createElement("ForceInstall");
forceInstallE.appendChild( doc.createTextNode( QVariant(d->forceInstall).toString() ) );
updateE.appendChild(forceInstallE);
QDomElement descE = doc.createElement("Description");
descE.appendChild( doc.createCDATASection(d->description) );
updateE.appendChild(descE);
QDomElement releaseE = doc.createElement("Release");
releaseE.appendChild( doc.createTextNode(d->release.toString()) );
updateE.appendChild(releaseE);
QDomElement versionE = doc.createElement("Version");
versionE.appendChild( doc.createTextNode(d->version) );
updateE.appendChild(versionE);
QList<UpdateFileInfo> ufiList;
if( forThisSystem )
{
UpdateFileInfo fileInfo = updateFileForThisSystem();
ufiList.append(fileInfo);
}
else
ufiList = d->updateFiles;
for(int j=0; j<ufiList.count(); j++)
{
UpdateFileInfo ufi = ufiList[j];
QDomElement updateFileE = doc.createElement("UpdateFile");
updateE.appendChild(updateFileE);
updateFileE.setAttribute("OS", ufi.OS);
updateFileE.setAttribute("Arch", ufi.Arch);
updateFileE.appendChild( doc.createTextNode(ufi.UpdateFileURL.toString()) );
}
const QList<UpdateInfo>& deps = d->dependencies;
for(int j=0; j<deps.count(); j++)
{
UpdateInfo dep = deps[j];
QString depStr = QString("%1 [%2]").arg( dep.name() ).arg( dep.version() );
QDomElement dependsOnE = doc.createElement("DependsOn");
dependsOnE.appendChild( doc.createTextNode(depStr) );
updateE.appendChild(dependsOnE);
}
return updateE;
}