One, foreword
This is the biggest change made to the video surveillance system recently. It uses QMainWindow to dock the form and hover the form, which greatly enhances the extendability. Various small modules in the main interface all use the hover module, and finally different working modes and different running states (full screen state, normal state) are saved into different layouts. Layout plan follow visual screen processing mode in the system, it is because of the time the system stops form layout experience, the successful experience of transplanted into video monitoring system, a proven and after unanimous favorable comment of user experience, just also can solve different work modes corresponding to different flexible loading module of incurable diseases.
The main interface of the system is designed with QMainWindow docking form mode, so that a variety of sub-modules can be customized to dock and float, different working modes can correspond to different modules, and even can be expanded into different user rights corresponding to different main interface modules. All submodules are new, and any number are supported. By default, QMainWindow generates a right-click menu of the module name in the title bar of the hover module QDockWidget, so that you can freely control whether each submodule is visible or not. However, this feature is only available in the title bar of fixed embedded modules, not in the hover module. Means that if there is no a module in embedded parked state, displayed a hidden, can’t switch modules in order to solve this problem, specially according to the load of itself and module generates a menu in the title bar, at the same time also increased the show all modules, hide all module, save the current general layout, the layout and reset reset full screen layout menu.
Two, functions and features
(1) Software module
- Video surveillance module, various docking small form submodules, including equipment list, graphic alarm, window information, PTC control, preset position, cruise setting, equipment control, suspension map, web browsing, etc.
- Video playback module, including local playback, remote playback, device playback, picture playback, and video upload.
- Electronic map module, including picture map, online map, offline map, path planning and so on.
- Log query module, including local logs and device logs.
- System setting module, including system Settings (basic Settings, video parameters, database Settings, map configuration, serial port configuration, etc.), VCR management, camera management, polling configuration, user management, etc.
(2) Basic functions
- Support all kinds of video streams (RTSP, RTMP, HTTP, etc.), video files (MP4, RMVB, AVI, etc.), local USB camera playback.
- Supports multi-screen switching, including 1, 4, 6, 8, 9, 13, 16, 25, 36, 64 screen switching.
- Supports full-screen switching, including the right mouse button menu, toolbar buttons, and shortcut keys (Alt + Enter full-screen, esc exit full-screen).
- Supports video polling, including 1, 4, 9, and 16 screen polling. You can set polling groups (polling plan), polling interval, and bit stream types.
- Supports the ONVIF protocol, including device search, PTZ control, and device control (picture parameters, check time, system restart, and picture capture).
- Supports permission management. Different users have different permissions for modules, such as deleting logs and shutting down the system.
- Multiple databases are supported, including SQLite, mysql, SQLServer, PostgresQL, Oracle, and CNPC.
- You can set parameters such as resolution and frame rate for a local USB camera.
- All the docked modules automatically generate the corresponding menu to control the display and hide, right-click the title bar can be popup.
- You can display or hide all modules, reset the normal layout, or reset the full-screen layout.
- Double-click the device to display real-time preview videos, including picture maps, online maps, and offline maps.
- Drag the camera node to the corresponding form to play the video. You can also drag the local file to play the video directly.
- You can delete a video from the right mouse button, close the hover bar, or drag it outside the video monitoring panel.
- The device button on the picture map can be dragged freely to automatically save the location information. On the Baidu map, you can click to obtain the latitude and longitude information to update the device location.
- Any channel in the form of the video monitoring panel supports drag exchange and instant response.
- Encapsulating Baidu map, view switching, motion trajectory, device point, click the mouse to obtain latitude and longitude.
- Double click the node, drag the node, drag the form to change the position and other operations, are automatically updated and saved the last play address, the next software open automatic application.
- Lower right volume bar control, automatically hidden when losing focus, volume band mute icon.
- Support video capture, you can specify a single or all channel capture, the bottom toolbar also has a screenshot button.
- Supports automatic hiding of the mouse pointer and automatic full screen after timeout.
- Support onVIF PTZ control, can move PTZ camera up, down, left and right, including reset and focus adjustment.
- Support any ONVIF camera, including but not limited to Hikon, Dahua, Yusee, Tiandi weiye, Huawei, etc.
- Can save the video, can select the storage or single file storage, optional storage interval.
- The video stream communication mode can be set to TCP + UDP, and the video decoding mode can be set to speed first, quality first, balance, etc.
- You can set the software name in Chinese, English, and LOGO.
- The stored video files can be exported to a specified directory and uploaded to the server in batches.
(3) Features
- The main interface adopts the mode of docked form, and various components are added in the form of small modules, and any modules can be customized.
- The docking module can be dragged to any position to embed and hover, support maximum full screen, support multi-screen.
- Dual layout file storage mechanism, normal mode, full screen mode correspond to different layout scheme, automatic switching and saving, such as the full screen mode can highlight several modules transparent display in the specified position, more science fiction sense of modernization.
- The original ONVIF protocol mechanism, using the underlying protocol parsing (UDP broadcast search + HTTP request execution command) is more lightweight, easy to learn and expand, do not rely on any third-party components such as GSOAP.
- Original data import and export mechanism, cross-platform does not depend on any components, instantaneous data export.
- Built-in multiple original components, the universe value is super awesome, It includes data import and export components (export to XLS, PDF, print), database components (database management thread, automatic data cleaning thread, universal paging, data request, etc.), map components, video monitoring components, file multi-threaded transceiver components, ONVIF communication components, general browser kernel components, etc.
- Custom information box, error box, query box, and message box (in various formats) in the lower right corner.
- Exquisite skin peels, up to 17 sets of skin styles can be changed at will, all styles are unified, including menu, etc.
- Multiple buttons can be added to the video control hover bar, and buttons can also be added to the small toolbar at the bottom of the monitoring interface.
- Double click the camera node to automatically play the video, double click the node to automatically add the video, will automatically jump to the next, double click the parent node to automatically add all the videos under this node. Primary stream and substream are optional.
- VCR management and camera management: You can add, delete, modify, import or export printed information. The new device information is immediately applied to generate a tree list without restarting the system.
- Optional a variety of kernel free switching, FFMPEG, VLC, MPV, etc., can be set in pro. It is recommended to use FFMPEG, the most cross-platform, default to provide a good Linux and MAC platform compiled library.
- Support hard decoding, can set the hard decoding type (QSV, DXVA2, D3D11VA, etc.).
- Opengl rendering video by default, ultra low CPU resource occupation, support yuYV and NV12 two formats, very cow force.
- Highly customizable, users can easily derive their own functions on this basis, such as adding custom modules, operating modes, robot monitoring, uav monitoring, excavator monitoring, etc.
- Support XP, Win7, Win10, Linux, MAC, a variety of domestic systems (UOS, Kirin, Galaxy, etc.), embedded Linux and other systems.
- Complete comments, clear project structure, super detailed complete use of the development manual, down to the function of each code file, continuous iterations.
Three, experience address
- Experience address: pan.baidu.com/s/1d7TH_GEY… Extract code: 01JF File name: bin_video_system.zip.
- Domestic website: gitee.com/feiyangqing…
- International site: github.com/feiyangqing…
- Profile: blog.csdn.net/feiyangqing…
- Zhihu homepage: www.zhihu.com/people/feiy…
- Online documentation: feiyangqingyun. Gitee. IO/qwidgetdemo…
Four, the effect diagram
5. Core code
void frmModule::initWidget(a)
{
// Clear the list
this->dockWidgets.clear(a);this->dockWidths.clear(a);this->dockHeights.clear(a);// Dock form default size. Most modules follow this size
int width = 220;
int height = 500;
// Load different modules according to different working modes
// You can change the corresponding name
if (AppConfig::WorkMode == 1) {
frmDeviceGps *deviceGps = new frmDeviceGps;
frmRobotData *robotData = new frmRobotData;
connect(robotData, SIGNAL(moveDevice(int, QString, QString)),
deviceGps, SLOT(moveDevice(int, QString, QString)));
newWidget(new frmDeviceTree, "Device List", width, height);
newWidget(new frmMsgTable, "Window information", width, 200);
newWidget(deviceGps, "Equipment track", width, 200);
newWidget(robotData, "Simulation data", width, height);
newWidget(new frmRobotDebug2, "Data debugging", width, height);
newWidget(new frmRobotEmulate, "Motion Simulation", width, height);
} else if (AppConfig::WorkMode == 2) {
newWidget(new frmMsgList, "Graphic alert", width, height);
newWidget(new frmMsgTable, "Window information", width, 200);
newWidget(new frmDeviceGps, "Flight path.", width, 200);
newWidget(new frmIpcPtz, "Cradle head control", width, height);
newWidget(new frmDeviceTree, "Device List", width, height);
} else {
newWidget(new frmMsgList, "Graphic alert", width, height);
newWidget(new frmMsgTable, "Window information", width, 200);
newWidget(new frmDeviceGps, "Floating map", width, 250);
newWidget(new frmDeviceTree, "Device List", width, height);
newWidget(new frmIpcPtz, "Cradle head control", width, height);
newWidget(new frmIpcControl, "Equipment control", width, height);
newWidget(new frmIpcPreset, "Preset cruise", width, height);
}
#if 0
// Demonstrate loading the web browsing module
frmWebView *webView = new frmWebView;
webView->resize(400.300);
//webView->setUrl("http://www.qtcn.org/");
webView->setUrl("http://data.fengmap.cn:1024/yz/connect/DEMO/%E6%A8%A1%E5%9E%8B3D/DEMO%E4%B8%89%E7%BB%B41/20180611_%E5%94%90%E5%B1%B1%E5 %B7%A5%E4%BA%BA%E5%8C%BB%E9%99%A2_241902");
QDockWidget *dockWebView = newWidget(webView, "Web Browsing", width, height);
// Set the current submodule fixed size
dockWebView->setFixedSize(800.600);
dockWebView->setProperty("FixedSize".true);
// Add to the docked layout
addWidget(dockWebView, 0);
#endif
#if 0
// Demo independent video monitoring form, multi-screen
frmVideoPanel *videoPanel2 = new frmVideoPanel;
videoPanel2->resize(400.300);
QDockWidget *dockVideoPanel = newWidget(videoPanel2, "Image Monitoring", width, height);
// Add to the docked layout
addWidget(dockVideoPanel, 0);
#endif
// Instantiate the video surveillance channel screen
frmVideoPanel *videoPanel = new frmVideoPanel;
videoPanel->setObjectName("centralWidget_frmVideoPanel");
// Set the center form
this->setCentralWidget(videoPanel);
// Set the docking parameters to allow no overlap, only drag
//this->setDockOptions(QMainWindow::AnimatedDocks);
}
QDockWidget *frmModule::newWidget(QWidget *widget, const QString &title, int width, int height)
{
// Set stretch strategy
//widget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
// Instantiate the docked form
QString objName = widget->objectName(a); QDockWidget *dockWidget =new QDockWidget;
dockWidget->setObjectName("dockWidget_" + objName);
dockWidget->setWindowTitle(title);
dockWidget->setWidget(widget);
// This controls the transparency of the docked form. The transparency effect is visible when it is stripped out and suspended
dockWidget->setWindowOpacity((qreal)AppConfig::WindowOpacity / 100);
// Customizes the docked window title bar
CustomTitleBar *titleBar = new CustomTitleBar;
titleBar->setObjectName("titleBar_" + objName);
titleBar->setFull(false);
titleBar->setTitle(title);
dockWidget->setTitleBarWidget(titleBar);
connect(dockWidget, SIGNAL(visibilityChanged(bool)), this.SLOT(visibilityChanged(bool)));
// The operator cannot do anything about a docked form
if (AppData::CurrentUserType == "Operator") {
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
}
// Set to allow left and right docking only
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
dockWidgets << dockWidget;
dockWidths << width;
dockHeights << height;
return dockWidget;
}
void frmModule::addWidget(a)
{
// Adjust the position of the module according to different working modes
// There is an order required to apply transparency. It seems to be from right to left
if (AppConfig::WorkMode == 1) {
// Add the right form
addWidget(2.1);
addWidget(3.1);
addWidget(4.1);
addWidget(5.1);
// Add the left side form
addWidget(0.0);
addWidget(1.0);
// Merge forms to form tabs
this->tabifyDockWidget(dockWidgets.at(3), dockWidgets.at(4));
this->tabifyDockWidget(dockWidgets.at(4), dockWidgets.at(5));
} else if (AppConfig::WorkMode == 2) {
// Add the right form
addWidget(2.1);
addWidget(3.1);
addWidget(4.1);
// Add the left side form
addWidget(0.0);
addWidget(1.0);
} else {
// Add the right form
addWidget(3.1);
addWidget(4.1);
addWidget(6.1);
// Add the left side form
addWidget(2.0);
addWidget(0.0);
addWidget(1.0);
addWidget(5.0);
// Merge forms to form tabs
this->tabifyDockWidget(dockWidgets.at(1), dockWidgets.at(5));
this->tabifyDockWidget(dockWidgets.at(4), dockWidgets.at(6)); }}void frmModule::addWidget(int index, int position)
{
if (index < dockWidgets.count()) {
addWidget(dockWidgets.at(index), position); }}void frmModule::addWidget(QDockWidget *widget, int position)
{
// Set the docking position
Qt::DockWidgetArea area;
if (position == 0) {
area = Qt::LeftDockWidgetArea;
} else if (position == 1) {
area = Qt::RightDockWidgetArea;
} else if (position == 2) {
area = Qt::TopDockWidgetArea;
} else if (position == 3) {
area = Qt::BottomDockWidgetArea;
} else {
area = Qt::AllDockWidgetAreas;
}
this->addDockWidget(area, widget);
}
Copy the code