main.qml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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: mainView
  74. // MainWindow {}
  75. }
  76. Item {
  77. id: panelView
  78. width: 1920
  79. height: 1080
  80. visible: true
  81. x: 0
  82. y: 0
  83. Dialog {
  84. id: closeDialog
  85. visible: false
  86. modal: true
  87. x: (parent.width - width) / 2
  88. y: (parent.height - height) / 2
  89. closePolicy: Popup.NoAutoClose
  90. implicitWidth: 500
  91. implicitHeight: 300
  92. Text {
  93. text: "该账号已登录,程序将自动退出"
  94. font.pointSize: 24
  95. font.family: alibaba.name
  96. color: mainAppColor
  97. anchors.horizontalCenter: parent.horizontalCenter
  98. y: 100
  99. }
  100. onOpened: {
  101. closeWinTimer.start()
  102. }
  103. }
  104. Dialog {
  105. id: panelDialog
  106. visible: false
  107. modal: true
  108. x: (parent.width - width) / 2
  109. y: (parent.height - height) / 2
  110. closePolicy: Popup.NoAutoClose
  111. implicitWidth: 500
  112. implicitHeight: 300
  113. Text {
  114. text: "确认退出吗?"
  115. font.pointSize: 24
  116. font.family: alibaba.name
  117. color: mainAppColor
  118. anchors.horizontalCenter: parent.horizontalCenter
  119. y: 100
  120. }
  121. Row {
  122. height: parent.height
  123. anchors.horizontalCenter: parent.horizontalCenter
  124. y: 200
  125. CButton {
  126. id: cancelBtn
  127. textHeight: 50
  128. fontHeight: 0.4
  129. width: 150
  130. height: 50
  131. color: pressed ? textClickedColor : mainAppColor
  132. text: "取消"
  133. onClicked: panelDialog.visible = false
  134. }
  135. spacing: 50
  136. CButton {
  137. id: quitButton
  138. textHeight: 50
  139. fontHeight: 0.4
  140. width: 150
  141. height: 50
  142. color: pressed ? textClickedColor : mainAppColor
  143. text: "退出"
  144. onClicked: {
  145. videoWindow.close()
  146. rootItem.qmlSignalQuit()
  147. }
  148. }
  149. }
  150. }
  151. PanelWindow {
  152. id: subPage
  153. focus: true
  154. Keys.enabled: true
  155. Keys.onEscapePressed: {
  156. panelDialog.visible = true
  157. }
  158. }
  159. Window {
  160. id: videoWindow
  161. property int wndIndex: 0
  162. visible: true
  163. width: 3840
  164. height: 1080
  165. x: 1920
  166. title: qsTr("Hyper vision remote control System")
  167. flags: Qt.Window | Qt.FramelessWindowHint
  168. screen: Qt.application.screens[wndIndex]
  169. MainWindow {}
  170. Component.onCompleted: {
  171. appModel.radar1 = 0
  172. appModel.radar2 = 0
  173. appModel.radar3 = 0
  174. appModel.radar4 = 0
  175. appModel.radar5 = 0
  176. appModel.radar6 = 0
  177. appModel.ping = 0
  178. appModel.ready = 0
  179. appModel.imux = 0
  180. appModel.imuy = 0
  181. appModel.username = ''
  182. appModel.password = ''
  183. }
  184. }
  185. }
  186. Timer {
  187. id: splashScreenClose
  188. interval: 1000
  189. onTriggered: {
  190. splashScreenLoader.item.visible = false
  191. splashScreenLoader.source = ""
  192. rootItem.qmlSignalMaxWindow()
  193. rootItem.state = "loaded"
  194. }
  195. }
  196. Loader {
  197. id: splashScreenLoader
  198. source: "qrc:/components/SplashScreen.qml"
  199. onLoaded: {
  200. splashScreenClose.start()
  201. }
  202. }
  203. // Component.onCompleted: {
  204. // videoWin.createObject(rootItem, {
  205. // "wndIndex": 0
  206. // })
  207. // }
  208. // Component {
  209. // id: videoWin
  210. // Window {
  211. // id: videoWindow
  212. // property int wndIndex: 0
  213. // visible: true
  214. // width: 3840
  215. // height: 1080
  216. // x: 2560
  217. // title: qsTr("Hyper vision remote control System")
  218. // flags: Qt.Window | Qt.FramelessWindowHint
  219. // screen: Qt.application.screens[wndIndex]
  220. // MainWindow {}
  221. // Component.onCompleted: {
  222. // appModel.radar1 = 0
  223. // appModel.radar2 = 0
  224. // appModel.radar3 = 0
  225. // appModel.radar4 = 0
  226. // appModel.radar5 = 0
  227. // appModel.radar6 = 0
  228. // appModel.delay = 0
  229. // appModel.ready = 0
  230. // }
  231. // }
  232. // }
  233. }