forked from openkylin/ukui-search
delete unuseful files and add the number first index files and folders
This commit is contained in:
parent
276f520888
commit
38cac0bc3b
|
@ -1,44 +0,0 @@
|
|||
#include <QDebug>
|
||||
#include "filetypefilter.h"
|
||||
#include "index-generator.h"
|
||||
|
||||
FileTypeFilter::FileTypeFilter(const QString& path) : Traverse_BFS(path)
|
||||
{
|
||||
this->result = new QList<QString>();
|
||||
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<QString>* FileTypeFilter::getTargetFileAbsolutePath(){
|
||||
return this->result;
|
||||
}
|
||||
|
||||
|
||||
void FileTypeFilter::Test(){
|
||||
IndexGenerator* ig = IndexGenerator::getInstance();
|
||||
// this->result = new QList<QString>();
|
||||
// this->result->append(QString("/home/zpf/桌面/DOCX 文档(1).docx"));
|
||||
|
||||
// ig->creatAllIndex(this->result);
|
||||
}
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
//aborted --MouseZhangZh
|
||||
#ifndef FILETYPEFILTER_H
|
||||
#define FILETYPEFILTER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMimeDatabase>
|
||||
#include <QMimeType>
|
||||
#include <QList>
|
||||
#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<QString>* getTargetFileAbsolutePath();
|
||||
void Test();
|
||||
void startIndexText();
|
||||
Q_SIGNALS:
|
||||
private:
|
||||
const QVector<QString> targetFileTypeVec ={
|
||||
// QString(".doc"),
|
||||
QString(".docx"),
|
||||
// QString(".ppt"),
|
||||
// QString(".pptx"),
|
||||
// QString(".xls"),
|
||||
// QString(".xlsx"),
|
||||
QString(".txt")};
|
||||
QList<QString>* result;
|
||||
|
||||
};
|
||||
|
||||
#endif // FILETYPEFILTER_H
|
|
@ -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([&](){
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -1,10 +1 @@
|
|||
#include "libsearch.h"
|
||||
|
||||
GlobalSearch::GlobalSearch()
|
||||
{
|
||||
}
|
||||
|
||||
QStringList GlobalSearch::fileSearch(QString keyword, int begin, int num)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue