Support view scroll and rename ImageButton to ImgButton to avoid conflics
This commit is contained in:
parent
5ba039dd4e
commit
622e52b445
|
@ -119,15 +119,16 @@ Item {
|
||||||
|
|
||||||
KeyNavigation.backtab: userButton; KeyNavigation.tab: shutdownButton
|
KeyNavigation.backtab: userButton; KeyNavigation.tab: shutdownButton
|
||||||
}
|
}
|
||||||
ImageButton {
|
ImgButton {
|
||||||
id: loginButton
|
id: loginButton
|
||||||
anchors {
|
anchors {
|
||||||
right: parent.right
|
right: parent.right
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fixme, This is vary strange
|
normalImg: "icons/login_normal.png"
|
||||||
source: "icons/login_normal.png"
|
hoverImg: "icons/login_normal.png"
|
||||||
|
pressImg: "icons/login_press.png"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
glowAnimation.running = true
|
glowAnimation.running = true
|
||||||
sddm.login(userNameText.text, passwdInput.text, sessionIndex)
|
sddm.login(userNameText.text, passwdInput.text, sessionIndex)
|
||||||
|
|
14
Main.qml
14
Main.qml
|
@ -216,35 +216,37 @@ Rectangle {
|
||||||
anchors.rightMargin: hMargin
|
anchors.rightMargin: hMargin
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
ImageButton {
|
ImgButton {
|
||||||
id: sessionButton
|
id: sessionButton
|
||||||
width: m_powerButtonSize
|
width: m_powerButtonSize
|
||||||
height: m_powerButtonSize
|
height: m_powerButtonSize
|
||||||
visible: sessionFrame.isMultipleSessions()
|
visible: sessionFrame.isMultipleSessions()
|
||||||
source: sessionFrame.getCurrentSessionIconIndicator()
|
normalImg: sessionFrame.getCurrentSessionIconIndicator()
|
||||||
onClicked: root.state = "stateSession"
|
onClicked: root.state = "stateSession"
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButton {
|
ImgButton {
|
||||||
id: userButton
|
id: userButton
|
||||||
width: m_powerButtonSize
|
width: m_powerButtonSize
|
||||||
height: m_powerButtonSize
|
height: m_powerButtonSize
|
||||||
visible: userFrame.isMultipleUsers()
|
visible: userFrame.isMultipleUsers()
|
||||||
|
|
||||||
source: "icons/switchframe/userswitch_normal.png"
|
normalImg: "icons/switchframe/userswitch_normal.png"
|
||||||
|
hoverImg: "icons/switchframe/userswitch_hover.png"
|
||||||
|
pressImg: "icons/switchframe/userswitch_press.png"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("Switch User...")
|
console.log("Switch User...")
|
||||||
root.state = "stateUser"
|
root.state = "stateUser"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButton {
|
ImgButton {
|
||||||
id: shutdownButton
|
id: shutdownButton
|
||||||
width: m_powerButtonSize
|
width: m_powerButtonSize
|
||||||
height: m_powerButtonSize
|
height: m_powerButtonSize
|
||||||
visible: true//sddm.canPowerOff
|
visible: true//sddm.canPowerOff
|
||||||
|
|
||||||
source: "icons/switchframe/powermenu.png"
|
normalImg: "icons/switchframe/powermenu.png"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("Show shutdown menu")
|
console.log("Show shutdown menu")
|
||||||
root.state = "statePower"
|
root.state = "statePower"
|
||||||
|
|
|
@ -17,7 +17,7 @@ Item {
|
||||||
width: 100
|
width: 100
|
||||||
height: 150
|
height: 150
|
||||||
|
|
||||||
ImageButton {
|
ImgButton {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
normalImg: "icons/powerframe/shutdown_normal.png"
|
normalImg: "icons/powerframe/shutdown_normal.png"
|
||||||
|
@ -41,7 +41,7 @@ Item {
|
||||||
width: 100
|
width: 100
|
||||||
height: 150
|
height: 150
|
||||||
|
|
||||||
ImageButton {
|
ImgButton {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
normalImg: "icons/powerframe/restart_normal.png"
|
normalImg: "icons/powerframe/restart_normal.png"
|
||||||
|
@ -65,7 +65,7 @@ Item {
|
||||||
width: 100
|
width: 100
|
||||||
height: 150
|
height: 150
|
||||||
|
|
||||||
ImageButton {
|
ImgButton {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
normalImg: "icons/powerframe/suspend_normal.png"
|
normalImg: "icons/powerframe/suspend_normal.png"
|
||||||
|
|
|
@ -6,6 +6,8 @@ Item {
|
||||||
signal selected(var index)
|
signal selected(var index)
|
||||||
signal needClose()
|
signal needClose()
|
||||||
|
|
||||||
|
readonly property int m_viewMaxWidth: frame.width - prevSession.width - nextSession.width - 230;
|
||||||
|
property bool shouldShowBG: false
|
||||||
property var sessionTypeList: ["deepin", "enlightenment", "fluxbox", "gnome", "kde", "lxde", "ubuntu"]
|
property var sessionTypeList: ["deepin", "enlightenment", "fluxbox", "gnome", "kde", "lxde", "ubuntu"]
|
||||||
function getIconName(sessionName) {
|
function getIconName(sessionName) {
|
||||||
for (var item in sessionTypeList) {
|
for (var item in sessionTypeList) {
|
||||||
|
@ -27,21 +29,47 @@ Item {
|
||||||
return sessionList.count > 1
|
return sessionList.count > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onOpacityChanged: {
|
||||||
|
shouldShowBG = false
|
||||||
|
}
|
||||||
|
|
||||||
|
ImgButton {
|
||||||
|
id: prevSession
|
||||||
|
visible: sessionList.childrenRect.width > m_viewMaxWidth
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: 10
|
||||||
|
normalImg: "icons/angle-left.png"
|
||||||
|
onClicked: {
|
||||||
|
sessionList.decrementCurrentIndex()
|
||||||
|
shouldShowBG = true
|
||||||
|
}
|
||||||
|
// KeyNavigation.backtab: btnShutdown; KeyNavigation.tab: listView
|
||||||
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: sessionList
|
id: sessionList
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: childrenRect.width
|
width: childrenRect.width > m_viewMaxWidth ? m_viewMaxWidth : childrenRect.width
|
||||||
height: 80
|
height: 150
|
||||||
|
clip: true
|
||||||
model: sessionModel
|
model: sessionModel
|
||||||
currentIndex: sessionModel.lastIndex
|
currentIndex: sessionModel.lastIndex
|
||||||
orientation: ListView.Horizontal
|
orientation: ListView.Horizontal
|
||||||
delegate: Item {
|
spacing: 10
|
||||||
|
delegate: Rectangle {
|
||||||
property string iconIndicator: iconButton.indicator
|
property string iconIndicator: iconButton.indicator
|
||||||
|
property bool activeBG: sessionList.currentIndex === index && shouldShowBG
|
||||||
|
|
||||||
width: 250
|
border.width: 3
|
||||||
|
border.color: activeBG ? "#33ffffff" : "transparent"
|
||||||
|
radius: 8
|
||||||
|
color: activeBG ? "#55000000" : "transparent"
|
||||||
|
|
||||||
|
width: 230
|
||||||
height: 150
|
height: 150
|
||||||
|
|
||||||
ImageButton {
|
ImgButton {
|
||||||
id: iconButton
|
id: iconButton
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
@ -73,6 +101,20 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImgButton {
|
||||||
|
id: nextSession
|
||||||
|
visible: sessionList.childrenRect.width > m_viewMaxWidth
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: 10
|
||||||
|
normalImg: "icons/angle-right.png"
|
||||||
|
onClicked: {
|
||||||
|
sessionList.incrementCurrentIndex()
|
||||||
|
shouldShowBG = true
|
||||||
|
}
|
||||||
|
// KeyNavigation.backtab: listView; KeyNavigation.tab: session
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
z: -1
|
z: -1
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
@ -6,25 +6,54 @@ Item {
|
||||||
signal selected(var userName)
|
signal selected(var userName)
|
||||||
signal needClose()
|
signal needClose()
|
||||||
|
|
||||||
|
readonly property int m_viewMaxWidth: frame.width - prevUser.width - nextUser.width - 130
|
||||||
property string currentIconPath: usersList.currentItem.iconPath
|
property string currentIconPath: usersList.currentItem.iconPath
|
||||||
property string currentUserName: usersList.currentItem.userName
|
property string currentUserName: usersList.currentItem.userName
|
||||||
|
property bool shouldShowBG: false
|
||||||
|
|
||||||
function isMultipleUsers() {
|
function isMultipleUsers() {
|
||||||
return usersList.count > 1
|
return usersList.count > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onOpacityChanged: {
|
||||||
|
shouldShowBG = false
|
||||||
|
}
|
||||||
|
|
||||||
|
ImgButton {
|
||||||
|
id: prevUser
|
||||||
|
visible: usersList.childrenRect.width > m_viewMaxWidth
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: 10
|
||||||
|
normalImg: "icons/angle-left.png"
|
||||||
|
onClicked: {
|
||||||
|
usersList.decrementCurrentIndex()
|
||||||
|
shouldShowBG = true
|
||||||
|
}
|
||||||
|
// KeyNavigation.backtab: btnShutdown; KeyNavigation.tab: listView
|
||||||
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: usersList
|
id: usersList
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: childrenRect.width
|
width: childrenRect.width > m_viewMaxWidth ? m_viewMaxWidth : childrenRect.width
|
||||||
height: 80
|
height: 150
|
||||||
model: userModel
|
model: userModel
|
||||||
|
clip: true
|
||||||
|
spacing: 10
|
||||||
orientation: ListView.Horizontal
|
orientation: ListView.Horizontal
|
||||||
delegate: Item {
|
|
||||||
|
delegate: Rectangle {
|
||||||
property string iconPath: icon
|
property string iconPath: icon
|
||||||
property string userName: nameText.text
|
property string userName: nameText.text
|
||||||
|
property bool activeBG: usersList.currentIndex === index && shouldShowBG
|
||||||
|
|
||||||
width: 150
|
border.width: 3
|
||||||
|
border.color: activeBG ? "#33ffffff" : "transparent"
|
||||||
|
radius: 8
|
||||||
|
color: activeBG ? "#55000000" : "transparent"
|
||||||
|
|
||||||
|
width: 130
|
||||||
height: 150
|
height: 150
|
||||||
|
|
||||||
UserAvatar {
|
UserAvatar {
|
||||||
|
@ -65,6 +94,20 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImgButton {
|
||||||
|
id: nextUser
|
||||||
|
visible: usersList.childrenRect.width > m_viewMaxWidth
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: 10
|
||||||
|
normalImg: "icons/angle-right.png"
|
||||||
|
onClicked: {
|
||||||
|
usersList.incrementCurrentIndex()
|
||||||
|
shouldShowBG = true
|
||||||
|
}
|
||||||
|
// KeyNavigation.backtab: listView; KeyNavigation.tab: session
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
z: -1
|
z: -1
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 214 B |
Binary file not shown.
After Width: | Height: | Size: 230 B |
Loading…
Reference in New Issue