ukui-search/libsearch/searchinterface/search-controller.h

68 lines
2.1 KiB
C
Raw Normal View History

2021-12-28 15:56:41 +08:00
#ifndef SEARCHCONTROLLER_H
#define SEARCHCONTROLLER_H
#include <QStringList>
2022-01-11 16:20:40 +08:00
#include <memory>
2021-12-28 15:56:41 +08:00
#include "data-queue.h"
//todo: url parser?
namespace UkuiSearch {
class UkuiSearchTask;
class ResultItem;
class SearchControllerPrivate;
/*
*ID
*
*使
*/
2021-12-28 15:56:41 +08:00
class SearchController
{
friend class SearchControllerPrivate;
public:
2022-01-11 16:20:40 +08:00
explicit SearchController(std::shared_ptr<SearchController> parent = nullptr);
SearchController(SearchController &) = delete;
SearchController &operator =(const SearchController &) = delete;
2021-12-28 15:56:41 +08:00
~SearchController();
DataQueue<ResultItem>* refreshDataqueue();
size_t refreshSearchId();
DataQueue<ResultItem>* initDataQueue();
2021-12-31 17:38:02 +08:00
void stop();
2021-12-28 15:56:41 +08:00
void addSearchDir(QString &path);
void setRecurse(bool recurse = true);
void addKeyword(QString &keyword);
void setActiveKeywordSegmentation(bool active);
void addFileLabel(QString &label);
2022-01-11 16:20:40 +08:00
void setOnlySearchFile(bool onlySearchFile);
void setOnlySearchDir(bool onlySearchDir);
2021-12-31 17:38:02 +08:00
//以上方法插件请不要调用
2021-12-28 15:56:41 +08:00
2021-12-31 17:38:02 +08:00
//以下方法插件可以调用
2021-12-28 15:56:41 +08:00
size_t getCurrentSearchId();
DataQueue<ResultItem>* getDataQueue();
bool beginSearchIdCheck(size_t searchId);
void finishSearchIdCheck();
2021-12-31 17:38:02 +08:00
2021-12-28 15:56:41 +08:00
QStringList getSearchDir();
bool isRecurse();
QStringList getKeyword();
bool isKeywordSegmentationActived();
QStringList getFileLabel();
2022-01-11 16:20:40 +08:00
bool isSearchFileOnly();
bool isSearchDirOnly();
void clearAllConditions();
void clearKeyWords();
void clearSearchDir();
void setPagination(unsigned int first, unsigned int maxResults);
unsigned int first() const;
unsigned int maxResults() const;
2021-12-28 15:56:41 +08:00
private:
2022-01-11 16:20:40 +08:00
std::shared_ptr<SearchController> m_parent = nullptr;
SearchControllerPrivate *d = nullptr;
2021-12-28 15:56:41 +08:00
};
}
#endif // SEARCHCONTROLLER_H