2020-12-30 15:31:36 +08:00
|
|
|
#include "file-reader.h"
|
|
|
|
#include "file-utils.h"
|
|
|
|
|
|
|
|
FileReader::FileReader(QObject *parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-01-12 16:07:50 +08:00
|
|
|
void FileReader::getTextContent(QString path, QString &textContent)
|
2020-12-30 15:31:36 +08:00
|
|
|
{
|
|
|
|
//获取所有文件内容
|
|
|
|
//先分类
|
2020-12-31 21:14:13 +08:00
|
|
|
QString type =FileUtils::getMimetype(path,true);
|
2020-12-30 15:31:36 +08:00
|
|
|
if(type == "application/zip")
|
2021-01-12 16:07:50 +08:00
|
|
|
FileUtils::getDocxTextContent(path,textContent);
|
2020-12-30 15:31:36 +08:00
|
|
|
else if(type == "text/plain")
|
2021-01-12 16:07:50 +08:00
|
|
|
FileUtils::getTxtContent(path,textContent);
|
2020-12-30 15:31:36 +08:00
|
|
|
|
2021-01-12 16:07:50 +08:00
|
|
|
return;
|
2020-12-30 15:31:36 +08:00
|
|
|
}
|