desktop.qml 12 KB

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