Advertisement
Guest User

homepage.qml

a guest
Oct 14th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.04 KB | None | 0 0
  1. import QtQuick 2.9
  2. import QtQuick.Controls 2.2
  3.  
  4. import QtGraphicalEffects 1.0
  5. import QtQuick.Window 2.3
  6. import QtQuick.Layouts 1.3
  7. import QtGraphicalEffects 1.0
  8. import QtQuick.Controls.Styles 1.4
  9. import QtQuick.Dialogs 1.1
  10. import QtQuick.Window 2.11
  11.  
  12.  
  13.  
  14. Item {
  15. id: mainwnd
  16. FontLoader { id: poiretOneRegular; source: "/fonts/poiretOneRegular.ttf"; }
  17. FontLoader { id: openSansCondensed; source: "/fonts/openSansCondensed_Light.ttf"; }
  18.  
  19.  
  20. Connections{
  21. target: myClient
  22. onStartReadInfo: {
  23.  
  24. billVal.text = myClient.showBill();
  25. billVal.color = myClient.showState() ? "#f7f7f7" : "#f31010"
  26. planName.text = myClient.showPlan();
  27. countTxt.text = "Личный счет: " + myClient.showId();
  28. dateTxt.text = "Расчетный день: " + myClient.showPay_day() + " (" + myClient.nextPayDay() + ")";
  29. bill.text = "Баланс на сегодня " + myClient.serverTime();
  30. myClient.switchToMe();
  31. infoRectcolorRect.y = 10
  32. infoRectcolorRect.x = 10
  33. infoRectcolorRectcleAnimation.start()
  34. infoRectcolorRectOpacityAnimation.start()
  35.  
  36. }
  37. }
  38.  
  39.  
  40. Item{
  41. id: infoRect
  42. width: mainwnd.width
  43. height: (mainwnd.height * 0.3) + 10
  44. anchors.top: mainwnd.top
  45. anchors.horizontalCenter: parent.horizontalCenter
  46. Component.onCompleted: focus = true
  47.  
  48. Image {
  49. id: walletPic
  50. z: 4
  51. scale: mainwnd.height / 1530
  52. width: 75
  53. height: 65
  54. source: "qrc:/Wallet.png"
  55. anchors.verticalCenter: billVal.verticalCenter
  56. anchors.horizontalCenter: infoPic.horizontalCenter
  57. MouseArea{
  58. anchors.fill: parent
  59. onClicked: {
  60. myClient.makeBusyON(); stackView.push("qrc:/payDescribe.qml");
  61.  
  62. }
  63. }
  64.  
  65. }
  66.  
  67. Text{
  68. id: billVal
  69. anchors.horizontalCenter: infoRect.horizontalCenter
  70. anchors.top: infoRect.top
  71. anchors.topMargin: -17 /////// controversal <<<<<<<<<<<<<<<<<<<<
  72. font.family: openSansCondensed.name;
  73. font.pointSize: 55
  74. text: myClient.showBill()
  75.  
  76. }
  77.  
  78. Image {
  79. id: rubPic
  80. width: billVal.height * 0.4
  81. height: billVal.height * 0.5
  82. source: "qrc:/Menu/rub.png"
  83. anchors.verticalCenter: billVal.verticalCenter
  84. anchors.left: billVal.right
  85. anchors.margins: 5
  86. }
  87.  
  88. Text{
  89. id: bill
  90. // y: billVal.y + billVal.height
  91. anchors.top: billVal.bottom
  92. anchors.topMargin: -10
  93. //anchors.topMargin:
  94. anchors.horizontalCenter: infoRect.horizontalCenter
  95. color: "#f7f7f7"
  96. font.family: openSansCondensed.name;
  97. font.pointSize: 14
  98. width: infoline.width
  99. horizontalAlignment: Text.AlignHCenter
  100. minimumPointSize: 8
  101. fontSizeMode: Text.Fit
  102. font.bold: true
  103. // text: "Баланс на сегодня " + myClient.serverTime();
  104. }
  105.  
  106. Text{
  107. id: planName
  108. anchors.top: bill.bottom
  109. anchors.topMargin: -4
  110. anchors.horizontalCenter: infoline.horizontalCenter
  111. font.family: openSansCondensed.name;
  112. font.pointSize: 20
  113. color: "#f7f7f7"
  114. width: infoline.width
  115. horizontalAlignment: Text.AlignHCenter
  116. minimumPointSize: 8
  117. fontSizeMode: Text.Fit
  118. //text: "Комплекс 550"
  119.  
  120. }
  121.  
  122. Rectangle{
  123. id: infoline
  124. opacity: 0.7
  125. width: bigMenu.width
  126. height: 1
  127. anchors.horizontalCenter: infoRect.horizontalCenter
  128. anchors.top: planName.bottom
  129. anchors.topMargin: 0
  130. color: "white"
  131. }
  132.  
  133. Image {
  134. id: infoPic
  135. anchors.verticalCenter: countItem.bottom
  136. anchors.right: countItem.left
  137. anchors.rightMargin: 14
  138. width: 25
  139. height: 25
  140. source: "qrc:/infoPic.png"
  141. //smooth: true
  142.  
  143. }
  144.  
  145.  
  146. Item {
  147. id: countItem
  148. // anchors.horizontalCenter: infoline.horizontalCenter
  149. x: dateTxt.x
  150. anchors.top: infoline.bottom
  151. anchors.topMargin: 3
  152. height: countTxt.height
  153. width: infoline.width
  154. z: 4
  155.  
  156.  
  157. MouseArea{
  158. id: bufArea
  159. //z: 4
  160. anchors.fill: parent
  161. onPressed: {
  162. console.log("copyed");
  163. countBack.color = "#95c9e8"
  164. countBack.opacity = 1
  165. copyTxt.visible = true
  166. myClient.copyToBuf();
  167. }
  168. onReleased: {
  169. countBackDiss.running = true
  170. }
  171.  
  172.  
  173. OpacityAnimator{
  174. id: countBackDiss
  175. target: countBack
  176. from: 1
  177. to: 0
  178. duration: 2500
  179. running: false
  180. onStopped: {
  181. countBack.color = "transparent"
  182. copyTxt.visible = false
  183. }
  184.  
  185. }
  186. }
  187.  
  188. Text {
  189. id: countTxt
  190. anchors.top: countItem.top
  191. // anchors.top: infoline.bottom
  192. // anchors.topMargin: 10
  193. // anchors.horizontalCenter: countItem.horizontalCenter
  194. anchors.left: countItem.left
  195. //font.family: openSansCondensed.name;
  196. horizontalAlignment: Text.AlignHCenter
  197. minimumPointSize: 14
  198. fontSizeMode: Text.Fit
  199. font.pointSize: 18
  200. font.bold: true
  201. color: "#f7f7f7"
  202.  
  203. Rectangle{
  204. id: countBack
  205. anchors.fill: parent
  206. radius: 4
  207. color: "transparent"
  208. Text {
  209. id: copyTxt
  210. anchors.horizontalCenter: parent.horizontalCenter
  211. font.family: openSansCondensed.name;
  212. font.pointSize: 16
  213. text: "скопировано"
  214. visible: false
  215. color: "white"
  216.  
  217. }
  218. }
  219. }
  220.  
  221. Image {
  222. id: copyImg
  223. source: "qrc:/Menu/copyimg.png"
  224. anchors.left: countTxt.right
  225. anchors.leftMargin: 8
  226. width: 18
  227. height: 18
  228. anchors.verticalCenter: countTxt.verticalCenter
  229. }
  230.  
  231. Text {
  232. id: copyComment
  233. anchors.left: copyImg.right
  234. anchors.verticalCenter: copyImg.verticalCenter
  235. anchors.leftMargin: 4
  236. font.family: openSansCondensed.name;
  237. font.pointSize: 14
  238. color: "#f7f7f7"
  239. // color: "#70859e"
  240. text: "копировать"
  241. }
  242.  
  243. }
  244.  
  245. Text{
  246. id: dateTxt
  247. anchors.top: countItem.bottom
  248. anchors.topMargin: 3
  249. anchors.horizontalCenter: infoRect.horizontalCenter
  250. font.family: openSansCondensed.name;
  251. font.pointSize: 15
  252. color: "#f7f7f7"
  253.  
  254. }
  255.  
  256.  
  257. Rectangle {
  258. id: infoRectcolorRect
  259. height: 0
  260. width: 0
  261.  
  262. color: "#95c9e8"
  263.  
  264. transform: Translate {
  265. x: -infoRectcolorRect.width / 2
  266. y: -infoRectcolorRect.height / 2
  267. }
  268. }
  269. MouseArea{
  270. id: infoArea
  271. z: 2
  272. anchors.fill: infoRect
  273. // enabled: false
  274. onPressed: {
  275.  
  276. infoRectcolorRectcleAnimation.stop();
  277. infoRectcolorRectOpacityAnimation.stop();
  278.  
  279. infoRectcolorRect.x = mouseX
  280. infoRectcolorRect.y = mouseY
  281. infoRectcolorRectcleAnimation.start()
  282. infoRectcolorRectOpacityAnimation.start()
  283.  
  284. }
  285. }
  286.  
  287. PropertyAnimation {
  288. id: infoRectcolorRectcleAnimation
  289. target: infoRectcolorRect
  290. properties: "width,height,radius"
  291. from: 0
  292. to: infoRect.width * 15
  293. duration: 2000
  294.  
  295. onStopped: {
  296. infoRectcolorRect.width = 0
  297. infoRectcolorRect.height = 0
  298.  
  299. }
  300. }
  301.  
  302. PropertyAnimation {
  303. id: infoRectcolorRectOpacityAnimation
  304. target: infoRectcolorRect
  305. properties: "opacity"
  306. from: 1
  307. to: 0
  308. duration: 2000
  309.  
  310.  
  311.  
  312. }
  313.  
  314.  
  315. }
  316.  
  317. /////////////////////////////////// BUTTONS ////////////////////////////////////////////
  318.  
  319.  
  320. ListModel {
  321. id: myModel
  322.  
  323. ListElement {
  324. mycolor: "#2cbaf1"
  325. backdata: "qrc:/Menu/payhistory.png"
  326. active: true
  327. mtext: "Платежи"
  328. }
  329. ListElement {
  330. mycolor: "#2cbaf1"
  331. backdata: "qrc:/Menu/gps.png"
  332. active: true
  333. mtext: "Оплата"
  334. }
  335.  
  336. ListElement {
  337. mycolor: "#2cbaf1"
  338. backdata: "qrc:/Menu/trusted.png"
  339. active: true
  340. mtext: "Временный платеж"
  341. }
  342.  
  343. ListElement {
  344. mycolor: "#2cbaf1"
  345. backdata: "qrc:/Menu/msg.png"
  346. active: true
  347. mtext: "Сообщения"
  348. }
  349.  
  350. ListElement {
  351. mycolor: "#2cbaf1"
  352. backdata: "qrc:/Menu/call.png"
  353. active: true
  354. mtext: "Позвонить нам"
  355. }
  356.  
  357. ListElement {
  358. mycolor: "#2cbaf1"
  359. // backdata: "qrc:/Menu/oursite.png"
  360. backdata: "qrc:/Menu/report_issue.png"
  361. active: true
  362. // mtext: "Наш сайт"
  363. mtext: "Решить проблему"
  364. }
  365.  
  366. }
  367.  
  368.  
  369. Rectangle{
  370. id: bigMenu
  371. width: infoRect.width - 30
  372. height: mainwnd.height - infoRect.height -5
  373. anchors.horizontalCenter: infoRect.horizontalCenter
  374. radius: 2
  375. anchors.top: infoRect.bottom
  376. anchors.topMargin: -20 // WTF
  377.  
  378. DropShadow {
  379. id: bigMenuShadow
  380. anchors.fill: bigMenu
  381. cached: true
  382. //horizontalOffset: 3
  383. verticalOffset: 4
  384. //horizontalOffset: 4
  385.  
  386. radius: 14
  387. samples: 10
  388. //color: "#80000000"
  389. color: "steelblue"
  390. smooth: true
  391. source: bigMenu
  392. opacity: 0.4
  393. }
  394.  
  395. GridView{
  396. id: cells
  397. interactive: false
  398. opacity: 0
  399. //visible: false
  400. anchors.centerIn: parent
  401. // smooth: true
  402.  
  403. width: cellWidth * 2
  404. height: cellHeight * 3
  405.  
  406. cellHeight: bigMenu.height / 3
  407. cellWidth: bigMenu.width / 2
  408.  
  409. model: myModel
  410.  
  411. delegate: Component{
  412. id: cellDelegat
  413. Item {
  414. id: oneCell
  415. width: cells.cellWidth
  416. height: cells.cellHeight
  417.  
  418. MouseArea{
  419. id: buttons
  420. enabled: active
  421. width: oneCell.width
  422. height: oneCell.height
  423. clip: true
  424. anchors.fill: parent
  425.  
  426. Rectangle{
  427. id: backOfCell
  428. color: "#f8f8f8"
  429. anchors.fill: parent
  430. radius: 3
  431. anchors.margins: 1
  432.  
  433. Rectangle {
  434. id: bigMenucolorRect
  435. height: 0
  436. width: 0
  437. visible: false
  438. color: "#93deff"
  439. opacity: 0.6
  440.  
  441. transform: Translate {
  442. x: -bigMenucolorRect.width / 2
  443. y: -bigMenucolorRect.height / 2
  444. }
  445. }
  446.  
  447. Image {
  448. id: buttImg
  449. opacity: 0.9
  450. anchors.centerIn: parent
  451. fillMode: Image.PreserveAspectFit
  452. width: 28
  453. source: backdata
  454.  
  455.  
  456. Behavior on width {
  457. NumberAnimation { duration: 160 }
  458.  
  459. }
  460.  
  461. Component.onCompleted: buttImg.width = Screen.width / 9 - 5
  462.  
  463. }
  464.  
  465. Text {
  466. id: cellButtonTxt
  467. anchors.top: buttImg.bottom
  468. anchors.topMargin: 10
  469. anchors.horizontalCenter: buttImg.horizontalCenter
  470. color: "#1d242b"
  471. font.family: poiretOneRegular.name;
  472. font.bold: true
  473. font.pointSize: 17
  474. text: mtext
  475. }
  476.  
  477. }
  478.  
  479. onPressed: {
  480. onPressedAnim.running = true
  481. backOfCell.opacity = 0.7
  482.  
  483. }
  484.  
  485. onReleased: {
  486. //game_engine.soundTap()
  487.  
  488.  
  489. bigMenucolorRect.x = mouseX
  490. bigMenucolorRect.y = mouseY
  491.  
  492. if(cellButtoncircleAnimation.running)
  493. cellButtoncircleAnimation.stop()
  494.  
  495. cellButtoncircleAnimation.start()
  496.  
  497. }
  498.  
  499.  
  500. ColorAnimation {
  501. id: onPressedAnim
  502. running: false
  503. target: backOfCell
  504. property: "color"
  505. duration: 200
  506. from: "#f7f7f7"
  507. to: "#C4EDFF"
  508. //easing.type: Easing.InExpo;
  509. }
  510.  
  511.  
  512. Timer{
  513. id: operationTimer
  514. running: false
  515. interval: 250
  516. onTriggered: {
  517. switch (index) {
  518. case 0: myClient.askForPayments(); myClient.makeBusyON();
  519. stackView.push("payments.qml"); break;
  520. case 1: myClient.makeBusyON(); stackView.push("qrc:/payDescribe.qml"); break;
  521. case 2: stackView.push("trustedPayPage.qml"); break;
  522. case 3: myClient.makeBusyON();
  523. myClient.askForMsgs();
  524. stackView.push("messagePage.qml"); break;
  525. case 4: BackEnd.callUs(); break;
  526. case 5: stackView.push("issue_report.qml"); break; //BackEnd.goUrl(); break;
  527. }
  528.  
  529. }
  530. }
  531.  
  532.  
  533. ParallelAnimation {
  534. id: cellButtoncircleAnimation
  535.  
  536. NumberAnimation {
  537. //id: cellButtoncircleAnimation
  538. target: bigMenucolorRect;
  539. properties: "width,height,radius";
  540. from: bigMenucolorRect.width;
  541. to: buttons.width;
  542. duration: 1100;
  543. easing.type: Easing.OutExpo
  544.  
  545. }
  546.  
  547.  
  548. NumberAnimation {
  549. id: cellButtonOpacityAnimation
  550. target: bigMenucolorRect;
  551. //easing.type: Easing.InExpo;
  552. properties: "opacity";
  553. from: 0.6;
  554. to: 0;
  555. duration: 800;
  556.  
  557.  
  558. }
  559.  
  560.  
  561. ColorAnimation {
  562. target: backOfCell
  563. property: "color"
  564. duration: 1100
  565. from: "#C4EDFF"
  566. to: "#f7f7f7"
  567. easing.type: Easing.InExpo;
  568.  
  569.  
  570. }
  571.  
  572. onStarted: {
  573. bigMenucolorRect.visible = true
  574. operationTimer.running = true
  575.  
  576. }
  577.  
  578. onStopped: {
  579. backOfCell.color = "#f7f7f7" // color: "#f7f7f7"
  580. backOfCell.opacity = 1
  581.  
  582. bigMenucolorRect.width = 0
  583. bigMenucolorRect.height = 0
  584. bigMenucolorRect.visible = false
  585.  
  586. // if (index === 1) { stackView.push("payPoints.qml"); }
  587.  
  588.  
  589.  
  590. }
  591.  
  592. }
  593.  
  594. }
  595.  
  596. }
  597.  
  598. }
  599.  
  600.  
  601. OpacityAnimator{
  602. id: cellAppear
  603. target: cells
  604. running: cells.visible
  605. from: 0
  606. to: 1
  607. duration: 200
  608. easing.type: Easing.InCirc
  609. onStopped: {
  610. // some soundeffects
  611. // game_engine.soundBegin()
  612. //backgroundAppear.start()
  613. }
  614. }
  615.  
  616. }
  617.  
  618. }
  619.  
  620. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement