~verzegnassi-stefano/+junk/docviewer-tmp-001

« back to all changes in this revision

Viewing changes to src/app/qml/TextView.qml

  • Committer: Tarmac
  • Author(s): David Planella, Stefano Verzegnassi
  • Date: 2014-10-29 08:08:25 UTC
  • mfrom: (31.1.28 add-plugin)
  • Revision ID: tarmac-20141029080825-3z9xameaqsd28rgp
New UI design for plain text viewer.

Approved by Ubuntu Phone Apps Jenkins Bot, Stefano Verzegnassi.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import QtQuick 2.3
2
2
import Ubuntu.Components 1.1
 
3
import Ubuntu.Components.Themes.Ambiance 0.1
3
4
 
4
5
import "utils.js" as Utils
5
6
 
15
16
        }
16
17
    ]
17
18
 
 
19
    Scrollbar {
 
20
        flickableItem: flickable
 
21
    }
 
22
 
18
23
    Flickable {
19
24
        id: flickable
20
25
        anchors.fill: parent
21
26
        contentHeight: columnMain.height
22
27
        contentWidth: parent.width
23
28
 
 
29
        boundsBehavior: Flickable.StopAtBounds
24
30
 
25
31
        Column {
26
32
            id: columnMain
27
33
            objectName: "columnMain"
28
 
            width: parent.width
 
34
 
 
35
            anchors {
 
36
                left: parent.left
 
37
                right: parent.right
 
38
                top: parent.top
 
39
            }
 
40
 
29
41
            spacing: 10
30
42
 
31
43
            TextArea {
42
54
 
43
55
                text: "Loading..."
44
56
 
 
57
                // Use Ubuntu Mono font so we can know how many chars are placed in a single line.
 
58
                font.family: "UbuntuMono"
 
59
 
 
60
                property int maxCharsPerLine: contentWidth / (font.pixelSize * 0.5)
 
61
                // Ubuntu Mono font ratio is 1:2 (width:height)
 
62
 
45
63
                signal loadCompleted()
46
64
 
47
65
                Component.onCompleted: {
56
74
                    }
57
75
 
58
76
                    xhr.send();
 
77
                    flickable.forceActiveFocus()
 
78
                }
 
79
 
 
80
                style: TextAreaStyle {
 
81
                    background: Item {
 
82
                        id: bgItem
 
83
                        anchors.fill: parent
 
84
                    }
59
85
                }
60
86
            }
61
87
        }
84
110
            flickable.flick( 0, -height / 2)
85
111
        }
86
112
    }
87
 
 
88
113
}