void Application::updateGotCurrent() { if (!updateReply || updateThread) return; cSetLastUpdateCheck(unixtime()); QRegularExpressionMatch m = QRegularExpression(qsl("^\\s*(\\d+)\\s*:\\s*([\\x21-\\x7f]+)\\s*$")).match(QString::fromUtf8(updateReply->readAll())); if (m.hasMatch()) { int32 currentVersion = m.captured(1).toInt(); if (currentVersion > AppVersion) { updateThread = new QThread(); connect(updateThread, SIGNAL(finished()), updateThread, SLOT(deleteLater())); updateDownloader = new PsUpdateDownloader(updateThread, m.captured(2)); updateThread->start(); } } if (updateReply) updateReply->deleteLater(); updateReply = 0; if (!updateThread) { QDir updates(cWorkingDir() + "tupdates"); if (updates.exists()) { QFileInfoList list = updates.entryInfoList(QDir::Files); for (QFileInfoList::iterator i = list.begin(), e = list.end(); i != e; ++i) { if (QRegularExpression("^(tupdate|tmacupd|tlinuxupd|tlinux32upd)\\d+$", QRegularExpression::CaseInsensitiveOption).match(i->fileName()).hasMatch()) { QFile(i->absoluteFilePath()).remove(); } } } emit updateLatest(); } startUpdateCheck(true); App::writeConfig(); }
void UpdateStateRow::onCheck() { if (!cAutoUpdate()) return; setState(State::Check); cSetLastUpdateCheck(0); Sandbox::startUpdateCheck(); }
bool Application::onAppUpdateFail() { updateRequestId = 0; cSetLastUpdateCheck(unixtime()); App::writeConfig(); startUpdateCheck(); return true; }
void UpdateStateRow::onCheck() { if (!cAutoUpdate()) return; Core::UpdateChecker checker; setState(State::Check); cSetLastUpdateCheck(0); checker.start(); }
void Application::onUpdateReady() { if (updateDownloader) { updateDownloader->deleteLater(); updateDownloader = 0; } updateCheckTimer.stop(); cSetLastUpdateCheck(unixtime()); App::writeConfig(); }
void Application::onUpdateFailed() { if (updateDownloader) { updateDownloader->deleteLater(); updateDownloader = 0; if (updateThread) updateThread->quit(); updateThread = 0; } cSetLastUpdateCheck(unixtime()); App::writeConfig(); }
void Application::onAppUpdate(const MTPhelp_AppUpdate &response) { updateRequestId = 0; cSetLastUpdateCheck(unixtime()); App::writeConfig(); if (response.type() == mtpc_help_noAppUpdate) { startUpdateCheck(); } else { updateThread = new QThread(); updateDownloader = new PsUpdateDownloader(updateThread, response.c_help_appUpdate()); updateThread->start(); } }
void SettingsInner::onCheckNow() { if (!cAutoUpdate()) return; cSetLastUpdateCheck(0); App::app()->startUpdateCheck(); }