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

76 lines
2.4 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"
#include "search-result-property.h"
2021-12-28 15:56:41 +08:00
//todo: url parser?
namespace UkuiSearch {
class UkuiSearchTask;
class ResultItem;
class SearchControllerPrivate;
/*
*ID
*/
2021-12-28 15:56:41 +08:00
class SearchController
{
public:
SearchController();
SearchController(const SearchController &other);
SearchController &operator=(const SearchController &other);
SearchController &operator=(SearchController &&other) Q_DECL_NOEXCEPT;
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();
void addSearchDir(const QString &path);
2021-12-28 15:56:41 +08:00
void setRecurse(bool recurse = true);
void addKeyword(const QString &keyword);
2021-12-28 15:56:41 +08:00
void setActiveKeywordSegmentation(bool active);
void addFileLabel(const QString &label);
2022-01-11 16:20:40 +08:00
void setOnlySearchFile(bool onlySearchFile);
void setOnlySearchDir(bool onlySearchDir);
void setSearchOnlineApps(bool searchOnlineApps);
void setSearchHiddenFiles(bool searchHiddenFiles);
void setMaxResultNum(unsigned int maxResults);
void setInformNum(int num = 0);
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();
SearchResultProperties getResultProperties(SearchProperty::SearchType searchType);
QStringList getCustomResultDataType(QString customSearchType);
2021-12-28 15:56:41 +08:00
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();
bool isSearchOnlineApps();
bool searchHiddenFiles();
void clearAllConditions();
void clearKeyWords();
void clearSearchDir();
void clearFileLabel();
unsigned int maxResults() const;
int informNum() const;
bool setResultProperties(SearchProperty::SearchType searchType, UkuiSearch::SearchResultProperties searchResultProperties);
void setCustomResultDataType(QString customSearchType, QStringList dataType);
2021-12-28 15:56:41 +08:00
private:
std::shared_ptr<SearchControllerPrivate> d;
2022-01-11 16:20:40 +08:00
2021-12-28 15:56:41 +08:00
};
}
#endif // SEARCHCONTROLLER_H