2021-05-13 11:17:07 +08:00
|
|
|
|
#ifndef INDEXSTATUSRECORDER_H
|
|
|
|
|
#define INDEXSTATUSRECORDER_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
#include <QDir>
|
2021-06-10 20:43:57 +08:00
|
|
|
|
#include <QMutex>
|
2021-05-13 11:17:07 +08:00
|
|
|
|
#define CONTENT_INDEX_DATABASE_STATE "content_index_database_state"
|
|
|
|
|
#define INDEX_DATABASE_STATE "index_database_state"
|
2022-03-17 15:40:55 +08:00
|
|
|
|
#define OCR_DATABASE_STATE "ocr_database_state"
|
|
|
|
|
#define INOTIFY_NORMAL_EXIT "inotify_normal_exit" // 1 - 出错;2 - 正常;3-关闭索引; 0-有信号正在处理
|
2021-06-10 20:43:57 +08:00
|
|
|
|
#define PENDING_FILE_QUEUE_FINISH "pending_file_queue_finish"
|
2021-05-13 11:17:07 +08:00
|
|
|
|
#define INDEX_STATUS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-index-status.conf"
|
2021-12-14 14:43:35 +08:00
|
|
|
|
namespace UkuiSearch {
|
2021-05-13 11:17:07 +08:00
|
|
|
|
//fixme: we need a better way to record index status.
|
|
|
|
|
class IndexStatusRecorder : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
static IndexStatusRecorder *getInstance();
|
|
|
|
|
void setStatus(const QString& key, const QVariant& value);
|
|
|
|
|
const QVariant getStatus(const QString& key);
|
2022-03-17 15:40:55 +08:00
|
|
|
|
bool indexDatabaseEnable();
|
|
|
|
|
bool contentIndexDatabaseEnable();
|
|
|
|
|
bool ocrDatabaseEnable();
|
2021-05-13 11:17:07 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
explicit IndexStatusRecorder(QObject *parent = nullptr);
|
2022-03-17 15:40:55 +08:00
|
|
|
|
static IndexStatusRecorder *m_instance;
|
2021-05-13 11:17:07 +08:00
|
|
|
|
QSettings *m_status;
|
2021-06-10 20:43:57 +08:00
|
|
|
|
QMutex m_mutex;
|
2021-05-13 11:17:07 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // INDEXSTATUSRECORDER_H
|