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:
@@ -37,3 +37,91 @@ void MalfunctionSign::initialize(int type, QString description)
|
||||
this->type = type;
|
||||
this->description = description;
|
||||
}
|
||||
|
||||
|
||||
QString SubProc::getDmCode() const
|
||||
{
|
||||
return dmCode;
|
||||
}
|
||||
|
||||
QString SubProc::getTitle() const
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
void SubProc::setDmCode(const QString &value)
|
||||
{
|
||||
dmCode = value;
|
||||
}
|
||||
|
||||
void SubProc::setTitle(const QString &value)
|
||||
{
|
||||
title = value;
|
||||
}
|
||||
|
||||
QString SubProc::getModeListStr() const
|
||||
{
|
||||
return modeListStr;
|
||||
}
|
||||
|
||||
ModeList SubProc::getModeList() const
|
||||
{
|
||||
return modeList;
|
||||
}
|
||||
|
||||
void SubProc::setModeList(const ModeList &value)
|
||||
{
|
||||
this->modeList = value;
|
||||
this->modeListStr = buildCanplay(value);
|
||||
}
|
||||
|
||||
void SubProc::setModeListStr(const QString &value)
|
||||
{
|
||||
this->modeListStr = value;
|
||||
this->modeList = parseCanplay(value);
|
||||
}
|
||||
|
||||
QString SubProc::buildCanplay(ModeList modeList)
|
||||
{
|
||||
QString canplay = QString("%1/%2/%3/%4").arg(modeList.demo?"+":"-", modeList.train?"+":"-", modeList.exam?"+":"-", modeList.autoM?"+":"-");
|
||||
return canplay;
|
||||
}
|
||||
|
||||
ModeList SubProc::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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user