From f99ce401e602f31049c030803fd7b19cb18b6eea Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Sat, 3 Jul 2021 16:49:37 +0800 Subject: [PATCH] Add a preview page plugin iface. --- .../stack-pages/search-page-section.cpp | 2 +- .../plugininterface/plugin-interface.pri | 3 ++ .../preview-page-plugin-iface.h | 47 +++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 libsearch/plugininterface/preview-page-plugin-iface.h diff --git a/frontend/control/stack-pages/search-page-section.cpp b/frontend/control/stack-pages/search-page-section.cpp index 8b0e317..2fda7ca 100644 --- a/frontend/control/stack-pages/search-page-section.cpp +++ b/frontend/control/stack-pages/search-page-section.cpp @@ -154,7 +154,7 @@ void DetailWidget::setWidgetInfo(const QString &plugin_name, const SearchPluginI QLabel * descLabel = new QLabel(m_descFrame); descLabel->setTextFormat(Qt::PlainText); descLabel->setWordWrap(true); - QString show_desc = desc.key + ": " + desc.value; + QString show_desc = desc.key + " " + desc.value; descLabel->setText(show_desc); m_descFrameLyt->addWidget(descLabel); } diff --git a/libsearch/plugininterface/plugin-interface.pri b/libsearch/plugininterface/plugin-interface.pri index 592db4d..3885713 100644 --- a/libsearch/plugininterface/plugin-interface.pri +++ b/libsearch/plugininterface/plugin-interface.pri @@ -2,6 +2,9 @@ INCLUDEPATH += $$PWD \ HEADERS += \ $$PWD/plugin-iface.h \ + $$PWD/preview-page-plugin-iface.h \ $$PWD/search-plugin-iface.h \ $$PWD/data-queue.h +SOURCES += + diff --git a/libsearch/plugininterface/preview-page-plugin-iface.h b/libsearch/plugininterface/preview-page-plugin-iface.h new file mode 100644 index 0000000..869f6a2 --- /dev/null +++ b/libsearch/plugininterface/preview-page-plugin-iface.h @@ -0,0 +1,47 @@ +#ifndef PREVIEWPAGEPLUGINIFACE_H +#define PREVIEWPAGEPLUGINIFACE_H +#include +#include +#include +#include "plugin-iface.h" + +#define PreviewPagePluginIface_iid "org.ukui.ukui-search.plugin-iface.PreviewPagePluginInterface" + +namespace Zeeker { + +class PreviewPageIface; + +class PreviewPagePluginIface : public PluginInterface +{ +public: + virtual ~PreviewPagePluginIface() {} + + virtual PreviewPageIface *createPreviewPage() = 0; +}; + +class PreviewPageIface +{ +public: + enum PreviewType { + Attribute, + Text, + Pictrue, + PDF, + OfficeDoc, + Other + }; + + virtual ~PreviewPageIface() {} + + virtual void prepare(const QString &uri, PreviewType type) = 0; + virtual void prepare(const QString &uri) = 0; + virtual void startPreview() = 0; + virtual void cancel() = 0; + virtual void closePreviewPage() = 0; +}; + +} + +Q_DECLARE_INTERFACE(Zeeker::PreviewPagePluginIface, PreviewPagePluginIface_iid) + +#endif // PREVIEWPAGEPLUGINIFACE_H