Changeset View
Changeset View
Standalone View
Standalone View
sddm-theme/Main.qml
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 31 | PlasmaCore.ColorScope { | |||
---|---|---|---|---|---|
59 | 59 | | |||
60 | Clock { | 60 | Clock { | ||
61 | visible: y > 0 | 61 | visible: y > 0 | ||
62 | y: (userListComponent.userList.y + mainStack.y)/2 - height/2 | 62 | y: (userListComponent.userList.y + mainStack.y)/2 - height/2 | ||
63 | anchors.horizontalCenter: parent.horizontalCenter | 63 | anchors.horizontalCenter: parent.horizontalCenter | ||
64 | } | 64 | } | ||
65 | 65 | | |||
66 | 66 | | |||
67 | ColumnLayout { | 67 | StackView { | ||
68 | id: mainStack | ||||
68 | anchors { | 69 | anchors { | ||
69 | top: parent.top | | |||
70 | bottom: footer.top | | |||
71 | left: parent.left | 70 | left: parent.left | ||
72 | right: parent.right | 71 | right: parent.right | ||
73 | topMargin: footer.height // effectively centre align within the view | | |||
74 | } | 72 | } | ||
75 | StackView { | 73 | height: root.height | ||
76 | id: mainStack | 74 | | ||
77 | Layout.fillWidth: true | | |||
78 | Layout.fillHeight: true | | |||
79 | focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it | 75 | focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it | ||
80 | 76 | | |||
81 | Timer { | 77 | Timer { | ||
82 | //SDDM has a bug in 0.13 where even though we set the focus on the right item within the window, the window doesn't have focus | 78 | //SDDM has a bug in 0.13 where even though we set the focus on the right item within the window, the window doesn't have focus | ||
83 | //it is fixed in 6d5b36b28907b16280ff78995fef764bb0c573db which will be 0.14 | 79 | //it is fixed in 6d5b36b28907b16280ff78995fef764bb0c573db which will be 0.14 | ||
84 | //we need to call "window->activate()" *After* it's been shown. We can't control that in QML so we use a shoddy timer | 80 | //we need to call "window->activate()" *After* it's been shown. We can't control that in QML so we use a shoddy timer | ||
85 | //it's been this way for all Plasma 5.x without a huge problem | 81 | //it's been this way for all Plasma 5.x without a huge problem | ||
86 | running: true | 82 | running: true | ||
87 | repeat: false | 83 | repeat: false | ||
88 | interval: 200 | 84 | interval: 200 | ||
89 | onTriggered: mainStack.forceActiveFocus() | 85 | onTriggered: mainStack.forceActiveFocus() | ||
90 | } | 86 | } | ||
91 | 87 | | |||
92 | initialItem: Login { | 88 | initialItem: Login { | ||
93 | id: userListComponent | 89 | id: userListComponent | ||
94 | userListModel: userModel | 90 | userListModel: userModel | ||
95 | userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0 | 91 | userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0 | ||
96 | lastUserName: userModel.lastUser | 92 | lastUserName: userModel.lastUser | ||
97 | showUserList: { | 93 | showUserList: { | ||
98 | if ( !userListModel.hasOwnProperty("count") | 94 | if ( !userListModel.hasOwnProperty("count") | ||
99 | || !userListModel.hasOwnProperty("disableAvatarsThreshold")) | 95 | || !userListModel.hasOwnProperty("disableAvatarsThreshold")) | ||
100 | return true | 96 | return (userList.y + mainStack.y) > 0 | ||
101 | 97 | | |||
102 | if ( userListModel.count == 0 ) return false | 98 | if ( userListModel.count == 0 ) return false | ||
103 | 99 | | |||
104 | return userListModel.count <= userListModel.disableAvatarsThreshold | 100 | return userListModel.count <= userListModel.disableAvatarsThreshold && (userList.y + mainStack.y) > 0 | ||
105 | } | 101 | } | ||
106 | 102 | | |||
107 | notificationMessage: { | 103 | notificationMessage: { | ||
108 | var text = "" | 104 | var text = "" | ||
109 | if (keystateSource.data["Caps Lock"]["Locked"]) { | 105 | if (keystateSource.data["Caps Lock"]["Locked"]) { | ||
110 | text += i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on") | 106 | text += i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on") | ||
111 | if (root.notificationMessage) { | 107 | if (root.notificationMessage) { | ||
112 | text += " • " | 108 | text += " • " | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 152 | Behavior on opacity { | |||
157 | OpacityAnimator { | 153 | OpacityAnimator { | ||
158 | duration: units.longDuration | 154 | duration: units.longDuration | ||
159 | } | 155 | } | ||
160 | } | 156 | } | ||
161 | } | 157 | } | ||
162 | 158 | | |||
163 | Loader { | 159 | Loader { | ||
164 | id: inputPanel | 160 | id: inputPanel | ||
161 | state: "hidden" | ||||
165 | property bool keyboardActive: item ? item.active : false | 162 | property bool keyboardActive: item ? item.active : false | ||
163 | onKeyboardActiveChanged: { | ||||
164 | if (keyboardActive) { | ||||
165 | state = "visible" | ||||
166 | } else { | ||||
167 | state = "hidden"; | ||||
168 | } | ||||
169 | } | ||||
166 | source: "components/VirtualKeyboard.qml" | 170 | source: "components/VirtualKeyboard.qml" | ||
167 | Layout.fillWidth: true | 171 | anchors { | ||
168 | Layout.preferredHeight: (item && item.active) ? item.implicitHeight : 0 | 172 | left: parent.left | ||
173 | right: parent.right | ||||
174 | } | ||||
175 | | ||||
169 | function showHide() { | 176 | function showHide() { | ||
170 | if (Qt.inputMethod.visible) { | 177 | state = state == "hidden" ? "visible" : "hidden"; | ||
171 | Qt.inputMethod.hide(); | 178 | } | ||
172 | } else { | 179 | | ||
173 | item.activated = true; | 180 | states: [ | ||
181 | State { | ||||
182 | name: "visible" | ||||
183 | PropertyChanges { | ||||
184 | target: mainStack | ||||
185 | y: Math.min(0, root.height - inputPanel.height - userListComponent.visibleBoundary) | ||||
186 | } | ||||
187 | PropertyChanges { | ||||
188 | target: inputPanel | ||||
189 | y: root.height - inputPanel.height | ||||
190 | opacity: 1 | ||||
191 | } | ||||
192 | }, | ||||
193 | State { | ||||
194 | name: "hidden" | ||||
195 | PropertyChanges { | ||||
196 | target: mainStack | ||||
197 | y: 0 | ||||
198 | } | ||||
199 | PropertyChanges { | ||||
200 | target: inputPanel | ||||
201 | y: root.height - root.height/4 | ||||
202 | opacity: 0 | ||||
203 | } | ||||
204 | } | ||||
205 | ] | ||||
206 | transitions: [ | ||||
207 | Transition { | ||||
208 | from: "hidden" | ||||
209 | to: "visible" | ||||
210 | SequentialAnimation { | ||||
211 | ScriptAction { | ||||
212 | script: { | ||||
213 | inputPanel.item.activated = true; | ||||
174 | Qt.inputMethod.show(); | 214 | Qt.inputMethod.show(); | ||
175 | } | 215 | } | ||
176 | } | 216 | } | ||
217 | ParallelAnimation { | ||||
218 | NumberAnimation { | ||||
219 | target: mainStack | ||||
220 | property: "y" | ||||
221 | duration: units.longDuration | ||||
222 | easing.type: Easing.InOutQuad | ||||
223 | } | ||||
224 | NumberAnimation { | ||||
225 | target: inputPanel | ||||
226 | property: "y" | ||||
227 | duration: units.longDuration | ||||
228 | easing.type: Easing.OutQuad | ||||
229 | } | ||||
230 | OpacityAnimator { | ||||
231 | target: inputPanel | ||||
232 | duration: units.longDuration | ||||
233 | easing.type: Easing.OutQuad | ||||
234 | } | ||||
235 | } | ||||
236 | } | ||||
237 | }, | ||||
238 | Transition { | ||||
239 | from: "visible" | ||||
240 | to: "hidden" | ||||
241 | SequentialAnimation { | ||||
242 | ParallelAnimation { | ||||
243 | NumberAnimation { | ||||
244 | target: mainStack | ||||
245 | property: "y" | ||||
246 | duration: units.longDuration | ||||
247 | easing.type: Easing.InOutQuad | ||||
248 | } | ||||
249 | NumberAnimation { | ||||
250 | target: inputPanel | ||||
251 | property: "y" | ||||
252 | duration: units.longDuration | ||||
253 | easing.type: Easing.InQuad | ||||
254 | } | ||||
255 | OpacityAnimator { | ||||
256 | target: inputPanel | ||||
257 | duration: units.longDuration | ||||
258 | easing.type: Easing.InQuad | ||||
259 | } | ||||
260 | } | ||||
261 | ScriptAction { | ||||
262 | script: { | ||||
263 | Qt.inputMethod.hide(); | ||||
264 | } | ||||
265 | } | ||||
177 | } | 266 | } | ||
178 | } | 267 | } | ||
268 | ] | ||||
269 | } | ||||
270 | | ||||
179 | 271 | | |||
180 | Component { | 272 | Component { | ||
181 | id: userPromptComponent | 273 | id: userPromptComponent | ||
182 | Login { | 274 | Login { | ||
183 | showUsernamePrompt: true | 275 | showUsernamePrompt: true | ||
184 | notificationMessage: root.notificationMessage | 276 | notificationMessage: root.notificationMessage | ||
185 | 277 | | |||
186 | userListModel: QtObject { | 278 | userListModel: QtObject { | ||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |