本文整理汇总了C++中ConfigFile::configFile方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigFile::configFile方法的具体用法?C++ ConfigFile::configFile怎么用?C++ ConfigFile::configFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigFile
的用法示例。
在下文中一共展示了ConfigFile::configFile方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateStateOnStart
NSISUpdater::UpdateState NSISUpdater::updateStateOnStart()
{
ConfigFile 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: 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();
}
}
}
}
示例3: updateSucceeded
bool OCUpdater::updateSucceeded() const
{
ConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
qint64 targetVersionInt = Helper::stringVersionToInt(settings.value(updateTargetVersionC).toString());
qint64 currentVersion = Helper::currentVersionToInt();
return currentVersion >= targetVersionInt;
}
示例4: slotStartInstaller
void OCUpdater::slotStartInstaller()
{
ConfigFile 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");
}
示例5: settings
std::unique_ptr<QSettings> Account::settingsWithGroup(const QString& group, QObject *parent)
{
if (_configFileName.isEmpty()) {
// cache file name
ConfigFile cfg;
_configFileName = cfg.configFile();
}
std::unique_ptr<QSettings> settings(new QSettings(_configFileName, QSettings::IniFormat, parent));
settings->beginGroup(group);
return settings;
}
示例6: settings
std::unique_ptr<QSettings> Utility::settingsWithGroup(const QString& group, QObject *parent)
{
if (g_configFileName()->isEmpty()) {
// cache file name
ConfigFile cfg;
*g_configFileName() = cfg.configFile();
}
std::unique_ptr<QSettings> settings(new QSettings(*g_configFileName(), QSettings::IniFormat, parent));
settings->beginGroup(group);
return settings;
}
示例7: performUpdate
bool OCUpdater::performUpdate()
{
ConfigFile 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;
}
示例8: performUpdate
bool OCUpdater::performUpdate()
{
ConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
QString updateFile = settings.value(updateAvailableC).toString();
if (!updateFile.isEmpty() && QFile(updateFile).exists()
&& !updateSucceeded() /* Someone might have run the updater manually between restarts */ ) {
const QString name = Theme::instance()->appNameGUI();
if (QMessageBox::information(0, tr("New %1 Update Ready").arg(name),
tr("A new update for %1 is about to be installed. The updater may ask\n"
"for additional privileges during the process.").arg(name), QMessageBox::Ok)) {
slotStartInstaller();
return true;
}
}
return false;
}
示例9: 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;
ConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
settings.setValue(updateTargetVersionC, updateInfo().version());
settings.setValue(updateAvailableC, _targetFile);
}
示例10: settings
ShibbolethWebView::ShibbolethWebView(AccountPtr account, QWidget* parent)
: QWebView(parent)
, _account(account)
, _accepted(false)
, _cursorOverriden(false)
{
// no minimize
setWindowFlags(Qt::Dialog);
setAttribute(Qt::WA_DeleteOnClose);
QWebPage* page = new QWebPage(this);
connect(page, SIGNAL(loadStarted()),
this, SLOT(slotLoadStarted()));
connect(page, SIGNAL(loadFinished(bool)),
this, SLOT(slotLoadFinished(bool)));
// Make sure to accept the same SSL certificate issues as the regular QNAM we use for syncing
QObject::connect(page->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
_account.data(), SLOT(slotHandleSslErrors(QNetworkReply*,QList<QSslError>)));
// The Account keeps ownership of the cookie jar, it must outlive this webview.
account->lendCookieJarTo(page->networkAccessManager());
connect(page->networkAccessManager()->cookieJar(),
SIGNAL(newCookiesForUrl (QList<QNetworkCookie>, QUrl)),
this, SLOT(onNewCookiesForUrl (QList<QNetworkCookie>, QUrl)));
page->mainFrame()->load(account->url());
this->setPage(page);
setWindowTitle(tr("%1 - Authenticate").arg(Theme::instance()->appNameGUI()));
// If we have a valid cookie, it's most likely expired. We can use this as
// as a criteria to tell the user why the browser window pops up
QNetworkCookie shibCookie = ShibbolethCredentials::findShibCookie(_account.data(), ShibbolethCredentials::accountCookies(_account.data()));
if (shibCookie != QNetworkCookie()) {
Logger::instance()->postOptionalGuiLog(tr("Reauthentication required"), tr("Your session has expired. You need to re-login to continue to use the client."));
}
ConfigFile config;
QSettings settings(config.configFile());
resize(900, 700); // only effective the first time, later overridden by restoreGeometry
restoreGeometry(settings.value(ShibbolethWebViewGeometryC).toByteArray());
}
示例11: slotSetSeenVersion
void NSISUpdater::slotSetSeenVersion()
{
ConfigFile cfg;
QSettings settings(cfg.configFile(), QSettings::IniFormat);
settings.setValue(seenVersionC, updateInfo().version());
}