1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef OPERATIONDIALOG_H
18 #define OPERATIONDIALOG_H
20 #include "ui_operationdialog.h"
21 #include "operation.h"
23 class QWinTaskbarButton
;
30 * \author Cedric 'Kervala' OCHS
33 class COperationDialog
: public QDialog
, public Ui::OperationDialog
, public IOperationProgressListener
38 COperationDialog(QWidget
*parent
= NULL
);
39 virtual ~COperationDialog();
41 void setOperation(OperationType operation
);
42 void setUninstallComponents(const SComponents
&components
);
43 void setCurrentServerId(const QString
&serverId
) { m_currentServerId
= serverId
; }
46 void onAbortClicked();
48 void onDownloadPrepared();
49 void onDownloadDone();
51 void onProgressPrepare();
52 void onProgressInit(qint64 current
, qint64 total
);
53 void onProgressStart();
54 void onProgressStop();
55 void onProgressProgress(qint64 current
, const QString
&filename
);
56 void onProgressSuccess(qint64 total
);
57 void onProgressFail(const QString
&error
);
61 // emitted when requesting real URL
64 // emitted when we got the initial (local) and total (remote) size of file
65 void init(qint64 current
, qint64 total
);
67 // emitted when we begin to download
70 // emitted when the download stopped
73 // emitted when extracting
74 void progress(qint64 current
, const QString
&filename
);
76 // emitted when the whole file is downloaded
77 void success(qint64 total
);
79 // emitted when an error occurs
80 void fail(const QString
&error
);
82 // emitted when done and should process next step
86 void showEvent(QShowEvent
*e
);
87 void closeEvent(QCloseEvent
*e
);
89 void processNextStep();
90 void processInstallNextStep();
91 void processUninstallNextStep();
92 void processUpdateProfilesNextStep();
96 void extractDownloadedData();
97 void downloadClient();
98 void extractDownloadedClient();
100 void copyProfileFiles();
102 void extractBnpClient();
103 void copyInstaller();
104 void uninstallOldClient();
105 bool createDefaultProfile();
107 bool createProfileShortcuts(const QString
&profileId
);
109 bool createAddRemoveEntry();
110 bool updateAddRemoveEntry();
111 bool deleteAddRemoveEntry();
113 void addComponentsServers();
114 void deleteComponentsServers();
116 void addComponentsProfiles();
117 void deleteComponentsProfiles();
119 void deleteComponentsInstaller();
120 void deleteComponentsDownloadedFiles();
122 void updateAddRemoveComponents();
125 virtual void operationPrepare();
126 virtual void operationInit(qint64 current
, qint64 total
);
127 virtual void operationStart();
128 virtual void operationStop();
129 virtual void operationProgress(qint64 current
, const QString
&filename
);
130 virtual void operationSuccess(qint64 total
);
131 virtual void operationFail(const QString
&error
);
132 virtual void operationContinue();
134 virtual bool operationShouldStop();
136 void renamePartFile();
137 void launchUpgradeScript(const QString
&directory
, const QString
&executable
);
139 // hacks to prevent an infinite loop
140 void acceptDelayed();
141 void rejectDelayed();
143 QWinTaskbarButton
*m_button
;
144 CDownloader
*m_downloader
;
146 QString m_currentOperation
;
148 QMutex m_abortingMutex
;
151 OperationType m_operation
;
152 OperationStep m_operationStep
;
153 int m_operationStepCounter
;
154 SComponents m_addComponents
;
155 SComponents m_removeComponents
;
156 QString m_currentServerId
;