ScummVM API documentation
dlcmanager.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef BACKENDS_DLC_DLCMANAGER_H
23#define BACKENDS_DLC_DLCMANAGER_H
24
25#include "common/str.h"
26#include "common/str-array.h"
27#include "common/queue.h"
28#include "common/singleton.h"
29
30#include "gui/object.h"
31
32#include "backends/networking/http/request.h"
33
34namespace GUI {
35class LauncherDialog;
36}
37
38namespace DLC {
39class Store;
40struct DLCDesc;
41}
42
43namespace DLC {
44
45class DLCManager : public Common::Singleton<DLCManager>, public GUI::CommandSender {
46
47 Store *_store;
48 GUI::LauncherDialog *_launcher;
49
50 bool _isDLCDownloading = false;
51 Common::String _currentDownloadingDLC;
52
53public:
54 bool _fetchDLCs = false;
55 bool _interruptCurrentDownload = false;
56 uint32 _currentDownloadedSize;
57 Common::String _errorText;
59 Common::Array<DLCDesc*> _dlcsInProgress;
60 Common::Queue<DLCDesc*> _queuedDownloadTasks;
61
62 DLCManager();
63 virtual ~DLCManager();
64
65 void init();
66
67 // Runs only once
68 void getAllDLCs();
69
70 void refreshDLCList();
71
72 void refreshLauncherGameList();
73
74 void setLauncher(GUI::LauncherDialog *launcher);
75
76 // Add download task to queue, runs on click download button,
77 void addDownload(uint32 idx);
78
79 bool cancelDownload(uint32 idx);
80
81 void processDownloadQueue();
82
83 Common::String getCurrentDownloadingDLC() const;
84
85 uint getDLCIdxFromId(const Common::String &id) const;
86
87 void startDownloadAsync(const Common::String &id, const Common::String &url);
88};
89
90#define DLCMan DLC::DLCManager::instance()
91
92} // End of namespace DLC
93
94
95#endif
Definition: array.h:52
Definition: queue.h:42
Definition: singleton.h:42
Definition: str.h:59
Definition: dlcmanager.h:45
Definition: store.h:32
Definition: object.h:40
Definition: launcher.h:108