Changeset View
Changeset View
Standalone View
Standalone View
sddm-theme/Main.qml
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 56 | Background { | |||
---|---|---|---|---|---|
57 | x: geometry.x; y: geometry.y; width: geometry.width; height: geometry.height | 57 | x: geometry.x; y: geometry.y; width: geometry.width; height: geometry.height | ||
58 | sceneBackgroundType: config.type | 58 | sceneBackgroundType: config.type | ||
59 | sceneBackgroundColor: config.color | 59 | sceneBackgroundColor: config.color | ||
60 | sceneBackgroundImage: config.background | 60 | sceneBackgroundImage: config.background | ||
61 | } | 61 | } | ||
62 | } | 62 | } | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | MouseArea { | | |||
66 | id: loginScreenRoot | | |||
67 | anchors.fill: parent | | |||
68 | | ||||
69 | property bool uiVisible: true | | |||
70 | property bool blockUI: mainStack.depth > 1 || userListComponent.mainPasswordBox.text.length > 0 || inputPanel.keyboardActive || config.type != "image" | | |||
71 | | ||||
72 | hoverEnabled: true | | |||
73 | drag.filterChildren: true | | |||
74 | onPressed: uiVisible = true; | | |||
75 | onPositionChanged: uiVisible = true; | | |||
76 | onUiVisibleChanged: { | | |||
77 | if (blockUI) { | | |||
78 | fadeoutTimer.running = false; | | |||
79 | } else if (uiVisible) { | | |||
80 | fadeoutTimer.restart(); | | |||
81 | } | | |||
82 | } | | |||
83 | onBlockUIChanged: { | | |||
84 | if (blockUI) { | | |||
85 | fadeoutTimer.running = false; | | |||
86 | uiVisible = true; | | |||
87 | } else { | | |||
88 | fadeoutTimer.restart(); | | |||
89 | } | | |||
90 | } | | |||
91 | | ||||
92 | Keys.onPressed: { | | |||
93 | uiVisible = true; | | |||
94 | event.accepted = false; | | |||
95 | } | | |||
96 | | ||||
97 | //takes one full minute for the ui to disappear | | |||
98 | Timer { | | |||
99 | id: fadeoutTimer | | |||
100 | running: true | | |||
101 | interval: 60000 | | |||
102 | onTriggered: { | | |||
103 | if (!loginScreenRoot.blockUI) { | | |||
104 | loginScreenRoot.uiVisible = false; | | |||
105 | } | | |||
106 | } | | |||
107 | } | | |||
108 | WallpaperFader { | | |||
109 | visible: config.type == "image" | | |||
110 | anchors.fill: parent | | |||
111 | state: loginScreenRoot.uiVisible ? "on" : "off" | | |||
112 | source: wallpaper | | |||
113 | mainStack: mainStack | | |||
114 | footer: footer | | |||
115 | clock: clock | | |||
116 | } | | |||
117 | | ||||
118 | Clock { | 65 | Clock { | ||
119 | id: clock | 66 | id: clock | ||
120 | visible: y > 0 | 67 | visible: y > 0 | ||
121 | y: (userListComponent.userList.y + mainStack.y)/2 - height/2 | 68 | y: (userListComponent.userList.y + mainStack.y)/2 - height/2 | ||
122 | anchors.horizontalCenter: parent.horizontalCenter | 69 | anchors.horizontalCenter: parent.horizontalCenter | ||
123 | } | 70 | } | ||
124 | 71 | | |||
125 | 72 | | |||
126 | StackView { | 73 | StackView { | ||
127 | id: mainStack | 74 | id: mainStack | ||
128 | anchors { | 75 | anchors { | ||
129 | left: parent.left | 76 | left: parent.left | ||
130 | right: parent.right | 77 | right: parent.right | ||
131 | } | 78 | } | ||
132 | height: root.height | 79 | height: root.height | ||
133 | 80 | | |||
134 | focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it | 81 | focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it | ||
135 | 82 | | |||
136 | Timer { | | |||
137 | //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 | | |||
138 | //it is fixed in 6d5b36b28907b16280ff78995fef764bb0c573db which will be 0.14 | | |||
139 | //we need to call "window->activate()" *After* it's been shown. We can't control that in QML so we use a shoddy timer | | |||
140 | //it's been this way for all Plasma 5.x without a huge problem | | |||
141 | running: true | | |||
142 | repeat: false | | |||
143 | interval: 200 | | |||
144 | onTriggered: mainStack.forceActiveFocus() | | |||
145 | } | | |||
146 | | ||||
147 | initialItem: Login { | 83 | initialItem: Login { | ||
148 | id: userListComponent | 84 | id: userListComponent | ||
149 | userListModel: userModel | 85 | userListModel: userModel | ||
150 | loginScreenUiVisible: loginScreenRoot.uiVisible | | |||
151 | userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0 | 86 | userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0 | ||
152 | lastUserName: userModel.lastUser | 87 | lastUserName: userModel.lastUser | ||
153 | showUserList: { | 88 | showUserList: { | ||
154 | if ( !userListModel.hasOwnProperty("count") | 89 | if ( !userListModel.hasOwnProperty("count") | ||
155 | || !userListModel.hasOwnProperty("disableAvatarsThreshold")) | 90 | || !userListModel.hasOwnProperty("disableAvatarsThreshold")) | ||
156 | return (userList.y + mainStack.y) > 0 | 91 | return (userList.y + mainStack.y) > 0 | ||
157 | 92 | | |||
158 | if ( userListModel.count == 0 ) return false | 93 | if ( userListModel.count == 0 ) return false | ||
Show All 10 Lines | 100 | if (keystateSource.data["Caps Lock"]["Locked"]) { | |||
169 | } | 104 | } | ||
170 | } | 105 | } | ||
171 | text += root.notificationMessage | 106 | text += root.notificationMessage | ||
172 | return text | 107 | return text | ||
173 | } | 108 | } | ||
174 | 109 | | |||
175 | actionItems: [ | 110 | actionItems: [ | ||
176 | ActionButton { | 111 | ActionButton { | ||
177 | iconSource: "system-suspend" | 112 | iconSource: "system-suspend-translucent" | ||
178 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Suspend") | 113 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Suspend") | ||
114 | labelShadow: true | ||||
179 | onClicked: sddm.suspend() | 115 | onClicked: sddm.suspend() | ||
180 | enabled: sddm.canSuspend | 116 | enabled: sddm.canSuspend | ||
181 | visible: !inputPanel.keyboardActive | 117 | visible: !inputPanel.keyboardActive | ||
182 | }, | 118 | }, | ||
183 | ActionButton { | 119 | ActionButton { | ||
184 | iconSource: "system-reboot" | 120 | iconSource: "system-reboot-translucent" | ||
185 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Restart") | 121 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Restart") | ||
122 | labelShadow: true | ||||
186 | onClicked: sddm.reboot() | 123 | onClicked: sddm.reboot() | ||
187 | enabled: sddm.canReboot | 124 | enabled: sddm.canReboot | ||
188 | visible: !inputPanel.keyboardActive | 125 | visible: !inputPanel.keyboardActive | ||
189 | }, | 126 | }, | ||
190 | ActionButton { | 127 | ActionButton { | ||
191 | iconSource: "system-shutdown" | 128 | iconSource: "system-shutdown-translucent" | ||
192 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shut Down") | 129 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shut Down") | ||
130 | labelShadow: true | ||||
193 | onClicked: sddm.powerOff() | 131 | onClicked: sddm.powerOff() | ||
194 | enabled: sddm.canPowerOff | 132 | enabled: sddm.canPowerOff | ||
195 | visible: !inputPanel.keyboardActive | 133 | visible: !inputPanel.keyboardActive | ||
196 | }, | 134 | }, | ||
197 | ActionButton { | 135 | ActionButton { | ||
198 | iconSource: "system-switch-user" | 136 | iconSource: "system-switch-user-translucent" | ||
199 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Different User") | 137 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Different User") | ||
138 | labelShadow: true | ||||
200 | onClicked: mainStack.push(userPromptComponent) | 139 | onClicked: mainStack.push(userPromptComponent) | ||
201 | enabled: true | 140 | enabled: true | ||
202 | visible: !userListComponent.showUsernamePrompt && !inputPanel.keyboardActive | 141 | visible: !userListComponent.showUsernamePrompt && !inputPanel.keyboardActive | ||
203 | }] | 142 | }] | ||
204 | 143 | | |||
205 | onLoginRequest: { | 144 | onLoginRequest: { | ||
206 | root.notificationMessage = "" | 145 | root.notificationMessage = "" | ||
207 | sddm.login(username, password, sessionButton.currentIndex) | 146 | sddm.login(username, password, sessionButton.currentIndex) | ||
208 | } | 147 | } | ||
209 | } | 148 | } | ||
210 | | ||||
211 | Behavior on opacity { | | |||
212 | OpacityAnimator { | | |||
213 | duration: units.longDuration | | |||
214 | } | | |||
215 | } | | |||
216 | } | 149 | } | ||
217 | 150 | | |||
218 | Loader { | 151 | Loader { | ||
219 | id: inputPanel | 152 | id: inputPanel | ||
220 | state: "hidden" | 153 | state: "hidden" | ||
221 | property bool keyboardActive: item ? item.active : false | 154 | property bool keyboardActive: item ? item.active : false | ||
222 | onKeyboardActiveChanged: { | 155 | onKeyboardActiveChanged: { | ||
223 | if (keyboardActive) { | 156 | if (keyboardActive) { | ||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 254 | script: { | |||
322 | Qt.inputMethod.hide(); | 255 | Qt.inputMethod.hide(); | ||
323 | } | 256 | } | ||
324 | } | 257 | } | ||
325 | } | 258 | } | ||
326 | } | 259 | } | ||
327 | ] | 260 | ] | ||
328 | } | 261 | } | ||
329 | 262 | | |||
330 | | ||||
331 | Component { | 263 | Component { | ||
332 | id: userPromptComponent | 264 | id: userPromptComponent | ||
333 | Login { | 265 | Login { | ||
334 | showUsernamePrompt: true | 266 | showUsernamePrompt: true | ||
335 | notificationMessage: root.notificationMessage | 267 | notificationMessage: root.notificationMessage | ||
336 | loginScreenUiVisible: loginScreenRoot.uiVisible | | |||
337 | 268 | | |||
338 | userListModel: QtObject { | 269 | userListModel: QtObject { | ||
339 | property string name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Log in as a different user") | 270 | property string name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Log in as a different user") | ||
340 | property string iconSource: "" | 271 | property string iconSource: "" | ||
341 | } | 272 | } | ||
342 | 273 | | |||
343 | onLoginRequest: { | 274 | onLoginRequest: { | ||
344 | root.notificationMessage = "" | 275 | root.notificationMessage = "" | ||
345 | sddm.login(username, password, sessionButton.currentIndex) | 276 | sddm.login(username, password, sessionButton.currentIndex) | ||
346 | } | 277 | } | ||
347 | 278 | | |||
348 | actionItems: [ | 279 | actionItems: [ | ||
349 | ActionButton { | 280 | ActionButton { | ||
350 | iconSource: "go-previous" | 281 | iconSource: "go-previous-translucent" | ||
351 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Back") | 282 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Back") | ||
352 | onClicked: mainStack.pop() | 283 | onClicked: mainStack.pop() | ||
284 | labelShadow: true | ||||
353 | } | 285 | } | ||
354 | ] | 286 | ] | ||
355 | } | 287 | } | ||
356 | } | 288 | } | ||
357 | 289 | | |||
358 | //Footer | 290 | //Footer | ||
359 | RowLayout { | 291 | Rectangle { | ||
360 | id: footer | 292 | id: footer | ||
361 | anchors { | 293 | anchors { | ||
362 | bottom: parent.bottom | 294 | bottom: parent.bottom | ||
363 | left: parent.left | 295 | left: parent.left | ||
364 | right: parent.right | 296 | right: parent.right | ||
365 | margins: units.smallSpacing | | |||
366 | } | 297 | } | ||
298 | height: footerLayout.implicitHeight + (units.smallSpacing * 2) | ||||
davidedmundson: This is now choosing an arbitrary size and hoping the contents happen to be smaller. | |||||
299 | | ||||
300 | color: PlasmaCore.ColorScope.backgroundColor | ||||
301 | opacity: 0.9 | ||||
367 | 302 | | |||
368 | Behavior on opacity { | 303 | Behavior on opacity { | ||
369 | OpacityAnimator { | 304 | OpacityAnimator { | ||
370 | duration: units.longDuration | 305 | duration: units.longDuration | ||
371 | } | 306 | } | ||
372 | } | 307 | } | ||
373 | 308 | | |||
309 | RowLayout { | ||||
310 | id: footerLayout | ||||
311 | anchors { | ||||
312 | fill: parent | ||||
313 | margins: units.smallSpacing | ||||
314 | } | ||||
315 | | ||||
374 | PlasmaComponents.ToolButton { | 316 | PlasmaComponents.ToolButton { | ||
375 | text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to show/hide virtual keyboard", "Virtual Keyboard") | 317 | text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to show/hide virtual keyboard", "Virtual Keyboard") | ||
376 | iconName: inputPanel.keyboardActive ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off" | 318 | iconName: inputPanel.keyboardActive ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off" | ||
377 | onClicked: inputPanel.showHide() | 319 | onClicked: inputPanel.showHide() | ||
378 | visible: inputPanel.status == Loader.Ready | 320 | visible: inputPanel.status == Loader.Ready | ||
379 | } | 321 | } | ||
380 | 322 | | |||
381 | KeyboardButton { | 323 | KeyboardButton { | ||
Show All 40 Lines |
This is now choosing an arbitrary size and hoping the contents happen to be smaller.
Generally (if possible) you want views to fit contents, not squish contents to view.
i.e
height: theInnerLayout.implicitHeight