runhey 3 лет назад
Родитель
Сommit
bd956018c7

+ 2 - 2
fluentui/src/imports/FluentUI/Controls/FluProgressRing.qml

@@ -4,7 +4,7 @@ import FluentUI
 
 Rectangle {
 
-    property real linWidth : 5
+    property real linWidth : width/8
     property real progress: 0.25
     property bool indeterminate: true
     readonly property real radius2 : radius - linWidth/2
@@ -13,7 +13,7 @@ Rectangle {
     id: control
     width: 44
     height: 44
-    radius: 22
+    radius: width/2
     border.width: linWidth
     color: "#00000000"
     border.color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)

+ 3 - 0
module/gui/qml.qrc

@@ -8,5 +8,8 @@
         <file>qml/Global/ItemsFooter.qml</file>
         <file>qml/Global/ItemsOriginal.qml</file>
         <file>qml/Global/MainEvent.qml</file>
+        <file>qml/Component/SplitPanel.qml</file>
+        <file>qml/Component/OverStatus.qml</file>
+        <file>qml/Component/RunStatusIcon.qml</file>
     </qresource>
 </RCC>

+ 44 - 0
module/gui/qml/Component/OverStatus.qml

@@ -0,0 +1,44 @@
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import FluentUI
+import "../Global/"
+
+Item{
+
+//    width: 200
+    height: 40
+    RowLayout{
+        anchors.fill: parent
+        spacing: 0
+        FluText{
+            id: menuName
+            Layout.alignment: Qt.AlignVCenter
+            text: MainEvent.menuTitle
+            font: FluTextStyle.BodyStrong
+        }
+        RunStatusIcon{
+            id: runStatusIcon
+            Layout.alignment: Qt.AlignVCenter
+            Layout.leftMargin: 20
+            runStatus: MainEvent.runStatus
+        }
+        FluText{
+            id:runStatusText
+            property int runStatus: MainEvent.runStatus
+            Layout.alignment: Qt.AlignVCenter
+            text: ""
+            onRunStatusChanged: {
+                if(runStatus === MainEvent.RunStatus.Empty){
+                    text= ""
+                }else if(runStatus === MainEvent.RunStatus.Free){
+                    text= "闲置"
+                }else if(runStatus === MainEvent.RunStatus.Run){
+                    text= "运行中"
+                }else if(runStatus === MainEvent.RunStatus.Error){
+                    text= "发生错误"
+                }
+            }
+        }
+    }
+}

+ 68 - 0
module/gui/qml/Component/RunStatusIcon.qml

@@ -0,0 +1,68 @@
+import QtQuick
+import QtQuick.Controls
+import FluentUI
+import "../Global"
+
+Item {
+    id: root
+    width: 40
+    height: 40
+    clip: true
+    property int runStatus: MainEvent.runStatus
+    property real radius: width / 2
+    property color color: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
+    property real animationDuration: 600 // in ms
+    property real maxRadius: width / 4
+
+
+    Rectangle {
+        id: runError
+        anchors.centerIn: parent
+        width: radius * 2
+        height: radius * 2
+        visible: runStatus
+        color: root.color
+        radius: radius
+
+        Behavior on radius {
+            NumberAnimation {
+                duration: root.animationDuration
+                easing.type: Easing.OutQuad
+            }
+        }
+
+        SequentialAnimation on radius {
+            loops: Animation.Infinite
+            PropertyAnimation { to: root.maxRadius; duration: root.animationDuration }
+        }
+    }
+
+    FluProgressRing{
+        id: runProgress
+        anchors.centerIn: parent
+        width: parent.width/2
+        height: parent.height/2
+    }
+
+    onRunStatusChanged: {
+        if(runStatus === MainEvent.RunStatus.Empty){
+            runError.visible = false
+            runProgress.visible = false
+        }else if(runStatus === MainEvent.RunStatus.Free){
+            runError.visible = false
+            runProgress.visible = true
+            runProgress.progress = 0
+        }else if(runStatus === MainEvent.RunStatus.Run){
+            runError.visible = false
+            runProgress.visible = true
+            runProgress.progress = 0.25
+        }else if(runStatus === MainEvent.RunStatus.Error){
+            runError.visible = true
+            runProgress.visible = false
+            runProgress.progress = 0
+        }
+    }
+
+
+
+}

+ 7 - 0
module/gui/qml/Component/SplitPanel.qml

@@ -0,0 +1,7 @@
+import QtQuick
+import QtQuick.Controls
+import FluentUI
+
+Item {
+
+}

+ 1 - 0
module/gui/qml/Global/ItemsFooter.qml

@@ -16,6 +16,7 @@ FluObject{
         icon:FluentIcons.Contact
         tapFunc:function(){
             console.debug("this click about")
+            MainEvent.runStatus = MainEvent.RunStatus.Error
         }
     }
 

+ 10 - 1
module/gui/qml/Global/MainEvent.qml

@@ -5,5 +5,14 @@ import QtQuick.Controls
 import FluentUI
 
 QtObject {
-    property int displayMode : FluNavigationView.Auto
+    enum RunStatus {
+        Error,
+        Run,
+        Free, //空闲
+        Empty //不显示
+    }
+
+    property int displayMode : FluNavigationView.Compact
+    property int runStatus: MainEvent.RunStatus.Empty
+    property string menuTitle: "主页"
 }

+ 9 - 9
module/gui/qml/MainWindow.qml

@@ -6,6 +6,7 @@ import Qt.labs.platform
 
 import FluentUI
 import "./Global/"
+import "./Component/"
 
 FluWindow {
     id:window
@@ -17,22 +18,21 @@ FluWindow {
     minimumHeight: 460
     launchMode: FluWindow.SingleTask
 
-//    Connections{
-//        target: appInfo
-//        function onActiveWindow(){
-//            window.show()
-//            window.raise()
-//            window.requestActivate()
-//        }
-//    }
 
     FluAppBar{
        id:appbar
        z:9
        width: parent.width
     }
+    OverStatus{
+        anchors{
+            top: parent.top
+            horizontalCenter: parent.horizontalCenter
+        }
+    }
+
 
-// 任务栏的左边系统图标
+// 任务栏的右边边系统图标
     SystemTrayIcon {
         id:system_tray
         visible: true

+ 4 - 3
module/gui/qml/Page/O_Add.qml

@@ -10,8 +10,9 @@ FluScrollablePage{
     bottomPadding:20
     spacing: 0
 
-    FluText{
-        anchors.top: parent.top
-        text: "this add"
+    FluProgressRing{
+        z: 888
+        width: 44
+        height: 44
     }
 }

+ 1 - 0
module/gui/res.qrc

@@ -1,5 +1,6 @@
 <RCC>
     <qresource prefix="/">
         <file>res/icon.ico</file>
+        <file>res/exclamation-triangle-fill.svg</file>
     </qresource>
 </RCC>

+ 3 - 0
module/gui/res/exclamation-triangle-fill.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill" viewBox="0 0 16 16">
+  <path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
+</svg>

+ 37 - 2
module/gui/res_rcc.py

@@ -1,6 +1,6 @@
 # Resource object code (Python 3)
 # Created by: object code
-# Created by: The Resource Compiler for Qt version 6.5.0
+# Created by: The Resource Compiler for Qt version 6.4.3
 # WARNING! All changes made in this file will be lost!
 
 from PySide6 import QtCore
@@ -8920,6 +8920,34 @@ W\xed\x07@\x004\xae\x02@\xce\x06\xb8,\xa7\x12\xcb\
 {Oe\xa3\x16j\xff\xfdg\xfb\xff\x03\x9fG\xc4v\
 dJ\xf0\x8f\x00\x00\x00\x00IEND\xaeB`\x82\
 \
+\x00\x00\x01\x9b\
+<\
+svg xmlns=\x22http:\
+//www.w3.org/200\
+0/svg\x22 width=\x2216\
+\x22 height=\x2216\x22 fi\
+ll=\x22currentColor\
+\x22 class=\x22bi bi-e\
+xclamation-trian\
+gle-fill\x22 viewBo\
+x=\x220 0 16 16\x22>\x0a \
+ <path d=\x22M8.982\
+ 1.566a1.13 1.13\
+ 0 0 0-1.96 0L.1\
+65 13.233c-.457.\
+778.091 1.767.98\
+ 1.767h13.713c.8\
+89 0 1.438-.99.9\
+8-1.767L8.982 1.\
+566zM8 5c.535 0 \
+.954.462.9.995l-\
+.35 3.507a.552.5\
+52 0 0 1-1.1 0L7\
+.1 5.995A.905.90\
+5 0 0 1 8 5zm.00\
+2 6a1 1 0 1 1 0 \
+2 1 1 0 0 1 0-2z\
+\x22/>\x0a</svg>\
 "
 
 qt_resource_name = b"\
@@ -8931,13 +8959,20 @@ qt_resource_name = b"\
 \x0aaB\x7f\
 \x00i\
 \x00c\x00o\x00n\x00.\x00i\x00c\x00o\
+\x00\x1d\
+\x07\xce\x01\xc7\
+\x00e\
+\x00x\x00c\x00l\x00a\x00m\x00a\x00t\x00i\x00o\x00n\x00-\x00t\x00r\x00i\x00a\x00n\
+\x00g\x00l\x00e\x00-\x00f\x00i\x00l\x00l\x00.\x00s\x00v\x00g\
 "
 
 qt_resource_struct = b"\
 \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
 \x00\x00\x00\x00\x00\x00\x00\x00\
-\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
+\x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\
 \x00\x00\x00\x00\x00\x00\x00\x00\
+\x00\x00\x00\x22\x00\x00\x00\x00\x00\x01\x00\x02,\xf5\
+\x00\x00\x01\x88\x0a\xc7k\xfc\
 \x00\x00\x00\x0c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
 \x00\x00\x01\x87\xfc2\xeaa\
 "