ukui-search/libsearch/index/file-indexer-config.h

94 lines
2.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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 FILEINDEXERCONFIG_H
#define FILEINDEXERCONFIG_H
#include <QObject>
#include <QSettings>
#include <QGSettings>
#include <QAtomicInt>
#include "dir-watcher.h"
class FileIndexerConfig : public QObject
{
Q_OBJECT
public:
static FileIndexerConfig* getInstance();
/**
* @brief currentIndexableDir
* @return 当前可索引的所有目录
*/
QStringList currentIndexableDir();
/**
* @brief currentBlackListOfIndex
* @return 当前索引黑名单
*/
QStringList currentBlackListOfIndex();
/**
* @brief isFileIndexEnable
* @return 是否启动基本索引(只索引文件基本数据,包含路径等内容)
*/
bool isFileIndexEnable();
/**
* @brief isContentIndexEnable
* @return 是否启动文本内容索引
*/
bool isContentIndexEnable();
/**
* @brief isOCREnable
* @return 是否激活OCR功能文件内容索引
*/
bool isOCREnable();
/**
* @brief isMetaDataIndexEnable
* @return 是否激活元数据索引
*/
bool isMetaDataIndexEnable();
Q_SIGNALS:
/**
* @brief appendIndexDir
* 索引目录增加时发送,参数为增加的目录和其下的黑名单
*/
void appendIndexDir(const QString&, const QStringList&);
/**
* @brief removeIndexDir
* 移除索引目录时发送
*/
void removeIndexDir(const QString&);
/**
* @brief fileIndexEnableStatusChanged
* 文件索引开关(基本索引)
*/
void fileIndexEnableStatusChanged(bool);
private:
explicit FileIndexerConfig(QObject *parent = nullptr);
~FileIndexerConfig();
DirWatcher *m_dirWatcher = nullptr;
QGSettings *m_gsettings = nullptr;
QSettings *m_settings = nullptr;
QAtomicInt m_stop;
};
#endif // FILEINDEXERCONFIG_H