ukui-search/libsearch/plugininterface/search-plugin-iface.h

63 lines
1.7 KiB
C
Raw Normal View History

#ifndef SEARCHPLUGINIFACE_H
#define SEARCHPLUGINIFACE_H
#define SearchPluginIface_iid "org.ukui.ukui-search.plugin-iface.SearchPluginInterface"
#define SEARCH_PLUGIN_IFACE_VERSION "1.1.0"
#include <QString>
#include <QIcon>
2021-05-27 21:10:11 +08:00
#include <QList>
#include <QMutex>
#include <QtPlugin>
#include "plugin-iface.h"
2021-05-27 21:10:11 +08:00
#include "data-queue.h"
2021-12-14 14:43:35 +08:00
namespace UkuiSearch {
class SearchPluginIface : public PluginInterface
{
public:
enum InvokableAction
{
None = 1u << 0,
HideUI = 1u << 1
};
Q_DECLARE_FLAGS(InvokableActions, InvokableAction)
struct DescriptionInfo
{
QString key;
QString value;
};
2021-05-27 21:10:11 +08:00
struct Actioninfo
{
int actionkey;
QString displayName;
};
2021-05-03 00:21:36 +08:00
/**
* @brief The ResultInfo struct
2021-05-03 00:21:36 +08:00
*/
struct ResultInfo
{
QIcon icon;
QString name;
QVector<DescriptionInfo> description;
2021-05-27 21:10:11 +08:00
QString actionKey;
int type;
};
2021-05-27 21:10:11 +08:00
2021-05-03 00:21:36 +08:00
virtual ~SearchPluginIface() {}
virtual QString getPluginName() = 0;
2021-05-27 21:10:11 +08:00
virtual void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult) = 0;
virtual void stopSearch() = 0;
2021-05-27 21:10:11 +08:00
virtual QList<Actioninfo> getActioninfo(int type) = 0;
2021-06-17 14:08:55 +08:00
virtual void openAction(int actionkey, QString key, int type) = 0;
// virtual bool isPreviewEnable(QString key, int type) = 0;
// virtual QWidget *previewPage(QString key, int type, QWidget *parent = nullptr) = 0;
virtual QWidget *detailPage(const ResultInfo &ri) = 0;
void invokeActions(InvokableActions actions);
};
}
2021-12-14 14:43:35 +08:00
Q_DECLARE_INTERFACE(UkuiSearch::SearchPluginIface, SearchPluginIface_iid)
#endif // SEARCHPLUGINIFACE_H