Ejemplo n.º 1
0
void MainWindow::startConnection()
{
    Client *client = new Client(this);

    connect(client, SIGNAL(version_checked(QString, QString)), SLOT(checkVersion(QString, QString)));
    connect(client, SIGNAL(error_message(QString)), SLOT(networkError(QString)));
}
Ejemplo n.º 2
0
bool CUpdator::CheckVersion(const CVersion &local, const CVersion &remote)
{
	//check
	bool is_new = remote > local;
	if(is_new)
	{
		//should let user to confirm to do or cancel
		if(!m_confirmed)
		{
			//notify
			Event version_checked(E_CHECKED,(void*)this,0,is_new);
			Notify(version_checked);
			return false;
		}
		//new versioninfo 
		CVersionInfo *pvinfo = 0;
		pvinfo = new CVersionInfo(local,remote);
		m_pverinfo.reset(pvinfo);
		//get remote version url
		tstring rm_path = m_config->GetRemoteVerPath();
		//get local version temp path 
		tstring updatepath = m_config->GetLocalUpdatePath();
		//check the end of path for adding the filename in the end
		if (updatepath.length()>0 && updatepath[updatepath.length()-1] !='\\')
		{
			updatepath += _T("\\");
		}
		//download the new version file
		bool r = m_loader->DownLoad(rm_path,updatepath+rm_path);
		//notify l
		Event loading(E_LOAD_VER,(void*)this,0,r);
		Notify(loading);
		if(!r)
		{
			return false;
		}
		pvinfo->SetUpdateVerPath(updatepath+rm_path);
	}
	else
	{
		//notify
		DWORD noNeed = 2;
		Event version_checked(E_UPDATE_OVER,(void*)this,0,noNeed);
		Notify(version_checked);
	}
	return is_new;
}
Ejemplo n.º 3
0
void Client::checkVersion(const QJsonValue &server_version){
	QString version = server_version.toString();

	QString version_number, mod_name;
	if(version.contains(QChar(':'))){
		QStringList texts = version.split(QChar(':'));
		version_number = texts.value(0);
		mod_name = texts.value(1);
	}else{
		version_number = version;
		mod_name = "official";
	}

	emit version_checked(version_number, mod_name);
}
Ejemplo n.º 4
0
void Client::checkVersion(const QString &server_version){
    emit version_checked(server_version);
}