diff --git a/index/index-generator.cpp b/index/index-generator.cpp index b5d2f20..000fc4e 100644 --- a/index/index-generator.cpp +++ b/index/index-generator.cpp @@ -103,7 +103,7 @@ void IndexGenerator::HandlePathList(QStringList *pathlist) auto info = new QFileInfo(list->at(i)); //提取文件名并用空格分割,同时去除'.' QString filename = info->fileName(); - QString index_test = filename.replace(".","").replace(""," "); + QString index_test = filename.replace(".","").replace("+", "%2B").replace(""," "); QString pinyin_test = chineseCharactersToPinyin::find(filename.replace(".", "")).replace("", " "); diff --git a/index/index.pri b/index/index.pri index e388cf2..175a493 100644 --- a/index/index.pri +++ b/index/index.pri @@ -4,12 +4,16 @@ HEADERS += \ $$PWD/chinesecharacterstopinyin.h \ $$PWD/index-generator.h \ $$PWD/inotify-manager.h \ \ - $$PWD/messagelist-manager.h + $$PWD/inotify.h \ + $$PWD/messagelist-manager.h \ + $$PWD/traverse_bfs.h SOURCES += \ $$PWD/chinesecharacterstopinyin.cpp \ $$PWD/index-generator.cpp \ $$PWD/inotify-manager.cpp \ + $$PWD/inotify.cpp \ $$PWD/messagelist-manager.cpp \ - $$PWD/test-Inotify-Manager.cpp + $$PWD/test-Inotify-Manager.cpp \ + $$PWD/traverse_bfs.cpp diff --git a/index/messagelist-manager.cpp b/index/messagelist-manager.cpp index 39e6eb8..979cd38 100644 --- a/index/messagelist-manager.cpp +++ b/index/messagelist-manager.cpp @@ -27,8 +27,8 @@ MessageListManager::~MessageListManager(){ this->indexGeneratorThread = nullptr; } -void MessageListManager::AddMessage(const QString& path){ - this->messageList->append(path); +void MessageListManager::AddMessage(const QVector& pathVec){ + this->messageList->append(pathVec); if (static_cast(this->messageList->length()) >= this->length){ this->SendMessage(); } diff --git a/index/messagelist-manager.h b/index/messagelist-manager.h index e078bf5..909e496 100644 --- a/index/messagelist-manager.h +++ b/index/messagelist-manager.h @@ -11,13 +11,15 @@ public: explicit MessageListManager(); ~MessageListManager(); - void AddMessage(const QString&); + void AddMessage(const QVector&); bool SendMessage(); bool SendDeleteMessage(); void SetAutoSendMessageLength(const size_t&); private: - QStringList* messageList; +// QStringList* messageList; + QList>* messageList; + size_t length = 0; IndexGenerator* ig; QThread* indexGeneratorThread; diff --git a/index/test-Inotify-Manager.cpp b/index/test-Inotify-Manager.cpp index a6e2a5d..6f7cbc5 100644 --- a/index/test-Inotify-Manager.cpp +++ b/index/test-Inotify-Manager.cpp @@ -3,6 +3,7 @@ #include "src/mainwindow.h" #include "inotify-manager.h" #include "chinesecharacterstopinyin.h" +#include "inotify.h" void testTraverse(void){ /*-------------Inotify Test Start---------------*/ @@ -18,13 +19,24 @@ void testTraverse(void){ /*-------------PinyinSearch Test Start---------------*/ QTime t1 = QTime::currentTime(); - QString test("gongzuo"); + QString test("test"); qDebug() << IndexGenerator::IndexSearch(test); QTime t2 = QTime::currentTime(); qDebug() << t1; qDebug() << t2; /*-------------PinyinSearch Test End-----------------*/ + /*-------------InotyifyRefact Test Start---------------*/ +// QTime t1 = QTime::currentTime(); +// InotifyManagerRefact* imr = new InotifyManagerRefact("/home"); +// imr->AddWatch("/home"); +// imr->setPath("/home"); +// imr->Traverse(); +// QTime t2 = QTime::currentTime(); +// qDebug() << t1; +// qDebug() << t2; + /*-------------InotyifyRefact Test End-----------------*/ + exit(0);