Commit 22010b9d authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

fixed filter update in historical view

parent 0a3a03ee
......@@ -197,6 +197,11 @@ void AlarmTreeWidget::contextMenuEvent(QContextMenuEvent *e)
wikiAction->setProperty("url", it->text(MESSAGE).split(" ").last());
connect(wikiAction, SIGNAL(triggered()), this, SLOT(openUrl()));
}
// enable
if(m_type == AlarmType)
menu->addAction("Enable", this, SIGNAL(enable()));
menu->exec(QCursor::pos());
delete menu;
}
......
......@@ -38,6 +38,7 @@ signals:
void mouseOverItem(bool);
void silence();
void ack();
void enable();
protected:
void mouseMoveEvent(QMouseEvent *event);
......
......@@ -40,6 +40,18 @@ void Acmd::silence(const QTreeWidget *tw, bool all, CumbiaPool *cup, const CuCon
}
}
void Acmd::enable(const QTreeWidget *tw, CumbiaPool *cup, const CuControlsFactoryPool &fpoo) {
QMultiMap<QString, QString> map = m_getDevAlarmMap(tw, false);
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 + "->Enable");
printf("AckCmd.ack: executing %s (%s)\n", qstoc(w->target()), qstoc(alarms.join(",")));
w->execute(alarms);
}
}
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()) {
......
......@@ -14,7 +14,7 @@ public:
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);
void enable(const QTreeWidget *tw, CumbiaPool *cup, const CuControlsFactoryPool &fpoo);
private:
QMultiMap<QString, QString> m_getDevAlarmMap(const QTreeWidget *tw, bool all) const;
};
......
......@@ -69,6 +69,9 @@ Alarm::Alarm(CumbiaPool *cu_p, QWidget *parent) : QWidget(parent)
connect(ui->treeWidgetAlarms, SIGNAL(silence()), this, SLOT(stopSound()));
/* ack. Also uses QTWriter to impart StopNew command */
connect(ui->treeWidgetAlarms, SIGNAL(ack()), this, SLOT(ack()));
/* enable */
connect(ui->treeWidgetAlarms, SIGNAL(enable()), this, SLOT(enable()));
connect(ui->pBStopSound, SIGNAL(clicked()), this, SLOT(stopSound()));
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
......@@ -226,6 +229,11 @@ void Alarm::silence()
acmd.silence(ui->treeWidgetAlarms, false, cu_pool, m_ctrl_factory_pool);
}
void Alarm::enable() {
Acmd acmd;
acmd.enable(ui->treeWidgetAlarms, cu_pool, m_ctrl_factory_pool);
}
void Alarm::testSound() {
sound->play();
}
......
......@@ -63,6 +63,7 @@ protected slots:
void ack();
void ackAll();
void silence();
void enable();
void stopSound();
void testSound();
void tabChanged(int);
......
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