/* * Copyright 2016 Eric Hameleers, Eindhoven, NL * All rights reserved. * * Permission to use, copy, modify, and distribute this software for * any purpose with or without fee is hereby granted, provided that * the above copyright notice and this permission notice appear in all * copies. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ import QtQuick 2.2 import SddmComponents 2.0 Rectangle { id: container width: 1024 height: 768 property int sessionIndex: session.index TextConstants { id: textConstants } Connections { target: sddm onLoginSucceeded: { } onLoginFailed: { txtMessage.text = textConstants.loginFailed listView.currentItem.password.text = "" } } Repeater { model: screenModel Background { x: geometry.x; y: geometry.y; width: geometry.width; height:geometry.height source: config.background fillMode: Image.PreserveAspectCrop onStatusChanged: { if (status == Image.Error && source != config.defaultBackground) { source = config.defaultBackground } } } } Rectangle { property variant geometry: screenModel.geometry(screenModel.primary) x: geometry.x; y: geometry.y; width: geometry.width; height: geometry.height color: "transparent" Component { id: userDelegate PictureBox { anchors.verticalCenter: parent.verticalCenter name: (model.realName === "") ? model.name : model.realName icon: model.icon focus: (listView.currentIndex === index) ? true : false state: (listView.currentIndex === index) ? "active" : "" onLogin: sddm.login(model.name, password, sessionIndex); MouseArea { anchors.fill: parent hoverEnabled: true onEntered: listView.currentIndex = index onClicked: listView.focus = true } } } Row { anchors.fill: parent Text { id: txtMessage anchors.top: usersContainer.bottom; anchors.margins: 20 anchors.horizontalCenter: parent.horizontalCenter color: "white" text: textConstants.promptSelectUser font.pixelSize: 16 font.family: "sans" } Item { id: usersContainer width: parent.width; height: 300 anchors.verticalCenter: parent.verticalCenter ImageButton { id: prevUser anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter anchors.margins: 10 source: "angle-left.png" onClicked: listView.decrementCurrentIndex() KeyNavigation.backtab: btnShutdown; KeyNavigation.tab: listView } ListView { id: listView height: parent.height anchors.left: prevUser.right; anchors.right: nextUser.left anchors.verticalCenter: parent.verticalCenter anchors.margins: 10 clip: true focus: true spacing: 5 model: userModel delegate: userDelegate orientation: ListView.Horizontal currentIndex: userModel.lastIndex KeyNavigation.backtab: prevUser; KeyNavigation.tab: nextUser } ImageButton { id: nextUser anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter anchors.margins: 10 source: "angle-right.png" onClicked: listView.incrementCurrentIndex() KeyNavigation.backtab: listView; KeyNavigation.tab: session } } } } Rectangle { id: actionBar anchors.top: parent.top; anchors.horizontalCenter: parent.horizontalCenter width: parent.width; height: 64 color: "#44ffffff" Row { anchors.left: parent.left anchors.margins: 5 height: parent.height spacing: 5 Text { height: parent.height anchors.verticalCenter: parent.verticalCenter text: textConstants.session font.pixelSize: 14 color: "white" verticalAlignment: Text.AlignVCenter } ComboBox { id: session width: 245 anchors.verticalCenter: parent.verticalCenter arrowIcon: "angle-down.png" model: sessionModel index: sessionModel.lastIndex font.pixelSize: 14 color: "#44ffffff" KeyNavigation.backtab: nextUser; KeyNavigation.tab: layoutBox } Text { height: parent.height anchors.verticalCenter: parent.verticalCenter text: textConstants.layout font.pixelSize: 14 color: "white" verticalAlignment: Text.AlignVCenter } LayoutBox { id: layoutBox width: 90 anchors.verticalCenter: parent.verticalCenter font.pixelSize: 14 arrowIcon: "angle-down.png" KeyNavigation.backtab: session; KeyNavigation.tab: btnShutdown } } Row { height: parent.height anchors.right: parent.right anchors.margins: 5 spacing: 5 ImageButton { id: btnReboot height: parent.height source: "reboot.png" visible: sddm.canReboot onClicked: sddm.reboot() KeyNavigation.backtab: layoutBox; KeyNavigation.tab: btnShutdown } ImageButton { id: btnShutdown height: parent.height source: "shutdown.png" visible: sddm.canPowerOff onClicked: sddm.powerOff() KeyNavigation.backtab: btnReboot; KeyNavigation.tab: prevUser } Clock { id: clock anchors.margins: 5 anchors.top: parent.top; anchors.right: parent.right color: "white" timeFont.family: "sans" timeFont.bold: true timeFont.pixelSize: 28 dateFont.pixelSize: 12 } } } }