~mutse-young/ubuntu-docviewer-app/trunk

« back to all changes in this revision

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

  • Committer: David Planella
  • Date: 2014-10-28 22:01:16 UTC
  • mfrom: (31.2.8 add-poppler-plugin)
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: david.planella@ubuntu.com-20141028220116-bryaeq3if69o6r6o
Merged branch to add Poppler plugin

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
 
 
4
 
Image
5
 
{
6
 
 
7
 
    property double fixedWidth
8
 
 
9
 
    id: imagePage
10
 
    asynchronous: true
 
3
import QtGraphicalEffects 1.0
 
4
 
 
5
Rectangle {
 
6
    id: pdfPage
11
7
    width: parent.width
12
 
    sourceSize.width: fixedWidth
13
 
    fillMode: Image.PreserveAspectCrop
14
 
    source: "image://poppler/page/1"
15
 
 
16
 
    Connections {
17
 
        target: parent
18
 
 
19
 
        onShouldReloadImgChanged: {
20
 
            if (parent.shouldReloadImg)
21
 
            {
22
 
                fixedWidth = parent.width
23
 
            }
24
 
        }
25
 
    }
26
 
 
27
 
    Component.onCompleted: {
28
 
        fixedWidth = parent.width
 
8
 
 
9
    height: width * (model.height / model.width)
 
10
 
 
11
    border {
 
12
        width: 1
 
13
        color: "#808080"
 
14
    }
 
15
 
 
16
    Image {
 
17
        id: imagePage
 
18
        anchors {
 
19
            fill: parent
 
20
            margins: 1
 
21
        }
 
22
        asynchronous: true
 
23
        sourceSize.width: parent.width - 2
 
24
        fillMode: Image.PreserveAspectCrop
 
25
 
 
26
        Component.onCompleted: source = "image://poppler/page/" + (model.index + 1)
 
27
    }
 
28
 
 
29
    Rectangle {
 
30
        anchors.fill: parent
 
31
        color: "white"
 
32
        visible: imagePage.status === Image.Loading
 
33
 
 
34
        ActivityIndicator {
 
35
            anchors.centerIn: parent
 
36
            running: parent.visible
 
37
        }
 
38
    }
 
39
 
 
40
    DropShadow {
 
41
        anchors.fill: parent
 
42
        cached: true;
 
43
        horizontalOffset: 0;
 
44
        verticalOffset: 2;
 
45
        radius: 8.0;
 
46
        samples: 16;
 
47
        color: "#80000000";
 
48
        smooth: true;
 
49
        source: parent;
 
50
        z: -10
29
51
    }
30
52
}