Overview.qml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. import QtQuick
  2. import QtQuick.Controls
  3. import QtQuick.Layouts
  4. import FluentUI
  5. Item {
  6. id: root
  7. property string configName: ""
  8. Item{
  9. id: leftScheduler
  10. width: 260
  11. anchors{
  12. left: parent.left
  13. top: parent.top
  14. bottom: parent.bottom
  15. }
  16. FluArea{
  17. id: schedulerOpen
  18. anchors.top: parent.top
  19. width: parent.width
  20. height: 50
  21. RowLayout{
  22. anchors.fill: parent
  23. FluText{
  24. text: 'Scheduler'
  25. Layout.leftMargin: 16
  26. font: FluTextStyle.Subtitle
  27. Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
  28. }
  29. FluIconButton{
  30. Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
  31. text: "Restart"
  32. iconSource: FluentIcons.RepeatAll
  33. onClicked: {
  34. showSuccess("Restart"+" "+configName)
  35. process_manager.restart(configName)
  36. textLog.text = ""
  37. }
  38. }
  39. FluToggleButton{
  40. Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
  41. Layout.rightMargin: 16
  42. text:"Start"
  43. selected: true
  44. onClicked: {
  45. selected = !selected
  46. if(selected){
  47. text = "Start"
  48. textLog.text = ""
  49. }else{
  50. text = "Stop"
  51. }
  52. }
  53. }
  54. }
  55. }
  56. FluArea{
  57. id: schedulerRunning
  58. anchors.top: schedulerOpen.bottom
  59. anchors.topMargin: 10
  60. width: parent.width
  61. height: 120
  62. ColumnLayout{
  63. width: parent.width
  64. spacing: 8
  65. FluText{
  66. text: 'Running'
  67. Layout.leftMargin: 16
  68. Layout.topMargin: 6
  69. font: FluTextStyle.Subtitle
  70. }
  71. Rectangle{
  72. width: schedulerRunning.width - 20
  73. height: 2
  74. Layout.alignment: Qt.AlignHCenter
  75. color: FluTheme.dark ? Qt.rgba(64/255, 68/255, 75/255, 1) : Qt.rgba(234/255, 236/255, 239/255, 1)
  76. radius: 2
  77. }
  78. Taskmini{
  79. Layout.leftMargin: 16
  80. }
  81. }
  82. }
  83. FluArea{
  84. id: schedulerPending
  85. anchors.top: schedulerRunning.bottom
  86. anchors.topMargin: 10
  87. width: parent.width
  88. height: 240
  89. ColumnLayout{
  90. width: parent.width
  91. spacing: 8
  92. FluText{
  93. text: 'Pending'
  94. Layout.leftMargin: 16
  95. Layout.topMargin: 6
  96. font: FluTextStyle.Subtitle
  97. }
  98. Rectangle{
  99. width: schedulerRunning.width - 20
  100. height: 2
  101. Layout.alignment: Qt.AlignHCenter
  102. color: FluTheme.dark ? Qt.rgba(64/255, 68/255, 75/255, 1) : Qt.rgba(234/255, 236/255, 239/255, 1)
  103. radius: 2
  104. }
  105. Taskmini{
  106. Layout.leftMargin: 16
  107. }
  108. Taskmini{
  109. Layout.leftMargin: 16
  110. }
  111. Taskmini{
  112. Layout.leftMargin: 16
  113. }
  114. Taskmini{
  115. Layout.leftMargin: 16
  116. }
  117. }
  118. }
  119. FluArea{
  120. id: schedulerWaiting
  121. anchors.top: schedulerPending.bottom
  122. anchors.topMargin: 10
  123. anchors.bottom: parent.bottom
  124. anchors.bottomMargin: 0
  125. width: parent.width
  126. ColumnLayout{
  127. width: parent.width
  128. spacing: 8
  129. FluText{
  130. Layout.fillHeight: false
  131. text: 'Waiting'
  132. Layout.leftMargin: 16
  133. Layout.topMargin: 6
  134. font: FluTextStyle.Subtitle
  135. }
  136. Rectangle{
  137. Layout.fillHeight: false
  138. width: schedulerPending.width - 20
  139. height: 2
  140. Layout.alignment: Qt.AlignHCenter
  141. color: FluTheme.dark ? Qt.rgba(64/255, 68/255, 75/255, 1) : Qt.rgba(234/255, 236/255, 239/255, 1)
  142. radius: 2
  143. }
  144. Taskmini{
  145. Layout.leftMargin: 16
  146. Layout.fillHeight: false
  147. }
  148. }
  149. }
  150. }
  151. FluArea{
  152. id: logHeader
  153. anchors.top: parent.top
  154. anchors.left: leftScheduler.right
  155. anchors.leftMargin: 10
  156. anchors.right: parent.right
  157. height: 50
  158. RowLayout{
  159. anchors.fill: parent
  160. RowLayout.alignment: Qt.AlignRight | Qt.AlignVCenter
  161. FluText{
  162. text: 'Log'
  163. Layout.leftMargin: 16
  164. font: FluTextStyle.Subtitle
  165. Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
  166. }
  167. FluToggleButton{
  168. Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
  169. Layout.rightMargin: 16
  170. text:"Auto Scroll On"
  171. selected: true
  172. onClicked: {
  173. selected = !selected
  174. if(selected){
  175. text = "Auto Scroll On"
  176. }else{
  177. text = "Auto Scroll Off"
  178. }
  179. }
  180. }
  181. }
  182. }
  183. FluArea{
  184. anchors.top: logHeader.bottom
  185. anchors.topMargin: 10
  186. anchors.bottom: parent.bottom
  187. anchors.left: leftScheduler.right
  188. anchors.leftMargin: 10
  189. anchors.right: parent.right
  190. FluScrollablePage{
  191. anchors.fill: parent
  192. FluText{
  193. id: textLog
  194. width: parent.width
  195. padding: 10
  196. clip: true
  197. wrapMode: Text.WordWrap // 设置自动换行模式
  198. text: ""
  199. function add_log(config, log){
  200. if(config !== root.configName){
  201. return
  202. }
  203. textLog.text += log
  204. }
  205. Component.onCompleted:{
  206. process_manager.log_signal.connect(textLog.add_log)
  207. }
  208. }}
  209. }
  210. }