2021-05-27 21:10:11 +08:00
|
|
|
#ifndef FILESEARCHPLUGIN_H
|
|
|
|
#define FILESEARCHPLUGIN_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QThreadPool>
|
2021-07-31 16:12:04 +08:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QFrame>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QAction>
|
2021-05-27 21:10:11 +08:00
|
|
|
|
|
|
|
#include "libsearch_global.h"
|
|
|
|
#include "search-plugin-iface.h"
|
|
|
|
#include "common.h"
|
2021-07-31 16:12:04 +08:00
|
|
|
#include "action-label.h"
|
2021-05-27 21:10:11 +08:00
|
|
|
namespace Zeeker {
|
|
|
|
//internal plugin
|
|
|
|
class LIBSEARCH_EXPORT FileSearchPlugin : public QObject, public SearchPluginIface
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
FileSearchPlugin(QObject *parent = nullptr);
|
|
|
|
PluginType pluginType() {return PluginType::SearchPlugin;}
|
|
|
|
const QString name();
|
|
|
|
const QString description();
|
|
|
|
const QIcon icon() {return QIcon::fromTheme("folder");}
|
|
|
|
void setEnable(bool enable) {m_enable = enable;}
|
|
|
|
bool isEnable() {return m_enable;}
|
|
|
|
QString getPluginName();
|
|
|
|
|
|
|
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
|
|
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
2021-06-17 14:08:55 +08:00
|
|
|
void openAction(int actionkey, QString key, int type = 0);
|
2021-07-31 16:12:04 +08:00
|
|
|
// bool isPreviewEnable(QString key, int type);
|
|
|
|
// QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
|
|
|
QWidget *detailPage(const ResultInfo &ri);
|
2021-05-27 21:10:11 +08:00
|
|
|
|
|
|
|
private:
|
2021-07-31 16:12:04 +08:00
|
|
|
void initDetailPage();
|
|
|
|
QString m_currentActionKey;
|
|
|
|
QWidget *m_detailPage;
|
|
|
|
QVBoxLayout *m_detailLyt = nullptr;
|
|
|
|
QLabel *m_iconLabel = nullptr;
|
|
|
|
QFrame *m_nameFrame = nullptr;
|
|
|
|
QHBoxLayout *m_nameFrameLyt = nullptr;
|
|
|
|
QLabel *m_nameLabel = nullptr;
|
|
|
|
QLabel *m_pluginLabel = nullptr;
|
|
|
|
QFrame *m_line_1 = nullptr;
|
|
|
|
QFrame *m_pathFrame = nullptr;
|
|
|
|
QLabel *m_pathLabel1 = nullptr;
|
|
|
|
QLabel *m_pathLabel2 = nullptr;
|
|
|
|
QHBoxLayout *m_pathFrameLyt = nullptr;
|
|
|
|
QFrame *m_timeFrame = nullptr;
|
|
|
|
QLabel *m_timeLabel1 = nullptr;
|
|
|
|
QLabel *m_timeLabel2 = nullptr;
|
|
|
|
QHBoxLayout *m_timeFrameLyt = nullptr;
|
|
|
|
|
|
|
|
QFrame *m_line_2 = nullptr;
|
|
|
|
QFrame *m_actionFrame = nullptr;
|
|
|
|
QVBoxLayout *m_actionFrameLyt = nullptr;
|
|
|
|
ActionLabel *m_actionLabel1 = nullptr;
|
|
|
|
ActionLabel *m_actionLabel2 = nullptr;
|
|
|
|
ActionLabel *m_actionLabel3 = nullptr;
|
|
|
|
|
|
|
|
QVBoxLayout * m_actionLyt = nullptr;
|
|
|
|
|
2021-05-27 21:10:11 +08:00
|
|
|
bool m_enable = true;
|
|
|
|
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
|
|
|
QThreadPool m_pool;
|
|
|
|
};
|
|
|
|
|
|
|
|
class LIBSEARCH_EXPORT DirSearchPlugin : public QObject, public SearchPluginIface
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DirSearchPlugin(QObject *parent = nullptr);
|
|
|
|
PluginType pluginType() {return PluginType::SearchPlugin;}
|
|
|
|
const QString name();
|
|
|
|
const QString description();
|
|
|
|
const QIcon icon() {return QIcon::fromTheme("folder");}
|
|
|
|
void setEnable(bool enable) {m_enable = enable;}
|
|
|
|
bool isEnable() {return m_enable;}
|
|
|
|
QString getPluginName();
|
|
|
|
|
|
|
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
|
|
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
2021-06-17 14:08:55 +08:00
|
|
|
void openAction(int actionkey, QString key, int type = 0);
|
2021-07-31 16:12:04 +08:00
|
|
|
// bool isPreviewEnable(QString key, int type);
|
|
|
|
// QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
|
|
|
QWidget *detailPage(const ResultInfo &ri);
|
2021-05-27 21:10:11 +08:00
|
|
|
private:
|
2021-07-31 16:12:04 +08:00
|
|
|
void initDetailPage();
|
|
|
|
QWidget *m_detailPage = nullptr;
|
|
|
|
QString m_currentActionKey;
|
|
|
|
QVBoxLayout *m_detailLyt = nullptr;
|
|
|
|
QLabel *m_iconLabel = nullptr;
|
|
|
|
QFrame *m_nameFrame = nullptr;
|
|
|
|
QHBoxLayout *m_nameFrameLyt = nullptr;
|
|
|
|
QLabel *m_nameLabel = nullptr;
|
|
|
|
QLabel *m_pluginLabel = nullptr;
|
|
|
|
QFrame *m_line_1 = nullptr;
|
|
|
|
QFrame *m_pathFrame = nullptr;
|
|
|
|
QLabel *m_pathLabel1 = nullptr;
|
|
|
|
QLabel *m_pathLabel2 = nullptr;
|
|
|
|
QHBoxLayout *m_pathFrameLyt = nullptr;
|
|
|
|
QFrame *m_timeFrame = nullptr;
|
|
|
|
QLabel *m_timeLabel1 = nullptr;
|
|
|
|
QLabel *m_timeLabel2 = nullptr;
|
|
|
|
QHBoxLayout *m_timeFrameLyt = nullptr;
|
|
|
|
|
|
|
|
QFrame *m_line_2 = nullptr;
|
|
|
|
QFrame *m_actionFrame = nullptr;
|
|
|
|
QVBoxLayout *m_actionFrameLyt = nullptr;
|
|
|
|
ActionLabel *m_actionLabel1 = nullptr;
|
|
|
|
ActionLabel *m_actionLabel2 = nullptr;
|
|
|
|
ActionLabel *m_actionLabel3 = nullptr;
|
|
|
|
|
|
|
|
QVBoxLayout * m_actionLyt = nullptr;
|
|
|
|
|
2021-05-27 21:10:11 +08:00
|
|
|
bool m_enable = true;
|
|
|
|
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
|
|
|
QThreadPool m_pool;
|
|
|
|
};
|
|
|
|
|
|
|
|
class LIBSEARCH_EXPORT FileContengSearchPlugin : public QObject, public SearchPluginIface
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
FileContengSearchPlugin(QObject *parent = nullptr);
|
|
|
|
PluginType pluginType() {return PluginType::SearchPlugin;}
|
|
|
|
const QString name();
|
|
|
|
const QString description();
|
|
|
|
const QIcon icon() {return QIcon::fromTheme("folder");}
|
|
|
|
void setEnable(bool enable) {m_enable = enable;}
|
|
|
|
bool isEnable() {return m_enable;}
|
|
|
|
QString getPluginName();
|
|
|
|
|
|
|
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
|
|
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
2021-06-17 14:08:55 +08:00
|
|
|
void openAction(int actionkey, QString key, int type = 0);
|
2021-07-31 16:12:04 +08:00
|
|
|
// bool isPreviewEnable(QString key, int type);
|
|
|
|
// QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
|
|
|
QWidget *detailPage(const ResultInfo &ri);
|
|
|
|
QString getHtmlText(const QString & text, const QString & keyword);
|
2021-05-27 21:10:11 +08:00
|
|
|
private:
|
2021-07-31 16:12:04 +08:00
|
|
|
void initDetailPage();
|
|
|
|
QWidget *m_detailPage = nullptr;
|
|
|
|
QString m_currentActionKey;
|
|
|
|
QVBoxLayout *m_detailLyt = nullptr;
|
|
|
|
QLabel *m_iconLabel = nullptr;
|
|
|
|
QFrame *m_nameFrame = nullptr;
|
|
|
|
QHBoxLayout *m_nameFrameLyt = nullptr;
|
|
|
|
QLabel *m_nameLabel = nullptr;
|
|
|
|
QLabel *m_pluginLabel = nullptr;
|
|
|
|
QFrame *m_line_1 = nullptr;
|
|
|
|
QLabel *m_snippetLabel = nullptr;
|
|
|
|
QFrame *m_pathFrame = nullptr;
|
|
|
|
QLabel *m_pathLabel1 = nullptr;
|
|
|
|
QLabel *m_pathLabel2 = nullptr;
|
|
|
|
QHBoxLayout *m_pathFrameLyt = nullptr;
|
|
|
|
QFrame *m_timeFrame = nullptr;
|
|
|
|
QLabel *m_timeLabel1 = nullptr;
|
|
|
|
QLabel *m_timeLabel2 = nullptr;
|
|
|
|
QHBoxLayout *m_timeFrameLyt = nullptr;
|
|
|
|
|
|
|
|
QFrame *m_line_2 = nullptr;
|
|
|
|
QFrame *m_actionFrame = nullptr;
|
|
|
|
QVBoxLayout *m_actionFrameLyt = nullptr;
|
|
|
|
ActionLabel *m_actionLabel1 = nullptr;
|
|
|
|
ActionLabel *m_actionLabel2 = nullptr;
|
|
|
|
ActionLabel *m_actionLabel3 = nullptr;
|
|
|
|
|
|
|
|
QVBoxLayout * m_actionLyt = nullptr;
|
|
|
|
QString m_keyWord;
|
2021-05-27 21:10:11 +08:00
|
|
|
bool m_enable = true;
|
|
|
|
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
|
|
|
QThreadPool m_pool;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // FILESEARCHPLUGIN_H
|