Exemple #1
0
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();
}
Exemple #3
0
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();
}
Exemple #5
0
void Application::onUpdateReady() {
	if (updateDownloader) {
		updateDownloader->deleteLater();
		updateDownloader = 0;
	}
	updateCheckTimer.stop();

	cSetLastUpdateCheck(unixtime());
	App::writeConfig();
}
Exemple #6
0
void Application::onUpdateFailed() {
	if (updateDownloader) {
		updateDownloader->deleteLater();
		updateDownloader = 0;
		if (updateThread) updateThread->quit();
		updateThread = 0;
	}

	cSetLastUpdateCheck(unixtime());
	App::writeConfig();
}
Exemple #7
0
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();
	}
}
Exemple #8
0
void SettingsInner::onCheckNow() {
	if (!cAutoUpdate()) return;

	cSetLastUpdateCheck(0);
	App::app()->startUpdateCheck();
}