Просмотр исходного кода

feat(gui): add Overview scheduler

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

+ 1 - 1
README.md

@@ -14,4 +14,4 @@
 
 ui库目前还没完善,先做device
 
-![image-20230517184432630](https://runhey-img-stg1.oss-cn-chengdu.aliyuncs.com/img2/202305171844003.png)
+![image-20230526205041711](https://runhey-img-stg1.oss-cn-chengdu.aliyuncs.com/img2/202305262050939.png)

+ 1 - 1
module/gui/README.md

@@ -6,7 +6,7 @@
 where python
 cd module/gui
 pyside6-rcc -o qml_rcc.py qml.qrc
-pyside6-rcc -o rec_rcc.py res.qrc
+pyside6-rcc -o res_rcc.py res.qrc
 ```
 
 即可生成rcc文件。当然当你每修改一次qrc指向的资源文件时候就需要运行一次

+ 5 - 1
module/gui/qml.qrc

@@ -17,6 +17,10 @@
         <file>qml/Component/FItemDelegate.qml</file>
         <file>qml/Page/ScriptView.qml</file>
         <file>qml/Component/ScriptItem.qml</file>
-        <file>qml/Component/OverView.qml</file>
+        <file>qml/Component/Overview.qml</file>
+        <file>qml/Page/Home.qml</file>
+        <file>qml/Page/Update.qml</file>
+        <file>qml/Component/Args.qml</file>
+        <file>qml/Component/Taskmini.qml</file>
     </qresource>
 </RCC>

+ 1 - 1
module/gui/qml/Component/OverView.qml → module/gui/qml/Component/Args.qml

@@ -3,6 +3,6 @@ import FluentUI
 
 Item {
     FluText{
-        text: "i kdow this overview"
+        text: 'this args '
     }
 }

+ 146 - 0
module/gui/qml/Component/Overview.qml

@@ -0,0 +1,146 @@
+import QtQuick
+import QtQuick.Layouts
+import FluentUI
+
+Item {
+
+
+
+    Item{
+        id: leftScheduler
+        width: 260
+        anchors{
+            left: parent.left
+            top: parent.top
+            bottom: parent.bottom
+        }
+        FluArea{
+            id: schedulerOpen
+            anchors.top: parent.top
+            width: parent.width
+            height: 50
+            RowLayout{
+                anchors.fill: parent
+                FluText{
+                    text: 'Scheduler'
+                    Layout.leftMargin: 16
+                    font: FluTextStyle.Subtitle
+                    Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
+                }
+                FluToggleButton{
+                    Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
+                    Layout.rightMargin: 16
+                    text:"Start"
+                    onClicked: {
+                        selected = !selected
+                        if(selected){
+                            text = "Start"
+                        }else{
+                            text = "Stop"
+                        }
+                    }
+                }
+            }
+        }
+        FluArea{
+            id: schedulerRunning
+            anchors.top: schedulerOpen.bottom
+            anchors.topMargin: 10
+            width: parent.width
+            height: 120
+            ColumnLayout{
+                width: parent.width
+                spacing: 8
+                FluText{
+                    text: 'Running'
+                    Layout.leftMargin: 16
+                    Layout.topMargin: 6
+                    font: FluTextStyle.Subtitle
+                }
+                Rectangle{
+                    width: schedulerRunning.width - 20
+                    height: 2
+                    Layout.alignment: Qt.AlignHCenter
+                    color: FluTheme.dark ? Qt.rgba(64/255, 68/255, 75/255, 1) : Qt.rgba(234/255, 236/255, 239/255, 1)
+                    radius: 2
+                }
+                Taskmini{
+                    Layout.leftMargin: 16
+                }
+            }
+        }
+        FluArea{
+            id: schedulerPending
+            anchors.top: schedulerRunning.bottom
+            anchors.topMargin: 10
+            width: parent.width
+            height: 240
+            ColumnLayout{
+                width: parent.width
+                spacing: 8
+                FluText{
+                    text: 'Pending'
+                    Layout.leftMargin: 16
+                    Layout.topMargin: 6
+                    font: FluTextStyle.Subtitle
+                }
+                Rectangle{
+                    width: schedulerRunning.width - 20
+                    height: 2
+                    Layout.alignment: Qt.AlignHCenter
+                    color: FluTheme.dark ? Qt.rgba(64/255, 68/255, 75/255, 1) : Qt.rgba(234/255, 236/255, 239/255, 1)
+                    radius: 2
+                }
+                Taskmini{
+                    Layout.leftMargin: 16
+                }
+                Taskmini{
+                    Layout.leftMargin: 16
+                }
+                Taskmini{
+                    Layout.leftMargin: 16
+                }
+                Taskmini{
+                    Layout.leftMargin: 16
+                }
+            }
+        }
+        FluArea{
+            id: schedulerWaiting
+            anchors.top: schedulerPending.bottom
+            anchors.topMargin: 10
+            anchors.bottom: parent.bottom
+            anchors.bottomMargin: 0
+            width: parent.width
+            ColumnLayout{
+                width: parent.width
+                spacing: 8
+                FluText{
+                    Layout.fillHeight: false
+                    text: 'Waiting'
+                    Layout.leftMargin: 16
+                    Layout.topMargin: 6
+                    font: FluTextStyle.Subtitle
+                }
+                Rectangle{
+                    Layout.fillHeight: false
+                    width: schedulerPending.width - 20
+                    height: 2
+                    Layout.alignment: Qt.AlignHCenter
+                    color: FluTheme.dark ? Qt.rgba(64/255, 68/255, 75/255, 1) : Qt.rgba(234/255, 236/255, 239/255, 1)
+                    radius: 2
+                }
+                Taskmini{
+                    Layout.leftMargin: 16
+                    Layout.fillHeight: false
+                }
+            }
+        }
+    }
+    FluArea{
+        anchors.left: leftScheduler.right
+        anchors.leftMargin: 10
+        height: parent.height
+        anchors.right: parent.right
+    }
+}

+ 5 - 15
module/gui/qml/Component/SplitPanel.qml

@@ -1,9 +1,11 @@
 import QtQuick
 import QtQuick.Controls
 import FluentUI
+import "../Global"
 
 Item {
-    signal clickMessage(string text)
+    id: splitPanel
+    property string title: ""
 
     // 左边菜单
     FluArea{
@@ -17,7 +19,8 @@ Item {
             selectionMode: FluTabView.SizeToContent
 
             onItemClicked:(model)=>{
-                    clickMessage(model.text)
+                    MainEvent.menuTitle = model.text
+                    splitPanel.title = model.text
                     showSuccess(model.text)
                 }
         }
@@ -67,19 +70,6 @@ Item {
             }
         }
         menu_tree.updateData(datas)
-
-//        for(let items of data){
-//        if(items.length === 'string'){
-//            datas.push(menu_tree.createItem(items,false))
-//        }else{
-//            var da = []
-//            for(let item of items){
-//                da.push(menu_tree.createItem(item,false))
-//            }
-//            datas.push(menu_tree.createItem(items, true, da))
-//        }
-
-//        }
     }
 
     //右侧的分为两个部分一个部分是contentDefalut表示固定的不动的

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

@@ -0,0 +1,44 @@
+import QtQuick
+import QtQuick.Layouts
+import FluentUI
+// 这个组件是在总览那儿小小的显示
+// 任务的名称 + 时间 以及一个设置的入口
+
+Item {
+    width: 225
+    height: 40
+    FluText{
+        id: taskName
+        anchors{
+            left: parent.left
+            leftMargin: 0
+            top: parent.top
+            topMargin: 0
+        }
+        text: "taskName"
+        font: FluTextStyle.BodyStrong
+    }
+    FluText{
+        id: taskTime
+        anchors{
+            left: parent.left
+            leftMargin: 0
+            bottom: parent.bottom
+            bottomMargin: 0
+        }
+        text: "2023-05-26 18:33:55"
+        font: FluTextStyle.Caption
+    }
+    FluButton{
+        id: settingButton
+        anchors{
+            right: parent.right
+            rightMargin: 0
+            verticalCenter: parent.verticalCenter
+        }
+        text:"setting"
+        onClicked: {
+             showSuccess("setting")
+        }
+    }
+}

+ 0 - 2
module/gui/qml/Global/MainEvent.qml

@@ -39,7 +39,6 @@ QtObject {
                 "language": "zh-CN"}
         }
 
-        console.debug(displayMode, darkMode, primaryColor, nativeText, language)
         mainEvent.displayMode = set["displayMode"]
         mainEvent.darkMode = set["darkMode"]
         mainEvent.nativeText = set["nativeText"]
@@ -54,7 +53,6 @@ QtObject {
         else if(primary_color === "Blue"){mainEvent.primaryColor = FluColors.Blue}
         else if(primary_color === "Teal"){mainEvent.primaryColor = FluColors.Teal}
         else if(primary_color === "Green"){mainEvent.primaryColor = FluColors.Green}
-        console.debug(displayMode, darkMode, primaryColor, nativeText, language)
     }
     onDisplayModeChanged: {
         if(mainEvent.settings === ""){

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

@@ -11,7 +11,7 @@ import "./Component/"
 FluWindow {
     id:window
     title: "oas"
-    width: 1000
+    width: 1100
     height: 720
     closeDestory:false
     minimumWidth: 520

+ 26 - 0
module/gui/qml/Page/Home.qml

@@ -0,0 +1,26 @@
+import QtQuick
+import QtQuick.Layouts
+import FluentUI
+
+FluScrollablePage{
+    spacing: 6
+    Image {
+        id: name
+        Layout.preferredHeight: 40
+        Layout.preferredWidth: 40
+        Layout.alignment: Qt.AlignHCenter
+        source: "qrc:/res/icon.png"
+    }
+    FluText{
+//        Layout.fillWidth: true
+        text: "OAS是一款致力于全自动化的阴阳师脚本"
+        font: FluTextStyle.Title
+        Layout.alignment: Qt.AlignHCenter
+    }
+    FluText{
+        text: "https://github.com/runhey/OnmyojiAutoScript"
+        font: FluTextStyle.Body
+        Layout.alignment: Qt.AlignHCenter
+    }
+
+}

+ 19 - 0
module/gui/qml/Page/O_Home.qml

@@ -9,5 +9,24 @@ import "../Component"
 
 SplitPanel{
 
+    onTitleChanged: {
+        if(title === "Home"){
+            var comp = Qt.createComponent("../../qml/Page/Home.qml")
+            if (comp.status === Component.Ready) {
+                setLoader(comp)
+            }
+        }else if(title === "Update"){
+            var updater = Qt.createComponent("../../qml/Page/Update.qml")
+            if (updater.status === Component.Ready) {
+                setLoader(updater)
+            }
+        }
+    }
+    Component.onCompleted:{
+        var comp = Qt.createComponent("../../qml/Page/Home.qml")
+        if (comp.status === Component.Ready) {
+            setDefalut(comp)
+        }
+    }
 }
 

+ 16 - 2
module/gui/qml/Page/ScriptView.qml

@@ -7,17 +7,31 @@ import "../Global"
 SplitPanel{
 
     property string configName: ""
+    onTitleChanged: {
+        if(title === "Overview"){
+            showDefalut()
+        }
+        else{
+            var component = Qt.createComponent("../../qml/Component/Args.qml")
+            if (component.status === Component.Ready) {
+                setLoader(component)
+            }else{
+                // 组件加载失败
+            }
+        }
+    }
 
 
     Component.onCompleted:{
-        var data = {'OverView':[], 'Script': ['Script', 'General', 'Restart']}
+        var data = {'Overview':[], 'Script': ['Script', 'General', 'Restart']}
         create(data)
 
-        var component = Qt.createComponent("../../qml/Component/OverView.qml")
+        var component = Qt.createComponent("../../qml/Component/Overview.qml")
         if (component.status === Component.Ready) {
             setDefalut(component)
         } else {
             // 组件加载失败
+            console.debug('组件加载失败')
         }
     }
 }

+ 9 - 0
module/gui/qml/Page/Update.qml

@@ -0,0 +1,9 @@
+import QtQuick
+import FluentUI
+
+FluScrollablePage{
+
+    FluText{
+        text: '显示github的更新信息'
+    }
+}

Разница между файлами не показана из-за своего большого размера
+ 1194 - 203
module/gui/qml_rcc.py


+ 1 - 0
module/gui/res.qrc

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

BIN
module/gui/res/icon.png


Разница между файлами не показана из-за своего большого размера
+ 33927 - 0
module/gui/res_rcc.py


Некоторые файлы не были показаны из-за большого количества измененных файлов