|
|
|
@ -122,12 +122,12 @@ Cigarette::Cigarette(QWidget* parent)
|
|
|
|
|
if (!dirinfo->exists()) {
|
|
|
|
|
// 如果文件夹信息不存在
|
|
|
|
|
delete dirinfo, dirinfo = nullptr;
|
|
|
|
|
g_conf_path.config_path = QString::fromStdString(ROOTPATH_PREFIX + SLASH + CONFPATH);
|
|
|
|
|
g_conf_path.config_path = "D:/conf";
|
|
|
|
|
}
|
|
|
|
|
delete dirinfo, dirinfo = nullptr;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
g_conf_path.config_path = QString::fromStdString(ROOTPATH_PREFIX + SLASH + CONFPATH);
|
|
|
|
|
g_conf_path.config_path = "D:/conf";
|
|
|
|
|
|
|
|
|
|
bool update_rotate = false;
|
|
|
|
|
if (!read_rotate_message()) {
|
|
|
|
@ -247,11 +247,11 @@ Cigarette::Cigarette(QWidget* parent)
|
|
|
|
|
quantity_stop_count = 0;
|
|
|
|
|
g_seconds = 0;
|
|
|
|
|
|
|
|
|
|
QString config_path = g_conf_path.config_path + QString::fromStdString( SLASH + CONF_FILE);
|
|
|
|
|
QString config_path = g_conf_path.config_path + "/conf.txt";
|
|
|
|
|
read_sys_config(g_sys_conf, config_path); //初始化系统配置
|
|
|
|
|
|
|
|
|
|
if (g_sys_conf.model_path.isEmpty()) {
|
|
|
|
|
g_sys_conf.model_path = QString::fromStdString(ROOTPATH_PREFIX + SLASH + MODELPATH);
|
|
|
|
|
g_sys_conf.model_path = "D:/model";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_sys_conf.model_name.isEmpty()) {
|
|
|
|
@ -1061,12 +1061,12 @@ void Cigarette::OnKey(QKeyEvent* event)
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
char buf[256];
|
|
|
|
|
memset(buf, 0, 256);
|
|
|
|
|
sprintf(buf, SELECT_RECTS_FILE.c_str(), Num, Cnt);
|
|
|
|
|
sprintf(buf, SELECT_RECTS_FILE, Num, Cnt);
|
|
|
|
|
QString rects_file = g_conf_path.config_path + "/" + buf;
|
|
|
|
|
cfg_file.open(rects_file.toLocal8Bit().constData(), ios::trunc | ofstream::out);
|
|
|
|
|
if (!cfg_file.is_open())
|
|
|
|
|
{
|
|
|
|
|
std::cout << "Error: Open SelectRects file " << rects_file.toStdString() << std::endl;
|
|
|
|
|
std::cout << "Error: Open config file SelectRects.txt" << std::endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < g_display_label_conf[Num].RectVet[Cnt].size(); i++)
|
|
|
|
@ -1209,12 +1209,12 @@ void Cigarette::DrawRect_init(int Num_Cnt) {
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
char buf[256];
|
|
|
|
|
memset(buf, 0, 256);
|
|
|
|
|
sprintf(buf, SELECT_RECTS_FILE.c_str(), Num, Cnt);
|
|
|
|
|
sprintf(buf, SELECT_RECTS_FILE, Num, Cnt);
|
|
|
|
|
QString rects_file = g_conf_path.config_path + "/" + buf;
|
|
|
|
|
cfg_file.open(rects_file.toLocal8Bit().constData());
|
|
|
|
|
if (!cfg_file.is_open())
|
|
|
|
|
{
|
|
|
|
|
std::cout << "Error: Open SelectRects file" << rects_file.toStdString() << std::endl;
|
|
|
|
|
std::cout << "Error: Open config file SelectRects" << Num << Cnt << ".txt" << std::endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
while (!cfg_file.eof())
|
|
|
|
@ -1256,12 +1256,12 @@ void Cigarette::OnTPClickHub(int Num_Cnt)
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
char buf[256];
|
|
|
|
|
memset(buf, 0, 256);
|
|
|
|
|
sprintf(buf, SELECT_RECTS_FILE.c_str(), Num, Cnt);
|
|
|
|
|
sprintf(buf, SELECT_RECTS_FILE, Num, Cnt);
|
|
|
|
|
QString rects_file = g_conf_path.config_path + "/" + buf;
|
|
|
|
|
cfg_file.open(rects_file.toLocal8Bit().constData());
|
|
|
|
|
if (!cfg_file.is_open())
|
|
|
|
|
{
|
|
|
|
|
std::cout << "Error: Open SelectRects file " << rects_file.toStdString() << std::endl;
|
|
|
|
|
std::cout << "Error: Open config file SelectRects.txt" << std::endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
while (!cfg_file.eof())
|
|
|
|
@ -2112,11 +2112,10 @@ void Cigarette::on_pushButton_clear_released()//换班
|
|
|
|
|
QString Cigarette::read_pswd()
|
|
|
|
|
{
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
std::string pswd_path = ROOTPATH_PREFIX + SLASH + PSWD_FILE;
|
|
|
|
|
cfg_file.open(pswd_path.c_str());
|
|
|
|
|
cfg_file.open("D:/Release/pswd.txt");
|
|
|
|
|
if (!cfg_file.is_open())
|
|
|
|
|
{
|
|
|
|
|
std::cout << "Error: Open pswd file" << pswd_path <<std::endl;
|
|
|
|
|
std::cout << "Error: Open config file pswd.txt" << std::endl;
|
|
|
|
|
return "81dc9bdb52d04dc20036dbd8313ed055";
|
|
|
|
|
}
|
|
|
|
|
if (!cfg_file.eof())
|
|
|
|
@ -2145,11 +2144,10 @@ QString Cigarette::read_pswd()
|
|
|
|
|
QString Cigarette::read_op_pswd()
|
|
|
|
|
{
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
std::string pswd_op_path = ROOTPATH_PREFIX + SLASH + PSWD_OP_FILE;
|
|
|
|
|
cfg_file.open(pswd_op_path.c_str());
|
|
|
|
|
cfg_file.open("D:/Release/pswd_op.txt");
|
|
|
|
|
if (!cfg_file.is_open())
|
|
|
|
|
{
|
|
|
|
|
std::cout << "Error: Open pswd_op file" <<pswd_op_path<< std::endl;
|
|
|
|
|
std::cout << "Error: Open config file pswd_op.txt" << std::endl;
|
|
|
|
|
return "81dc9bdb52d04dc20036dbd8313ed055";
|
|
|
|
|
}
|
|
|
|
|
if (!cfg_file.eof())
|
|
|
|
@ -2176,10 +2174,9 @@ QString Cigarette::read_op_pswd()
|
|
|
|
|
|
|
|
|
|
bool Cigarette::read_conf(ConfPath& conf_path) {
|
|
|
|
|
std::fstream conf_file;
|
|
|
|
|
std::string conf_file_path = ROOTPATH_PREFIX + SLASH + CONFPATH + CONFPATH_FILE;
|
|
|
|
|
conf_file.open(conf_file_path);
|
|
|
|
|
conf_file.open(CONFPATH);
|
|
|
|
|
if (!conf_file.is_open()) {
|
|
|
|
|
std::cout << "Error: Open conf_path file " << conf_file_path << std::endl;
|
|
|
|
|
std::cout << "Error: Open conf path file " << CONFPATH << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
while (!conf_file.eof()) {
|
|
|
|
@ -2606,11 +2603,11 @@ bool Cigarette::read_modbus_config(ModbusConf& conf)
|
|
|
|
|
{
|
|
|
|
|
QString str_kick;
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
QString modbus_file = g_conf_path.config_path + "/" + QString::fromStdString(MODBUS_CONFIGURE_FILE);
|
|
|
|
|
QString modbus_file = g_conf_path.config_path + "/" + MODBUS_CONFIGURE_FILE;
|
|
|
|
|
cfg_file.open(modbus_file.toLocal8Bit().constData());
|
|
|
|
|
if (!cfg_file.is_open())
|
|
|
|
|
{
|
|
|
|
|
std::cout << "Error: Open modbus file" << modbus_file.toStdString() << std::endl;
|
|
|
|
|
std::cout << "Error: Open config file " << MODBUS_CONFIGURE_FILE << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
while (!cfg_file.eof())
|
|
|
|
@ -2665,11 +2662,11 @@ bool Cigarette::read_modbus_config(ModbusConf& conf)
|
|
|
|
|
bool Cigarette::read_rotate_message()
|
|
|
|
|
{
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
QString rotate_file = g_conf_path.config_path + "/" + QString::fromStdString(ROTATE_FILE);
|
|
|
|
|
QString rotate_file = g_conf_path.config_path + "/" + ROTATE_FILE;
|
|
|
|
|
cfg_file.open(rotate_file.toLocal8Bit().constData());
|
|
|
|
|
if (!cfg_file.is_open())
|
|
|
|
|
{
|
|
|
|
|
std::cout << "Error: Open config file rotate.txt" << ROTATE_FILE << std::endl;
|
|
|
|
|
std::cout << "Error: Open config file rotate.txt" << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!cfg_file.eof())
|
|
|
|
@ -2702,11 +2699,11 @@ bool Cigarette::read_rotate_message()
|
|
|
|
|
bool Cigarette::save_rotate_message()
|
|
|
|
|
{
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
QString rotate_file = g_conf_path.config_path + "/" + QString::fromStdString(ROTATE_FILE);
|
|
|
|
|
QString rotate_file = g_conf_path.config_path + "/" + ROTATE_FILE;
|
|
|
|
|
cfg_file.open(rotate_file.toLocal8Bit().constData(), ios::trunc | ofstream::out);
|
|
|
|
|
if (!cfg_file.is_open())
|
|
|
|
|
{
|
|
|
|
|
std::cout << "Error: Open config file rotate.txt" << ROTATE_FILE << std::endl;
|
|
|
|
|
std::cout << "Error: Open config file rotate.txt" << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < NumberOfSupportedCameras; i++) {
|
|
|
|
@ -2785,7 +2782,7 @@ QImage Cigarette::cvMatToQImage(const cv::Mat& mat)
|
|
|
|
|
void Cigarette::read_plc_items()
|
|
|
|
|
{
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
QString plc_file = g_conf_path.config_path + "/" + QString::fromStdString(PLC_CONFIG_FILE);
|
|
|
|
|
QString plc_file = g_conf_path.config_path + "/" + PLC_CONFIG_FILE;
|
|
|
|
|
cfg_file.open(plc_file.toLocal8Bit().constData());
|
|
|
|
|
|
|
|
|
|
if (!cfg_file.is_open())
|
|
|
|
@ -3703,7 +3700,7 @@ void Cigarette::record_output_statistic(qint64 quantity, int Kick[NumberOfSuppor
|
|
|
|
|
{
|
|
|
|
|
if (SingleCamInfo[i].IsOpen && quantity > 0) {
|
|
|
|
|
std::fstream cfg_file;
|
|
|
|
|
file_name = QString::fromStdString(STATISTIC_FILE).arg(i);
|
|
|
|
|
file_name = QString(STATISTIC_FILE).arg(i);
|
|
|
|
|
file_path = g_conf_path.config_path + "/" + file_name;
|
|
|
|
|
|
|
|
|
|
char buf[256];
|
|
|
|
|