mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
refact. SubProc превр. в класс. fix bug canplay
This commit is contained in:
@@ -71,15 +71,29 @@ bool DocsUpdater::updateDocsXML()
|
||||
return false;
|
||||
}
|
||||
|
||||
for(QList<SubProc> listSP : listSubProcMap)
|
||||
//Проставляем canplay
|
||||
for (auto it = listSubProcMap.begin(); it != listSubProcMap.end(); ++it)
|
||||
{
|
||||
for(SubProc sp : listSP)
|
||||
QList<SubProc> listSP = it.value();
|
||||
QString keyToReplace = it.key();
|
||||
|
||||
if(listSP.count())
|
||||
{
|
||||
QString dmCode = sp.dmCode;
|
||||
DM* module = getDMmoduleByDMcode(dmCode);
|
||||
if(module)
|
||||
for(int i = 0; i < listSP.count(); i++)
|
||||
{
|
||||
sp.modeList = module->getModeList();
|
||||
QString dmCode = listSP.at(i).getDmCode();
|
||||
DM* module = getDMmoduleByDMcode(dmCode);
|
||||
if(module)
|
||||
{
|
||||
SubProc sp = listSP.at(i);
|
||||
sp.setModeList(module->getModeList());
|
||||
listSP.replace(i, sp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!keyToReplace.isEmpty())
|
||||
{
|
||||
listSubProcMap[keyToReplace] = listSP;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,14 +201,14 @@ void DocsUpdater::domElementParserAMM(QDomElement element, Module* moduleParent)
|
||||
QList<SubProc> listSubProc;
|
||||
if(processingScenXML(dmCode, canplay, listSubProc))
|
||||
{
|
||||
DMmodulParent->setModeList(parseCanplay(canplay));
|
||||
DMmodulParent->setModeList(SubProc::parseCanplay(canplay));
|
||||
nodeMap.namedItem("canplay").setNodeValue(canplay);
|
||||
|
||||
listSubProcMap.insert(dmCode, listSubProc);
|
||||
}
|
||||
else
|
||||
{
|
||||
DMmodulParent->setModeList(parseCanplay(canplay));
|
||||
DMmodulParent->setModeList(SubProc::parseCanplay(canplay));
|
||||
nodeMap.namedItem("canplay").setNodeValue(canplay);
|
||||
}
|
||||
}
|
||||
@@ -242,51 +256,6 @@ void DocsUpdater::deleteAllModulsAMM()
|
||||
listAllModulesAMM.clear();
|
||||
}
|
||||
|
||||
ModeList DocsUpdater::parseCanplay(QString canplay)
|
||||
{
|
||||
ModeList modeList;
|
||||
|
||||
if(canplay == "")
|
||||
{
|
||||
modeList.demo = false;
|
||||
modeList.train = false;
|
||||
modeList.exam = false;
|
||||
modeList.autoM = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
QStringList list = canplay.split("/");
|
||||
|
||||
if(list.at(0) == "+")
|
||||
modeList.demo = true;
|
||||
else
|
||||
modeList.demo = false;
|
||||
|
||||
if(list.at(1) == "+")
|
||||
modeList.train = true;
|
||||
else
|
||||
modeList.train = false;
|
||||
|
||||
if(list.at(2) == "+")
|
||||
modeList.exam = true;
|
||||
else
|
||||
modeList.exam = false;
|
||||
|
||||
if(list.at(3) == "+")
|
||||
modeList.autoM = true;
|
||||
else
|
||||
modeList.autoM = false;
|
||||
}
|
||||
|
||||
return modeList;
|
||||
}
|
||||
|
||||
QString DocsUpdater::buildCanplay(ModeList modeList)
|
||||
{
|
||||
QString canplay = QString("%1/%2/%3/%4").arg(modeList.demo?"+":"-", modeList.train?"+":"-", modeList.exam?"+":"-", modeList.autoM?"+":"-");
|
||||
return canplay;
|
||||
}
|
||||
|
||||
bool DocsUpdater::processingScenXML(const QString dmCode, QString &canplay, QList<SubProc> &listSubProc)
|
||||
{
|
||||
listSubProc.clear();
|
||||
@@ -384,8 +353,8 @@ void DocsUpdater::selectSubProc(QDomElement &modeElement, QList<SubProc> &listSu
|
||||
if(!subProcElement.isNull())
|
||||
{
|
||||
SubProc subProc;
|
||||
subProc.dmCode = subProcElement.toElement().attribute("dmCode");
|
||||
subProc.title = subProcElement.toElement().attribute("title");
|
||||
subProc.setDmCode(subProcElement.toElement().attribute("dmCode"));
|
||||
subProc.setTitle(subProcElement.toElement().attribute("title"));
|
||||
|
||||
listSubProc.append(subProc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user