ukui-search/frontend/control/stack-pages/search-page-section.h

125 lines
3.4 KiB
C++

/*
*
* Copyright (C) 2020, KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Authors: zhangjiaping <zhangjiaping@kylinos.cn>
*
*/
#ifndef SEARCHPAGESECTION_H
#define SEARCHPAGESECTION_H
#include <QScrollArea>
#include <QPaintEvent>
#include <QPainter>
#include <QStyleOption>
#include "result-view.h"
#include "search-plugin-iface.h"
namespace Zeeker {
class ResultArea : public QScrollArea
{
Q_OBJECT
public:
ResultArea(QWidget *parent = nullptr);
~ResultArea() = default;
void appendWidet(ResultWidget *);
void setVisibleList(const QStringList &);
public Q_SLOTS:
void onWidgetSizeChanged();
private:
void initUi();
void setupConnectionsForWidget(ResultWidget *);
QWidget * m_widget = nullptr;
QVBoxLayout * m_mainLyt = nullptr;
QList<ResultWidget *> m_widget_list;
Q_SIGNALS:
void startSearch(const QString &);
void stopSearch();
};
class DetailWidget : public QWidget
{
Q_OBJECT
public:
DetailWidget(QWidget *parent = nullptr);
~DetailWidget() = default;
void clear();
public Q_SLOTS:
void setWidgetInfo(const QString &plugin_name, const SearchPluginIface::ResultInfo &info);
void updateDetailPage(const QString &plugin_name, const SearchPluginIface::ResultInfo &info);
protected:
void paintEvent(QPaintEvent *event);
private:
void initUi();
void clearLayout(QLayout *);
QVBoxLayout * m_mainLyt = nullptr;
QString m_currentPluginId;
QWidget *m_detailPage = nullptr;
// QLabel * m_iconLabel = nullptr;
// QFrame *m_previewFrame = nullptr;
// QHBoxLayout *m_previewFrameLyt = nullptr;
// QFrame * m_nameFrame = nullptr;
// QHBoxLayout * m_nameFrameLyt = nullptr;
// QLabel * m_nameLabel = nullptr;
// QLabel * m_pluginLabel = nullptr;
// QFrame * m_line_1 = nullptr;
// QFrame * m_descFrame = nullptr;
// QVBoxLayout * m_descFrameLyt = nullptr;
// QFrame * m_line_2 = nullptr;
// QFrame * m_actionFrame = nullptr;
// QVBoxLayout * m_actionFrameLyt = nullptr;
};
class DetailArea : public QScrollArea
{
Q_OBJECT
public:
DetailArea(QWidget *parent = nullptr);
~DetailArea() = default;
private:
void initUi();
DetailWidget * m_detailWidget = nullptr;
Q_SIGNALS:
void setWidgetInfo(const QString&, const SearchPluginIface::ResultInfo&);
};
//class ActionLabel : public QLabel
//{
// Q_OBJECT
//public:
// ActionLabel(const QString &action, const QString &key, const int &ActionKey, const QString &pluginId, const int type = 0, QWidget *parent = nullptr);
// ~ActionLabel() = default;
//private:
// void initUi();
// QString m_action;
// QString m_key;
// int m_actionKey;
// int m_type = 0;
// QString m_pluginId;
//protected:
// bool eventFilter(QObject *, QEvent *);
//};
}
#endif // SEARCHPAGESECTION_H