2016-05-16 09:11:40 +00:00
|
|
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
|
|
// Copyright (C) 2010 Winch Gate Property Limited
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#ifndef OPERATIONDIALOG_H
|
|
|
|
#define OPERATIONDIALOG_H
|
|
|
|
|
|
|
|
#include "ui_operationdialog.h"
|
|
|
|
#include "operation.h"
|
|
|
|
|
|
|
|
class QWinTaskbarButton;
|
|
|
|
class CDownloader;
|
|
|
|
class CArchive;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Main window
|
|
|
|
*
|
|
|
|
* \author Cedric 'Kervala' OCHS
|
|
|
|
* \date 2016
|
|
|
|
*/
|
|
|
|
class COperationDialog : public QDialog, public Ui::OperationDialog, public IOperationProgressListener
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-05-29 18:30:53 +00:00
|
|
|
COperationDialog(QWidget *parent = NULL);
|
2016-05-16 09:11:40 +00:00
|
|
|
virtual ~COperationDialog();
|
|
|
|
|
2016-06-14 17:39:39 +00:00
|
|
|
void setOperation(OperationType operation);
|
2016-06-19 19:02:17 +00:00
|
|
|
void setUninstallComponents(const SComponents &components);
|
2016-05-29 18:34:43 +00:00
|
|
|
|
2016-05-16 09:11:40 +00:00
|
|
|
public slots:
|
|
|
|
void onAbortClicked();
|
|
|
|
|
2016-06-18 17:52:51 +00:00
|
|
|
void onDownloadPrepared();
|
|
|
|
void onDownloadDone();
|
|
|
|
|
2016-05-16 09:11:40 +00:00
|
|
|
void onProgressPrepare();
|
|
|
|
void onProgressInit(qint64 current, qint64 total);
|
|
|
|
void onProgressStart();
|
|
|
|
void onProgressStop();
|
|
|
|
void onProgressProgress(qint64 current, const QString &filename);
|
|
|
|
void onProgressSuccess(qint64 total);
|
|
|
|
void onProgressFail(const QString &error);
|
|
|
|
void onDone();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
// emitted when requesting real URL
|
|
|
|
void prepare();
|
|
|
|
|
|
|
|
// emitted when we got the initial (local) and total (remote) size of file
|
|
|
|
void init(qint64 current, qint64 total);
|
|
|
|
|
|
|
|
// emitted when we begin to download
|
|
|
|
void start();
|
|
|
|
|
|
|
|
// emitted when the download stopped
|
|
|
|
void stop();
|
|
|
|
|
|
|
|
// emitted when extracting
|
|
|
|
void progress(qint64 current, const QString &filename);
|
|
|
|
|
|
|
|
// emitted when the whole file is downloaded
|
|
|
|
void success(qint64 total);
|
|
|
|
|
|
|
|
// emitted when an error occurs
|
|
|
|
void fail(const QString &error);
|
|
|
|
|
|
|
|
// emitted when done and should process next step
|
|
|
|
void done();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent *e);
|
|
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
|
|
|
|
void processNextStep();
|
2016-05-29 18:34:43 +00:00
|
|
|
void processInstallNextStep();
|
|
|
|
void processUninstallNextStep();
|
2016-06-14 17:51:28 +00:00
|
|
|
void processUpdateProfilesNextStep();
|
2016-05-16 09:11:40 +00:00
|
|
|
|
|
|
|
// operations
|
2016-05-16 12:49:18 +00:00
|
|
|
void downloadData();
|
2016-06-14 17:55:17 +00:00
|
|
|
void extractDownloadedData();
|
2016-05-16 12:49:18 +00:00
|
|
|
void downloadClient();
|
2016-06-14 17:55:17 +00:00
|
|
|
void extractDownloadedClient();
|
|
|
|
void copyDataFiles();
|
2016-05-16 09:11:40 +00:00
|
|
|
void copyProfileFiles();
|
|
|
|
void cleanFiles();
|
2016-05-29 18:32:33 +00:00
|
|
|
void extractBnpClient();
|
|
|
|
void copyInstaller();
|
|
|
|
void uninstallOldClient();
|
2016-05-16 09:11:40 +00:00
|
|
|
bool createDefaultProfile();
|
2016-06-19 19:07:51 +00:00
|
|
|
|
2016-07-25 16:31:11 +00:00
|
|
|
bool createProfileShortcuts(const QString &profileId);
|
2016-06-19 19:07:51 +00:00
|
|
|
|
2016-05-25 21:26:40 +00:00
|
|
|
bool createAddRemoveEntry();
|
2016-06-19 19:08:23 +00:00
|
|
|
bool updateAddRemoveEntry();
|
2016-06-07 11:24:26 +00:00
|
|
|
bool deleteAddRemoveEntry();
|
2016-06-19 19:02:17 +00:00
|
|
|
|
|
|
|
void addComponentsServers();
|
2016-06-04 17:57:50 +00:00
|
|
|
void deleteComponentsServers();
|
2016-06-19 19:02:17 +00:00
|
|
|
|
|
|
|
void addComponentsProfiles();
|
2016-06-04 17:57:50 +00:00
|
|
|
void deleteComponentsProfiles();
|
2016-06-19 19:02:17 +00:00
|
|
|
|
2016-06-04 17:57:50 +00:00
|
|
|
void deleteComponentsInstaller();
|
2016-06-26 17:41:33 +00:00
|
|
|
void deleteComponentsDownloadedFiles();
|
2016-05-16 09:11:40 +00:00
|
|
|
|
2016-06-19 19:02:17 +00:00
|
|
|
void updateAddRemoveComponents();
|
|
|
|
|
2016-05-16 09:11:40 +00:00
|
|
|
// from CFilesCopier
|
|
|
|
virtual void operationPrepare();
|
|
|
|
virtual void operationInit(qint64 current, qint64 total);
|
|
|
|
virtual void operationStart();
|
|
|
|
virtual void operationStop();
|
|
|
|
virtual void operationProgress(qint64 current, const QString &filename);
|
|
|
|
virtual void operationSuccess(qint64 total);
|
|
|
|
virtual void operationFail(const QString &error);
|
|
|
|
|
|
|
|
virtual bool operationShouldStop();
|
|
|
|
|
2016-06-18 17:52:51 +00:00
|
|
|
void renamePartFile();
|
|
|
|
|
2016-09-14 06:12:49 +00:00
|
|
|
// hacks to prevent an infinite loop
|
|
|
|
void acceptDelayed();
|
|
|
|
void rejectDelayed();
|
|
|
|
|
2016-05-16 09:11:40 +00:00
|
|
|
QWinTaskbarButton *m_button;
|
|
|
|
CDownloader *m_downloader;
|
|
|
|
|
|
|
|
QString m_currentOperation;
|
|
|
|
QString m_currentOperationProgressFormat;
|
|
|
|
|
|
|
|
QMutex m_abortingMutex;
|
|
|
|
bool m_aborting;
|
2016-05-29 18:34:43 +00:00
|
|
|
|
2016-06-14 17:39:39 +00:00
|
|
|
OperationType m_operation;
|
2016-06-19 19:02:17 +00:00
|
|
|
SComponents m_addComponents;
|
|
|
|
SComponents m_removeComponents;
|
2016-06-14 17:54:51 +00:00
|
|
|
QString m_currentServerId;
|
2016-05-16 09:11:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|