ScummVM API documentation
folderdownloadrequest.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_CLOUD_FOLDERDOWNLOADREQUEST_H
23
#define BACKENDS_CLOUD_FOLDERDOWNLOADREQUEST_H
24
25
#include "backends/networking/curl/request.h"
26
#include "backends/cloud/storage.h"
27
#include "gui/object.h"
28
29
namespace
Cloud
{
30
31
class
FolderDownloadRequest
:
public
Networking::Request
,
public
GUI::CommandSender
{
32
Storage
*_storage;
33
Storage::FileArrayCallback
_fileArrayCallback;
34
Common::String
_remoteDirectoryPath;
35
Common::Path
_localDirectoryPath;
36
bool
_recursive;
37
Common::Array<StorageFile>
_pendingFiles, _failedFiles;
38
StorageFile
_currentFile;
39
Request *_workingRequest;
40
bool
_ignoreCallback;
41
uint32 _totalFiles;
42
uint64 _downloadedBytes, _totalBytes, _wasDownloadedBytes, _currentDownloadSpeed;
43
44
void
start();
45
void
directoryListedCallback(
const
Storage::ListDirectoryResponse
&response);
46
void
directoryListedErrorCallback(
const
Networking::ErrorResponse
&
error
);
47
void
fileDownloadedCallback(
const
Storage::BoolResponse
&response);
48
void
fileDownloadedErrorCallback(
const
Networking::ErrorResponse
&error);
49
void
downloadNextFile();
50
void
finishDownload(
Common::Array<StorageFile>
&files);
51
public
:
52
FolderDownloadRequest
(
Storage
*storage,
Storage::FileArrayCallback
callback,
Networking::ErrorCallback
ecb,
const
Common::String
&remoteDirectoryPath,
const
Common::Path
&localDirectoryPath,
bool
recursive);
53
~
FolderDownloadRequest
()
override
;
54
55
void
handle
()
override
;
56
void
restart
()
override
;
57
59
double
getProgress
()
const
;
60
62
uint64
getDownloadedBytes
()
const
;
63
65
uint64
getTotalBytesToDownload
()
const
;
66
68
uint64
getDownloadSpeed
()
const
;
69
71
Common::String
getRemotePath
()
const
{
return
_remoteDirectoryPath; }
72
74
Common::Path
getLocalPath
()
const
{
return
_localDirectoryPath; }
75
};
76
77
}
// End of namespace Cloud
78
79
#endif
Common::String
Definition:
str.h:59
Cloud::FolderDownloadRequest::getRemotePath
Common::String getRemotePath() const
Definition:
folderdownloadrequest.h:71
Cloud
Definition:
basestorage.h:28
Cloud::Storage
Definition:
storage.h:47
Networking::ErrorResponse
Definition:
request.h:73
Common::Array
Definition:
array.h:52
Cloud::FolderDownloadRequest::handle
void handle() override
Common::Path
Definition:
path.h:52
Networking::Response
Definition:
request.h:47
Cloud::FolderDownloadRequest::getDownloadSpeed
uint64 getDownloadSpeed() const
Cloud::FolderDownloadRequest::getLocalPath
Common::Path getLocalPath() const
Definition:
folderdownloadrequest.h:74
Common::BaseCallback
Definition:
callback.h:49
Cloud::FolderDownloadRequest::getProgress
double getProgress() const
Cloud::FolderDownloadRequest
Definition:
folderdownloadrequest.h:31
error
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Cloud::StorageFile
Definition:
storagefile.h:42
Cloud::FolderDownloadRequest::getDownloadedBytes
uint64 getDownloadedBytes() const
Cloud::FolderDownloadRequest::restart
void restart() override
Cloud::FolderDownloadRequest::getTotalBytesToDownload
uint64 getTotalBytesToDownload() const
GUI::CommandSender
Definition:
object.h:40
Networking::Request
Definition:
request.h:119
backends
cloud
folderdownloadrequest.h
Generated on Fri Nov 15 2024 09:03:58 for ScummVM API documentation by
1.8.13