From 9f980d1242dbc12836c2df1e002e6b408bbb20e3 Mon Sep 17 00:00:00 2001 From: Jinhuan <412100639@qq.com> Date: Wed, 10 Sep 2025 22:26:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BA=BF=E7=A8=8Bdefine?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E9=9A=94=E7=A6=BB=E4=B8=8D=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cigarette/Thread/Cleanthread.cpp | 4 +++- Cigarette/Thread/Cleanthread.h | 3 +++ Cigarette/Thread/Logthread.cpp | 4 +++- Cigarette/Thread/Logthread.h | 3 +++ Cigarette/Thread/threadSend.cpp | 3 +++ Cigarette/Thread/threadSend.h | 4 +++- Cigarette/Thread/threadSendMqtt.cpp | 4 +++- Cigarette/Thread/threadSendMqtt.h | 5 ++++- Cigarette/Thread/threadSendTCP.cpp | 3 +++ Cigarette/Thread/threadSendTCP.h | 3 +++ Cigarette/Ui/dialogsetup.cpp | 2 ++ 11 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Cigarette/Thread/Cleanthread.cpp b/Cigarette/Thread/Cleanthread.cpp index 92785787..c3c73d2a 100644 --- a/Cigarette/Thread/Cleanthread.cpp +++ b/Cigarette/Thread/Cleanthread.cpp @@ -1,4 +1,6 @@ #include "Cleanthread.h" + +#ifdef CLEAR_THREAD #include #include #include @@ -6,7 +8,6 @@ #include #include #include -#include "common.h"/// extern SysConf g_sys_conf;/// extern ConfPath g_conf_path; @@ -154,3 +155,4 @@ qint64 CleanWorkThread::DirFileSize(const QString& path) } return size; } +#endif \ No newline at end of file diff --git a/Cigarette/Thread/Cleanthread.h b/Cigarette/Thread/Cleanthread.h index a17d3b88..a91e23d0 100644 --- a/Cigarette/Thread/Cleanthread.h +++ b/Cigarette/Thread/Cleanthread.h @@ -1,4 +1,6 @@ #pragma once +#include "common.h" +#ifdef CLEAR_THREAD #include class CleanWorkThread : public QObject { @@ -22,3 +24,4 @@ public: private: int delSelection; }; +#endif \ No newline at end of file diff --git a/Cigarette/Thread/Logthread.cpp b/Cigarette/Thread/Logthread.cpp index 1c729016..3e4ff430 100644 --- a/Cigarette/Thread/Logthread.cpp +++ b/Cigarette/Thread/Logthread.cpp @@ -1,8 +1,9 @@ #include "Logthread.h" + +#ifdef LOG_RECORD #include #include #include -#include const char Suffix[] = ".txt"; bool CLog::isFileReady = false; @@ -162,3 +163,4 @@ void CLog::recMegFromCigarette(QString str) //qDebug() << GetCurrentThreadId() << "WinAPI"; CLOG_INFO(str.toStdString().c_str()); } +#endif \ No newline at end of file diff --git a/Cigarette/Thread/Logthread.h b/Cigarette/Thread/Logthread.h index 805c8a7d..a36746fa 100644 --- a/Cigarette/Thread/Logthread.h +++ b/Cigarette/Thread/Logthread.h @@ -1,4 +1,6 @@ #pragma once +#include +#ifdef LOG_RECORD #include class CLog : public QObject @@ -70,3 +72,4 @@ private: #endif #define CLOG_INFO(...) CLog::log(CLog::STARTAPP, __VA_ARGS__) +#endif \ No newline at end of file diff --git a/Cigarette/Thread/threadSend.cpp b/Cigarette/Thread/threadSend.cpp index 0ee3fdb6..73f94a96 100644 --- a/Cigarette/Thread/threadSend.cpp +++ b/Cigarette/Thread/threadSend.cpp @@ -1,4 +1,6 @@ #include "threadSend.h" + +#ifdef __UDPSend #include #include "basecamera.h" #include @@ -172,3 +174,4 @@ void threadSend::sendFile(QString FilePath, int port) mSocket.writeDatagram(FileEndFrame.toLatin1(), QHostAddress(ip), port); file.close(); } +#endif \ No newline at end of file diff --git a/Cigarette/Thread/threadSend.h b/Cigarette/Thread/threadSend.h index 2c318d79..a8430655 100644 --- a/Cigarette/Thread/threadSend.h +++ b/Cigarette/Thread/threadSend.h @@ -1,4 +1,6 @@ #pragma once +#include "common.h" +#ifdef __UDPSend #include #include #include @@ -6,7 +8,6 @@ #include #include #include -#include "common.h" #include "SyncQueue.h" #include @@ -94,3 +95,4 @@ public: std::atomic_bool isLoop = { 0 }; QUdpSocket mSocket; }; +#endif \ No newline at end of file diff --git a/Cigarette/Thread/threadSendMqtt.cpp b/Cigarette/Thread/threadSendMqtt.cpp index f5f5fd53..09783940 100644 --- a/Cigarette/Thread/threadSendMqtt.cpp +++ b/Cigarette/Thread/threadSendMqtt.cpp @@ -1,6 +1,7 @@ #include "threadSendMqtt.h" -#include +#ifdef __MQTTSend +#include // 相关头文件 #include // 文件操作 #include // JSON对象 @@ -96,3 +97,4 @@ void threadSendMqtt::sendData(_MqttSendInfo* TCPSendInfo, int Num) { auto result = m_client.publish(QMqttTopicName("topic"), jsonBytes, 0, true); } } +#endif \ No newline at end of file diff --git a/Cigarette/Thread/threadSendMqtt.h b/Cigarette/Thread/threadSendMqtt.h index b44efd04..65d9ffd6 100644 --- a/Cigarette/Thread/threadSendMqtt.h +++ b/Cigarette/Thread/threadSendMqtt.h @@ -1,10 +1,12 @@ #pragma once +#include "common.h" + +#ifdef __MQTTSend #include #include #include #include #include -#include "common.h" #include "SyncQueue.h" class _MqttSendInfo @@ -54,3 +56,4 @@ public: std::atomic_bool isLoop = { 0 }; QMqttClient m_client; }; +#endif \ No newline at end of file diff --git a/Cigarette/Thread/threadSendTCP.cpp b/Cigarette/Thread/threadSendTCP.cpp index 816d20da..7a01ffb5 100644 --- a/Cigarette/Thread/threadSendTCP.cpp +++ b/Cigarette/Thread/threadSendTCP.cpp @@ -1,4 +1,6 @@ #include "threadSendTCP.h" + +#ifdef __TCPSend #include #include #include @@ -222,4 +224,5 @@ void threadSendTCP::onClientDisconnected() qDebug() << "ClientDisconnected"; mySocket->deleteLater(); } +#endif #endif \ No newline at end of file diff --git a/Cigarette/Thread/threadSendTCP.h b/Cigarette/Thread/threadSendTCP.h index a51bd00c..8fd490bb 100644 --- a/Cigarette/Thread/threadSendTCP.h +++ b/Cigarette/Thread/threadSendTCP.h @@ -1,5 +1,7 @@ #pragma once #include "common.h" + +#ifdef __TCPSend #include #include #include @@ -70,3 +72,4 @@ public: QAbstractSocket::SocketState ClientStatus; #endif }; +#endif \ No newline at end of file diff --git a/Cigarette/Ui/dialogsetup.cpp b/Cigarette/Ui/dialogsetup.cpp index 34626ff8..0018b0a0 100644 --- a/Cigarette/Ui/dialogsetup.cpp +++ b/Cigarette/Ui/dialogsetup.cpp @@ -336,6 +336,7 @@ void DialogSetup::on_pushButton_close_released() void DialogSetup::on_pushButton_clear_pic_released() { +#ifdef CLEAR_THREAD QThread* handleThread = new QThread(); CleanWorkThread* cleanWorkThread = new CleanWorkThread(); @@ -347,6 +348,7 @@ void DialogSetup::on_pushButton_clear_pic_released() connect(cleanWorkThread, &CleanWorkThread::destroyed, handleThread, &QThread::quit); connect(handleThread, &QThread::finished, handleThread, &QThread::deleteLater); handleThread->start(); +#endif } void DialogSetup::on_toolButton_choose_config_path_released() {