forked from openkylin/ukui-search
Merge branch '1213-ukss' into 'ukss-dev'
Add search interface frame. See merge request kylin-desktop/ukui-search!234
This commit is contained in:
commit
74e5c6ab84
|
@ -32,6 +32,7 @@ include(appsearch/appsearch.pri)
|
|||
include(notesearch/notesearch.pri)
|
||||
include(settingsearch/settingsearch.pri)
|
||||
include(websearch/websearch.pri)
|
||||
include(searchinterface/search-interface.pri)
|
||||
|
||||
LIBS += -L$$OUT_PWD/../libchinese-segmentation/ -lchinese-segmentation
|
||||
LIBS += -lxapian -lquazip5 -luchardet -lQt5Xdg#-L/usr/local/lib/libjemalloc -ljemalloc
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef COMMONDEFINES_H
|
||||
#define COMMONDEFINES_H
|
||||
namespace UkuiSearch {
|
||||
enum class SearchType
|
||||
{
|
||||
File,
|
||||
FileContent,
|
||||
Application,
|
||||
Setting,
|
||||
Note,
|
||||
Mail,
|
||||
Custom
|
||||
};
|
||||
}
|
||||
#endif // COMMONDEFINES_H
|
|
@ -10,7 +10,8 @@ public:
|
|||
{
|
||||
MenuPlugin,
|
||||
PreviewPagePlugin,
|
||||
SearchPlugin,
|
||||
SearchPlugin, // for ukui-search itself.
|
||||
SearchTaskPlugin, // for search service.
|
||||
Other
|
||||
};
|
||||
|
||||
|
|
|
@ -2,9 +2,11 @@ INCLUDEPATH += $$PWD \
|
|||
|
||||
HEADERS += \
|
||||
$$PWD/action-label.h \
|
||||
$$PWD/common-defines.h \
|
||||
$$PWD/plugin-iface.h \
|
||||
$$PWD/search-plugin-iface.h \
|
||||
$$PWD/data-queue.h
|
||||
$$PWD/data-queue.h \
|
||||
$$PWD/search-task-plugin-iface.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/action-label.cpp
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef SEARCHTASKPLUGINIFACE_H
|
||||
#define SEARCHTASKPLUGINIFACE_H
|
||||
#define SearchTaskPLuginIface_iid "org.ukui.ukui-search.plugin-iface.SearchTaskPLuginIface"
|
||||
|
||||
#include <QObject>
|
||||
#include <QtPlugin>
|
||||
#include "plugin-iface.h"
|
||||
#include "search-controller.h"
|
||||
#include "common-defines.h"
|
||||
|
||||
namespace UkuiSearch {
|
||||
class SearchTaskPLuginIface : public QObject, public PluginInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
virtual QString getSearchType() = 0;
|
||||
//Asynchronous,multithread.
|
||||
virtual void startSearch(SearchController searchController) = 0;
|
||||
virtual void stop() = 0;
|
||||
Q_SIGNALS:
|
||||
void searchFinished(size_t searchId);
|
||||
};
|
||||
}
|
||||
Q_DECLARE_INTERFACE(UkuiSearch::SearchTaskPLuginIface, SearchTaskPLuginIface_iid)
|
||||
|
||||
|
||||
|
||||
#endif // SEARCHTASKPLUGINIFACE_H
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef RESULTITEMPRIVATE_H
|
||||
#define RESULTITEMPRIVATE_H
|
||||
#include "result-item.h"
|
||||
#include "result-item-private.h"
|
||||
namespace UkuiSearch {
|
||||
class ResultItemPrivate
|
||||
{
|
||||
public:
|
||||
explicit ResultItemPrivate(const QString &itemKey, ResultItem *parent);
|
||||
~ResultItemPrivate();
|
||||
private:
|
||||
size_t searchId;
|
||||
QString m_itemKey;
|
||||
QString m_label;
|
||||
QVariant m_extral;
|
||||
//and something else...
|
||||
|
||||
ResultItem *q;
|
||||
|
||||
};
|
||||
}
|
||||
#endif // RESULTITEMPRIVATE_H
|
|
@ -0,0 +1,11 @@
|
|||
#include "result-item.h"
|
||||
#include "result-item-private.h"
|
||||
using namespace UkuiSearch;
|
||||
ResultItem::ResultItem(const QString &itemKey)
|
||||
{
|
||||
d = new ResultItemPrivate(itemKey, this);
|
||||
}
|
||||
|
||||
ResultItem::~ResultItem()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef RESULTITEM_H
|
||||
#define RESULTITEM_H
|
||||
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
namespace UkuiSearch {
|
||||
class ResultItemPrivate;
|
||||
class ResultItem
|
||||
{
|
||||
public:
|
||||
explicit ResultItem(const QString &itemKey);
|
||||
~ResultItem();
|
||||
private:
|
||||
ResultItemPrivate *d;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // RESULTITEM_H
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef SEARCHCONTROLLERPRIVATE_H
|
||||
#define SEARCHCONTROLLERPRIVATE_H
|
||||
|
||||
#include <QMutex>
|
||||
#include <QSharedPointer>
|
||||
#include "search-controller.h"
|
||||
namespace UkuiSearch {
|
||||
|
||||
class SearchControllerPrivate
|
||||
{
|
||||
public:
|
||||
explicit SearchControllerPrivate(SearchController *parent);
|
||||
~SearchControllerPrivate();
|
||||
size_t refreshSearchId();
|
||||
DataQueue<ResultItem>* refreshDataqueue();
|
||||
DataQueue<ResultItem>* initDataQueue();
|
||||
|
||||
void addSearchDir(QString &path);
|
||||
void setRecurse(bool recurse = true);
|
||||
void addKeyword(QString &keyword);
|
||||
void setActiveKeywordSegmentation(bool active);
|
||||
void addFileLabel(QString &label);
|
||||
|
||||
size_t getCurrentSearchId();
|
||||
DataQueue<ResultItem>* getDataQueue();
|
||||
bool beginSearchIdCheck(size_t searchId);
|
||||
void finishSearchIdCheck();
|
||||
void stop();
|
||||
QStringList getSearchDir();
|
||||
bool isRecurse();
|
||||
QStringList getKeyword();
|
||||
bool isKeywordSegmentationActived();
|
||||
QStringList getFileLabel();
|
||||
|
||||
private:
|
||||
DataQueue<ResultItem>* m_dataQueue = nullptr ;
|
||||
size_t m_searchId = 0;
|
||||
QMutex m_searchIdMutex;
|
||||
SearchController *q;
|
||||
QSharedPointer<SearchController> m_formerController;
|
||||
|
||||
QStringList m_keywords;
|
||||
QStringList m_searchDirs;
|
||||
QStringList m_FileLabels;
|
||||
bool m_recurse = true;
|
||||
bool m_activeKeywordSegmentation = false;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SEARCHCONTROLLERPRIVATE_H
|
|
@ -0,0 +1,210 @@
|
|||
#include "search-controller.h"
|
||||
#include "search-controller-private.h"
|
||||
#include "ukui-search-task.h"
|
||||
#include <QDebug>
|
||||
using namespace UkuiSearch;
|
||||
SearchControllerPrivate::SearchControllerPrivate(SearchController *parent)
|
||||
: q(parent)
|
||||
{
|
||||
if(q->m_parent) {
|
||||
m_formerController = QSharedPointer<SearchController>(q->m_parent);
|
||||
m_searchId = q->m_parent->d->m_searchId;
|
||||
m_dataQueue = q->m_parent->d->m_dataQueue;
|
||||
m_keywords = q->m_parent->d->m_keywords;
|
||||
m_searchDirs = q->m_parent->d->m_searchDirs;
|
||||
m_FileLabels = q->m_parent->d->m_FileLabels;
|
||||
m_recurse = q->m_parent->d->m_recurse;
|
||||
m_activeKeywordSegmentation = q->m_parent->d->m_activeKeywordSegmentation;
|
||||
}
|
||||
}
|
||||
|
||||
SearchControllerPrivate::~SearchControllerPrivate()
|
||||
{
|
||||
m_formerController.clear();
|
||||
}
|
||||
|
||||
size_t SearchControllerPrivate::refreshSearchId()
|
||||
{
|
||||
m_searchIdMutex.lock();
|
||||
m_searchId += 1;
|
||||
m_searchIdMutex.unlock();
|
||||
return m_searchId;
|
||||
}
|
||||
|
||||
DataQueue<ResultItem> *SearchControllerPrivate::refreshDataqueue()
|
||||
{
|
||||
if(!m_dataQueue) {
|
||||
m_dataQueue = new DataQueue<ResultItem>;
|
||||
return m_dataQueue;
|
||||
}
|
||||
m_dataQueue->clear();
|
||||
return m_dataQueue;;
|
||||
}
|
||||
|
||||
DataQueue<ResultItem> *SearchControllerPrivate::initDataQueue()
|
||||
{
|
||||
if(!m_dataQueue) {
|
||||
m_dataQueue = new DataQueue<ResultItem>;
|
||||
return m_dataQueue;
|
||||
}
|
||||
return m_dataQueue;
|
||||
}
|
||||
|
||||
void SearchControllerPrivate::addSearchDir(QString &path)
|
||||
{
|
||||
m_searchDirs.append(path);
|
||||
}
|
||||
|
||||
void SearchControllerPrivate::setRecurse(bool recurse)
|
||||
{
|
||||
m_recurse = recurse;
|
||||
}
|
||||
|
||||
void SearchControllerPrivate::addKeyword(QString &keyword)
|
||||
{
|
||||
m_keywords.append(keyword);
|
||||
}
|
||||
|
||||
void SearchControllerPrivate::setActiveKeywordSegmentation(bool active)
|
||||
{
|
||||
m_activeKeywordSegmentation = active;
|
||||
}
|
||||
|
||||
void SearchControllerPrivate::addFileLabel(QString &label)
|
||||
{
|
||||
m_FileLabels.append(label);
|
||||
}
|
||||
|
||||
size_t SearchControllerPrivate::getCurrentSearchId()
|
||||
{
|
||||
return m_searchId;
|
||||
}
|
||||
|
||||
DataQueue<ResultItem> *SearchControllerPrivate::getDataQueue()
|
||||
{
|
||||
return m_dataQueue;
|
||||
}
|
||||
|
||||
bool SearchControllerPrivate::beginSearchIdCheck(size_t searchId)
|
||||
{
|
||||
if(q->m_parent) {
|
||||
return q->m_parent->beginSearchIdCheck(searchId);
|
||||
}
|
||||
m_searchIdMutex.lock();
|
||||
return m_searchId == searchId;
|
||||
}
|
||||
|
||||
void SearchControllerPrivate::finishSearchIdCheck()
|
||||
{
|
||||
if(q->m_parent) {
|
||||
return q->m_parent->finishSearchIdCheck();
|
||||
}
|
||||
m_searchIdMutex.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
void SearchControllerPrivate::stop()
|
||||
{
|
||||
m_searchIdMutex.lock();
|
||||
m_searchId = 0;
|
||||
m_searchIdMutex.unlock();
|
||||
}
|
||||
|
||||
QStringList SearchControllerPrivate::getSearchDir()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool SearchControllerPrivate::isRecurse()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QStringList SearchControllerPrivate::getKeyword()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool SearchControllerPrivate::isKeywordSegmentationActived()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QStringList SearchControllerPrivate::getFileLabel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SearchController::SearchController(SearchController *parent) : m_parent(parent), d(new SearchControllerPrivate(this))
|
||||
{
|
||||
}
|
||||
|
||||
SearchController::~SearchController()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
DataQueue<ResultItem> *SearchController::refreshDataqueue()
|
||||
{
|
||||
return d->refreshDataqueue();
|
||||
}
|
||||
|
||||
size_t SearchController::refreshSearchId()
|
||||
{
|
||||
return d->refreshSearchId();
|
||||
}
|
||||
|
||||
DataQueue<ResultItem> *SearchController::initDataQueue()
|
||||
{
|
||||
return d->initDataQueue();
|
||||
}
|
||||
|
||||
void SearchController::addSearchDir(QString &path)
|
||||
{
|
||||
return d->addSearchDir(path);
|
||||
}
|
||||
|
||||
void SearchController::setRecurse(bool recurse)
|
||||
{
|
||||
d->setRecurse(recurse);
|
||||
}
|
||||
|
||||
void SearchController::addKeyword(QString &keyword)
|
||||
{
|
||||
d->addKeyword(keyword);
|
||||
}
|
||||
|
||||
size_t SearchController::getCurrentSearchId()
|
||||
{
|
||||
d->getCurrentSearchId();
|
||||
}
|
||||
|
||||
DataQueue<ResultItem> *SearchController::getDataQueue()
|
||||
{
|
||||
return d->getDataQueue();
|
||||
}
|
||||
|
||||
void SearchController::setActiveKeywordSegmentation(bool active)
|
||||
{
|
||||
d->setActiveKeywordSegmentation(active);
|
||||
}
|
||||
|
||||
void SearchController::addFileLabel(QString &label)
|
||||
{
|
||||
d->addFileLabel(label);
|
||||
}
|
||||
|
||||
bool SearchController::beginSearchIdCheck(size_t searchId)
|
||||
{
|
||||
return d->beginSearchIdCheck(searchId);
|
||||
}
|
||||
|
||||
void SearchController::finishSearchIdCheck()
|
||||
{
|
||||
d->finishSearchIdCheck();
|
||||
}
|
||||
|
||||
void SearchController::stop()
|
||||
{
|
||||
d->stop();
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef SEARCHCONTROLLER_H
|
||||
#define SEARCHCONTROLLER_H
|
||||
|
||||
#include <QStringList>
|
||||
#include "data-queue.h"
|
||||
//todo: url parser?
|
||||
namespace UkuiSearch {
|
||||
class UkuiSearchTask;
|
||||
class ResultItem;
|
||||
class SearchControllerPrivate;
|
||||
class SearchController
|
||||
{
|
||||
friend class SearchControllerPrivate;
|
||||
public:
|
||||
explicit SearchController(SearchController *parent = nullptr);
|
||||
~SearchController();
|
||||
DataQueue<ResultItem>* refreshDataqueue();
|
||||
size_t refreshSearchId();
|
||||
DataQueue<ResultItem>* initDataQueue();
|
||||
|
||||
void addSearchDir(QString &path);
|
||||
void setRecurse(bool recurse = true);
|
||||
void addKeyword(QString &keyword);
|
||||
void setActiveKeywordSegmentation(bool active);
|
||||
void addFileLabel(QString &label);
|
||||
|
||||
size_t getCurrentSearchId();
|
||||
DataQueue<ResultItem>* getDataQueue();
|
||||
bool beginSearchIdCheck(size_t searchId);
|
||||
void finishSearchIdCheck();
|
||||
void stop();
|
||||
QStringList getSearchDir();
|
||||
bool isRecurse();
|
||||
QStringList getKeyword();
|
||||
bool isKeywordSegmentationActived();
|
||||
QStringList getFileLabel();
|
||||
private:
|
||||
SearchControllerPrivate *d;
|
||||
SearchController *m_parent;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SEARCHCONTROLLER_H
|
|
@ -0,0 +1,16 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
include(searchtasks/search-tasks.pri)
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/result-item-private.h \
|
||||
$$PWD/search-controller-private.h \
|
||||
$$PWD/search-controller.h \
|
||||
$$PWD/result-item.h \
|
||||
$$PWD/ukui-search-task-private.h \
|
||||
$$PWD/ukui-search-task.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/search-controller.cpp \
|
||||
$$PWD/result-item.cpp \
|
||||
$$PWD/ukui-search-task.cpp
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#include "file-search-task.h"
|
||||
using namespace UkuiSearch;
|
||||
FileSearchTask::FileSearchTask(SearchController searchController): m_searchControl(searchController)
|
||||
{
|
||||
}
|
||||
|
||||
const QString FileSearchTask::name()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const QString FileSearchTask::description()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString FileSearchTask::getSearchType()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FileSearchTask::startSearch(SearchController searchController)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FileSearchTask::stop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FileSearchTask::run()
|
||||
{
|
||||
//file search, based on index or direct search?
|
||||
//1.do search
|
||||
if(m_searchControl.beginSearchIdCheck(m_searchControl.getCurrentSearchId())) {
|
||||
|
||||
//do enqueue here
|
||||
m_searchControl.finishSearchIdCheck();
|
||||
}
|
||||
m_searchControl.finishSearchIdCheck();
|
||||
//finish
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef FILESEARCHTASK_H
|
||||
#define FILESEARCHTASK_H
|
||||
#include "search-task-plugin-iface.h"
|
||||
#include "search-controller.h"
|
||||
#include <QIcon>
|
||||
namespace UkuiSearch {
|
||||
class FileSearchTask : public SearchTaskPLuginIface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FileSearchTask(SearchController searchController);
|
||||
PluginType pluginType() {return PluginType::SearchTaskPlugin;}
|
||||
const QString name();
|
||||
const QString description();
|
||||
const QIcon icon() {return QIcon::fromTheme("folder");}
|
||||
void setEnable(bool enable) {}
|
||||
bool isEnable() {}
|
||||
|
||||
QString getSearchType();
|
||||
void startSearch(SearchController searchController);
|
||||
void stop();
|
||||
protected:
|
||||
void run();
|
||||
private:
|
||||
SearchController m_searchControl;
|
||||
};
|
||||
}
|
||||
#endif // FILESEARCHTASK_H
|
|
@ -0,0 +1,9 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/file-search-task.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/file-search-task.cpp
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef UKUISEARCHPRIVATE_H
|
||||
#define UKUISEARCHPRIVATE_H
|
||||
|
||||
#include "ukui-search-task.h"
|
||||
#include <QThreadPool>
|
||||
#include <QMutex>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include "data-queue.h"
|
||||
#include "search-controller.h"
|
||||
namespace UkuiSearch {
|
||||
class UkuiSearchTaskPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit UkuiSearchTaskPrivate(UkuiSearchTask* parent);
|
||||
~UkuiSearchTaskPrivate();
|
||||
DataQueue<ResultItem>* init();
|
||||
void addSearchDir(QString &path);
|
||||
void setRecurse(bool recurse = true);
|
||||
void addKeyword(QString &keyword);
|
||||
void addFileLabel(QString &label);
|
||||
void setSearchOnlineApps(bool searchOnlineApps);
|
||||
size_t startSearch(SearchType searchtype);
|
||||
void stop();
|
||||
|
||||
private:
|
||||
SearchController* m_searchCotroller;
|
||||
size_t m_searchId = 0;
|
||||
UkuiSearchTask* q = nullptr;
|
||||
|
||||
Q_SIGNALS:
|
||||
void searchFinished(size_t searchId);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // UKUISEARCHPRIVATE_H
|
|
@ -0,0 +1,113 @@
|
|||
#include "ukui-search-task.h"
|
||||
#include "ukui-search-task-private.h"
|
||||
#include <QDebug>
|
||||
using namespace UkuiSearch;
|
||||
UkuiSearchTaskPrivate::UkuiSearchTaskPrivate(UkuiSearchTask *parent)
|
||||
: QObject(parent),
|
||||
q(parent)
|
||||
{
|
||||
m_searchCotroller = new SearchController();
|
||||
}
|
||||
|
||||
UkuiSearchTaskPrivate::~UkuiSearchTaskPrivate()
|
||||
{
|
||||
this->stop();
|
||||
}
|
||||
|
||||
DataQueue<ResultItem> *UkuiSearchTaskPrivate::init()
|
||||
{
|
||||
return m_searchCotroller->initDataQueue();
|
||||
}
|
||||
|
||||
void UkuiSearchTaskPrivate::addSearchDir(QString &path)
|
||||
{
|
||||
m_searchCotroller->addSearchDir(path);
|
||||
}
|
||||
|
||||
void UkuiSearchTaskPrivate::setRecurse(bool recurse)
|
||||
{
|
||||
m_searchCotroller->setRecurse(recurse);
|
||||
}
|
||||
|
||||
void UkuiSearchTaskPrivate::addKeyword(QString &keyword)
|
||||
{
|
||||
m_searchCotroller->addKeyword(keyword);
|
||||
}
|
||||
|
||||
void UkuiSearchTaskPrivate::addFileLabel(QString &label)
|
||||
{
|
||||
m_searchCotroller->addFileLabel(label);
|
||||
}
|
||||
|
||||
void UkuiSearchTaskPrivate::setSearchOnlineApps(bool searchOnlineApps)
|
||||
{
|
||||
}
|
||||
|
||||
size_t UkuiSearchTaskPrivate::startSearch(SearchType searchtype)
|
||||
{
|
||||
|
||||
m_searchId = m_searchCotroller->refreshSearchId();
|
||||
// if(!m_dataQueue) {
|
||||
// qWarning() << "Please run init first!";
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
//plugin manager do async search here
|
||||
// plugin->search(SearchController(m_searchController))
|
||||
|
||||
return m_searchId;
|
||||
}
|
||||
|
||||
void UkuiSearchTaskPrivate::stop()
|
||||
{
|
||||
m_searchCotroller->stop();
|
||||
}
|
||||
|
||||
UkuiSearchTask::UkuiSearchTask(QObject *parent) : QObject(parent), d(new UkuiSearchTaskPrivate(this))
|
||||
{
|
||||
connect(d, &UkuiSearchTaskPrivate::searchFinished, this, &UkuiSearchTask::searchFinished);
|
||||
}
|
||||
|
||||
UkuiSearchTask::~UkuiSearchTask()
|
||||
{
|
||||
}
|
||||
|
||||
DataQueue<ResultItem> *UkuiSearchTask::init()
|
||||
{
|
||||
d->init();
|
||||
}
|
||||
|
||||
void UkuiSearchTask::addSearchDir(QString &path)
|
||||
{
|
||||
d->addSearchDir(path);
|
||||
}
|
||||
|
||||
void UkuiSearchTask::setRecurse(bool recurse)
|
||||
{
|
||||
d->setRecurse(recurse);
|
||||
}
|
||||
|
||||
void UkuiSearchTask::addKeyword(QString &keyword)
|
||||
{
|
||||
d->addKeyword(keyword);
|
||||
}
|
||||
|
||||
void UkuiSearchTask::addFileLabel(QString &label)
|
||||
{
|
||||
d->addFileLabel(label);
|
||||
}
|
||||
|
||||
void UkuiSearchTask::setSearchOnlineApps(bool searchOnlineApps)
|
||||
{
|
||||
d->setSearchOnlineApps(searchOnlineApps);
|
||||
}
|
||||
|
||||
size_t UkuiSearchTask::startSearch(SearchType searchtype)
|
||||
{
|
||||
return d->startSearch(searchtype);
|
||||
}
|
||||
|
||||
void UkuiSearchTask::stop()
|
||||
{
|
||||
d->stop();
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef UKUISEARCH_H
|
||||
#define UKUISEARCH_H
|
||||
|
||||
#include "result-item.h"
|
||||
#include "data-queue.h"
|
||||
#include "common-defines.h"
|
||||
namespace UkuiSearch {
|
||||
class UkuiSearchTaskPrivate;
|
||||
class UkuiSearchTask : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit UkuiSearchTask(QObject *parent = nullptr);
|
||||
~UkuiSearchTask();
|
||||
DataQueue<ResultItem>* init();
|
||||
void addSearchDir(QString &path);
|
||||
void setRecurse(bool recurse = true);
|
||||
void addKeyword(QString &keyword);
|
||||
void addFileLabel(QString &label);
|
||||
void setSearchOnlineApps(bool searchOnlineApps);
|
||||
size_t startSearch(SearchType searchtype);
|
||||
void stop();
|
||||
|
||||
Q_SIGNALS:
|
||||
void searchFinished(size_t searchId);
|
||||
|
||||
private:
|
||||
UkuiSearchTaskPrivate* d = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // UKUISEARCH_H
|
Loading…
Reference in New Issue