在不影响运行的情况下,去掉一些文件的绝对路径方便调试

CigaretteSH
Jinhuan 9 months ago
parent 2284ed6032
commit 8b3bacc136

@ -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; //判断测试图片是否正常读取

@ -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;

@ -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"

@ -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];

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

Loading…
Cancel
Save