72e53b35dc9349d0804ec3b8d16ff1edd27dc0ea
[quicknewsreader] / qml / QuickNewsReader / content / view / SourceConfigDialog.qml
1 import QtQuick 1.0
2 import "../modelitf"
3
4 Rectangle {
5     id: configDialog
6     anchors.fill: parent
7     color: "#00000000"
8     visible: false
9     state: "hidden"
10
11     property string configViewComponent
12
13     //property SourceModel model;
14     //property SourceConfigComponentView viewComponent;
15
16     states: [
17         State {
18             name: "showSourceConfig"
19
20             // In this state, we bring the configuration UI of the source
21             PropertyChanges { target: configDialog; color: "#d0000000" }
22             PropertyChanges { target: sourceConfigLoader; opacity: 1 }
23             PropertyChanges { target: sourceConfigLoader; source: configViewComponent }
24
25             AnchorChanges { target: quitApplyConfigButton; anchors.left: undefined; anchors.right: configDialog.right }
26             AnchorChanges { target: quitCancelConfigButton; anchors.right: undefined; anchors.left: configDialog.left }
27         }
28     ]
29
30     transitions: [
31         Transition {
32             from: "hidden"
33             to: "showSourceConfig"
34
35             SequentialAnimation {
36                 // Show the dialog
37                 PropertyAction { target: configDialog; property: "visible"; value: true }
38                 // Bring the UI elements
39                 ParallelAnimation {
40                     AnchorAnimation { duration: 500 }
41                     ColorAnimation { duration: 400 }
42                 }
43             }
44         },
45         Transition {
46             from: "showSourceConfig"
47             to: "hidden"
48
49             SequentialAnimation {
50                 // Move out the UI elements
51                 ParallelAnimation {
52                     AnchorAnimation { duration: 500 }
53                     ColorAnimation { duration: 400 }
54                 }
55                 // Hide the dialog
56                 PropertyAction { target: configDialog; property: "visible"; value: false }
57             }
58         }
59     ]
60
61     Loader {
62         id: sourceConfigLoader
63         opacity: 0
64         anchors.top: parent.top
65         anchors.left: parent.left
66         anchors.right: parent.right
67         anchors.bottom: quitApplyConfigButton.top
68
69         Behavior on opacity {
70             NumberAnimation { duration: 1000; easing.type: Easing.InOutQuad }
71         }
72     }
73
74     FancyButton {
75         id: quitApplyConfigButton
76         icon: "../images/apply.png"
77         anchors.bottom: parent.bottom
78         anchors.left: parent.right
79
80         onClicked: {
81             // Store the configuration of this source, and disappear
82             configDialog.state = "hidden"
83         }
84     }
85
86     FancyButton {
87         id: quitCancelConfigButton
88         icon: "../images/cancel.png"
89         anchors.bottom: parent.bottom
90         anchors.right: parent.left
91
92         onClicked: {
93             // Store the configuration of this source, and disappear
94             configDialog.state = "hidden"
95         }
96     }
97
98 }