ProfilesView.qml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. /**
  2. * Copyright © 2010 Digia Plc
  3. * Copyright © 2010 Nokia Corporation
  4. *
  5. * All rights reserved.
  6. *
  7. * Nokia and Nokia Connecting People are registered trademarks of
  8. * Nokia Corporation.
  9. * Java and all Java-based marks are trademarks or registered
  10. * trademarks of
  11. * Sun Microsystems, Inc. Other product and company names
  12. * mentioned herein may be
  13. * trademarks or trade names of their respective owners.
  14. *
  15. *
  16. * Subject to the conditions below, you may, without charge:
  17. *
  18. * · Use, copy, modify and/or merge copies of this software and
  19. * associated documentation files (the "Software")
  20. *
  21. * · Publish, distribute, sub-licence and/or sell new software
  22. * derived from or incorporating the Software.
  23. *
  24. *
  25. * This file, unmodified, shall be included with all copies or
  26. * substantial portions
  27. * of the Software that are distributed in source code form.
  28. *
  29. * The Software cannot constitute the primary value of any new
  30. * software derived
  31. * from or incorporating the Software.
  32. *
  33. * Any person dealing with the Software shall not misrepresent
  34. * the source of the Software.
  35. *
  36. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  37. * KIND, EXPRESS OR IMPLIED,
  38. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  39. * MERCHANTABILITY, FITNESS FOR A
  40. * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41. * AUTHORS OR COPYRIGHT
  42. * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  43. * WHETHER IN AN ACTION
  44. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  45. * CONNECTION WITH THE
  46. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  47. */
  48. import Qt 4.7
  49. import "javascript/profileFunctions.js" as ProFunc
  50. import "../colibri"
  51. import "styles"
  52. Item {
  53. id: structure
  54. property CLStyle style : StyleHomeControlSystem{}
  55. property string currentMode: "Custom"
  56. signal profileChanged() // Triggered when profile is changed
  57. signal saunaTurnedOff() // Triggered when profile with sauna of is selected
  58. signal closeWindow()
  59. /**
  60. * Changes profile if it exists
  61. *
  62. * @param index Profile index
  63. * @return bool
  64. */
  65. function checkNewProfile( index ) {
  66. if( index < 0 || index > 4 ) return false;
  67. structure.profileChanged();
  68. if( index == 0 ) ProFunc.normalMode();
  69. if( index == 1 ) ProFunc.nightMode();
  70. if( index == 2 ) ProFunc.awayMode();
  71. if( index == 3 ) ProFunc.awayLongMode();
  72. if( index == 4 ) ProFunc.movieMode();
  73. return true;
  74. }
  75. /**
  76. * Sets current profile as Custom
  77. *
  78. * @return Nothing
  79. */
  80. function profileToCustom() {
  81. structure.currentMode = "Custom";
  82. listbox.clearSelections();
  83. ProFunc.hideAll()
  84. }
  85. width: 640
  86. height: 424
  87. MouseArea {
  88. anchors.fill: parent;
  89. }
  90. Rectangle{
  91. width:structure.width*0.955
  92. height:structure.height*0.924
  93. color:style.selectionColor
  94. anchors.centerIn:parent
  95. radius:7
  96. }
  97. Image {
  98. source: "images/control_bg_trans_420x275_png.png";
  99. anchors.fill: parent;
  100. smooth: true
  101. opacity:0.7
  102. }
  103. RoomExitButton {
  104. windowWidth: structure.width
  105. windowHeight: structure.height
  106. style: structure.style
  107. onClicked: structure.closeWindow();
  108. }
  109. Text {
  110. id: selectText
  111. text: "Profiles"
  112. font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) )
  113. x: Math.round( structure.width * 0.05 )
  114. y: Math.round( structure.height * 0.05 )
  115. color: structure.style.textColor
  116. font.bold: true
  117. }
  118. CLListbox {
  119. id: listbox
  120. x: Math.round( structure.width * 0.05 )
  121. width: Math.round( 200 * (structure.width/640) )
  122. anchors.top: selectText.bottom
  123. anchors.topMargin: Math.round( 10 * (structure.height / 424) )
  124. style: structure.style
  125. itemHeight: Math.round( 50 * (structure.height/424) )
  126. items: ListModel {
  127. ListElement { label: "Home"; value: 0; selected: false; }
  128. ListElement { label: "Night"; value: 1; selected: false; }
  129. ListElement { label: "Away"; value: 2; selected: false; }
  130. ListElement { label: "Away (long)"; value: 3; selected: false; }
  131. ListElement { label: "Movie"; value: 4; selected: false; }
  132. }
  133. selectMany: false
  134. onItemClicked: checkNewProfile(index);
  135. allowDeSelect: false
  136. fontSize: 1 + Math.round( 14 * (structure.height / 424) )
  137. }
  138. Rectangle {
  139. x: theColumn.x + Math.round( 8 * (structure.height / 424) )
  140. y: theColumn.y - Math.round( 16 * (structure.height / 424) )
  141. width: theColumn.width
  142. height: listbox.height - 2*border.width
  143. color: "transparent"
  144. border.width: 1
  145. border.color: style.borderColor
  146. smooth: true
  147. radius: 0.0000001
  148. }
  149. Column {
  150. id: theColumn
  151. x: Math.round( 240 * (structure.width/640) )
  152. y: Math.round( structure.height * 0.18 )
  153. width: Math.round( 360 * (structure.width/640) )
  154. height: Math.round( 330 * (structure.height/424) )
  155. spacing: Math.round( 8 * (structure.height/424) )
  156. Row {
  157. id: rowTemp
  158. property int theTemperature : 22
  159. property string text : "Temperature"
  160. property string text2 : ""+theTemperature+"<html>&deg;</html>C"
  161. visible: false
  162. x: Math.round(structure.height * 0.05)
  163. width: parent.width - x
  164. height: (visible)? Math.round(30 * (structure.height / 424)) : 0
  165. spacing: Math.round(6 * (structure.width / 640))
  166. Image { id: tempImg; smooth: true; width: parent.height; height: parent.height; source: "images/thermometer_40x40.png" }
  167. Rectangle {
  168. anchors.verticalCenter: parent.verticalCenter
  169. height: parent.height; width:(parent.width-parent.spacing-tempImg.width);
  170. color: "transparent"
  171. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  172. Text { text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; anchors.rightMargin: (longest.width-width); }
  173. }
  174. }
  175. Row {
  176. id: rowLight
  177. property string text : "Lights"
  178. property string text2 : "Off"
  179. visible: false
  180. x: Math.round( structure.height * 0.05 )
  181. width: parent.width - x
  182. height: (visible)? Math.round( 30 * (structure.height / 424) ) : 0
  183. spacing: Math.round( 6 * (structure.width / 640) )
  184. Image { id: lightImg; smooth: true; width: parent.height; height: parent.height; source: "images/lamp_off_100x100.png" }
  185. Rectangle {
  186. anchors.verticalCenter: parent.verticalCenter
  187. height: parent.height; width:(parent.width-parent.spacing-lightImg.width);
  188. color: "transparent"
  189. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  190. Text { text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; anchors.rightMargin: (longest.width-width); }
  191. }
  192. }
  193. Row {
  194. id: rowLightDim
  195. property string text : "LR lights"
  196. property string text2 : "10%"
  197. visible: false
  198. x: Math.round(structure.height * 0.05)
  199. width: parent.width - x
  200. height: (visible)? Math.round(30 * (structure.height / 424)) : 0
  201. spacing: Math.round(6 * (structure.width / 640))
  202. Image { id: lightDimImg; smooth: true; width: parent.height; height: parent.height; source: "images/lamp_on_30x30.png" }
  203. Rectangle {
  204. anchors.verticalCenter: parent.verticalCenter
  205. height: parent.height; width:(parent.width-parent.spacing-lightDimImg.width);
  206. color: "transparent"
  207. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  208. Text { text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; anchors.rightMargin: (longest.width-width); }
  209. }
  210. }
  211. Row {
  212. id: rowVolume
  213. property string text : "Audio"
  214. property string text2 : "Off"
  215. visible: false
  216. x: Math.round(structure.height * 0.05)
  217. width: parent.width - x
  218. height: (visible)? Math.round(30 * (structure.height / 424)) : 0
  219. spacing: Math.round(6 * (structure.width / 640))
  220. Image { id: volumeImg; smooth: true; width: parent.height; height: parent.height; source: "images/speaker_mute_100x100.png" }
  221. Rectangle {
  222. anchors.verticalCenter: parent.verticalCenter
  223. height: parent.height; width:(parent.width-parent.spacing-volumeImg.width);
  224. color: "transparent"
  225. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  226. Text { text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; anchors.rightMargin: (longest.width-width); }
  227. }
  228. }
  229. Row {
  230. id: rowVolumeMovie
  231. property string text : "LR audio"
  232. property string text2 : "80%"
  233. visible: false
  234. x: Math.round( structure.height * 0.05 )
  235. width: parent.width - x
  236. height: (visible)? Math.round(30 * (structure.height / 424)) : 0
  237. spacing: Math.round(6 * (structure.width / 640))
  238. Image { id: movieVolImg; smooth: true; width: parent.height; height: parent.height; source: "images/speaker_100x100.png" }
  239. Rectangle {
  240. anchors.verticalCenter: parent.verticalCenter
  241. height: parent.height; width:(parent.width-parent.spacing-movieVolImg.width);
  242. color: "transparent"
  243. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  244. Text { text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; anchors.rightMargin: (longest.width-width); }
  245. }
  246. }
  247. Row {
  248. id: rowSaunaOff
  249. property string text : "Sauna"
  250. property string text2 : "Off"
  251. visible: false
  252. x: Math.round(structure.height * 0.05)
  253. width: parent.width - x
  254. height: (visible)? Math.round(30 * (structure.height / 424)) : 0
  255. spacing: Math.round( 6 * (structure.width / 640) )
  256. Image { id: saunaImg; smooth: true; width: parent.height; height: parent.height; source: "images/sauna_40x40.png" }
  257. Rectangle{
  258. anchors.verticalCenter: parent.verticalCenter
  259. height: parent.height; width:(parent.width-parent.spacing-saunaImg.width);
  260. color: "transparent"
  261. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  262. Text { text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; anchors.rightMargin: (longest.width-width); }
  263. }
  264. }
  265. Row {
  266. id: rowLockOpen
  267. property string text : "Doors"
  268. property string text2 : "Open"
  269. visible: false
  270. x: Math.round(structure.height * 0.05)
  271. width: parent.width - x
  272. height: (visible)? Math.round(30 * (structure.height / 424)) : 0
  273. spacing: Math.round(6 * (structure.width / 640))
  274. Image { id: lockOpenImg; smooth: true; width: parent.height; height: parent.height; source: "images/lock_open_100x100.png" }
  275. Rectangle {
  276. anchors.verticalCenter: parent.verticalCenter
  277. height: parent.height; width:(parent.width-parent.spacing-lockOpenImg.width);
  278. color: "transparent"
  279. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  280. Text { text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; anchors.rightMargin: (longest.width-width); }
  281. }
  282. }
  283. Row {
  284. id: rowLockClosed
  285. visible: false
  286. x: Math.round( structure.height * 0.05 )
  287. property string text : "Doors"
  288. property string text2 : "Locked"
  289. width: parent.width - x
  290. height: (visible)? Math.round( 30 * (structure.height / 424) ) : 0
  291. spacing: Math.round( 6 * (structure.width / 640) )
  292. Image { id: lockClosedImg; smooth: true; width: parent.height; height: parent.height; source: "images/lock_100x100.png" }
  293. Rectangle {
  294. anchors.verticalCenter: parent.verticalCenter
  295. height: parent.height; width:(parent.width-parent.spacing-lockClosedImg.width);
  296. color: "transparent"
  297. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  298. Text { id: longest; text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; }
  299. }
  300. }
  301. Row {
  302. id: rowAlarmOn
  303. property string text : "Alarm"
  304. property string text2 : "On"
  305. visible: false
  306. x: Math.round(structure.height * 0.05)
  307. width: parent.width - x
  308. height: (visible)? Math.round( 30 * (structure.height / 424)) : 0
  309. spacing: Math.round(6 * (structure.width / 640))
  310. Image { id: alarmOnImg; smooth: true; width: parent.height; height: parent.height; source: "images/alarm_40x40.png" }
  311. Rectangle {
  312. anchors.verticalCenter: parent.verticalCenter
  313. height: parent.height; width:(parent.width-parent.spacing-alarmOnImg.width);
  314. color: "transparent"
  315. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  316. Text { text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; anchors.rightMargin: (longest.width-width); }
  317. }
  318. }
  319. Row {
  320. id: rowAlarmOff
  321. property string text : "Alarm"
  322. property string text2 : "Off"
  323. visible: false
  324. x: Math.round(structure.height * 0.05)
  325. width: parent.width - x
  326. height: (visible)? Math.round(30 * (structure.height / 424)) : 0
  327. spacing: Math.round(6 * (structure.width / 640))
  328. Image { id: alarmOffImg; smooth: true; width: parent.height; height: parent.height; source: "images/alarm_40x40.png" }
  329. Rectangle {
  330. anchors.verticalCenter: parent.verticalCenter
  331. height: parent.height; width:(parent.width - parent.spacing - alarmOffImg.width);
  332. color: "transparent"
  333. Text { text: parent.parent.text; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; }
  334. Text { text: parent.parent.text2; font.pixelSize: 1 + Math.round( 23 * (structure.height / 424) ); color: structure.style.textColor; anchors.verticalCenter: parent.verticalCenter; anchors.right: parent.right; anchors.rightMargin: (longest.width-width); }
  335. }
  336. }
  337. }
  338. Rectangle {
  339. visible: false
  340. color: "transparent"
  341. x: Math.round(structure.width * 0.05)
  342. y: Math.round(structure.height * 0.15)
  343. width: Math.round(330 * (structure.width/640))
  344. height: Math.round(330 * (structure.height/424))
  345. Text {
  346. id: displayText
  347. text: ""
  348. anchors.horizontalCenter: parent.horizontalCenter
  349. font.bold: true
  350. opacity: 0
  351. font.pixelSize: 1 + Math.round(20 * (structure.height / 424))
  352. states: State {
  353. name: "show"
  354. PropertyChanges { target: displayText; opacity: 100; font.pixelSize: 1 + Math.round( 30 * (structure.height / 424) ); }
  355. }
  356. Behavior on font.pixelSize { PropertyAnimation { duration: 200 } }
  357. Behavior on opacity { PropertyAnimation { duration: 200 } }
  358. }
  359. Text {
  360. id: displayTextSmall
  361. x: Math.round(structure.height * 0.05)
  362. y: Math.round(structure.height * 0.15)
  363. text: ""
  364. opacity: displayText.opacity
  365. font.pixelSize: 1 + Math.round( 22 * (structure.height / 424) )
  366. }
  367. }
  368. }