QString filePath = QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir()) + QString("../../data/model/alarm_color_define.xml");
QDomDocument document;
QFile file(filePath);
if (!file.open(QIODevice::ReadOnly))
{
LOGINFO("loadColorConfig Failed!");
return;
}
if (!document.setContent(&file))
{
file.close();
return;
}
file.close();
bool isFlash = false;
QDomElement element = document.documentElement();
QDomNode node = element.firstChild();
while(!node.isNull())
{
QDomElement attr = node.toElement();
if(!attr.isNull())
{
if(QString("Flash") == attr.tagName())
{
isFlash = (bool)attr.attribute("alternate").toInt();
}
else if(QString("Level") == attr.tagName())
{
int priority = attr.attribute("priority").toInt();
m_backgroundMap[priority] = QColor(attr.attribute("background_color"));
m_alternatingMap[priority] = QColor(attr.attribute("alternating_color"));
m_confirmMap[priority] = QColor(attr.attribute("confirm_color"));
m_activeTextMap[priority] = QColor(attr.attribute("active_text_color"));
m_confirmTextMap[priority] = QColor(attr.attribute("confirm_text_color"));
}
else if(QString("Select") == attr.tagName())
{
m_selectBackgroundColor = QColor(attr.attribute("background_color"));
m_selectTextColor = QColor(attr.attribute("text_color"));
}
else if(QString("NoItem") == attr.tagName())
{
m_emptyBackgroundColor = QColor(attr.attribute("background_color"));
m_emptyTipColor = QColor(attr.attribute("tips_color"));
m_emptyTip = tr("当前无报警!");
}
}
node = node.nextSibling();
}