/* * Copyright (C) 2020, 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 . * * Authors: zhangpengfei * Modified by: zhangzihao * Modified by: zhangjiaping * */ #ifndef FILEUTILS_H #define FILEUTILS_H #include "gobject-template.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include "libsearch_global.h" //#define INITIAL_STATE 0 //#define CREATING_INDEX 1 //#define FINISH_CREATING_INDEX 2 #define MAX_CONTENT_LENGTH 20480000 #define UKUI_SEARCH_PIPE_PATH (QDir::homePath()+"/.config/org.ukui/ukui-search/ukuisearch").toLocal8Bit().constData() class LIBSEARCH_EXPORT FileUtils { public: static std::string makeDocUterm(QString ); static QIcon getFileIcon(const QString &, bool checkValid = true); static QIcon getAppIcon(const QString &); static QIcon getSettingIcon(const QString &, const bool&); static QString getFileName(const QString &); static QString getAppName(const QString &); static QString getSettingName(const QString &); //chinese character to pinyin static QMap map_chinese2pinyin; static QString find(const QString&); static QStringList findMultiToneWords(const QString&); static void loadHanziTable(const QString&); //parse text,docx..... static QMimeType getMimetype(QString &path); static void getDocxTextContent(QString &path, QString &textcontent); static void getPptxTextContent(QString &path, QString &textcontent); static void getXlsxTextContent(QString &path, QString &textcontent); static void getTxtContent(QString &path, QString &textcontent); static size_t _max_index_count; static size_t _current_index_count; //this one has been Abandoned,do not use it. static unsigned short _index_status; private: FileUtils(); }; #endif // FILEUTILS_H