├── _config.yml ├── lib ├── libquc.a ├── quc.dll ├── Qt5Qmqtt.dll ├── libQt5Qmqtt.a ├── cmake │ └── Qt5Qmqtt │ │ ├── ExtraSourceIncludes.cmake │ │ └── Qt5QmqttConfigVersion.cmake ├── pkgconfig │ └── Qt5Qmqtt.pc └── Qt5Qmqtt.prl ├── README.md ├── main.cpp ├── include └── QtQmqtt │ └── QtQmqttDepends ├── mqtt ├── qmqtt.pro ├── qmqtt.pri ├── qmqtt_websocketiodevice.cpp ├── qmqtt.h ├── qmqtt_global.h ├── qmqtt_router.h ├── qmqtt_timer_p.h ├── qmqtt_timerinterface.h ├── qmqtt_timer.cpp ├── qmqtt_routedmessage.h ├── qmqtt_socket_p.h ├── qmqtt_router.cpp ├── qmqtt_routesubscription.h ├── qmqtt_message_p.h ├── qmqtt_websocketiodevice_p.h ├── qmqtt_ssl_socket_p.h ├── qmqtt_socket.cpp ├── qmqtt_websocket.cpp ├── qmqtt_socketinterface.h ├── qmqtt_message.h └── qmqtt.qbs ├── qt_image_include ├── smoothcurvecreator.h ├── zhtopy.h ├── oventimer.h ├── ntpclient.h ├── movewidget.h ├── roundwidget.h ├── colorwidget.h ├── maskwidget.h ├── colorcombobox.h ├── saveruntime.h ├── flowlayout.h ├── imagepilot.h ├── imagepower.h ├── lcddatetime.h ├── tiledbg.h ├── combobox.h ├── tumblertime.h ├── imageswitch.h ├── tumblerdate.h ├── cpumemorylabel.h ├── imagecalendar.h ├── lightpoint.h ├── savelog.h ├── ledtext.h ├── trayicon.h ├── roundlogo.h ├── animationbutton1.h ├── verifiedcode.h ├── ipaddress.h ├── framelesswidget.h ├── shadowclock.h ├── pinyin.h ├── colorpanelfader.h ├── magicpool.h ├── videopanel.h ├── tumblerdatetime.h ├── iconeditor.h ├── gifwidget.h ├── lcdnumber.h ├── colorstyle.h ├── waveplot.h ├── shadowcalendar.h ├── screenwidget.h ├── colorpanelbtn.h ├── animationbutton2.h ├── magicmouse.h ├── panelwidget.h ├── adswidget.h ├── colorpanelhsb.h ├── xslider.h ├── barvumeter.h ├── waveline.h ├── progressbutton.h ├── customrocker.h ├── lunarcalendarinfo.h ├── antline.h ├── custompie.h ├── devicesizetable.h ├── bottomwidget.h ├── wavewater.h ├── buttondefence.h ├── imageclock.h ├── roundcircle.h ├── xprogressbar.h ├── wavedouble.h ├── gaugecompasspan.h ├── wavedata.h ├── barvolume.h ├── wavebar.h ├── tumbler.h └── customgraphics.h ├── .gitignore ├── mainwindow.h ├── index.md └── MQTT_Smart_Home.pro /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /lib/libquc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HYJJJJJJJJ/MQTT_Smart_Home/HEAD/lib/libquc.a -------------------------------------------------------------------------------- /lib/quc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HYJJJJJJJJ/MQTT_Smart_Home/HEAD/lib/quc.dll -------------------------------------------------------------------------------- /lib/Qt5Qmqtt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HYJJJJJJJJ/MQTT_Smart_Home/HEAD/lib/Qt5Qmqtt.dll -------------------------------------------------------------------------------- /lib/libQt5Qmqtt.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HYJJJJJJJJ/MQTT_Smart_Home/HEAD/lib/libQt5Qmqtt.a -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MQTT_Qt_Client 2 | 基于Qt开发的MQTT智能家居客户端 3 | 编译环境Qt 5.13.0 MinGW 32-bit 4 | 5 | 2020-02-24 6 | 实现基本功能 7 | 8 | 2020-04-17 9 | 添加相关动态库文件,完善.pro文件工程配置 10 | 11 | 12 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | MainWindow w; 8 | w.show(); 9 | 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /include/QtQmqtt/QtQmqttDepends: -------------------------------------------------------------------------------- 1 | /* This file was generated by qmake with the info from /src/mqtt/qmqtt.pro. */ 2 | #ifdef __cplusplus /* create empty PCH in C mode */ 3 | #include 4 | #include 5 | #endif 6 | -------------------------------------------------------------------------------- /lib/cmake/Qt5Qmqtt/ExtraSourceIncludes.cmake: -------------------------------------------------------------------------------- 1 | 2 | list(APPEND _Qt5Qmqtt_OWN_INCLUDE_DIRS 3 | "G:/LMZ/qmqtt-master/include" "G:/LMZ/qmqtt-master/include/QtQmqtt" 4 | ) 5 | set(Qt5Qmqtt_PRIVATE_INCLUDE_DIRS 6 | "G:/LMZ/qmqtt-master/include/QtQmqtt/1.0.0" "G:/LMZ/qmqtt-master/include/QtQmqtt/1.0.0/QtQmqtt" 7 | ) 8 | -------------------------------------------------------------------------------- /mqtt/qmqtt.pro: -------------------------------------------------------------------------------- 1 | TARGET = QtQmqtt 2 | QT = core network 3 | QMQTT_WEBSOCKETS: QT += websockets 4 | 5 | DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII 6 | 7 | HEADERS += \ 8 | $$PWD/qmqtt_global.h \ 9 | $$PWD/qmqtt.h 10 | 11 | include(qmqtt.pri) 12 | 13 | HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS 14 | 15 | load(qt_module) 16 | -------------------------------------------------------------------------------- /lib/pkgconfig/Qt5Qmqtt.pc: -------------------------------------------------------------------------------- 1 | prefix=D:/Qt/Qt5.13.0/5.13.0/mingw73_32 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | 7 | Name: Qt5 Qmqtt 8 | Description: Qt Qmqtt module 9 | Version: 1.0.0 10 | Libs: -L${libdir} -lQt5Qmqtt 11 | Cflags: -DQT_QMQTT_LIB -I${includedir}/QtQmqtt -I${includedir} 12 | Requires: Qt5Core Qt5Network 13 | 14 | -------------------------------------------------------------------------------- /lib/cmake/Qt5Qmqtt/Qt5QmqttConfigVersion.cmake: -------------------------------------------------------------------------------- 1 | 2 | set(PACKAGE_VERSION 1.0.0) 3 | 4 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 5 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 6 | else() 7 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 8 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 9 | set(PACKAGE_VERSION_EXACT TRUE) 10 | endif() 11 | endif() 12 | -------------------------------------------------------------------------------- /qt_image_include/smoothcurvecreator.h: -------------------------------------------------------------------------------- 1 | #ifndef SMOOTHCURVECREATOR_H 2 | #define SMOOTHCURVECREATOR_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class SmoothCurveCreator 9 | { 10 | public: 11 | static QPainterPath createSmoothCurve(const QVector &points); 12 | 13 | private: 14 | static void calculateFirstControlPoints(double *&result, const double *rhs, int n); 15 | static void calculateControlPoints(const QVector &knots, QVector *firstControlPoints, QVector *secondControlPoints); 16 | }; 17 | 18 | #endif // SMOOTHCURVECREATOR_H 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | *.slo 3 | *.lo 4 | *.o 5 | *.la 6 | *.lai 7 | *.so 8 | *.so.* 9 | *.dylib 10 | *.a 11 | *.dll 12 | *.prl 13 | 14 | # Qt-es 15 | object_script.*.Release 16 | object_script.*.Debug 17 | *_plugin_import.cpp 18 | /.qmake.cache 19 | /.qmake.stash 20 | *.pro.user 21 | *.pro.user.* 22 | *.qbs.user 23 | *.qbs.user.* 24 | *.moc 25 | moc_*.cpp 26 | moc_*.h 27 | qrc_*.cpp 28 | ui_*.h 29 | *.qmlc 30 | *.jsc 31 | Makefile* 32 | *build-* 33 | *.qm 34 | *.prl 35 | 36 | # Qt unit tests 37 | target_wrapper.* 38 | 39 | # QtCreator 40 | *.autosave 41 | 42 | # QtCreator Qml 43 | *.qmlproject.user 44 | *.qmlproject.user.* 45 | 46 | # QtCreator CMake 47 | CMakeLists.txt.user* 48 | 49 | # QtCreator 4.8< compilation database 50 | compile_commands.json 51 | 52 | # QtCreator local machine specific files for imported projects 53 | *creator.user* 54 | -------------------------------------------------------------------------------- /qt_image_include/zhtopy.h: -------------------------------------------------------------------------------- 1 | #ifndef ZHTOPY_H 2 | #define ZHTOPY_H 3 | 4 | /** 5 | * 汉字转拼音类 作者:feiyangqingyun(QQ:517216493) 2019-2-16 6 | * 1:汉字转拼音 7 | * 2:汉字转拼音简拼 8 | * 3:汉字转拼音首字母 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT ZhToPY : public QObject 22 | #else 23 | class ZhToPY : public QObject 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | public: 29 | static ZhToPY *Instance(); 30 | explicit ZhToPY(QObject *parent = 0); 31 | 32 | private: 33 | static QScopedPointer self; 34 | QStringList listPY; 35 | QStringList listJP; 36 | 37 | public: 38 | //载入拼音文件 39 | void loadPY(const QString &fileName = "zhtopy.txt"); 40 | //汉字转拼音 41 | QString zhToPY(const QString &chinese); 42 | //汉字转字母简拼 43 | QString zhToJP(const QString &chinese); 44 | //汉字转首字母 45 | QString zhToZM(const QString &chinese); 46 | }; 47 | 48 | #endif // ZHTOPY_H 49 | -------------------------------------------------------------------------------- /qt_image_include/oventimer.h: -------------------------------------------------------------------------------- 1 | #ifndef OVENTIMER_H 2 | #define OVENTIMER_H 3 | 4 | #include 5 | #include 6 | 7 | class QTimer; 8 | 9 | #ifdef quc 10 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 11 | #include 12 | #else 13 | #include 14 | #endif 15 | 16 | class QDESIGNER_WIDGET_EXPORT OvenTimer : public QWidget 17 | #else 18 | class OvenTimer : public QWidget 19 | #endif 20 | 21 | { 22 | Q_OBJECT 23 | public: 24 | explicit OvenTimer(QWidget *parent = 0); 25 | ~OvenTimer(); 26 | 27 | protected: 28 | void mousePressEvent(QMouseEvent *event); 29 | void paintEvent(QPaintEvent *); 30 | void draw(QPainter *painter); 31 | 32 | private: 33 | int duration; 34 | QDateTime finishTime; 35 | 36 | QTimer *updateTimer; 37 | QTimer *finishTimer; 38 | 39 | public: 40 | int getDuration() const; 41 | QSize sizeHint() const; 42 | QSize minimumSizeHint() const; 43 | 44 | public Q_SLOTS: 45 | void setDuration(int secs); 46 | 47 | Q_SIGNALS: 48 | void timeout(); 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /qt_image_include/ntpclient.h: -------------------------------------------------------------------------------- 1 | #ifndef NTPCLIENT_H 2 | #define NTPCLIENT_H 3 | 4 | /** 5 | * Ntp校时类 作者:feiyangqingyun(QQ:517216493) 2017-2-16 6 | * 1:可设置Ntp服务器IP地址 7 | * 2:收到时间信号发出 8 | */ 9 | 10 | #include 11 | #include 12 | class QUdpSocket; 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT NtpClient : public QObject 22 | #else 23 | class NtpClient : public QObject 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | public: 29 | static NtpClient *Instance(); 30 | explicit NtpClient(QObject *parent = 0); 31 | 32 | private: 33 | static QScopedPointer self; 34 | QString ntpIP; 35 | QUdpSocket *udpSocket; 36 | 37 | private slots: 38 | void readData(); 39 | void sendData(); 40 | 41 | signals: 42 | //收到时间返回 43 | void receiveTime(const QDateTime &dateTime); 44 | 45 | public slots: 46 | //设置NTP服务器IP 47 | void setNtpIP(const QString &ntpIP); 48 | 49 | //获取日期时间 50 | void getDateTime(); 51 | 52 | }; 53 | 54 | #endif // NTPCLIENT_H 55 | -------------------------------------------------------------------------------- /qt_image_include/movewidget.h: -------------------------------------------------------------------------------- 1 | #ifndef MOVEWIDGET_H 2 | #define MOVEWIDGET_H 3 | 4 | /** 5 | * 通用控件移动类 作者:feiyangqingyun(QQ:517216493) 2019-9-28 6 | * 1:可以指定需要移动的widget 7 | * 2:可设置是否限定鼠标左键拖动 8 | * 3:支持任意widget控件 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT MoveWidget : public QObject 21 | #else 22 | class MoveWidget : public QObject 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit MoveWidget(QObject *parent = 0); 29 | 30 | protected: 31 | bool eventFilter(QObject *watched, QEvent *event); 32 | 33 | private: 34 | QPoint lastPoint; //最后按下的坐标 35 | bool pressed; //鼠标是否按下 36 | bool leftButton; //限定鼠标左键 37 | bool inControl; //限定在容器内 38 | QWidget *widget; //移动的控件 39 | 40 | public Q_SLOTS: 41 | //设置是否限定鼠标左键 42 | void setLeftButton(bool leftButton); 43 | //设置是否限定不能移出容器外面 44 | void setInControl(bool inControl); 45 | //设置要移动的控件 46 | void setWidget(QWidget *widget); 47 | }; 48 | 49 | #endif // MOVEWIDGET_H 50 | -------------------------------------------------------------------------------- /qt_image_include/roundwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef ROUNDWIDGET_H 2 | #define ROUNDWIDGET_H 3 | 4 | /** 5 | * 旋转圆窗体 作者:feiyangqingyun(QQ:517216493) 2016-11-22 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | #ifdef quc 12 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | class QDESIGNER_WIDGET_EXPORT RoundWidget : public QWidget 19 | #else 20 | class RoundWidget : public QWidget 21 | #endif 22 | 23 | { 24 | Q_OBJECT 25 | public: 26 | explicit RoundWidget(QWidget *parent = 0); 27 | ~RoundWidget(); 28 | 29 | protected: 30 | void resizeEvent(QResizeEvent *); 31 | void showEvent(QShowEvent *); 32 | 33 | private: 34 | QHash widgets; 35 | QWidget *w1; 36 | QWidget *w2; 37 | QWidget *w3; 38 | QWidget *w4; 39 | QWidget *w5; 40 | QWidget *w6; 41 | 42 | QTimer *timer; 43 | 44 | int radius; 45 | int circle; 46 | int offset; 47 | 48 | private slots: 49 | void initWidget(); 50 | void updateValue(); 51 | 52 | public: 53 | QSize sizeHint() const; 54 | QSize minimumSizeHint() const; 55 | }; 56 | 57 | #endif // ROUNDWIDGET_H 58 | -------------------------------------------------------------------------------- /qt_image_include/colorwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORWIDGET_H 2 | #define COLORWIDGET_H 3 | 4 | #include 5 | 6 | class QGridLayout; 7 | class QVBoxLayout; 8 | class QLabel; 9 | class QLineEdit; 10 | 11 | #ifdef quc 12 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | class QDESIGNER_WIDGET_EXPORT ColorWidget : public QWidget 19 | #else 20 | class ColorWidget : public QWidget 21 | #endif 22 | 23 | { 24 | Q_OBJECT 25 | public: 26 | static ColorWidget *Instance(); 27 | explicit ColorWidget(QWidget *parent = 0); 28 | ~ColorWidget(); 29 | 30 | protected: 31 | void mousePressEvent(QMouseEvent *); 32 | void mouseReleaseEvent(QMouseEvent *); 33 | 34 | private: 35 | static ColorWidget *instance; 36 | QClipboard *cp; 37 | bool pressed; 38 | QTimer *timer; 39 | 40 | QGridLayout *gridLayout; 41 | QVBoxLayout *verticalLayout; 42 | QLabel *labColor; 43 | QLabel *label; 44 | QLabel *labWeb; 45 | QLineEdit *txtWeb; 46 | QLabel *labRgb; 47 | QLineEdit *txtRgb; 48 | QLabel *labPoint; 49 | QLineEdit *txtPoint; 50 | 51 | private Q_SLOTS: 52 | void showColorValue(); 53 | }; 54 | 55 | #endif // COLORWIDGET_H 56 | -------------------------------------------------------------------------------- /qt_image_include/maskwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef MASKWIDGET_H 2 | #define MASKWIDGET_H 3 | 4 | /** 5 | * 弹窗遮罩层控件 作者:feiyangqingyun(QQ:517216493) 2016-12-26 6 | * 1:可设置需要遮罩的主窗体,自动跟随主窗体位置显示遮罩面积 7 | * 2:只需要将弹窗窗体的名称一开始传入队列即可,足够简单 8 | * 3:可设置透明度 9 | * 4:可设置遮罩层颜色 10 | * 5:不阻塞消息循坏 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT MaskWidget : public QWidget 23 | #else 24 | class MaskWidget : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | public: 30 | static MaskWidget *Instance(); 31 | explicit MaskWidget(QWidget *parent = 0); 32 | 33 | protected: 34 | void showEvent(QShowEvent *); 35 | bool eventFilter(QObject *obj, QEvent *event); 36 | 37 | private: 38 | static QScopedPointer self; 39 | QWidget *mainWidget; //需要遮罩的主窗体 40 | QStringList dialogNames; //可能弹窗的窗体对象名称集合链表 41 | 42 | public Q_SLOTS: 43 | void setMainWidget(QWidget *mainWidget); 44 | void setDialogNames(const QStringList &dialogNames); 45 | void setBgColor(const QColor &bgColor); 46 | void setOpacity(double opacity); 47 | }; 48 | 49 | #endif // MASKWIDGET_H 50 | -------------------------------------------------------------------------------- /lib/Qt5Qmqtt.prl: -------------------------------------------------------------------------------- 1 | QMAKE_PRL_BUILD_DIR = G:/LMZ/qmqtt-master/src/build-src-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/mqtt 2 | QMAKE_PRO_INPUT = qmqtt.pro 3 | QMAKE_PRL_TARGET = libQt5Qmqtt.a 4 | QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin windows qt_build_extra file_copies qmake_use qt warn_on release link_prl debug_and_release precompile_header shared release no_plugin_manifest win32 mingw gcc copy_dir_files sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples f16c largefile optimize_debug precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl prepare_docs qt_docs_targets no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions warning_clean release ReleaseBuild Release build_pass qml_debug release ReleaseBuild Release build_pass relative_qt_rpath qmake_cache target_qt c++11 strict_c++ c++14 c++1z c99 c11 split_incpath qt_install_headers need_fwd_pri qt_install_module debug_and_release build_all create_cmake skip_target_version_ext compiler_supports_fpmath create_pc release ReleaseBuild Release build_pass have_target dll exclusive_builds no_autoqmake thread moc resources 5 | QMAKE_PRL_VERSION = 1.0.0 6 | -------------------------------------------------------------------------------- /mqtt/qmqtt.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | 3 | PUBLIC_HEADERS += \ 4 | $$PWD/qmqtt_client.h \ 5 | $$PWD/qmqtt_frame.h \ 6 | $$PWD/qmqtt_message.h \ 7 | $$PWD/qmqtt_routesubscription.h \ 8 | $$PWD/qmqtt_routedmessage.h \ 9 | $$PWD/qmqtt_router.h \ 10 | $$PWD/qmqtt_networkinterface.h \ 11 | $$PWD/qmqtt_socketinterface.h \ 12 | $$PWD/qmqtt_timerinterface.h 13 | 14 | PRIVATE_HEADERS += \ 15 | $$PWD/qmqtt_client_p.h \ 16 | $$PWD/qmqtt_message_p.h \ 17 | $$PWD/qmqtt_network_p.h \ 18 | $$PWD/qmqtt_socket_p.h \ 19 | $$PWD/qmqtt_timer_p.h 20 | 21 | SOURCES += \ 22 | $$PWD/qmqtt_client_p.cpp \ 23 | $$PWD/qmqtt_client.cpp \ 24 | $$PWD/qmqtt_frame.cpp \ 25 | $$PWD/qmqtt_message.cpp \ 26 | $$PWD/qmqtt_network.cpp \ 27 | $$PWD/qmqtt_routesubscription.cpp \ 28 | $$PWD/qmqtt_router.cpp \ 29 | $$PWD/qmqtt_socket.cpp \ 30 | $$PWD/qmqtt_timer.cpp 31 | 32 | QMQTT_WEBSOCKETS { 33 | PRIVATE_HEADERS += \ 34 | $$PWD/qmqtt_websocket_p.h \ 35 | $$PWD/qmqtt_websocketiodevice_p.h 36 | 37 | SOURCES += \ 38 | $$PWD/qmqtt_websocket.cpp \ 39 | $$PWD/qmqtt_websocketiodevice.cpp 40 | } 41 | 42 | !contains(CONFIG, QMQTT_NO_SSL) { 43 | PRIVATE_HEADERS += \ 44 | $$PWD/qmqtt_ssl_socket_p.h 45 | 46 | SOURCES += \ 47 | $$PWD/qmqtt_ssl_socket.cpp 48 | } 49 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include "qt_image_include/gaugeweather.h" 6 | #include "qt_image_include/colorpanelhsb.h" 7 | #include 8 | #include 9 | #include "QDebug" 10 | #include "QString" 11 | #include "mqtt/qmqtt.h" 12 | 13 | #define topicSub_max 3 14 | #define topicPub_max 2 15 | 16 | enum Pubtopic{ 17 | Fan=0,Led 18 | }; 19 | 20 | namespace Ui { 21 | class MainWindow; 22 | } 23 | 24 | class MainWindow : public QMainWindow 25 | { 26 | Q_OBJECT 27 | 28 | public: 29 | explicit MainWindow(QWidget *parent = nullptr); 30 | ~MainWindow(); 31 | 32 | private slots:// 槽函数定义 33 | void onMQTT_Connected(); 34 | void onMQTT_Disconnected(); 35 | void onMQTT_Subscribed(const QString &topic); 36 | void onMQTT_Received(const QMQTT::Message &message); 37 | void on_pushButton_connect_clicked(); 38 | void onFanDuty_changed(int duty); 39 | void onColorDuty_changed(const QColor &color, double hue, double sat); 40 | private: 41 | Ui::MainWindow *ui; 42 | GaugeWeather *gaugeweather; 43 | ColorPanelHSB *colorpanel; 44 | QMQTT::Client *client; 45 | Pubtopic pubtopic=Fan; 46 | 47 | protected: 48 | QString topicSub[topicSub_max] = {"wd","sd","gz"}; 49 | QString topicPub[topicPub_max] = {"fan","led"}; 50 | 51 | }; 52 | 53 | #endif // MAINWINDOW_H 54 | -------------------------------------------------------------------------------- /qt_image_include/colorcombobox.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORCOMBOBOX_H 2 | #define COLORCOMBOBOX_H 3 | 4 | /** 5 | * 颜色下拉框控件 作者:feiyangqingyun(QQ:517216493) 2016-12-28 6 | * 1:支持内置所有颜色下拉选择 7 | * 2:可设置是否显示对应颜色的名称 8 | * 3:可指定当前颜色为哪个颜色 9 | * 4:发出颜色改变信号通知 10 | */ 11 | 12 | #include 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT ColorComboBox : public QComboBox 22 | #else 23 | class ColorComboBox : public QComboBox 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(bool showColorName READ getShowColorName WRITE setShowColorName) 29 | 30 | public: 31 | explicit ColorComboBox(QWidget *parent = 0); 32 | 33 | private: 34 | bool showColorName; //是否显示颜色名称 35 | QString colorName; //当前颜色 36 | 37 | private slots: 38 | void currentIndexChanged(int index); 39 | 40 | public: 41 | bool getShowColorName() const; 42 | QString getColorName() const; 43 | 44 | public Q_SLOTS: 45 | void setShowColorName(bool showColorName); 46 | void setColorName(const QString &colorName); 47 | void initItems(); 48 | 49 | Q_SIGNALS: 50 | void colorChanged(const QString &colorName); 51 | void colorChanged(const QColor &color); 52 | }; 53 | 54 | #endif // COLORCOMBOBOX_H 55 | -------------------------------------------------------------------------------- /qt_image_include/saveruntime.h: -------------------------------------------------------------------------------- 1 | #ifndef SAVERUNTIME_H 2 | #define SAVERUNTIME_H 3 | 4 | #include 5 | #include 6 | class QTimer; 7 | 8 | #ifdef quc 9 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 10 | #include 11 | #else 12 | #include 13 | #endif 14 | 15 | class QDESIGNER_WIDGET_EXPORT SaveRunTime : public QObject 16 | #else 17 | class SaveRunTime : public QObject 18 | #endif 19 | 20 | { 21 | Q_OBJECT 22 | public: 23 | static SaveRunTime *Instance(); 24 | explicit SaveRunTime(QObject *parent = 0); 25 | 26 | private: 27 | static QScopedPointer self; 28 | QString path; //日志文件路径 29 | QString name; //日志文件名称 30 | 31 | int lastID; 32 | int saveInterval; 33 | QDateTime startTime; 34 | QString logFile; 35 | QTimer *timerSave; 36 | 37 | private: 38 | void getDiffValue(const QDateTime &startTime, const QDateTime &endTime, int &day, int &hour, int &minute); 39 | 40 | signals: 41 | 42 | public slots: 43 | void start(); //启动服务 44 | void stop(); //停止服务 45 | void initLog(); //初始化日志文件 46 | void appendLog(); //追加一条记录到日志文件 47 | void saveLog(); //保存运行时间到日志文件 48 | 49 | void setPath(const QString &path); 50 | void setName(const QString &name); 51 | void setSaveInterval(int saveInterval); 52 | }; 53 | 54 | #endif // SAVERUNTIME_H 55 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | ## Welcome to GitHub Pages 2 | 3 | You can use the [editor on GitHub](https://github.com/HYJJJJJJJJ/MQTT_Smart_Home/edit/master/index.md) to maintain and preview the content for your website in Markdown files. 4 | 5 | Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. 6 | 7 | ### Markdown 8 | 9 | Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for 10 | 11 | ```markdown 12 | Syntax highlighted code block 13 | 14 | # Header 1 15 | ## Header 2 16 | ### Header 3 17 | 18 | - Bulleted 19 | - List 20 | 21 | 1. Numbered 22 | 2. List 23 | 24 | **Bold** and _Italic_ and `Code` text 25 | 26 | [Link](url) and ![Image](src) 27 | ``` 28 | 29 | For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). 30 | 31 | ### Jekyll Themes 32 | 33 | Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/HYJJJJJJJJ/MQTT_Smart_Home/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file. 34 | 35 | ### Support or Contact 36 | 37 | Having trouble with Pages? Check out our [documentation](https://help.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out. 38 | -------------------------------------------------------------------------------- /qt_image_include/flowlayout.h: -------------------------------------------------------------------------------- 1 | #ifndef FLOWLAYOUT_H 2 | #define FLOWLAYOUT_H 3 | 4 | /** 5 | * 流式布局类 - qt自带demo 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #ifdef quc 13 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 14 | #include 15 | #else 16 | #include 17 | #endif 18 | 19 | class QDESIGNER_WIDGET_EXPORT FlowLayout : public QLayout 20 | #else 21 | class FlowLayout : public QLayout 22 | #endif 23 | 24 | { 25 | public: 26 | explicit FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1); 27 | explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1); 28 | ~FlowLayout(); 29 | 30 | void addItem(QLayoutItem *item); 31 | int horizontalSpacing() const; 32 | int verticalSpacing() const; 33 | Qt::Orientations expandingDirections() const; 34 | bool hasHeightForWidth() const; 35 | int heightForWidth(int) const; 36 | int count() const; 37 | QLayoutItem *itemAt(int index) const; 38 | QSize minimumSize() const; 39 | void setGeometry(const QRect &rect); 40 | QSize sizeHint() const; 41 | QLayoutItem *takeAt(int index); 42 | 43 | private: 44 | int doLayout(const QRect &rect, bool testOnly) const; 45 | int smartSpacing(QStyle::PixelMetric pm) const; 46 | 47 | QList itemList; 48 | int m_hSpace; 49 | int m_vSpace; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /qt_image_include/imagepilot.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGEPILOT_H 2 | #define IMAGEPILOT_H 3 | 4 | /** 5 | * 图片指示灯控件 作者:feiyangqingyun(QQ:517216493) 2016-11-25 6 | * 1:可设置五种颜色 7 | * 2:可自定义指示灯图片 8 | */ 9 | 10 | #include 11 | 12 | #ifdef quc 13 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 14 | #include 15 | #else 16 | #include 17 | #endif 18 | 19 | class QDESIGNER_WIDGET_EXPORT ImagePilot : public QWidget 20 | #else 21 | class ImagePilot : public QWidget 22 | #endif 23 | 24 | { 25 | Q_OBJECT 26 | Q_ENUMS(PilotStyle) 27 | Q_PROPERTY(PilotStyle pilotStyle READ getPilotStyle WRITE setPilotStyle) 28 | 29 | public: 30 | enum PilotStyle { 31 | PilotStyle_Blue = 0, //蓝色风格 32 | PilotStyle_Gray = 1, //灰色风格 33 | PilotStyle_Green = 2, //绿色风格 34 | PilotStyle_Red = 3, //红色风格 35 | PilotStyle_Yellow = 4 //黄色风格 36 | }; 37 | 38 | explicit ImagePilot(QWidget *parent = 0); 39 | 40 | protected: 41 | void paintEvent(QPaintEvent *event); 42 | 43 | private: 44 | PilotStyle pilotStyle; 45 | QString imgFile; 46 | 47 | public: 48 | PilotStyle getPilotStyle() const; 49 | QString getImgFile() const; 50 | QSize sizeHint() const; 51 | QSize minimumSizeHint() const; 52 | 53 | public Q_SLOTS: 54 | void setPilotStyle(const PilotStyle &pilotStyle); 55 | void setImage(const QString &imgFile); 56 | }; 57 | 58 | #endif // IMAGEPILOT_H 59 | -------------------------------------------------------------------------------- /qt_image_include/imagepower.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGEPOWER_H 2 | #define IMAGEPOWER_H 3 | 4 | /** 5 | * 图片电源控件 作者:feiyangqingyun(QQ:517216493) 2016-11-25 6 | * 1:可设置五种电源状态 7 | * 2:可自定义电源图片 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT ImagePower : public QWidget 21 | #else 22 | class ImagePower : public QWidget 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(QImage image READ getImage WRITE setImage) 28 | Q_PROPERTY(int imageValue READ getImageValue WRITE setImageValue) 29 | Q_PROPERTY(int value READ getValue WRITE setValue) 30 | 31 | public: 32 | explicit ImagePower(QWidget *parent = 0); 33 | 34 | protected: 35 | void paintEvent(QPaintEvent *event); 36 | 37 | private: 38 | QImage image; //电池电量图片 39 | int imageValue; //电池电量图片表示的电量 40 | int value; //当前电量 41 | 42 | public: 43 | QImage getImage() const; 44 | int getImageValue() const; 45 | int getValue() const; 46 | QSize sizeHint() const; 47 | QSize minimumSizeHint() const; 48 | 49 | public Q_SLOTS: 50 | void setImage(const QImage &image); 51 | void setImageValue(int imageValue); 52 | void setValue(int value); 53 | }; 54 | 55 | #endif // IMAGEPOWER_H 56 | -------------------------------------------------------------------------------- /qt_image_include/lcddatetime.h: -------------------------------------------------------------------------------- 1 | #ifndef LCDDATETIME_H 2 | #define LCDDATETIME_H 3 | 4 | /** 5 | * 当前时间LCD控件 作者:feiyangqingyun(QQ:517216493) 2016-11-25 6 | * 1:可设置时间字符串格式 7 | * 2:可设置中间点分隔符是否闪烁 8 | * 3:可实时显示当前时间 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT LcdDateTime : public QLCDNumber 21 | #else 22 | class LcdDateTime : public QLCDNumber 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(bool dotHide READ getDotHide WRITE setDotHide) 28 | Q_PROPERTY(QString format READ getFormat WRITE setFormat) 29 | Q_PROPERTY(int digitCount READ getDigitCount WRITE setDigitCount) 30 | 31 | public: 32 | explicit LcdDateTime(QWidget *parent = 0); 33 | ~LcdDateTime(); 34 | 35 | private: 36 | bool dotHide; 37 | QString format; 38 | int digitCount; 39 | QTimer *timer; 40 | 41 | public: 42 | bool getDotHide() const; 43 | QString getFormat() const; 44 | int getDigitCount() const; 45 | 46 | QSize sizeHint() const; 47 | QSize minimumSizeHint() const; 48 | 49 | public Q_SLOTS: 50 | void start(int interval = 1000); 51 | void setDateTime(); 52 | void setDotHide(bool dotHide); 53 | void setFormat(const QString &format); 54 | }; 55 | 56 | #endif // LCDDATETIME_H 57 | -------------------------------------------------------------------------------- /mqtt/qmqtt_websocketiodevice.cpp: -------------------------------------------------------------------------------- 1 | #ifdef QT_WEBSOCKETS_LIB 2 | 3 | #include "qmqtt_websocketiodevice_p.h" 4 | 5 | #include 6 | 7 | QMQTT::WebSocketIODevice::WebSocketIODevice(QWebSocket *socket, QObject *parent) 8 | : QIODevice(parent) 9 | , _webSocket(socket) 10 | { 11 | connect(_webSocket, &QWebSocket::bytesWritten, this, &WebSocketIODevice::bytesWritten); 12 | connect(_webSocket, &QWebSocket::binaryMessageReceived, 13 | this, &WebSocketIODevice::binaryMessageReceived); 14 | } 15 | 16 | bool QMQTT::WebSocketIODevice::connectToHost(const QNetworkRequest &request) 17 | { 18 | _webSocket->open(request); 19 | return QIODevice::open(QIODevice::ReadWrite); 20 | } 21 | 22 | qint64 QMQTT::WebSocketIODevice::bytesAvailable() const 23 | { 24 | return _buffer.count(); 25 | } 26 | 27 | void QMQTT::WebSocketIODevice::binaryMessageReceived(const QByteArray &frame) 28 | { 29 | _buffer.append(frame); 30 | emit readyRead(); 31 | } 32 | 33 | qint64 QMQTT::WebSocketIODevice::readData(char *data, qint64 maxSize) 34 | { 35 | int size = qMin(static_cast(maxSize), _buffer.count()); 36 | for (int i=0; i(maxSize)); 45 | return _webSocket->sendBinaryMessage(d); 46 | } 47 | 48 | #endif // QT_WEBSOCKETS_LIB 49 | -------------------------------------------------------------------------------- /qt_image_include/tiledbg.h: -------------------------------------------------------------------------------- 1 | #ifndef TILEDBG_H 2 | #define TILEDBG_H 3 | 4 | /** 5 | * 平铺背景控件 作者:feiyangqingyun(QQ:517216493) 2018-8-25 6 | * 1:可设置交替背景颜色 7 | */ 8 | 9 | #include 10 | 11 | #ifdef quc 12 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | class QDESIGNER_WIDGET_EXPORT TiledBg : public QWidget 19 | #else 20 | class TiledBg : public QWidget 21 | #endif 22 | 23 | { 24 | Q_OBJECT 25 | Q_PROPERTY(QColor color1 READ getColor1 WRITE setColor1) 26 | Q_PROPERTY(QColor color2 READ getColor2 WRITE setColor2) 27 | Q_PROPERTY(QPixmap bgPix READ getBgPix WRITE setBgPix) 28 | 29 | public: 30 | explicit TiledBg(QWidget *parent = 0); 31 | 32 | protected: 33 | void drawBg(); 34 | void paintEvent(QPaintEvent *); 35 | 36 | private: 37 | QColor color1; //颜色1 38 | QColor color2; //颜色2 39 | QPixmap bgPix; //背景图片 40 | 41 | public: 42 | QColor getColor1() const; 43 | QColor getColor2() const; 44 | QPixmap getBgPix() const; 45 | 46 | QSize sizeHint() const; 47 | QSize minimumSizeHint() const; 48 | 49 | public slots: 50 | //设置颜色1 51 | void setColor1(const QColor &color1); 52 | //设置颜色2 53 | void setColor2(const QColor &color2); 54 | //设置背景图片 55 | void setBgPix(const QPixmap &bgPix); 56 | }; 57 | 58 | #endif // TILEDBG_H 59 | -------------------------------------------------------------------------------- /qt_image_include/combobox.h: -------------------------------------------------------------------------------- 1 | #ifndef COMBOBOX_H 2 | #define COMBOBOX_H 3 | 4 | /** 5 | * 自定义宽高下拉框控件 作者:feiyangqingyun(QQ:517216493) 2017-4-11 6 | * 1:可设置下拉框元素高度 7 | * 2:可设置下拉框元素宽度 8 | * 3:可设置是否自动调整下拉框元素宽度,根据元素宽高自动调整 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT ComboBox : public QComboBox 21 | #else 22 | class ComboBox : public QComboBox 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(int itemWidth READ getItemWidth WRITE setItemWidth) 28 | Q_PROPERTY(int itemHeight READ getItemHeight WRITE setItemHeight) 29 | Q_PROPERTY(bool autoWidth READ getAutoWidth WRITE setAutoWidth) 30 | 31 | public: 32 | explicit ComboBox(QWidget *parent = 0); 33 | 34 | protected: 35 | void showEvent(QShowEvent *); 36 | 37 | private: 38 | int itemWidth; //元素宽度 39 | int itemHeight; //元素高度 40 | bool autoWidth; //是否自动调整元素宽度 41 | int maxItemWidth; //最大元素宽度 42 | 43 | public: 44 | int getItemWidth() const; 45 | int getItemHeight() const; 46 | bool getAutoWidth() const; 47 | 48 | public Q_SLOTS: 49 | void setItemWidth(int itemWidth); 50 | void setItemHeight(int itemHeight); 51 | void setAutoWidth(bool autoWidth); 52 | }; 53 | 54 | #endif // COMBOBOX_H 55 | -------------------------------------------------------------------------------- /qt_image_include/tumblertime.h: -------------------------------------------------------------------------------- 1 | #ifndef TUMBLERTIME_H 2 | #define TUMBLERTIME_H 3 | 4 | /** 5 | * 时间滑动选择器 作者:feiyangqingyun(QQ:517216493) 2017-8-11 6 | * 1:可设置时分秒 7 | * 2:可鼠标或者手指滑动选择时分秒 8 | * 3:支持自定义数值范围 9 | * 4:支持鼠标滚轮选择 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | class Tumbler; 16 | class TumblerTime; 17 | 18 | #ifdef quc 19 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 20 | #include 21 | #else 22 | #include 23 | #endif 24 | 25 | class QDESIGNER_WIDGET_EXPORT TumblerTime : public QWidget 26 | #else 27 | class TumblerTime : public QWidget 28 | #endif 29 | 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit TumblerTime(QWidget *parent = 0); 34 | 35 | private: 36 | int hour; //时钟 37 | int min; //分钟 38 | int sec; //秒钟 39 | 40 | Tumbler *tumblerHour; //时钟选择器 41 | Tumbler *tumblerMin; //分钟选择器 42 | Tumbler *tumblerSec; //秒钟选择器 43 | 44 | private slots: 45 | void initForm(); 46 | 47 | public: 48 | //获取时钟 49 | int getHour() const; 50 | //获取分钟 51 | int getMin() const; 52 | //获取秒钟 53 | int getSec() const; 54 | 55 | //获取时间 56 | QTime getTime() const; 57 | 58 | public Q_SLOTS: 59 | //设置时钟 60 | void setHour(int hour); 61 | 62 | //设置分钟 63 | void setMin(int min); 64 | 65 | //设置秒钟 66 | void setSec(int sec); 67 | 68 | //设置年月日 69 | void setTime(int hour, int min, int sec); 70 | 71 | }; 72 | 73 | #endif // TUMBLERTIME_H 74 | -------------------------------------------------------------------------------- /qt_image_include/imageswitch.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGESWITCH_H 2 | #define IMAGESWITCH_H 3 | 4 | /** 5 | * 图片开关控件 作者:feiyangqingyun(QQ:517216493) 2016-11-25 6 | * 1:自带三种开关按钮样式 7 | * 2:可自定义开关图片 8 | */ 9 | 10 | #include 11 | 12 | #ifdef quc 13 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 14 | #include 15 | #else 16 | #include 17 | #endif 18 | 19 | class QDESIGNER_WIDGET_EXPORT ImageSwitch : public QWidget 20 | #else 21 | class ImageSwitch : public QWidget 22 | #endif 23 | 24 | { 25 | Q_OBJECT 26 | Q_ENUMS(ButtonStyle) 27 | 28 | Q_PROPERTY(bool isChecked READ getChecked WRITE setChecked) 29 | Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle) 30 | 31 | public: 32 | enum ButtonStyle { 33 | ButtonStyle_1 = 0, //开关样式1 34 | ButtonStyle_2 = 1, //开关样式2 35 | ButtonStyle_3 = 2 //开关样式3 36 | }; 37 | 38 | explicit ImageSwitch(QWidget *parent = 0); 39 | 40 | protected: 41 | void mousePressEvent(QMouseEvent *); 42 | void paintEvent(QPaintEvent *event); 43 | 44 | private: 45 | bool isChecked; 46 | ButtonStyle buttonStyle; 47 | 48 | QString imgOffFile; 49 | QString imgOnFile; 50 | QString imgFile; 51 | 52 | public: 53 | bool getChecked() const; 54 | ButtonStyle getButtonStyle() const; 55 | QSize sizeHint() const; 56 | QSize minimumSizeHint() const; 57 | 58 | public Q_SLOTS: 59 | void setChecked(bool isChecked); 60 | void setButtonStyle(const ImageSwitch::ButtonStyle &buttonStyle); 61 | }; 62 | 63 | #endif // IMAGESWITCH_H 64 | -------------------------------------------------------------------------------- /qt_image_include/tumblerdate.h: -------------------------------------------------------------------------------- 1 | #ifndef TUMBLERDATE_H 2 | #define TUMBLERDATE_H 3 | 4 | /** 5 | * 日期滑动选择器 作者:feiyangqingyun(QQ:517216493) 2017-8-11 6 | * 1:可设置年月日 7 | * 2:可鼠标或者手指滑动选择年月日 8 | * 3:支持自定义数值范围 9 | * 4:支持鼠标滚轮选择 10 | * 5:年月日自动联动计算 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | class Tumbler; 17 | class TumblerDate; 18 | 19 | #ifdef quc 20 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | class QDESIGNER_WIDGET_EXPORT TumblerDate : public QWidget 27 | #else 28 | class TumblerDate : public QWidget 29 | #endif 30 | 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit TumblerDate(QWidget *parent = 0); 35 | 36 | private: 37 | int year; //年份 38 | int month; //月份 39 | int day; //日期 40 | 41 | Tumbler *tumblerYear; //年份选择器 42 | Tumbler *tumblerMonth; //月份选择器 43 | Tumbler *tumblerDay; //日期选择器 44 | 45 | private slots: 46 | void initForm(); 47 | void currentValueChanged(const QString &); 48 | 49 | public: 50 | //获取年份 51 | int getYear() const; 52 | //获取月份 53 | int getMonth() const; 54 | //获取日期 55 | int getDay() const; 56 | 57 | //获取日期 58 | QDate getDate() const; 59 | 60 | public Q_SLOTS: 61 | //设置年份 62 | void setYear(int year); 63 | 64 | //设置月份 65 | void setMonth(int month); 66 | 67 | //设置日期 68 | void setDay(int day); 69 | 70 | //设置年月日 71 | void setDate(int year, int month, int day); 72 | 73 | }; 74 | 75 | #endif // TUMBLERDATE_H 76 | -------------------------------------------------------------------------------- /qt_image_include/cpumemorylabel.h: -------------------------------------------------------------------------------- 1 | #ifndef CPUMEMORYLABEL_H 2 | #define CPUMEMORYLABEL_H 3 | 4 | /** 5 | * CPU内存显示控件 作者:feiyangqingyun(QQ:517216493) 2016-11-18 6 | * 1:实时显示当前CPU及内存使用情况,包括共多少内存已使用多少内存 7 | * 2:全平台通用,包括windows,linux,ARM 8 | */ 9 | 10 | #include 11 | 12 | class QProcess; 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT CpuMemoryLabel : public QLabel 22 | #else 23 | class CpuMemoryLabel : public QLabel 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit CpuMemoryLabel(QWidget *parent = 0); 30 | ~CpuMemoryLabel(); 31 | 32 | private: 33 | quint64 totalNew, idleNew, totalOld, idleOld; 34 | quint64 cpuPercent; 35 | 36 | quint64 memoryPercent; 37 | quint64 memoryAll; 38 | quint64 memoryUse; 39 | quint64 memoryFree; 40 | 41 | QTimer *timerCPU; //定时器获取CPU信息 42 | QTimer *timerMemory; //定时器获取内存信息 43 | QProcess *process; //linux执行命令 44 | 45 | private slots: 46 | void getCPU(); //获取cpu 47 | void getMemory(); //获取内存 48 | void readData(); //读取数据 49 | void setData(); //设置数据 50 | 51 | public: 52 | QSize sizeHint() const; 53 | QSize minimumSizeHint() const; 54 | 55 | public Q_SLOTS: 56 | void start(int interval); 57 | void stop(); 58 | 59 | Q_SIGNALS: 60 | void textChanged(const QString &text); 61 | void valueChanged(quint64 cpuPercent, quint64 memoryPercent, quint64 memoryAll, quint64 memoryUse, quint64 memoryFree); 62 | }; 63 | 64 | #endif // CPUMEMORYLABEL_H 65 | -------------------------------------------------------------------------------- /qt_image_include/imagecalendar.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGECALENDAR_H 2 | #define IMAGECALENDAR_H 3 | 4 | /** 5 | * 图片背景日历控件 作者:feiyangqingyun(QQ:517216493) 2016-11-25 6 | * 1:可设置六种图片背景风格 黄色风格/蓝色风格/褐色风格/灰色风格/紫色风格/红色风格 7 | * 2:显示当前日期及农历 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT ImageCalendar : public QWidget 21 | #else 22 | class ImageCalendar : public QWidget 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_ENUMS(CalendarStyle) 28 | Q_PROPERTY(CalendarStyle calendarStyle READ getCalendarStyle WRITE setCalendarStyle) 29 | 30 | public: 31 | enum CalendarStyle { 32 | CalendarStyle_Yellow = 0, //黄色风格 33 | CalendarStyle_Blue = 1, //蓝色风格 34 | CalendarStyle_Brown = 2, //褐色风格 35 | CalendarStyle_Gray = 3, //灰色风格 36 | CalendarStyle_Purple = 4, //紫色风格 37 | CalendarStyle_Red = 5 //红色风格 38 | }; 39 | 40 | explicit ImageCalendar(QWidget *parent = 0); 41 | 42 | protected: 43 | void paintEvent(QPaintEvent *); 44 | 45 | private: 46 | CalendarStyle calendarStyle; //背景样式 47 | QImage calendarBg; //主背景 48 | QStringList imageNames; //图片名称集合 49 | QDateTime currentDate; //当前时间 50 | 51 | private Q_SLOTS: 52 | void changeStyle(); 53 | void changeDate(); 54 | 55 | public: 56 | CalendarStyle getCalendarStyle()const; 57 | QSize sizeHint() const; 58 | QSize minimumSizeHint() const; 59 | 60 | public Q_SLOTS: 61 | //设置图片日历样式 62 | void setCalendarStyle(const CalendarStyle &calendarStyle); 63 | }; 64 | 65 | #endif // IMAGECALENDAR_H 66 | -------------------------------------------------------------------------------- /qt_image_include/lightpoint.h: -------------------------------------------------------------------------------- 1 | #ifndef LIGHTPOINT_H 2 | #define LIGHTPOINT_H 3 | 4 | /** 5 | * 呼吸点控件 作者:feiyangqingyun(QQ:517216493) 2017-11-27 6 | * 1:可设置呼吸间隔 7 | * 2:可设置颜色透明渐变步长 8 | * 3:可设置背景颜色 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT LightPoint : public QWidget 21 | #else 22 | class LightPoint : public QWidget 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(int step READ getStep WRITE setStep) 28 | Q_PROPERTY(int interval READ getInterval WRITE setInterval) 29 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 30 | 31 | public: 32 | explicit LightPoint(QWidget *parent = 0); 33 | ~LightPoint(); 34 | 35 | protected: 36 | void paintEvent(QPaintEvent *); 37 | void drawBg(QPainter *painter); 38 | 39 | private: 40 | int step; //颜色透明渐变步长 41 | int interval; //定时器间隔 42 | QColor bgColor; //背景颜色 43 | 44 | QTimer *timer; //绘制定时器 45 | int offset; //偏移量 46 | bool add; //是否增加 47 | 48 | public: 49 | int getStep() const; 50 | int getInterval() const; 51 | QColor getBgColor() const; 52 | 53 | QSize sizeHint() const; 54 | QSize minimumSizeHint() const; 55 | 56 | public slots: 57 | //设置颜色透明渐变步长 58 | void setStep(int step); 59 | 60 | //设置定时器间隔 61 | void setInterval(int interval); 62 | 63 | //设置背景颜色 64 | void setBgColor(const QColor &bgColor); 65 | 66 | }; 67 | 68 | #endif // LIGHTPOINT_H 69 | -------------------------------------------------------------------------------- /qt_image_include/savelog.h: -------------------------------------------------------------------------------- 1 | #ifndef SAVELOG_H 2 | #define SAVELOG_H 3 | 4 | #include 5 | 6 | class QFile; 7 | class QTcpSocket; 8 | class QTcpServer; 9 | 10 | #ifdef quc 11 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | class QDESIGNER_WIDGET_EXPORT SaveLog : public QObject 18 | #else 19 | class SaveLog : public QObject 20 | #endif 21 | 22 | { 23 | Q_OBJECT 24 | public: 25 | static SaveLog *Instance(); 26 | explicit SaveLog(QObject *parent = 0); 27 | ~SaveLog(); 28 | 29 | private: 30 | static QScopedPointer self; 31 | 32 | //文件对象 33 | QFile *file; 34 | //是否重定向到网络 35 | bool toNet; 36 | //日志文件路径 37 | QString path; 38 | //日志文件名称 39 | QString name; 40 | //日志文件完整名称 41 | QString fileName; 42 | 43 | signals: 44 | void send(const QString &content); 45 | 46 | public slots: 47 | //启动日志服务 48 | void start(); 49 | //暂停日志服务 50 | void stop(); 51 | //保存日志 52 | void save(const QString &content); 53 | 54 | //设置是否重定向到网络 55 | void setToNet(bool toNet); 56 | //设置日志文件存放路径 57 | void setPath(const QString &path); 58 | //设置日志文件名称 59 | void setName(const QString &name); 60 | 61 | }; 62 | 63 | class SendLog : public QObject 64 | { 65 | Q_OBJECT 66 | public: 67 | static SendLog *Instance(); 68 | explicit SendLog(QObject *parent = 0); 69 | ~SendLog(); 70 | 71 | private: 72 | static QScopedPointer self; 73 | QTcpSocket *socket; 74 | QTcpServer *server; 75 | 76 | private slots: 77 | void newConnection(); 78 | 79 | public slots: 80 | //发送日志 81 | void send(const QString &content); 82 | }; 83 | 84 | #endif // SAVELOG_H 85 | -------------------------------------------------------------------------------- /qt_image_include/ledtext.h: -------------------------------------------------------------------------------- 1 | #ifndef LEDTEXT_H 2 | #define LEDTEXT_H 3 | 4 | /** 5 | * 字模提取控件 作者:feiyangqingyun(QQ:517216493) 2016-11-17 6 | * 1:可设置字模文字 7 | * 2:可设置字体名称及字号 8 | * 3:可设置步长间隔 9 | * 4:可设置前景色 10 | */ 11 | 12 | #include 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT LedText : public QWidget 22 | #else 23 | class LedText : public QWidget 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(QString text READ getText WRITE setText) 29 | Q_PROPERTY(int step READ getStep WRITE setStep) 30 | 31 | Q_PROPERTY(QColor foreground READ getForeground WRITE setForeground) 32 | Q_PROPERTY(QColor background READ getBackground WRITE setBackground) 33 | 34 | public: 35 | explicit LedText(QWidget *parent = 0); 36 | 37 | protected: 38 | void paintEvent(QPaintEvent *); 39 | 40 | private: 41 | QString text; //文字 42 | int step; //步长 43 | 44 | QColor foreground; //前景色 45 | QColor background; //背景色 46 | 47 | public: 48 | QString getText() const; 49 | int getStep() const; 50 | 51 | QColor getForeground() const; 52 | QColor getBackground() const; 53 | 54 | QSize sizeHint() const; 55 | QSize minimumSizeHint() const; 56 | 57 | public Q_SLOTS: 58 | //设置字模信息 59 | void setText(const QString &text); 60 | void setStep(int step); 61 | 62 | //设置前景色 63 | void setForeground(const QColor &foreground); 64 | //设置背景色 65 | void setBackground(const QColor &background); 66 | }; 67 | 68 | #endif // LEDTEXT_H 69 | -------------------------------------------------------------------------------- /qt_image_include/trayicon.h: -------------------------------------------------------------------------------- 1 | #ifndef TRAYICON_H 2 | #define TRAYICON_H 3 | 4 | /** 5 | * 托盘图标控件 作者:feiyangqingyun(QQ:517216493) 2017-1-8 6 | * 1:可设置托盘图标对应所属主窗体 7 | * 2:可设置托盘图标 8 | * 3:可设置提示信息 9 | * 4:自带右键菜单 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | class QMenu; 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT TrayIcon : public QObject 25 | #else 26 | class TrayIcon : public QObject 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | public: 32 | static TrayIcon *Instance(); 33 | explicit TrayIcon(QObject *parent = 0); 34 | 35 | private: 36 | static QScopedPointer self; 37 | QWidget *mainWidget; //对应所属主窗体 38 | QSystemTrayIcon *trayIcon; //托盘对象 39 | QMenu *menu; //右键菜单 40 | bool exitDirect; //是否直接退出 41 | 42 | private slots: 43 | void iconIsActived(QSystemTrayIcon::ActivationReason reason); 44 | 45 | public: 46 | bool getVisible() const; 47 | 48 | public Q_SLOTS: 49 | //设置是否直接退出,如果不是直接退出则发送信号给主界面 50 | void setExitDirect(bool exitDirect); 51 | 52 | //设置所属主窗体 53 | void setMainWidget(QWidget *mainWidget); 54 | 55 | //显示消息 56 | void showMessage(const QString &title, const QString &msg, 57 | QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int msecs = 5000); 58 | 59 | //设置图标 60 | void setIcon(const QString &strIcon); 61 | //设置提示信息 62 | void setToolTip(const QString &tip); 63 | //设置是否可见 64 | void setVisible(bool visible); 65 | //退出所有 66 | void closeAll(); 67 | 68 | Q_SIGNALS: 69 | void trayIconExit(); 70 | }; 71 | 72 | #endif // TRAYICON_H 73 | -------------------------------------------------------------------------------- /qt_image_include/roundlogo.h: -------------------------------------------------------------------------------- 1 | #ifndef ROUNDLOGO_H 2 | #define ROUNDLOGO_H 3 | 4 | /** 5 | * 旋转logo控件 作者:东门吹雪(QQ:709102202) 整理:飞扬青云(QQ:517216493) 2019-4-23 6 | * 1:可设置旋转速度 7 | * 2:可设置背景颜色 8 | * 3:可设置logo的子颜色 9 | * 4:可设置花瓣个数 10 | * 5:可设置圆形间距 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT RoundLogo : public QWidget 23 | #else 24 | class RoundLogo : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int speed READ getSpeed WRITE setSpeed) 30 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 31 | 32 | public: 33 | explicit RoundLogo(QWidget *parent = 0); 34 | ~RoundLogo(); 35 | 36 | protected: 37 | void paintEvent(QPaintEvent *); 38 | void drawBg(QPainter *painter); 39 | void drawLogo(QPainter *painter); 40 | double TwoPtDistance(const QPointF &pt1, const QPointF &pt2); 41 | 42 | private slots: 43 | void updateValue(); 44 | 45 | private: 46 | int speed; //旋转速度 47 | QColor bgColor; //背景颜色 48 | QList colors; //颜色集合 49 | 50 | int value; //当前值 51 | QTimer *timer; //定时器绘制 52 | 53 | public: 54 | int getSpeed() const; 55 | QColor getBgColor() const; 56 | 57 | QSize sizeHint() const; 58 | QSize minimumSizeHint() const; 59 | 60 | public Q_SLOTS: 61 | //设置速度 62 | void setSpeed(int speed); 63 | 64 | //设置颜色 65 | void setBgColor(const QColor &bgColor); 66 | void setColors(const QList &colors); 67 | 68 | //启动+停止旋转 69 | void start(); 70 | void stop(); 71 | 72 | }; 73 | 74 | #endif // GAUGEPOWER_H 75 | -------------------------------------------------------------------------------- /mqtt/qmqtt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt.h - qmqtt library heaer 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_H 33 | #define QMQTT_H 34 | 35 | #include "qmqtt_message.h" 36 | #include "qmqtt_client.h" 37 | 38 | #endif // QMQTT_H 39 | -------------------------------------------------------------------------------- /qt_image_include/animationbutton1.h: -------------------------------------------------------------------------------- 1 | #ifndef ANIMATIONBUTTON1_H 2 | #define ANIMATIONBUTTON1_H 3 | 4 | /** 5 | * 动画按钮控件 作者:feiyangqingyun(QQ:517216493) 2016-10-22 6 | * 1:可设置显示的图像 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | class QPropertyAnimation; 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT AnimationButton1 : public QWidget 22 | #else 23 | class AnimationButton1 : public QWidget 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(QString imageName READ getImageName WRITE setImageName) 29 | 30 | public: 31 | explicit AnimationButton1(QWidget *parent = 0); 32 | ~AnimationButton1(); 33 | 34 | protected: 35 | void enterEvent(QEvent *); 36 | void leaveEvent(QEvent *); 37 | void paintEvent(QPaintEvent *); 38 | 39 | private: 40 | bool enter; //是否进入 41 | bool leave; //是否离开 42 | int pixWidth; //图片宽度 43 | int pixHeight; //图片高度 44 | int oldWidth; //图片旧宽度 45 | int oldHeight; //图片旧高度 46 | 47 | QPropertyAnimation *enterAnimation; //进入动画 48 | QPropertyAnimation *leaveAnimation; //离开动画 49 | 50 | int targetWidth; //目标宽度 51 | int targetHeight; //目标高度 52 | QString imageName; //图像路径 53 | 54 | private slots: 55 | void enterImageChanged(QVariant index); 56 | void leaveImageChanged(QVariant index); 57 | 58 | public: 59 | QString getImageName() const; 60 | 61 | QSize sizeHint() const; 62 | QSize minimumSizeHint() const; 63 | 64 | public Q_SLOTS: 65 | //设置显示的图像 66 | void setImageName(const QString &imageName); 67 | }; 68 | 69 | #endif // ANIMATIONBUTTON1_H 70 | -------------------------------------------------------------------------------- /qt_image_include/verifiedcode.h: -------------------------------------------------------------------------------- 1 | #ifndef VERIFIEDCODE_H 2 | #define VERIFIEDCODE_H 3 | 4 | /** 5 | * 验证码控件 作者:feiyangqingyun(QQ:517216493) 2016-12-25 6 | * 1:可设置字符长度 7 | * 2:可设置噪点数量 8 | * 3:可设置干扰线条数量 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT VerifiedCode : public QWidget 21 | #else 22 | class VerifiedCode : public QWidget 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(int codeLen READ getCodeLen WRITE setCodeLen) 28 | Q_PROPERTY(int noiseCount READ getNoiseCount WRITE setNoiseCount) 29 | Q_PROPERTY(int lineCount READ getLineCount WRITE setLineCount) 30 | 31 | public: 32 | explicit VerifiedCode(QWidget *parent = 0); 33 | ~VerifiedCode(); 34 | 35 | protected: 36 | void paintEvent(QPaintEvent *); 37 | void drawRoise(QPainter *painter); 38 | void drawLine(QPainter *painter); 39 | void drawCode(QPainter *painter); 40 | 41 | private: 42 | int codeLen; //验证码长度 43 | int noiseCount; //噪点数量 44 | int lineCount; //干扰线数量 45 | 46 | QString code; //当前验证码 47 | QStringList listCode; //验证码池列表 48 | QStringList colorList; //颜色集合 49 | 50 | private: 51 | void updateCode(); 52 | 53 | public: 54 | int getCodeLen() const; 55 | int getNoiseCount() const; 56 | int getLineCount() const; 57 | QString getCode() const; 58 | 59 | QSize sizeHint() const; 60 | QSize minimumSizeHint() const; 61 | 62 | public Q_SLOTS: 63 | void loadCode(); 64 | void setCodeLen(int codeLen); 65 | void setNoiseCount(int noiseCount); 66 | void setLineCount(int lineCount); 67 | }; 68 | 69 | #endif // VERIFIEDCODE_H 70 | -------------------------------------------------------------------------------- /qt_image_include/ipaddress.h: -------------------------------------------------------------------------------- 1 | #ifndef IPADDRESS_H 2 | #define IPADDRESS_H 3 | 4 | /** 5 | * IP地址输入框控件 作者:feiyangqingyun(QQ:517216493) 2017-8-11 6 | * 1:可设置IP地址,自动填入框 7 | * 2:可清空IP地址 8 | * 3:支持按下小圆点自动切换 9 | * 4:支持退格键自动切换 10 | * 5:支持IP地址过滤 11 | * 6:可设置背景色/边框颜色/边框圆角角度 12 | */ 13 | 14 | #include 15 | 16 | class QLabel; 17 | class QLineEdit; 18 | 19 | #ifdef quc 20 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | class QDESIGNER_WIDGET_EXPORT IPAddress : public QWidget 27 | #else 28 | class IPAddress : public QWidget 29 | #endif 30 | 31 | { 32 | Q_OBJECT 33 | Q_PROPERTY(QString ip READ getIP WRITE setIP) 34 | 35 | public: 36 | explicit IPAddress(QWidget *parent = 0); 37 | 38 | protected: 39 | bool eventFilter(QObject *watched, QEvent *event); 40 | 41 | private: 42 | QLabel *labDot1; //第一个小圆点 43 | QLabel *labDot2; //第二个小圆点 44 | QLabel *labDot3; //第三个小圆点 45 | 46 | QLineEdit *txtIP1; //IP地址网段输入框1 47 | QLineEdit *txtIP2; //IP地址网段输入框2 48 | QLineEdit *txtIP3; //IP地址网段输入框3 49 | QLineEdit *txtIP4; //IP地址网段输入框4 50 | 51 | QString ip; //IP地址 52 | QString bgColor; //背景颜色 53 | QString borderColor;//边框颜色 54 | int borderRadius; //边框圆角角度 55 | 56 | private slots: 57 | void textChanged(const QString &text); 58 | 59 | public: 60 | //获取IP地址 61 | QString getIP() const; 62 | 63 | QSize sizeHint() const; 64 | QSize minimumSizeHint() const; 65 | 66 | public Q_SLOTS: 67 | //设置IP地址 68 | void setIP(const QString &ip); 69 | //清空 70 | void clear(); 71 | 72 | //设置背景颜色 73 | void setBgColor(const QString &bgColor); 74 | //设置边框颜色 75 | void setBorderColor(const QString &borderColor); 76 | //设置边框圆角角度 77 | void setBorderRadius(int borderRadius); 78 | 79 | }; 80 | 81 | #endif // IPADDRESS_H 82 | -------------------------------------------------------------------------------- /qt_image_include/framelesswidget.h: -------------------------------------------------------------------------------- 1 | #ifndef FRAMELESSWIDGET_H 2 | #define FRAMELESSWIDGET_H 3 | 4 | /** 5 | * 无边框窗体类 作者:feiyangqingyun(QQ:517216493) 2019-10-03 6 | * 1:可以指定需要无边框的widget 7 | * 2:边框四周八个方位都可以自由拉伸 8 | * 3:可设置对应位置的边距,以便识别更大区域 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT FramelessWidget : public QObject 21 | #else 22 | class FramelessWidget : public QObject 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit FramelessWidget(QObject *parent = 0); 29 | 30 | protected: 31 | bool eventFilter(QObject *watched, QEvent *event); 32 | 33 | private: 34 | int padding; //边距 35 | QWidget *widget; //无边框窗体 36 | 37 | bool pressed; //鼠标按下 38 | bool pressedLeft; //鼠标按下左侧 39 | bool pressedRight; //鼠标按下右侧 40 | bool pressedTop; //鼠标按下上侧 41 | bool pressedBottom; //鼠标按下下侧 42 | bool pressedLeftTop; //鼠标按下左上侧 43 | bool pressedRightTop; //鼠标按下右上侧 44 | bool pressedLeftBottom; //鼠标按下左下侧 45 | bool pressedRightBottom; //鼠标按下右下侧 46 | 47 | int rectX, rectY, rectW, rectH; //窗体坐标+宽高 48 | QPoint lastPos; //鼠标按下处坐标 49 | 50 | QRectF rectLeft; //左侧区域 51 | QRectF rectRight; //右侧区域 52 | QRectF rectTop; //上侧区域 53 | QRectF rectBottom; //下侧区域 54 | QRectF rectLeftTop; //左上侧区域 55 | QRectF rectRightTop; //右上侧区域 56 | QRectF rectLeftBottom; //左下侧区域 57 | QRectF rectRightBottom; //右下侧区域 58 | 59 | public Q_SLOTS: 60 | //设置边距 61 | void setPadding(int padding); 62 | //设置要无边框的窗体 63 | void setWidget(QWidget *widget); 64 | }; 65 | 66 | #endif // FRAMELESSWIDGET_H 67 | -------------------------------------------------------------------------------- /qt_image_include/shadowclock.h: -------------------------------------------------------------------------------- 1 | #ifndef SHADOWCLOCK_H 2 | #define SHADOWCLOCK_H 3 | 4 | /** 5 | * 光晕时钟控件 作者:雨田哥(QQ:3246214072) 整理:feiyangqingyun(QQ:517216493) 2019-10-07 6 | * 1:可设置圆弧半径宽度 7 | * 2:可设置光晕宽度 8 | * 3:可设置光晕颜色 9 | * 4:可设置文本颜色 10 | * 5:采用动画机制平滑进度展示时间 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT ShadowClock : public QWidget 23 | #else 24 | class ShadowClock : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int radiusWidth READ getRadiusWidth WRITE setRadiusWidth) 30 | Q_PROPERTY(int shadowWidth READ getShadowWidth WRITE setShadowWidth) 31 | 32 | Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor) 33 | Q_PROPERTY(QColor shadowColor READ getShadowColor WRITE setShadowColor) 34 | 35 | public: 36 | explicit ShadowClock(QWidget *parent = 0); 37 | ~ShadowClock(); 38 | 39 | protected: 40 | void paintEvent(QPaintEvent *); 41 | void drawArc(QPainter *painter, int radius, qreal angle); 42 | void drawText(QPainter *painter); 43 | 44 | private: 45 | int radiusWidth; //半径宽度 46 | int shadowWidth; //光晕宽度 47 | 48 | QColor textColor; //文本颜色 49 | QColor shadowColor; //光晕颜色 50 | 51 | public: 52 | int getRadiusWidth() const; 53 | int getShadowWidth() const; 54 | 55 | QColor getTextColor() const; 56 | QColor getShadowColor() const; 57 | 58 | QSize sizeHint() const; 59 | QSize minimumSizeHint() const; 60 | 61 | public Q_SLOTS: 62 | //设置半径宽度+光晕宽度 63 | void setRadiusWidth(int radiusWidth); 64 | void setShadowWidth(int shadowWidth); 65 | 66 | //设置文本颜色+光晕颜色 67 | void setTextColor(const QColor &textColor); 68 | void setShadowColor(const QColor &shadowColor); 69 | }; 70 | 71 | #endif // SHADOWCLOCK_H 72 | -------------------------------------------------------------------------------- /qt_image_include/pinyin.h: -------------------------------------------------------------------------------- 1 | #ifndef PINYIN_H 2 | #define PINYIN_H 3 | 4 | /** 5 | * 简体转繁体+汉字转拼音带音标类 作者:feiyangqingyun(QQ:517216493) 2019-2-16 6 | * 1:简体繁体互相转换 7 | * 2:汉字转拼音带音标 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT PinYin : public QObject 22 | #else 23 | class PinYin : public QObject 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | public: 29 | enum Format { 30 | Format_None = 0, 31 | Format_Tone = 1, 32 | Format_Number = 2 33 | }; 34 | 35 | static PinYin *Instance(); 36 | explicit PinYin(QObject *parent = 0); 37 | 38 | private: 39 | static QScopedPointer self; 40 | 41 | //分别存储单个汉字的拼音,多音字的拼音,繁体与简体对照表 42 | QMap map_one, map_group, map_fanti; 43 | 44 | //从文本文件读取汉字与拼音对照表 45 | QMap getDict(const QString &fileName); 46 | 47 | public slots: 48 | //初始化 49 | void initPath(const QString &path); 50 | void initDict(const QString &pinyin_one = "pinyin_one.txt", 51 | const QString &pinyin_group = "pinyin_group.txt", 52 | const QString &pinyin_fanti = "pinyin_fanti.txt"); 53 | 54 | //简体转繁体 55 | QChar getFanTi(const QChar &letter); 56 | QString getFanTi(const QString &str); 57 | 58 | //繁体转简体 59 | QChar getJianTi(const QChar &letter); 60 | QString getJianTi(const QString &str); 61 | 62 | //判断字符是否是汉字 63 | bool isChinese(const QChar &letter); 64 | 65 | //格式化拼音显示 66 | QStringList formatPinyin(const QString &str, const Format &format); 67 | 68 | //将单个汉字转换为相应格式的拼音 69 | QStringList getPinYin(const QChar &letter, const Format &format); 70 | 71 | //将字符串转换成相应格式的拼音 72 | QString getPinYin(const QString &str, const QString &separator, const Format &format); 73 | 74 | }; 75 | 76 | #endif // PINYIN_H 77 | -------------------------------------------------------------------------------- /qt_image_include/colorpanelfader.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORPANELFADER_H 2 | #define COLORPANELFADER_H 3 | 4 | /** 5 | * 颜色滑块面板 作者:feiyangqingyun(QQ:517216493) 2017-11-17 6 | * 1:可设置滑块条之间的间隔 7 | * 2:可设置滑块组之间的间隔 8 | * 3:可设置背景颜色 9 | */ 10 | 11 | #include 12 | 13 | class QHBoxLayout; 14 | class QSpacerItem; 15 | class ColorPanelBar; 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT ColorPanelFader : public QWidget 25 | #else 26 | class ColorPanelFader : public QWidget 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | Q_PROPERTY(int barSpace READ getBarSpace WRITE setBarSpace) 32 | Q_PROPERTY(int groupSpace READ getGroupSpace WRITE setGroupSpace) 33 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 34 | 35 | public: 36 | explicit ColorPanelFader(QWidget *parent = 0); 37 | 38 | protected: 39 | bool eventFilter(QObject *watched, QEvent *event); 40 | void paintEvent(QPaintEvent *); 41 | 42 | private: 43 | QHBoxLayout *layout; 44 | QSpacerItem *spacer1; 45 | QSpacerItem *spacer2; 46 | QList items; 47 | 48 | int barSpace; //柱状条间隔 49 | int groupSpace; //分组间隔 50 | QColor bgColor; //背景颜色 51 | 52 | private slots: 53 | void colorChanged(const QColor &color, double value, double percent); 54 | 55 | public: 56 | int getBarSpace() const; 57 | int getGroupSpace() const; 58 | QColor getBgColor() const; 59 | 60 | QSize sizeHint() const; 61 | QSize minimumSizeHint() const; 62 | 63 | public: 64 | //设置柱状条间隔 65 | void setBarSpace(int barSpace); 66 | //设置分组间隔 67 | void setGroupSpace(int groupSpace); 68 | //设置背景颜色 69 | void setBgColor(const QColor &bgColor); 70 | 71 | Q_SIGNALS: 72 | void colorChanged(const QColor &color, double hue, double sat, double bright); 73 | }; 74 | 75 | #endif // COLORPANELFADER_H 76 | -------------------------------------------------------------------------------- /mqtt/qmqtt_global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_global.h - qmqtt libray global 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_GLOBAL_H 33 | #define QMQTT_GLOBAL_H 34 | 35 | #include 36 | 37 | #ifndef QT_STATIC 38 | # if defined(QT_BUILD_QMQTT_LIB) 39 | # define Q_MQTT_EXPORT Q_DECL_EXPORT 40 | # else 41 | # define Q_MQTT_EXPORT Q_DECL_IMPORT 42 | # endif 43 | #else 44 | # define Q_MQTT_EXPORT 45 | #endif 46 | 47 | #endif // QMQTT_GLOBAL_H 48 | 49 | -------------------------------------------------------------------------------- /qt_image_include/magicpool.h: -------------------------------------------------------------------------------- 1 | #ifndef MAGICPOOL_H 2 | #define MAGICPOOL_H 3 | 4 | /** 5 | * 魔幻水池控件 作者:feiyangqingyun(QQ:517216493) 2018-7-15 6 | * 1:可设置最大半径 7 | * 2:可设置边框大小+边框颜色 8 | * 3:可设置背景颜色 9 | */ 10 | 11 | #include 12 | 13 | class MagicFish; 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT MagicPool : public QWidget 23 | #else 24 | class MagicPool : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int maxRadius READ getMaxRadius WRITE setMaxRadius) 30 | Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth) 31 | Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor) 32 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 33 | 34 | public: 35 | explicit MagicPool(QWidget *parent = 0); 36 | ~MagicPool(); 37 | 38 | protected: 39 | void mousePressEvent(QMouseEvent *); 40 | void paintEvent(QPaintEvent *); 41 | 42 | private: 43 | int maxRadius; //最大半径 44 | int borderWidth; //边框大小 45 | QColor borderColor; //边框颜色 46 | QColor bgColor; //背景颜色 47 | 48 | bool startDraw; //开始绘制 49 | int currentRadius; //当前半径 50 | 51 | QPoint posPress; //按下处的坐标 52 | QTimer *timerUpdate; //绘制定时器 53 | 54 | private slots: 55 | void updateValue(); 56 | 57 | public: 58 | int getMaxRadius() const; 59 | int getBorderWidth() const; 60 | QColor getBorderColor() const; 61 | QColor getBgColor() const; 62 | 63 | QSize sizeHint() const; 64 | QSize minimumSizeHint() const; 65 | 66 | public Q_SLOTS: 67 | //设置最大半径 68 | void setMaxRadius(int maxRadius); 69 | //设置边框宽度 70 | void setBorderWidth(int borderWidth); 71 | //设置边框颜色 72 | void setBorderColor(const QColor &borderColor); 73 | //设置背景颜色 74 | void setBgColor(const QColor &bgColor); 75 | }; 76 | 77 | #endif // MAGICPOOL_H 78 | -------------------------------------------------------------------------------- /qt_image_include/videopanel.h: -------------------------------------------------------------------------------- 1 | #ifndef VIDEOPANEL_H 2 | #define VIDEOPANEL_H 3 | 4 | /** 5 | * 视频监控画面控件 整理:feiyangqingyun(QQ:517216493) 2019-4-11 6 | * 1:目前颜色都写死在样式表,可自行更改或者拓展属性设置 7 | */ 8 | 9 | #include 10 | 11 | class QMenu; 12 | class QLabel; 13 | class QGridLayout; 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT VideoPanel : public QWidget 23 | #else 24 | class VideoPanel : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit VideoPanel(QWidget *parent = 0); 32 | 33 | protected: 34 | bool eventFilter(QObject *watched, QEvent *event); 35 | 36 | private: 37 | QGridLayout *gridLayout; //表格布局存放视频标签 38 | bool videoMax; //是否最大化 39 | int videoCount; //视频通道个数 40 | QString videoType; //当前画面类型 41 | QMenu *videoMenu; //右键菜单 42 | QAction *actionFull; //全屏动作 43 | QAction *actionPoll; //轮询动作 44 | QList widgets; //视频标签集合 45 | 46 | public: 47 | QSize sizeHint() const; 48 | QSize minimumSizeHint() const; 49 | 50 | private slots: 51 | void initControl(); 52 | void initForm(); 53 | void initMenu(); 54 | void full(); 55 | void poll(); 56 | 57 | private slots: 58 | void play_video_all(); 59 | void snapshot_video_one(); 60 | void snapshot_video_all(); 61 | 62 | void show_video_all(); 63 | void show_video_4(); 64 | void show_video_6(); 65 | void show_video_8(); 66 | void show_video_9(); 67 | void show_video_13(); 68 | void show_video_16(); 69 | 70 | void hide_video_all(); 71 | void change_video(int index, int flag); 72 | void change_video_4(int index); 73 | void change_video_6(int index); 74 | void change_video_8(int index); 75 | void change_video_9(int index); 76 | void change_video_13(int index); 77 | void change_video_16(int index); 78 | 79 | signals: 80 | void fullScreen(bool full); 81 | }; 82 | 83 | #endif // VIDEOPANEL_H 84 | -------------------------------------------------------------------------------- /qt_image_include/tumblerdatetime.h: -------------------------------------------------------------------------------- 1 | #ifndef TUMBLERDATETIME_H 2 | #define TUMBLERDATETIME_H 3 | 4 | /** 5 | * 日期时间滑动选择器 作者:feiyangqingyun(QQ:517216493) 2017-8-11 6 | * 1:可设置年月日时分秒 7 | * 2:可鼠标或者手指滑动选择年月日时分秒 8 | * 3:支持自定义数值范围 9 | * 4:支持鼠标滚轮选择 10 | * 5:年月日自动联动计算 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | class Tumbler; 17 | class TumblerDateTime; 18 | 19 | #ifdef quc 20 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | class QDESIGNER_WIDGET_EXPORT TumblerDateTime : public QWidget 27 | #else 28 | class TumblerDateTime : public QWidget 29 | #endif 30 | 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit TumblerDateTime(QWidget *parent = 0); 35 | 36 | private: 37 | int year; //年份 38 | int month; //月份 39 | int day; //日期 40 | int hour; //时钟 41 | int min; //分钟 42 | int sec; //秒钟 43 | 44 | Tumbler *tumblerYear; //年份选择器 45 | Tumbler *tumblerMonth; //月份选择器 46 | Tumbler *tumblerDay; //日期选择器 47 | Tumbler *tumblerHour; //时钟选择器 48 | Tumbler *tumblerMin; //分钟选择器 49 | Tumbler *tumblerSec; //秒钟选择器 50 | 51 | private slots: 52 | void initForm(); 53 | void currentValueChanged(const QString &); 54 | 55 | public: 56 | //获取年份 57 | int getYear() const; 58 | //获取月份 59 | int getMonth() const; 60 | //获取日期 61 | int getDay() const; 62 | 63 | //获取时钟 64 | int getHour() const; 65 | //获取分钟 66 | int getMin() const; 67 | //获取秒钟 68 | int getSec() const; 69 | 70 | public Q_SLOTS: 71 | //设置年份 72 | void setYear(int year); 73 | 74 | //设置月份 75 | void setMonth(int month); 76 | 77 | //设置日期 78 | void setDay(int day); 79 | 80 | //设置时钟 81 | void setHour(int hour); 82 | 83 | //设置分钟 84 | void setMin(int min); 85 | 86 | //设置秒钟 87 | void setSec(int sec); 88 | 89 | //设置年月日 90 | void setDateTime(int year, int month, int day, int hour, int min, int sec); 91 | }; 92 | 93 | #endif // TUMBLERDATETIME_H 94 | -------------------------------------------------------------------------------- /qt_image_include/iconeditor.h: -------------------------------------------------------------------------------- 1 | #ifndef ICONEDITOR_H 2 | #define ICONEDITOR_H 3 | 4 | /** 5 | * 图标编辑控件 作者:feiyangqingyun(QQ:517216493) 2017-2-10 6 | * 来源于Qt官方教材 7 | * 1:可设置伸缩因子 8 | * 2:可设置宫格线条颜色 9 | * 3:可设置画笔颜色 10 | * 4:可设置ico图片 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT IconEditor : public QWidget 23 | #else 24 | class IconEditor : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int zoomFactor READ getZoomFactor WRITE setZoomFactor) 30 | Q_PROPERTY(QColor lineColor READ getLineColor WRITE setLineColor) 31 | Q_PROPERTY(QColor penColor READ getPenColor WRITE setPenColor) 32 | Q_PROPERTY(QImage iconImage READ getIconImage WRITE setIconImage) 33 | 34 | public: 35 | explicit IconEditor(QWidget *parent = 0); 36 | 37 | protected: 38 | void mousePressEvent(QMouseEvent *event); 39 | void mouseMoveEvent(QMouseEvent *event); 40 | void paintEvent(QPaintEvent *event); 41 | void drawBg(QPainter *painter); 42 | void drawIcon(QPainter *painter, QPaintEvent *event); 43 | 44 | private: 45 | int zoomFactor; //伸缩因子 46 | QColor lineColor; //线条颜色 47 | QColor penColor; //画笔颜色 48 | QImage iconImage; //ico图片 49 | 50 | private: 51 | void setImagePixel(const QPoint &pos, bool opaque); 52 | QRect pixelRect(int i, int j) const; 53 | 54 | public: 55 | int getZoomFactor() const; 56 | QColor getLineColor() const; 57 | QColor getPenColor() const; 58 | QImage getIconImage() const; 59 | 60 | QSize sizeHint() const; 61 | QSize minimumSizeHint() const; 62 | 63 | public Q_SLOTS: 64 | void setZoomFactor(int zoomFactor); 65 | void setLineColor(const QColor &lineColor); 66 | void setPenColor(const QColor &penColor); 67 | void setIconImage(const QImage &iconImage); 68 | void setIconImage(const QString &iconFile); 69 | void saveIcon(const QString &file); 70 | void saveBg(const QString &file); 71 | }; 72 | 73 | #endif // ICONEDITOR_H 74 | -------------------------------------------------------------------------------- /mqtt/qmqtt_router.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_router.h - qmqtt router 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * Router added by Niklas Wulf 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of mqttc nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | #ifndef QMQTT_ROUTER_H 34 | #define QMQTT_ROUTER_H 35 | 36 | #include 37 | 38 | #include 39 | 40 | namespace QMQTT { 41 | 42 | class Client; 43 | class RouteSubscription; 44 | 45 | class Q_MQTT_EXPORT Router : public QObject 46 | { 47 | Q_OBJECT 48 | public: 49 | explicit Router(Client *parent = 0); 50 | 51 | RouteSubscription *subscribe(const QString &route); 52 | Client *client() const; 53 | 54 | private: 55 | Client *_client; 56 | }; 57 | 58 | } // namespace QMQTT 59 | 60 | #endif // QMQTT_ROUTER_H 61 | -------------------------------------------------------------------------------- /qt_image_include/gifwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef GIFWIDGET_H 2 | #define GIFWIDGET_H 3 | 4 | /** 5 | * GIF录屏控件 作者:feiyangqingyun(QQ:517216493) 2019-4-3 6 | * 1:可设置要录制屏幕的宽高,支持右下角直接拉动改变. 7 | * 2:可设置变宽的宽度 8 | * 3:可设置录屏控件的背景颜色 9 | * 4:可设置录制的帧数 10 | * 5:录制区域可自由拖动选择 11 | */ 12 | 13 | #include 14 | #include "gif.h" 15 | 16 | class QLineEdit; 17 | class QLabel; 18 | 19 | #ifdef quc 20 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | class QDESIGNER_WIDGET_EXPORT GifWidget : public QDialog 27 | #else 28 | class GifWidget : public QDialog 29 | #endif 30 | 31 | { 32 | Q_OBJECT 33 | Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth) 34 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 35 | 36 | public: 37 | static GifWidget *Instance(); 38 | explicit GifWidget(QWidget *parent = 0); 39 | 40 | protected: 41 | bool eventFilter(QObject *watched, QEvent *event); 42 | void resizeEvent(QResizeEvent *); 43 | void paintEvent(QPaintEvent *); 44 | 45 | private: 46 | static QScopedPointer self; 47 | QWidget *widgetTop; //标题栏 48 | QWidget *widgetMain; //中间部分 49 | QWidget *widgetBottom; //底部栏 50 | QLineEdit *txtFps; //帧率输入框 51 | QLineEdit *txtWidth; //宽度输入框 52 | QLineEdit *txtHeight; //高度输入框 53 | QPushButton *btnStart; //开始按钮 54 | QLabel *labStatus; //显示状态信息 55 | 56 | int fps; //帧数 100为1s 57 | int borderWidth; //边框宽度 58 | QColor bgColor; //背景颜色 59 | 60 | int count; //帧数计数 61 | QString fileName; //保存文件名称 62 | QRect rectGif; //截屏区域 63 | QTimer *timer; //截屏定时器 64 | 65 | Gif gif; //gif类对象 66 | Gif::GifWriter *gifWriter; //gif写入对象 67 | 68 | public: 69 | int getBorderWidth() const; 70 | QColor getBgColor() const; 71 | 72 | private slots: 73 | void initControl(); 74 | void initForm(); 75 | void saveImage(); 76 | void record(); 77 | void closeAll(); 78 | void resizeForm(); 79 | 80 | public Q_SLOTS: 81 | void setBorderWidth(int borderWidth); 82 | void setBgColor(const QColor &bgColor); 83 | }; 84 | 85 | #endif // GIFWIDGET_H 86 | -------------------------------------------------------------------------------- /qt_image_include/lcdnumber.h: -------------------------------------------------------------------------------- 1 | #ifndef LCDNUMBER_H 2 | #define LCDNUMBER_H 3 | 4 | /** 5 | * LCD数字控件 作者:feiyangqingyun(QQ:517216493) 2016-10-31 6 | * 1:可设置目标值和间隔 7 | * 2:可设置背景颜色和数字颜色 8 | */ 9 | 10 | #include 11 | 12 | #ifdef quc 13 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 14 | #include 15 | #else 16 | #include 17 | #endif 18 | 19 | class QDESIGNER_WIDGET_EXPORT LcdNumber : public QWidget 20 | #else 21 | class LcdNumber : public QWidget 22 | #endif 23 | 24 | { 25 | Q_OBJECT 26 | Q_PROPERTY(int number READ getNumber WRITE setNumber) 27 | Q_PROPERTY(int space READ getSpace WRITE setSpace) 28 | 29 | Q_PROPERTY(QColor bgColorStart READ getBgColorStart WRITE setBgColorStart) 30 | Q_PROPERTY(QColor bgColorEnd READ getBgColorEnd WRITE setBgColorEnd) 31 | 32 | Q_PROPERTY(QColor numberColorStart READ getNumberColorStart WRITE setNumberColorStart) 33 | Q_PROPERTY(QColor numberColorEnd READ getNumberColorEnd WRITE setNumberColorEnd) 34 | 35 | public: 36 | explicit LcdNumber(QWidget *parent = 0); 37 | 38 | protected: 39 | void paintEvent(QPaintEvent *); 40 | void drawBg(QPainter *painter); 41 | void drawNumber(QPainter *painter); 42 | 43 | private: 44 | int number; //目标值 45 | int space; //间距 46 | 47 | QColor bgColorStart; //背景渐变开始颜色 48 | QColor bgColorEnd; //背景渐变结束颜色 49 | 50 | QColor numberColorStart;//数字渐变开始颜色 51 | QColor numberColorEnd; //数字渐变结束颜色 52 | 53 | public: 54 | int getNumber() const; 55 | int getSpace() const; 56 | 57 | QColor getBgColorStart() const; 58 | QColor getBgColorEnd() const; 59 | 60 | QColor getNumberColorStart() const; 61 | QColor getNumberColorEnd() const; 62 | 63 | QSize sizeHint() const; 64 | QSize minimumSizeHint() const; 65 | 66 | public Q_SLOTS: 67 | //设置值 68 | void setNumber(int number); 69 | //设置间距 70 | void setSpace(int space); 71 | 72 | //设置背景颜色 73 | void setBgColorStart(const QColor &bgColorStart); 74 | void setBgColorEnd(const QColor &bgColorEnd); 75 | 76 | //设置数字颜色 77 | void setNumberColorStart(const QColor &numberColorStart); 78 | void setNumberColorEnd(const QColor &numberColorEnd); 79 | }; 80 | 81 | #endif // LCDNUMBER_H 82 | -------------------------------------------------------------------------------- /qt_image_include/colorstyle.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORSTYLE_H 2 | #define COLORSTYLE_H 3 | 4 | /** 5 | * 颜色样式选择控件 作者:feiyangqingyun(QQ:517216493) 2017-9-10 6 | * 1:可设置背景颜色 7 | * 2:可设置角标颜色 8 | * 3:可设置角标大小 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT ColorStyle : public QWidget 21 | #else 22 | class ColorStyle : public QWidget 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 28 | Q_PROPERTY(QColor signColor READ getSignColor WRITE setSignColor) 29 | Q_PROPERTY(int signSize READ getSignSize WRITE setSignSize) 30 | Q_PROPERTY(bool checked READ getChecked WRITE setChecked) 31 | Q_PROPERTY(bool hovered READ getHovered WRITE setHovered) 32 | 33 | public: 34 | explicit ColorStyle(QWidget *parent = 0); 35 | 36 | protected: 37 | void enterEvent(QEvent *); 38 | void leaveEvent(QEvent *); 39 | void mousePressEvent(QMouseEvent *); 40 | void paintEvent(QPaintEvent *); 41 | void drawBg(QPainter *painter); 42 | void drawSign(QPainter *painter); 43 | 44 | private: 45 | QColor bgColor; //背景颜色 46 | QColor signColor; //选中符号颜色 47 | int signSize; //选中符号大小 48 | bool checked; //是否选中 49 | bool hovered; //是否永久悬停 50 | 51 | QFont iconFont; //图形字体 52 | bool hover; //当前是否悬停 53 | 54 | public: 55 | QColor getBgColor() const; 56 | QColor getSignColor() const; 57 | int getSignSize() const; 58 | bool getChecked() const; 59 | bool getHovered() const; 60 | 61 | QSize sizeHint() const; 62 | QSize minimumSizeHint() const; 63 | 64 | public Q_SLOTS: 65 | //设置背景颜色 66 | void setBgColor(const QColor &bgColor); 67 | 68 | //设置角标颜色 69 | void setSignColor(const QColor &signColor); 70 | 71 | //设置角标大小 72 | void setSignSize(int signSize); 73 | 74 | //设置是否选中 75 | void setChecked(bool checked); 76 | 77 | //设置是否永久悬停 78 | void setHovered(bool hovered); 79 | 80 | Q_SIGNALS: 81 | //当前选中发送颜色值 82 | void selected(const QColor &bgColor); 83 | 84 | }; 85 | 86 | #endif // COLORSTYLE_H 87 | -------------------------------------------------------------------------------- /mqtt/qmqtt_timer_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_timer_p.h - qmqtt timer private header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_TIMER_P_H 33 | #define QMQTT_TIMER_P_H 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | 40 | namespace QMQTT { 41 | 42 | class Timer : public TimerInterface 43 | { 44 | Q_OBJECT 45 | public: 46 | explicit Timer(QObject *parent = 0); 47 | virtual ~Timer(); 48 | 49 | bool isSingleShot() const; 50 | void setSingleShot(bool singleShot); 51 | int interval() const; 52 | void setInterval(int msec); 53 | void start(); 54 | void stop(); 55 | 56 | protected: 57 | QTimer _timer; 58 | }; 59 | 60 | } 61 | 62 | #endif // QMQTT_TIMER_P_H 63 | -------------------------------------------------------------------------------- /qt_image_include/waveplot.h: -------------------------------------------------------------------------------- 1 | #ifndef WAVEPLOT_H 2 | #define WAVEPLOT_H 3 | 4 | /** 5 | * 正弦曲线控件 作者:feiyangqingyun(QQ:517216493) 2017-2-10 6 | * 1:可设置波浪的速度 7 | * 2:可设置波浪的高度 8 | * 3:可设置波浪的密度,密度越大越浪 9 | * 4:可设置背景颜色 10 | * 5:可设置波浪颜色 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT WavePlot : public QWidget 23 | #else 24 | class WavePlot : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int interval READ getInterval WRITE setInterval) 30 | Q_PROPERTY(double waterHeight READ getWaterHeight WRITE setWaterHeight) 31 | Q_PROPERTY(double waterDensity READ getWaterDensity WRITE setWaterDensity) 32 | Q_PROPERTY(QColor lineColor READ getLineColor WRITE setLineColor) 33 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 34 | 35 | public: 36 | explicit WavePlot(QWidget *parent = 0); 37 | ~WavePlot(); 38 | 39 | protected: 40 | void paintEvent(QPaintEvent *); 41 | void drawBg(QPainter *painter); 42 | void drawLine(QPainter *painter); 43 | 44 | private: 45 | int interval; //间隔 46 | double waterHeight; //水波高度 47 | double waterDensity; //水波密度 48 | QColor lineColor; //线条颜色 49 | QColor bgColor; //背景颜色 50 | 51 | double offset; //水波偏移量 52 | QTimer *timer; //定时器绘制动画 53 | 54 | public: 55 | int getInterval() const; 56 | double getWaterHeight() const; 57 | double getWaterDensity() const; 58 | QColor getLineColor() const; 59 | QColor getBgColor() const; 60 | 61 | QSize sizeHint() const; 62 | QSize minimumSizeHint() const; 63 | 64 | public Q_SLOTS: 65 | //启动波动 66 | void start(); 67 | //停止波动 68 | void stop(); 69 | 70 | //设置波动间隔 71 | void setInterval(int interval); 72 | //设置水波高度 73 | void setWaterHeight(double waterHeight); 74 | //设置水波密度 75 | void setWaterDensity(double waterDensity); 76 | 77 | //设置线条颜色 78 | void setLineColor(const QColor &lineColor); 79 | //设置背景颜色 80 | void setBgColor(const QColor &bgColor); 81 | }; 82 | 83 | #endif // WAVEPLOT_H 84 | -------------------------------------------------------------------------------- /MQTT_Smart_Home.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2020-02-05T18:10:30 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | QT += xml 9 | QT += network 10 | 11 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 12 | 13 | TARGET = MQTT_Smart_Home 14 | TEMPLATE = app 15 | 16 | # The following define makes your compiler emit warnings if you use 17 | # any feature of Qt which has been marked as deprecated (the exact warnings 18 | # depend on your compiler). Please consult the documentation of the 19 | # deprecated API in order to know how to port your code away from it. 20 | DEFINES += QT_DEPRECATED_WARNINGS 21 | 22 | # You can also make your code fail to compile if you use deprecated APIs. 23 | # In order to do so, uncomment the following line. 24 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 25 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 26 | 27 | CONFIG += c++11 28 | 29 | SOURCES += \ 30 | main.cpp \ 31 | mainwindow.cpp 32 | 33 | HEADERS += \ 34 | mainwindow.h 35 | 36 | FORMS += \ 37 | mainwindow.ui 38 | 39 | INCLUDEPATH += $$PWD/sdk 40 | 41 | CONFIG(debug, debug|release){ 42 | LIBS += -L$$PWD/sdk/ -lqucd 43 | } else { 44 | LIBS += -L$$PWD/sdk/ -lquc 45 | } 46 | 47 | 48 | # Default rules for deployment. 49 | qnx: target.path = /tmp/$${TARGET}/bin 50 | else: unix:!android: target.path = /opt/$${TARGET}/bin 51 | !isEmpty(target.path): INSTALLS += target 52 | 53 | DISTFILES += 54 | 55 | win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/ -lQt5Qmqtt 56 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/ -lQt5Qmqttd 57 | else:unix: LIBS += -L$$PWD/lib/ -lQt5Qmqtt 58 | 59 | INCLUDEPATH += $$PWD/include 60 | DEPENDPATH += $$PWD/include 61 | 62 | win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/ -lQt5Qmqtt 63 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/ -lQt5Qmqttd 64 | else:unix: LIBS += -L$$PWD/lib/ -lQt5Qmqtt 65 | 66 | INCLUDEPATH += $$PWD/include 67 | DEPENDPATH += $$PWD/include 68 | 69 | win32:CONFIG(release, debug|release): LIBS += -L$$PWD/./ -lquc 70 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/./ -lqucd 71 | else:unix: LIBS += -L$$PWD/./ -lquc 72 | 73 | INCLUDEPATH += $$PWD/. 74 | DEPENDPATH += $$PWD/. 75 | -------------------------------------------------------------------------------- /qt_image_include/shadowcalendar.h: -------------------------------------------------------------------------------- 1 | #ifndef SHADOWCALENDAR_H 2 | #define SHADOWCALENDAR_H 3 | 4 | /** 5 | * 光晕日历控件 作者:雨田哥(QQ:3246214072) 整理:feiyangqingyun(QQ:517216493) 2019-10-07 6 | * 1:可设置背景颜色 7 | * 2:可设置光晕颜色 8 | * 3:可设置文字颜色 9 | * 4:可设置选中日期背景 10 | * 5:光晕跟随鼠标移动 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | #ifdef quc 17 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 18 | #include 19 | #else 20 | #include 21 | #endif 22 | 23 | class QDESIGNER_WIDGET_EXPORT ShadowCalendar : public QWidget 24 | #else 25 | class ShadowCalendar : public QWidget 26 | #endif 27 | 28 | { 29 | Q_OBJECT 30 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 31 | Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor) 32 | Q_PROPERTY(QColor shadowColor READ getShadowColor WRITE setShadowColor) 33 | Q_PROPERTY(QColor selectColor READ getSelectColor WRITE setSelectColor) 34 | 35 | public: 36 | struct DateItem { 37 | int year; 38 | int month; 39 | int day; 40 | 41 | DateItem() 42 | { 43 | year = -1; 44 | month = -1; 45 | day = -1; 46 | } 47 | }; 48 | 49 | explicit ShadowCalendar(QWidget *parent = 0); 50 | ~ShadowCalendar(); 51 | 52 | public: 53 | void updateCalendar(const QDate &selectDate); 54 | 55 | protected: 56 | void leaveEvent(QEvent *); 57 | void mouseMoveEvent(QMouseEvent *); 58 | void paintEvent(QPaintEvent *); 59 | 60 | private: 61 | QColor bgColor; //背景颜色 62 | QColor textColor; //文字颜色 63 | QColor shadowColor; //光晕颜色 64 | QColor selectColor; //选中颜色 65 | 66 | QDate selectDate; //今天日期 67 | DateItem dateItem[6][7]; //日期数组 68 | 69 | public: 70 | QColor getBgColor() const; 71 | QColor getTextColor() const; 72 | QColor getShadowColor() const; 73 | QColor getSelectColor() const; 74 | 75 | QSize sizeHint() const; 76 | QSize minimumSizeHint() const; 77 | 78 | public Q_SLOTS: 79 | //设置背景颜色+文字颜色+光晕颜色+选中颜色 80 | void setBgColor(const QColor &bgColor); 81 | void setTextColor(const QColor &textColor); 82 | void setShadowColor(const QColor &shadowColor); 83 | void setSelectColor(const QColor &selectColor); 84 | }; 85 | 86 | #endif // SHADOWCALENDAR_H 87 | -------------------------------------------------------------------------------- /qt_image_include/screenwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef SCREENWIDGET_H 2 | #define SCREENWIDGET_H 3 | 4 | /** 5 | * 全局截屏控件 作者:feiyangqingyun(QQ:517216493) 2016-11-11 6 | * 1:支持鼠标右键选择菜单 7 | * 2:支持全局截屏和局部截屏 8 | * 3:支持图片另存为 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | class Screen 17 | { 18 | public: 19 | enum STATUS {SELECT, MOV, SET_W_H}; 20 | Screen() {} 21 | Screen(QSize size); 22 | 23 | void setStart(QPoint pos); 24 | void setEnd(QPoint pos); 25 | QPoint getStart(); 26 | QPoint getEnd(); 27 | 28 | QPoint getLeftUp(); 29 | QPoint getRightDown(); 30 | 31 | STATUS getStatus(); 32 | void setStatus(STATUS status); 33 | 34 | int width(); 35 | int height(); 36 | bool isInArea(QPoint pos); // 检测pos是否在截图区域内 37 | void move(QPoint p); // 按 p 移动截图区域 38 | 39 | private: 40 | QPoint leftUpPos, rightDownPos; //记录 截图区域 左上角、右下角 41 | QPoint startPos, endPos; //记录 鼠标开始位置、结束位置 42 | int maxWidth, maxHeight; //记录屏幕大小 43 | STATUS status; //三个状态: 选择区域、移动区域、设置width height 44 | 45 | void cmpPoint(QPoint &s, QPoint &e);//比较两位置,判断左上角、右下角 46 | }; 47 | 48 | #ifdef quc 49 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 50 | #include 51 | #else 52 | #include 53 | #endif 54 | 55 | class QDESIGNER_WIDGET_EXPORT ScreenWidget : public QWidget 56 | #else 57 | class ScreenWidget : public QWidget 58 | #endif 59 | 60 | { 61 | Q_OBJECT 62 | public: 63 | static ScreenWidget *Instance(); 64 | explicit ScreenWidget(QWidget *parent = 0); 65 | 66 | private: 67 | static QScopedPointer self; 68 | QMenu *menu; //右键菜单对象 69 | Screen *screen; //截屏对象 70 | QPixmap *fullScreen; //保存全屏图像 71 | QPixmap *bgScreen; //模糊背景图 72 | QPoint movPos; //坐标 73 | 74 | protected: 75 | void contextMenuEvent(QContextMenuEvent *); 76 | void mousePressEvent(QMouseEvent *); 77 | void mouseMoveEvent(QMouseEvent *); 78 | void mouseReleaseEvent(QMouseEvent *); 79 | void paintEvent(QPaintEvent *); 80 | void showEvent(QShowEvent *); 81 | 82 | private slots: 83 | void saveScreen(); 84 | void saveFullScreen(); 85 | void saveScreenOther(); 86 | void saveFullOther(); 87 | }; 88 | 89 | #endif // SCREENWIDGET_H 90 | 91 | -------------------------------------------------------------------------------- /qt_image_include/colorpanelbtn.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORPANELBTN_H 2 | #define COLORPANELBTN_H 3 | 4 | /** 5 | * 颜色按钮面板 作者:feiyangqingyun(QQ:517216493) 2017-11-17 6 | * 1:可设置颜色集合 7 | * 2:可设置按钮圆角角度 8 | * 3:可设置列数 9 | * 4:可设置按钮边框宽度和边框颜色 10 | */ 11 | 12 | #include 13 | 14 | class QGridLayout; 15 | class QPushButton; 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT ColorPanelBtn : public QWidget 25 | #else 26 | class ColorPanelBtn : public QWidget 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | Q_PROPERTY(int space READ getSpace WRITE setSpace) 32 | Q_PROPERTY(int columnCount READ getColumnCount WRITE setColumnCount) 33 | Q_PROPERTY(int borderRadius READ getBorderRadius WRITE setBorderRadius) 34 | Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth) 35 | Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor) 36 | 37 | public: 38 | explicit ColorPanelBtn(QWidget *parent = 0); 39 | 40 | private: 41 | QGridLayout *gridLayout; 42 | QList btns; 43 | QStringList colors; 44 | 45 | int space; //按钮之间的间隔 46 | int columnCount; //按钮列数 47 | int borderRadius; //边框圆角 48 | int borderWidth; //边框宽度 49 | QColor borderColor; //边框颜色 50 | 51 | private slots: 52 | void initStyle(); 53 | void initBtn(); 54 | void btnClicked(); 55 | 56 | public: 57 | QStringList getColors() const; 58 | 59 | int getSpace() const; 60 | int getColumnCount() const; 61 | int getBorderRadius() const; 62 | int getBorderWidth() const; 63 | QColor getBorderColor() const; 64 | 65 | QSize sizeHint() const; 66 | QSize minimumSizeHint() const; 67 | 68 | public Q_SLOTS: 69 | //设置颜色集合 70 | void setColors(const QStringList &colors); 71 | 72 | //设置按钮间隔 73 | void setSpace(int space); 74 | 75 | //设置列数 76 | void setColumnCount(int columnCount); 77 | 78 | //设置圆角角度 79 | void setBorderRadius(int borderRadius); 80 | 81 | //设置边框宽度 82 | void setBorderWidth(int borderWidth); 83 | 84 | //设置边框颜色 85 | void setBorderColor(const QColor &borderColor); 86 | 87 | Q_SIGNALS: 88 | void colorChanged(const QColor &color); 89 | 90 | }; 91 | 92 | #endif // COLORPANELBTN_H 93 | -------------------------------------------------------------------------------- /qt_image_include/animationbutton2.h: -------------------------------------------------------------------------------- 1 | #ifndef ANIMATIONBUTTON2_H 2 | #define ANIMATIONBUTTON2_H 3 | 4 | /** 5 | * 动画图片按钮控件 作者:feiyangqingyun(QQ:517216493) 2016-10-16 6 | * 本控件来源于网络(原作者:what951006(http://blog.csdn.net/what951006/article/details/51542497)) 7 | * 1:可设置普通状态图片 8 | * 2:可设置进入状态图片 9 | * 3:可设置离开状态图片 10 | * 4:按照比例自动居中绘制 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | class QPropertyAnimation; 17 | 18 | #ifdef quc 19 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 20 | #include 21 | #else 22 | #include 23 | #endif 24 | 25 | class QDESIGNER_WIDGET_EXPORT AnimationButton2 : public QWidget 26 | #else 27 | class AnimationButton2 : public QWidget 28 | #endif 29 | 30 | { 31 | Q_OBJECT 32 | Q_PROPERTY(QString normalImage READ getNormalImage WRITE setNormalImage) 33 | Q_PROPERTY(QString enterImage READ getEnterImage WRITE setEnterImage) 34 | Q_PROPERTY(QString leaveImage READ getLeaveImage WRITE setLeaveImage) 35 | 36 | public: 37 | explicit AnimationButton2(QWidget *parent = 0); 38 | ~AnimationButton2(); 39 | 40 | protected: 41 | void enterEvent(QEvent *); 42 | void leaveEvent(QEvent *); 43 | void paintEvent(QPaintEvent *); 44 | 45 | private: 46 | bool enter; //是否进入 47 | bool leave; //是否离开 48 | int enterIndex; //进入图片索引 49 | int leaveIndex; //离开图片索引 50 | 51 | QPropertyAnimation *enterAnimation; //进入动画 52 | QPropertyAnimation *leaveAnimation; //离开动画 53 | 54 | QList listPixEnter; //进入图片队列 55 | QList listPixLeave; //离开图片队列 56 | QPixmap pixNormal; //默认图片 57 | 58 | QString normalImage; //默认状态图片地址 59 | QString enterImage; //进入状态图片地址 60 | QString leaveImage; //离开状态图片地址 61 | 62 | private slots: 63 | void enterImageChanged(QVariant index); 64 | void leaveImageChanged(QVariant index); 65 | 66 | public: 67 | QString getNormalImage() const; 68 | QString getEnterImage() const; 69 | QString getLeaveImage() const; 70 | 71 | QSize sizeHint() const; 72 | QSize minimumSizeHint() const; 73 | 74 | public Q_SLOTS: 75 | //设置普通状态图片 76 | void setNormalImage(QString normalImage); 77 | //设置进入状态图片 78 | void setEnterImage(QString enterImage); 79 | //设置离开状态图片 80 | void setLeaveImage(QString leaveImage); 81 | }; 82 | 83 | #endif // ANIMATIONBUTTON2_H 84 | -------------------------------------------------------------------------------- /qt_image_include/magicmouse.h: -------------------------------------------------------------------------------- 1 | #ifndef MAGICMOUSE_H 2 | #define MAGICMOUSE_H 3 | 4 | /** 5 | * 魔幻老鼠控件 作者:feiyangqingyun(QQ:517216493) 2018-7-15 6 | * 本控件来源于qtdemo 7 | * 1:可设置身体+眼睛+眼珠+鼻子+尾巴的颜色 8 | * 2:可设置停留位置旋转角度 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT MagicMouse : public QWidget 21 | #else 22 | class MagicMouse : public QWidget 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(int angle READ getAngle WRITE setAngle) 28 | Q_PROPERTY(QColor bodyColor READ getBodyColor WRITE setBodyColor) 29 | Q_PROPERTY(QColor eyeColor READ getEyeColor WRITE setEyeColor) 30 | Q_PROPERTY(QColor eyeballColor READ getEyeballColor WRITE setEyeballColor) 31 | Q_PROPERTY(QColor noseColor READ getNoseColor WRITE setNoseColor) 32 | Q_PROPERTY(QColor earColor READ getEarColor WRITE setEarColor) 33 | Q_PROPERTY(QColor tailColor READ getTailColor WRITE setTailColor) 34 | 35 | public: 36 | explicit MagicMouse(QWidget *parent = 0); 37 | 38 | protected: 39 | void paintEvent(QPaintEvent *); 40 | 41 | private: 42 | int angle; //旋转角度 43 | QColor bodyColor; //身体颜色 44 | QColor eyeColor; //眼睛颜色 45 | QColor eyeballColor; //眼珠颜色 46 | QColor noseColor; //鼻子颜色 47 | QColor earColor; //耳朵颜色 48 | QColor tailColor; //尾巴颜色 49 | 50 | public: 51 | int getAngle() const; 52 | QColor getBodyColor() const; 53 | QColor getEyeColor() const; 54 | QColor getEyeballColor() const; 55 | QColor getNoseColor() const; 56 | QColor getEarColor() const; 57 | QColor getTailColor() const; 58 | 59 | QSize sizeHint() const; 60 | QSize minimumSizeHint() const; 61 | 62 | public slots: 63 | //设置旋转角度 64 | void setAngle(int angle); 65 | //设置身体颜色 66 | void setBodyColor(const QColor &bodyColor); 67 | //设置眼睛颜色 68 | void setEyeColor(const QColor &eyeColor); 69 | //设置眼珠颜色 70 | void setEyeballColor(const QColor &eyeballColor); 71 | //设置鼻子颜色 72 | void setNoseColor(const QColor &noseColor); 73 | //设置耳朵颜色 74 | void setEarColor(const QColor &earColor); 75 | //设置尾巴颜色 76 | void setTailColor(const QColor &tailColor); 77 | 78 | }; 79 | 80 | #endif // MAGICMOUSE_H 81 | -------------------------------------------------------------------------------- /qt_image_include/panelwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef PANELWIDGET_H 2 | #define PANELWIDGET_H 3 | 4 | /** 5 | * 面板容器控件 作者:feiyangqingyun(QQ:517216493) 2016-11-20 6 | * 1:支持所有widget子类对象,自动产生滚动条 7 | * 2:支持自动拉伸自动填充 8 | * 3:提供接口获取容器内的所有对象的指针 9 | * 4:可设置是否自动拉伸宽度高度 10 | * 5:可设置设备面板之间的间距和边距 11 | */ 12 | 13 | #include 14 | 15 | class QScrollArea; 16 | class QFrame; 17 | class QVBoxLayout; 18 | class QGridLayout; 19 | 20 | #ifdef quc 21 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 22 | #include 23 | #else 24 | #include 25 | #endif 26 | 27 | class QDESIGNER_WIDGET_EXPORT PanelWidget : public QWidget 28 | #else 29 | class PanelWidget : public QWidget 30 | #endif 31 | 32 | { 33 | Q_OBJECT 34 | Q_PROPERTY(int margin READ getMargin WRITE setMargin) 35 | Q_PROPERTY(int space READ getSpace WRITE setSpace) 36 | Q_PROPERTY(bool autoWidth READ getAutoWidth WRITE setAutoWidth) 37 | Q_PROPERTY(bool autoHeight READ getAutoHeight WRITE setAutoHeight) 38 | 39 | public: 40 | explicit PanelWidget(QWidget *parent = 0); 41 | 42 | protected: 43 | void resizeEvent(QResizeEvent *); 44 | 45 | private: 46 | QScrollArea *scrollArea; //滚动区域 47 | QWidget *scrollAreaWidgetContents; //滚动区域载体 48 | QFrame *frame; //放置设备的框架,自动变宽变高 49 | QVBoxLayout *verticalLayout; //设备面板总布局 50 | QGridLayout *gridLayout; //设备表格布局 51 | 52 | int margin; //边距 53 | int space; //设备之间的间隔 54 | bool autoWidth; //宽度自动拉伸 55 | bool autoHeight; //高度自动拉伸 56 | 57 | QList widgets; //设备面板对象集合 58 | int columnCount; //面板列数 59 | 60 | public: 61 | QSize sizeHint() const; 62 | QSize minimumSizeHint() const; 63 | 64 | int getMargin() const; 65 | int getSpace() const; 66 | bool getAutoWidth() const; 67 | bool getAutoHeight() const; 68 | 69 | QList getWidgets(); 70 | int getColumnCount(); 71 | 72 | public Q_SLOTS: 73 | void setWidget(QList widgets, int columnCount); 74 | void setMargin(int left, int top, int right, int bottom); 75 | void setMargin(int margin); 76 | void setSpace(int space); 77 | void setAutoWidth(bool autoWidth); 78 | void setAutoHeight(bool autoHeight); 79 | 80 | }; 81 | 82 | #endif // PANELWIDGET_H 83 | -------------------------------------------------------------------------------- /qt_image_include/adswidget.h: -------------------------------------------------------------------------------- 1 | #ifndef ADSWIDGET_H 2 | #define ADSWIDGET_H 3 | 4 | /** 5 | * 广告轮播控件 作者:feiyangqingyun(QQ:517216493) 2016-12-22 6 | * 1:可设置显示的图像 7 | * 2:可添加多个广告 8 | * 3:可设置指示器样式 迷你型样式 数字型样式 9 | * 4:可设置指示器大小 10 | * 5:可设置切换间隔 11 | */ 12 | 13 | #include 14 | 15 | class QLabel; 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT AdsWidget : public QWidget 25 | #else 26 | class AdsWidget : public QWidget 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | Q_ENUMS(BannerStyle) 32 | 33 | Q_PROPERTY(int interval READ getInterval WRITE setInterval) 34 | Q_PROPERTY(QSize bannerFixedSize READ getBannerFixedSize WRITE setBannerFixedSize) 35 | Q_PROPERTY(QString imageNames READ getImageNames WRITE setImageNames) 36 | Q_PROPERTY(BannerStyle bannerStyle READ getBannerStyle WRITE setBannerStyle) 37 | 38 | public: 39 | enum BannerStyle { 40 | BannerStyle_Min = 0, //迷你型样式 41 | BannerStyle_Num = 1 //数字型样式 42 | }; 43 | 44 | explicit AdsWidget(QWidget *parent = 0); 45 | ~AdsWidget(); 46 | 47 | protected: 48 | bool eventFilter(QObject *obj, QEvent *event); 49 | 50 | private: 51 | int interval; //自动切换间隔 52 | QSize bannerFixedSize; //导航指示器固定尺寸 53 | BannerStyle bannerStyle; //导航指示器样式 54 | QString imageNames; //导航图片集合字符串 55 | 56 | int currentIndex; //当前显示的广告对应索引 57 | QTimer *timer; //定时器轮播广告 58 | QList labs; //导航标签链表 59 | QList names; //导航图片链表 60 | 61 | QWidget *widgetBg; //存放广告图片的容器 62 | QWidget *widgetBanner; //存放导航指示器的容器 63 | 64 | private slots: 65 | void initWidget(); 66 | void initForm(); 67 | void changedAds(); 68 | void changedAds(QLabel *lab); 69 | 70 | public: 71 | int getInterval() const; 72 | QSize getBannerFixedSize() const; 73 | BannerStyle getBannerStyle() const; 74 | QString getImageNames() const; 75 | 76 | QSize sizeHint() const; 77 | QSize minimumSizeHint() const; 78 | 79 | public Q_SLOTS: 80 | void setInterval(int interval); 81 | void setBannerFixedSize(const QSize &bannerFixedSize); 82 | void setBannerStyle(const BannerStyle &bannerStyle); 83 | void setImageNames(const QString &imageNames); 84 | }; 85 | 86 | #endif // ADSWIDGET_H 87 | -------------------------------------------------------------------------------- /mqtt/qmqtt_timerinterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_timerinterface.h - qmqtt timer interface header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_TIMER_INTERFACE_H 33 | #define QMQTT_TIMER_INTERFACE_H 34 | 35 | #include 36 | 37 | #include 38 | 39 | namespace QMQTT { 40 | 41 | class Q_MQTT_EXPORT TimerInterface : public QObject 42 | { 43 | Q_OBJECT 44 | public: 45 | explicit TimerInterface(QObject* parent = NULL) : QObject(parent) {} 46 | virtual ~TimerInterface() {} 47 | 48 | virtual bool isSingleShot() const = 0; 49 | virtual void setSingleShot(bool singleShot) = 0; 50 | virtual int interval() const = 0; 51 | virtual void setInterval(int msec) = 0; 52 | virtual void start() = 0; 53 | virtual void stop() = 0; 54 | 55 | signals: 56 | void timeout(); 57 | }; 58 | 59 | } 60 | 61 | #endif // QMQTT_TIMER_INTERFACE_H 62 | 63 | -------------------------------------------------------------------------------- /mqtt/qmqtt_timer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_timer.cpp - qmqtt timer 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #include "qmqtt_timer_p.h" 34 | 35 | QMQTT::Timer::Timer(QObject* parent) 36 | : TimerInterface(parent) 37 | { 38 | connect(&_timer, &QTimer::timeout, this, &TimerInterface::timeout); 39 | } 40 | 41 | QMQTT::Timer::~Timer() 42 | { 43 | } 44 | 45 | bool QMQTT::Timer::isSingleShot() const 46 | { 47 | return _timer.isSingleShot(); 48 | } 49 | 50 | void QMQTT::Timer::setSingleShot(bool singleShot) 51 | { 52 | _timer.setSingleShot(singleShot); 53 | } 54 | 55 | int QMQTT::Timer::interval() const 56 | { 57 | return _timer.interval(); 58 | } 59 | 60 | void QMQTT::Timer::setInterval(int msec) 61 | { 62 | _timer.setInterval(msec); 63 | } 64 | 65 | void QMQTT::Timer::start() 66 | { 67 | _timer.start(); 68 | } 69 | 70 | void QMQTT::Timer::stop() 71 | { 72 | _timer.stop(); 73 | } 74 | -------------------------------------------------------------------------------- /qt_image_include/colorpanelhsb.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORPANELHSB_H 2 | #define COLORPANELHSB_H 3 | 4 | /** 5 | * 颜色选取面板 作者:feiyangqingyun(QQ:517216493) 2017-11-17 6 | * 1:可设置当前百分比,用于控制指针大小 7 | * 2:可设置边框宽度 8 | * 3:可设置边框颜色 9 | * 4:可设置指针颜色 10 | */ 11 | 12 | #include 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT ColorPanelHSB : public QWidget 22 | #else 23 | class ColorPanelHSB : public QWidget 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(int percent READ getPercent WRITE setPercent) 29 | Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor) 30 | Q_PROPERTY(QColor cursorColor READ getCursorColor WRITE setCursorColor) 31 | 32 | Q_PROPERTY(QColor color READ getColor) 33 | Q_PROPERTY(double hue READ getHue) 34 | Q_PROPERTY(double sat READ getSat) 35 | 36 | public: 37 | explicit ColorPanelHSB(QWidget *parent = 0); 38 | 39 | protected: 40 | void showEvent(QShowEvent *); 41 | void resizeEvent(QResizeEvent *); 42 | void mousePressEvent(QMouseEvent *e); 43 | void mouseMoveEvent(QMouseEvent *e); 44 | void paintEvent(QPaintEvent *); 45 | void drawBg(QPainter *painter); 46 | void drawCursor(QPainter *painter); 47 | void drawBorder(QPainter *painter); 48 | 49 | private: 50 | int percent; //当前百分比 51 | int borderWidth; //边框宽度 52 | QColor borderColor; //边框颜色 53 | QColor cursorColor; //鼠标按下处的文字形状颜色 54 | 55 | QColor color; //鼠标按下处的颜色 56 | double hue; //hue值 57 | double sat; //sat值 58 | 59 | QPoint lastPos; //最后鼠标按下去的坐标 60 | QPixmap bgPix; //背景颜色图片 61 | 62 | public: 63 | int getPercent() const; 64 | QColor getBorderColor() const; 65 | QColor getCursorColor() const; 66 | 67 | QColor getColor() const; 68 | double getHue() const; 69 | double getSat() const; 70 | 71 | QSize sizeHint() const; 72 | QSize minimumSizeHint() const; 73 | 74 | public Q_SLOTS: 75 | //设置百分比 76 | void setPercent(int percent); 77 | 78 | //设置边框颜色 79 | void setBorderColor(const QColor &borderColor); 80 | 81 | //设置文字形状颜色 82 | void setCursorColor(const QColor &cursorColor); 83 | 84 | Q_SIGNALS: 85 | void colorChanged(const QColor &color, double hue, double sat); 86 | 87 | }; 88 | 89 | #endif // COLORPANELHSB_H 90 | -------------------------------------------------------------------------------- /qt_image_include/xslider.h: -------------------------------------------------------------------------------- 1 | #ifndef XSLIDER_H 2 | #define XSLIDER_H 3 | 4 | /** 5 | * 滑动条控件 作者:feiyangqingyun(QQ:517216493) 2019-1-16 6 | * 1:可设置高度 7 | * 2:可设置正常颜色 8 | * 3:可设置滑过的颜色 9 | * 4:可设置手柄边框颜色 10 | * 5:可设置手柄颜色 11 | * 6:可设置文字颜色 12 | * 7:单击自动切换到按下处位置 13 | * 8:对应值显示在手柄圆圈处 14 | */ 15 | 16 | #include 17 | 18 | #ifdef quc 19 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 20 | #include 21 | #else 22 | #include 23 | #endif 24 | 25 | class QDESIGNER_WIDGET_EXPORT XSlider : public QSlider 26 | #else 27 | class XSlider : public QSlider 28 | #endif 29 | 30 | { 31 | Q_OBJECT 32 | Q_PROPERTY(int sliderHeight READ getSliderHeight WRITE setSliderHeight) 33 | Q_PROPERTY(QColor normalColor READ getNormalColor WRITE setNormalColor) 34 | Q_PROPERTY(QColor grooveColor READ getGrooveColor WRITE setGrooveColor) 35 | Q_PROPERTY(QColor handleBorderColor READ getHandleBorderColor WRITE setHandleBorderColor) 36 | Q_PROPERTY(QColor handleColor READ getHandleColor WRITE setHandleColor) 37 | Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor) 38 | 39 | public: 40 | explicit XSlider(QWidget *parent = 0); 41 | 42 | protected: 43 | void paintEvent(QPaintEvent *); 44 | void mousePressEvent(QMouseEvent *); 45 | 46 | private: 47 | int sliderHeight; //滑动条高度 48 | QColor normalColor; //正常颜色 49 | QColor grooveColor; //滑过的颜色 50 | QColor handleBorderColor; //手柄边框颜色 51 | QColor handleColor; //手柄颜色 52 | QColor textColor; //文字颜色 53 | 54 | private slots: 55 | void initForm(); 56 | void initStyle(); 57 | 58 | public: 59 | int getSliderHeight() const; 60 | QColor getNormalColor() const; 61 | QColor getGrooveColor() const; 62 | QColor getHandleBorderColor() const; 63 | QColor getHandleColor() const; 64 | QColor getTextColor() const; 65 | 66 | QSize sizeHint() const; 67 | QSize minimumSizeHint() const; 68 | 69 | public Q_SLOTS: 70 | //设置滑动条高度 71 | void setSliderHeight(int sliderHeight); 72 | //设置正常颜色 73 | void setNormalColor(const QColor &normalColor); 74 | //设置滑过的颜色 75 | void setGrooveColor(const QColor &grooveColor); 76 | //设置手柄边框颜色 77 | void setHandleBorderColor(const QColor &handleBorderColor); 78 | //设置手柄颜色 79 | void setHandleColor(const QColor &handleColor); 80 | //设置文字颜色 81 | void setTextColor(const QColor &textColor); 82 | 83 | Q_SIGNALS: 84 | void clicked(); 85 | }; 86 | 87 | #endif // XSLIDER_H 88 | -------------------------------------------------------------------------------- /qt_image_include/barvumeter.h: -------------------------------------------------------------------------------- 1 | #ifndef BARVUMETER_H 2 | #define BARVUMETER_H 3 | 4 | /** 5 | * 音量条控件 作者:来源于网络 整理:feiyangqingyun(QQ:517216493) 2016-10-8 6 | */ 7 | 8 | #include 9 | 10 | #ifdef quc 11 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | class QDESIGNER_WIDGET_EXPORT BarVUMeter : public QWidget 18 | #else 19 | class BarVUMeter : public QWidget 20 | #endif 21 | 22 | { 23 | Q_OBJECT 24 | Q_PROPERTY(double minValue READ getMinValue WRITE setMinValue) 25 | Q_PROPERTY(double maxValue READ getMaxValue WRITE setMaxValue) 26 | Q_PROPERTY(double leftValue READ getLeftValue WRITE setLeftValue) 27 | Q_PROPERTY(double rightValue READ getRightValue WRITE setRightValue) 28 | 29 | Q_PROPERTY(QColor colorBg READ getColorBg WRITE setColorBg) 30 | Q_PROPERTY(QColor colorValue READ getColorValue WRITE setColorValue) 31 | Q_PROPERTY(QColor colorLow READ getColorLow WRITE setColorLow) 32 | Q_PROPERTY(QColor colorHigh READ getColorHigh WRITE setColorHigh) 33 | 34 | public: 35 | explicit BarVUMeter(QWidget *parent = 0); 36 | ~BarVUMeter(); 37 | 38 | protected: 39 | void paintEvent(QPaintEvent *); 40 | void drawBorder(QPainter *painter); 41 | void drawBar(QPainter *painter); 42 | void drawValue(QPainter *painter); 43 | 44 | private: 45 | double minValue; //最小值 46 | double maxValue; //最大值 47 | double leftValue; //左边值 48 | double rightValue; //右边值 49 | 50 | QColor colorBg; //背景颜色 51 | QColor colorValue; //值颜色 52 | QColor colorHigh; //大值颜色 53 | QColor colorLow; //小值颜色 54 | 55 | public: 56 | double getMinValue() const; 57 | double getMaxValue() const; 58 | double getLeftValue() const; 59 | double getRightValue() const; 60 | 61 | QColor getColorBg() const; 62 | QColor getColorValue() const; 63 | QColor getColorLow() const; 64 | QColor getColorHigh() const; 65 | 66 | QSize sizeHint() const; 67 | QSize minimumSizeHint() const; 68 | 69 | public Q_SLOTS: 70 | void setMinValue(double minValue); 71 | void setMaxValue(double maxValue); 72 | void setLeftValue(double leftValue); 73 | void setRightValue(double rightValue); 74 | 75 | void setColorBg(const QColor &colorBg); 76 | void setColorValue(const QColor &colorValue); 77 | void setColorHigh(const QColor &colorHigh); 78 | void setColorLow(const QColor &colorLow); 79 | 80 | Q_SIGNALS: 81 | void valueLChanged(double); 82 | void valueRChanged(double); 83 | }; 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /qt_image_include/waveline.h: -------------------------------------------------------------------------------- 1 | #ifndef WAVELINE_H 2 | #define WAVELINE_H 3 | 4 | /** 5 | * 直方波形图控件 作者:feiyangqingyun(QQ:517216493) 2016-11-6 6 | * 1:可设置最大值 7 | * 2:可设置每次过渡的步长 8 | * 3:可设置item之间的间隔 9 | * 4:可设置渐变的背景颜色 10 | * 5:可设置线条的颜色 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT WaveLine : public QWidget 23 | #else 24 | class WaveLine : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int maxValue READ getMaxValue WRITE setMaxValue) 30 | Q_PROPERTY(int step READ getStep WRITE setStep) 31 | Q_PROPERTY(int space READ getSpace WRITE setSpace) 32 | 33 | Q_PROPERTY(QColor bgColorStart READ getBgColorStart WRITE setBgColorStart) 34 | Q_PROPERTY(QColor bgColorEnd READ getBgColorEnd WRITE setBgColorEnd) 35 | Q_PROPERTY(QColor lineColor READ getLineColor WRITE setLineColor) 36 | 37 | public: 38 | explicit WaveLine(QWidget *parent = 0); 39 | ~WaveLine(); 40 | 41 | protected: 42 | void paintEvent(QPaintEvent *); 43 | void drawBg(QPainter *painter); 44 | void drawLine(QPainter *painter); 45 | 46 | private: 47 | int maxValue; //最大值 48 | int step; //步长 49 | int space; //间距 50 | 51 | QColor bgColorStart; //背景渐变开始颜色 52 | QColor bgColorEnd; //背景渐变结束颜色 53 | QColor lineColor; //线条颜色 54 | 55 | QTimer *timer; //绘制定时器 56 | QVector currentDataVec; //当前数据集合 57 | QVector dataVec; //目标数据集合 58 | 59 | private slots: 60 | void updateData(); 61 | 62 | public: 63 | int getMaxValue() const; 64 | int getStep() const; 65 | int getSpace() const; 66 | 67 | QColor getBgColorStart() const; 68 | QColor getBgColorEnd() const; 69 | QColor getLineColor() const; 70 | 71 | QSize sizeHint() const; 72 | QSize minimumSizeHint() const; 73 | 74 | public Q_SLOTS: 75 | //设置数据 76 | void setData(const QVector &dataVec); 77 | 78 | //设置最大值 79 | void setMaxValue(int maxValue); 80 | //设置步长 81 | void setStep(int step); 82 | //设置间距 83 | void setSpace(int space); 84 | 85 | //设置背景颜色 86 | void setBgColorStart(const QColor &bgColorStart); 87 | void setBgColorEnd(const QColor &bgColorEnd); 88 | 89 | //设置线条颜色 90 | void setLineColor(const QColor &lineColor); 91 | }; 92 | 93 | #endif // WAVELINE_H 94 | -------------------------------------------------------------------------------- /qt_image_include/progressbutton.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRESSBUTTON_H 2 | #define PROGRESSBUTTON_H 3 | 4 | /** 5 | * 按钮进度条控件 作者:倪大侠(QQ:393320854 zyb920@hotmail.com) 2019-4-17 6 | * 1:可设置进度线条宽度+颜色 7 | * 2:可设置边框宽度+颜色 8 | * 3:可设置圆角角度+背景颜色 9 | */ 10 | 11 | #include 12 | 13 | class QTimer; 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT ProgressButton : public QWidget 23 | #else 24 | class ProgressButton : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int lineWidth READ getLineWidth WRITE setLineWidth) 30 | Q_PROPERTY(QColor lineColor READ getLineColor WRITE setLineColor) 31 | Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth) 32 | Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor) 33 | Q_PROPERTY(int borderRadius READ getBorderRadius WRITE setBorderRadius) 34 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 35 | 36 | public: 37 | explicit ProgressButton(QWidget *parent = 0); 38 | 39 | protected: 40 | void resizeEvent(QResizeEvent *); 41 | void mousePressEvent(QMouseEvent *); 42 | void paintEvent(QPaintEvent *); 43 | void drawBg(QPainter *painter); 44 | void drawProgress(QPainter *painter); 45 | 46 | private: 47 | int lineWidth; //线条宽度 48 | QColor lineColor; //线条颜色 49 | int borderWidth; //边框宽度 50 | QColor borderColor; //边框颜色 51 | int borderRadius; //圆角角度 52 | QColor bgColor; //背景颜色 53 | 54 | double value; //当前值 55 | int status; //状态 56 | int tempWidth; //动态改变宽度 57 | QTimer *timer; //定时器改变进度 58 | 59 | public: 60 | int getLineWidth() const; 61 | QColor getLineColor() const; 62 | int getBorderWidth() const; 63 | QColor getBorderColor() const; 64 | int getBorderRadius() const; 65 | QColor getBgColor() const; 66 | 67 | QSize sizeHint() const; 68 | QSize minimumSizeHint() const; 69 | 70 | private slots: 71 | void progress(); 72 | 73 | public Q_SLOTS: 74 | //设置线条宽度+颜色 75 | void setLineWidth(int lineWidth); 76 | void setLineColor(const QColor &lineColor); 77 | 78 | //设置边框宽度+颜色 79 | void setBorderWidth(int borderWidth); 80 | void setBorderColor(const QColor &borderColor); 81 | 82 | //设置圆角角度+背景颜色 83 | void setBorderRadius(int borderRadius); 84 | void setBgColor(const QColor &bgColor); 85 | 86 | Q_SIGNALS: 87 | void valueChanged(int value); 88 | }; 89 | 90 | #endif // PROGRESSBUTTON_H 91 | -------------------------------------------------------------------------------- /mqtt/qmqtt_routedmessage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_router.h - qmqtt router 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * Router added by Niklas Wulf 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of mqttc nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | #ifndef QMQTT_ROUTEDMESSAGE_H 34 | #define QMQTT_ROUTEDMESSAGE_H 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | namespace QMQTT { 43 | 44 | class RouteSubscription; 45 | 46 | class Q_MQTT_EXPORT RoutedMessage 47 | { 48 | public: 49 | inline RoutedMessage() 50 | {} 51 | inline RoutedMessage(const Message &message) 52 | : _message(message) 53 | {} 54 | 55 | inline const Message &message() const 56 | { return _message; } 57 | inline QHash parameters() const 58 | { return _parameters; } 59 | 60 | private: 61 | friend class RouteSubscription; 62 | 63 | Message _message; 64 | QHash _parameters; 65 | }; 66 | 67 | } // namespace QMQTT 68 | 69 | Q_DECLARE_METATYPE(QMQTT::RoutedMessage) 70 | 71 | #endif // QMQTT_ROUTEDMESSAGE_H 72 | -------------------------------------------------------------------------------- /mqtt/qmqtt_socket_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_socket_p.h - qmqtt socket private header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_SOCKET_P_H 33 | #define QMQTT_SOCKET_P_H 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | QT_FORWARD_DECLARE_CLASS(QIODevice) 44 | QT_FORWARD_DECLARE_CLASS(QTcpSocket) 45 | 46 | namespace QMQTT 47 | { 48 | 49 | class Socket : public SocketInterface 50 | { 51 | Q_OBJECT 52 | public: 53 | explicit Socket(QObject* parent = NULL); 54 | virtual ~Socket(); 55 | 56 | virtual QIODevice *ioDevice(); 57 | void connectToHost(const QHostAddress& address, quint16 port); 58 | void connectToHost(const QString& hostName, quint16 port); 59 | void disconnectFromHost(); 60 | QAbstractSocket::SocketState state() const; 61 | QAbstractSocket::SocketError error() const; 62 | 63 | protected: 64 | QScopedPointer _socket; 65 | }; 66 | 67 | } 68 | 69 | #endif // QMQTT_SOCKET_P_H 70 | -------------------------------------------------------------------------------- /mqtt/qmqtt_router.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_router.cpp - qmqtt router 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * Router added by Niklas Wulf 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of mqttc nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | 34 | #include "qmqtt_router.h" 35 | #include "qmqtt_client.h" 36 | #include "qmqtt_routesubscription.h" 37 | 38 | #include 39 | 40 | namespace QMQTT { 41 | 42 | Q_LOGGING_CATEGORY(router, "qmqtt.router") 43 | 44 | Router::Router(Client *parent) : QObject(parent), _client(parent) 45 | { 46 | } 47 | 48 | RouteSubscription *Router::subscribe(const QString &route) 49 | { 50 | RouteSubscription *subscription = new RouteSubscription(this); 51 | subscription->setRoute(route); 52 | connect(_client, &Client::connected, subscription, [this, subscription]() { 53 | _client->subscribe(subscription->_topic, 0); 54 | }); 55 | if (_client->isConnectedToHost()) 56 | _client->subscribe(subscription->_topic, 0); 57 | connect(_client, &Client::received, subscription, &RouteSubscription::routeMessage); 58 | return subscription; 59 | } 60 | 61 | Client *Router::client() const 62 | { 63 | return _client; 64 | } 65 | 66 | } // namespace QMQTT 67 | 68 | -------------------------------------------------------------------------------- /qt_image_include/customrocker.h: -------------------------------------------------------------------------------- 1 | #ifndef CUSTOMROCKER_H 2 | #define CUSTOMROCKER_H 3 | 4 | #include 5 | 6 | /** 7 | * 自定义摇杆控件 作者:赵彦博(QQ:408815041 zyb920@hotmail.com) 2019-3-28 8 | * 1:可设置是否只在外边缘线上 9 | * 2:可设置边框宽度 10 | * 3:可设置摇杆的半径 11 | * 4:可设置边框颜色 12 | * 5:可设置背景颜色 13 | * 6:可设置摇杆颜色 14 | * 7:发出移动角度信号 15 | */ 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT CustomRocker : public QWidget 25 | #else 26 | class CustomRocker : public QWidget 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | Q_PROPERTY(bool online READ getOnline WRITE setOnline) 32 | Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth) 33 | Q_PROPERTY(int rockerRadius READ getRockerRadius WRITE setRockerRadius) 34 | 35 | Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor) 36 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 37 | Q_PROPERTY(QColor rockerColor READ getRockerColor WRITE setRockerColor) 38 | 39 | public: 40 | explicit CustomRocker(QWidget *parent = 0); 41 | 42 | protected: 43 | void resizeEvent(QResizeEvent *); 44 | void mousePressEvent(QMouseEvent *); 45 | void mouseMoveEvent(QMouseEvent *); 46 | void mouseReleaseEvent(QMouseEvent *); 47 | void paintEvent(QPaintEvent *); 48 | void resetPoint(const QPoint &point); 49 | 50 | private: 51 | bool online; //是否只在线上 52 | int borderWidth; //边框宽度 53 | int rockerRadius; //摇杆圆半径 54 | 55 | QColor borderColor; //边框颜色 56 | QColor bgColor; //背景颜色 57 | QColor rockerColor; //摇杆颜色 58 | 59 | int radius; //圆半径 60 | bool pressed; //鼠标是否按下 61 | QPoint currentPoint; //当前坐标 62 | QPoint centerPoint; //中心坐标 63 | 64 | private: 65 | double twoPtDistance(const QPointF &pt1, const QPointF &pt2); 66 | 67 | public: 68 | double getDistance() ; 69 | bool getOnline() const; 70 | int getBorderWidth() const; 71 | int getRockerRadius() const; 72 | 73 | QColor getBorderColor() const; 74 | QColor getBgColor() const; 75 | QColor getRockerColor() const; 76 | 77 | QSize sizeHint() const; 78 | QSize minimumSizeHint() const; 79 | 80 | public Q_SLOTS: 81 | void setOnline(bool online); 82 | void setBorderWidth(int borderWidth); 83 | void setRockerRadius(int rockerRadius); 84 | 85 | void setBorderColor(const QColor &borderColor); 86 | void setBgColor(const QColor &bgColor); 87 | void setRockerColor(const QColor &rockerColor); 88 | 89 | Q_SIGNALS: 90 | void moveAngle(double angle, double distance); 91 | }; 92 | 93 | #endif // CUSTOMROCKER_H 94 | -------------------------------------------------------------------------------- /mqtt/qmqtt_routesubscription.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_router.h - qmqtt router 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * Router added by Niklas Wulf 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of mqttc nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | #ifndef QMQTT_ROUTESUBSCRIPTION_H 34 | #define QMQTT_ROUTESUBSCRIPTION_H 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | namespace QMQTT { 45 | 46 | class Client; 47 | class Message; 48 | class RoutedMessage; 49 | class Router; 50 | 51 | class Q_MQTT_EXPORT RouteSubscription : public QObject 52 | { 53 | Q_OBJECT 54 | public: 55 | ~RouteSubscription(); 56 | 57 | QString route() const; 58 | 59 | signals: 60 | void received(const RoutedMessage &message); 61 | 62 | private slots: 63 | void routeMessage(const Message &message); 64 | 65 | private: 66 | friend class Router; 67 | 68 | explicit RouteSubscription(Router *parent = 0); 69 | void setRoute(const QString &route); 70 | 71 | QPointer _client; 72 | QString _topic; 73 | QRegularExpression _regularExpression; 74 | QStringList _parameterNames; 75 | }; 76 | 77 | } // namespace QMQTT 78 | 79 | #endif // QMQTT_ROUTESUBSCRIPTION_H 80 | -------------------------------------------------------------------------------- /qt_image_include/lunarcalendarinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef LUNARCALENDARINFO_H 2 | #define LUNARCALENDARINFO_H 3 | 4 | /** 5 | * 农历信息类 作者:倪大侠 整理:feiyangqingyun(QQ:517216493) 2016-12-10 6 | * 1:计算是否闰年 7 | * 2:计算国际节日 8 | * 3:计算二十四节气 9 | * 4:计算农历年 天干+地支+生肖 10 | * 5:计算指定年月日农历信息,包括公历节日和农历节日及二十四节气 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT LunarCalendarInfo : public QObject 23 | #else 24 | class LunarCalendarInfo : public QObject 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | public: 30 | static LunarCalendarInfo *Instance(); 31 | explicit LunarCalendarInfo(QObject *parent = 0); 32 | 33 | //计算是否闰年 34 | bool isLoopYear(int year); 35 | 36 | //计算指定年月该月共多少天 37 | int getMonthDays(int year, int month); 38 | 39 | //计算指定年月对应到该月共多少天 40 | int getTotalMonthDays(int year, int month); 41 | 42 | //计算指定年月对应星期几 43 | int getFirstDayOfWeek(int year, int month); 44 | 45 | //计算国际节日 46 | QString getHoliday(int month, int day); 47 | 48 | //计算二十四节气 49 | QString getSolarTerms(int year, int month, int day); 50 | 51 | //计算农历节日(必须传入农历年份月份) 52 | QString getLunarFestival(int month, int day); 53 | 54 | //计算农历年 天干+地支+生肖 55 | QString getLunarYear(int year); 56 | 57 | //计算指定年月日农历信息,包括公历节日和农历节日及二十四节气 58 | void getLunarCalendarInfo(int year, int month, int day, 59 | QString &strHoliday, 60 | QString &strSolarTerms, 61 | QString &strLunarFestival, 62 | QString &strLunarYear, 63 | QString &strLunarMonth, 64 | QString &strLunarDay); 65 | 66 | //获取指定年月日农历信息 67 | QString getLunarInfo(int year, int month, int day, bool yearInfo, bool monthInfo, bool dayInfo); 68 | QString getLunarYearMonthDay(int year, int month, int day); 69 | QString getLunarMonthDay(int year, int month, int day); 70 | QString getLunarDay(int year, int month, int day); 71 | 72 | private: 73 | static QScopedPointer self; 74 | 75 | QList lunarCalendarTable; //农历年表 76 | QList springFestival; //春节公历日期 77 | QList lunarData; //农历每月数据 78 | QList chineseTwentyFourData; //农历二十四节气数据 79 | QList monthAdd; //公历每月前面的天数 80 | 81 | QList listDayName; //农历日期名称集合 82 | QList listMonthName; //农历月份名称集合 83 | QList listSolarTerm; //二十四节气名称集合 84 | 85 | QList listTianGan; //天干名称集合 86 | QList listDiZhi; //地支名称集合 87 | QList listShuXiang; //属相名称集合 88 | }; 89 | 90 | #endif // LUNARCALENDARINFO_H 91 | -------------------------------------------------------------------------------- /qt_image_include/antline.h: -------------------------------------------------------------------------------- 1 | #ifndef ANTLINE_H 2 | #define ANTLINE_H 3 | 4 | /** 5 | * 蚂蚁线控件 整理:feiyangqingyun(QQ:517216493) 2018-8-31 6 | * 1:可设置蚂蚁线的长度 7 | * 2:可设置蚂蚁线的宽度=粗细 8 | * 3:可设置蚂蚁线的步长 9 | * 4:可设置蚂蚁线的流动速度 10 | * 5:可设置蚂蚁线的颜色 11 | * 6:可设置蚂蚁线的形状 12 | */ 13 | 14 | #include 15 | #include 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT AntLine : public QWidget 25 | #else 26 | class AntLine : public QWidget 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | Q_ENUMS(LineStyle) 32 | 33 | Q_PROPERTY(int lineLen READ getLineLen WRITE setLineLen) 34 | Q_PROPERTY(int lineWidth READ getLineWidth WRITE setLineWidth) 35 | Q_PROPERTY(int lineStep READ getLineStep WRITE setLineStep) 36 | Q_PROPERTY(int lineSpeed READ getLineSpeed WRITE setLineSpeed) 37 | 38 | Q_PROPERTY(QColor lineColor READ getLineColor WRITE setLineColor) 39 | Q_PROPERTY(LineStyle lineStyle READ getLineStyle WRITE setLineStyle) 40 | 41 | public: 42 | enum LineStyle { 43 | LineStyle_Rect = 0, //矩形 44 | LineStyle_RoundedRect = 1, //圆角矩形 45 | LineStyle_Ellipse = 2, //椭圆 46 | LineStyle_Circle = 3 //圆形 47 | }; 48 | 49 | explicit AntLine(QWidget *parent = 0); 50 | ~AntLine(); 51 | 52 | protected: 53 | void paintEvent(QPaintEvent *event); 54 | 55 | private: 56 | int lineLen; //线条长度 57 | int lineWidth; //线条宽度 58 | int lineStep; //每次移动的步长 59 | int lineSpeed; //线条流动的速度 60 | 61 | QColor lineColor; //线条颜色 62 | LineStyle lineStyle; //线条样式 63 | 64 | int dashes; //线条长度 65 | int spaces; //空白长度 66 | QVector dashPattern;//线条样式数据 67 | QTimer *timer; //更新定时器 68 | 69 | private slots: 70 | void updateValue(); 71 | 72 | public: 73 | int getLineLen() const; 74 | int getLineWidth() const; 75 | int getLineStep() const; 76 | int getLineSpeed() const; 77 | 78 | QColor getLineColor() const; 79 | LineStyle getLineStyle() const; 80 | 81 | QSize sizeHint() const; 82 | QSize minimumSizeHint() const; 83 | 84 | public Q_SLOTS: 85 | //设置线条长度 86 | void setLineLen(int lineLen); 87 | //设置线条宽度 88 | void setLineWidth(int lineWidth); 89 | //设置线条步长 90 | void setLineStep(int lineStep); 91 | //设置线条速度 92 | void setLineSpeed(int lineSpeed); 93 | 94 | //设置线条颜色 95 | void setLineColor(const QColor &lineColor); 96 | //设置线条样式 97 | void setLineStyle(const LineStyle &lineStyle); 98 | 99 | }; 100 | 101 | #endif // ANTLINE_H 102 | -------------------------------------------------------------------------------- /qt_image_include/custompie.h: -------------------------------------------------------------------------------- 1 | #ifndef CUSTOMPIE_H 2 | #define CUSTOMPIE_H 3 | 4 | /** 5 | * 自定义饼图控件 作者:feiyangqingyun(QQ:517216493) 2019-5-21 6 | * 1:可设置文字颜色 7 | * 2:可设置边框颜色 8 | * 3:可设置颜色集合 9 | * 4:可设置某个区域是否弹出 10 | * 5:可设置是否显示百分比 11 | * 6:支持字符串形式设置数据 12 | */ 13 | 14 | #include 15 | 16 | #ifdef quc 17 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 18 | #include 19 | #else 20 | #include 21 | #endif 22 | 23 | class QDESIGNER_WIDGET_EXPORT CustomPie : public QWidget 24 | #else 25 | class CustomPie : public QWidget 26 | #endif 27 | 28 | { 29 | Q_OBJECT 30 | Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor) 31 | Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor) 32 | Q_PROPERTY(QString infos READ getInfos WRITE setInfos) 33 | 34 | public: 35 | explicit CustomPie(QWidget *parent = 0); 36 | ~CustomPie(); 37 | 38 | protected: 39 | void paintEvent(QPaintEvent *); 40 | void drawPie(QPainter *painter); 41 | 42 | private: 43 | bool explodedAll; //是否全部展开 44 | int explodedIndex; //展开的索引 45 | 46 | bool showPercent; //是否显示百分比 47 | double holeSize; //空心占比 48 | 49 | QColor textColor; //文字颜色 50 | QColor borderColor; //边框颜色 51 | QList colors; //颜色集合 52 | 53 | QList labels; //标签集合 54 | QList values; //值集合 55 | QString infos; //标签+值集合 56 | 57 | private: 58 | //获取总值 59 | double getSumValue(); 60 | //根据偏移值获取偏移点坐标 61 | QPoint getOffsetPoint(double angel, int offset = 6); 62 | 63 | public: 64 | QColor getTextColor() const; 65 | QColor getBorderColor() const; 66 | QString getInfos() const; 67 | 68 | QSize sizeHint() const; 69 | QSize minimumSizeHint() const; 70 | 71 | public Q_SLOTS: 72 | //设置是否全部展开+展开的索引 73 | void setExplodedAll(bool explodedAll); 74 | void setExplodedIndex(int index); 75 | 76 | //设置是否启用默认颜色 77 | void setDefaultColor(bool defaultColor); 78 | 79 | //设置文字颜色+边框颜色 80 | void setTextColor(const QColor &textColor); 81 | void setBorderColor(const QColor &borderColor); 82 | 83 | //设置颜色集合 84 | void setColors(const QList &colors); 85 | 86 | //初始化饼图 87 | void initPie(); 88 | //添加饼图数据 89 | void appendPie(const QString &label, double value, const QString &tip = ""); 90 | //设置数据 91 | void setDataPie(const QList &labels, const QList &values); 92 | //设置值集合 93 | void setInfos(const QString &infos); 94 | //重新设置百分比 95 | void loadPercent(); 96 | //清除饼图 97 | void clearPie(); 98 | //设置空心占比 99 | void setHoleSize(double holeSize); 100 | 101 | }; 102 | 103 | #endif // CUSTOMPIE_H 104 | -------------------------------------------------------------------------------- /qt_image_include/devicesizetable.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICESIZETABLE_H 2 | #define DEVICESIZETABLE_H 3 | 4 | /** 5 | * 本地存储空间大小控件 作者:feiyangqingyun(QQ:517216493) 2016-11-30 6 | * 1:可自动加载本地存储设备的总容量/已用容量 7 | * 2:进度条显示已用容量 8 | * 3:支持所有操作系统 9 | * 4:增加U盘或者SD卡到达信号 10 | */ 11 | 12 | #include 13 | 14 | class QProcess; 15 | 16 | #ifdef quc 17 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 18 | #include 19 | #else 20 | #include 21 | #endif 22 | 23 | class QDESIGNER_WIDGET_EXPORT DeviceSizeTable : public QTableWidget 24 | #else 25 | class DeviceSizeTable : public QTableWidget 26 | #endif 27 | 28 | { 29 | Q_OBJECT 30 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 31 | Q_PROPERTY(QColor chunkColor1 READ getChunkColor1 WRITE setChunkColor1) 32 | Q_PROPERTY(QColor chunkColor2 READ getChunkColor2 WRITE setChunkColor2) 33 | Q_PROPERTY(QColor chunkColor3 READ getChunkColor3 WRITE setChunkColor3) 34 | Q_PROPERTY(QColor textColor1 READ getTextColor1 WRITE setTextColor1) 35 | Q_PROPERTY(QColor textColor2 READ getTextColor2 WRITE setTextColor2) 36 | Q_PROPERTY(QColor textColor3 READ getTextColor3 WRITE setTextColor3) 37 | 38 | public: 39 | explicit DeviceSizeTable(QWidget *parent = 0); 40 | 41 | private: 42 | QProcess *process; //执行命令进程 43 | 44 | QColor bgColor; //背景颜色 45 | QColor chunkColor1; //进度颜色1 46 | QColor chunkColor2; //进度颜色2 47 | QColor chunkColor3; //进度颜色3 48 | QColor textColor1; //文字颜色1 49 | QColor textColor2; //文字颜色2 50 | QColor textColor3; //文字颜色3 51 | 52 | private slots: 53 | void readData(); 54 | void checkSize(const QString &result, const QString &name); 55 | void insertSize(const QString &name, const QString &use, const QString &free, const QString &all, int percent); 56 | 57 | public: 58 | QColor getBgColor() const; 59 | QColor getChunkColor1() const; 60 | QColor getChunkColor2() const; 61 | QColor getChunkColor3() const; 62 | QColor getTextColor1() const; 63 | QColor getTextColor2() const; 64 | QColor getTextColor3() const; 65 | 66 | QSize sizeHint() const; 67 | QSize minimumSizeHint() const; 68 | 69 | public Q_SLOTS: 70 | //载入容量 71 | void load(); 72 | 73 | //设置背景颜色 74 | void setBgColor(const QColor &bgColor); 75 | 76 | //设置进度颜色 77 | void setChunkColor1(const QColor &chunkColor1); 78 | void setChunkColor2(const QColor &chunkColor2); 79 | void setChunkColor3(const QColor &chunkColor3); 80 | 81 | //设置文字颜色 82 | void setTextColor1(const QColor &textColor1); 83 | void setTextColor2(const QColor &textColor2); 84 | void setTextColor3(const QColor &textColor3); 85 | 86 | Q_SIGNALS: 87 | void sdcardReceive(const QString &sdcardName); 88 | void udiskReceive(const QString &udiskName); 89 | }; 90 | 91 | #endif // DEVICESIZETABLE_H 92 | -------------------------------------------------------------------------------- /qt_image_include/bottomwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef BOTTOMWIDGET_H 2 | #define BOTTOMWIDGET_H 3 | 4 | /** 5 | * 底部状态栏控件 作者:feiyangqingyun(QQ:517216493) 2016-11-23 6 | * 1:可设置软件标题/版本/作者/当前用户/当前用户类型 7 | * 2:可实时显示已运行时间和当前时间 8 | * 3:可设置每个部件是否可见 9 | */ 10 | 11 | #include 12 | 13 | class QLabel; 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT BottomWidget : public QWidget 23 | #else 24 | class BottomWidget : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit BottomWidget(QWidget *parent = 0); 31 | 32 | protected: 33 | void paintEvent(QPaintEvent *); 34 | 35 | private: 36 | QString title; //标题 37 | QString version; //版本 38 | QString author; //作者 39 | QString currentUserName; //当前用户 40 | QString currentUserType; //当前用户类型 41 | QString fontName; //字体 42 | int fontSize; //字号 43 | bool lineFixedWidth; //分隔符固定宽度 44 | 45 | int day; //天数 46 | int hour; //时钟数 47 | int minute; //分钟数 48 | int seconds; //秒钟数 49 | QTimer *timer; //定时器获取时间 50 | 51 | QLabel *labTitle; //标题标签 52 | QLabel *labAuthor; //作者标签 53 | QLabel *labUser; //当前用户标签 54 | QLabel *labLive; //已运行时间标签 55 | QLabel *labDateTime; //当前时间标签 56 | 57 | bool labTitleVisible; //标题标签是否可见 58 | bool labAuthorVisible; //作者标签是否可见 59 | bool labUserVisible; //当前用户标签是否可见 60 | bool labLiveVisible; //已运行时间标签是否可见 61 | bool labDateTimeVisible; //当前时间标签是否可见 62 | 63 | private slots: 64 | void showTime(); 65 | 66 | public: 67 | QString getTitle() const; 68 | QString getVersion() const; 69 | QString getAuthor() const; 70 | QString getCurrentUserName() const; 71 | QString getCurrentUserType() const; 72 | 73 | public Q_SLOTS: 74 | void setLabTitleVisible(bool labTitleVisible); 75 | void setLabAuthorVisible(bool labAuthorVisible); 76 | void setLabUserVisible(bool labUserVisible); 77 | void setLabLiveVisible(bool labLiveVisible); 78 | void setLabDateTimeVisible(bool labDateTimeVisible); 79 | 80 | void setTitle(const QString &title); 81 | void setVersion(const QString &version); 82 | void setAuthor(const QString &author); 83 | void setCurrentUserName(const QString ¤tUserName); 84 | void setCurrentUserType(const QString ¤tUserType); 85 | void setFontName(const QString &fontName); 86 | void setFontSize(int fontSize); 87 | void setLineFixedWidth(bool lineFixedWidth); 88 | void start(int interval = 1000); 89 | }; 90 | 91 | #endif // BOTTOMWIDGET_H 92 | -------------------------------------------------------------------------------- /qt_image_include/wavewater.h: -------------------------------------------------------------------------------- 1 | #ifndef WAVEWATER_H 2 | #define WAVEWATER_H 3 | 4 | /** 5 | * 水波效果控件 作者:离心泵(QQ:33522) 整理:feiyangqingyun(QQ:517216493) 2019-10-03 6 | * 1:可设置显示的图像 7 | * 2:可设置衰减系数,控制消失速度,值越小水波消失越快 8 | * 3:可设置折射系数,控制扩散速度,值越大水波扩散越快 9 | * 4:可设置石头大小,控制水波面积,值越大水波面积越大 10 | * 5:可设置石头重量,控制水波深度,值越大水波深度越浪 11 | * 6:目前采用的是cpu运算和绘制,图片越小越流畅 12 | */ 13 | 14 | #include 15 | #include 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT WaveWater : public QWidget 25 | #else 26 | class WaveWater : public QWidget 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | Q_PROPERTY(int damping READ getDamping WRITE setDamping) 32 | Q_PROPERTY(int refractive READ getRefractive WRITE setRefractive) 33 | Q_PROPERTY(int stoneSize READ getStoneSize WRITE setStoneSize) 34 | Q_PROPERTY(int stoneWeight READ getStoneWeight WRITE setStoneWeight) 35 | Q_PROPERTY(QPixmap image READ getImage WRITE setImage) 36 | 37 | public: 38 | explicit WaveWater(QWidget *parent = 0); 39 | ~WaveWater(); 40 | 41 | protected: 42 | void mousePressEvent(QMouseEvent *); 43 | void mouseMoveEvent(QMouseEvent *); 44 | void mouseReleaseEvent(QMouseEvent *); 45 | void paintEvent(QPaintEvent *); 46 | 47 | private: 48 | int damping; //波能衰减系数 49 | int refractive; //波能折射系数 50 | int stoneSize; //石头大小 51 | int stoneWeight; //石头重量 52 | QPixmap image; //渲染图片 53 | 54 | QImage imageRender; //渲染像素图片 55 | QImage imageOrigin; //渲染源 56 | QPixmap pixmap; //渲染图片 57 | 58 | int imageWidth; //图片宽度 59 | int imageHeight; //图片高度 60 | int **waveBuffer1; //波能缓冲区1 61 | int **waveBuffer2; //波能缓冲区2 62 | 63 | bool isStoped; //水波是否结束波动 64 | bool isPressed; //鼠标是否按下 65 | QPoint lastPoint; //鼠标按下出的坐标 66 | QTimer *timer; //定时器绘制 67 | 68 | private slots: 69 | //执行计算位图进行绘制 70 | void drawImage(); 71 | //水波步进扩散 72 | void waveSpread(); 73 | //渲染水波位图 74 | void waveRender(); 75 | //扔石子 76 | void dropStone(int x, int y, int stoneSize, int stoneWeight); 77 | 78 | public: 79 | int getDamping() const; 80 | int getRefractive() const; 81 | int getStoneSize() const; 82 | int getStoneWeight() const; 83 | QPixmap getImage() const; 84 | 85 | QSize sizeHint() const; 86 | QSize minimumSizeHint() const; 87 | 88 | public Q_SLOTS: 89 | //设置衰减率系数 90 | void setDamping(int damping); 91 | //设置折射率系数 92 | void setRefractive(int refractive); 93 | //设置石头大小 94 | void setStoneSize(int stoneSize); 95 | //设置石头重量 96 | void setStoneWeight(int stoneWeight); 97 | //设置背景图片 98 | void setImage(const QPixmap &pixmap); 99 | }; 100 | 101 | #endif // WAVEWATER_H 102 | -------------------------------------------------------------------------------- /mqtt/qmqtt_message_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_message.h - qmqtt message private header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_MESSAGE_P_H 33 | #define QMQTT_MESSAGE_P_H 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | namespace QMQTT { 40 | 41 | class MessagePrivate : public QSharedData 42 | { 43 | public: 44 | inline MessagePrivate() 45 | : QSharedData(), 46 | id(0), 47 | qos(0), 48 | retain(false), 49 | dup(false) 50 | {} 51 | 52 | inline MessagePrivate(const MessagePrivate &other) 53 | : QSharedData(other), 54 | id(other.id), 55 | qos(other.qos), 56 | retain(other.retain), 57 | dup(other.dup), 58 | topic(other.topic), 59 | payload(other.payload) 60 | {} 61 | 62 | inline MessagePrivate(quint16 id, const QString &topic, const QByteArray &payload, 63 | quint8 qos, bool retain, bool dup) 64 | : QSharedData(), 65 | id(id), 66 | qos(qos), 67 | retain(retain), 68 | dup(dup), 69 | topic(topic), 70 | payload(payload) 71 | {} 72 | 73 | quint16 id; 74 | quint8 qos : 2; 75 | quint8 retain: 1; 76 | quint8 dup: 1; 77 | QString topic; 78 | QByteArray payload; 79 | }; 80 | 81 | } // namespace QMQTT 82 | 83 | #endif // QMQTT_MESSAGE_P_H 84 | -------------------------------------------------------------------------------- /qt_image_include/buttondefence.h: -------------------------------------------------------------------------------- 1 | #ifndef BUTTONDEFENCE_H 2 | #define BUTTONDEFENCE_H 3 | 4 | /** 5 | * 防区按钮控件 作者:feiyangqingyun(QQ:517216493) 2018-7-2 6 | * 1:可设置防区样式 圆形、警察、气泡、气泡2、消息、消息2 7 | * 2:可设置防区状态 布防、撤防、报警、旁路、故障 8 | * 3:可设置报警切换 9 | * 4:可设置显示的防区号 10 | * 5:可设置是否可鼠标拖动 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT ButtonDefence : public QWidget 23 | #else 24 | class ButtonDefence : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_ENUMS(ButtonStyle) 30 | Q_ENUMS(ButtonStatus) 31 | 32 | Q_PROPERTY(bool canMove READ getCanMove WRITE setCanMove) 33 | Q_PROPERTY(QString text READ getText WRITE setText) 34 | 35 | Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle) 36 | Q_PROPERTY(ButtonStatus buttonStatus READ getButtonStatus WRITE setButtonStatus) 37 | 38 | public: 39 | //防区样式 40 | enum ButtonStyle { 41 | ButtonStyle_Circle = 0, //圆形 42 | ButtonStyle_Police = 1, //警察 43 | ButtonStyle_Bubble = 2, //气泡 44 | ButtonStyle_Bubble2 = 3, //气泡2 45 | ButtonStyle_Msg = 4, //消息 46 | ButtonStyle_Msg2 = 5 //消息2 47 | }; 48 | 49 | //防区状态 50 | enum ButtonStatus { 51 | ButtonStatus_Arming = 0, //布防 52 | ButtonStatus_Disarming = 1, //撤防 53 | ButtonStatus_Alarm = 2, //报警 54 | ButtonStatus_Bypass = 3, //旁路 55 | ButtonStatus_Error = 4 //故障 56 | }; 57 | 58 | explicit ButtonDefence(QWidget *parent = 0); 59 | ~ButtonDefence(); 60 | 61 | protected: 62 | void paintEvent(QPaintEvent *); 63 | bool eventFilter(QObject *watched, QEvent *event); 64 | 65 | private: 66 | bool canMove; //是否可移动 67 | QString text; //显示文字 68 | ButtonStyle buttonStyle; //防区样式 69 | ButtonStatus buttonStatus; //防区状态 70 | 71 | QString type; //图片末尾类型 72 | QString imgName; //背景图片名称 73 | bool isDark; //是否加深报警 74 | QTimer *timer; //报警闪烁定时器 75 | 76 | private slots: 77 | void checkAlarm(); 78 | 79 | public: 80 | bool getCanMove() const; 81 | QString getText() const; 82 | 83 | ButtonStyle getButtonStyle() const; 84 | ButtonStatus getButtonStatus() const; 85 | 86 | QSize sizeHint() const; 87 | QSize minimumSizeHint() const; 88 | 89 | public slots: 90 | //设置可移动 91 | void setCanMove(bool canMove); 92 | //设置显示文字 93 | void setText(const QString &text); 94 | //设置防区样式 95 | void setButtonStyle(const ButtonStyle &buttonStyle); 96 | //设置防区状态 97 | void setButtonStatus(const ButtonStatus &buttonStatus); 98 | 99 | }; 100 | 101 | #endif // BUTTONDEFENCE_H 102 | -------------------------------------------------------------------------------- /mqtt/qmqtt_websocketiodevice_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_socketinterface.h - qmqtt socket interface header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef QMQTT_WEBSOCKETIODEVICE_H 34 | #define QMQTT_WEBSOCKETIODEVICE_H 35 | 36 | #ifdef QT_WEBSOCKETS_LIB 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | QT_FORWARD_DECLARE_CLASS(QWebSocket) 44 | QT_FORWARD_DECLARE_CLASS(QNetworkRequest) 45 | QT_FORWARD_DECLARE_CLASS(QSslError) 46 | 47 | namespace QMQTT 48 | { 49 | 50 | class WebSocketIODevice : public QIODevice 51 | { 52 | Q_OBJECT 53 | public: 54 | explicit WebSocketIODevice(QWebSocket *socket, QObject *parent = NULL); 55 | 56 | bool connectToHost(const QNetworkRequest &request); 57 | 58 | virtual qint64 bytesAvailable() const; 59 | 60 | signals: 61 | void connected(); 62 | 63 | void disconnected(); 64 | 65 | void error(QAbstractSocket::SocketError error); 66 | 67 | void sslErrors(const QList &errors); 68 | 69 | protected: 70 | virtual qint64 readData(char *data, qint64 maxSize); 71 | 72 | virtual qint64 writeData(const char *data, qint64 maxSize); 73 | 74 | private slots: 75 | void binaryMessageReceived(const QByteArray &frame); 76 | 77 | private: 78 | QByteArray _buffer; 79 | QWebSocket *_webSocket; 80 | }; 81 | 82 | } 83 | 84 | #endif // QT_WEBSOCKETS_LIB 85 | 86 | #endif // QMQTT_WEBSOCKETIODEVICE_H 87 | -------------------------------------------------------------------------------- /mqtt/qmqtt_ssl_socket_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_ssl_socket_p.h - qmqtt SSL socket private header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * Copyright (c) 2016 Matthias Dieter Wallnöfer 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of mqttc nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | #ifndef QMQTT_SSL_SOCKET_P_H 34 | #define QMQTT_SSL_SOCKET_P_H 35 | 36 | #ifndef QT_NO_SSL 37 | 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | QT_FORWARD_DECLARE_CLASS(QSslSocket) 47 | QT_FORWARD_DECLARE_CLASS(QSslError) 48 | #include 49 | 50 | namespace QMQTT 51 | { 52 | 53 | class SslSocket : public SocketInterface 54 | { 55 | Q_OBJECT 56 | public: 57 | explicit SslSocket(const QSslConfiguration& config, QObject* parent = NULL); 58 | virtual ~SslSocket(); 59 | 60 | virtual QIODevice *ioDevice(); 61 | void connectToHost(const QHostAddress& address, quint16 port); 62 | void connectToHost(const QString& hostName, quint16 port); 63 | void disconnectFromHost(); 64 | QAbstractSocket::SocketState state() const; 65 | QAbstractSocket::SocketError error() const; 66 | void ignoreSslErrors(const QList& errors); 67 | void ignoreSslErrors(); 68 | QSslConfiguration sslConfiguration() const; 69 | void setSslConfiguration(const QSslConfiguration& config); 70 | 71 | protected: 72 | QScopedPointer _socket; 73 | }; 74 | 75 | } 76 | 77 | #endif // QT_NO_SSL 78 | 79 | #endif // QMQTT_SSL_SOCKET_P_H 80 | -------------------------------------------------------------------------------- /qt_image_include/imageclock.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGECLOCK_H 2 | #define IMAGECLOCK_H 3 | 4 | /** 5 | * 图片时钟控件 作者:feiyangqingyun(QQ:517216493) 2016-11-4 6 | * 1:支持鼠标右键切换风格 7 | * 2:支持设置四种背景风格样式 8 | * 3:支持四种秒针走动风格样式 9 | * 4:增加设置时间接口 10 | */ 11 | 12 | #include 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT ImageClock : public QWidget 22 | #else 23 | class ImageClock : public QWidget 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | Q_ENUMS(ClockStyle) 29 | Q_ENUMS(SecondStyle) 30 | 31 | Q_PROPERTY(ClockStyle clockStyle READ getClockStyle WRITE setClockStyle) 32 | Q_PROPERTY(SecondStyle secondStyle READ getSecondStyle WRITE setSecondStyle) 33 | 34 | public: 35 | enum ClockStyle { 36 | ClockStyle_Trad = 0, //黑色风格 37 | ClockStyle_System = 1, //银色风格 38 | ClockStyle_Modern = 2, //红色风格 39 | ClockStyle_Flower = 3 //花瓣风格 40 | }; 41 | 42 | enum SecondStyle { 43 | SecondStyle_Normal = 0, //普通效果 44 | SecondStyle_Spring = 1, //弹簧效果 45 | SecondStyle_Continue = 2, //连续效果 46 | SecondStyle_Hide = 3 //隐藏效果 47 | }; 48 | 49 | explicit ImageClock(QWidget *parent = 0); 50 | ~ImageClock(); 51 | 52 | protected: 53 | void paintEvent(QPaintEvent *); 54 | void drawBg(QPainter *painter); 55 | void drawHour(QPainter *painter); 56 | void drawMin(QPainter *painter); 57 | void drawSec(QPainter *painter); 58 | void drawDot(QPainter *painter); 59 | 60 | private: 61 | ClockStyle clockStyle; //背景样式 62 | SecondStyle secondStyle; //秒针走动样式 63 | 64 | QImage clockBg; //主背景 65 | QImage clockHour; //时钟背景 66 | QImage clockMin; //分钟背景 67 | QImage clockSec; //秒钟背景 68 | QImage clockDot; //中间点背景 69 | QImage clockHighlights; //高亮背景 70 | 71 | QStringList imageNames; //图片名称集合 72 | 73 | QTimer *timer; //定时器计算时间 74 | int hour, min, sec, msec; //时分秒毫秒 75 | 76 | QTimer *timerSpring; //定时器显示弹簧效果 77 | double angleSpring; //弹簧角度 78 | 79 | QAction *action_secondstyle;//秒针样式右键菜单 80 | 81 | private Q_SLOTS: 82 | void doAction(); 83 | void updateTime(); 84 | void updateSpring(); 85 | 86 | public: 87 | ClockStyle getClockStyle() const; 88 | SecondStyle getSecondStyle() const; 89 | QSize sizeHint() const; 90 | QSize minimumSizeHint() const; 91 | 92 | public Q_SLOTS: 93 | //设置图片背景时钟样式 94 | void setClockStyle(const ClockStyle &clockStyle); 95 | //设置秒针走动样式 96 | void setSecondStyle(const SecondStyle &secondStyle); 97 | //设置系统时间 98 | void setSystemDateTime(const QString &year, const QString &month, const QString &day, 99 | const QString &hour, const QString &min, const QString &sec); 100 | }; 101 | 102 | #endif // IMAGECLOCK_H 103 | -------------------------------------------------------------------------------- /mqtt/qmqtt_socket.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_socket.cpp - qmqtt socket 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #include "qmqtt_socket_p.h" 34 | 35 | #include 36 | 37 | QMQTT::Socket::Socket(QObject* parent) 38 | : SocketInterface(parent) 39 | , _socket(new QTcpSocket(this)) 40 | { 41 | connect(_socket.data(), &QTcpSocket::connected, this, &SocketInterface::connected); 42 | connect(_socket.data(), &QTcpSocket::disconnected, this, &SocketInterface::disconnected); 43 | connect(_socket.data(), 44 | static_cast(&QTcpSocket::error), 45 | this, 46 | static_cast(&SocketInterface::error)); 47 | } 48 | 49 | QMQTT::Socket::~Socket() 50 | { 51 | } 52 | 53 | QIODevice *QMQTT::Socket::ioDevice() 54 | { 55 | return _socket.data(); 56 | } 57 | 58 | void QMQTT::Socket::connectToHost(const QHostAddress& address, quint16 port) 59 | { 60 | _socket->connectToHost(address, port); 61 | } 62 | 63 | void QMQTT::Socket::connectToHost(const QString& hostName, quint16 port) 64 | { 65 | _socket->connectToHost(hostName, port); 66 | } 67 | 68 | void QMQTT::Socket::disconnectFromHost() 69 | { 70 | _socket->disconnectFromHost(); 71 | } 72 | 73 | QAbstractSocket::SocketState QMQTT::Socket::state() const 74 | { 75 | return _socket->state(); 76 | } 77 | 78 | QAbstractSocket::SocketError QMQTT::Socket::error() const 79 | { 80 | return _socket->error(); 81 | } 82 | -------------------------------------------------------------------------------- /qt_image_include/roundcircle.h: -------------------------------------------------------------------------------- 1 | #ifndef ROUNDCIRCLE_H 2 | #define ROUNDCIRCLE_H 3 | 4 | /** 5 | * 旋转圆控件 作者:feiyangqingyun(QQ:517216493) 2016-10-22 6 | * 1:可设置步长 7 | * 2:可设置各种颜色 8 | * 3:可设置顺时针逆时针旋转 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT RoundCircle : public QWidget 21 | #else 22 | class RoundCircle : public QWidget 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(int step READ getStep WRITE setStep) 28 | Q_PROPERTY(bool clockWise READ getClockWise WRITE setClockWise) 29 | 30 | Q_PROPERTY(QColor bgColorStart READ getBgColorStart WRITE setBgColorStart) 31 | Q_PROPERTY(QColor bgColorEnd READ getBgColorEnd WRITE setBgColorEnd) 32 | 33 | Q_PROPERTY(QColor pieColor1Start READ getPieColor1Start WRITE setPieColor1Start) 34 | Q_PROPERTY(QColor pieColor1End READ getPieColor1End WRITE setPieColor1End) 35 | Q_PROPERTY(QColor pieColor2Start READ getPieColor2Start WRITE setPieColor2Start) 36 | Q_PROPERTY(QColor pieColor2End READ getPieColor2End WRITE setPieColor2End) 37 | 38 | public: 39 | explicit RoundCircle(QWidget *parent = 0); 40 | ~RoundCircle(); 41 | 42 | protected: 43 | void paintEvent(QPaintEvent *); 44 | void drawBg(QPainter *painter); 45 | void drawPie(QPainter *painter); 46 | 47 | private: 48 | int step; //每次旋转的步长 49 | bool clockWise; //顺时针 50 | 51 | QColor bgColorStart; //背景渐变开始颜色 52 | QColor bgColorEnd; //背景渐变结束颜色 53 | 54 | QColor pieColor1Start; //圆形渐变色1开始颜色 55 | QColor pieColor1End; //圆形渐变色1结束颜色 56 | QColor pieColor2Start; //圆形渐变色2开始颜色 57 | QColor pieColor2End; //圆形渐变色2结束颜色 58 | 59 | double angle; //角度值 60 | double radius; //半径 61 | QTimer *timer; //定时器更新 62 | 63 | private slots: 64 | void updateAngle(); 65 | 66 | public: 67 | int getStep() const; 68 | bool getClockWise() const; 69 | 70 | QColor getBgColorStart() const; 71 | QColor getBgColorEnd() const; 72 | 73 | QColor getPieColor1Start() const; 74 | QColor getPieColor1End() const; 75 | QColor getPieColor2Start() const; 76 | QColor getPieColor2End() const; 77 | 78 | QSize sizeHint() const; 79 | QSize minimumSizeHint() const; 80 | 81 | public Q_SLOTS: 82 | //设置旋转的步长 83 | void setStep(int step); 84 | //设置进度旋转方向 85 | void setClockWise(bool clockWise); 86 | 87 | //设置背景渐变色 88 | void setBgColorStart(const QColor &bgColorStart); 89 | void setBgColorEnd(const QColor &bgColorEnd); 90 | 91 | //设备饼状圆形交替渐变色 92 | void setPieColor1Start(const QColor &pieColor1Start); 93 | void setPieColor1End(const QColor &pieColor1End); 94 | void setPieColor2Start(const QColor &pieColor2Start); 95 | void setPieColor2End(const QColor &pieColor2End); 96 | }; 97 | 98 | #endif // ROUNDCIRCLE_H 99 | -------------------------------------------------------------------------------- /mqtt/qmqtt_websocket.cpp: -------------------------------------------------------------------------------- 1 | #ifdef QT_WEBSOCKETS_LIB 2 | 3 | #include "qmqtt_websocket_p.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #ifndef QT_NO_SSL 10 | QMQTT::WebSocket::WebSocket(const QString& origin, 11 | QWebSocketProtocol::Version version, 12 | const QSslConfiguration* sslConfig, 13 | QObject* parent) 14 | : SocketInterface(parent) 15 | , _socket(new QWebSocket(origin, version, this)) 16 | , _ioDevice(new WebSocketIODevice(_socket, this)) 17 | { 18 | initialize(); 19 | if (sslConfig != NULL) 20 | _socket->setSslConfiguration(*sslConfig); 21 | connect(_socket, &QWebSocket::sslErrors, this, &WebSocket::sslErrors); 22 | } 23 | #endif // QT_NO_SSL 24 | 25 | QMQTT::WebSocket::WebSocket(const QString& origin, 26 | QWebSocketProtocol::Version version, 27 | QObject* parent) 28 | : SocketInterface(parent) 29 | , _socket(new QWebSocket(origin, version, this)) 30 | , _ioDevice(new WebSocketIODevice(_socket, this)) 31 | { 32 | initialize(); 33 | } 34 | 35 | void QMQTT::WebSocket::initialize() 36 | { 37 | connect(_socket, &QWebSocket::connected, this, &WebSocket::connected); 38 | connect(_socket, &QWebSocket::disconnected, this, &WebSocket::disconnected); 39 | connect(_socket, 40 | static_cast(&QWebSocket::error), 41 | this, 42 | static_cast(&SocketInterface::error)); 43 | } 44 | 45 | QMQTT::WebSocket::~WebSocket() 46 | { 47 | } 48 | 49 | void QMQTT::WebSocket::connectToHost(const QHostAddress& address, quint16 port) 50 | { 51 | Q_UNUSED(address) 52 | Q_UNUSED(port) 53 | qFatal("No supported"); 54 | } 55 | 56 | void QMQTT::WebSocket::connectToHost(const QString& hostName, quint16 port) 57 | { 58 | Q_UNUSED(port) 59 | QUrl url(hostName); 60 | QNetworkRequest request(url); 61 | request.setRawHeader("Sec-WebSocket-Protocol", "mqtt"); 62 | _ioDevice->connectToHost(request); 63 | } 64 | 65 | void QMQTT::WebSocket::disconnectFromHost() 66 | { 67 | _socket->close(); 68 | } 69 | 70 | QAbstractSocket::SocketState QMQTT::WebSocket::state() const 71 | { 72 | return _socket->state(); 73 | } 74 | 75 | QAbstractSocket::SocketError QMQTT::WebSocket::error() const 76 | { 77 | return _socket->error(); 78 | } 79 | 80 | #ifndef QT_NO_SSL 81 | void QMQTT::WebSocket::ignoreSslErrors(const QList& errors) 82 | { 83 | _socket->ignoreSslErrors(errors); 84 | } 85 | 86 | void QMQTT::WebSocket::ignoreSslErrors() 87 | { 88 | _socket->ignoreSslErrors(); 89 | } 90 | 91 | QSslConfiguration QMQTT::WebSocket::sslConfiguration() const 92 | { 93 | return _socket->sslConfiguration(); 94 | } 95 | 96 | void QMQTT::WebSocket::setSslConfiguration(const QSslConfiguration& config) 97 | { 98 | _socket->setSslConfiguration(config); 99 | } 100 | 101 | #endif // QT_NO_SSL 102 | 103 | #endif // QT_WEBSOCKETS_LIB 104 | -------------------------------------------------------------------------------- /qt_image_include/xprogressbar.h: -------------------------------------------------------------------------------- 1 | #ifndef XPROGRESSBAR_H 2 | #define XPROGRESSBAR_H 3 | 4 | /** 5 | * 自定义进度条控件 作者:feiyangqingyun(QQ:517216493) 2019-4-30 6 | * 1:可设置背景颜色 7 | * 2:可设置进度颜色 8 | * 3:可设置圆角角度 9 | * 4:可设置进度是否圆角 10 | * 5:可设置是否自动圆角 11 | * 6:可设置渐变颜色进度 12 | * 6:精准计算圆角角度,解决了QSS中border-radius当进度小于圆角角度出现方形的BUG 13 | */ 14 | 15 | #include 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT XProgressBar : public QProgressBar 25 | #else 26 | class XProgressBar : public QProgressBar 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | Q_PROPERTY(QBrush valueBrush READ getValueBrush WRITE setValueBrush) 32 | Q_PROPERTY(QColor valueColor READ getValueColor WRITE setValueColor) 33 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 34 | Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor) 35 | 36 | Q_PROPERTY(int radius READ getRadius WRITE setRadius) 37 | Q_PROPERTY(bool autoRadius READ getAutoRadius WRITE setAutoRadius) 38 | Q_PROPERTY(bool showProgressRadius READ getShowProgressRadius WRITE setShowProgressRadius) 39 | 40 | Q_PROPERTY(double borderWidth READ getBorderWidth WRITE setBorderWidth) 41 | Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor) 42 | 43 | public: 44 | explicit XProgressBar(QWidget *parent = 0); 45 | 46 | protected: 47 | void paintEvent(QPaintEvent *); 48 | void drawBg(QPainter *painter); 49 | void drawValue(QPainter *painter); 50 | void drawBorder(QPainter *painter); 51 | 52 | private: 53 | QBrush valueBrush; //进度画刷 54 | QColor valueColor; //进度颜色 55 | QColor bgColor; //背景颜色 56 | QColor textColor; //文字颜色 57 | 58 | int radius; //圆角角度 59 | bool autoRadius; //自动圆角 60 | bool showProgressRadius; //显示进度圆角角度 61 | 62 | double borderWidth; //边框宽度 63 | QColor borderColor; //边框颜色 64 | 65 | public: 66 | QBrush getValueBrush() const; 67 | QColor getValueColor() const; 68 | QColor getBgColor() const; 69 | QColor getTextColor() const; 70 | 71 | int getRadius() const; 72 | bool getAutoRadius() const; 73 | bool getShowProgressRadius()const; 74 | 75 | double getBorderWidth() const; 76 | QColor getBorderColor() const; 77 | 78 | QSize sizeHint() const; 79 | QSize minimumSizeHint() const; 80 | 81 | public Q_SLOTS: 82 | //设置进度画刷+进度颜色+背景颜色+文字颜色 83 | void setValueBrush(const QBrush &valueBrush); 84 | void setValueColor(const QColor &valueColor); 85 | void setBgColor(const QColor &bgColor); 86 | void setTextColor(const QColor &textColor); 87 | 88 | //设置圆角+自动圆角+是否显示进度圆角角度 89 | void setRadius(int radius); 90 | void setAutoRadius(bool autoRadius); 91 | void setShowProgressRadius(bool showProgressRadius); 92 | 93 | //设置边框宽度+颜色 94 | void setBorderWidth(double borderWidth); 95 | void setBorderColor(const QColor &borderColor); 96 | }; 97 | 98 | #endif // XPROGRESSBAR_H 99 | -------------------------------------------------------------------------------- /qt_image_include/wavedouble.h: -------------------------------------------------------------------------------- 1 | #ifndef WAVEDOUBLE_H 2 | #define WAVEDOUBLE_H 3 | 4 | /** 5 | * 直方对称图控件 作者:feiyangqingyun(QQ:517216493) 2016-11-6 6 | * 1:可设置最大值/最小值/当前值 7 | * 2:可设置每次过渡的步长 8 | * 3:可设置item之间的间隔 9 | * 4:可设置渐变的背景颜色 10 | * 5:可设置柱状条的颜色 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT WaveDouble : public QWidget 23 | #else 24 | class WaveDouble : public QWidget 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int minValue READ getMinValue WRITE setMinValue) 30 | Q_PROPERTY(int maxValue READ getMaxValue WRITE setMaxValue) 31 | Q_PROPERTY(int value READ getValue WRITE setValue) 32 | 33 | Q_PROPERTY(double step READ getStep WRITE setStep) 34 | Q_PROPERTY(int space READ getSpace WRITE setSpace) 35 | 36 | Q_PROPERTY(QColor bgColorStart READ getBgColorStart WRITE setBgColorStart) 37 | Q_PROPERTY(QColor bgColorEnd READ getBgColorEnd WRITE setBgColorEnd) 38 | Q_PROPERTY(QColor barColor READ getBarColor WRITE setBarColor) 39 | 40 | public: 41 | explicit WaveDouble(QWidget *parent = 0); 42 | ~WaveDouble(); 43 | 44 | protected: 45 | void paintEvent(QPaintEvent *); 46 | void drawBg(QPainter *painter); 47 | void drawBar(QPainter *painter); 48 | 49 | private: 50 | int minValue; //最小值 51 | int maxValue; //最大值 52 | int value; //目标值 53 | 54 | int step; //步长 55 | int space; //间距 56 | 57 | QColor bgColorStart; //背景渐变开始颜色 58 | QColor bgColorEnd; //背景渐变结束颜色 59 | QColor barColor; //柱状条颜色 60 | 61 | double currentValue; //当前值 62 | bool reverse; //是否倒退 63 | QTimer *timer; //绘制定时器 64 | 65 | private slots: 66 | void updateValue(); 67 | void stop(); 68 | 69 | public: 70 | int getMinValue() const; 71 | int getMaxValue() const; 72 | int getValue() const; 73 | 74 | int getStep() const; 75 | int getSpace() const; 76 | 77 | QColor getBgColorStart() const; 78 | QColor getBgColorEnd() const; 79 | QColor getBarColor() const; 80 | 81 | QSize sizeHint() const; 82 | QSize minimumSizeHint() const; 83 | 84 | public Q_SLOTS: 85 | //设置范围值 86 | void setRange(int minValue, int maxValue); 87 | 88 | //设置最大最小值 89 | void setMinValue(int minValue); 90 | void setMaxValue(int maxValue); 91 | 92 | //设置目标值 93 | void setValue(int value); 94 | 95 | //设置步长 96 | void setStep(int step); 97 | //设置间距 98 | void setSpace(int space); 99 | 100 | //设置背景颜色 101 | void setBgColorStart(const QColor &bgColorStart); 102 | void setBgColorEnd(const QColor &bgColorEnd); 103 | 104 | //设置柱状条颜色 105 | void setBarColor(const QColor &barColor); 106 | 107 | Q_SIGNALS: 108 | void valueChanged(int value); 109 | }; 110 | 111 | #endif // WAVEDOUBLE_H 112 | -------------------------------------------------------------------------------- /qt_image_include/gaugecompasspan.h: -------------------------------------------------------------------------------- 1 | #ifndef GAUGECOMPASSPAN_H 2 | #define GAUGECOMPASSPAN_H 3 | 4 | /** 5 | * 指南针面板控件 作者:东门吹雪(QQ:709102202) 整理:飞扬青云(QQ:517216493) 2019-4-23 6 | * 1:可设置当前度数 7 | * 2:可设置背景颜色+文字颜色 8 | * 3:可设置边框颜色+边框宽度 9 | * 4:可设置正北点颜色 10 | * 5:可设置其他方向点颜色 11 | * 6:可设置指针颜色 12 | * 7:自动计算方位变显示 13 | */ 14 | 15 | #include 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT GaugeCompassPan : public QWidget 25 | #else 26 | class GaugeCompassPan : public QWidget 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | Q_PROPERTY(double value READ getValue WRITE setValue) 32 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 33 | Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor) 34 | Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor) 35 | Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth) 36 | 37 | Q_PROPERTY(QColor northDotColor READ getNorthDotColor WRITE setNorthDotColor) 38 | Q_PROPERTY(QColor otherDotColor READ getOtherDotColor WRITE setOtherDotColor) 39 | Q_PROPERTY(QColor pointerColor READ getPointerColor WRITE setPointerColor) 40 | 41 | public: 42 | explicit GaugeCompassPan(QWidget *parent = 0); 43 | ~GaugeCompassPan(); 44 | 45 | protected: 46 | void paintEvent(QPaintEvent *); 47 | void drawBg(QPainter *painter); 48 | void drawFourDots(QPainter *painter); 49 | void drawFourText(QPainter *painter); 50 | void drawPointer(QPainter *painter); 51 | void drawValue(QPainter *painter); 52 | 53 | private: 54 | double value; //当前值 55 | QColor bgColor; //背景颜色 56 | QColor textColor; //文字颜色 57 | QColor borderColor; //边框颜色 58 | int borderWidth; //边框宽度 59 | 60 | QColor northDotColor; //正北点颜色 61 | QColor otherDotColor; //其它方向点颜色 62 | QColor pointerColor; //指针颜色 63 | 64 | public: 65 | double getValue() const; 66 | QColor getBgColor() const; 67 | QColor getTextColor() const; 68 | QColor getBorderColor() const; 69 | int getBorderWidth() const; 70 | 71 | QColor getNorthDotColor() const; 72 | QColor getOtherDotColor() const; 73 | QColor getPointerColor() const; 74 | 75 | QSize sizeHint() const; 76 | QSize minimumSizeHint() const; 77 | 78 | public Q_SLOTS: 79 | //设置值 80 | void setValue(double value); 81 | //设置背景色 82 | void setBgColor(const QColor &bgColor); 83 | //设置文字颜色 84 | void setTextColor(const QColor &textColor); 85 | //设置外边框颜色 86 | void setBorderColor(const QColor &borderColor); 87 | //设置外边框宽度 88 | void setBorderWidth(int borderWidth); 89 | 90 | //设置正北点颜色 91 | void setNorthDotColor(const QColor &northDotColor); 92 | //设置其它方向点颜色 93 | void setOtherDotColor(const QColor &otherDotColor); 94 | //设置指针颜色 95 | void setPointerColor(const QColor &pointerColor); 96 | 97 | Q_SIGNALS: 98 | void valueChanged(double value); 99 | }; 100 | 101 | #endif // GAUGECOMPASSPAN_H 102 | -------------------------------------------------------------------------------- /qt_image_include/wavedata.h: -------------------------------------------------------------------------------- 1 | #ifndef WAVEDATA_H 2 | #define WAVEDATA_H 3 | 4 | /** 5 | * 音量采样值波形控件 作者:feiyangqingyun(QQ:517216493) 2017-9-10 6 | * 1:可设置采样深度 7 | * 2:可设置当前位置线条宽度/线条颜色 8 | * 3:可设置前景色/背景色 9 | * 4:可设置数据展示样式,线条样式/柱状样式/平滑样式 10 | */ 11 | 12 | #include 13 | 14 | #ifdef quc 15 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | class QDESIGNER_WIDGET_EXPORT WaveData : public QWidget 22 | #else 23 | class WaveData : public QWidget 24 | #endif 25 | 26 | { 27 | Q_OBJECT 28 | Q_ENUMS(WaveStyle) 29 | Q_PROPERTY(double deep READ getDeep WRITE setDeep) 30 | Q_PROPERTY(bool showLine READ getShowLine WRITE setShowLine) 31 | Q_PROPERTY(int lineWidth READ getLineWidth WRITE setLineWidth) 32 | Q_PROPERTY(QColor lineColor READ getLineColor WRITE setLineColor) 33 | Q_PROPERTY(QColor foreground READ getForeground WRITE setForeground) 34 | Q_PROPERTY(QColor background READ getBackground WRITE setBackground) 35 | Q_PROPERTY(WaveStyle waveStyle READ getWaveStyle WRITE setWaveStyle) 36 | 37 | public: 38 | enum WaveStyle { 39 | WaveStyle_Line = 0, //线条样式 40 | WaveStyle_Smooth = 1, //平滑样式 41 | WaveStyle_Bar = 2 //柱状样式 42 | }; 43 | 44 | explicit WaveData(QWidget *parent = 0); 45 | 46 | protected: 47 | void mousePressEvent(QMouseEvent *); 48 | void paintEvent(QPaintEvent *); 49 | void drawBg(QPainter *painter); 50 | void drawData(QPainter *painter); 51 | void drawLine(QPainter *painter); 52 | 53 | private: 54 | double deep; //采集深度 55 | bool showLine; //显示线条 56 | int lineWidth; //线条宽度 57 | QColor lineColor; //线条颜色 58 | QColor foreground; //前景色 59 | QColor background; //背景色 60 | WaveStyle waveStyle; //数据样式 61 | 62 | int length; //采样点长度 63 | int position; //当前位置 64 | QVector data; //采样点数据 65 | 66 | public: 67 | double getDeep() const; 68 | bool getShowLine() const; 69 | int getLineWidth() const; 70 | QColor getLineColor() const; 71 | QColor getForeground() const; 72 | QColor getBackground() const; 73 | WaveStyle getWaveStyle() const; 74 | 75 | QSize sizeHint() const; 76 | QSize minimumSizeHint() const; 77 | 78 | public slots: 79 | //设置深度 80 | void setDeep(double deep); 81 | 82 | //设置是否显示线条 83 | void setShowLine(bool showLine); 84 | //设置线条宽度 85 | void setLineWidth(int lineWidth); 86 | //设置线条颜色 87 | void setLineColor(const QColor &lineColor); 88 | 89 | //设置前景色 90 | void setForeground(const QColor &foreground); 91 | //设置背景色 92 | void setBackground(const QColor &background); 93 | 94 | //设置数据样式 95 | void setWaveStyle(const WaveStyle &waveStyle); 96 | 97 | //设置总长度 98 | void setLength(int length); 99 | //设置当前位置 100 | void setPosition(int position); 101 | 102 | //设置当前数据 103 | void setData(const QVector &data); 104 | //清空数据 105 | void clearData(); 106 | 107 | signals: 108 | void positionChanged(int position); 109 | }; 110 | 111 | #endif // WAVEDATA_H 112 | -------------------------------------------------------------------------------- /mqtt/qmqtt_socketinterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_socketinterface.h - qmqtt socket interface header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_SOCKET_INTERFACE_H 33 | #define QMQTT_SOCKET_INTERFACE_H 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #ifndef QT_NO_SSL 44 | #include 45 | QT_FORWARD_DECLARE_CLASS(QSslError) 46 | #endif // QT_NO_SSL 47 | 48 | QT_FORWARD_DECLARE_CLASS(QIODevice) 49 | 50 | namespace QMQTT 51 | { 52 | 53 | class Q_MQTT_EXPORT SocketInterface : public QObject 54 | { 55 | Q_OBJECT 56 | public: 57 | explicit SocketInterface(QObject* parent = NULL) : QObject(parent) {} 58 | virtual ~SocketInterface() {} 59 | 60 | virtual QIODevice* ioDevice() = 0; 61 | virtual void connectToHost(const QHostAddress& address, quint16 port) = 0; 62 | virtual void connectToHost(const QString& hostName, quint16 port) = 0; 63 | virtual void disconnectFromHost() = 0; 64 | virtual QAbstractSocket::SocketState state() const = 0; 65 | virtual QAbstractSocket::SocketError error() const = 0; 66 | #ifndef QT_NO_SSL 67 | virtual void ignoreSslErrors(const QList& errors) { Q_UNUSED(errors); } 68 | virtual void ignoreSslErrors() {} 69 | virtual QSslConfiguration sslConfiguration() const { return QSslConfiguration(); } 70 | virtual void setSslConfiguration(const QSslConfiguration& config) { Q_UNUSED(config); } 71 | #endif // QT_NO_SSL 72 | 73 | signals: 74 | void connected(); 75 | void disconnected(); 76 | void error(QAbstractSocket::SocketError socketError); 77 | #ifndef QT_NO_SSL 78 | void sslErrors(const QList& errors); 79 | #endif // QT_NO_SSL 80 | }; 81 | 82 | } 83 | 84 | #endif // QMQTT_SOCKET_INTERFACE_H 85 | -------------------------------------------------------------------------------- /mqtt/qmqtt_message.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_message.h - qmqtt message header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_MESSAGE_H 33 | #define QMQTT_MESSAGE_H 34 | 35 | #include "qmqtt_global.h" 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | namespace QMQTT { 43 | 44 | class MessagePrivate; 45 | 46 | class Q_MQTT_EXPORT Message 47 | { 48 | public: 49 | Message(); 50 | explicit Message(const quint16 id, const QString &topic, const QByteArray &payload, 51 | const quint8 qos = 0, const bool retain = false, const bool dup = false); 52 | Message(const Message &other); 53 | ~Message(); 54 | 55 | Message &operator=(const Message &other); 56 | #ifdef Q_COMPILER_RVALUE_REFS 57 | inline Message &operator=(Message &&other) Q_DECL_NOTHROW 58 | { swap(other); return *this; } 59 | #endif 60 | 61 | bool operator==(const Message &other) const; 62 | inline bool operator!=(const Message &other) const 63 | { return !operator==(other); } 64 | 65 | inline void swap(Message &other) Q_DECL_NOTHROW 66 | { qSwap(d, other.d); } 67 | 68 | quint16 id() const; 69 | void setId(const quint16 id); 70 | 71 | quint8 qos() const; 72 | void setQos(const quint8 qos); 73 | 74 | bool retain() const; 75 | void setRetain(const bool retain); 76 | 77 | bool dup() const; 78 | void setDup(const bool dup); 79 | 80 | QString topic() const; 81 | void setTopic(const QString &topic); 82 | 83 | QByteArray payload() const; 84 | void setPayload(const QByteArray &payload); 85 | 86 | private: 87 | QSharedDataPointer d; 88 | }; 89 | 90 | } // namespace QMQTT 91 | 92 | Q_DECLARE_SHARED(QMQTT::Message) 93 | 94 | Q_DECLARE_METATYPE(QMQTT::Message) 95 | 96 | #endif // QMQTT_MESSAGE_H 97 | -------------------------------------------------------------------------------- /qt_image_include/barvolume.h: -------------------------------------------------------------------------------- 1 | #ifndef BARVOLUME_H 2 | #define BARVOLUME_H 3 | 4 | /** 5 | * 柱状音量控件 作者:feiyangqingyun(QQ:517216493) 2016-11-6 6 | * 1:可设置范围值/当前值/步长/圆角角度 7 | * 2:可设置背景渐变颜色 8 | * 3:可设置柱状三种渐变颜色 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT BarVolume : public QWidget 21 | #else 22 | class BarVolume : public QWidget 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(int value READ getValue WRITE setValue) 28 | Q_PROPERTY(int step READ getStep WRITE setStep) 29 | Q_PROPERTY(int space READ getSpace WRITE setSpace) 30 | Q_PROPERTY(int padding READ getPadding WRITE setPadding) 31 | Q_PROPERTY(int radius READ getRadius WRITE setRadius) 32 | 33 | Q_PROPERTY(QColor bgColorStart READ getBgColorStart WRITE setBgColorStart) 34 | Q_PROPERTY(QColor bgColorEnd READ getBgColorEnd WRITE setBgColorEnd) 35 | 36 | Q_PROPERTY(QColor barBgColor READ getBarBgColor WRITE setBarBgColor) 37 | Q_PROPERTY(QColor barColorStart READ getBarColorStart WRITE setBarColorStart) 38 | Q_PROPERTY(QColor barColorMid READ getBarColorMid WRITE setBarColorMid) 39 | Q_PROPERTY(QColor barColorEnd READ getBarColorEnd WRITE setBarColorEnd) 40 | 41 | public: 42 | explicit BarVolume(QWidget *parent = 0); 43 | 44 | protected: 45 | void paintEvent(QPaintEvent *); 46 | void drawBg(QPainter *painter); 47 | void drawBarBg(QPainter *painter); 48 | void drawBar(QPainter *painter); 49 | 50 | private: 51 | int value; //目标值 52 | int step; //步长 53 | int space; //间距 54 | int padding; //间隔 55 | int radius; //圆角角度 56 | 57 | QColor bgColorStart; //背景渐变开始颜色 58 | QColor bgColorEnd; //背景渐变结束颜色 59 | 60 | QColor barBgColor; //进度背景颜色 61 | QColor barColorStart; //进度渐变开始颜色 62 | QColor barColorMid; //进度渐变中间颜色 63 | QColor barColorEnd; //进度渐变结束颜色 64 | 65 | public: 66 | int getValue() const; 67 | int getStep() const; 68 | int getSpace() const; 69 | int getPadding() const; 70 | int getRadius() const; 71 | 72 | QColor getBgColorStart() const; 73 | QColor getBgColorEnd() const; 74 | 75 | QColor getBarBgColor() const; 76 | QColor getBarColorStart() const; 77 | QColor getBarColorMid() const; 78 | QColor getBarColorEnd() const; 79 | 80 | QSize sizeHint() const; 81 | QSize minimumSizeHint() const; 82 | 83 | public Q_SLOTS: 84 | //设置目标值 85 | void setValue(int value); 86 | //设置步长 87 | void setStep(int step); 88 | //设置间距 89 | void setSpace(int space); 90 | //设置间隔 91 | void setPadding(int padding); 92 | //设置圆角角度 93 | void setRadius(int radius); 94 | 95 | //设置背景颜色 96 | void setBgColorStart(QColor bgColorStart); 97 | void setBgColorEnd(QColor bgColorEnd); 98 | 99 | //设置柱状颜色 100 | void setBarBgColor(QColor barBgColor); 101 | void setBarColorStart(QColor barColorStart); 102 | void setBarColorMid(QColor barColorMid); 103 | void setBarColorEnd(QColor barColorEnd); 104 | }; 105 | 106 | #endif // BARVOLUME_H 107 | -------------------------------------------------------------------------------- /qt_image_include/wavebar.h: -------------------------------------------------------------------------------- 1 | #ifndef WAVEBAR_H 2 | #define WAVEBAR_H 3 | 4 | /** 5 | * 直方动态图控件 作者:feiyangqingyun(QQ:517216493) 2016-11-6 6 | * 1:可设置范围值/当前值/步长/圆角角度 7 | * 2:可设置顶部滑块高度 8 | * 3:可设置背景颜色和柱状条颜色 9 | */ 10 | 11 | #include 12 | 13 | #ifdef quc 14 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | class QDESIGNER_WIDGET_EXPORT WaveBar : public QWidget 21 | #else 22 | class WaveBar : public QWidget 23 | #endif 24 | 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(int minValue READ getMinValue WRITE setMinValue) 28 | Q_PROPERTY(int maxValue READ getMaxValue WRITE setMaxValue) 29 | Q_PROPERTY(int value READ getValue WRITE setValue) 30 | 31 | Q_PROPERTY(double step READ getStep WRITE setStep) 32 | Q_PROPERTY(int space READ getSpace WRITE setSpace) 33 | Q_PROPERTY(int headHeight READ getHeadHeight WRITE setHeadHeight) 34 | 35 | Q_PROPERTY(QColor bgColorStart READ getBgColorStart WRITE setBgColorStart) 36 | Q_PROPERTY(QColor bgColorEnd READ getBgColorEnd WRITE setBgColorEnd) 37 | Q_PROPERTY(QColor barColor READ getBarColor WRITE setBarColor) 38 | 39 | public: 40 | explicit WaveBar(QWidget *parent = 0); 41 | ~WaveBar(); 42 | 43 | protected: 44 | void resizeEvent(QResizeEvent *); 45 | void paintEvent(QPaintEvent *); 46 | void drawBg(QPainter *painter); 47 | void drawBar(QPainter *painter); 48 | void drawHead(QPainter *painter); 49 | 50 | private: 51 | int minValue; //最小值 52 | int maxValue; //最大值 53 | int value; //目标值 54 | 55 | double step; //步长 56 | int space; //间距 57 | int headHeight; //顶部条块高度 58 | 59 | QColor bgColorStart; //背景渐变开始颜色 60 | QColor bgColorEnd; //背景渐变结束颜色 61 | QColor barColor; //柱状条颜色 62 | 63 | int currentValue; //当前值 64 | double headY; //顶部条块Y轴坐标 65 | double barY; //柱状条块Y轴坐标 66 | QTimer *barTimer; //柱状条块下降定时器 67 | QTimer *headTimer; //顶部条块下坠定时器 68 | 69 | private slots: 70 | void updateBar(); 71 | void updateHead(); 72 | 73 | public: 74 | int getMinValue() const; 75 | int getMaxValue() const; 76 | int getValue() const; 77 | 78 | double getStep() const; 79 | int getSpace() const; 80 | int getHeadHeight() const; 81 | 82 | QColor getBgColorStart() const; 83 | QColor getBgColorEnd() const; 84 | QColor getBarColor() const; 85 | 86 | QSize sizeHint() const; 87 | QSize minimumSizeHint() const; 88 | 89 | public Q_SLOTS: 90 | //设置范围值 91 | void setRange(int minValue, int maxValue); 92 | 93 | //设置最大最小值 94 | void setMinValue(int minValue); 95 | void setMaxValue(int maxValue); 96 | 97 | //设置目标值 98 | void setValue(int value); 99 | 100 | //设置步长 101 | void setStep(double step); 102 | //设置间距 103 | void setSpace(int space); 104 | //设置顶部条块高度 105 | void setHeadHeight(int headHeight); 106 | 107 | //设置背景颜色 108 | void setBgColorStart(const QColor &bgColorStart); 109 | void setBgColorEnd(const QColor &bgColorEnd); 110 | 111 | //设置柱状条颜色 112 | void setBarColor(const QColor &barColor); 113 | }; 114 | 115 | #endif // WAVEBAR_H 116 | -------------------------------------------------------------------------------- /mqtt/qmqtt.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | import qbs.TextFile 3 | import qbs.FileInfo 4 | 5 | Product { 6 | name: "qmqtt" 7 | type: [libraryType] 8 | property bool webSocketSupport: false 9 | property string libraryType: "dynamiclibrary" 10 | targetName: "qmqtt" 11 | version: "1.0.0" 12 | 13 | cpp.defines: [ 14 | "QT_BUILD_QMQTT_LIB", 15 | "QT_NO_CAST_TO_ASCII", 16 | "QT_NO_CAST_FROM_ASCII", 17 | ] 18 | 19 | cpp.includePaths: sourceDirectory 20 | 21 | files: [ 22 | "*.cpp" 23 | ] 24 | 25 | Group { 26 | name: "Public Headers" 27 | fileTags: [ 28 | "hpp", 29 | "public_headers" 30 | ] 31 | files: [ 32 | "*.h" 33 | ] 34 | excludeFiles: privateHeaders.files 35 | } 36 | 37 | Group { 38 | id: privateHeaders 39 | name: "Private Headers" 40 | fileTags: [ 41 | "hpp", 42 | "private_headers", 43 | ] 44 | files: [ 45 | "*_p.h" 46 | ] 47 | } 48 | 49 | Group { 50 | fileTagsFilter: libraryType 51 | qbs.install: true 52 | qbs.installDir: "lib" 53 | } 54 | 55 | Group { 56 | fileTagsFilter: "public_headers" 57 | qbs.install: true 58 | qbs.installDir: FileInfo.joinPaths("include", product.name) 59 | } 60 | 61 | Group { 62 | fileTagsFilter: "private_headers" 63 | qbs.install: true 64 | qbs.installDir: FileInfo.joinPaths("include", product.name, version, product.name) 65 | } 66 | 67 | Group { 68 | fileTagsFilter: "Exporter.qbs.module" 69 | qbs.installDir: FileInfo.joinPaths("qbs", "modules", product.name, "private") 70 | qbs.install: true 71 | } 72 | 73 | Group { 74 | fileTagsFilter: "Exporter.pkgconfig.pc" 75 | qbs.installDir: FileInfo.joinPaths("lib" ,"pkgconfig") 76 | qbs.install: true 77 | } 78 | 79 | Depends { 80 | name: "cpp" 81 | } 82 | 83 | Depends { 84 | name: "Qt" 85 | property var baseModules: ["core", "network"] 86 | 87 | Properties { 88 | condition: webSocketSupport 89 | submodules: baseModules.concat(["websockets"]) 90 | } 91 | Properties { 92 | condition: !webSocketSupport 93 | submodules: baseModules 94 | } 95 | } 96 | 97 | Depends { 98 | name: "Exporter.qbs" 99 | } 100 | Depends { 101 | name: "Exporter.pkgconfig" 102 | } 103 | 104 | Export { 105 | Depends { 106 | name: "cpp" 107 | } 108 | 109 | Depends { 110 | name: "Qt" 111 | property var baseModules: ["core", "network"] 112 | Properties { 113 | condition: product.webSocketSupport 114 | submodules: baseModules.concat(["websockets"]) 115 | } 116 | Properties { 117 | condition: !product.webSocketSupport 118 | submodules: baseModules 119 | } 120 | } 121 | 122 | cpp.includePaths: [ 123 | product.sourceDirectory, 124 | FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, "include"), 125 | ] 126 | prefixMapping: [ 127 | { 128 | prefix: product.sourceDirectory, 129 | replacement: FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, "include", 130 | product.name) 131 | } 132 | ] 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /qt_image_include/tumbler.h: -------------------------------------------------------------------------------- 1 | #ifndef TUMBLER_H 2 | #define TUMBLER_H 3 | 4 | /** 5 | * 滑动选择器控件 作者:feiyangqingyun(QQ:517216493) 2016-11-24 6 | * 1:可设置数据队列值 7 | * 2:可设置当前队列索引及当前值 8 | * 2:支持任意窗体大小缩放 9 | * 3:支持背景色前景色文字颜色线条颜色设置 10 | * 4:支持左右滑动和上下滑动两种形式 11 | * 5:支持鼠标滚动切换元素 12 | * 6:中间值自动放大显示且居中 13 | */ 14 | 15 | #include 16 | 17 | #ifdef quc 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 19 | #include 20 | #else 21 | #include 22 | #endif 23 | 24 | class QDESIGNER_WIDGET_EXPORT Tumbler : public QWidget 25 | #else 26 | class Tumbler : public QWidget 27 | #endif 28 | 29 | { 30 | Q_OBJECT 31 | Q_PROPERTY(int currentIndex READ getCurrentIndex WRITE setCurrentIndex) 32 | Q_PROPERTY(QString currentValue READ getCurrentValue WRITE setCurrentValue) 33 | Q_PROPERTY(bool horizontal READ getHorizontal WRITE setHorizontal) 34 | 35 | Q_PROPERTY(QColor foreground READ getForeground WRITE setForeground) 36 | Q_PROPERTY(QColor background READ getBackground WRITE setBackground) 37 | Q_PROPERTY(QColor lineColor READ getLineColor WRITE setLineColor) 38 | Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor) 39 | 40 | public: 41 | explicit Tumbler(QWidget *parent = 0); 42 | 43 | protected: 44 | void wheelEvent(QWheelEvent *); 45 | void mousePressEvent(QMouseEvent *); 46 | void mouseMoveEvent(QMouseEvent *); 47 | void mouseReleaseEvent(QMouseEvent *); 48 | void paintEvent(QPaintEvent *); 49 | void drawBg(QPainter *painter); 50 | void drawLine(QPainter *painter); 51 | void drawText(QPainter *painter, int index, int offset); 52 | 53 | private: 54 | QStringList listValue; //值队列 55 | int currentIndex; //当前索引 56 | QString currentValue; //当前值 57 | bool horizontal; //是否横向显示 58 | 59 | QColor foreground; //前景色 60 | QColor background; //背景色 61 | QColor lineColor; //线条颜色 62 | QColor textColor; //当前文本颜色 63 | 64 | int percent; //比例 65 | int offset; //偏离值 66 | bool pressed; //鼠标是否按下 67 | int pressedPos; //按下处坐标 68 | int currentPos; //当前值对应起始坐标 69 | 70 | private: 71 | void checkPosition(); 72 | 73 | public: 74 | QStringList getListValue() const; 75 | int getCurrentIndex() const; 76 | QString getCurrentValue() const; 77 | bool getHorizontal() const; 78 | 79 | QColor getForeground() const; 80 | QColor getBackground() const; 81 | QColor getLineColor() const; 82 | QColor getTextColor() const; 83 | 84 | QSize sizeHint() const; 85 | QSize minimumSizeHint() const; 86 | 87 | public Q_SLOTS: 88 | //设置值队列 89 | void setListValue(const QStringList &listValue); 90 | //设置当前索引 91 | void setCurrentIndex(int currentIndex); 92 | //设置当前值 93 | void setCurrentValue(const QString ¤tValue); 94 | //设置横向显示,如果为假则纵向显示 95 | void setHorizontal(bool horizontal); 96 | 97 | //设置前景色 98 | void setForeground(const QColor &foreground); 99 | //设置背景色 100 | void setBackground(const QColor &background); 101 | //设置线条颜色 102 | void setLineColor(const QColor &lineColor); 103 | //设置文本颜色 104 | void setTextColor(const QColor &textColor); 105 | 106 | Q_SIGNALS: 107 | void currentIndexChanged(int currentIndex); 108 | void currentValueChanged(QString currentValue); 109 | }; 110 | 111 | #endif // TUMBLER_H 112 | -------------------------------------------------------------------------------- /qt_image_include/customgraphics.h: -------------------------------------------------------------------------------- 1 | #ifndef CUSTOMGRAPHICS_H 2 | #define CUSTOMGRAPHICS_H 3 | 4 | /** 5 | * 自定义多边形控件 作者:赵彦博(QQ:408815041 zyb920@hotmail.com) 2019-3-28 6 | * 1:自定义随意绘制多边形 7 | * 2:产生闭合形状后可单击选中移动整个多边形 8 | * 3:可拉动某个点 9 | * 4:支持多个多边形 10 | * 5:鼠标右键退出绘制 11 | * 6:可设置各种颜色 12 | */ 13 | 14 | #include 15 | 16 | #ifdef quc 17 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 18 | #include 19 | #else 20 | #include 21 | #endif 22 | 23 | class QDESIGNER_WIDGET_EXPORT CustomGraphics : public QWidget 24 | #else 25 | class CustomGraphics : public QWidget 26 | #endif 27 | 28 | { 29 | Q_OBJECT 30 | Q_PROPERTY(bool selectDotVisible READ getSelectDotVisible WRITE setSelectDotVisible) 31 | Q_PROPERTY(int dotRadius READ getDotRadius WRITE setDotRadius) 32 | Q_PROPERTY(int lineWidth READ getLineWidth WRITE setLineWidth) 33 | 34 | Q_PROPERTY(QColor dotColor READ getDotColor WRITE setDotColor) 35 | Q_PROPERTY(QColor lineColor READ getLineColor WRITE setLineColor) 36 | Q_PROPERTY(QColor polygonColor READ getPolygonColor WRITE setPolygonColor) 37 | Q_PROPERTY(QColor selectColor READ getSelectColor WRITE setSelectColor) 38 | 39 | public: 40 | typedef struct { 41 | QVector pos; 42 | bool selected; 43 | } Polygon; 44 | 45 | explicit CustomGraphics(QWidget *parent = 0); 46 | 47 | protected: 48 | void mousePressEvent(QMouseEvent *e); 49 | void mouseMoveEvent(QMouseEvent *e); 50 | void mouseReleaseEvent(QMouseEvent *e); 51 | void paintEvent(QPaintEvent *); 52 | void drawPolygon(QPainter *p, const Polygon &v); 53 | void drawLines(QPainter *p, const QList &list, bool isFirst = true); 54 | 55 | private: 56 | bool selectDotVisible; //选中点可见 57 | int dotRadius; //点的半径 58 | int lineWidth; //线条宽度 59 | 60 | QColor dotColor; //点的颜色 61 | QColor lineColor; //线条颜色 62 | QColor polygonColor; //多边形颜色 63 | QColor selectColor; //选中颜色 64 | 65 | QPoint tempPoint; //临时点 66 | QList tempPoints; //点集合 67 | QList tempPolygons;//多边形集合 68 | 69 | bool pressed; //鼠标是否按下 70 | QPoint lastPoint; //鼠标按下处的坐标 71 | QPoint ellipsePos; //保存按下点的坐标 72 | int selectedEllipseIndex; //选中点的index 73 | Polygon pressedPolygon; //保存按下时多边形的原始坐标 74 | int selectedIndex; //选中多边形的index 75 | 76 | private: 77 | //计算两点间的距离 78 | double length(const QPoint &p1, const QPoint &p2); 79 | //检测是否选中多边形 80 | bool checkPoint(const QVector &points, int x, int y); 81 | 82 | public: 83 | bool getSelectDotVisible() const; 84 | int getDotRadius() const; 85 | int getLineWidth() const; 86 | 87 | QColor getDotColor() const; 88 | QColor getLineColor() const; 89 | QColor getPolygonColor() const; 90 | QColor getSelectColor() const; 91 | 92 | QSize sizeHint() const; 93 | QSize minimumSizeHint() const; 94 | 95 | public Q_SLOTS: 96 | void setSelectDotVisible(bool selectDotVisible); 97 | void setDotRadius(int dotRadius); 98 | void setLineWidth(int lineWidth); 99 | 100 | void setDotColor(const QColor &dotColor); 101 | void setLineColor(const QColor &lineColor); 102 | void setPolygonColor(const QColor &polygonColor); 103 | void setSelectColor(const QColor &selectColor); 104 | 105 | //清除临时绘制的 106 | void clearTemp(); 107 | //清除所有 108 | void clearAll(); 109 | }; 110 | 111 | #endif // CUSTOMGRAPHICS_H 112 | --------------------------------------------------------------------------------