Fix potential problems.
This commit is contained in:
parent
3dc0eb4af2
commit
71e6c6896a
|
@ -35,8 +35,8 @@ FirstIndex::FirstIndex(const QString& path) : Traverse_BFS(path)
|
||||||
qDebug() << "contentIndexDataBaseStatus: " << contentIndexDataBaseStatus;
|
qDebug() << "contentIndexDataBaseStatus: " << contentIndexDataBaseStatus;
|
||||||
qDebug() << "inotifyIndexStatus: " << inotifyIndexStatus;
|
qDebug() << "inotifyIndexStatus: " << inotifyIndexStatus;
|
||||||
|
|
||||||
|
/* || contentIndexDataBaseStatus == ""*/
|
||||||
if (indexDataBaseStatus == "" || contentIndexDataBaseStatus == ""){
|
if (indexDataBaseStatus == ""){
|
||||||
this->bool_dataBaseExist = false;
|
this->bool_dataBaseExist = false;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -75,7 +75,7 @@ FirstIndex::~FirstIndex()
|
||||||
void FirstIndex::DoSomething(const QFileInfo& fileInfo){
|
void FirstIndex::DoSomething(const QFileInfo& fileInfo){
|
||||||
// qDebug() << "there are some shit here"<<fileInfo.fileName() << fileInfo.absoluteFilePath() << QString(fileInfo.isDir() ? "1" : "0");
|
// qDebug() << "there are some shit here"<<fileInfo.fileName() << fileInfo.absoluteFilePath() << QString(fileInfo.isDir() ? "1" : "0");
|
||||||
this->q_index->enqueue(QVector<QString>() << fileInfo.fileName() << fileInfo.absoluteFilePath() << QString((fileInfo.isDir() && (!fileInfo.isSymLink())) ? "1" : "0"));
|
this->q_index->enqueue(QVector<QString>() << fileInfo.fileName() << fileInfo.absoluteFilePath() << QString((fileInfo.isDir() && (!fileInfo.isSymLink())) ? "1" : "0"));
|
||||||
if ((!fileInfo.fileName().split(".").isEmpty()) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
|
if ((fileInfo.fileName().split(".", QString::SkipEmptyParts).length() > 1) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
|
||||||
this->q_content_index->enqueue(fileInfo.absoluteFilePath());
|
this->q_content_index->enqueue(fileInfo.absoluteFilePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,9 @@ private:
|
||||||
std::map<QString, bool>::value_type("doc", true),
|
std::map<QString, bool>::value_type("doc", true),
|
||||||
std::map<QString, bool>::value_type("docx", true),
|
std::map<QString, bool>::value_type("docx", true),
|
||||||
std::map<QString, bool>::value_type("ppt", true),
|
std::map<QString, bool>::value_type("ppt", true),
|
||||||
// std::map<QString, bool>::value_type(".pptx", true),
|
// std::map<QString, bool>::value_type("pptx", true),
|
||||||
std::map<QString, bool>::value_type("xls", true),
|
std::map<QString, bool>::value_type("xls", true),
|
||||||
// std::map<QString, bool>::value_type(".xlsx", true),
|
// std::map<QString, bool>::value_type("xlsx", true),
|
||||||
std::map<QString, bool>::value_type("txt", true),
|
std::map<QString, bool>::value_type("txt", true),
|
||||||
std::map<QString, bool>::value_type("dot", true),
|
std::map<QString, bool>::value_type("dot", true),
|
||||||
std::map<QString, bool>::value_type("wps", true),
|
std::map<QString, bool>::value_type("wps", true),
|
||||||
|
|
|
@ -93,7 +93,7 @@ void InotifyIndex::DoSomething(const QFileInfo& fileInfo){
|
||||||
QQueue<QVector<QString> > tempFile;
|
QQueue<QVector<QString> > tempFile;
|
||||||
tempFile.enqueue(QVector<QString>() << fileInfo.fileName() << fileInfo.absoluteFilePath() << QString((fileInfo.isDir() && (!fileInfo.isSymLink())) ? "1" : "0"));
|
tempFile.enqueue(QVector<QString>() << fileInfo.fileName() << fileInfo.absoluteFilePath() << QString((fileInfo.isDir() && (!fileInfo.isSymLink())) ? "1" : "0"));
|
||||||
IndexGenerator::getInstance()->creatAllIndex(&tempFile);
|
IndexGenerator::getInstance()->creatAllIndex(&tempFile);
|
||||||
if ((!fileInfo.fileName().split(".").isEmpty()) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
|
if ((fileInfo.fileName().split(".", QString::SkipEmptyParts).length() > 1) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
|
||||||
QQueue<QString> tmp;
|
QQueue<QString> tmp;
|
||||||
tmp.enqueue(fileInfo.absoluteFilePath());
|
tmp.enqueue(fileInfo.absoluteFilePath());
|
||||||
IndexGenerator::getInstance()->creatAllIndex(&tmp);
|
IndexGenerator::getInstance()->creatAllIndex(&tmp);
|
||||||
|
|
|
@ -65,9 +65,9 @@ private:
|
||||||
std::map<QString, bool>::value_type("doc", true),
|
std::map<QString, bool>::value_type("doc", true),
|
||||||
std::map<QString, bool>::value_type("docx", true),
|
std::map<QString, bool>::value_type("docx", true),
|
||||||
std::map<QString, bool>::value_type("ppt", true),
|
std::map<QString, bool>::value_type("ppt", true),
|
||||||
// std::map<QString, bool>::value_type(".pptx", true),
|
// std::map<QString, bool>::value_type("pptx", true),
|
||||||
std::map<QString, bool>::value_type("xls", true),
|
std::map<QString, bool>::value_type("xls", true),
|
||||||
// std::map<QString, bool>::value_type(".xlsx", true),
|
// std::map<QString, bool>::value_type("xlsx", true),
|
||||||
std::map<QString, bool>::value_type("txt", true),
|
std::map<QString, bool>::value_type("txt", true),
|
||||||
std::map<QString, bool>::value_type("dot", true),
|
std::map<QString, bool>::value_type("dot", true),
|
||||||
std::map<QString, bool>::value_type("wps", true),
|
std::map<QString, bool>::value_type("wps", true),
|
||||||
|
|
|
@ -30,6 +30,7 @@ void Traverse_BFS::Traverse(){
|
||||||
bfs.enqueue(this->path);
|
bfs.enqueue(this->path);
|
||||||
QFileInfoList list;
|
QFileInfoList list;
|
||||||
QDir dir;
|
QDir dir;
|
||||||
|
// QDir::Hidden
|
||||||
dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||||
dir.setSorting(QDir::DirsFirst);
|
dir.setSorting(QDir::DirsFirst);
|
||||||
while (!bfs.empty()) {
|
while (!bfs.empty()) {
|
||||||
|
|
Loading…
Reference in New Issue