forked from openkylin/ukui-search
change message list data struct
This commit is contained in:
parent
f06e9e3614
commit
0a48b42a84
|
@ -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("", " ");
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ MessageListManager::~MessageListManager(){
|
|||
this->indexGeneratorThread = nullptr;
|
||||
}
|
||||
|
||||
void MessageListManager::AddMessage(const QString& path){
|
||||
this->messageList->append(path);
|
||||
void MessageListManager::AddMessage(const QVector<QString>& pathVec){
|
||||
this->messageList->append(pathVec);
|
||||
if (static_cast<size_t>(this->messageList->length()) >= this->length){
|
||||
this->SendMessage();
|
||||
}
|
||||
|
|
|
@ -11,13 +11,15 @@ public:
|
|||
explicit MessageListManager();
|
||||
~MessageListManager();
|
||||
|
||||
void AddMessage(const QString&);
|
||||
void AddMessage(const QVector<QString>&);
|
||||
bool SendMessage();
|
||||
bool SendDeleteMessage();
|
||||
void SetAutoSendMessageLength(const size_t&);
|
||||
|
||||
private:
|
||||
QStringList* messageList;
|
||||
// QStringList* messageList;
|
||||
QList<QVector<QString>>* messageList;
|
||||
|
||||
size_t length = 0;
|
||||
IndexGenerator* ig;
|
||||
QThread* indexGeneratorThread;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue