Commit 223c6aa6 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files
parent 19e4e284
......@@ -211,7 +211,7 @@ void AlarmTreeWidget::refresh(const CuData &v) {
alsrcset.insert(fields.at(AlarmTreeWidgetItem::Alarm));
// notify new alarm detected. connected to Alarm::beep
if(fields.size() > 5 && fields[3] == "ALARM" && fields.last() == "NEW")
if(fields.size() > 5 && (fields[3] == "ALARM" || fields[3] == "ERROR") && fields.last() == "NEW")
emit newAlarmDetected();
}
......@@ -327,6 +327,8 @@ int AlarmTreeWidget::m_pri_to_int(const QString &pri) const {
int AlarmTreeWidget::m_status_to_int(const QString &stat) {
if(stat == "ALARM")
return 100;
else if(stat == "ERROR")
return 80;
return 50;
}
......
......@@ -40,6 +40,18 @@ void Acmd::silence(const QTreeWidget *tw, bool all, CumbiaPool *cup, const CuCon
}
}
void Acmd::stop_new(const QTreeWidget *tw, bool all, CumbiaPool *cup, const CuControlsFactoryPool &fpoo) {
QMultiMap<QString, QString> map = m_getDevAlarmMap(tw, all);
foreach(const QString& dev, map.uniqueKeys()) {
QuWriter *w = new QuWriter(nullptr, cup, fpoo);
const QStringList &alarms = map.values(dev);
w->setAutoDestroy(true);
w->setTarget(dev + "->StopNew");
printf("AckCmd.stop_new: executing %s\n", qstoc(w->target()));
w->execute(alarms);
}
}
QMultiMap<QString, QString> Acmd::m_getDevAlarmMap(const QTreeWidget *tw, bool all) const {
QMultiMap<QString, QString> map;
QList<QTreeWidgetItem *> selected;
......
......@@ -13,6 +13,7 @@ public:
Acmd();
void ack(const QTreeWidget *tw, bool all, CumbiaPool *cup, const CuControlsFactoryPool &fpoo);
void silence(const QTreeWidget *tw, bool all, CumbiaPool *cup, const CuControlsFactoryPool &fpoo);
void stop_new(const QTreeWidget *tw, bool all, CumbiaPool *cup, const CuControlsFactoryPool &fpoo);
private:
QMultiMap<QString, QString> m_getDevAlarmMap(const QTreeWidget *tw, bool all) const;
......
......@@ -193,6 +193,8 @@ void Alarm::beep() {
}
void Alarm::stopSound() {
Acmd acmd;
acmd.stop_new(ui->treeWidgetAlarms, true, cu_pool, m_ctrl_factory_pool);
sound->stop();
}
......
......@@ -13,6 +13,7 @@ AlarmInfoW::AlarmInfoW(QWidget *parent, CumbiaPool *cu_pool, const CuControlsFac
iw->setObjectName("alarm_info_watcher");
connect(iw, SIGNAL(newData(CuData)), this, SLOT(update(CuData)));
QStandardItemModel *m = new QStandardItemModel(this);
setHeaderHidden(true);
setModel(m);
}
......@@ -25,8 +26,10 @@ void AlarmInfoW::update(const CuData &da) {
if(!da["err"].toBool()) {
QuStringList l(da["value"]);
foreach(QString s, l) {
QList<QStandardItem *> il = QList<QStandardItem *>() << new QStandardItem(s.section('=', 0, 0)) << new QStandardItem(s.section('=', 1, 1));
m->appendRow(il);
QStandardItem *si1 = new QStandardItem(s.section('=', 0, 0));
QStandardItem *si2 = new QStandardItem(s.section('=', 1));
si2->setToolTip(si2->text());
m->appendRow(QList<QStandardItem *>() << si1 << si2);
}
}/*
#if CUMBIA_VERSION < 0x010203
......
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