Commit 0af26d44 authored by Paweł Wegner's avatar Paweł Wegner

cloudbrowser: reworked file info view.

parent 564b665d
...@@ -135,6 +135,17 @@ Kirigami.ScrollablePage { ...@@ -135,6 +135,17 @@ Kirigami.ScrollablePage {
} }
] ]
function show_size(size) {
if (size < 1024)
return size + " B";
else if (size < 1024 * 1024)
return (size / 1024).toFixed(2) + " KB";
else if (size < 1024 * 1024 * 1024)
return (size / (1024 * 1024)).toFixed(2) + " MB";
else
return (size / (1024 * 1024 * 1024)).toFixed(2) + " GB";
}
Kirigami.OverlaySheet { Kirigami.OverlaySheet {
id: file_info_sheet id: file_info_sheet
Item { Item {
...@@ -149,66 +160,41 @@ Kirigami.ScrollablePage { ...@@ -149,66 +160,41 @@ Kirigami.ScrollablePage {
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
Column { ListView {
id: file_list
anchors.top: file_name.bottom anchors.top: file_name.bottom
width: parent.implicitWidth * 0.8 anchors.left: parent.left
anchors.horizontalCenter: parent.horizontalCenter anchors.right: parent.right
Rectangle { height: childrenRect.height
width: parent.width boundsBehavior: Flickable.StopAtBounds
height: childrenRect.height model: [
border.width: 1 {
anchors.leftMargin: 10 "name": "size",
Column { "value": root.selected_item && root.selected_item.size !== -1 ?
width: parent.width show_size(root.selected_item.size) : ""
Item { },
visible: root.selected_item ? root.selected_item.size !== -1 : "" {
anchors.left: parent.left "name": "last modified",
anchors.right: parent.right "value": root.selected_item && root.selected_item.timestamp !== -1 ?
anchors.margins: 10 root.selected_item.timestamp : ""
height: 50 }
Text { ]
anchors.verticalCenter: parent.verticalCenter delegate: Kirigami.BasicListItem {
anchors.left: parent.left icon: ""
font.pointSize: 12 visible: modelData.value !== ""
text: "size" anchors.margins: 10
} height: visible ? 50 : 0
Text { Text {
function show_size(size) { anchors.verticalCenter: parent.verticalCenter
if (size < 1024) anchors.left: parent.left
return size + " B"; font.pointSize: 12
else if (size < 1024 * 1024) text: modelData.name
return (size / 1024).toFixed(2) + " KB"; }
else if (size < 1024 * 1024 * 1024) Text {
return (size / (1024 * 1024)).toFixed(2) + " MB"; font.pointSize: 16
else text: modelData.value
return (size / (1024 * 1024 * 1024)).toFixed(2) + " GB"; anchors.verticalCenter: parent.verticalCenter
} anchors.right: parent.right
font.pointSize: 16
text: root.selected_item ? show_size(root.selected_item.size) : ""
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
}
}
Item {
visible: root.selected_item ? root.selected_item.timestamp !== "" : false
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 10
height: 50
Text {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
font.pointSize: 12
text: "last modified"
}
Text {
font.pointSize: 16
text: root.selected_item ? root.selected_item.timestamp : ""
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
}
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment