00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 import QtQuick 1.1
00040 import com.nokia.symbian.StatusNotification 1.0
00041 import com.nokia.symbian 1.1
00042
00043
00048 PageStackWindow {
00049 id: window
00050 showStatusBar: true
00051 function setStateIfFound(target, name) {
00052 for (var i = 0; i < target.states.length; i++) {
00053 var curState = target.states[i];
00054 if(curState.name == name) {
00055 target.state = name
00056 break
00057 }
00058 }
00059 }
00060
00061
00062 ToolBarLayout {
00063 id: commonTools
00064 ToolButton {
00065 flat: true
00066 iconSource: "qtg_toolbar_back.svg"
00067 onClicked: pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
00068 }
00069
00070 }
00071
00072 Page {
00073 id: page
00074 anchors.fill: parent
00075 tools: commonTools
00076
00077 Component.onCompleted: {
00078 if(screen.currentOrientation == Screen.Portrait) {
00079 setStateIfFound(page, "PortraitState")
00080 } else if(screen.currentOrientation == Screen.Landscape) {
00081 setStateIfFound(page, "LandscapeState")
00082 }
00083 }
00084
00085
00086 Image {
00087 id: imagePoster
00088 y: parent.topLeft
00089 x: parent.topLeft
00090 height: parent.height
00091 width: parent.width
00092 source: "water.jpg"
00093 }
00094
00095
00096 Rectangle {
00097 id: heading
00098 anchors.right: parent.right
00099 anchors.left: parent.left
00100 anchors.top: parent.top
00101 width: parent.width
00102 height: 40
00103 anchors.margins: 0
00104 gradient: Gradient {
00105 GradientStop { position: 0.0; color: "#B5B5B5" }
00106 GradientStop { position: 1.0; color: "#4F4F4F" }
00107 }
00108
00109 Text {
00110 id: txtHead
00111 anchors.left: parent.left
00112 text: "Status Notification"
00113 font.italic: true
00114 color: "white"
00115 font.pointSize: 11
00116 }
00117 }
00118
00119
00120 StatusNotification {
00121 id: statusnotification
00122 title: ""
00123 description: ""
00124 onSelected: {
00125 statustext.text = "Notification selected and removed"
00126 }
00127 }
00128
00129
00130 TextField {
00131 id: titleTextInput
00132 text: "Title"
00133 anchors.top: parent.top
00134 anchors.topMargin: 59
00135 anchors.left: parent.left
00136 anchors.leftMargin: 22
00137 anchors.right: parent.right
00138 anchors.rightMargin: 62
00139 }
00140
00141
00142 TextField {
00143 id: descriptionTextInput
00144 text: "Description"
00145 anchors.top: titleTextInput.bottom
00146 anchors.topMargin: 12
00147 anchors.left: parent.left
00148 anchors.leftMargin: 22
00149 anchors.right: parent.right
00150 anchors.rightMargin: 62
00151 }
00152
00153
00154 Button {
00155 id: addNotification1Button
00156 text: qsTrId("Show notification")
00157 width: 289
00158 height: 50
00159 anchors.left: parent.left
00160 anchors.leftMargin: 22
00161 anchors.right: parent.right
00162 anchors.rightMargin: 56
00163 anchors.top: descriptionTextInput.bottom
00164 anchors.topMargin: 41
00165 property bool iconToggle : true
00166 onClicked: {
00167 statusnotification.title = titleTextInput.text
00168 statusnotification.description = descriptionTextInput.text
00169 statusnotification.icon = iconToggle ? "pics/icon1.svg" : "pics/icon1_2.svg";
00170
00171 if (statusnotification.visible == false)
00172 statustext.text = iconToggle ? "Notification added (icon 1)" : "Notification added (icon 2)";
00173 else
00174 statustext.text = iconToggle ? "Notification modified (icon 1)" : "Notification modified (icon 2)";
00175
00176 statusnotification.visible = true;
00177 iconToggle = !iconToggle;
00178
00179 }
00180 }
00181
00182
00183 Button {
00184 id: removeNotification1Button
00185
00186 text: qsTrId("Hide notification")
00187 height: 52
00188 anchors.top: addNotification1Button.bottom
00189 anchors.topMargin: 21
00190 anchors.left: parent.left
00191 anchors.leftMargin: 22
00192 anchors.right: parent.right
00193 anchors.rightMargin: 56
00194 onClicked: {
00195 statusnotification.visible = false;
00196 statustext.text = "Notification removed"
00197
00198 }
00199 }
00200
00201
00202 CheckBox {
00203 id: checkbox
00204 anchors.left: parent.left
00205 anchors.leftMargin: 22
00206 text: qsTrId("Autohide off")
00207 anchors.right: parent.right
00208 anchors.rightMargin: 62
00209 anchors.top: removeNotification1Button.bottom
00210 anchors.topMargin: 30
00211
00212 onClicked: {
00213
00214 statusnotification.autoHide = checkbox.checked
00215 if (checkbox.checked ) {
00216 statustext.text = "AutoHide enable"
00217 checkbox.text = "AutoHide on"
00218 }
00219 else {
00220 statustext.text = "AutoHide disabled"
00221 checkbox.text = "Autohide off"
00222 }
00223 }
00224 }
00225
00226
00227 Text {
00228 id: statustext
00229 text: ""
00230 font.family: "Nokia Sans"
00231 font.pointSize: 7
00232 color: "white"
00233 anchors.top: checkbox.bottom
00234 anchors.topMargin: 41
00235 anchors.left: parent.left
00236 anchors.leftMargin: 5
00237 }
00238 }
00239 Component.onCompleted: pageStack.push(page)
00240 }
00241