Update SidePane componants, add Base.HColumnLayout
This commit is contained in:
parent
2e8e042808
commit
87c72e32db
@ -3,21 +3,20 @@ import QtQuick.Controls 2.0
|
|||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.4
|
||||||
import "../base" as Base
|
import "../base" as Base
|
||||||
|
|
||||||
ColumnLayout {
|
Base.HColumnLayout {
|
||||||
id: accountDelegate
|
id: accountDelegate
|
||||||
spacing: 0
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
RowLayout {
|
property string roomListUserId: userId
|
||||||
|
|
||||||
|
Base.HRowLayout {
|
||||||
id: row
|
id: row
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Base.HAvatar { id: avatar; name: displayName; dimension: 36 }
|
Base.HAvatar { id: avatar; name: displayName; dimension: 36 }
|
||||||
|
|
||||||
ColumnLayout {
|
Base.HColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Base.HLabel {
|
Base.HLabel {
|
||||||
id: accountLabel
|
id: accountLabel
|
||||||
@ -29,22 +28,20 @@ ColumnLayout {
|
|||||||
rightPadding: leftPadding
|
rightPadding: leftPadding
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
Base.HTextField {
|
||||||
id: statusEdit
|
id: statusEdit
|
||||||
text: statusMessage || ""
|
text: statusMessage || ""
|
||||||
placeholderText: qsTr("Set status message")
|
placeholderText: qsTr("Set status message")
|
||||||
|
font.pixelSize: Base.HStyle.fontSize.small
|
||||||
background: null
|
background: null
|
||||||
color: "black"
|
|
||||||
selectByMouse: true
|
|
||||||
font.family: "Roboto"
|
|
||||||
font.pixelSize: 12
|
|
||||||
Layout.fillWidth: true
|
|
||||||
padding: 0
|
padding: 0
|
||||||
leftPadding: accountLabel.leftPadding
|
leftPadding: accountLabel.leftPadding
|
||||||
rightPadding: leftPadding
|
rightPadding: leftPadding
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
Backend.setStatusMessage(userId, text)
|
//Backend.setStatusMessage(userId, text)
|
||||||
pageStack.forceActiveFocus()
|
pageStack.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,17 +62,12 @@ ColumnLayout {
|
|||||||
id: roomList
|
id: roomList
|
||||||
visible: true
|
visible: true
|
||||||
interactive: false // no scrolling
|
interactive: false // no scrolling
|
||||||
forUserId: userId
|
userId: roomListUserId
|
||||||
|
|
||||||
Layout.minimumHeight:
|
Layout.preferredHeight: roomList.visible ? roomList.contentHeight : 0
|
||||||
roomList.visible ?
|
|
||||||
roomList.contentHeight :
|
|
||||||
0
|
|
||||||
Layout.maximumHeight: Layout.minimumHeight
|
|
||||||
|
|
||||||
Layout.minimumWidth:
|
Layout.preferredWidth:
|
||||||
parent.width - Layout.leftMargin - Layout.rightMargin
|
parent.width - Layout.leftMargin - Layout.rightMargin
|
||||||
Layout.maximumWidth: Layout.minimumWidth
|
|
||||||
|
|
||||||
Layout.margins: accountList.spacing
|
Layout.margins: accountList.spacing
|
||||||
Layout.leftMargin:
|
Layout.leftMargin:
|
@ -4,8 +4,13 @@ import QtQuick.Layouts 1.4
|
|||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: accountList
|
id: accountList
|
||||||
|
clip: true
|
||||||
|
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
Layout.leftMargin: spacing
|
||||||
|
topMargin: spacing
|
||||||
|
bottomMargin: spacing
|
||||||
|
|
||||||
model: Backend.models.accounts
|
model: Backend.models.accounts
|
||||||
delegate: AccountDelegate {}
|
delegate: AccountDelegate {}
|
||||||
clip: true
|
|
||||||
}
|
}
|
@ -5,29 +5,32 @@ import "../base" as Base
|
|||||||
import "utils.js" as SidePaneJS
|
import "utils.js" as SidePaneJS
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: root
|
id: roomDelegate
|
||||||
width: roomList.width
|
width: roomList.width
|
||||||
height: roomList.childrenHeight
|
height: roomList.childrenHeight
|
||||||
|
|
||||||
onClicked: pageStack.showRoom(roomList.forUserId, roomId)
|
onClicked: pageStack.showRoom(roomList.userId, roomId)
|
||||||
|
|
||||||
RowLayout {
|
Base.HRowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
id: row
|
id: row
|
||||||
spacing: 1
|
spacing: 1
|
||||||
|
|
||||||
Base.HAvatar { id: avatar; name: displayName; dimension: root.height }
|
Base.HAvatar {
|
||||||
|
id: roomAvatar
|
||||||
ColumnLayout {
|
name: displayName
|
||||||
spacing: 0
|
dimension: roomDelegate.height
|
||||||
|
}
|
||||||
|
|
||||||
|
Base.HColumnLayout {
|
||||||
Base.HLabel {
|
Base.HLabel {
|
||||||
id: roomLabel
|
id: roomLabel
|
||||||
text: displayName ? displayName : "<i>Empty room</i>"
|
text: displayName ? displayName : "<i>Empty room</i>"
|
||||||
textFormat: Text.StyledText
|
textFormat: Text.StyledText
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
Layout.maximumWidth: row.width - row.spacing - avatar.width
|
Layout.maximumWidth:
|
||||||
|
row.width - row.totalSpacing - roomAvatar.width
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
|
||||||
topPadding: -2
|
topPadding: -2
|
||||||
@ -35,10 +38,11 @@ MouseArea {
|
|||||||
leftPadding: 5
|
leftPadding: 5
|
||||||
rightPadding: leftPadding
|
rightPadding: leftPadding
|
||||||
}
|
}
|
||||||
|
|
||||||
Base.HLabel {
|
Base.HLabel {
|
||||||
function getText() {
|
function getText() {
|
||||||
return SidePaneJS.getLastRoomEventText(
|
return SidePaneJS.getLastRoomEventText(
|
||||||
roomId, roomList.forUserId
|
roomId, roomList.userId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ import QtQuick.Layouts 1.4
|
|||||||
import "../base" as Base
|
import "../base" as Base
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
property var forUserId: null
|
property var userId: null
|
||||||
|
|
||||||
property int childrenHeight: 36
|
property int childrenHeight: 36
|
||||||
property int sectionHeight: 16 + spacing
|
property int sectionHeight: 16 + spacing
|
||||||
@ -31,7 +31,7 @@ ListView {
|
|||||||
|
|
||||||
id: roomList
|
id: roomList
|
||||||
spacing: 8
|
spacing: 8
|
||||||
model: Backend.models.rooms.get(forUserId)
|
model: Backend.models.rooms.get(userId)
|
||||||
delegate: RoomDelegate {}
|
delegate: RoomDelegate {}
|
||||||
|
|
||||||
section.property: "category"
|
section.property: "category"
|
@ -10,15 +10,14 @@ Base.HGlassRectangle {
|
|||||||
|
|
||||||
isPageStackDescendant: false
|
isPageStackDescendant: false
|
||||||
|
|
||||||
ColumnLayout {
|
Base.HColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
AccountList {
|
AccountList {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
|
|
||||||
HToolBar {}
|
PaneToolBar {}
|
||||||
}
|
}
|
||||||
}
|
}
|
11
harmonyqml/components/base/HColumnLayout.qml
Normal file
11
harmonyqml/components/base/HColumnLayout.qml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.2
|
||||||
|
import QtQuick.Layouts 1.4
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnLayout
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
property int totalSpacing:
|
||||||
|
spacing * Math.max(0, (columnLayout.visibleChildren.length - 1))
|
||||||
|
}
|
@ -4,6 +4,7 @@ import QtQuick.Controls 2.0
|
|||||||
TextField {
|
TextField {
|
||||||
font.family: HStyle.fontFamily.sans
|
font.family: HStyle.fontFamily.sans
|
||||||
font.pixelSize: HStyle.fontSize.normal
|
font.pixelSize: HStyle.fontSize.normal
|
||||||
|
color: HStyle.colors.foreground
|
||||||
|
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user