本文整理汇总了C++中MirallConfigFile::configFile方法的典型用法代码示例。如果您正苦于以下问题:C++ MirallConfigFile::configFile方法的具体用法?C++ MirallConfigFile::configFile怎么用?C++ MirallConfigFile::configFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MirallConfigFile
的用法示例。
在下文中一共展示了MirallConfigFile::configFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateStateOnStart
NSISUpdater::UpdateState NSISUpdater::updateStateOnStart()
{
MirallConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
QString updateFileName = settings.value(updateAvailableC).toString();
// has the previous run downloaded an update?
if (!updateFileName.isEmpty() && QFile(updateFileName).exists()) {
// did it try to execute the update?
if (settings.value(autoUpdateAttemptedC, false).toBool()) {
// clean up
settings.remove(autoUpdateAttemptedC);
settings.remove(updateAvailableC);
QFile::remove(updateFileName);
if (updateSucceeded()) {
// success: clean up even more
settings.remove(updateTargetVersionC);
settings.remove(autoUpdateFailedVersionC);
return NoUpdate;
} else {
// auto update failed. Set autoUpdateFailedVersion as a hint
// for visual fallback notification
QString targetVersion = settings.value(updateTargetVersionC).toString();
settings.setValue(autoUpdateFailedVersionC, targetVersion);
settings.remove(updateTargetVersionC);
return UpdateFailed;
}
} else {
if (!settings.contains(autoUpdateFailedVersionC)) {
return UpdateAvailable;
}
}
}
return NoUpdate;
}
示例2: updateSucceeded
bool OCUpdater::updateSucceeded() const
{
MirallConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
qint64 targetVersionInt = Helper::stringVersionToInt(settings.value(updateTargetVersionC).toString());
qint64 currentVersion = Helper::currentVersionToInt();
return currentVersion >= targetVersionInt;
}
示例3: slotStartInstaller
void OCUpdater::slotStartInstaller()
{
MirallConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
QString updateFile = settings.value(updateAvailableC).toString();
settings.setValue(autoUpdateAttemptedC, true);
settings.sync();
qDebug() << "Running updater" << updateFile;
QProcess::startDetached(updateFile, QStringList() << "/S" << "/launch");
}
示例4: performUpdate
bool OCUpdater::performUpdate()
{
MirallConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
QString updateFile = settings.value(updateAvailableC).toString();
if (!updateFile.isEmpty() && QFile(updateFile).exists()) {
if (QMessageBox::information(0, tr("New Update Ready"),
tr("A new update is about to be installed. The updater may ask\n"
"for additional privileges during the process."), QMessageBox::Ok)) {
slotStartInstaller();
return true;
}
}
return false;
}
示例5: slotDownloadFinished
void NSISUpdater::slotDownloadFinished()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
if (reply->error() != QNetworkReply::NoError) {
setDownloadState(DownloadFailed);
return;
}
QUrl url(reply->url());
_file->close();
QFile::copy(_file->fileName(), _targetFile);
setDownloadState(DownloadComplete);
qDebug() << "Downloaded" << url.toString() << "to" << _targetFile;
MirallConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
settings.setValue(updateTargetVersionC, updateInfo().version());
settings.setValue(updateAvailableC, _targetFile);
}
示例6: versionInfoArrived
void NSISUpdater::versionInfoArrived(const UpdateInfo &info)
{
MirallConfigFile 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)
{
qDebug() << "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, SIGNAL(readyRead()), SLOT(slotWriteFile()));
connect(reply, SIGNAL(finished()), SLOT(slotDownloadFinished()));
setDownloadState(Downloading);
_file.reset(new QTemporaryFile);
_file->setAutoRemove(true);
_file->open();
}
}
}
}
示例7: slotSetSeenVersion
void NSISUpdater::slotSetSeenVersion()
{
MirallConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
settings.setValue(seenVersionC, updateInfo().version());
}