Added AccountSummary widget to sidebar

This commit is contained in:
Christian Muehlhaeuser 2019-05-05 14:57:56 +02:00
parent 68aac97fcf
commit daa30794ea
No known key found for this signature in database
GPG key ID: 3CF9FA45CA1EBB7E
2 changed files with 108 additions and 30 deletions

64
qml/AccountSummary.qml Normal file
View file

@ -0,0 +1,64 @@
import QtQuick 2.4
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3
ColumnLayout {
RowLayout {
id: accountLayout
anchors.horizontalCenter: parent.horizontalCenter
spacing: 16
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.bottomMargin: 4
ImageButton {
opacity: 1.0
rounded: true
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
source: accountBridge.avatar
sourceSize.height: 64
onClicked: function() {
Qt.openUrlExternally(accountBridge.profileURL)
}
}
ColumnLayout {
Layout.fillWidth: true
Label {
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft
text: accountBridge.name
font.pixelSize: 16
font.bold: true
elide: Label.ElideRight
}
Label {
text: accountBridge.username
font.pixelSize: 16
opacity: 0.7
elide: Label.ElideRight
}
}
}
RowLayout {
anchors.horizontalCenter: parent.horizontalCenter
Label {
Layout.alignment: Qt.AlignLeft
text: "<b>" + accountBridge.posts + "</b> Posts"
font.pixelSize: 11
elide: Label.ElideRight
}
Label {
Layout.alignment: Qt.AlignCenter
text: "<b>" + accountBridge.follows + "</b> Follows"
font.pixelSize: 11
elide: Label.ElideRight
}
Label {
Layout.alignment: Qt.AlignRight
text: "<b>" + accountBridge.followers + "</b> Followers"
font.pixelSize: 11
elide: Label.ElideRight
}
}
}

View file

@ -148,44 +148,58 @@ ApplicationWindow {
height: mainWindow.height
dragMargin: 0
ListView {
id: listView
currentIndex: -1
ColumnLayout {
anchors.fill: parent
delegate: ItemDelegate {
width: parent.width
text: model.title
highlighted: ListView.isCurrentItem
onClicked: {
listView.currentIndex = -1
drawer.close()
AccountSummary {}
ToolSeparator {
Layout.fillWidth: true
orientation: Qt.Horizontal
}
switch (model.sid) {
case 0:
messagePopup.messageid = 0
messagePopup.open()
break
case 1:
Qt.quit()
break
ListView {
id: listView
currentIndex: -1
Layout.fillWidth: true
Layout.fillHeight: true
delegate: ItemDelegate {
width: parent.width
text: model.title
highlighted: ListView.isCurrentItem
onClicked: {
listView.currentIndex = -1
drawer.close()
switch (model.sid) {
case 0:
connectDialog.open()
break
case 1:
messagePopup.messageid = 0
messagePopup.open()
break
case 2:
Qt.quit()
break
}
}
}
}
model: ListModel {
ListElement {
title: qsTr("New Post")
property int sid: 0
model: ListModel {
ListElement {
title: qsTr("Connect")
property int sid: 0
}
ListElement {
title: qsTr("New Post")
property int sid: 1
}
ListElement {
title: qsTr("Exit")
property int sid: 2
}
}
ListElement {
title: qsTr("Exit")
property int sid: 1
ScrollIndicator.vertical: ScrollIndicator {
}
}
ScrollIndicator.vertical: ScrollIndicator {
}
}
}