Skip to content

Commit ada1588

Browse files
adjust tab size, auto detect quick connect and show tab if enabled on server
1 parent a693a6b commit ada1588

3 files changed

Lines changed: 30 additions & 12 deletions

File tree

components/config/SigninScene.bs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "pkg:/source/enums/KeyCode.bs"
22
import "pkg:/source/enums/String.bs"
33
import "pkg:/source/utils/misc.bs"
4+
import "pkg:/source/api/userauth.bs"
45

56
sub init()
67
m.top.setFocus(true)
@@ -66,6 +67,7 @@ sub init()
6667
m.quickConnectBack.observeField("buttonSelected", "onBackPressed")
6768

6869
initServerName()
70+
checkQuickConnectEnabled()
6971
end sub
7072

7173
sub initServerName()
@@ -89,6 +91,18 @@ sub initServerName()
8991
m.connectingTo.text = tr("Connecting to ") + serverName
9092
end sub
9193

94+
sub checkQuickConnectEnabled()
95+
resp = APIRequest("QuickConnect/Enabled")
96+
result = getString(resp)
97+
if isValidAndNotEmpty(result) and result = "true"
98+
json = initQuickConnect()
99+
if isValid(json)
100+
m.top.quickConnectJson = json
101+
showQuickConnect()
102+
end if
103+
end if
104+
end sub
105+
92106
sub onAlertChange()
93107
m.errorContainer.visible = isValidAndNotEmpty(m.top.alert)
94108

@@ -114,7 +128,9 @@ end sub
114128
sub showQuickConnect()
115129
m.top.findNode("signInFormContainer").visible = false
116130
m.quickConnectGroup.visible = true
117-
m.quickConnectBack.setFocus(true)
131+
132+
m.config.setFocus(false)
133+
m.config.jumpToItem = -1
118134

119135
m.quickConnect.background = "0x00A4DCFF"
120136
m.passwordTab.background = "0x2a2e40FF"
@@ -129,6 +145,8 @@ sub showQuickConnect()
129145
m.quickConnectCode.text = json.Code
130146

131147
m.quickConnectTimer.control = "start"
148+
149+
m.top.lastFocus = m.quickConnectBack
132150
end sub
133151

134152
sub hideQuickConnect()

components/config/SigninScene.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
height="600"
2525
uri="pkg:/images/surface.9.png">
2626

27-
<Rectangle id="errorContainer" visible="false" width="600" height="60" translation="[305, 135]">
28-
<Text id="errorMessage" text="" wrap="true" width="600" font="font:MediumSystemFont" horizAlign="center" color="0xFF6B6BFF" translation="[10, 15]" />
27+
<Rectangle id="errorContainer" visible="false" width="600" height="60" translation="[305, 625]">
28+
<Text id="errorMessage" text="" wrap="true" width="600" font="font:SmallSystemFont" horizAlign="center" color="0xffe0e0" translation="[10, 13]" />
2929
</Rectangle>
3030

3131
<Label
@@ -35,7 +35,7 @@
3535
height="35"
3636
font="font:MediumBoldSystemFont"
3737
color="0xFFFFFFFF"
38-
translation="[0, 60]" />
38+
translation="[0, 45]" />
3939

4040
<Label id="connectingTo"
4141
text="Connecting to -----"
@@ -44,14 +44,14 @@
4444
height="35"
4545
font="font:TinySystemFont"
4646
color="0x9CA3AFFF"
47-
translation="[0, 100]" />
47+
translation="[0, 90]" />
4848

4949
<StandardButton
5050
id="quickConnect"
5151
text="Quick Connect"
5252
height="50"
53-
width="545"
54-
translation="[40, 140]"
53+
width="250"
54+
translation="[340, 150]"
5555
background="0x2a2e40FF"
5656
color="0xFFFFFFFF"
5757
focusBackground="0x00A4DCFF"
@@ -62,19 +62,19 @@
6262
id="passwordTab"
6363
text="Password"
6464
height="50"
65-
width="545"
66-
translation="[610, 140]"
65+
width="250"
66+
translation="[610, 150]"
6767
background="0x2a2e40FF"
6868
color="0xFFFFFFFF"
6969
focusBackground="0x00A4DCFF"
7070
focusColor="0xFFFFFFFF"
7171
fontSize="24" />
7272

7373
<Rectangle id="signInFormContainer" color="#ffffff00" width="1120" height="280" translation="[40, 170]">
74-
<Rectangle color="0x2a2e40FF" width="1110" height="75" translation="[5, 40]" />
74+
<Rectangle color="0x2a2e40FF" width="1110" height="75" translation="[5, 65]" />
7575
<Rectangle color="0x2a2e40FF" width="1110" height="75" translation="[5, 165]" />
7676

77-
<FormList id="configOptions" translation="[36, 40]" itemSpacing="[0, 50]" />
77+
<FormList id="configOptions" translation="[36, 65]" itemSpacing="[0, 20]" />
7878

7979
<CheckList
8080
id="saveCredentials"

source/ShowScenes.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ function CreateSigninGroup(user = "")
588588
else if isStringEqual(node, "quickConnect")
589589
json = initQuickConnect()
590590
if json = invalid
591-
m.global.sceneManager.callFunc("standardDialog", "Quick Connect Error", { data: ["<p>" + tr("There was an error detecting Quick Connect on your server.") + "</p>"] })
591+
m.global.sceneManager.callFunc("standardDialog", "Quick Connect Error", { data: ["<p>" + tr("There was an error detecting Quick Connect. Quick Connect is disabled on your server.") + "</p>"] })
592592
else
593593
group.quickConnectJson = json
594594
group.showQuickConnect = true

0 commit comments

Comments
 (0)