blackberry.qml 12 KB

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