当前位置: 首页>>代码示例>>C++>>正文


C++ MirallConfigFile::configFile方法代码示例

本文整理汇总了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;
}
开发者ID:VincentvgNn,项目名称:mirall,代码行数:34,代码来源:ocupdater.cpp

示例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;
}
开发者ID:VincentvgNn,项目名称:mirall,代码行数:9,代码来源:ocupdater.cpp

示例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");
}
开发者ID:VincentvgNn,项目名称:mirall,代码行数:10,代码来源:ocupdater.cpp

示例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;
}
开发者ID:VincentvgNn,项目名称:mirall,代码行数:15,代码来源:ocupdater.cpp

示例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);
}
开发者ID:VincentvgNn,项目名称:mirall,代码行数:18,代码来源:ocupdater.cpp

示例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();
            }
        }
    }
}
开发者ID:VincentvgNn,项目名称:mirall,代码行数:36,代码来源:ocupdater.cpp

示例7: slotSetSeenVersion

void NSISUpdater::slotSetSeenVersion()
{
    MirallConfigFile cfg;
    QSettings settings(cfg.configFile(), QSettings::IniFormat);
    settings.setValue(seenVersionC, updateInfo().version());
}
开发者ID:VincentvgNn,项目名称:mirall,代码行数:6,代码来源:ocupdater.cpp


注:本文中的MirallConfigFile::configFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。