Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / tools / client / ryzom_installer / src / operationdialog.h
blob572c0173ec51133c9a924c795a5e58b1ed25a4b3
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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;
24 class CDownloader;
25 class CArchive;
27 /**
28 * Main window
30 * \author Cedric 'Kervala' OCHS
31 * \date 2016
33 class COperationDialog : public QDialog, public Ui::OperationDialog, public IOperationProgressListener
35 Q_OBJECT
37 public:
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; }
45 public slots:
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);
58 void onDone();
60 signals:
61 // emitted when requesting real URL
62 void prepare();
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
68 void start();
70 // emitted when the download stopped
71 void stop();
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
83 void operationDone();
85 protected:
86 void showEvent(QShowEvent *e);
87 void closeEvent(QCloseEvent *e);
89 void processNextStep();
90 void processInstallNextStep();
91 void processUninstallNextStep();
92 void processUpdateProfilesNextStep();
94 // operations
95 void downloadData();
96 void extractDownloadedData();
97 void downloadClient();
98 void extractDownloadedClient();
99 void copyDataFiles();
100 void copyProfileFiles();
101 void cleanFiles();
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();
124 // from CFilesCopier
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;
149 bool m_aborting;
151 OperationType m_operation;
152 OperationStep m_operationStep;
153 int m_operationStepCounter;
154 SComponents m_addComponents;
155 SComponents m_removeComponents;
156 QString m_currentServerId;
159 #endif