2020-12-21 18:50:54 +08:00
|
|
|
#ifndef FILEUTILS_H
|
|
|
|
#define FILEUTILS_H
|
2020-12-24 11:06:19 +08:00
|
|
|
#include "gobject-template.h"
|
2021-01-22 09:49:44 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
2020-12-21 18:50:54 +08:00
|
|
|
#include <QString>
|
|
|
|
#include <QCryptographicHash>
|
2020-12-24 11:06:19 +08:00
|
|
|
#include <QIcon>
|
2020-12-26 12:45:28 +08:00
|
|
|
#include <QMap>
|
2020-12-30 14:42:04 +08:00
|
|
|
#include "libsearch_global.h"
|
2021-01-22 17:15:43 +08:00
|
|
|
//#define INITIAL_STATE 0
|
|
|
|
//#define CREATING_INDEX 1
|
|
|
|
//#define FINISH_CREATING_INDEX 2
|
2020-12-26 12:45:28 +08:00
|
|
|
|
2021-01-22 09:49:44 +08:00
|
|
|
#define UKUI_SEARCH_PIPE_PATH "/tmp/ukuisearch"
|
|
|
|
|
2021-01-21 13:50:21 +08:00
|
|
|
|
2020-12-30 14:42:04 +08:00
|
|
|
class LIBSEARCH_EXPORT FileUtils
|
2020-12-21 18:50:54 +08:00
|
|
|
{
|
|
|
|
public:
|
2020-12-26 08:56:38 +08:00
|
|
|
static std::string makeDocUterm(QString );
|
2020-12-24 11:06:19 +08:00
|
|
|
static QIcon getFileIcon(const QString &, bool checkValid = true);
|
|
|
|
static QIcon getAppIcon(const QString &);
|
2020-12-25 19:16:44 +08:00
|
|
|
static QIcon getSettingIcon(const QString &, const bool&);
|
2020-12-24 11:06:19 +08:00
|
|
|
|
|
|
|
static QString getFileName(const QString &);
|
|
|
|
static QString getAppName(const QString &);
|
|
|
|
static QString getSettingName(const QString &);
|
2020-12-26 12:45:28 +08:00
|
|
|
|
|
|
|
//chinese character to pinyin
|
2020-12-29 20:18:36 +08:00
|
|
|
static QMap<QString, QStringList> map_chinese2pinyin;
|
2020-12-26 12:45:28 +08:00
|
|
|
static QString find(const QString&);
|
2020-12-29 16:41:30 +08:00
|
|
|
static QStringList findMultiToneWords(const QString&);
|
2020-12-26 12:45:28 +08:00
|
|
|
static void loadHanziTable(const QString&);
|
|
|
|
|
2020-12-29 20:18:36 +08:00
|
|
|
//parse text,docx.....
|
|
|
|
static QString getMimetype(QString &path, bool getsuffix = false);
|
2021-01-12 16:07:50 +08:00
|
|
|
static void getDocxTextContent(QString &path, QString &textcontent);
|
|
|
|
static void getTxtContent(QString &path, QString &textcontent);
|
2021-01-10 09:23:02 +08:00
|
|
|
static size_t _max_index_count;
|
2021-01-15 09:14:25 +08:00
|
|
|
static size_t _current_index_count; //this one has been Abandoned,do not use it.
|
2021-01-13 18:35:48 +08:00
|
|
|
static unsigned short _index_status;
|
2020-12-29 20:18:36 +08:00
|
|
|
|
2020-12-21 18:50:54 +08:00
|
|
|
private:
|
|
|
|
FileUtils();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FILEUTILS_H
|