summaryrefslogtreecommitdiffstats
path: root/demos/declarative/mediabrowser/content/MoviesPathView.qml
blob: a13437a835ef17747237d07a2d3682ce9e528077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<PathView id="Container">

    <path>
        <Path startX="-50" startY="40">
            <PathAttribute name="scale" value="0.4"/>
            <PathCubic x="400" y="220" control1X="140" control1Y="40" control2X="210" control2Y="220"/>
            <PathAttribute name="scale" value="0.7"/>
            <PathCubic x="850" y="40" control2X="660" control2Y="40" control1X="590" control1Y="220"/>
            <PathAttribute name="scale" value="0.4"/>
        </Path>
    </path>

    <delegate>
        <Component id="MovieDelegate">
            <Item id="Wrapper" width="220" height="310" scale="{Wrapper.PathView.scale}">
                <Connection sender="{MovieInfoContainer}" script="if (Wrapper.state == 'Details') Wrapper.state = ''" signal="closed()"/>

                <Script>
                    function movieClicked() {
                        if (MainWindow.minimized == true) {
                            MainWindow.minimized = false;
                        } else {
                            MovieInfoContainer.movieTitle = title;
                            MovieInfoContainer.flickableArea.yPosition = 0;
                            MovieInfoContainer.movieDescription = description;
                            MovieInfoContainer.rating = rating;
                            Wrapper.state = "Details";
                        }
                    }
                </Script>

                <Rect id="Dvd" anchors.fill="{parent}" color="white">
                    <Image src="{thumb}" width="215" height="305" anchors.centeredIn="{parent}" opaque="true"/>
                    <Image src="pics/reflection.png" anchors.centeredIn="{parent}"/>
                    <Image src="pics/shadow-right.png" x="220"/>
                    <Image src="pics/shadow-bottom.png" y="310"/>
                    <Image src="pics/shadow-corner.png" x="220" y="310"/>
                </Rect>

                <MouseRegion anchors.fill="{Wrapper}" onClicked="movieClicked()"/>

                <states>
                    <State name="Details">
                        <ParentChange target="{Wrapper}" parent="{MovieInfoContainer.frontContainer}"/>
                        <SetProperties target="{Wrapper}" x="50" y="60" scale="1"/>
                        <SetProperties target="{MovieInfoContainer}" y="20"/>
                        <SetProperties target="{Container}" y="-480"/>
                        <SetProperties target="{CloseButton}" opacity="0"/>
                        <SetProperties target="{CategoryText}" y="-50"/>
                    </State>
                    <State name="Stacked" when="{MainWindow.minimized == true}">
                        <ParentChange target="{Wrapper}" parent="{Stack}"/>
                        <SetProperties target="{Wrapper}" x="0" y="0" scale="0.2"/>
                        <SetProperties target="{CloseButton}" opacity="0"/>
                        <SetProperties target="{CategoryText}" y="-50"/>
                    </State>
                </states>

                <transitions>
                    <Transition fromState="" toState="Details,Stacked">
                        <ParentChangeAction/>
                        <NumericAnimation properties="x,y,scale,opacity" duration="500" easing="easeInOutQuad"/>
                    </Transition>
                    <Transition fromState="Details,Stacked" toState="">
                        <ParentChangeAction/>
                        <NumericAnimation properties="x,y,scale,opacity" duration="500" easing="easeInOutQuad"/>
                    </Transition>
                </transitions>

            </Item>
        </Component>
    </delegate>

</PathView>