commit
74a8583b90
|
@ -1,3 +1,16 @@
|
|||
ukui-search (0.0.1+0114) v101; urgency=medium
|
||||
|
||||
* Bugs fixed.
|
||||
|
||||
-- zhangpengfei <zhangpengfei@zhangpengfei> Thu, 14 Jan 2021 20:47:42 +0800
|
||||
|
||||
ukui-search (0.0.1+0113) v101; urgency=medium
|
||||
|
||||
* Bugs fixed.
|
||||
* Functions perfected.
|
||||
|
||||
-- zhangpengfei <zhangpengfei@kylinos.cn> Wed, 13 Jan 2021 18:55:43 +0800
|
||||
|
||||
ukui-search (0.0.1+0104) v101; urgency=medium
|
||||
|
||||
* Initial release.
|
||||
|
|
|
@ -15,7 +15,8 @@ Build-Depends: debhelper (>=9.0.0),
|
|||
libglib2.0-dev,
|
||||
libkf5windowsystem-dev,
|
||||
libgsettings-qt-dev,
|
||||
libqt5x11extras5-dev
|
||||
libqt5x11extras5-dev,
|
||||
libuchardet-dev
|
||||
Standards-Version: 4.5.0
|
||||
Homepage: https://www.ukui.org/
|
||||
Vcs-Git: https://github.com/ukui/ukui-search.git
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <QMimeDatabase>
|
||||
#include <QMimeType>
|
||||
#include <QQueue>
|
||||
#include "uchardet/uchardet.h"
|
||||
size_t FileUtils::_max_index_count = 0;
|
||||
size_t FileUtils::_current_index_count = 0;
|
||||
unsigned short FileUtils::_index_status = INITIAL_STATE;
|
||||
|
@ -512,6 +513,22 @@ void FileUtils::getTxtContent(QString &path, QString &textcontent)
|
|||
QFile file(path);
|
||||
if(!file.open(QIODevice::ReadOnly|QIODevice::Text))
|
||||
return;
|
||||
textcontent = QString(file.readAll()).replace("\n","");
|
||||
|
||||
QByteArray encodedString = file.readAll();
|
||||
|
||||
uchardet_t chardet = uchardet_new();
|
||||
if(uchardet_handle_data(chardet,encodedString.constData(),encodedString.size()) !=0)
|
||||
qWarning()<<"Txt file encoding format detect fail!"<<path;
|
||||
|
||||
uchardet_data_end(chardet);
|
||||
const char *codec = uchardet_get_charset(chardet);
|
||||
|
||||
if(QTextCodec::codecForName(codec) == 0)
|
||||
qWarning()<<"Unsupported Text encoding format"<<path;
|
||||
|
||||
QTextStream stream(encodedString,QIODevice::ReadOnly);
|
||||
stream.setCodec(codec);
|
||||
|
||||
textcontent = stream.readAll().replace("\n","");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ include(appsearch/appsearch.pri)
|
|||
include(settingsearch/settingsearch.pri))
|
||||
|
||||
LIBS += -L$$OUT_PWD/../libchinese-segmentation/ -lchinese-segmentation
|
||||
LIBS += -lxapian -lquazip5
|
||||
LIBS += -lxapian -lquazip5 -luchardet
|
||||
|
||||
SOURCES += \
|
||||
file-utils.cpp \
|
||||
|
|
Loading…
Reference in New Issue