2024-04-15 09:52:06 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2024, 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>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef UKUI_SEARCH_INDEX_MONITOR_H
|
|
|
|
#define UKUI_SEARCH_INDEX_MONITOR_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
namespace UkuiSearch {
|
|
|
|
/**
|
|
|
|
* 索引状态和进度信息查询
|
|
|
|
*/
|
|
|
|
class IndexMonitorPrivate;
|
|
|
|
class IndexMonitor : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QStringList currentIndexPaths READ currentIndexPaths NOTIFY currentIndexPathsChanged)
|
|
|
|
Q_PROPERTY(QString indexState READ indexState NOTIFY indexStateChanged)
|
|
|
|
Q_PROPERTY(uint basicIndexSize READ basicIndexSize NOTIFY basicIndexSizeChanged)
|
|
|
|
Q_PROPERTY(uint contentIndexSize READ contentIndexSize NOTIFY contentIndexSizeChanged)
|
|
|
|
Q_PROPERTY(uint ocrContentIndexSize READ ocrContentIndexSize NOTIFY ocrContentIndexSizeChanged)
|
2024-04-17 17:43:50 +08:00
|
|
|
Q_PROPERTY(uint aiIndexSize READ aiIndexSize NOTIFY aiIndexSizeChanged)
|
2024-04-15 09:52:06 +08:00
|
|
|
Q_PROPERTY(uint basicIndexProgress READ basicIndexProgress NOTIFY basicIndexProgressChanged)
|
|
|
|
Q_PROPERTY(uint contentIndexProgress READ contentIndexProgress NOTIFY contentIndexProgressChanged)
|
|
|
|
Q_PROPERTY(uint ocrContentIndexProgress READ ocrContentIndexProgress NOTIFY ocrContentIndexProgressChanged)
|
2024-04-17 17:43:50 +08:00
|
|
|
Q_PROPERTY(uint aiIndexProgress READ aiIndexProgress NOTIFY aiIndexProgressChanged)
|
2024-04-15 09:52:06 +08:00
|
|
|
Q_PROPERTY(uint basicIndexDocNum READ basicIndexDocNum NOTIFY basicIndexDocNumChanged)
|
|
|
|
Q_PROPERTY(uint contentIndexDocNum READ contentIndexDocNum NOTIFY contentIndexDocNumChanged)
|
|
|
|
Q_PROPERTY(uint ocrContentIndexDocNum READ ocrContentIndexDocNum NOTIFY ocrContentIndexDocNumChanged)
|
2024-04-17 17:43:50 +08:00
|
|
|
Q_PROPERTY(uint basicIndexUpdating READ basicIndexUpdating NOTIFY basicIndexUpdatingChanged)
|
|
|
|
Q_PROPERTY(uint contentIndexUpdating READ contentIndexUpdating NOTIFY contentIndexUpdatingChanged)
|
|
|
|
Q_PROPERTY(uint ocrContentIndexUpdating READ ocrContentIndexUpdating NOTIFY ocrContentIndexUpdatingChanged)
|
|
|
|
Q_PROPERTY(uint aiIndexUpdating READ aiIndexUpdating NOTIFY aiIndexUpdatingChanged)
|
2024-04-15 09:52:06 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
static IndexMonitor *self();
|
|
|
|
static void stopMonitor();
|
|
|
|
static void startMonitor();
|
|
|
|
/**
|
|
|
|
* @brief currentIndexPaths
|
|
|
|
* @return 当前索引的所有目录
|
|
|
|
*/
|
|
|
|
QStringList currentIndexPaths() const;
|
|
|
|
/**
|
|
|
|
* @brief indexState
|
|
|
|
* @return 当前索引调度器的状态
|
|
|
|
*/
|
|
|
|
QString indexState() const;
|
|
|
|
/**
|
|
|
|
* @brief basicIndexSize
|
|
|
|
* @return 当前需要处理的基础索引数量
|
|
|
|
*/
|
|
|
|
uint basicIndexSize() const;
|
|
|
|
/**
|
|
|
|
* @brief contentIndexSize
|
|
|
|
* @return 当前需要处理的内容索引数量
|
|
|
|
*/
|
|
|
|
uint contentIndexSize() const;
|
|
|
|
/**
|
|
|
|
* @brief ocrContentIndexSize
|
|
|
|
* @return 当前需要处理的OCR索引数量
|
|
|
|
*/
|
|
|
|
uint ocrContentIndexSize() const;
|
2024-04-17 17:43:50 +08:00
|
|
|
/**
|
|
|
|
* @brief aiIndexSize
|
|
|
|
* @return 当前需要处理的ai索引数量
|
|
|
|
*/
|
|
|
|
uint aiIndexSize() const;
|
2024-04-15 09:52:06 +08:00
|
|
|
/**
|
|
|
|
* @brief basicIndexProgress
|
|
|
|
* @return 基础索引进度
|
|
|
|
*/
|
|
|
|
uint basicIndexProgress() const;
|
|
|
|
/**
|
|
|
|
* @brief contentIndexProgress
|
|
|
|
* @return 内容索引进度
|
|
|
|
*/
|
|
|
|
uint contentIndexProgress() const;
|
|
|
|
/**
|
|
|
|
* @brief ocrContentIndexProgress
|
|
|
|
* @return ocr索引进度
|
|
|
|
*/
|
|
|
|
uint ocrContentIndexProgress() const;
|
2024-04-17 17:43:50 +08:00
|
|
|
/**
|
|
|
|
* @brief aiIndexProgress
|
|
|
|
* @return ai索引进度
|
|
|
|
*/
|
|
|
|
uint aiIndexProgress() const;
|
2024-04-15 09:52:06 +08:00
|
|
|
/**
|
|
|
|
* @brief basicIndexDocNum
|
|
|
|
* @return 基础索引完成的总文档数
|
|
|
|
*/
|
|
|
|
uint basicIndexDocNum() const;
|
|
|
|
/**
|
|
|
|
* @brief contentIndexDocNum
|
|
|
|
* @return 内容索引完成的总文档数
|
|
|
|
*/
|
|
|
|
uint contentIndexDocNum() const;
|
|
|
|
/**
|
|
|
|
* @brief contentIndexDocNum
|
|
|
|
* @return ocr内容索引完成的总文档数
|
|
|
|
*/
|
|
|
|
uint ocrContentIndexDocNum() const;
|
2024-04-15 15:51:47 +08:00
|
|
|
/**
|
|
|
|
* basicIndexUpdating
|
|
|
|
* @return 基础索引是否正在执行增量更新
|
|
|
|
*/
|
2024-04-17 17:43:50 +08:00
|
|
|
bool basicIndexUpdating() const;
|
2024-04-15 15:51:47 +08:00
|
|
|
/**
|
|
|
|
* basicIndexUpdating
|
|
|
|
* @return 文本内容索引是否正在执行增量更新
|
|
|
|
*/
|
2024-04-17 17:43:50 +08:00
|
|
|
bool contentIndexUpdating() const;
|
2024-04-15 15:51:47 +08:00
|
|
|
/**
|
|
|
|
* basicIndexUpdating
|
|
|
|
* @return ocr索引是否正在执行增量更新
|
|
|
|
*/
|
2024-04-17 17:43:50 +08:00
|
|
|
bool ocrContentIndexUpdating() const;
|
|
|
|
/**
|
|
|
|
* aiIndexUpdating
|
|
|
|
* @return ai索引是否正在执行增量更新
|
|
|
|
*/
|
|
|
|
bool aiIndexUpdating() const;
|
2024-04-15 09:52:06 +08:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void currentIndexPathsChanged(QStringList currentIndexPaths);
|
|
|
|
void indexStateChanged(QString indexState);
|
|
|
|
void basicIndexSizeChanged(uint basicIndexSize);
|
|
|
|
void contentIndexSizeChanged(uint contentIndexSize);
|
2024-04-17 17:43:50 +08:00
|
|
|
void ocrContentIndexSizeChanged(uint ocrContentIndexSize);
|
|
|
|
void aiIndexSizeChanged(uint aiIndexSize);
|
2024-04-15 09:52:06 +08:00
|
|
|
void basicIndexProgressChanged(uint basicIndexProgress);
|
|
|
|
void contentIndexProgressChanged(uint contentIndexProgress);
|
|
|
|
void ocrContentIndexProgressChanged(uint ocrIndexProgress);
|
2024-04-17 17:43:50 +08:00
|
|
|
void aiIndexProgressChanged(uint aiIndexProgress);
|
2024-04-15 09:52:06 +08:00
|
|
|
void basicIndexDocNumChanged(uint basicIndexDocNum);
|
|
|
|
void contentIndexDocNumChanged(uint contentIndexDocNum);
|
|
|
|
void ocrContentIndexDocNumChanged(uint ocrContentIndexDocNum);
|
2024-04-17 17:43:50 +08:00
|
|
|
void aiIndexDocNumChanged(uint ocrContentIndexDocNum);
|
2024-04-15 09:52:06 +08:00
|
|
|
void basicIndexStart();
|
|
|
|
void contentIndexStart();
|
|
|
|
void ocrContentIndexStart();
|
2024-04-17 17:43:50 +08:00
|
|
|
void aiIndexStart();
|
2024-04-15 09:52:06 +08:00
|
|
|
void basicIndexDone(bool success);
|
|
|
|
void contentIndexDone(bool success);
|
|
|
|
void ocrContentIndexDone(bool success);
|
2024-04-17 17:43:50 +08:00
|
|
|
void aiIndexDone(bool success);
|
2024-04-15 15:51:47 +08:00
|
|
|
void basicIndexUpdatingChanged(bool basicIndexUpdating);
|
|
|
|
void contentIndexUpdatingChanged(bool contentIndexUpdating);
|
|
|
|
void ocrContentIndexUpdatingChanged(bool ocrContentIndexUpdating);
|
2024-04-17 17:43:50 +08:00
|
|
|
void aiIndexUpdatingChanged(bool ocrContentIndexUpdating);
|
2024-04-15 09:52:06 +08:00
|
|
|
|
|
|
|
void serviceReady();
|
|
|
|
void serviceOffline();
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit IndexMonitor(QObject *parent = nullptr);
|
|
|
|
~IndexMonitor();
|
|
|
|
IndexMonitorPrivate *d = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // UkuiSearch
|
|
|
|
|
|
|
|
#endif //UKUI_SEARCH_INDEX_MONITOR_H
|