harmattan.qml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. import QtQuick 1.1
  2. import com.nokia.meego 1.0
  3. import "EvidencehuntCore" 1.0
  4. Item {
  5. id: field
  6. Image { source: "EvidencehuntCore/pics/crimescene.jpg"; anchors.fill: parent; }
  7. Dialog {
  8. id: exitDialog
  9. title:Label { color:"orange"; text:qsTr("__EXIT__") + emptyString }
  10. content:Label { color:"white"; text:qsTr("__EXITQUESTION__") + emptyString; }
  11. buttons: Row {
  12. Button {id: bOk; text: "OK"; onClicked: Qt.quit(); }
  13. Button {id: bCancel; text:qsTr("__CANCEL__") + emptyString; onClicked: exitDialog.close()}
  14. }
  15. }
  16. Dialog {
  17. id: resetDialog
  18. title:Label { color:"orange"; text:qsTr("__RESET__") + emptyString }
  19. content:Label { color:"white"; text: qsTr("__RESETQUESTION__") + emptyString; }
  20. buttons: Row {
  21. Button {id: bRestartOk; text: "OK"; onClicked: { resetDialog.close(); reset(); } }
  22. Button {id: bRestartCancel; text: qsTr("__CANCEL__") + emptyString; onClicked: resetDialog.close(); }
  23. }
  24. }
  25. Dialog {
  26. id: welcomeDialog
  27. title: Label { color: "orange"; text: qsTr("__ABOUTWELCOME__") + emptyString; }
  28. content: Text { color:"white"; font.pixelSize: 22; text: qsTr("__ABOUTWELCOMETEXT__") + emptyString; }
  29. buttons: Column {
  30. Row {
  31. Button { text: qsTr("__LANGUAGE__") + emptyString; onClicked: { languageDialog.returnToWelcome = true; welcomeDialog.close(); languageDialog.open(); } }
  32. Button { text: qsTr("__CONTINUE__") + emptyString; onClicked: { welcomeDialog.close(); welcomeSheet.open(); } }
  33. }
  34. Button {anchors.horizontalCenter: parent.horizontalCenter; text: qsTr("__CLOSE__") + emptyString; onClicked: { welcomeDialog.close(); } }
  35. }
  36. }
  37. Sheet {
  38. id: scoreboardSheet
  39. acceptButtonText: qsTr("__CLOSE__") + emptyString
  40. buttons: Item { Text { font.pixelSize: 26; font.bold: true; text: qsTr("__TOPLIST__") + emptyString; anchors.top: parent.top; anchors.left: parent.left; anchors.topMargin: 16; anchors.leftMargin: 16 } }
  41. z: 1000
  42. content: Scoreboard {
  43. id: scoreboardSheetContents
  44. anchors.fill: parent
  45. }
  46. onAccepted: scoreboardSheet.close();
  47. }
  48. Sheet {
  49. id: welcomeSheet
  50. acceptButtonText: qsTr("__CLOSE__") + emptyString
  51. buttons: Item { Text { font.pixelSize: 26; font.bold: true; text: "EvidenceHunt Game - " + qsTr("__ABOUT__") + emptyString; anchors.top: parent.top; anchors.left: parent.left; anchors.topMargin: 16; anchors.leftMargin: 16 } }
  52. z: 1000
  53. content: Flickable {
  54. anchors.fill: parent
  55. anchors.margins: 30
  56. contentWidth: welcomeSheetContents.width
  57. contentHeight: welcomeSheetContents.height
  58. flickableDirection: Flickable.VerticalFlick
  59. Welcome { id: welcomeSheetContents }
  60. }
  61. onAccepted: welcomeSheet.close();
  62. }
  63. property list<ListModel> languageSelector;
  64. languageSelector: [
  65. ListModel {
  66. id: languageSelector0
  67. ListElement { name: "English" }
  68. ListElement { name: "Hungarian" }
  69. ListElement { name: "Serbian" }
  70. ListElement { name: "Italian" }
  71. },
  72. ListModel {
  73. id: languageSelector1
  74. ListElement { name: "Angol" }
  75. ListElement { name: "Magyar" }
  76. ListElement { name: "Szerb" }
  77. ListElement { name: "Olasz" }
  78. },
  79. ListModel {
  80. id: languageSelector2
  81. ListElement { name: "Engleski" }
  82. ListElement { name: "Mađarski" }
  83. ListElement { name: "Srpski" }
  84. ListElement { name: "Italijanski" }
  85. },
  86. ListModel {
  87. id: languageSelector3
  88. ListElement { name: "Inglese" }
  89. ListElement { name: "Ungherese" }
  90. ListElement { name: "Serbo" }
  91. ListElement { name: "Italiano" }
  92. }
  93. ]
  94. SelectionDialog {
  95. property bool returnToWelcome: false;
  96. id: languageDialog
  97. titleText: qsTr("__LANGUAGE__") + emptyString
  98. model: languageSelector[selectedLanguage]
  99. selectedIndex: selectedLanguage
  100. onAccepted: {
  101. selectLanguage(languageDialog.selectedIndex);
  102. if (returnToWelcome) {
  103. returnToWelcome = false;
  104. welcomeDialog.open();
  105. } else {
  106. //settingsDialog.open();
  107. }
  108. }
  109. }
  110. Dialog {
  111. id: shareDialog
  112. title:Label { color:"orange"; text:qsTr("__SHARE__") + emptyString }
  113. content: Column {
  114. spacing: 10
  115. Text {
  116. width:parent.width
  117. height: 90
  118. color:"white"; font.pixelSize: 22;
  119. text: qsTr("__SHAREINFO__") + emptyString;
  120. }
  121. Rectangle {
  122. height: 64
  123. color: "transparent"
  124. width:parent.width
  125. Image { id: shareFacebookIcon; source: "EvidencehuntCore/icons/facebook.png"; }
  126. Text {
  127. id: shareFacebookText;
  128. anchors.left: parent.left;
  129. anchors.leftMargin: 64;
  130. anchors.top: parent.top;
  131. anchors.topMargin: 16;
  132. color:"#3B5998";
  133. font.pixelSize: 22;
  134. font.underline: true;
  135. text: qsTr("__OFFICIALFACEBOOK__") + emptyString;
  136. }
  137. MouseArea {
  138. anchors.top: shareFacebookIcon.top
  139. anchors.bottom: shareFacebookIcon.bottom
  140. anchors.left: shareFacebookIcon.left
  141. anchors.right: shareFacebookText.right
  142. onClicked: Qt.openUrlExternally("http://www.facebook.com/pages/EvidenceHunt-Game/129432933818266");
  143. }
  144. }
  145. Rectangle {
  146. height: 84
  147. color: "transparent"
  148. width:parent.width;
  149. Image { id: shareTwitterIcon; source: "EvidencehuntCore/icons/twitter.png"; }
  150. Text {
  151. id: shareTwitterText;
  152. anchors.left: parent.left;
  153. anchors.leftMargin: 64;
  154. anchors.top: parent.top;
  155. anchors.topMargin: 16;
  156. color:"#4099FF";
  157. font.pixelSize: 22;
  158. font.underline: true;
  159. text: qsTr("__FOLLOWTWITTER__") + emptyString;
  160. }
  161. MouseArea {
  162. anchors.top: shareTwitterIcon.top
  163. anchors.bottom: shareTwitterIcon.bottom
  164. anchors.left: shareTwitterIcon.left
  165. anchors.right: shareTwitterText.right
  166. onClicked: Qt.openUrlExternally("http://www.twitter.com/BlackWiCKED/");
  167. }
  168. }
  169. }
  170. buttons: Row {
  171. Button {id: bShareContinue; text: qsTr("__SHARE__") + emptyString; onClicked: shareGame(); }
  172. Button {id: bShareCancel; text: qsTr("__CLOSE__") + emptyString; onClicked: shareDialog.close(); }
  173. }
  174. }
  175. Grid {
  176. id: evidenceTiles
  177. anchors.left: parent.left
  178. anchors.leftMargin: 20
  179. anchors.top: parent.top
  180. anchors.topMargin: 20
  181. columns: 8; spacing: 1
  182. Repeater {
  183. id: repeater
  184. model: tiles
  185. delegate: Tile {}
  186. }
  187. }
  188. EvidenceInfo {
  189. id: evidenceInfoInstance
  190. opacity: 0
  191. state: isInfoVisible ? 'visible' : ''
  192. states: State {
  193. name: "visible"
  194. PropertyChanges { target: evidenceInfoInstance; opacity: 1 }
  195. }
  196. transitions: Transition {
  197. PropertyAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
  198. }
  199. }
  200. Button {
  201. id: onlineScoreboardButton
  202. text: qsTr("__SUBMITPERSONALBEST__") + emptyString
  203. anchors.bottom: evidenceInfoInstance.bottom
  204. anchors.bottomMargin: 20
  205. anchors.horizontalCenter: evidenceInfoInstance.horizontalCenter
  206. visible: maxScore > maxScoreSubmitted && !isPlaying && !hasWon && isInfoVisible
  207. onClicked: {
  208. openScoreboard();
  209. scoreboardSheet.open();
  210. }
  211. }
  212. GameMenuTop {
  213. id: gamemenu
  214. }
  215. Rectangle {
  216. id: expandableMenu
  217. property bool isExpanded: true;
  218. color: "transparent"
  219. anchors.top: gamemenu.top
  220. anchors.topMargin: 80
  221. state: "collapsed-landscape" //!isExpanded ? ((field.width < field.height) ? 'collapsed-portrait':'collapsed-landscape') : ((field.width < field.height) ? 'expanded-portrait':'expanded-landscape');
  222. states: [
  223. State {
  224. name: "collapsed-portrait";
  225. AnchorChanges { target: expandableMenu; anchors.bottom: field.bottom; anchors.left: field.left; anchors.top: undefined; anchors.right: undefined; }
  226. PropertyChanges { target: expandableMenu; width:field.width; height: (field.height >= 900) ? 390 : (field.height - 510); }
  227. },
  228. State {
  229. name: "collapsed-landscape";
  230. AnchorChanges { target: expandableMenu; anchors.top: field.top; anchors.right: field.right; anchors.bottom: undefined; anchors.left: undefined;}
  231. PropertyChanges { target: expandableMenu; width: (field.width >= 900) ? 390 : (field.width - 510); height: field.height;}
  232. },
  233. State {
  234. name: "expanded-portrait";
  235. AnchorChanges { target: expandableMenu; anchors.bottom: field.bottom; anchors.left: field.left; anchors.top: undefined; anchors.right: undefined; }
  236. PropertyChanges { target: expandableMenu; width:field.width; height: 390; }
  237. },
  238. State {
  239. name: "expanded-landscape";
  240. AnchorChanges { target: expandableMenu; anchors.top: field.top; anchors.right: field.right; anchors.bottom: undefined; anchors.left: undefined;}
  241. PropertyChanges { target: expandableMenu; width: 390; height: field.height;}
  242. }
  243. ]
  244. SuspectList {
  245. id: suspectlist
  246. }
  247. Score {
  248. id: scoreboard
  249. }
  250. GameMenuBottom {
  251. id: gameMenuBottom
  252. }
  253. }
  254. function openWelcomeDialog() {
  255. welcomeDialog.open();
  256. }
  257. function scoreBoardLoaded() {
  258. scoreboardSheetContents.hasNoError();
  259. }
  260. function openBoardErrorDialog() {
  261. scoreboardSheetContents.hasError();
  262. }
  263. }