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,62 +160,39 @@ Kirigami.ScrollablePage { ...@@ -149,62 +160,39 @@ 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.horizontalCenter: parent.horizontalCenter
Rectangle {
width: parent.width
height: childrenRect.height
border.width: 1
anchors.leftMargin: 10
Column {
width: parent.width
Item {
visible: root.selected_item ? root.selected_item.size !== -1 : ""
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.margins: 10 height: childrenRect.height
height: 50 boundsBehavior: Flickable.StopAtBounds
Text { model: [
anchors.verticalCenter: parent.verticalCenter {
anchors.left: parent.left "name": "size",
font.pointSize: 12 "value": root.selected_item && root.selected_item.size !== -1 ?
text: "size" show_size(root.selected_item.size) : ""
} },
Text { {
function show_size(size) { "name": "last modified",
if (size < 1024) "value": root.selected_item && root.selected_item.timestamp !== -1 ?
return size + " B"; root.selected_item.timestamp : ""
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";
}
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 delegate: Kirigami.BasicListItem {
anchors.left: parent.left icon: ""
anchors.right: parent.right visible: modelData.value !== ""
anchors.margins: 10 anchors.margins: 10
height: 50 height: visible ? 50 : 0
Text { Text {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
font.pointSize: 12 font.pointSize: 12
text: "last modified" text: modelData.name
} }
Text { Text {
font.pointSize: 16 font.pointSize: 16
text: root.selected_item ? root.selected_item.timestamp : "" text: modelData.value
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
} }
...@@ -212,8 +200,6 @@ Kirigami.ScrollablePage { ...@@ -212,8 +200,6 @@ Kirigami.ScrollablePage {
} }
} }
} }
}
}
Kirigami.OverlaySheet { Kirigami.OverlaySheet {
id: create_directory_sheet id: create_directory_sheet
......
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