One, foreword
As a basic function, the log query function is divided into two parts. One is local log query, including run logs, alarm logs, and operation logs. Is an equipment log query, that is, to pull through the SDK to NVR equipment log information, including the system operation, configuration, operation, alarm operation, video, file operations, remote operation and other operations, etc., these log information is stored in the NVR device, upon the request of the query, the return to the log information to the client shows them one by one. The local log query is usually bound to the database table, and then set the query conditions, and then select the results, using the QTableView control to display the data, while the remote device log, according to the query results of their own paginating, stored in a linked list, using the QTableWidget control. Both controls are easy to use.
About log query function module, data query, in fact, most of the system is used, and paging, so in the years to write so many system, in the process would have sealed a custom paging components, introduced into the table name, query conditions, fields, rules, after the select paging display automatically, Click the buttons of previous page, next page, first page and last page to switch pages. Meanwhile, label is provided to display the current page, total pages, lines on each page, query execution time, etc. This component is completely open source.
Two, functional characteristics
Software modules
- 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.
- Video playback module, including local playback, remote playback, device playback, picture playback, video upload, etc.
- Electronic map module, including picture map, online map, offline map, path planning, etc.
- Log query module, including local logs, device logs, etc.
- 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.
Basis function
- Support various video streams (RTSP, RTMP, HTTP, etc.), video files (MP4, RMVB, AVI, etc.), local USB camera playback.
- Support 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, toolbar button, 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 group (polling plan), polling interval, and bit stream type.
- Supports the OnVIF protocol, including device search, pte control, device control (picture parameters, check time, system restart, capture pictures, etc.).
- Different users can have different module permissions, such as deleting logs and shutting down the system.
- Support a variety of databases, including sqlite, mysql, sqlserver, postgresql, oracle, rendajincang and so on.
- You can set resolution and frame rate for a local USB camera.
- All docking modules automatically generate corresponding menus to control the display and hide, in the title bar right click can pop up.
- Display all modules, hide all modules, reset the common layout, and reset the full-screen layout.
- Double-click the device to pop up real-time preview video, supporting picture map, online map, offline map, etc.
- 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.
- You can delete a video by right-clicking the mouse button, closing the floating bar, or dragging it outside the video surveillance panel.
- 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.
- Any channel in the video surveillance panel form supports drag exchange, instant response.
- Encapsulated Baidu map, view switch, movement track, equipment point, mouse click to obtain latitude and longitude.
- 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.
- Volume bar control in the lower right corner, automatically hide when losing focus, volume strip mute icon.
- You can specify a screenshot for a single channel or all channels. The screenshot button is also available on the bottom toolbar.
- The mouse pointer can be automatically hidden when timeout expires and the mouse pointer can be automatically displayed in full screen.
- Support onVIF PTZ control, can move PTZ camera up, down, left and right, including reset and focal length adjustment.
- Support any ONVIF camera, including but not limited to Hikang, Dahua, Yushi, Weiye, Huawei, etc.
- Can save video, can select the time storage or single file storage, optional storage interval time.
- Video stream communication mode can be set TCP + UDP, video decoding can be set speed first, quality first, balance, etc.
- You can set the software name, English name, and LOGO icon.
- You can export stored video files to specific directories or upload them to servers in batches.
features
- The main interface adopts the mode of docked form, various components in the form of small modules, can be customized to join any module.
- Docking module can drag any position embedded and suspended, support maximum full screen, support multi-screen.
- 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.
- 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.
- Original data import and export mechanism, cross-platform independent of any components, instant data export.
- 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.
- Customize information box + error box + query box + lower right prompt box (including various formats).
- Exquisite skin change, 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, 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.
- 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.
- 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.
- Supports hard decoding and can be set to hard decoding type (QSV, DXVA2, d3D11VA, etc.).
- The default opengL rendering video, ultra-low CPU resource consumption, support YUYV and NV12 two formats to draw, very awesome.
- Highly customizable, users can easily derive their own functions on this basis, such as adding custom modules, operation mode, robot monitoring, UAV monitoring, excavator monitoring, procuratorate trial monitoring, etc.
- Support XP, Win7, Win10, Linux, MAC, a variety of domestic systems (UOS, kyrin, Galaxy Kyrin, etc.), embedded Linux and other systems.
- 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
- Experience address: pan.baidu.com/s/1d7TH_GEY… Extraction code: 01Jf File name: bin_video_system.zip
- Domestic site: gitee.com/feiyangqing…
- International site: github.com/feiyangqing…
- Profile: blog.csdn.net/feiyangqing…
- Zhihu homepage: www.zhihu.com/people/feiy…
Four, effect drawing
Five, core code
#include "frmloglocal.h"
#include "ui_frmloglocal.h"
#include "quiwidget.h"
#include "dbdelegate.h"
frmLogLocal::frmLogLocal(QWidget *parent) : QWidget(parent), ui(new Ui::frmLogLocal)
{
ui->setupUi(this);
this->initForm(a);this->initData(a);this->initIcon(a);this->loadData(a); } frmLogLocal::~frmLogLocal()
{
delete ui;
}
void frmLogLocal::initForm(a)
{
for (int i = 1; i <= 16; i++) {
ui->cboxCh->addItem(QString(Channel "% 1").arg(i));
}
QStringList type;
type << "Run Log" << "Alarm log" << "Operation Log";
ui->cboxType->addItems(type);
ui->dateTimeStart->setDate(QDate::currentDate());
ui->dateTimeEnd->setDate(QDate::currentDate().addDays(1));
ui->dateTimeStart->calendarWidget() - >setLocale(QLocale::Chinese);
ui->dateTimeEnd->calendarWidget() - >setLocale(QLocale::Chinese);
}
void frmLogLocal::initIcon(a)
{
quint32 size = 15;
quint32 pixWidth = 20;
quint32 pixHeight = 15;
QSize iconSize = QSize(pixWidth, pixHeight);
QPixmap pix1 = IconHelper::Instance() - >getPixmap(QUIConfig::TextColor, 0xf002, size, pixWidth, pixHeight);
QPixmap pix2 = IconHelper::Instance() - >getPixmap(QUIConfig::TextColor, 0xf1c3, size, pixWidth, pixHeight);
QPixmap pix3 = IconHelper::Instance() - >getPixmap(QUIConfig::TextColor, 0xf00d, size, pixWidth, pixHeight);
QPixmap pix4 = IconHelper::Instance() - >getPixmap(QUIConfig::TextColor, 0xf1f8, size, pixWidth, pixHeight);
ui->btnSelect->setIconSize(iconSize);
ui->btnExcel->setIconSize(iconSize);
ui->btnDelete->setIconSize(iconSize);
ui->btnClear->setIconSize(iconSize);
ui->btnSelect->setIcon(QIcon(pix1));
ui->btnExcel->setIcon(QIcon(pix2));
ui->btnDelete->setIcon(QIcon(pix3));
ui->btnClear->setIcon(QIcon(pix4));
foreach (DbDelegate *delegate, delegates) {
delegate->setTextColor(QUIConfig::TextColor);
delegate->setSelectBgColor(QUIConfig::NormalColorStart); }}void frmLogLocal::initData(a)
{
QStringList headText;
headText << "Identity" << "Serial number" << "Time" << "User" << "Channel" << "Type" << "Content" << "Note";
ui->tableWidget->setColumnCount(headText.count());
ui->tableWidget->setHorizontalHeaderLabels(headText);
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
//ui->tableWidget->setAlternatingRowColors(true);
ui->tableWidget->verticalHeader() - >setVisible(false);
ui->tableWidget->horizontalHeader() - >setStretchLastSection(true);
ui->tableWidget->horizontalHeader() - >setFixedHeight(25);
ui->tableWidget->verticalHeader() - >setDefaultSectionSize(25);
#if 1
// Set the column width
ui->tableWidget->setColumnWidth(0.50);
ui->tableWidget->setColumnWidth(1.60);
ui->tableWidget->setColumnWidth(2.160);
ui->tableWidget->setColumnWidth(3.120);
ui->tableWidget->setColumnWidth(4.100);
ui->tableWidget->setColumnWidth(5.100);
ui->tableWidget->setColumnWidth(6.160);
ui->tableWidget->setColumnWidth(7.50);
#else
// Adaptive column width
#if(QT_VERSION < = QT_VERSION_CHECK (0, 5))
ui->tableWidget->verticalHeader() - >setResizeMode(QHeaderView::Stretch);
ui->tableWidget->horizontalHeader() - >setResizeMode(QHeaderView::ResizeToContents);
#else
ui->tableWidget->verticalHeader() - >setSectionResizeMode(QHeaderView::Stretch);
ui->tableWidget->horizontalHeader() - >setSectionResizeMode(QHeaderView::ResizeToContents);
#endif
#endif
// Set the first column delegate to automatically display different ICONS according to the content
DbDelegate *d_pixmap = new DbDelegate(this);
d_pixmap->setDelegateColumn(0);
d_pixmap->setDelegateType("QPixmap");
d_pixmap->setCheckColumn(6);
d_pixmap->setCheckType("contains");
d_pixmap->setCheckValue("Offline fault | | alarm");
d_pixmap->setCheckOkImage(IconHelper::Instance() - >getPixmap(QUIConfig::TextColor, 0xf071.15.15.15));
d_pixmap->setCheckNoImage(IconHelper::Instance() - >getPixmap(QUIConfig::TextColor, 0xf06a.15.15.15));
ui->tableWidget->setItemDelegateForColumn(0, d_pixmap);
delegates << d_pixmap;
}
void frmLogLocal::loadData(a)
{
QStringList content;
content << "Equipment online" << "Device offline" << "Equipment normal" << "Equipment failure" << "Equipment alarm";
QStringList type;
type << "Run Log" << "Alarm log" << "Operation Log";
QDateTime now = QDateTime::currentDateTime(a);// Set line number + line height
int count = 30;
ui->tableWidget->setRowCount(count);
for (int i = 0; i < count; i++) {
now = now.addSecs(60 * 30 * i);
QTableWidgetItem *item1 = new QTableWidgetItem(QString::number(i + 1));
QTableWidgetItem *item2 = new QTableWidgetItem(now.toString("yyyy-MM-dd HH:mm:ss"));
QTableWidgetItem *item3 = new QTableWidgetItem("admin");
QTableWidgetItem *item4 = new QTableWidgetItem(QString(Channel "% 1").arg((qrand() % 16) + 1));
QTableWidgetItem *item5 = new QTableWidgetItem(type.at(qrand() % 3));
QTableWidgetItem *item6 = new QTableWidgetItem(content.at(qrand() % 5));
item1->setTextAlignment(Qt::AlignCenter);
item2->setTextAlignment(Qt::AlignCenter);
item3->setTextAlignment(Qt::AlignCenter);
//item4->setTextAlignment(Qt::AlignCenter);
item5->setTextAlignment(Qt::AlignCenter);
item6->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->setItem(i, 1, item1);
ui->tableWidget->setItem(i, 2, item2);
ui->tableWidget->setItem(i, 3, item3);
ui->tableWidget->setItem(i, 4, item4);
ui->tableWidget->setItem(i, 5, item5);
ui->tableWidget->setItem(i, 6, item6); }}Copy the code