QString OCUpdater::statusString() const { QString updateVersion = _updateInfo.version(); switch (downloadState()) { case Downloading: return tr("Downloading version %1. Please wait...").arg(updateVersion); case DownloadComplete: return tr("Version %1 available. Restart application to start the update.").arg(updateVersion); case DownloadFailed: return tr("Could not download update. Please click <a href='%1'>here</a> to download the update manually.").arg(_updateInfo.web()); case DownloadTimedOut: return tr("Could not check for new updates."); case UpdateOnlyAvailableThroughSystem: return tr("New version %1 available. Please use the system's update tool to install it.").arg(updateVersion); case CheckingServer: return tr("Checking update server..."); case Unknown: return tr("Update status is unknown: Did not check for new updates."); case UpToDate: // fall through default: return tr("No updates available. Your installation is at the latest version."); } }
static void debugDownloadState(WRT::Download * download) { int num = intAttribute(download, WRT::State); const char * state = downloadState(num); debugDownloadAttribute(download, "DownloadState", state); }
void OCUpdater::backgroundCheckForUpdate() { int dlState = downloadState(); // do the real update check depending on the internal state of updater. switch (dlState) { case Unknown: case UpToDate: case DownloadFailed: case DownloadTimedOut: qCInfo(lcUpdater) << "Checking for available update"; checkForUpdate(); break; case DownloadComplete: qCInfo(lcUpdater) << "Update is downloaded, skip new check."; break; case UpdateOnlyAvailableThroughSystem: qCInfo(lcUpdater) << "Update is only available through system, skip check."; break; } }