ukui-search/ukui-search-service/monitor.h

124 lines
3.4 KiB
C
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>
*
*/
#ifndef MONITOR_H
#define MONITOR_H
#include <QObject>
#include "index-scheduler.h"
#include "database.h"
#include "rep_monitor_source.h"
namespace UkuiSearch {
/**
* @brief The Monitor class
*
*/
class Monitor : public MonitorSource
{
Q_OBJECT
public:
explicit Monitor(IndexScheduler* scheduler, QObject *parent = nullptr);
/**
* @brief currentIndexPaths
* @return
*/
QStringList currentIndexPaths() const override;
/**
* @brief indexState
* @return
*/
QString indexState() const override;
/**
* @brief basicIndexSize
* @return
*/
uint basicIndexSize() const override;
/**
* @brief contentIndexSize
* @return
*/
uint contentIndexSize() const override;
/**
* @brief ocrIndexSize
* @return OCR索引数量
*/
uint ocrIndexSize() const override;
/**
* @brief basicIndexProgress
* @return
*/
uint basicIndexProgress() const override;
/**
* @brief contentIndexProgress
* @return
*/
uint contentIndexProgress() const override;
/**
* @brief ocrIndexProgress
* @return ocr索引进度
*/
uint ocrIndexProgress() const override;
/**
* @brief basicIndexDocNum
* @return
*/
uint basicIndexDocNum() const override;
/**
* @brief contentIndexDocNum
* @return
*/
uint contentIndexDocNum() const override;
/**
* @brief contentIndexDocNum
* @return ocr容索引完成的总文档数
*/
uint ocrContentIndexDocNum() const override;
Q_SIGNALS:
/**
* @brief basicIndexDone
*
*/
void basicIndexDone();
/**
* @brief contentIndexDone
*
*/
void contentIndexDone();
private Q_SLOTS:
void onIndexStateChanged(IndexScheduler::IndexerState);
void processUpdate(UkuiSearch::IndexType type, uint all, uint finished);
private:
IndexScheduler *m_scheduler = nullptr;
Database m_basicDatabase;
Database m_contentDatabase;
Database m_ocrContentDatabase;
uint m_basicIndexSize = 0;
uint m_contentIndexSize = 0;
uint m_ocrIndexSize = 0;
uint m_basicIndexProgress = 0;
uint m_contentIndexProgress = 0;
uint m_ocrIndexProgress = 0;
};
}
#endif // MONITOR_H