Settings dialog infrastructure
[quicknewsreader] / qml / QuickNewsReader / content / view / SourceConfigDialog.qml
diff --git a/qml/QuickNewsReader/content/view/SourceConfigDialog.qml b/qml/QuickNewsReader/content/view/SourceConfigDialog.qml
new file mode 100644 (file)
index 0000000..72e53b3
--- /dev/null
@@ -0,0 +1,98 @@
+import QtQuick 1.0
+import "../modelitf"
+
+Rectangle {
+    id: configDialog
+    anchors.fill: parent
+    color: "#00000000"
+    visible: false
+    state: "hidden"
+
+    property string configViewComponent
+
+    //property SourceModel model;
+    //property SourceConfigComponentView viewComponent;
+
+    states: [
+        State {
+            name: "showSourceConfig"
+
+            // In this state, we bring the configuration UI of the source
+            PropertyChanges { target: configDialog; color: "#d0000000" }
+            PropertyChanges { target: sourceConfigLoader; opacity: 1 }
+            PropertyChanges { target: sourceConfigLoader; source: configViewComponent }
+
+            AnchorChanges { target: quitApplyConfigButton; anchors.left: undefined; anchors.right: configDialog.right }
+            AnchorChanges { target: quitCancelConfigButton; anchors.right: undefined; anchors.left: configDialog.left }
+        }
+    ]
+
+    transitions: [
+        Transition {
+            from: "hidden"
+            to: "showSourceConfig"
+
+            SequentialAnimation {
+                // Show the dialog
+                PropertyAction { target: configDialog; property: "visible"; value: true }
+                // Bring the UI elements
+                ParallelAnimation {
+                    AnchorAnimation { duration: 500 }
+                    ColorAnimation { duration: 400 }
+                }
+            }
+        },
+        Transition {
+            from: "showSourceConfig"
+            to: "hidden"
+
+            SequentialAnimation {
+                // Move out the UI elements
+                ParallelAnimation {
+                    AnchorAnimation { duration: 500 }
+                    ColorAnimation { duration: 400 }
+                }
+                // Hide the dialog
+                PropertyAction { target: configDialog; property: "visible"; value: false }
+            }
+        }
+    ]
+
+    Loader {
+        id: sourceConfigLoader
+        opacity: 0
+        anchors.top: parent.top
+        anchors.left: parent.left
+        anchors.right: parent.right
+        anchors.bottom: quitApplyConfigButton.top
+
+        Behavior on opacity {
+            NumberAnimation { duration: 1000; easing.type: Easing.InOutQuad }
+        }
+    }
+
+    FancyButton {
+        id: quitApplyConfigButton
+        icon: "../images/apply.png"
+        anchors.bottom: parent.bottom
+        anchors.left: parent.right
+
+        onClicked: {
+            // Store the configuration of this source, and disappear
+            configDialog.state = "hidden"
+        }
+    }
+
+    FancyButton {
+        id: quitCancelConfigButton
+        icon: "../images/cancel.png"
+        anchors.bottom: parent.bottom
+        anchors.right: parent.left
+
+        onClicked: {
+            // Store the configuration of this source, and disappear
+            configDialog.state = "hidden"
+        }
+    }
+
+}