mirror of
https://github.com/muesli/telephant
synced 2024-11-13 23:37:11 +00:00
Added AccountSummary widget to sidebar
This commit is contained in:
parent
68aac97fcf
commit
daa30794ea
2 changed files with 108 additions and 30 deletions
64
qml/AccountSummary.qml
Normal file
64
qml/AccountSummary.qml
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue