X-Git-Url: https://www.flypig.org.uk/git/?p=openvpnui.git;a=blobdiff_plain;f=qml%2Ffilebrowse%2Fpages%2FViewPage.qml;fp=qml%2Ffilebrowse%2Fpages%2FViewPage.qml;h=e0b945ab6778270e5b0d28810b2b202f024825ad;hp=0000000000000000000000000000000000000000;hb=e24363e314aca32e7bee952f02f517a04a8dc5f2;hpb=ee3968ffa08d4e0fcbad87765efa3aeb32ff0554 diff --git a/qml/filebrowse/pages/ViewPage.qml b/qml/filebrowse/pages/ViewPage.qml new file mode 100644 index 0000000..e0b945a --- /dev/null +++ b/qml/filebrowse/pages/ViewPage.qml @@ -0,0 +1,80 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import "functions.js" as Functions +import "../components" + +Page { + id: page + allowedOrientations: Orientation.All + property string path: "" + + SilicaFlickable { + id: flickable + anchors.fill: parent + contentHeight: column.height + VerticalScrollDecorator { flickable: flickable } + + Column { + id: column + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: Theme.paddingLarge + anchors.rightMargin: Theme.paddingLarge + + PageHeader { title: Functions.lastPartOfPath(page.path) } + + Label { + id: portraitText + textFormat: Text.PlainText + width: parent.width + wrapMode: Text.WrapAnywhere + font.pixelSize: Theme.fontSizeTiny + font.family: "Monospace" + color: Theme.highlightColor + visible: page.orientation === Orientation.Portrait + } + Label { + id: landscapeText + textFormat: Text.PlainText + width: parent.width + wrapMode: Text.WrapAnywhere + font.pixelSize: Theme.fontSizeTiny + font.family: "Monospace" + color: Theme.highlightColor + visible: page.orientation === Orientation.Landscape + } + Spacer { + height: 40 + visible: message.text !== "" + } + Label { + id: message + width: parent.width + wrapMode: Text.Wrap + // show medium size if there is no portrait (or landscape text) + // in that case, this message becomes main message + font.pixelSize: portraitText.text === "" ? Theme.fontSizeMedium : Theme.fontSizeTiny + color: portraitText.text === "" ? Theme.highlightColor : Theme.secondaryColor + horizontalAlignment: Text.AlignHCenter + visible: message.text !== "" + } + Spacer { + height: 40 + visible: message.text !== "" + } + } + } + + // update cover + onStatusChanged: { + if (status === PageStatus.Activating) { + // reading file returns three texts, message, portrait and landscape texts + var txts = engine.readFile(page.path); + message.text = txts[0]; + portraitText.text = txts[1]; + landscapeText.text = txts[2]; + } + } +} + +