/* * * Copyright (C) 2020, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: zhangjiaping * */ #ifndef SEARCHRESULTMANAGER_H #define SEARCHRESULTMANAGER_H #include #include #include #include #include "pluginmanage/search-plugin-manager.h" namespace Zeeker { class ReceiveResultThread : public QThread { Q_OBJECT public: ReceiveResultThread(DataQueue * result_queue, QObject * parent = nullptr); ~ReceiveResultThread() = default; void stop(); protected: void run() override; private: DataQueue * m_result_queue; Q_SIGNALS: void gotResultInfo(const SearchPluginIface::ResultInfo&); }; class SearchResultManager : public QObject { Q_OBJECT public: explicit SearchResultManager(const QString &plugin_id, QObject *parent = nullptr); ~SearchResultManager() = default; public Q_SLOTS: void startSearch(const QString &); void stopSearch(); private: void initConnections(); QString m_plugin_id; DataQueue * m_result_queue; ReceiveResultThread * m_get_result_thread = nullptr; Q_SIGNALS: void gotResultInfo(const SearchPluginIface::ResultInfo&); }; } #endif // SEARCHRESULTMANAGER_H