diff --git a/libsearch/index/filetypefilter.cpp b/libsearch/index/filetypefilter.cpp deleted file mode 100644 index 7af45c2..0000000 --- a/libsearch/index/filetypefilter.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include "filetypefilter.h" -#include "index-generator.h" - -FileTypeFilter::FileTypeFilter(const QString& path) : Traverse_BFS(path) -{ - this->result = new QList(); - this->Traverse(); -} - -FileTypeFilter::~FileTypeFilter() -{ - delete this->result; - this->result = nullptr; -} - -void FileTypeFilter::DoSomething(const QFileInfo& fileInfo){ -// QMimeDatabase qmd; -// QMimeType qmt; -// qmt = qmd.mimeTypeForFile(fileInfo.fileName()); -// qDebug() << qmt.preferredSuffix(); - for (auto i : this->targetFileTypeVec){ - if (fileInfo.fileName().endsWith(i)){ - qDebug() << fileInfo.fileName(); - this->result->append(fileInfo.absoluteFilePath()); - } - } - -} - -QList* FileTypeFilter::getTargetFileAbsolutePath(){ - return this->result; -} - - -void FileTypeFilter::Test(){ - IndexGenerator* ig = IndexGenerator::getInstance(); -// this->result = new QList(); -// this->result->append(QString("/home/zpf/桌面/DOCX 文档(1).docx")); - -// ig->creatAllIndex(this->result); -} - - diff --git a/libsearch/index/filetypefilter.h b/libsearch/index/filetypefilter.h deleted file mode 100644 index bbae487..0000000 --- a/libsearch/index/filetypefilter.h +++ /dev/null @@ -1,35 +0,0 @@ -//aborted --MouseZhangZh -#ifndef FILETYPEFILTER_H -#define FILETYPEFILTER_H - -#include -#include -#include -#include -#include "traverse_bfs.h" - -class FileTypeFilter : public QObject, public Traverse_BFS -{ - Q_OBJECT -public: - explicit FileTypeFilter(const QString&); - ~FileTypeFilter(); - virtual void DoSomething(const QFileInfo&) final; - QList* getTargetFileAbsolutePath(); - void Test(); - void startIndexText(); -Q_SIGNALS: -private: - const QVector targetFileTypeVec ={ -// QString(".doc"), - QString(".docx"), -// QString(".ppt"), -// QString(".pptx"), -// QString(".xls"), -// QString(".xlsx"), - QString(".txt")}; - QList* result; - -}; - -#endif // FILETYPEFILTER_H diff --git a/libsearch/index/first-index.cpp b/libsearch/index/first-index.cpp index dc8ddac..482f217 100644 --- a/libsearch/index/first-index.cpp +++ b/libsearch/index/first-index.cpp @@ -105,6 +105,7 @@ void FirstIndex::run(){ sem.acquire(1); mutex1.unlock(); this->Traverse(); + FileUtils::_max_index_count = this->q_index->length(); sem.release(5); }); QtConcurrent::run([&](){ diff --git a/libsearch/index/first-index.h b/libsearch/index/first-index.h index 5bd989b..914fa85 100644 --- a/libsearch/index/first-index.h +++ b/libsearch/index/first-index.h @@ -9,6 +9,7 @@ #include "global-settings.h" #include "index-generator.h" #include "inotify-index.h" +#include "file-utils.h" class FirstIndex : public QThread, public Traverse_BFS { diff --git a/libsearch/index/index.pri b/libsearch/index/index.pri index a8345be..a94cb98 100644 --- a/libsearch/index/index.pri +++ b/libsearch/index/index.pri @@ -2,7 +2,6 @@ INCLUDEPATH += $$PWD HEADERS += \ $$PWD/document.h \ - $$PWD/filetypefilter.h \ $$PWD/file-reader.h \ $$PWD/first-index.h \ $$PWD/index-generator.h \ @@ -13,7 +12,6 @@ HEADERS += \ SOURCES += \ $$PWD/document.cpp \ - $$PWD/filetypefilter.cpp \ $$PWD/file-reader.cpp \ $$PWD/first-index.cpp \ $$PWD/index-generator.cpp \ diff --git a/libsearch/libsearch.cpp b/libsearch/libsearch.cpp index 91c0b3d..eeeb353 100644 --- a/libsearch/libsearch.cpp +++ b/libsearch/libsearch.cpp @@ -1,10 +1 @@ #include "libsearch.h" - -GlobalSearch::GlobalSearch() -{ -} - -QStringList GlobalSearch::fileSearch(QString keyword, int begin, int num) -{ - -} diff --git a/libsearch/libsearch.h b/libsearch/libsearch.h index a01098e..49c874a 100644 --- a/libsearch/libsearch.h +++ b/libsearch/libsearch.h @@ -9,8 +9,6 @@ #include "global-settings.h" #include "index/first-index.h" -#include "index/filetypefilter.h" - #include "index/ukui-search-qdbus.h" #include "index/inotify-index.h"