2024-01-31 15:22:21 +08:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2023, 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>
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2022-03-17 15:40:55 +08:00
|
|
|
|
|
2021-06-10 20:43:57 +08:00
|
|
|
|
#include <QMap>
|
2021-09-23 15:51:09 +08:00
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QDir>
|
2022-10-26 18:01:40 +08:00
|
|
|
|
namespace UkuiSearch {
|
2022-03-17 15:40:55 +08:00
|
|
|
|
|
2022-04-25 11:16:25 +08:00
|
|
|
|
#define CONTENT_DATABASE_PATH_SLOT 1
|
|
|
|
|
#define CONTENT_DATABASE_SUFFIX_SLOT 2
|
|
|
|
|
|
2024-01-26 14:31:56 +08:00
|
|
|
|
static const int LABEL_MAX_WIDTH = 320;
|
2022-03-17 15:40:55 +08:00
|
|
|
|
|
|
|
|
|
static const QString HOME_PATH = QDir::homePath();
|
|
|
|
|
static const QString INDEX_PATH = HOME_PATH + QStringLiteral("/.config/org.ukui/ukui-search/index_data");
|
|
|
|
|
static const QString CONTENT_INDEX_PATH = HOME_PATH + QStringLiteral("/.config/org.ukui/ukui-search/content_index_data");
|
|
|
|
|
static const QString FILE_SEARCH_VALUE = QStringLiteral("0");
|
|
|
|
|
static const QString DIR_SEARCH_VALUE = QStringLiteral("1");
|
|
|
|
|
static const QString INDEX_SEM = QStringLiteral("ukui-search-index-sem");
|
2022-04-13 13:46:30 +08:00
|
|
|
|
static const int OCR_MIN_SIZE = 200;
|
2022-04-14 11:16:26 +08:00
|
|
|
|
static const QByteArray UKUI_SEARCH_SCHEMAS = QByteArrayLiteral("org.ukui.search.settings");
|
|
|
|
|
static const QString SEARCH_METHOD_KEY = QStringLiteral("fileIndexEnable");
|
2024-01-26 14:31:56 +08:00
|
|
|
|
/**
|
|
|
|
|
* changelog 1.0.1 修复部分中文字符在term中被截断的问题
|
|
|
|
|
*/
|
|
|
|
|
static const QString INDEX_DATABASE_VERSION = QStringLiteral("1.0.1");
|
|
|
|
|
/**
|
|
|
|
|
* changelog 1.1.0 增加文件修改时间value
|
|
|
|
|
*/
|
|
|
|
|
static const QString CONTENT_DATABASE_VERSION = QStringLiteral("1.1.0");
|
2022-12-02 13:48:59 +08:00
|
|
|
|
|
|
|
|
|
|
2022-03-17 15:40:55 +08:00
|
|
|
|
|
2021-09-23 15:51:09 +08:00
|
|
|
|
static const QStringList allAppPath = {
|
2022-03-17 15:40:55 +08:00
|
|
|
|
{HOME_PATH + "/.local/share/applications/"},
|
|
|
|
|
{"/usr/share/applications/"}
|
2021-09-23 15:51:09 +08:00
|
|
|
|
};
|
2022-03-17 15:40:55 +08:00
|
|
|
|
|
2021-06-10 20:43:57 +08:00
|
|
|
|
static const QMap<QString, bool> targetFileTypeMap = {
|
2022-03-17 15:40:55 +08:00
|
|
|
|
{"doc", true},
|
|
|
|
|
{"docx", true},
|
|
|
|
|
{"ppt", true},
|
|
|
|
|
{"pptx", true},
|
|
|
|
|
{"xls", true},
|
|
|
|
|
{"xlsx", true},
|
|
|
|
|
{"txt", true},
|
|
|
|
|
{"dot", true},
|
|
|
|
|
{"wps", true},
|
|
|
|
|
{"pps", true},
|
|
|
|
|
{"dps", true},
|
|
|
|
|
{"et", true},
|
2022-04-26 10:25:23 +08:00
|
|
|
|
{"pdf", true},
|
2022-05-27 16:07:09 +08:00
|
|
|
|
{"html", true},
|
|
|
|
|
{"uof", true},
|
|
|
|
|
{"uot", true},
|
|
|
|
|
{"uos", true},
|
2022-05-11 09:08:23 +08:00
|
|
|
|
{"uop", true},
|
2022-05-27 16:07:09 +08:00
|
|
|
|
{"ofd", true}
|
2021-06-10 20:43:57 +08:00
|
|
|
|
};
|
2022-01-21 16:53:19 +08:00
|
|
|
|
|
|
|
|
|
static const QMap<QString, bool> targetPhotographTypeMap = {
|
2022-03-17 15:40:55 +08:00
|
|
|
|
{"png", true},
|
2022-04-13 13:46:30 +08:00
|
|
|
|
{"bmp", true},
|
|
|
|
|
{"hdr", false},
|
|
|
|
|
{"gif", true},
|
|
|
|
|
{"tif", true},
|
|
|
|
|
{"tiff", true},
|
|
|
|
|
{"heif", false},
|
|
|
|
|
{"webp", true},
|
|
|
|
|
{"jpe", true},
|
|
|
|
|
{"dib", false},
|
|
|
|
|
{"psd", false},
|
|
|
|
|
{"jng", false},
|
|
|
|
|
{"xpm", false},//pix read error.
|
|
|
|
|
{"j2k", false},
|
|
|
|
|
{"jp2", false},
|
2022-03-17 15:40:55 +08:00
|
|
|
|
{"jpg", true},
|
|
|
|
|
{"jpeg", true} // TODO 待完善,后续改为配置文件
|
2022-01-21 16:53:19 +08:00
|
|
|
|
};
|
2021-05-13 11:17:07 +08:00
|
|
|
|
//TODO Put things that needed to be put here here.
|
2022-10-26 18:01:40 +08:00
|
|
|
|
/**
|
|
|
|
|
* @brief The DataBaseType enum
|
|
|
|
|
* Basic 基础数据库
|
|
|
|
|
* Content 文本内容数据库
|
|
|
|
|
*/
|
|
|
|
|
enum class DataBaseType {
|
|
|
|
|
Basic = 0,
|
|
|
|
|
Content = 1
|
|
|
|
|
};
|
2022-03-17 15:40:55 +08:00
|
|
|
|
|
2022-10-26 18:01:40 +08:00
|
|
|
|
/**
|
|
|
|
|
* @brief The IndexType enum
|
|
|
|
|
* Index type, notice:OCR index is part of Content index.
|
|
|
|
|
*/
|
|
|
|
|
enum class IndexType {
|
|
|
|
|
Basic,
|
|
|
|
|
Contents,
|
|
|
|
|
OCR
|
|
|
|
|
};
|
|
|
|
|
}
|