ScummVM API documentation
integrity-dialog.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 GUI_INTEGRITY_DIALOG_H
23
#define GUI_INTEGRITY_DIALOG_H
24
25
#include "backends/networking/curl/postrequest.h"
26
27
#include "common/array.h"
28
#include "common/formats/json.h"
29
#include "common/str.h"
30
31
#include "gui/dialog.h"
32
#include "gui/widget.h"
33
#include "gui/widgets/list.h"
34
35
namespace
GUI
{
36
37
enum
{
38
OK = 0,
39
MISSING = 1,
40
CHECKSUM_MISMATCH = 2,
41
SIZE_MISMATCH = 3,
42
UNKNOWN = 4
43
};
44
45
enum
ProcessState {
46
kChecksumStateNone,
47
kChecksumStateCalculating,
48
kChecksumComplete,
49
kResponseReceived
50
};
51
52
class
IntegrityDialog
:
public
Dialog
,
public
CommandSender
{
53
StaticTextWidget
*_warningText;
54
ListWidget
*_resultsText;
55
56
StaticTextWidget
*_statusText;
57
StaticTextWidget
*_errorText;
58
StaticTextWidget
*_percentLabel;
59
StaticTextWidget
*_calcSizeLabel;
60
SliderWidget
*_progressBar;
61
ButtonWidget
*_cancelButton;
62
ButtonWidget
*_copyEmailButton;
63
64
bool
_close;
65
66
Common::U32String
getSizeLabelText();
67
void
refreshWidgets();
68
69
public
:
70
IntegrityDialog
(
Common::String
endpoint,
Common::String
gameConfig);
71
~
IntegrityDialog
();
72
73
void
sendJSON();
74
void
checksumResponseCallback(
const
Common::JSONValue
*r);
75
void
errorCallback(
const
Networking::ErrorResponse
&
error
);
76
77
void
calculateTotalSize(
Common::Path
gamePath);
78
79
Common::Array<Common::StringArray>
generateChecksums(
Common::Path
gamePath,
Common::Array<Common::StringArray>
&fileChecksums);
80
Common::JSONValue
*generateJSONRequest(
Common::Path
gamePath,
Common::String
gameid,
Common::String
engineid,
Common::String
extra,
Common::String
platform,
Common::String
language);
81
void
parseJSON(
const
Common::JSONValue
*response);
82
83
void
open()
override
;
84
void
close()
override
;
85
void
handleCommand(
CommandSender
*sender, uint32 cmd, uint32 data)
override
;
86
void
handleTickle()
override
;
87
void
reflowLayout()
override
;
88
89
void
setError(
Common::U32String
&msg);
90
91
private
:
92
void
setState(ProcessState state);
93
};
94
95
}
// End of namespace GUI
96
97
#endif // GUI_INTEGRITY_DIALOG_H
Common::String
Definition:
str.h:59
Networking::ErrorResponse
Definition:
request.h:73
Common::Array
Definition:
array.h:52
Common::Path
Definition:
path.h:52
GUI::StaticTextWidget
Definition:
widget.h:205
GUI::SliderWidget
Definition:
widget.h:405
GUI
Definition:
system.h:46
Common::JSONValue
Definition:
json.h:90
Common::U32String
Definition:
ustr.h:57
GUI::ListWidget
Definition:
list.h:51
error
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
GUI::Dialog
Definition:
dialog.h:49
GUI::ButtonWidget
Definition:
widget.h:233
GUI::CommandSender
Definition:
object.h:40
GUI::IntegrityDialog
Definition:
integrity-dialog.h:52
gui
integrity-dialog.h
Generated on Fri Nov 22 2024 09:30:38 for ScummVM API documentation by
1.8.13