summaryrefslogtreecommitdiffstats
path: root/demos/declarative/mediabrowser/content/PhonesPathView.qml
blob: df7e74235a3581e5596f26e4cdcfa2d300108932 (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
75
76
77
78
79
<PathView id="Container" pathItemCount="6">

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

    <delegate>
        <Component id="PhoneDelegate">
            <Item id="Wrapper" width="320" height="200" scale="{Wrapper.PathView.scale}" z="{Wrapper.PathView.z}">
                <Connection sender="{PhoneInfoContainer}" script="if (Wrapper.state == 'Details') Wrapper.state = ''" signal="closed()"/>

                <Script>
                    function phoneClicked() {
                        if (MainWindow.minimized == true) {
                            MainWindow.minimized = false;
                        } else {
                            PhoneInfoContainer.phoneTitle = title;
                            PhoneInfoContainer.flickableArea.yPosition = 0;
                            PhoneInfoContainer.phoneDescription = description;
                            PhoneInfoContainer.phoneSpecifications = specifications;
                            PhoneInfoContainer.phoneUrl = url;
                            PhoneInfoContainer.rating = rating;
                            Wrapper.state = "Details";
                        }
                    }
                </Script>

                <Rect id="Dvd" anchors.fill="{parent}" color="white">
                    <Item x="{(parent.width-width)/2}" y="{(parent.height-height)/2}" width="{Thumb.width*Thumb.scale}" height="{Thumb.height*Thumb.scale}">
                        <Image id="Thumb" source="{thumb}" scale="{0.95*Math.min(Dvd.height/height,Dvd.width/width)}"/>
                    </Item>
                    <!-- <Image source="pics/reflection.png" anchors.fill="{parent}"/> -->
                    <Image source="pics/shadow-right.png" x="{Dvd.width}" height="{Dvd.height}"/>
                    <Image source="pics/shadow-bottom.png" y="{Dvd.height}" width="{Dvd.width}"/>
                    <Image id="Corner" source="pics/shadow-corner.png" x="{Dvd.width}" y="{Dvd.height}"/>
                </Rect>

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

                <states>
                    <State name="Details">
                        <ParentChange target="{Wrapper}" parent="{PhoneInfoContainer.frontContainer}"/>
                        <SetProperties target="{Wrapper}" x="50" y="60" scale="1"/>
                        <SetProperties target="{PhoneInfoContainer}" 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>