Skip to content

Commit

Permalink
支持一次运行多种源
Browse files Browse the repository at this point in the history
  • Loading branch information
JackeyLea committed Nov 1, 2024
1 parent 2647c21 commit 77825ff
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions MindViewer/dataparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,45 @@ void DataParser::setSource(DataSourceType type)
case None:
break;
case COM:
m_comRetriver = new Retriver(NULL);
if(!m_comRetriver){
m_comRetriver = new Retriver(NULL);
}
m_comRetriver->showWgt();
connect(m_comRetriver,&Retriver::sigNewPkg,this,&DataParser::sltRcvData);
//清理之前状态
if(m_sim){
m_sim->disconnect();
}
if(m_lf){
m_lf->disconnect();
}
break;
case Sim:
m_sim = new Simulator();
if(!m_sim){
m_sim = new Simulator();
}
connect(m_sim,&Simulator::sigNewPkg,this,&DataParser::sltRcvData);
//清理之前状态
if(m_lf){
m_lf->disconnect();
}
if(m_comRetriver){
m_comRetriver->disconnect();
}
break;
case Local:
m_lf = new LocalFile(m_filePath);
if(!m_lf){
m_lf = new LocalFile(m_filePath);
}
connect(m_lf,&LocalFile::sigNewPkg,this,&DataParser::sltRcvData);
m_lf->fileParse();
//清理之前状态
if(m_sim){
m_sim->disconnect();
}
if(m_comRetriver){
m_comRetriver->disconnect();
}
break;
}
}
Expand Down

0 comments on commit 77825ff

Please sign in to comment.