2021-11-09 12:39:42 +00:00
|
|
|
|
#ifndef VIDEOBOX_H
|
|
|
|
|
#define VIDEOBOX_H
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 监控画面切换控件 作者:feiyangqingyun(QQ:517216493) 2021-11-08
|
|
|
|
|
* 1. 将所有通道切换处理全部集中到一个类。
|
2023-12-23 05:30:26 +00:00
|
|
|
|
* 2. 通用整数倍数布局切换函数,比如4x4/5x5,可方便拓展到100/255通道等。
|
|
|
|
|
* 3. 通用行列数量布局切换函数,比如1x4/4x2,可方便拓展各种axb行列数。
|
|
|
|
|
* 4. 通用特殊异形布局切换函数,可以参考进行自定义异形布局。
|
|
|
|
|
* 5. 提供添加行列数布局函数。
|
|
|
|
|
* 6. 通道布局切换发出信号通知。
|
|
|
|
|
* 7. 可控每种布局切换菜单是否启用。
|
|
|
|
|
* 8. 支持自定义子菜单布局内容。
|
|
|
|
|
* 9. 支持设置对应的菜单标识比如默认的通道字样改成设备。
|
2021-11-09 12:39:42 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QMap>
|
|
|
|
|
|
|
|
|
|
class QMenu;
|
|
|
|
|
class QWidget;
|
|
|
|
|
class QGridLayout;
|
|
|
|
|
|
|
|
|
|
#ifdef quc
|
|
|
|
|
class Q_DECL_EXPORT VideoBox : public QObject
|
|
|
|
|
#else
|
|
|
|
|
class VideoBox : public QObject
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit VideoBox(QObject *parent = 0);
|
|
|
|
|
|
|
|
|
|
private:
|
2024-02-26 02:34:39 +00:00
|
|
|
|
//最大通道数量
|
|
|
|
|
int maxCount;
|
|
|
|
|
//当前布局类型
|
|
|
|
|
QString layoutType;
|
|
|
|
|
|
2021-11-09 12:39:42 +00:00
|
|
|
|
//表格布局存放通道
|
|
|
|
|
QGridLayout *gridLayout;
|
|
|
|
|
//视频控件集合
|
|
|
|
|
QWidgetList widgets;
|
|
|
|
|
|
|
|
|
|
//主菜单子菜单文字标识
|
|
|
|
|
QString menuFlag;
|
|
|
|
|
QString actionFlag;
|
|
|
|
|
|
2023-12-23 05:30:26 +00:00
|
|
|
|
//可以控制每个子菜单是否可见
|
|
|
|
|
QList<bool> visibles;
|
|
|
|
|
|
2021-11-09 12:39:42 +00:00
|
|
|
|
//布局方案标识集合
|
2023-12-06 11:15:52 +00:00
|
|
|
|
QMap<QString, QStringList> types;
|
|
|
|
|
void addMenu(QMenu *menu, const QString &type);
|
2021-11-09 12:39:42 +00:00
|
|
|
|
|
2023-12-23 05:30:26 +00:00
|
|
|
|
private:
|
|
|
|
|
//常规及异形通道布局
|
2024-02-26 02:34:39 +00:00
|
|
|
|
void change_layout_normal(int index, int row, int column);
|
|
|
|
|
void change_layout_custom(int index, int type);
|
2023-12-23 05:30:26 +00:00
|
|
|
|
|
|
|
|
|
//设置可见
|
2024-02-26 02:34:39 +00:00
|
|
|
|
void change_layout_visible(int start, int end);
|
2023-12-23 05:30:26 +00:00
|
|
|
|
|
|
|
|
|
//异形布局(l表示右侧底部环绕布局/o表示上下左右环绕布局)
|
2024-02-26 02:34:39 +00:00
|
|
|
|
void change_layout_l(const QList<int> &indexs);
|
|
|
|
|
void change_layout_o(const QList<int> &indexs);
|
2023-12-23 05:30:26 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2024-02-26 02:34:39 +00:00
|
|
|
|
//获取和设置当前布局类型
|
|
|
|
|
QString getLayoutType() const;
|
|
|
|
|
void setLayoutType(const QString &layoutType);
|
2023-12-06 11:15:52 +00:00
|
|
|
|
|
|
|
|
|
//获取和设置视频控件集合
|
|
|
|
|
QWidgetList getWidgets() const;
|
2021-11-09 12:39:42 +00:00
|
|
|
|
void setWidgets(QWidgetList widgets);
|
|
|
|
|
|
2023-12-06 11:15:52 +00:00
|
|
|
|
//设置表格布局
|
|
|
|
|
void setLayout(QGridLayout *gridLayout);
|
2023-07-15 00:58:15 +00:00
|
|
|
|
|
2021-11-09 12:39:42 +00:00
|
|
|
|
//设置主菜单子菜单文字标识
|
|
|
|
|
void setMenuFlag(const QString &menuFlag);
|
|
|
|
|
void setActionFlag(const QString &actionFlag);
|
|
|
|
|
|
2023-12-23 05:30:26 +00:00
|
|
|
|
//设置子菜单可见
|
|
|
|
|
void setVisibles(const QList<bool> &visibles);
|
2021-11-09 12:39:42 +00:00
|
|
|
|
|
2023-12-23 05:30:26 +00:00
|
|
|
|
//添加行列布局(必须在initMenu前调用)
|
|
|
|
|
void appendType(int index, int row, int column);
|
|
|
|
|
//初始化菜单
|
|
|
|
|
void initMenu(QMenu *menu);
|
2021-11-09 12:39:42 +00:00
|
|
|
|
|
2023-12-23 05:30:26 +00:00
|
|
|
|
public Q_SLOTS:
|
2021-11-09 12:39:42 +00:00
|
|
|
|
//显示和隐藏所有通道
|
2024-02-26 02:34:39 +00:00
|
|
|
|
void show_all();
|
|
|
|
|
void hide_all();
|
2021-11-09 12:39:42 +00:00
|
|
|
|
|
2023-12-23 05:30:26 +00:00
|
|
|
|
//菜单切换布局槽函数
|
2024-02-26 02:34:39 +00:00
|
|
|
|
void change_layout();
|
|
|
|
|
void change_layout(int type, int index);
|
2023-12-06 11:15:52 +00:00
|
|
|
|
|
2023-12-23 05:30:26 +00:00
|
|
|
|
//自定义布局通道切换函数
|
2024-02-26 02:34:39 +00:00
|
|
|
|
void change_layout_y_1_2(int index);
|
|
|
|
|
void change_layout_y_1_3(int index);
|
|
|
|
|
void change_layout_y_1_5(int index);
|
|
|
|
|
void change_layout_y_1_8(int index);
|
|
|
|
|
void change_layout_y_1_9(int index);
|
|
|
|
|
void change_layout_y_1_10(int index);
|
|
|
|
|
void change_layout_y_1_12(int index);
|
|
|
|
|
void change_layout_y_1_16(int index);
|
2021-11-09 12:39:42 +00:00
|
|
|
|
|
2023-12-23 05:30:26 +00:00
|
|
|
|
//常规布局通道切换函数
|
2024-02-26 02:34:39 +00:00
|
|
|
|
void change_layout_1(int index);
|
|
|
|
|
void change_layout_4(int index);
|
|
|
|
|
void change_layout_6(int index);
|
|
|
|
|
void change_layout_8(int index);
|
|
|
|
|
void change_layout_9(int index);
|
|
|
|
|
void change_layout_13(int index);
|
|
|
|
|
void change_layout_16(int index);
|
|
|
|
|
void change_layout_25(int index);
|
|
|
|
|
void change_layout_36(int index);
|
|
|
|
|
void change_layout_64(int index);
|
2021-11-09 12:39:42 +00:00
|
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
|
//画面布局切换信号
|
2024-02-26 02:34:39 +00:00
|
|
|
|
void changeLayout(int type, const QString &layoutType, bool max);
|
2021-11-09 12:39:42 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // VIDEOBOX_H
|