Qt framework for the preparation 1- Gas Safety Management System Project

I. Introduction

Speaking framework of the project, also known as source framework, in fact, is very important, with the increase of programming experience, I believe that every programmer will have the framework of a project of their own habits, build a house with this thing, setting up the first shelf and then one by one Wang Libian filled with content, it is said fast hardware architects are responsible to build a good frame, then arrange men were responsible for the preparation of specific business logic code, write up to the point the core algorithm, generally at least 5 years working cattle experienced personnel have the strength. Framework set up well, there is a multiplier effect, build the frame when it is already considering expanding the latter part of the.
I usually write the framework Qt projects, like managed with pri files, pri is a good thing, in fact, is a text file, specifically classified management code files, suggest that may be multi-purpose, unless your project is one or two code files no are necessary to use outside, most people may contact pro file, if the number of code files such as dozens more, then all piled on the pro file, it seems it is a mess, but also in the project tree view pull to pull the scroll bar to find the code file, very inconvenient, the eyes will look at flowers. My frame of different projects are generally different pri the corresponding folder, the code number of files will not be so much in each folder, good looking, cool-cool clean and looks quite comfortable, there is a comfortable feeling , write code more efficient.

  1. Common components put together, such as the export component data printing, mail forwarding component, SMS forwarding components.
  2. The third party open component put together, such as serial type qextserialport, curve table class qcustomplot, properties of the control class qtpropertybrowser.
  3. Database processing on a class dbhelper in, all in one class, unified management operations of all QSqlQuery, modify it easy, no need to write QSqlQuery everywhere.
  4. Deviceapi protocol communication device placed together, hardware communication with the unified management, alarm linkage, forwarding the network.
  5. Different menu corresponding sub-pages put together, such as the main interface put a piece, including the main interface, user login, the user exits the interface; put together view interface, including data monitoring, maps, monitoring, equipment monitoring; data query put a piece, including the police records , the recording operation, the user record; a discharge system settings, including basic settings, port settings, device settings, and other settings map.
  6. Custom usercontrol put together, such as control switch button, tree navigation controls, drop-down box color controls.

Experience Address: https://gitee.com/feiyangqingyun/QWidgetExe https://github.com/feiyangqingyun/QWidgetExe Name: bin_sams.zip

Second, the functional characteristics

  1. Collect data port, serial port support + network port, serial port supports baud rate set free + serial number, network support freely set the IP address + communication ports, each port supports acquisition cycle, default 1 second address, set the communication timeout support frequency default 3 times, support the largest reconnection time for the re-read off-line equipment.
  2. Controller information, the controller can be added to the name, address + control model selection controller, the controller is provided below the number of detectors.
  3. Probe information, the bit number can be added, can be freely selected probe type, gas type, gas symbol, the value of the high alarm, low reported values, buffer values, a value is cleared, if enabled, an alarm sound, a background map, the storage period, the value conversion of decimal places, the alarm delay time, alarm type (HH, LL, HL) and the like.
  4. Detector Model Controller Model + + + gas symbol gas species, can be freely arranged.
  5. Map supports importing and delete all the corresponding map position detector can freely drag saved.
  6. Port information + + probe information controller information, import and export support + + print exported to Excel.
  7. + + Alarm log record recording the user, the query condition combination to support multiple, such as + period + Controller detectors, all record print support exported to Excel +.
  8. Export to excel record of support for all forms such as excel + wps file versions, does not rely on software such as excel.
  9. You can delete data within a specified time frame, auto clean up early data, set the maximum number of record-keeping.
  10. Support forwarding alarm messages, the plurality of support receiving phone number, the transmission interval can be set, such as instant or the transmission 6 hours send all the alarm messages, message content is too long, a number of messages automatically split.
  11. Support alarm mail forwarding, support for receiving a plurality of mailboxes, the transmission interval can be set, such as instant transmission or six hours all the alarm information once transmitted, to support attachments.
  12. High + Low message packets Color Color values ​​Color + + + 0 normal color profile curves + background color, etc., can be freely selected.
  13. Software English title Chinese title + + + logo Copyright paths can be freely set.
  14. Provides switch switched on the alarm sound + + + automatic login remember passwords.
  15. Sound the alarm can be set to play frequency interface available in 17 skin file selection.
  16. Support cloud data synchronization, cloud database information can be set, such as database name, username + password.
  17. Support network forwarding and receiving network, the network is open to receive, parse udp software to receive data from. Network forwarding support multiple target IP, thus achieving a local collection of software, free data to the client, at any time to view the detector data.
  18. Automatically remembers the last stop of the user interface + additional information, automatic application restart.
  19. Alarm automatically switches to a map corresponding to the detector button flashes.
  20. Double-click the probe icon, you can back control.
  21. Support user rights management, administrators + operator into two categories, user login + user exits, you can remember the password and automatic login, more than three times error prompt and close the program.
  22. Supports four monitoring mode, the monitoring device panel monitor + Map + table + curve data monitoring data monitoring, are free to switch the four synchronization application.
  23. Support alarm relay linkage, a bit serial number can be linked across a plurality of modules and a relay number, support-many.
  24. Local data storage support sqlite + mysql, supports remote data synchronization to the cloud database. Automatic reconnection.
  25. Real-time local device collected data uploaded to the cloud, so that the phone APP or web and other ways to extract.
  26. Supports two data sources, one serial port and the data acquisition devices through a network protocol, one is the collection database. Acquisition mode database can be used as a general system.
  27. Carrying equipment simulation tools, devices 16 support analog data, but also with the database data simulation, when there is no data to test the device.
  28. Default communication protocol using modbus protocol, later adding support mqtt and other things of the agreement, made common system.
  29. Supports all windows operating system + linux operating system and other operating systems.

Third, renderings

Fourth, the core code

pro文件
INCLUDEPATH         += $$PWD/frmmain
INCLUDEPATH         += $$PWD/frmview
INCLUDEPATH         += $$PWD/frmdata
INCLUDEPATH         += $$PWD/frmother
INCLUDEPATH         += $$PWD/frmconfig

INCLUDEPATH         += $$PWD
INCLUDEPATH         += $$PWD/api
INCLUDEPATH         += $$PWD/dbapi
INCLUDEPATH         += $$PWD/dataout
INCLUDEPATH         += $$PWD/sendmsg
INCLUDEPATH         += $$PWD/sendemail
INCLUDEPATH         += $$PWD/deviceapi
INCLUDEPATH         += $$PWD/usercontrol
INCLUDEPATH         += $$PWD/qcustomplot
INCLUDEPATH         += $$PWD/qextserialport
INCLUDEPATH         += $$PWD/qtpropertybrowser

include             ($$PWD/frmmain/frmmain.pri)
include             ($$PWD/frmview/frmview.pri)
include             ($$PWD/frmdata/frmdata.pri)
include             ($$PWD/frmother/frmother.pri)
include             ($$PWD/frmconfig/frmconfig.pri)

include             ($$PWD/api/api.pri)
include             ($$PWD/dbapi/dbapi.pri)
include             ($$PWD/dataout/dataout.pri)
include             ($$PWD/sendmsg/sendmsg.pri)
include             ($$PWD/sendemail/sendemail.pri)
include             ($$PWD/deviceapi/deviceapi.pri)
include             ($$PWD/usercontrol/usercontrol.pri)
include             ($$PWD/qcustomplot/qcustomplot.pri)
include             ($$PWD/qextserialport/qextserialport.pri)
include             ($$PWD/qtpropertybrowser/qtpropertybrowser.pri)

pri文件
FORMS += \
    $$PWD/frmview.ui \
    $$PWD/frmviewdata.ui \
    $$PWD/frmviewdevice.ui \
    $$PWD/frmviewmap.ui \
    $$PWD/frmviewplot.ui

HEADERS += \
    $$PWD/frmview.h \
    $$PWD/frmviewdata.h \
    $$PWD/frmviewdevice.h \
    $$PWD/frmviewmap.h \
    $$PWD/frmviewplot.h

SOURCES += \
    $$PWD/frmview.cpp \
    $$PWD/frmviewdata.cpp \
    $$PWD/frmviewdevice.cpp \
    $$PWD/frmviewmap.cpp \
    $$PWD/frmviewplot.cpp

Guess you like

Origin www.cnblogs.com/feiyangqingyun/p/11830605.html