[FIX] 🐛🐛🐛 Rest message won't be sent for index generation.
This commit is contained in:
parent
8cc3bf4448
commit
f9963f178e
|
@ -8,12 +8,12 @@ Document::Document()
|
|||
|
||||
Document::~Document()
|
||||
{
|
||||
if(m_document)
|
||||
delete m_document;
|
||||
if(m_index_text)
|
||||
delete m_index_text;
|
||||
if(m_unique_term)
|
||||
delete m_unique_term;
|
||||
// if(m_document)
|
||||
// delete m_document;
|
||||
// if(m_index_text)
|
||||
// delete m_index_text;
|
||||
// if(m_unique_term)
|
||||
// delete m_unique_term;
|
||||
}
|
||||
|
||||
void Document::setData(QString data)
|
||||
|
|
|
@ -23,6 +23,11 @@ InotifyManagerRefact::InotifyManagerRefact(const QString& path) : Traverse_BFS(p
|
|||
num2string.insert(IN_Q_OVERFLOW, "IN_Q_OVERFLOW");
|
||||
num2string.insert(IN_IGNORED, "IN_IGNORED");
|
||||
this->mlm = new MessageListManager();
|
||||
|
||||
this->AddWatch("/home");
|
||||
this->Traverse();
|
||||
this->SendRestMessage();
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -42,7 +47,12 @@ void InotifyManagerRefact::DoSomething(const QFileInfo& fileInfo){
|
|||
}
|
||||
// else{
|
||||
// this->mlm->AddMessage(QVector<QString>() << fileInfo.fileName() << fileInfo.absoluteFilePath() << QString(bool((fileInfo.isDir()))));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
void InotifyManagerRefact::SendRestMessage()
|
||||
{
|
||||
this->mlm->SendMessage();
|
||||
}
|
||||
|
||||
bool InotifyManagerRefact::AddWatch(const QString &path){
|
||||
|
@ -142,9 +152,9 @@ void InotifyManagerRefact::run(){
|
|||
}
|
||||
// else {
|
||||
//这里调用删除索引
|
||||
this->mlm->AddMessage(QVector<QString>() << event->name << (currentPath[event->wd] + '/' + event->name) << QString(bool((event->mask & IN_ISDIR))));
|
||||
this->mlm->SendDeleteMessage();
|
||||
// IndexGenerator::getInstance()->deleteAllIndex(new QStringList(currentPath[event->wd] + '/' + event->name));
|
||||
// this->mlm->AddMessage(QVector<QString>() << event->name << (currentPath[event->wd] + '/' + event->name) << QString(bool((event->mask & IN_ISDIR))));
|
||||
// this->mlm->SendDeleteMessage();
|
||||
IndexGenerator::getInstance()->deleteAllIndex(new QStringList(currentPath[event->wd] + '/' + event->name));
|
||||
// }
|
||||
}
|
||||
/*--------------------------------*/
|
||||
|
|
|
@ -19,6 +19,7 @@ public:
|
|||
bool AddWatch(const QString&);
|
||||
bool RemoveWatch(const QString&);
|
||||
virtual void DoSomething(const QFileInfo &) final;
|
||||
void SendRestMessage();
|
||||
Q_SIGNALS:
|
||||
protected:
|
||||
void run() override;
|
||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -45,16 +45,6 @@ void centerToScreen(QWidget* widget) {
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
/*-------------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-----------------*/
|
||||
qRegisterMetaType<QVector<QStringList>>("QVector<QStringList>");
|
||||
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
|
|
|
@ -46,8 +46,15 @@ extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int tran
|
|||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent)
|
||||
{
|
||||
//testBackServe
|
||||
//testTraverse();
|
||||
|
||||
/*-------------InotyifyRefact Test Start---------------*/
|
||||
QTime t1 = QTime::currentTime();
|
||||
InotifyManagerRefact* imr = new InotifyManagerRefact("/home");
|
||||
imr->start();
|
||||
QTime t2 = QTime::currentTime();
|
||||
qDebug() << t1;
|
||||
qDebug() << t2;
|
||||
/*-------------InotyifyRefact Test End-----------------*/
|
||||
|
||||
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
|
|
Loading…
Reference in New Issue