ukui-search/ukui-search-service/qml/IndexMonitor.qml

138 lines
4.7 KiB
QML
Raw Normal View History

/*
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Authors: iaom <zhangpengfei@kylinos.cn>
*
*/
2022-10-26 18:01:40 +08:00
import QtQuick 2.0
import QtQuick.Layouts 1.12
2022-10-26 18:01:40 +08:00
Rectangle {
height: 180
width: 320
Column {
visible: true
width: parent.width
height: childrenRect.height
StatusKeyValue {
id: basicIndexDocumentNum
keyText: qsTr("Basic index document number")
valueText: "--"
}
2022-10-26 18:01:40 +08:00
StatusKeyValue {
id: contentIndexDocumentNum
keyText: qsTr("Content index document number")
valueText: "--"
}
StatusKeyValue {
id: indexState
keyText: qsTr("Index state")
valueText: "--"
}
IndexProgressBar {
id: basicIndexProgress
width: parent.width;
name: "Basic index progress"
from: 0
visible: false
}
IndexProgressBar {
id: contentIndexProgress
width: parent.width;
name: "Content index progress"
from: 0
visible: false
}
IndexProgressBar {
id: ocrIndexProgress
name: "OCR index progress"
width: parent.width;
from: 0
visible: false
}
Component.onCompleted: {
basicIndexDocumentNum.valueText = monitor.basicIndexDocNum
contentIndexDocumentNum.valueText = monitor.contentIndexDocNum
indexState.valueText = monitor.indexState
monitor.basicIndexDocNumUpdate.connect(onBasicIndexDocNumUpdate);
monitor.contentIndexDocNumUpdate.connect(onContentIndexDocumentNum);
monitor.indexStateChanged.connect(onIndexStateChanged);
monitor.basicIndexSizeChange.connect(onBasicIndexSizeChange);
monitor.basicIndexProgressUpdate.connect(onBasicIndexProgressUpdate);
monitor.contentIndexSizeChange.connect(onContentIndexSizeChange);
monitor.contentIndexProgressUpdate.connect(onContentIndexProgressUpdate);
monitor.ocrIndexSizeChange.connect(onOcrIndexSizeChange);
monitor.onOcrIndexProgressUpdate.connect(onOcrIndexProgressUpdate);
monitor.basicIndexDone.connect(onBasicIndexDone);
monitor.contentIndexDone.connect(onContentIndexDone);
}
function onBasicIndexDocNumUpdate(num) {
var numStr = "%1";
basicIndexDocumentNum.valueText = numStr.arg(num);
}
function onContentIndexDocumentNum(num) {
var numStr = "%1";
contentIndexDocumentNum.valueText = numStr.arg(num);
}
function onIndexStateChanged(state) {
indexState.valueText = state;
}
function onBasicIndexSizeChange(num) {
if(!basicIndexProgress.visible) {
basicIndexProgress.visible = true;
}
basicIndexProgress.to = num;
}
function onBasicIndexProgressUpdate(num) {
basicIndexProgress.value = num;
basicIndexProgress.state = "Running"
}
function onContentIndexSizeChange(num) {
if(!contentIndexProgress.visible) {
contentIndexProgress.visible = true;
}
contentIndexProgress.to = num;
}
function onContentIndexProgressUpdate(num) {
contentIndexProgress.value = num;
contentIndexProgress.state = "Running"
}
function onOcrIndexSizeChange(num) {
if(!ocrIndexProgress.visible) {
ocrIndexProgress.visible = true;
}
ocrIndexProgress.to = num;
}
function onOcrIndexProgressUpdate(num) {
ocrIndexProgress.value = num;
ocrIndexProgress.state = "Running"
}
function onBasicIndexDone() {
basicIndexProgress.state = "Done"
}
function onContentIndexDone() {
contentIndexProgress.state = "Done"
ocrIndexProgress.state = "Done"
}
}
2022-10-26 18:01:40 +08:00
}