Commit 65295324 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

support for server down

parent 223c6aa6
......@@ -147,22 +147,22 @@ void AlarmTreeWidget::refresh(const CuData &v) {
double d = static_cast<int>(v["timestamp_us"].toDouble());
QString ts = QDateTime::fromSecsSinceEpoch(d).toString("HH:mm:ss");
ts += QString("+%1").arg(d - static_cast<int>(d));
const QuString src(v, "src");
QuString src(v, "src");
bool err = v["err"].toBool();
QStringList data = QuStringList(v, "value");
setToolTip(QuString(v, "msg"));
/* remove the filter */
if (err) {
setDisabled(true);
src = QuString(v, "device");
data = m_gen_error_item(v);
perr("%s: %s\n", qstoc(src), qstoc(toolTip()));
}
else {
setDisabled(false);
int scrollBarPos;
QStringList fields;
QStringList alrnames;
AlarmTreeWidgetItem* item = NULL;
QStringList data = QuStringList(v, "value");
data = QuStringList(v, "value");
QStringList high, medium, low, lowest, unknown_level;
// group by level in order to sort view
foreach(QString row, data) {
......@@ -306,6 +306,13 @@ void AlarmTreeWidget::m_insert_item(const QString& src, const QStringList &list,
mItemHash.insert(fields.at(AlarmTreeWidgetItem::Alarm), item);
}
QStringList AlarmTreeWidget::m_gen_error_item(const CuData &da) const {
QStringList l;
QDateTime dt = QDateTime::currentDateTime();
l << dt.toString() << "-" << QuString(da, "device") << "ERROR" << "NACK" << "1" << "high" << "-1" << "gr_handler" << QuString(da, "msg");
return l;
}
void AlarmTreeWidget::m_remove_stale_items(const QSet<QString> stale_names) {
foreach(const QString& name, stale_names) {
......
......@@ -49,6 +49,7 @@ private:
int m_status_to_int(const QString& stat);
void m_remove_stale_items(const QSet<QString> stale_names);
void m_insert_item(const QString &src, const QStringList &list, int index);
QStringList m_gen_error_item(const CuData& da) const;
bool _filter_enabled;
QHash<QString, AlarmTreeWidgetItem*> mItemHash;
......
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