main.qml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. import QtQuick
  2. import QtQuick.Layouts
  3. import QtQuick.Controls
  4. import QtDataVisualization 1.2
  5. import "components"
  6. Item {
  7. id: rootItem
  8. width: 1920
  9. height: 1080
  10. property string textTitle: '广西金川渣包车智能驾驶系统'
  11. property string mainTextColor: '#29b6fb'
  12. property string mainAppColor: '#29b6fb'
  13. property string textClickedColor: '#7ad4ff'
  14. property string textColorGreen: '#00FFFF'
  15. property color popupBgColorErr: "#b44"
  16. property color popupBgColorWarn: "#f7bd3e"
  17. property color popupBgColorOK: "#29b6fb"
  18. property color popupTextColor: "#ffffff"
  19. FontLoader {
  20. id: alibaba
  21. source: "qrc:/components/font/Alibaba-PuHuiTi-Bold.ttf"
  22. }
  23. FontLoader {
  24. id: fontawesome
  25. source: "qrc:/components/font/fontawesome-webfont.ttf"
  26. }
  27. FontLoader {
  28. id: digtalFont
  29. source: "qrc:/components/font/DS-DIGIB.ttf"
  30. }
  31. Popup {
  32. id: popup
  33. property alias popMessage: message.text
  34. property alias popColor: popupBg.color
  35. background: Rectangle {
  36. id: popupBg
  37. implicitWidth: rootItem.width
  38. implicitHeight: 60
  39. }
  40. y: (rootItem.height - 60)
  41. modal: true
  42. focus: true
  43. closePolicy: Popup.CloseOnPressOutside
  44. Text {
  45. id: message
  46. anchors.centerIn: parent
  47. font.pointSize: 12
  48. color: popupTextColor
  49. font.family: '黑体'
  50. }
  51. onOpened: popupClose.start()
  52. }
  53. signal qmlSignalMaxWindow
  54. signal qmlSignalQuit
  55. state: "loading"
  56. states: [
  57. State {
  58. name: "loading"
  59. PropertyChanges {
  60. target: panelView
  61. opacity: 0
  62. }
  63. },
  64. State {
  65. name: "loaded"
  66. PropertyChanges {
  67. target: panelView
  68. opacity: 1
  69. }
  70. }
  71. ]
  72. Item {
  73. id: panelView
  74. width: 1920
  75. height: 1080
  76. visible: true
  77. x: 0
  78. y: 0
  79. Dialog {
  80. id: closeDialog
  81. visible: false
  82. modal: true
  83. x: (parent.width - width) / 2
  84. y: (parent.height - height) / 2
  85. closePolicy: Popup.NoAutoClose
  86. implicitWidth: 500
  87. implicitHeight: 300
  88. Text {
  89. text: "该账号已登录,程序将自动退出"
  90. font.pointSize: 24
  91. font.family: alibaba.name
  92. color: mainAppColor
  93. anchors.horizontalCenter: parent.horizontalCenter
  94. y: 100
  95. }
  96. onOpened: {
  97. closeWinTimer.start()
  98. }
  99. }
  100. Dialog {
  101. id: panelDialog
  102. visible: false
  103. modal: true
  104. x: (parent.width - width) / 2
  105. y: (parent.height - height) / 2
  106. closePolicy: Popup.NoAutoClose
  107. implicitWidth: 500
  108. implicitHeight: 300
  109. Text {
  110. text: "确认退出吗?"
  111. font.pointSize: 24
  112. font.family: alibaba.name
  113. color: mainAppColor
  114. anchors.horizontalCenter: parent.horizontalCenter
  115. y: 100
  116. }
  117. Row {
  118. height: parent.height
  119. anchors.horizontalCenter: parent.horizontalCenter
  120. y: 200
  121. CButton {
  122. id: cancelBtn
  123. textHeight: 50
  124. fontHeight: 0.4
  125. width: 150
  126. height: 50
  127. color: pressed ? textClickedColor : mainAppColor
  128. text: "取消"
  129. onClicked: panelDialog.visible = false
  130. }
  131. spacing: 50
  132. CButton {
  133. id: quitButton
  134. textHeight: 50
  135. fontHeight: 0.4
  136. width: 150
  137. height: 50
  138. color: pressed ? textClickedColor : mainAppColor
  139. text: "退出"
  140. onClicked: {
  141. videoWindow.close()
  142. rootItem.qmlSignalQuit()
  143. }
  144. }
  145. }
  146. }
  147. PanelWindow {
  148. id: subPage
  149. focus: true
  150. Keys.enabled: true
  151. Keys.onEscapePressed: {
  152. panelDialog.visible = true
  153. }
  154. }
  155. Window {
  156. id: videoWindow
  157. property int wndIndex: 0
  158. visible: true
  159. width: 3840
  160. height: 1080
  161. x: 1920
  162. title: qsTr("Hyper vision remote control System")
  163. flags: Qt.Window | Qt.FramelessWindowHint
  164. screen: Qt.application.screens[wndIndex]
  165. MainWindow {}
  166. Component.onCompleted: {
  167. appModel.radar1 = 0
  168. appModel.radar2 = 0
  169. appModel.radar3 = 0
  170. appModel.radar4 = 0
  171. appModel.radar5 = 0
  172. // appModel.radar6 = 0
  173. appModel.ping = 0
  174. appModel.ready = 0
  175. }
  176. }
  177. }
  178. Timer {
  179. id: splashScreenClose
  180. interval: 1000
  181. onTriggered: {
  182. splashScreenLoader.item.visible = false
  183. splashScreenLoader.source = ""
  184. rootItem.qmlSignalMaxWindow()
  185. rootItem.state = "loaded"
  186. }
  187. }
  188. Loader {
  189. id: splashScreenLoader
  190. source: "qrc:/components/SplashScreen.qml"
  191. onLoaded: {
  192. splashScreenClose.start()
  193. }
  194. }
  195. }