mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-29 20:30:54 +00:00
Changed: Moved Operation steps enum
--HG-- branch : develop
This commit is contained in:
parent
97624ee719
commit
b952b51d05
7 changed files with 74 additions and 73 deletions
|
@ -620,7 +620,7 @@ QString CConfigFile::getSrcServerClientBNPFullPath() const
|
||||||
return QString("%1/unpack/exedll_%2.bnp").arg(getSrcServerDirectory()).arg(getClientArch());
|
return QString("%1/unpack/exedll_%2.bnp").arg(getSrcServerDirectory()).arg(getClientArch());
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigFile::InstallationStep CConfigFile::getNextStep() const
|
OperationStep CConfigFile::getInstallNextStep() const
|
||||||
{
|
{
|
||||||
// get last used profile
|
// get last used profile
|
||||||
const CProfile &profile = getProfile();
|
const CProfile &profile = getProfile();
|
||||||
|
@ -712,7 +712,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
|
||||||
// selected directory contains Ryzom files (shouldn't fail)
|
// selected directory contains Ryzom files (shouldn't fail)
|
||||||
if (areRyzomDataInstalledIn(getSrcServerDirectory()))
|
if (areRyzomDataInstalledIn(getSrcServerDirectory()))
|
||||||
{
|
{
|
||||||
return CopyServerFiles;
|
return CopyDataFiles;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,8 +17,11 @@
|
||||||
#ifndef CONFIGFILE_H
|
#ifndef CONFIGFILE_H
|
||||||
#define CONFIGFILE_H
|
#define CONFIGFILE_H
|
||||||
|
|
||||||
struct CServer
|
#include "operation.h"
|
||||||
|
|
||||||
|
class CServer
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
CServer()
|
CServer()
|
||||||
{
|
{
|
||||||
dataCompressedSize = 0;
|
dataCompressedSize = 0;
|
||||||
|
@ -45,8 +48,9 @@ extern const CServer NoServer;
|
||||||
|
|
||||||
typedef QVector<CServer> CServers;
|
typedef QVector<CServer> CServers;
|
||||||
|
|
||||||
struct CProfile
|
class CProfile
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
CProfile()
|
CProfile()
|
||||||
{
|
{
|
||||||
desktopShortcut = false;
|
desktopShortcut = false;
|
||||||
|
@ -78,27 +82,6 @@ class CConfigFile : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum InstallationStep
|
|
||||||
{
|
|
||||||
DisplayNoServerError,
|
|
||||||
ShowInstallWizard,
|
|
||||||
ShowMigrateWizard,
|
|
||||||
DownloadData,
|
|
||||||
ExtractDownloadedData,
|
|
||||||
DownloadClient,
|
|
||||||
ExtractDownloadedClient,
|
|
||||||
CopyServerFiles,
|
|
||||||
CopyProfileFiles,
|
|
||||||
CleanFiles,
|
|
||||||
ExtractBnpClient,
|
|
||||||
CopyInstaller,
|
|
||||||
UninstallOldClient,
|
|
||||||
CreateProfile,
|
|
||||||
CreateShortcuts,
|
|
||||||
CreateAddRemoveEntry,
|
|
||||||
Done
|
|
||||||
};
|
|
||||||
|
|
||||||
CConfigFile(QObject *parent = NULL);
|
CConfigFile(QObject *parent = NULL);
|
||||||
virtual ~CConfigFile();
|
virtual ~CConfigFile();
|
||||||
|
|
||||||
|
@ -180,7 +163,7 @@ public:
|
||||||
|
|
||||||
QString getSrcServerClientBNPFullPath() const;
|
QString getSrcServerClientBNPFullPath() const;
|
||||||
|
|
||||||
InstallationStep getNextStep() const;
|
OperationStep getInstallNextStep() const;
|
||||||
|
|
||||||
// product details
|
// product details
|
||||||
QString getProductName() const;
|
QString getProductName() const;
|
||||||
|
|
|
@ -80,9 +80,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
// instanciate ConfigFile
|
// instanciate ConfigFile
|
||||||
CConfigFile config;
|
CConfigFile config;
|
||||||
CConfigFile::InstallationStep step = config.load() ? config.getNextStep():CConfigFile::DisplayNoServerError;
|
OperationStep step = config.load() ? config.getInstallNextStep():DisplayNoServerError;
|
||||||
|
|
||||||
if (step == CConfigFile::DisplayNoServerError)
|
if (step == DisplayNoServerError)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(NULL, QApplication::tr("Error"), QApplication::tr("Unable to find installer.ini"));
|
QMessageBox::critical(NULL, QApplication::tr("Error"), QApplication::tr("Unable to find installer.ini"));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
COperationDialog dialog;
|
COperationDialog dialog;
|
||||||
|
|
||||||
dialog.setOperation(COperationDialog::OperationUninstall);
|
dialog.setOperation(OperationUninstall);
|
||||||
dialog.setUninstallComponents(components);
|
dialog.setUninstallComponents(components);
|
||||||
|
|
||||||
// TODO: set all components to uninstall
|
// TODO: set all components to uninstall
|
||||||
|
@ -140,7 +140,7 @@ int main(int argc, char *argv[])
|
||||||
return dialog.exec() ? 0 : 1;
|
return dialog.exec() ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step == CConfigFile::ShowMigrateWizard)
|
if (step == ShowMigrateWizard)
|
||||||
{
|
{
|
||||||
CMigrateDialog dialog;
|
CMigrateDialog dialog;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
step = config.getNextStep();
|
step = config.getNextStep();
|
||||||
}
|
}
|
||||||
else if (step == CConfigFile::ShowInstallWizard)
|
else if (step == ShowInstallWizard)
|
||||||
{
|
{
|
||||||
CInstallDialog dialog;
|
CInstallDialog dialog;
|
||||||
|
|
||||||
|
@ -157,10 +157,10 @@ int main(int argc, char *argv[])
|
||||||
step = config.getNextStep();
|
step = config.getNextStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step != CConfigFile::Done)
|
if (step != Done)
|
||||||
{
|
{
|
||||||
COperationDialog dialog;
|
COperationDialog dialog;
|
||||||
dialog.setOperation(config.getSrcServerDirectory().isEmpty() ? COperationDialog::OperationInstall: COperationDialog::OperationMigrate);
|
dialog.setOperation(config.getSrcServerDirectory().isEmpty() ? OperationInstall:OperationMigrate);
|
||||||
|
|
||||||
if (!dialog.exec()) return 1;
|
if (!dialog.exec()) return 1;
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ void CMainWindow::onProfiles()
|
||||||
{
|
{
|
||||||
COperationDialog dialog(this);
|
COperationDialog dialog(this);
|
||||||
|
|
||||||
dialog.setOperation(COperationDialog::OperationUpdateProfiles);
|
dialog.setOperation(OperationUpdateProfiles);
|
||||||
|
|
||||||
if (!dialog.exec())
|
if (!dialog.exec())
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,7 @@ void CMainWindow::onUninstall()
|
||||||
|
|
||||||
COperationDialog dialog;
|
COperationDialog dialog;
|
||||||
|
|
||||||
dialog.setOperation(COperationDialog::OperationUninstall);
|
dialog.setOperation(OperationUninstall);
|
||||||
dialog.setUninstallComponents(components);
|
dialog.setUninstallComponents(components);
|
||||||
|
|
||||||
if (dialog.exec())
|
if (dialog.exec())
|
||||||
|
|
|
@ -46,4 +46,34 @@ struct SUninstallComponents
|
||||||
bool installer;
|
bool installer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum OperationStep
|
||||||
|
{
|
||||||
|
DisplayNoServerError,
|
||||||
|
ShowInstallWizard,
|
||||||
|
ShowMigrateWizard,
|
||||||
|
DownloadData,
|
||||||
|
ExtractDownloadedData,
|
||||||
|
DownloadClient,
|
||||||
|
ExtractDownloadedClient,
|
||||||
|
CopyDataFiles,
|
||||||
|
CopyProfileFiles,
|
||||||
|
CleanFiles,
|
||||||
|
ExtractBnpClient,
|
||||||
|
CopyInstaller,
|
||||||
|
UninstallOldClient,
|
||||||
|
CreateProfile,
|
||||||
|
CreateShortcuts,
|
||||||
|
CreateAddRemoveEntry,
|
||||||
|
Done
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OperationType
|
||||||
|
{
|
||||||
|
OperationNone,
|
||||||
|
OperationMigrate,
|
||||||
|
OperationUpdateProfiles,
|
||||||
|
OperationInstall,
|
||||||
|
OperationUninstall
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -76,7 +76,7 @@ COperationDialog::~COperationDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void COperationDialog::setOperation(Operation operation)
|
void COperationDialog::setOperation(OperationType operation)
|
||||||
{
|
{
|
||||||
m_operation = operation;
|
m_operation = operation;
|
||||||
}
|
}
|
||||||
|
@ -126,73 +126,65 @@ void COperationDialog::processMigrateNextStep()
|
||||||
|
|
||||||
switch(step)
|
switch(step)
|
||||||
{
|
{
|
||||||
case CConfigFile::DisplayNoServerError:
|
case DownloadData:
|
||||||
break;
|
|
||||||
|
|
||||||
case CConfigFile::ShowMigrateWizard:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CConfigFile::ShowInstallWizard:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CConfigFile::DownloadData:
|
|
||||||
downloadData();
|
downloadData();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::ExtractDownloadedData:
|
case ExtractDownloadedData:
|
||||||
// TODO
|
QtConcurrent::run(this, &COperationDialog::extractDownloadedData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::DownloadClient:
|
case DownloadClient:
|
||||||
downloadClient();
|
downloadClient();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::ExtractDownloadedClient:
|
case ExtractDownloadedClient:
|
||||||
// TODO
|
QtConcurrent::run(this, &COperationDialog::extractDownloadedClient);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::CopyServerFiles:
|
case CopyDataFiles:
|
||||||
QtConcurrent::run(this, &COperationDialog::copyServerFiles);
|
QtConcurrent::run(this, &COperationDialog::copyDataFiles);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::CopyProfileFiles:
|
case CopyProfileFiles:
|
||||||
QtConcurrent::run(this, &COperationDialog::copyProfileFiles);
|
QtConcurrent::run(this, &COperationDialog::copyProfileFiles);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::CleanFiles:
|
case CleanFiles:
|
||||||
QtConcurrent::run(this, &COperationDialog::cleanFiles);
|
QtConcurrent::run(this, &COperationDialog::cleanFiles);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::ExtractBnpClient:
|
case ExtractBnpClient:
|
||||||
QtConcurrent::run(this, &COperationDialog::extractBnpClient);
|
QtConcurrent::run(this, &COperationDialog::extractBnpClient);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::CopyInstaller:
|
case CopyInstaller:
|
||||||
QtConcurrent::run(this, &COperationDialog::copyInstaller);
|
QtConcurrent::run(this, &COperationDialog::copyInstaller);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::UninstallOldClient:
|
case UninstallOldClient:
|
||||||
uninstallOldClient();
|
uninstallOldClient();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::CreateProfile:
|
case CreateProfile:
|
||||||
createDefaultProfile();
|
createDefaultProfile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::CreateShortcuts:
|
case CreateShortcuts:
|
||||||
createDefaultShortcuts();
|
createDefaultShortcuts();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::CreateAddRemoveEntry:
|
case CreateAddRemoveEntry:
|
||||||
createAddRemoveEntry();
|
createAddRemoveEntry();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CConfigFile::Done:
|
case Done:
|
||||||
accept();
|
accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// cases already managed in main.cpp
|
// cases already managed in main.cpp
|
||||||
|
qDebug() << "Shouldn't happen, step" << step;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -352,6 +344,11 @@ void COperationDialog::downloadData()
|
||||||
m_downloader->prepareFile(config->expandVariables(server.dataDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.dataDownloadFilename) + ".part");
|
m_downloader->prepareFile(config->expandVariables(server.dataDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.dataDownloadFilename) + ".part");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void COperationDialog::extractDownloadedData()
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
void COperationDialog::downloadClient()
|
void COperationDialog::downloadClient()
|
||||||
{
|
{
|
||||||
CConfigFile *config = CConfigFile::getInstance();
|
CConfigFile *config = CConfigFile::getInstance();
|
||||||
|
|
|
@ -38,16 +38,7 @@ public:
|
||||||
COperationDialog(QWidget *parent = NULL);
|
COperationDialog(QWidget *parent = NULL);
|
||||||
virtual ~COperationDialog();
|
virtual ~COperationDialog();
|
||||||
|
|
||||||
enum Operation
|
void setOperation(OperationType operation);
|
||||||
{
|
|
||||||
OperationNone,
|
|
||||||
OperationMigrate,
|
|
||||||
OperationUpdateProfiles,
|
|
||||||
OperationInstall,
|
|
||||||
OperationUninstall
|
|
||||||
};
|
|
||||||
|
|
||||||
void setOperation(Operation operation);
|
|
||||||
void setUninstallComponents(const SUninstallComponents &components);
|
void setUninstallComponents(const SUninstallComponents &components);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -134,7 +125,7 @@ protected:
|
||||||
QMutex m_abortingMutex;
|
QMutex m_abortingMutex;
|
||||||
bool m_aborting;
|
bool m_aborting;
|
||||||
|
|
||||||
Operation m_operation;
|
OperationType m_operation;
|
||||||
SUninstallComponents m_components;
|
SUninstallComponents m_components;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue