diff --git a/Cigarette/alg_jd.cpp b/Cigarette/alg_jd.cpp index 7c0708f..e3d6a44 100644 --- a/Cigarette/alg_jd.cpp +++ b/Cigarette/alg_jd.cpp @@ -53,12 +53,6 @@ bool AlgJd::init(QString model_path, QString model_name) //cv::Mat image = cv::imread("alg_jd.bmp"); cv::Mat image = cv::imread(image_path.toStdString()); - /*if (g_sys_conf.model_jpg_path.length() > 0) { - image = cv::imread(g_sys_conf.model_jpg_path.toStdString()); - } - else { - image = cv::imread("D:/Release/alg_jd.bmp"); - }*/ //识别一张图,测试模型是否正确,并且完成GPU数据加载 if (!image.data) return false; //判断测试图片是否正常读取 diff --git a/Cigarette/cigarette.cpp b/Cigarette/cigarette.cpp index 9aa8df6..d41627d 100644 --- a/Cigarette/cigarette.cpp +++ b/Cigarette/cigarette.cpp @@ -120,12 +120,12 @@ Cigarette::Cigarette(QWidget* parent) if (!dirinfo->exists()) { // 如果文件夹信息不存在 delete dirinfo, dirinfo = nullptr; - g_conf_path.config_path = "D:/conf"; + g_conf_path.config_path = DEFAULT_CONFPATH_PATH; } delete dirinfo, dirinfo = nullptr; } else - g_conf_path.config_path = "D:/conf"; + g_conf_path.config_path = DEFAULT_CONFPATH_PATH; bool update_rotate = false; if (!read_rotate_message()) {//读取旋转参数 @@ -351,8 +351,8 @@ Cigarette::Cigarette(QWidget* parent) cam_status_mat[i]->setStyleSheet(tr("background-color: rgb(0, 170, 0);")); QString model_path, model_name; if (g_sys_conf.model_path.isEmpty()) { - model_path = "D:/model"; - g_sys_conf.model_path = "D:/model"; + model_path = DEFAULT_MODEL_PATH; + g_sys_conf.model_path = DEFAULT_MODEL_PATH; } else model_path = g_sys_conf.model_path; @@ -2114,7 +2114,7 @@ void Cigarette::on_pushButton_clear_released()//换班 QString Cigarette::read_pswd() { std::fstream cfg_file; - cfg_file.open("D:/Release/pswd.txt"); + cfg_file.open("pswd.txt"); if (!cfg_file.is_open()) { std::cout << "Error: Open config file pswd.txt" << std::endl; @@ -2146,7 +2146,7 @@ QString Cigarette::read_pswd() QString Cigarette::read_op_pswd() { std::fstream cfg_file; - cfg_file.open("D:/Release/pswd_op.txt"); + cfg_file.open("pswd_op.txt"); 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 82918fa..eae8fb7 100644 --- a/Cigarette/common.h +++ b/Cigarette/common.h @@ -36,9 +36,11 @@ #define DEBUG(format, ...) #endif +#define DEFAULT_MODEL_PATH "D:/model" +#define DEFAULT_CONFPATH_PATH "D:/conf" +#define DEFAULT_PIC_SAVE_PATH "D:/image" // 主界面基本参数配置文件 -#define CONFPATH "D:/Release/conf_path.txt" -//#define CONFIGURE_FILE "D:/conf/conf.txt" +#define CONFPATH "conf_path.txt" // 相机旋转角度配置文件 #define ROTATE_FILE "rotate.txt" #define MODBUS_CONFIGURE_FILE "modbus.txt" diff --git a/Cigarette/dialogsetup.cpp b/Cigarette/dialogsetup.cpp index bb21935..a952aef 100644 --- a/Cigarette/dialogsetup.cpp +++ b/Cigarette/dialogsetup.cpp @@ -62,7 +62,7 @@ DialogSetup::DialogSetup(QWidget* parent) : QDialog(parent) { if (!dirinfo->exists()) { // 如果文件夹信息不存在 delete dirinfo, dirinfo = nullptr; - g_conf_path.config_path = "D:/conf"; + g_conf_path.config_path = DEFAULT_CONFPATH_PATH; } dirinfo->setNameFilters(QStringList("conf.txt")); QStringList fileList = dirinfo->entryList(QDir::Files); @@ -72,7 +72,7 @@ DialogSetup::DialogSetup(QWidget* parent) : QDialog(parent) { } else { // 如果路径空 - g_conf_path.config_path = "D:/conf"; + g_conf_path.config_path = DEFAULT_CONFPATH_PATH; } ui.comboBox_config_path->addItem(g_conf_path.config_path); // 更换选择文件 @@ -119,7 +119,7 @@ DialogSetup::DialogSetup(QWidget* parent) : QDialog(parent) { delete dirinfo, dirinfo = nullptr; } else { - QString dirPath = "D:/image"; + QString dirPath = DEFAULT_PIC_SAVE_PATH; QDir* dirinfo = new QDir(dirPath); if (!dirinfo->exists()) delete dirinfo, dirinfo = nullptr; @@ -354,7 +354,7 @@ void DialogSetup::on_toolButton_choose_config_path_released() { if (dirName.isEmpty()) { // 点击取消按钮 if (g_conf_path.config_path.isEmpty()) - dirName = "D:/conf"; + dirName = DEFAULT_CONFPATH_PATH; else dirName = g_conf_path.config_path; } @@ -367,7 +367,7 @@ void DialogSetup::on_toolButton_choose_config_path_released() { QStringList fileList = dirinfo->entryList(QDir::Files); if (fileList.count() == 0) { - dirName = "D:/conf"; + dirName = DEFAULT_CONFPATH_PATH; } //fileList.removeOne("."); @@ -395,7 +395,7 @@ void DialogSetup::on_toolButton_choose_model_path_released() { if (dirName.isEmpty()) { if (g_sys_conf.model_path.isEmpty()) - dirName = "D:/model"; + dirName = DEFAULT_MODEL_PATH; else dirName = g_sys_conf.model_path; @@ -409,7 +409,7 @@ void DialogSetup::on_toolButton_choose_model_path_released() { dirinfo->setNameFilters(QStringList("*.weights")); QStringList fileList = dirinfo->entryList(QDir::Files); if (fileList.count() == 0) { - g_sys_conf.model_path = "D:/model"; + g_sys_conf.model_path = DEFAULT_MODEL_PATH; g_sys_conf.model_name = "jd.weights"; } else @@ -432,7 +432,7 @@ void DialogSetup::on_toolButton_choose_save_pics_path_released() { // 如果没有选择路径 if (dirName.isEmpty()) { if (g_conf_path.save_pics_path.isEmpty()) - dirName = "D:/image"; + dirName = DEFAULT_PIC_SAVE_PATH; else dirName = g_conf_path.save_pics_path; //ui.comboBox_save_pics_path->addItem(dirName); @@ -472,7 +472,7 @@ void DialogSetup::on_toolButton_choose_path_jpg_released() { void DialogSetup::write_pswd() { std::fstream cfg_file; - cfg_file.open("D:/Release/pswd.txt", std::ios::out | std::ios::trunc); + cfg_file.open("pswd.txt", std::ios::out | std::ios::trunc); if (cfg_file.good()) { char buf[256]; @@ -485,7 +485,7 @@ void DialogSetup::write_pswd() void DialogSetup::write_pswd_op() { std::fstream cfg_file; - cfg_file.open("D:/Release/pswd_op.txt", std::ios::out | std::ios::trunc); + cfg_file.open("pswd_op.txt", std::ios::out | std::ios::trunc); if (cfg_file.good()) { char buf[256]; diff --git a/Cigarette/main.cpp b/Cigarette/main.cpp index fd8d15f..941d4f6 100644 --- a/Cigarette/main.cpp +++ b/Cigarette/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) } #endif qRegisterMetaType("cv::Mat"); - QPixmap pixmap("D:/Release/splash.jpg"); + QPixmap pixmap("splash.jpg"); QSplashScreen splash(pixmap); splash.show(); a.processEvents();