From 7583d17f5227df58535e9153d11fb183a690e4c5 Mon Sep 17 00:00:00 2001 From: Jinhuan <412100639@qq.com> Date: Wed, 8 May 2024 23:56:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0define=E6=9D=A5=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E8=B0=83=E8=AF=95=E6=97=B6=E5=80=99=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cigarette/alg_jd.cpp | 8 ++++++++ Cigarette/cigarette.cpp | 8 ++++++++ Cigarette/common.h | 1 + Cigarette/dialogsetup.cpp | 8 ++++++++ Cigarette/main.cpp | 4 ++++ 5 files changed, 29 insertions(+) diff --git a/Cigarette/alg_jd.cpp b/Cigarette/alg_jd.cpp index 1495636..1fd8201 100644 --- a/Cigarette/alg_jd.cpp +++ b/Cigarette/alg_jd.cpp @@ -27,11 +27,19 @@ bool AlgJd::init(QString model_path, QString model_name) image_path = model_path + "/" + "alg_jd.jpg"; } else { +#ifdef __DEBUGPATH + modelWeights = "../model/jd.weights"; + classesFile = "../model/jd.names"; + // Give the configuration and weight files for the model + modelConfiguration = "../model/jd.cfg"; + image_path = "alg_jd.jpg"; +#else modelWeights = "D:/model/jd.weights"; classesFile = "D:/model/jd.names"; // Give the configuration and weight files for the model modelConfiguration = "D:/model/jd.cfg"; image_path = "D:/model/alg_jd.jpg"; +#endif } std::ifstream classNamesFile(classesFile.c_str()); diff --git a/Cigarette/cigarette.cpp b/Cigarette/cigarette.cpp index d8ae7e7..64d7789 100644 --- a/Cigarette/cigarette.cpp +++ b/Cigarette/cigarette.cpp @@ -2121,7 +2121,11 @@ void Cigarette::on_pushButton_clear_released()//换班 QString Cigarette::read_pswd() { std::fstream cfg_file; +#ifdef __DEBUGPATH + cfg_file.open("pswd.txt"); +#else cfg_file.open("D:/Release/pswd.txt"); +#endif if (!cfg_file.is_open()) { std::cout << "Error: Open config file pswd.txt" << std::endl; @@ -2153,7 +2157,11 @@ QString Cigarette::read_pswd() QString Cigarette::read_op_pswd() { std::fstream cfg_file; +#ifdef __DEBUGPATH + cfg_file.open("pswd_op.txt"); +#else cfg_file.open("D:/Release/pswd_op.txt"); +#endif if (!cfg_file.is_open()) { std::cout << "Error: Open config file pswd_op.txt" << std::endl; diff --git a/Cigarette/common.h b/Cigarette/common.h index a7f2a2d..7d67902 100644 --- a/Cigarette/common.h +++ b/Cigarette/common.h @@ -5,6 +5,7 @@ #include "basecamera.h" #include "QtCore\qdatetime.h" +//#define __DEBUGPATH //修改debug时候的路径 //#define __DEBUG //debug信息输出功能 //#define __UDPSend //网络发送功能 #define __TCPSend // TCP发送 diff --git a/Cigarette/dialogsetup.cpp b/Cigarette/dialogsetup.cpp index 628747a..3f5a7f8 100644 --- a/Cigarette/dialogsetup.cpp +++ b/Cigarette/dialogsetup.cpp @@ -472,7 +472,11 @@ void DialogSetup::on_toolButton_choose_path_jpg_released() { void DialogSetup::write_pswd() { std::fstream cfg_file; +#ifdef __DEBUGPATH + cfg_file.open("pswd.txt", std::ios::out | std::ios::trunc); +#else cfg_file.open("D:/Release/pswd.txt", std::ios::out | std::ios::trunc); +#endif if (cfg_file.good()) { char buf[256]; @@ -485,7 +489,11 @@ void DialogSetup::write_pswd() void DialogSetup::write_pswd_op() { std::fstream cfg_file; +#ifdef __DEBUGPATH + cfg_file.open("pswd_op.txt", std::ios::out | std::ios::trunc); +#else cfg_file.open("D:/Release/pswd_op.txt", std::ios::out | std::ios::trunc); +#endif if (cfg_file.good()) { char buf[256]; diff --git a/Cigarette/main.cpp b/Cigarette/main.cpp index 5bb63aa..6956ef6 100644 --- a/Cigarette/main.cpp +++ b/Cigarette/main.cpp @@ -20,7 +20,11 @@ int main(int argc, char* argv[]) #endif qRegisterMetaType("cv::Mat"); QApplication a(argc, argv); +#ifdef __DEBUGPATH + QPixmap pixmap("splash.jpg"); +#else QPixmap pixmap("D:/Release/splash.jpg"); +#endif QSplashScreen splash(pixmap); splash.show(); a.processEvents();