2020-12-30 15:31:36 +08:00
|
|
|
#include "file-reader.h"
|
|
|
|
#include "file-utils.h"
|
|
|
|
|
|
|
|
FileReader::FileReader(QObject *parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QString *FileReader::getTextContent(QString path)
|
|
|
|
{
|
|
|
|
//获取所有文件内容
|
|
|
|
//先分类
|
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")
|
|
|
|
return FileUtils::getDocxTextContent(path);
|
|
|
|
else if(type == "text/plain")
|
|
|
|
return FileUtils::getTxtContent(path);
|
|
|
|
|
|
|
|
return new QString();
|
|
|
|
}
|