ukui-search/libsearch/index/index-monitor.h

181 lines
6.4 KiB
C
Raw Normal View History

/*
* 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)
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)
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)
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;
/**
* @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;
/**
* @brief basicIndexDocNum
* @return
*/
uint basicIndexDocNum() const;
/**
* @brief contentIndexDocNum
* @return
*/
uint contentIndexDocNum() const;
/**
* @brief contentIndexDocNum
* @return ocr内容索引完成的总文档数
*/
uint ocrContentIndexDocNum() const;
/**
* basicIndexUpdating
* @return
*/
2024-04-17 17:43:50 +08:00
bool basicIndexUpdating() const;
/**
* basicIndexUpdating
* @return
*/
2024-04-17 17:43:50 +08:00
bool contentIndexUpdating() const;
/**
* basicIndexUpdating
* @return ocr索引是否正在执行增量更新
*/
2024-04-17 17:43:50 +08:00
bool ocrContentIndexUpdating() const;
/**
* aiIndexUpdating
* @return ai索引是否正在执行增量更新
*/
bool aiIndexUpdating() const;
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);
void basicIndexProgressChanged(uint basicIndexProgress);
void contentIndexProgressChanged(uint contentIndexProgress);
void ocrContentIndexProgressChanged(uint ocrIndexProgress);
2024-04-17 17:43:50 +08:00
void aiIndexProgressChanged(uint aiIndexProgress);
void basicIndexDocNumChanged(uint basicIndexDocNum);
void contentIndexDocNumChanged(uint contentIndexDocNum);
void ocrContentIndexDocNumChanged(uint ocrContentIndexDocNum);
2024-04-17 17:43:50 +08:00
void aiIndexDocNumChanged(uint ocrContentIndexDocNum);
void basicIndexStart();
void contentIndexStart();
void ocrContentIndexStart();
2024-04-17 17:43:50 +08:00
void aiIndexStart();
void basicIndexDone(bool success);
void contentIndexDone(bool success);
void ocrContentIndexDone(bool success);
2024-04-17 17:43:50 +08:00
void aiIndexDone(bool success);
void basicIndexUpdatingChanged(bool basicIndexUpdating);
void contentIndexUpdatingChanged(bool contentIndexUpdating);
void ocrContentIndexUpdatingChanged(bool ocrContentIndexUpdating);
2024-04-17 17:43:50 +08:00
void aiIndexUpdatingChanged(bool ocrContentIndexUpdating);
void serviceReady();
void serviceOffline();
private:
explicit IndexMonitor(QObject *parent = nullptr);
~IndexMonitor();
IndexMonitorPrivate *d = nullptr;
};
} // UkuiSearch
#endif //UKUI_SEARCH_INDEX_MONITOR_H