增加define来控制调试时候的文件路径

CigaretteSH
Jinhuan 8 months ago
parent 1f0d18b37c
commit 7583d17f52

@ -27,11 +27,19 @@ bool AlgJd::init(QString model_path, QString model_name)
image_path = model_path + "/" + "alg_jd.jpg"; image_path = model_path + "/" + "alg_jd.jpg";
} }
else { 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"; modelWeights = "D:/model/jd.weights";
classesFile = "D:/model/jd.names"; classesFile = "D:/model/jd.names";
// Give the configuration and weight files for the model // Give the configuration and weight files for the model
modelConfiguration = "D:/model/jd.cfg"; modelConfiguration = "D:/model/jd.cfg";
image_path = "D:/model/alg_jd.jpg"; image_path = "D:/model/alg_jd.jpg";
#endif
} }
std::ifstream classNamesFile(classesFile.c_str()); std::ifstream classNamesFile(classesFile.c_str());

@ -2121,7 +2121,11 @@ void Cigarette::on_pushButton_clear_released()//换班
QString Cigarette::read_pswd() QString Cigarette::read_pswd()
{ {
std::fstream cfg_file; std::fstream cfg_file;
#ifdef __DEBUGPATH
cfg_file.open("pswd.txt");
#else
cfg_file.open("D:/Release/pswd.txt"); cfg_file.open("D:/Release/pswd.txt");
#endif
if (!cfg_file.is_open()) if (!cfg_file.is_open())
{ {
std::cout << "Error: Open config file pswd.txt" << std::endl; std::cout << "Error: Open config file pswd.txt" << std::endl;
@ -2153,7 +2157,11 @@ QString Cigarette::read_pswd()
QString Cigarette::read_op_pswd() QString Cigarette::read_op_pswd()
{ {
std::fstream cfg_file; std::fstream cfg_file;
#ifdef __DEBUGPATH
cfg_file.open("pswd_op.txt");
#else
cfg_file.open("D:/Release/pswd_op.txt"); cfg_file.open("D:/Release/pswd_op.txt");
#endif
if (!cfg_file.is_open()) if (!cfg_file.is_open())
{ {
std::cout << "Error: Open config file pswd_op.txt" << std::endl; std::cout << "Error: Open config file pswd_op.txt" << std::endl;

@ -5,6 +5,7 @@
#include "basecamera.h" #include "basecamera.h"
#include "QtCore\qdatetime.h" #include "QtCore\qdatetime.h"
//#define __DEBUGPATH //修改debug时候的路径
//#define __DEBUG //debug信息输出功能 //#define __DEBUG //debug信息输出功能
//#define __UDPSend //网络发送功能 //#define __UDPSend //网络发送功能
#define __TCPSend // TCP发送 #define __TCPSend // TCP发送

@ -472,7 +472,11 @@ void DialogSetup::on_toolButton_choose_path_jpg_released() {
void DialogSetup::write_pswd() void DialogSetup::write_pswd()
{ {
std::fstream cfg_file; 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); cfg_file.open("D:/Release/pswd.txt", std::ios::out | std::ios::trunc);
#endif
if (cfg_file.good()) if (cfg_file.good())
{ {
char buf[256]; char buf[256];
@ -485,7 +489,11 @@ void DialogSetup::write_pswd()
void DialogSetup::write_pswd_op() void DialogSetup::write_pswd_op()
{ {
std::fstream cfg_file; 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); cfg_file.open("D:/Release/pswd_op.txt", std::ios::out | std::ios::trunc);
#endif
if (cfg_file.good()) if (cfg_file.good())
{ {
char buf[256]; char buf[256];

@ -20,7 +20,11 @@ int main(int argc, char* argv[])
#endif #endif
qRegisterMetaType<cv::Mat>("cv::Mat"); qRegisterMetaType<cv::Mat>("cv::Mat");
QApplication a(argc, argv); QApplication a(argc, argv);
#ifdef __DEBUGPATH
QPixmap pixmap("splash.jpg");
#else
QPixmap pixmap("D:/Release/splash.jpg"); QPixmap pixmap("D:/Release/splash.jpg");
#endif
QSplashScreen splash(pixmap); QSplashScreen splash(pixmap);
splash.show(); splash.show();
a.processEvents(); a.processEvents();

Loading…
Cancel
Save