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/curl/request.h"
26 #include "common/str.h"
27 #include "common/ustr.h"
28 #include "gui/dialog.h"
29 
30 namespace GUI {
31 class ScrollContainerWidget;
32 class StaticTextWidget;
33 class ButtonWidget;
34 class EditTextWidget;
35 
36 class CloudConnectionWizard : public Dialog {
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
55  Networking::ErrorCallback _callback;
56  bool _connecting;
57  Common::U32String _errorMessage;
58 
59  // common and generic widgets
60  StaticTextWidget *_headlineLabel;
61  ButtonWidget *_closeButton;
62  ButtonWidget *_prevStepButton;
63  ButtonWidget *_nextStepButton;
64  StaticTextWidget *_label0;
65  StaticTextWidget *_label1;
66  StaticTextWidget *_label2;
67  StaticTextWidget *_label3;
68  ButtonWidget *_button0;
69  ButtonWidget *_button1;
70 
71  // specific widgets
72  ScrollContainerWidget *_container;
73  ButtonWidget *_quickModeButton;
74  StaticTextWidget *_quickModeLabel;
75  ButtonWidget *_manualModeButton;
76  EditTextWidget *_codeBox;
77 
78  // wizard flow
79  void showStep(Step newStep);
80 
81  void showStepModeSelect();
82  void hideStepModeSelect();
83 
84  void showStepQuickMode1();
85  void refreshStepQuickMode1(bool displayAsStopped = false);
86  void hideStepQuickMode1();
87 
88  void showStepQuickMode2();
89  void hideStepQuickMode2();
90 
91  void showStepQuickModeSuccess();
92  void hideStepQuickModeSuccess();
93 
94  void showStepManualMode1();
95  void hideStepManualMode1();
96 
97  void showStepManualMode2();
98  void hideStepManualMode2();
99 
100  void showStepManualModeFailure();
101  void hideStepManualModeFailure();
102 
103  void showStepManualModeSuccess();
104  void hideStepManualModeSuccess();
105 
106  // widgets utils
107  void showContainer(const Common::String &dialogName);
108  void hideContainer();
109 
110  void showBackButton();
111  void hideBackButton();
112 
113  void showNextButton();
114  void hideNextButton();
115 
116  void removeWidgetChecked(ScrollContainerWidget *&widget);
117  void removeWidgetChecked(ButtonWidget *&widget);
118  void removeWidgetChecked(StaticTextWidget *&widget);
119  void removeWidgetChecked(EditTextWidget *&widget);
120 
121  // logic
122  void storageConnectionCallback(const Networking::ErrorResponse &response);
123  void manualModeConnect();
124  void manualModeStorageConnectionCallback(const Networking::ErrorResponse &response);
125 
126 public:
128  ~CloudConnectionWizard() override;
129 
130  void open() override;
131  void close() override;
132  void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
133  void handleTickle() override;
134 };
135 
136 } // End of namespace GUI
137 
138 #endif
Definition: cloudconnectionwizard.h:36
Definition: str.h:59
Definition: request.h:73
Definition: edittext.h:32
Definition: scrollcontainer.h:31
Definition: widget.h:205
Definition: system.h:46
Definition: ustr.h:57
Definition: callback.h:49
Definition: dialog.h:49
Definition: widget.h:233
Definition: object.h:40