Merge pull request #276 from iaom/0630-new-frontend
Add preview page iface.
This commit is contained in:
commit
0734c5ea37
|
@ -27,11 +27,11 @@ using namespace Zeeker;
|
||||||
#define DETAIL_BACKGROUND_COLOR QColor(0, 0, 0, 0)
|
#define DETAIL_BACKGROUND_COLOR QColor(0, 0, 0, 0)
|
||||||
#define DETAIL_WIDGET_TRANSPARENT 0.04
|
#define DETAIL_WIDGET_TRANSPARENT 0.04
|
||||||
#define DETAIL_WIDGET_BORDER_RADIUS 4
|
#define DETAIL_WIDGET_BORDER_RADIUS 4
|
||||||
#define DETAIL_WIDGET_MARGINS 8,40,40,8
|
#define DETAIL_WIDGET_MARGINS 8,0,8,0
|
||||||
#define DETAIL_FRAME_MARGINS 8,0,8,0
|
#define DETAIL_FRAME_MARGINS 8,0,0,0
|
||||||
#define DETAIL_ICON_HEIGHT 120
|
#define DETAIL_ICON_HEIGHT 120
|
||||||
#define NAME_LABEL_WIDTH 280
|
#define NAME_LABEL_WIDTH 280
|
||||||
#define ICON_SIZE QSize(96, 96)
|
#define ICON_SIZE QSize(120, 120)
|
||||||
#define LINE_STYLE "QFrame{background: rgba(0,0,0,0.2);}"
|
#define LINE_STYLE "QFrame{background: rgba(0,0,0,0.2);}"
|
||||||
#define ACTION_NORMAL_COLOR QColor(55, 144, 250, 255)
|
#define ACTION_NORMAL_COLOR QColor(55, 144, 250, 255)
|
||||||
#define ACTION_HOVER_COLOR QColor(64, 169, 251, 255)
|
#define ACTION_HOVER_COLOR QColor(64, 169, 251, 255)
|
||||||
|
@ -139,8 +139,17 @@ QString escapeHtml(const QString & str) {
|
||||||
void DetailWidget::setWidgetInfo(const QString &plugin_name, const SearchPluginIface::ResultInfo &info)
|
void DetailWidget::setWidgetInfo(const QString &plugin_name, const SearchPluginIface::ResultInfo &info)
|
||||||
{
|
{
|
||||||
clearLayout(m_descFrameLyt);
|
clearLayout(m_descFrameLyt);
|
||||||
m_iconLabel->setPixmap(info.icon.pixmap(info.icon.actualSize(ICON_SIZE)));
|
clearLayout(m_previewFrameLyt);
|
||||||
m_iconLabel->show();
|
if(SearchPluginManager::getInstance()->getPlugin(plugin_name)->isPreviewEnable(info.actionKey,info.type)) {
|
||||||
|
m_iconLabel->hide();
|
||||||
|
m_previewFrameLyt->addWidget(SearchPluginManager::getInstance()->getPlugin(plugin_name)->previewPage(info.actionKey,info.type, m_previewFrame), 0 , Qt::AlignHCenter);
|
||||||
|
m_previewFrameLyt->setContentsMargins(0,0,0,0);
|
||||||
|
m_previewFrame->show();
|
||||||
|
} else {
|
||||||
|
m_previewFrame->hide();
|
||||||
|
m_iconLabel->setPixmap(info.icon.pixmap(info.icon.actualSize(ICON_SIZE)));
|
||||||
|
m_iconLabel->show();
|
||||||
|
}
|
||||||
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
|
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
|
||||||
QString name = fontMetrics.elidedText(info.name, Qt::ElideRight, NAME_LABEL_WIDTH - 8);
|
QString name = fontMetrics.elidedText(info.name, Qt::ElideRight, NAME_LABEL_WIDTH - 8);
|
||||||
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(escapeHtml(name)));
|
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(escapeHtml(name)));
|
||||||
|
@ -191,6 +200,8 @@ void DetailWidget::initUi()
|
||||||
m_iconLabel = new QLabel(this);
|
m_iconLabel = new QLabel(this);
|
||||||
m_iconLabel->setFixedHeight(DETAIL_ICON_HEIGHT);
|
m_iconLabel->setFixedHeight(DETAIL_ICON_HEIGHT);
|
||||||
m_iconLabel->setAlignment(Qt::AlignCenter);
|
m_iconLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
m_previewFrame = new QFrame(this);
|
||||||
|
m_previewFrameLyt = new QHBoxLayout(m_previewFrame);
|
||||||
|
|
||||||
m_nameFrame = new QFrame(this);
|
m_nameFrame = new QFrame(this);
|
||||||
m_nameFrameLyt = new QHBoxLayout(m_nameFrame);
|
m_nameFrameLyt = new QHBoxLayout(m_nameFrame);
|
||||||
|
@ -224,6 +235,7 @@ void DetailWidget::initUi()
|
||||||
m_actionFrameLyt->setContentsMargins(DETAIL_FRAME_MARGINS);
|
m_actionFrameLyt->setContentsMargins(DETAIL_FRAME_MARGINS);
|
||||||
|
|
||||||
m_mainLyt->addWidget(m_iconLabel);
|
m_mainLyt->addWidget(m_iconLabel);
|
||||||
|
m_mainLyt->addWidget(m_previewFrame, 0, Qt::AlignHCenter);
|
||||||
m_mainLyt->addWidget(m_nameFrame);
|
m_mainLyt->addWidget(m_nameFrame);
|
||||||
m_mainLyt->addWidget(m_line_1);
|
m_mainLyt->addWidget(m_line_1);
|
||||||
m_mainLyt->addWidget(m_descFrame);
|
m_mainLyt->addWidget(m_descFrame);
|
||||||
|
|
|
@ -70,6 +70,8 @@ private:
|
||||||
void clearLayout(QLayout *);
|
void clearLayout(QLayout *);
|
||||||
QVBoxLayout * m_mainLyt = nullptr;
|
QVBoxLayout * m_mainLyt = nullptr;
|
||||||
QLabel * m_iconLabel = nullptr;
|
QLabel * m_iconLabel = nullptr;
|
||||||
|
QFrame *m_previewFrame = nullptr;
|
||||||
|
QHBoxLayout *m_previewFrameLyt = nullptr;
|
||||||
QFrame * m_nameFrame = nullptr;
|
QFrame * m_nameFrame = nullptr;
|
||||||
QHBoxLayout * m_nameFrameLyt = nullptr;
|
QHBoxLayout * m_nameFrameLyt = nullptr;
|
||||||
QLabel * m_nameLabel = nullptr;
|
QLabel * m_nameLabel = nullptr;
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#include "search-page.h"
|
#include "search-page.h"
|
||||||
using namespace Zeeker;
|
using namespace Zeeker;
|
||||||
|
|
||||||
#define RESULT_WIDTH 298
|
#define RESULT_WIDTH 266
|
||||||
#define DETAIL_WIDTH 400
|
#define DETAIL_WIDTH 374
|
||||||
|
|
||||||
SearchPage::SearchPage(QWidget *parent) : QWidget(parent)
|
SearchPage::SearchPage(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -54,6 +54,7 @@ void SearchPage::appendPlugin(const QString &plugin_id)
|
||||||
void SearchPage::initUi()
|
void SearchPage::initUi()
|
||||||
{
|
{
|
||||||
m_splitter = new QSplitter(this);
|
m_splitter = new QSplitter(this);
|
||||||
|
m_splitter->setContentsMargins(0, 0, 0, 0);
|
||||||
m_resultArea = new ResultArea(m_splitter);
|
m_resultArea = new ResultArea(m_splitter);
|
||||||
m_detailArea = new DetailArea(m_splitter);
|
m_detailArea = new DetailArea(m_splitter);
|
||||||
m_splitter->addWidget(m_resultArea);
|
m_splitter->addWidget(m_resultArea);
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include "qt-single-application.h"
|
#include "qt-single-application.h"
|
||||||
#include "global-settings.h"
|
#include "global-settings.h"
|
||||||
|
|
||||||
#define MAIN_MARGINS 16,8,16,16
|
#define MAIN_MARGINS 16,16,16,16
|
||||||
#define TITLE_MARGINS 0,0,0,0
|
#define TITLE_MARGINS 0,0,0,0
|
||||||
#define UKUI_SEARCH_SCHEMAS "org.ukui.search.settings"
|
#define UKUI_SEARCH_SCHEMAS "org.ukui.search.settings"
|
||||||
#define SEARCH_METHOD_KEY "indexSearch"
|
#define SEARCH_METHOD_KEY "indexSearch"
|
||||||
|
@ -140,25 +140,25 @@ void MainWindow::initUi() {
|
||||||
mainlayout->setContentsMargins(MAIN_MARGINS);
|
mainlayout->setContentsMargins(MAIN_MARGINS);
|
||||||
m_frame->setLayout(mainlayout);
|
m_frame->setLayout(mainlayout);
|
||||||
|
|
||||||
m_titleFrame = new QFrame(m_frame);//标题栏
|
// m_titleFrame = new QFrame(m_frame);//标题栏
|
||||||
m_titleFrame->setFixedHeight(TITLE_HEIGHT);
|
// m_titleFrame->setFixedHeight(TITLE_HEIGHT);
|
||||||
m_titleLyt = new QHBoxLayout(m_titleFrame);
|
// m_titleLyt = new QHBoxLayout(m_titleFrame);
|
||||||
m_titleLyt->setContentsMargins(TITLE_MARGINS);
|
// m_titleLyt->setContentsMargins(TITLE_MARGINS);
|
||||||
m_iconLabel = new QLabel(m_titleFrame);
|
// m_iconLabel = new QLabel(m_titleFrame);
|
||||||
m_iconLabel->setFixedSize(WINDOW_ICON_SIZE, WINDOW_ICON_SIZE);
|
// m_iconLabel->setFixedSize(WINDOW_ICON_SIZE, WINDOW_ICON_SIZE);
|
||||||
m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(WINDOW_ICON_SIZE, WINDOW_ICON_SIZE)));
|
// m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(WINDOW_ICON_SIZE, WINDOW_ICON_SIZE)));
|
||||||
m_titleLabel = new QLabel(m_titleFrame);
|
// m_titleLabel = new QLabel(m_titleFrame);
|
||||||
m_titleLabel->setText(tr("Search"));
|
// m_titleLabel->setText(tr("Search"));
|
||||||
m_settingsBtn = new QPushButton(m_titleFrame);
|
// m_settingsBtn = new QPushButton(m_titleFrame);
|
||||||
m_settingsBtn->setFixedSize(SETTING_BTN_SIZE, SETTING_BTN_SIZE);
|
// m_settingsBtn->setFixedSize(SETTING_BTN_SIZE, SETTING_BTN_SIZE);
|
||||||
m_settingsBtn->setIcon(QIcon::fromTheme("document-properties-symbolic"));
|
// m_settingsBtn->setIcon(QIcon::fromTheme("document-properties-symbolic"));
|
||||||
m_settingsBtn->setProperty("useIconHighlightEffect", 0x2);
|
// m_settingsBtn->setProperty("useIconHighlightEffect", 0x2);
|
||||||
m_settingsBtn->setProperty("isWindowButton", 0x01);
|
// m_settingsBtn->setProperty("isWindowButton", 0x01);
|
||||||
m_settingsBtn->setFlat(true);
|
// m_settingsBtn->setFlat(true);
|
||||||
m_titleLyt->addWidget(m_iconLabel);
|
// m_titleLyt->addWidget(m_iconLabel);
|
||||||
m_titleLyt->addWidget(m_titleLabel);
|
// m_titleLyt->addWidget(m_titleLabel);
|
||||||
m_titleLyt->addStretch();
|
// m_titleLyt->addStretch();
|
||||||
m_titleLyt->addWidget(m_settingsBtn);
|
// m_titleLyt->addWidget(m_settingsBtn);
|
||||||
m_stackedWidget = new StackedWidget(m_frame);//内容栏
|
m_stackedWidget = new StackedWidget(m_frame);//内容栏
|
||||||
|
|
||||||
m_searchWidget = new SeachBarWidget(this);
|
m_searchWidget = new SeachBarWidget(this);
|
||||||
|
@ -166,9 +166,9 @@ void MainWindow::initUi() {
|
||||||
m_searchWidget->setLayout(m_searchLayout);
|
m_searchWidget->setLayout(m_searchLayout);
|
||||||
m_searchWidget->setFixedHeight(SEARCH_BAR_SIZE);
|
m_searchWidget->setFixedHeight(SEARCH_BAR_SIZE);
|
||||||
|
|
||||||
mainlayout->addWidget(m_titleFrame);
|
// mainlayout->addWidget(m_titleFrame);
|
||||||
mainlayout->addWidget(m_stackedWidget);
|
|
||||||
mainlayout->addWidget(m_searchWidget);
|
mainlayout->addWidget(m_searchWidget);
|
||||||
|
mainlayout->addWidget(m_stackedWidget);
|
||||||
|
|
||||||
//创建索引询问弹窗
|
//创建索引询问弹窗
|
||||||
m_askDialog = new CreateIndexAskDialog(this);
|
m_askDialog = new CreateIndexAskDialog(this);
|
||||||
|
@ -197,9 +197,9 @@ void MainWindow::initConnections()
|
||||||
});
|
});
|
||||||
connect(m_settingsBtn, &QPushButton::clicked, this, &MainWindow::settingsBtnClickedSlot);
|
connect(m_settingsBtn, &QPushButton::clicked, this, &MainWindow::settingsBtnClickedSlot);
|
||||||
//主题改变时,更新自定义标题栏的图标
|
//主题改变时,更新自定义标题栏的图标
|
||||||
connect(qApp, &QApplication::paletteChanged, this, [ = ]() {
|
// connect(qApp, &QApplication::paletteChanged, this, [ = ]() {
|
||||||
m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(WINDOW_ICON_SIZE, WINDOW_ICON_SIZE)));
|
// m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(WINDOW_ICON_SIZE, WINDOW_ICON_SIZE)));
|
||||||
});
|
// });
|
||||||
connect(m_searchLayout, &SearchBarHLayout::requestSearchKeyword, this, &MainWindow::searchKeywordSlot);
|
connect(m_searchLayout, &SearchBarHLayout::requestSearchKeyword, this, &MainWindow::searchKeywordSlot);
|
||||||
connect(m_stackedWidget, &StackedWidget::effectiveSearch, m_searchLayout, &SearchBarHLayout::effectiveSearchRecord);
|
connect(m_stackedWidget, &StackedWidget::effectiveSearch, m_searchLayout, &SearchBarHLayout::effectiveSearchRecord);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "app-search-plugin.h"
|
#include "app-search-plugin.h"
|
||||||
#include <gio/gdesktopappinfo.h>
|
#include <gio/gdesktopappinfo.h>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QLabel>
|
||||||
using namespace Zeeker;
|
using namespace Zeeker;
|
||||||
size_t AppSearchPlugin::uniqueSymbol = 0;
|
size_t AppSearchPlugin::uniqueSymbol = 0;
|
||||||
QMutex AppSearchPlugin::m_mutex;
|
QMutex AppSearchPlugin::m_mutex;
|
||||||
|
@ -89,6 +91,16 @@ void AppSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AppSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *AppSearchPlugin::previewPage(QString key, int type, QWidget *parent = nullptr)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool AppSearchPlugin::launch(const QString &path)
|
bool AppSearchPlugin::launch(const QString &path)
|
||||||
{
|
{
|
||||||
GDesktopAppInfo * desktopAppInfo = g_desktop_app_info_new_from_filename(path.toLocal8Bit().data());
|
GDesktopAppInfo * desktopAppInfo = g_desktop_app_info_new_from_filename(path.toLocal8Bit().data());
|
||||||
|
|
|
@ -23,6 +23,8 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type);
|
void openAction(int actionkey, QString key, int type);
|
||||||
|
bool isPreviewEnable(QString key, int type);
|
||||||
|
QWidget *previewPage(QString key, int type, QWidget *parent);
|
||||||
private:
|
private:
|
||||||
bool launch(const QString &path);
|
bool launch(const QString &path);
|
||||||
bool addPanelShortcut(const QString &path);
|
bool addPanelShortcut(const QString &path);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "file-search-plugin.h"
|
#include "file-search-plugin.h"
|
||||||
#include "search-manager.h"
|
#include "search-manager.h"
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QHBoxLayout>
|
||||||
using namespace Zeeker;
|
using namespace Zeeker;
|
||||||
|
|
||||||
FileSearchPlugin::FileSearchPlugin(QObject *parent) : QObject(parent)
|
FileSearchPlugin::FileSearchPlugin(QObject *parent) : QObject(parent)
|
||||||
|
@ -65,6 +68,25 @@ void FileSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FileSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *FileSearchPlugin::previewPage(QString key, int type, QWidget *parent)
|
||||||
|
{
|
||||||
|
QWidget *previewPage = new QWidget(parent);
|
||||||
|
QHBoxLayout * previewLyt = new QHBoxLayout(previewPage);
|
||||||
|
previewLyt->setContentsMargins(0, 0, 0, 0);
|
||||||
|
QLabel *label = new QLabel(previewPage);
|
||||||
|
previewLyt->addWidget(label);
|
||||||
|
label->setFixedHeight(120);
|
||||||
|
previewPage->setFixedSize(120,120);
|
||||||
|
previewLyt->setAlignment(Qt::AlignCenter);
|
||||||
|
label->setPixmap(FileUtils::getFileIcon(QUrl::fromLocalFile(key).toString()).pixmap(120,120));
|
||||||
|
return previewPage;
|
||||||
|
}
|
||||||
|
|
||||||
DirSearchPlugin::DirSearchPlugin(QObject *parent) : QObject(parent)
|
DirSearchPlugin::DirSearchPlugin(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
SearchPluginIface::Actioninfo open { 0, tr("Open")};
|
SearchPluginIface::Actioninfo open { 0, tr("Open")};
|
||||||
|
@ -128,6 +150,16 @@ void DirSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DirSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *DirSearchPlugin::previewPage(QString key, int type, QWidget *parent)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
FileContengSearchPlugin::FileContengSearchPlugin(QObject *parent) : QObject(parent)
|
FileContengSearchPlugin::FileContengSearchPlugin(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
SearchPluginIface::Actioninfo open { 0, tr("Open")};
|
SearchPluginIface::Actioninfo open { 0, tr("Open")};
|
||||||
|
@ -188,3 +220,13 @@ void FileContengSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FileContengSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *FileContengSearchPlugin::previewPage(QString key, int type, QWidget *parent)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type = 0);
|
void openAction(int actionkey, QString key, int type = 0);
|
||||||
|
bool isPreviewEnable(QString key, int type);
|
||||||
|
QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_enable = true;
|
bool m_enable = true;
|
||||||
|
@ -48,7 +50,8 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type = 0);
|
void openAction(int actionkey, QString key, int type = 0);
|
||||||
|
bool isPreviewEnable(QString key, int type);
|
||||||
|
QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
||||||
private:
|
private:
|
||||||
bool m_enable = true;
|
bool m_enable = true;
|
||||||
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
||||||
|
@ -71,7 +74,8 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type = 0);
|
void openAction(int actionkey, QString key, int type = 0);
|
||||||
|
bool isPreviewEnable(QString key, int type);
|
||||||
|
QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
||||||
private:
|
private:
|
||||||
bool m_enable = true;
|
bool m_enable = true;
|
||||||
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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
|
||||||
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
#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
|
|
|
@ -41,7 +41,8 @@ public:
|
||||||
virtual void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult) = 0;
|
virtual void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult) = 0;
|
||||||
virtual QList<Actioninfo> getActioninfo(int type) = 0;
|
virtual QList<Actioninfo> getActioninfo(int type) = 0;
|
||||||
virtual void openAction(int actionkey, QString key, int type) = 0;
|
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;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
|
#include <QWidget>
|
||||||
#include "settings-search-plugin.h"
|
#include "settings-search-plugin.h"
|
||||||
#include "file-utils.h"
|
#include "file-utils.h"
|
||||||
using namespace Zeeker;
|
using namespace Zeeker;
|
||||||
|
@ -122,6 +123,16 @@ void SettingsSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SettingsSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *SettingsSearchPlugin::previewPage(QString key, int type, QWidget *parent = nullptr)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SettingsSearchPlugin::xmlElement
|
* @brief SettingsSearchPlugin::xmlElement
|
||||||
* 将xml文件内容读到内存
|
* 将xml文件内容读到内存
|
||||||
|
|
|
@ -22,6 +22,8 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type);
|
void openAction(int actionkey, QString key, int type);
|
||||||
|
bool isPreviewEnable(QString key, int type);
|
||||||
|
QWidget *previewPage(QString key, int type, QWidget *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void xmlElement();
|
void xmlElement();
|
||||||
|
|
Loading…
Reference in New Issue