ScummVM API documentation
cloudconnectionwizard.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_CLOUDCONNECTIONWIZARD_H
23#define GUI_CLOUDCONNECTIONWIZARD_H
24
25#include "backends/networking/http/request.h"
26#include "common/str.h"
27#include "common/ustr.h"
28#include "gui/dialog.h"
29
30namespace GUI {
31class ScrollContainerWidget;
32class StaticTextWidget;
33class ButtonWidget;
34class EditTextWidget;
35
37 enum class Step {
38 NONE,
39 MODE_SELECT,
40 QUICK_MODE_STEP_1,
41 QUICK_MODE_STEP_2,
42 QUICK_MODE_SUCCESS,
43 MANUAL_MODE_STEP_1,
44 MANUAL_MODE_STEP_2,
45 MANUAL_MODE_FAILURE,
46 MANUAL_MODE_SUCCESS
47 };
48
49 // wizard flow
50 Step _currentStep;
51 bool _switchToSuccess;
52 bool _switchToFailure;
53
54 // state
56 bool _connecting;
57 Common::U32String _errorMessage;
58 uint32 _selectedStorageIndex;
59
60 // common and generic widgets
61 StaticTextWidget *_headlineLabel;
62 ButtonWidget *_closeButton;
63 ButtonWidget *_prevStepButton;
64 ButtonWidget *_nextStepButton;
65 StaticTextWidget *_label0;
66 StaticTextWidget *_label1;
67 StaticTextWidget *_label2;
68 StaticTextWidget *_label3;
69 ButtonWidget *_button0;
70 ButtonWidget *_button1;
71
72 // specific widgets
73 ScrollContainerWidget *_container;
74 ButtonWidget *_quickModeButton;
75 StaticTextWidget *_quickModeLabel;
76 ButtonWidget *_manualModeButton;
77 EditTextWidget *_codeBox;
78
79 // wizard flow
80 void showStep(Step newStep);
81
82 void showStepModeSelect();
83 void hideStepModeSelect();
84
85 void showStepQuickMode1();
86 void refreshStepQuickMode1(bool displayAsStopped = false);
87 void hideStepQuickMode1();
88
89 void showStepQuickMode2();
90 void hideStepQuickMode2();
91
92 void showStepQuickModeSuccess();
93 void hideStepQuickModeSuccess();
94
95 void showStepManualMode1();
96 void hideStepManualMode1();
97
98 void showStepManualMode2();
99 void hideStepManualMode2();
100
101 void showStepManualModeFailure();
102 void hideStepManualModeFailure();
103
104 void showStepManualModeSuccess();
105 void hideStepManualModeSuccess();
106
107 // widgets utils
108 void showContainer(const Common::String &dialogName);
109 void hideContainer();
110
111 void showBackButton();
112 void hideBackButton();
113
114 void showNextButton();
115 void hideNextButton();
116
117 void removeWidgetChecked(ScrollContainerWidget *&widget);
118 void removeWidgetChecked(ButtonWidget *&widget);
119 void removeWidgetChecked(StaticTextWidget *&widget);
120 void removeWidgetChecked(EditTextWidget *&widget);
121
122 // logic
123 void storageConnectionCallback(const Networking::ErrorResponse &response);
124 void manualModeConnect();
125 void manualModeStorageConnectionCallback(const Networking::ErrorResponse &response);
126
127#ifdef EMSCRIPTEN
128 void emscriptenCloudConnectionCallback(const Common::String *message);
129#endif
130
131public:
133 ~CloudConnectionWizard() override;
134
135 int runStorageModal(uint32 selectedStorageIndex);
136 void open() override;
137 void close() override;
138 void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
139 void handleTickle() override;
140};
141
142} // End of namespace GUI
143
144#endif
Definition: str.h:59
Definition: ustr.h:57
Definition: widget.h:241
Definition: cloudconnectionwizard.h:36
Definition: object.h:40
Definition: dialog.h:49
Definition: edittext.h:32
Definition: scrollcontainer.h:32
Definition: widget.h:213
Definition: request.h:73