@@ -32,15 +32,26 @@ void IonLoginPanel::Construct(const FArguments& InArgs) {
32
32
.GetCurrent ()
33
33
->ApiUrl .IsEmpty ()
34
34
? EVisibility::Visible
35
- : EVisibility::Hidden ;
35
+ : EVisibility::Collapsed ;
36
36
};
37
37
38
38
auto visibleWhenResuming = [this ]() {
39
39
return FCesiumEditorModule::serverManager ()
40
40
.GetCurrentSession ()
41
41
->isResuming ()
42
42
? EVisibility::Visible
43
- : EVisibility::Hidden;
43
+ : EVisibility::Collapsed;
44
+ };
45
+
46
+ auto visibleWhenNotConnectingOrResuming = []() {
47
+ return FCesiumEditorModule::serverManager ()
48
+ .GetCurrentSession ()
49
+ ->isConnecting () ||
50
+ FCesiumEditorModule::serverManager ()
51
+ .GetCurrentSession ()
52
+ ->isResuming ()
53
+ ? EVisibility::Collapsed
54
+ : EVisibility::Visible;
44
55
};
45
56
46
57
// TODO Format this, and disable clang format here
@@ -94,14 +105,8 @@ void IonLoginPanel::Construct(const FArguments& InArgs) {
94
105
.OnClicked (
95
106
this ,
96
107
&IonLoginPanel::CopyAuthorizeUrlToClipboard)
97
- .Text (FText::FromString (
98
- TEXT (" Copy to clipboard" )))]] +
99
- SVerticalBox::Slot ()
100
- .HAlign (HAlign_Center)
101
- .Padding (5 )
102
- .AutoHeight ()[SNew (SHyperlink)
103
- .OnNavigate (this , &IonLoginPanel::CancelLogin)
104
- .Text (FText::FromString (TEXT (" Cancel" )))];
108
+ .Text (
109
+ FText::FromString (TEXT (" Copy to clipboard" )))]];
105
110
106
111
TSharedPtr<SVerticalBox> connectionWidget =
107
112
SNew (SVerticalBox) +
@@ -111,37 +116,44 @@ void IonLoginPanel::Construct(const FArguments& InArgs) {
111
116
.Padding (5 )
112
117
.AutoHeight ()
113
118
[SNew (SButton)
119
+ .Visibility_Lambda (visibleWhenNotConnectingOrResuming)
114
120
.ButtonStyle (FCesiumEditorModule::GetStyle (), " CesiumButton" )
115
121
.TextStyle (
116
122
FCesiumEditorModule::GetStyle (),
117
123
" CesiumButtonText" )
118
124
.OnClicked (this , &IonLoginPanel::SignIn)
119
- .Text (FText::FromString (TEXT (" Connect to Cesium ion" )))
120
- .IsEnabled_Lambda ([this ]() {
121
- return !FCesiumEditorModule::serverManager ()
122
- .GetCurrentSession ()
123
- ->isConnecting () &&
124
- !FCesiumEditorModule::serverManager ()
125
- .GetCurrentSession ()
126
- ->isResuming ();
127
- })] +
125
+ .Text (FText::FromString (TEXT (" Connect to Cesium ion" )))] +
128
126
SVerticalBox::Slot ()
129
127
.VAlign (VAlign_Top)
130
- .Padding (10 , 10 , 10 , 5 )
128
+ .HAlign (HAlign_Center)
129
+ .Padding (5 )
130
+ .AutoHeight ()
131
+ [SNew (SButton)
132
+ .Visibility_Lambda (visibleWhenConnecting)
133
+ .ButtonStyle (FCesiumEditorModule::GetStyle (), " CesiumButton" )
134
+ .TextStyle (
135
+ FCesiumEditorModule::GetStyle (),
136
+ " CesiumButtonText" )
137
+ .OnClicked (this , &IonLoginPanel::CancelSignIn)
138
+ .Text (FText::FromString (TEXT (" Cancel Connecting" )))] +
139
+ SVerticalBox::Slot ()
140
+ .VAlign (VAlign_Top)
141
+ .Padding (10 , 0 , 10 , 5 )
131
142
.AutoHeight ()
132
143
[SNew (STextBlock)
144
+ .Visibility_Lambda ([visibleWhenNotConnectingOrResuming]() {
145
+ // Only show this message for the SaaS server.
146
+ UCesiumIonServer* Server =
147
+ FCesiumEditorModule::serverManager ().GetCurrent ();
148
+ if (Server->GetName () != TEXT (" CesiumIonSaaS" ))
149
+ return EVisibility::Collapsed;
150
+
151
+ return visibleWhenNotConnectingOrResuming ();
152
+ })
133
153
.AutoWrapText (true )
134
154
.TextStyle (FCesiumEditorModule::GetStyle (), " BodyBold" )
135
155
.Text (FText::FromString (TEXT (
136
- " You can now sign in with your Epic Games account!" )))
137
- .IsEnabled_Lambda ([this ]() {
138
- return !FCesiumEditorModule::serverManager ()
139
- .GetCurrentSession ()
140
- ->isConnecting () &&
141
- !FCesiumEditorModule::serverManager ()
142
- .GetCurrentSession ()
143
- ->isResuming ();
144
- })] +
156
+ " You can now sign in with your Epic Games account!" )))] +
145
157
SVerticalBox::Slot ()
146
158
.VAlign (VAlign_Top)
147
159
.Padding (5 , 15 , 5 , 5 )
@@ -204,12 +216,13 @@ void IonLoginPanel::LaunchBrowserAgain() {
204
216
NULL );
205
217
}
206
218
207
- void IonLoginPanel::CancelLogin () {
219
+ FReply IonLoginPanel::CancelSignIn () {
208
220
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> pRequest =
209
221
FHttpModule::Get ().CreateRequest ();
210
222
pRequest->SetURL (UTF8_TO_TCHAR (FCesiumEditorModule::serverManager ()
211
223
.GetCurrentSession ()
212
224
->getRedirectUrl ()
213
225
.c_str ()));
214
226
pRequest->ProcessRequest ();
227
+ return FReply::Handled ();
215
228
}
0 commit comments