One, foreword

Recently after the UI is big refactoring, many separation of functions in the form of a separate module, embedded in the form of hovering forms or suspended in the main form, this approach greatly enhanced the expansibility of the system, and the client what to want what modules to open module, placed in the appropriate location, layout scheme will automatically save, Different hover modules can also be loaded for different working modes. Has a lot of software is this kind of organization form, such as the universe first VS development tools, the dock is a variety of forms, for the first time when you use the VS, think it is fun, drag about can also be automatically merged, admire the designers at the outset, placed inside limited space more functional operation panel form, but also is very flexible, arbitrary drag cross combination.

The most basic docking module in the video surveillance system must be the device list. Looking at all kinds of video surveillance systems, such as hikon Dahua’s monitoring system client software, there is a device tree list, and different levels can be added. Generally, NVR is the upper level, and many IPC cameras are hung below NVR. In do is every camera has a detailed point of the main stream, stream, the third stream and so on, the user can choose a variety of ways to open the camera, such as NVR double-click the parent node is automatically open all the video camera under the node, double-click on a single camera is automatically open the video camera, the default is based on the system Settings to set the default stream, Generally, it is a sub-code stream. You can also manually drag the main code stream or sub-code stream under the camera to open the corresponding video stream.

In the corresponding equipment list, general also increases the right-click menu for quick operation, such as start intercom, output control all, refresh, refresh, etc., the start intercom, output control of this system does not implement function, because the SDK or gb need different manufacturers to achieve, as to refresh the channel refers to the currently selected channel to open, Refresh all of it is to point to will all open channel open again and again after the video parameters setting in the system Settings, only before open the parameter of the application, if it is already open the video is not application parameters, all immediately if you need a thorough application parameters without restart program is you just need to refresh everything here, such as video storage function.

Two, functional characteristics

(1) Software module

  1. Video monitoring module, various docking small window sub-module, including device list, graphic warning, window information, panyt control, preset position, cruise setting, device control, floating map, web browsing, etc.
  2. Video playback module, including local playback, remote playback, device playback, picture playback, video upload, etc.
  3. Electronic map module, including picture map, online map, offline map, path planning, etc.
  4. Log query module, including local logs, device logs, etc.
  5. System setting module, including system Settings (basic Settings, video parameters, database Settings, map configuration, serial port configuration, etc.), VIDEO recorder management, camera management, polling configuration, user management, etc.

(2) Basic functions

  1. Support various video streams (RTSP, RTMP, HTTP, etc.), video files (MP4, RMVB, AVI, etc.), local USB camera playback.
  2. Support multi-screen switching, including 1, 4, 6, 8, 9, 13, 16, 25, 36, 64 screen switching.
  3. Supports full-screen switching, including the right mouse button, toolbar button, and shortcut keys (Alt + Enter full-screen, esc exit full-screen).
  4. Supports video polling, including 1, 4, 9, and 16 screen polling. You can set polling group (polling plan), polling interval, and bit stream type.
  5. Supports the OnVIF protocol, including device search, pte control, device control (picture parameters, check time, system restart, capture pictures, etc.).
  6. Different users can have different module permissions, such as deleting logs and shutting down the system.
  7. Support a variety of databases, including sqlite, mysql, sqlserver, postgresql, oracle, rendajincang and so on.
  8. You can set resolution and frame rate for a local USB camera.
  9. All docking modules automatically generate corresponding menus to control the display and hide, in the title bar right click can pop up.
  10. Display all modules, hide all modules, reset the common layout, and reset the full-screen layout.
  11. Double-click the device to pop up real-time preview video, supporting picture map, online map, offline map, etc.
  12. The camera node can be dragged to the corresponding window to play the video, and the local file can be dragged to play the video.
  13. You can delete a video by right-clicking the mouse button, closing the floating bar, or dragging it outside the video surveillance panel.
  14. The device button on the picture map can be dragged freely to automatically save the location information. You can click the mouse to obtain the longitude and latitude information on the Baidu map to update the location of the device.
  15. Any channel in the video surveillance panel form supports drag exchange, instant response.
  16. Encapsulated Baidu map, view switch, movement track, equipment point, mouse click to obtain latitude and longitude.
  17. Double-click the node, drag the node, drag the window to switch positions and other operations, will automatically update and save the last playing address, the next software open automatic application.
  18. Volume bar control in the lower right corner, automatically hide when losing focus, volume strip mute icon.
  19. You can specify a screenshot for a single channel or all channels. The screenshot button is also available on the bottom toolbar.
  20. The mouse pointer can be automatically hidden when timeout expires and the mouse pointer can be automatically displayed in full screen.
  21. Support onVIF PTZ control, can move PTZ camera up, down, left and right, including reset and focal length adjustment.
  22. Support any ONVIF camera, including but not limited to Hikang, Dahua, Yushi, Weiye, Huawei, etc.
  23. Can save video, can select the time storage or single file storage, optional storage interval time.
  24. Video stream communication mode can be set TCP + UDP, video decoding can be set speed first, quality first, balance, etc.
  25. You can set the software name, English name, and LOGO icon.
  26. You can export stored video files to specific directories or upload them to servers in batches.

(3) Features and functions

  1. The main interface adopts the mode of docked form, various components in the form of small modules, can be customized to join any module.
  2. Docking module can drag any position embedded and suspended, support maximum full screen, support multi-screen.
  3. Dual layout file storage mechanism, normal mode and full-screen mode are corresponding to different layout schemes, automatic switching and saving, for example, full-screen mode can highlight several modules transparent display in the specified position, more science fiction sense of modernization.
  4. Original onVIF protocol mechanism, using the underlying protocol resolution (UDP broadcast search + HTTP request execution command) more lightweight easy to understand learning expansion, does not rely on any third-party components such as GSOAP.
  5. Original data import and export mechanism, cross-platform independent of any components, instant data export.
  6. Built in multiple original components, the universe super value super awesome, Including data import and export components (export to XLS, PDF, printing), database components (database management thread, automatic data cleaning thread, universal paging, data request, etc.), map component, video monitoring component, file multithreading transceiver component, onVIF communication component, universal browser kernel component, etc.
  7. Customize information box + error box + query box + lower right prompt box (including various formats).
  8. Exquisite skin change, up to 17 sets of skin styles can be changed at will, all styles are unified, including menu, etc.
  9. 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.
  10. Double click the camera node to automatically play the video, double click the node to automatically add the video, it will automatically jump to the next, double click the parent node to automatically add all the videos under the node. Primary stream and sub-stream are optional.
  11. You can add, delete, and modify the import and export printed information, and immediately apply the new device information to generate a tree list without restarting.
  12. Optional a variety of kernel free switch, FFMPEG, VLC, MPV, etc., can be set in pro. Ffmpeg is recommended. It is most cross-platform and provides libraries compiled on Linux and MAC platforms by default.
  13. Supports hard decoding and can be set to hard decoding type (QSV, DXVA2, d3D11VA, etc.).
  14. The default opengL rendering video, ultra-low CPU resource consumption, support YUYV and NV12 two formats to draw, very awesome.
  15. Highly customizable, users can easily derive their own functions on this basis, such as adding custom modules, adding operation mode, robot monitoring, uav monitoring, excavator monitoring, etc.
  16. Support XP, Win7, Win10, Linux, MAC, a variety of domestic systems (UOS, kyrin, Galaxy Kyrin, etc.), embedded Linux and other systems.
  17. Complete annotation, clear project structure, super detailed complete use of the development manual, accurate to the function description of each code file, continuous iteration version.

3. Experience address

  1. Experience address: pan.baidu.com/s/1d7TH_GEY… Extraction code: 01Jf File name: bin_video_system.zip
  2. Domestic site: gitee.com/feiyangqing…
  3. International site: github.com/feiyangqing…
  4. Profile: blog.csdn.net/feiyangqing…
  5. Zhihu homepage: www.zhihu.com/people/feiy…
  6. Online documentation: feiyangqingyun. Gitee. IO/qwidgetdemo…

Four, effect drawing

Five, core code

void DeviceHelper::initDeviceTree(QTreeWidget *treeWidget)
{
    treeWidget->clear(a); treeWidget->setAnimated(false);
    treeWidget->setHeaderHidden(true);
    // Double-click the node to disable it
    //treeWidget->setItemsExpandable(false);
    // Set the distance to the left of the node
    //treeWidget->setIndentation(10);
    // Set the tree node to be draggable
    treeWidget->setDragEnabled(true);

    // Load from the database, first load NVR, then traverse the IPC below NVR
    for (int i = 0; i < DbData::NvrInfo_Count; i++) {
        // Add VCR node
        QString nvrName = DbData::NvrInfo_NvrName.at(i);
        QString nvrIP = DbData::NvrInfo_NvrIP.at(i);
        QTreeWidgetItem *itemParent = new QTreeWidgetItem(treeWidget);
        itemParent->setText(0, nvrName);
        itemParent->setData(0, Qt::UserRole, nvrIP);

        // Loop to add the camera node under VCR
        for (int j = 0; j < DbData::IpcInfo_Count; j++) {
            if (DbData::IpcInfo_NvrName.at(j) == nvrName) {
                QString ipcName = DbData::IpcInfo_IpcName.at(j);
                QString rtspMain = DbData::IpcInfo_RtspMain.at(j);
                QString rtspSub = DbData::IpcInfo_RtspSub.at(j);
                QString rtspAddr = (AppConfig::VideoRtsp == 0 ? rtspMain : rtspSub);

                // Add a camera node
                QTreeWidgetItem *itemChild = new QTreeWidgetItem(itemParent);
                itemChild->setText(0, ipcName);
                itemChild->setData(0, Qt::UserRole, rtspAddr);
                // Add the primary stream node
                QTreeWidgetItem *itemRtspMain = new QTreeWidgetItem(itemChild);
                itemRtspMain->setText(0."Main stream");
                itemRtspMain->setData(0, Qt::UserRole, rtspMain);
                // Add a child stream node
                QTreeWidgetItem *itemRtspSub = new QTreeWidgetItem(itemChild);
                itemRtspSub->setText(0."Substream");
                itemRtspSub->setData(0, Qt::UserRole, rtspSub); }}//treeWidget->expandItem(itemParent);
    }

    // Expand all nodes if the number of devices is small
    if (DbData::IpcInfo_Count > 5) {
        // Open the parent node
        QTreeWidgetItemIterator it(treeWidget);
        while (*it) {
            if ((*it)->parent() = =0) {
                treeWidget->expandItem((*it)); } ++it; }}else {
        // Open all nodes
        treeWidget->expandAll();
    }
}

void DeviceHelper::initVideoIcon(a)
{
    if (deviceTree == NULL) {
        return;
    }

    // You can change the mapping table to a different icon
    QPixmap iconParent = IconHelper::getPixmap(QUIConfig::TextColor, 0xea23.18.20.20);
    QPixmap iconChild = IconHelper::getPixmap(QUIConfig::TextColor, 0xea07.18.20.20);
    QPixmap iconMain = IconHelper::getPixmap(QUIConfig::TextColor, 0xe9ff.18.20.20);
    QPixmap iconSub = IconHelper::getPixmap(QUIConfig::TextColor, 0xe9ff.18.20.20);

    // Different nodes display different ICONS
    QTreeWidgetItemIterator it(deviceTree);
    while (*it) {
        QPixmap pix = iconChild;
        QString text = (*it)->text(0);
        if ((*it)->parent() = =0) {
            pix = iconParent;
        } else if (text == "Main stream") {
            pix = iconMain;
        } else if (text == "Substream") {
            pix = iconSub;
        }

        (*it)->setIcon(0, pix); ++it; }}void DeviceHelper::setVideoIcon(const QString &url, bool online)
{
    if (deviceTree == NULL) {
        return;
    }

    // Set the camera icon online and offline
    QPixmap iconOnline = IconHelper::getPixmap(QUIConfig::TextColor, 0xea07.18.20.20);
    QPixmap iconOffline = IconHelper::getPixmap(QUIConfig::TextColor, 0xea0a.18.20.20);

    QTreeWidgetItemIterator it(deviceTree);
    while (*it) {
        if ((*it)->data(0, Qt::UserRole) == url) {
            (*it)->setIcon(0, online ? iconOnline : iconOffline);
            break; } ++it; }}Copy the code