Commit 767a4b2b authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

simplified fqdn in view

parent 213d3ab4
...@@ -307,7 +307,13 @@ void AlarmTreeWidget::m_insert_item(const QString& src, const QStringList &list, ...@@ -307,7 +307,13 @@ void AlarmTreeWidget::m_insert_item(const QString& src, const QStringList &list,
item->setData(AlarmTreeWidgetItem::DateTime, Qt::UserRole, list.at(AlarmTreeWidgetItem::DateTime).toUInt()); item->setData(AlarmTreeWidgetItem::DateTime, Qt::UserRole, list.at(AlarmTreeWidgetItem::DateTime).toUInt());
item->setData(AlarmTreeWidgetItem::Status, Qt::UserRole, m_status_to_int(list.at(AlarmTreeWidgetItem::Status))); item->setData(AlarmTreeWidgetItem::Status, Qt::UserRole, m_status_to_int(list.at(AlarmTreeWidgetItem::Status)));
QString s = src.section('/', 0, src.count('/') - 1); QString s = src.section('/', 0, src.count('/') - 1);
QRegularExpression re("[tango://]*(.*):\\d+/(.*)");
QRegularExpressionMatch ma = re.match(s);
if(ma.capturedTexts().size() > 2) {
s = "[" + ma.capturedTexts().at(1).section('.', 0, 0) + "] " + ma.capturedTexts()[2];
}
item->setData(AlarmTreeWidgetItem::Device, Qt::UserRole, src.section('/', 0, src.count('/') - 1)); item->setData(AlarmTreeWidgetItem::Device, Qt::UserRole, src.section('/', 0, src.count('/') - 1));
item->setText(AlarmTreeWidgetItem::Device, s);
insertTopLevelItem(index, item); insertTopLevelItem(index, item);
item->setNew(isNew); item->setNew(isNew);
} }
......
...@@ -81,6 +81,12 @@ void AlarmTreeWidgetItem::update(const QStringList &fields) ...@@ -81,6 +81,12 @@ void AlarmTreeWidgetItem::update(const QStringList &fields)
{ {
bool ok; bool ok;
QString field = fields.at(i); QString field = fields.at(i);
if(i == AlarmTreeWidgetItem::Device) {QRegularExpression re("[tango://]*(.*):\\d+/(.*)");
QRegularExpressionMatch ma = re.match(field);
if(ma.capturedTexts().size() > 2) {
field = "[" + ma.capturedTexts().at(1).section('.', 0, 0) + "] " + ma.capturedTexts()[2];
}
}
if(i == 0 && field.toUInt(&ok) && ok) if(i == 0 && field.toUInt(&ok) && ok)
field = QDateTime::fromTime_t(field.toUInt()).toString(); field = QDateTime::fromTime_t(field.toUInt()).toString();
if(text(i) != field) if(text(i) != field)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment