Commit 93f1fd44 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

fixed filter update in historical view

parent 22010b9d
......@@ -10,8 +10,6 @@ DEFINES -= QT_NO_DEBUG_OUTPUT
TEMPLATE = app
CONFIG += warn_on debug qt app_bundle
QT += sql
QT += multimedia
......
......@@ -110,9 +110,6 @@ void AlarmTreeWidget::refresh(const CuData &v) {
if(!item) /* create a new item */ {
index = findPos(fields[0].toUInt(), fields[AlarmTreeWidgetItem::Level], fields[AlarmTreeWidgetItem::Status]);
m_insert_item(src, fields, index);
// printf("\e[1;33m%s \e[1;34m%s - number of tabs %d -- index %d\e[0m\n",
// qstoc(QDateTime::fromTime_t(fields.first().toUInt()).toString()),
// qstoc(data[i]), data[i].count("\t"), index);
}
else /* update fields of existing items */
item->update(fields);
......@@ -124,6 +121,7 @@ void AlarmTreeWidget::refresh(const CuData &v) {
alsrcset.insert(alanam); // alsrcset is a reference
// notify new alarm detected. connected to Alarm::beep
qDebug() << __PRETTY_FUNCTION__ << fields;
if(fields.size() > 5 && (fields[3] == "ALARM" || fields[3] == "ERROR") && fields.last() == "NEW")
emit newAlarmDetected();
}
......@@ -138,7 +136,7 @@ int AlarmTreeWidget::findPos(time_t ts, const QString &pri, const QString& statu
int i = 0, prio = m_pri_to_int(pri), stat = m_status_to_int(status);
// printf("findPos called with ts %ld, pri %d\n", ts, prio);
while(i < topLevelItemCount() && topLevelItem(i)->data(AlarmTreeWidgetItem::Status, Qt::UserRole).toInt() > stat) {
// printf("1st pri %d pri %d --> i %d\n", prio, topLevelItem(i)->data(AlarmTreeWidgetItem::Level, Qt::UserRole).toInt(), i);
// printf("1st pri %d pri %d --> i %d\nok cont", prio, topLevelItem(i)->data(AlarmTreeWidgetItem::Level, Qt::UserRole).toInt(), i);
i++;
}
......@@ -175,15 +173,12 @@ int AlarmTreeWidget::countAlarmed() const {
void AlarmTreeWidget::contextMenuEvent(QContextMenuEvent *e)
{
bool silenceAvail = true;
bool enable = true;
QList<QTreeWidgetItem *>items = this->selectedItems();
foreach(QTreeWidgetItem *it, items)
{
foreach(QTreeWidgetItem *it, items) {
int sil = it->text(AlarmTreeWidgetItem::SilencedMin).toInt();
if(sil < 0)
{
silenceAvail = false;
break;
}
silenceAvail &= (sil == 0);
enable &= (sil > 0);
}
if(items.size()) {
QMenu *menu = new QMenu(this);
......@@ -199,7 +194,7 @@ void AlarmTreeWidget::contextMenuEvent(QContextMenuEvent *e)
}
// enable
if(m_type == AlarmType)
if(m_type == AlarmType && enable)
menu->addAction("Enable", this, SIGNAL(enable()));
menu->exec(QCursor::pos());
......
......@@ -23,6 +23,7 @@ Sound::~Sound()
void Sound::play()
{
if(mSound->isFinished())
mSound->play();
}
......
......@@ -227,6 +227,7 @@ void Alarm::silence()
{
Acmd acmd;
acmd.silence(ui->treeWidgetAlarms, false, cu_pool, m_ctrl_factory_pool);
sound->stop();
}
void Alarm::enable() {
......
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