/* * * Copyright (C) 2023, 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: iaom */ #ifndef APPSEARCHTASK_H #define APPSEARCHTASK_H #include #include #include #include #include #include "search-task-plugin-iface.h" #include "search-controller.h" #include "result-item.h" #include "application-info.h" #include "search-result-property.h" namespace UkuiSearch { class AppSearchTask : public SearchTaskPluginIface { friend class AppSearchWorker; Q_OBJECT public: explicit AppSearchTask(QObject *parent); ~AppSearchTask(); PluginType pluginType() {return PluginType::SearchTaskPlugin;} const QString name(); const QString description(); const QIcon icon() {return QIcon::fromTheme("appsearch");} void setEnable(bool enable) {} bool isEnable() { return true;} SearchProperty::SearchType getSearchType() {return SearchProperty::SearchType::Application;} QString getCustomSearchType(); void startSearch(std::shared_ptr searchController); void stop(); Q_INVOKABLE void sendFinishSignal(size_t searchId); private: ApplicationInfo m_appinfo; std::shared_ptr m_searchController; QThreadPool *m_pool = nullptr; }; class AppSearchWorker : public QRunnable { public: explicit AppSearchWorker(AppSearchTask *AppSarchTask); protected: void run(); private: ~AppSearchWorker(); void sendErrorMsg(const QString &msg); private: AppSearchTask *m_appSearchTask = nullptr; QDBusInterface *m_interFace = nullptr; size_t m_currentSearchId = 0; }; } #endif // APPSEARCHTASK_H