61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
#ifndef APPSEARCHTASK_H
|
|
#define APPSEARCHTASK_H
|
|
|
|
#include <QIcon>
|
|
#include <QThreadPool>
|
|
#include <QRunnable>
|
|
#include <QDBusInterface>
|
|
#include <QtDBus>
|
|
#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> searchController);
|
|
void stop();
|
|
Q_INVOKABLE void sendFinishSignal(size_t searchId);
|
|
|
|
private:
|
|
ApplicationInfo m_appinfo;
|
|
std::shared_ptr<SearchController> 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
|