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

154 lines
5.2 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)
Q_PROPERTY(uint basicIndexProgress READ basicIndexProgress NOTIFY basicIndexProgressChanged)
Q_PROPERTY(uint contentIndexProgress READ contentIndexProgress NOTIFY contentIndexProgressChanged)
Q_PROPERTY(uint ocrContentIndexProgress READ ocrContentIndexProgress NOTIFY ocrContentIndexProgressChanged)
Q_PROPERTY(uint basicIndexDocNum READ basicIndexDocNum NOTIFY basicIndexDocNumChanged)
Q_PROPERTY(uint contentIndexDocNum READ contentIndexDocNum NOTIFY contentIndexDocNumChanged)
Q_PROPERTY(uint ocrContentIndexDocNum READ ocrContentIndexDocNum NOTIFY ocrContentIndexDocNumChanged)
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;
/**
* @brief basicIndexProgress
* @return
*/
uint basicIndexProgress() const;
/**
* @brief contentIndexProgress
* @return
*/
uint contentIndexProgress() const;
/**
* @brief ocrContentIndexProgress
* @return ocr索引进度
*/
uint ocrContentIndexProgress() const;
/**
* @brief basicIndexDocNum
* @return
*/
uint basicIndexDocNum() const;
/**
* @brief contentIndexDocNum
* @return
*/
uint contentIndexDocNum() const;
/**
* @brief contentIndexDocNum
* @return ocr内容索引完成的总文档数
*/
uint ocrContentIndexDocNum() const;
/**
* basicIndexUpdating
* @return
*/
virtual bool basicIndexUpdating() const;
/**
* basicIndexUpdating
* @return
*/
virtual bool contentIndexUpdating() const;
/**
* basicIndexUpdating
* @return ocr索引是否正在执行增量更新
*/
virtual bool ocrContentIndexUpdating() const;
Q_SIGNALS:
void currentIndexPathsChanged(QStringList currentIndexPaths);
void indexStateChanged(QString indexState);
void basicIndexSizeChanged(uint basicIndexSize);
void contentIndexSizeChanged(uint contentIndexSize);
void ocrContentIndexSizeChanged(uint ocrIndexSize);
void basicIndexProgressChanged(uint basicIndexProgress);
void contentIndexProgressChanged(uint contentIndexProgress);
void ocrContentIndexProgressChanged(uint ocrIndexProgress);
void basicIndexDocNumChanged(uint basicIndexDocNum);
void contentIndexDocNumChanged(uint contentIndexDocNum);
void ocrContentIndexDocNumChanged(uint ocrContentIndexDocNum);
void basicIndexStart();
void contentIndexStart();
void ocrContentIndexStart();
void basicIndexDone(bool success);
void contentIndexDone(bool success);
void ocrContentIndexDone(bool success);
void basicIndexUpdatingChanged(bool basicIndexUpdating);
void contentIndexUpdatingChanged(bool contentIndexUpdating);
void ocrContentIndexUpdatingChanged(bool ocrContentIndexUpdating);
void serviceReady();
void serviceOffline();
private:
explicit IndexMonitor(QObject *parent = nullptr);
~IndexMonitor();
IndexMonitorPrivate *d = nullptr;
};
} // UkuiSearch
#endif //UKUI_SEARCH_INDEX_MONITOR_H