Add a preview page plugin iface.

This commit is contained in:
iaom 2021-07-03 16:49:37 +08:00
parent 7fb1dba37f
commit f99ce401e6
3 changed files with 51 additions and 1 deletions

View File

@ -154,7 +154,7 @@ void DetailWidget::setWidgetInfo(const QString &plugin_name, const SearchPluginI
QLabel * descLabel = new QLabel(m_descFrame); QLabel * descLabel = new QLabel(m_descFrame);
descLabel->setTextFormat(Qt::PlainText); descLabel->setTextFormat(Qt::PlainText);
descLabel->setWordWrap(true); descLabel->setWordWrap(true);
QString show_desc = desc.key + ": " + desc.value; QString show_desc = desc.key + " " + desc.value;
descLabel->setText(show_desc); descLabel->setText(show_desc);
m_descFrameLyt->addWidget(descLabel); m_descFrameLyt->addWidget(descLabel);
} }

View File

@ -2,6 +2,9 @@ INCLUDEPATH += $$PWD \
HEADERS += \ HEADERS += \
$$PWD/plugin-iface.h \ $$PWD/plugin-iface.h \
$$PWD/preview-page-plugin-iface.h \
$$PWD/search-plugin-iface.h \ $$PWD/search-plugin-iface.h \
$$PWD/data-queue.h $$PWD/data-queue.h
SOURCES +=

View File

@ -0,0 +1,47 @@
#ifndef PREVIEWPAGEPLUGINIFACE_H
#define PREVIEWPAGEPLUGINIFACE_H
#include <QPluginLoader>
#include <QtPlugin>
#include <QString>
#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