Changed: Profiles update
--HG-- branch : develop
This commit is contained in:
parent
c1d471cb19
commit
0d65dea8ba
2 changed files with 93 additions and 3 deletions
|
@ -196,9 +196,98 @@ void COperationDialog::processUpdateProfilesNextStep()
|
|||
// TODO: create shortcuts
|
||||
}
|
||||
|
||||
void COperationDialog::processInstallNextStep()
|
||||
QStringList serversToUpdate;
|
||||
QStringList profilesToDelete;
|
||||
|
||||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
// append all old profiles
|
||||
foreach(const CProfile &profile, config->getBackupProfiles())
|
||||
{
|
||||
// TODO: implement
|
||||
if (QFile::exists(profile.getDirectory())) profilesToDelete << profile.id;
|
||||
}
|
||||
|
||||
const CServer &defaultServer = config->getServer();
|
||||
|
||||
foreach(const CProfile &profile, config->getProfiles())
|
||||
{
|
||||
const CServer &server = config->getServer(profile.server);
|
||||
|
||||
QString serverDirectory = server.getDirectory();
|
||||
|
||||
// check if Ryzom is installed in new server directory
|
||||
if (server.id != defaultServer.id && !config->isRyzomInstalledIn(serverDirectory) && serversToUpdate.indexOf(server.id) == -1)
|
||||
{
|
||||
serversToUpdate << server.id;
|
||||
}
|
||||
|
||||
// remove profiles that still exist
|
||||
profilesToDelete.removeAll(profile.id);
|
||||
}
|
||||
|
||||
if (!profilesToDelete.isEmpty())
|
||||
{
|
||||
m_components.profiles << profilesToDelete;
|
||||
|
||||
// delete profiles in another thread
|
||||
QtConcurrent::run(this, &COperationDialog::deleteComponentsProfiles);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// servers files to download/update
|
||||
foreach(const QString &serverId, serversToUpdate)
|
||||
{
|
||||
const CServer &server = config->getServer(serverId);
|
||||
|
||||
// data
|
||||
if (!config->areRyzomDataInstalledIn(server.getDirectory()))
|
||||
{
|
||||
QString dataFile = config->getInstallationDirectory() + "/" + server.dataDownloadFilename;
|
||||
|
||||
// archive already downloaded
|
||||
if (QFile::exists(dataFile))
|
||||
{
|
||||
// make server current
|
||||
m_currentServerId = server.id;
|
||||
|
||||
// uncompress it
|
||||
QtConcurrent::run(this, &COperationDialog::extractDownloadedData);
|
||||
return;
|
||||
}
|
||||
|
||||
// data download URLs are different, can't copy data from default server
|
||||
if (server.dataDownloadUrl != defaultServer.dataDownloadUrl)
|
||||
{
|
||||
// download it
|
||||
// TODO
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// same data used
|
||||
|
||||
// copy them
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
// client
|
||||
if (!config->isRyzomClientInstalledIn(server.getDirectory()))
|
||||
{
|
||||
// client download URLs are different, can't copy client from default server
|
||||
if (server.clientDownloadUrl == defaultServer.clientDownloadUrl)
|
||||
{
|
||||
if (QFile::exists(""))
|
||||
downloadData();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QString clientFile = config->getInstallationDirectory() + "/" + server.clientDownloadFilename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void COperationDialog::processUninstallNextStep()
|
||||
|
|
|
@ -87,6 +87,7 @@ protected:
|
|||
void processUpdateProfilesNextStep();
|
||||
void processInstallNextStep();
|
||||
void processUninstallNextStep();
|
||||
void processUpdateProfilesNextStep();
|
||||
|
||||
// operations
|
||||
void downloadData();
|
||||
|
|
Loading…
Reference in a new issue