Пример #1
0
void FvUpdater::httpFeedDownloadFinished()
{
	if (m_httpRequestAborted) {
		m_reply->deleteLater();
		return;
	}

	QVariant redirectionTarget = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
	if (m_reply->error()) {

		// Error.
		showErrorDialog(tr("Feed download failed: %1.").arg(m_reply->errorString()), false);

	} else if (! redirectionTarget.isNull()) {
		QUrl newUrl = m_feedURL.resolved(redirectionTarget.toUrl());

		m_feedURL = newUrl;
		m_reply->deleteLater();

		startDownloadFeed(m_feedURL);
		return;

	} else {

		// Done.
		xmlParseFeed();

	}

	m_reply->deleteLater();
	m_reply = 0;
}
Пример #2
0
void FvUpdater::httpFeedDownloadFinished()
{
	if (m_httpRequestAborted) {
		m_reply->deleteLater();
		return;
	}

	QVariant redirectionTarget = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
	if (m_reply->error()) {

    qDebug() << " error value " << m_reply->error();
		// Error.
        showErrorDialog(tr("Updates are unable to detect: %1.").arg(m_reply->errorString()), NO_UPDATE_MESSAGE);
    emit updatesDownloaded(false);

	} else if (! redirectionTarget.isNull()) {
		QUrl newUrl = m_feedURL.resolved(redirectionTarget.toUrl());

		m_feedURL = newUrl;
		m_reply->deleteLater();

		startDownloadFeed(m_feedURL);
		return;

	} else {

		// Done.
		xmlParseFeed();
    emit updatesDownloaded(true);

	}

	m_reply->deleteLater();
	m_reply = 0;
}
Пример #3
0
bool FvUpdater::CheckForUpdates(bool silentAsMuchAsItCouldGet)
{
	if (m_feedURL.isEmpty()) {
		qCritical() << "Please set feed URL via setFeedURL() before calling CheckForUpdates().";
		return false;
	}

	m_silentAsMuchAsItCouldGet = silentAsMuchAsItCouldGet;

	// Check if application's organization name and domain are set, fail otherwise
	// (nowhere to store QSettings to)
	if (QApplication::organizationName().isEmpty()) {
		qCritical() << "QApplication::organizationName is not set. Please do that.";
		return false;
	}
	if (QApplication::organizationDomain().isEmpty()) {
		qCritical() << "QApplication::organizationDomain is not set. Please do that.";
		return false;
	}

	// Set application name / version is not set yet
	if (QApplication::applicationName().isEmpty()) {
		QString appName = QString::fromUtf8(FV_APP_NAME);
		qWarning() << "QApplication::applicationName is not set, setting it to '" << appName << "'";
		QApplication::setApplicationName(appName);
	}
	if (QApplication::applicationVersion().isEmpty()) {
		QString appVersion = QString::fromUtf8(FV_APP_VERSION);
		qWarning() << "QApplication::applicationVersion is not set, setting it to '" << appVersion << "'";
		QApplication::setApplicationVersion(appVersion);
	}

	cancelDownloadFeed();
	m_httpRequestAborted = false;
	startDownloadFeed(m_feedURL);

	return true;
}
Пример #4
0
bool FvUpdater::CheckForUpdates(bool silentAsMuchAsItCouldGet)
{
	if (m_feedURL.isEmpty()) {
		qCritical() << "Please set feed URL via setFeedURL() before calling CheckForUpdates().";
		return false;
	}

	m_silentAsMuchAsItCouldGet = silentAsMuchAsItCouldGet;

	// Check if application's organization name and domain are set, fail otherwise
	// (nowhere to store QSettings to)
	if (QCoreApplication::organizationName().isEmpty()) {
		qCritical() << "QCoreApplication::organizationName is not set. Please do that.";
		return false;
	}
	if (QCoreApplication::organizationDomain().isEmpty()) {
		qCritical() << "QCoreApplication::organizationDomain is not set. Please do that.";
		return false;
	}

	if(QCoreApplication::applicationName().isEmpty()) {
		qCritical() << "QCoreApplication::applicationName is not set. Please do that.";
		return false;
	}

	// Set application version is not set yet
	if (QCoreApplication::applicationVersion().isEmpty()) {
		qCritical() << "QCoreApplication::applicationVersion is not set. Please do that.";
		return false;
	}

	cancelDownloadFeed();
	m_httpRequestAborted = false;
	startDownloadFeed(m_feedURL);

	return true;
}
Пример #5
0
bool QUPDUpdater::checkForUpdates(bool silentMode)
{
    bool canCheck = true;
    if (_feedURL.isEmpty()) {
        qCritical() << "Please set feed URL via setFeedURL() before calling CheckForUpdates().";
        canCheck = false;
    } else if (QApplication::organizationName().isEmpty()) {
        qCritical() << "QApplication::organizationName is not set. Please do that.";
        canCheck = false;
    } else if (QApplication::organizationDomain().isEmpty()) {
        qCritical() << "QApplication::organizationDomain is not set. Please do that.";
        canCheck = false;
    }

    if (canCheck) {
        _silentMode = silentMode;
        // Set application name / version is not set yet
        if (QApplication::applicationName().isEmpty()) {
            QString appName = qApp->applicationName();
            qWarning() << "QApplication::applicationName is not set, setting it to '" << appName << "'";
            QApplication::setApplicationName(appName);
        }

        if (QApplication::applicationVersion().isEmpty()) {
            QString appVersion = qApp->applicationVersion();
            qWarning() << "QApplication::applicationVersion is not set, setting it to '" << appVersion << "'";
            QApplication::setApplicationVersion(appVersion);
        }

        cancelDownloadFeed();
        _feedHttpRequestAborted = false;
        startDownloadFeed();
        canCheck = true;
    }

    return canCheck;
}