Commit 2bd703f8 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

Disabled alarms view added

parent 97a61419
...@@ -73,9 +73,6 @@ Alarm::Alarm(CumbiaPool *cu_p, QWidget *parent) : QWidget(parent) ...@@ -73,9 +73,6 @@ Alarm::Alarm(CumbiaPool *cu_p, QWidget *parent) : QWidget(parent)
/* message label */ /* message label */
ui->msgLabel->setVisible(false); ui->msgLabel->setVisible(false);
connect(ui->treeWidgetAlarms, SIGNAL(message(QString)), ui->msgLabel, SLOT(setText(QString)));
connect(ui->treeWidgetAlarms, SIGNAL(mouseOverItem(bool)), ui->msgLabel, SLOT(setVisible(bool)));
ui->pBClearFilter->setDisabled(true); ui->pBClearFilter->setDisabled(true);
ui->tWGroup->sortItems(0, Qt::AscendingOrder); ui->tWGroup->sortItems(0, Qt::AscendingOrder);
ui->tWGroup->header()->setHidden(true); ui->tWGroup->header()->setHidden(true);
...@@ -136,8 +133,13 @@ Alarm::Alarm(CumbiaPool *cu_p, QWidget *parent) : QWidget(parent) ...@@ -136,8 +133,13 @@ Alarm::Alarm(CumbiaPool *cu_p, QWidget *parent) : QWidget(parent)
ui->liViewInfo->setVisible(false); ui->liViewInfo->setVisible(false);
connect(ui->liViewInfo, SIGNAL(urlClicked(QString)), this, SLOT(openUrl(QString))); connect(ui->liViewInfo, SIGNAL(urlClicked(QString)), this, SLOT(openUrl(QString)));
connect(ui->pbInfo, SIGNAL(toggled(bool)), this, SLOT(onInfoListViewVisibilityChange(bool))); connect(ui->pbInfo, SIGNAL(toggled(bool)), this, SLOT(onInfoListViewVisibilityChange(bool)));
connect(ui->treeWidgetAlarms, SIGNAL(itemSelectionChanged()), this, SLOT(onItemSelectionChange()));
connect(ui->treeWidgetAlarms, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onItemDoubleClicked(QModelIndex))); foreach(QTreeWidget *tw, QList<QTreeWidget *>() << ui->treeWidgetAlarms << ui->twDisabledAlarms) {
connect(tw, SIGNAL(message(QString)), ui->msgLabel, SLOT(setText(QString)));
connect(tw, SIGNAL(mouseOverItem(bool)), ui->msgLabel, SLOT(setVisible(bool)));
connect(tw, SIGNAL(itemSelectionChanged()), this, SLOT(onItemSelectionChange()));
connect(tw, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onItemDoubleClicked(QModelIndex)));
}
/* connections for test section */ /* connections for test section */
//connect(ui->pBTestSoundOn, SIGNAL(clicked()), this, SLOT(testSound())); //connect(ui->pBTestSoundOn, SIGNAL(clicked()), this, SLOT(testSound()));
//connect(ui->pBTestSoundOff, SIGNAL(clicked()), this, SLOT(stopSound())); //connect(ui->pBTestSoundOff, SIGNAL(clicked()), this, SLOT(stopSound()));
...@@ -153,7 +155,10 @@ Alarm::~Alarm() { ...@@ -153,7 +155,10 @@ Alarm::~Alarm() {
} }
void Alarm::refresh(const CuData &da) { void Alarm::refresh(const CuData &da) {
ui->treeWidgetAlarms->refresh(da); const QString& att = QuString(da, "src").section('/', -1, -1);
printf("Alarm::refresh: attribute is %s\n", qstoc(att));
AlarmTreeWidget *tw = att == "alarm" ? ui->treeWidgetAlarms : ui->twDisabledAlarms;
tw->refresh(da);
if(filtering && ui->cBDynamic->isChecked()) if(filtering && ui->cBDynamic->isChecked())
applyFilter(); applyFilter();
} }
...@@ -177,11 +182,13 @@ void Alarm::onGroupList(const CuData &da) { ...@@ -177,11 +182,13 @@ void Alarm::onGroupList(const CuData &da) {
} }
void Alarm::m_connect_devs(const QStringList &devs) { void Alarm::m_connect_devs(const QStringList &devs) {
foreach(const QString dev, devs) { foreach(const QString& att, QStringList() << "alarm" << "alarmDisabled") {
QuWatcher *alrw = new QuWatcher(this, cu_pool, m_ctrl_factory_pool); foreach(const QString dev, devs) {
alrw->setObjectName(dev + "/alarm" + "+watcher"); QuWatcher *alrw = new QuWatcher(this, cu_pool, m_ctrl_factory_pool);
connect(alrw, SIGNAL(newData(CuData)), this, SLOT(refresh(CuData))); alrw->setObjectName(dev + "/alarm" + "+watcher");
alrw->setSource(dev + "/alarm"); connect(alrw, SIGNAL(newData(CuData)), this, SLOT(refresh(CuData)));
alrw->setSource(dev + "/" + att);
}
} }
} }
...@@ -254,12 +261,14 @@ void Alarm::applyFilter() ...@@ -254,12 +261,14 @@ void Alarm::applyFilter()
filter.groups << groups[i]->text(0); filter.groups << groups[i]->text(0);
} }
ui->treeWidgetAlarms->applyFilter(filter); ui->treeWidgetAlarms->applyFilter(filter);
ui->twDisabledAlarms->applyFilter(filter);
filtering = true; filtering = true;
ui->pBClearFilter->setDisabled(false); ui->pBClearFilter->setDisabled(false);
} }
void Alarm::clearFilter() { void Alarm::clearFilter() {
ui->treeWidgetAlarms->removeFilter(); ui->treeWidgetAlarms->removeFilter();
ui->twDisabledAlarms->removeFilter();
ui->pBClearFilter->setDisabled(true); ui->pBClearFilter->setDisabled(true);
ui->cBDynamic->setChecked(false); ui->cBDynamic->setChecked(false);
filtering = false; filtering = false;
...@@ -268,15 +277,17 @@ void Alarm::clearFilter() { ...@@ -268,15 +277,17 @@ void Alarm::clearFilter() {
void Alarm::onInfoListViewVisibilityChange(bool vis) { void Alarm::onInfoListViewVisibilityChange(bool vis) {
if(!vis) if(!vis)
ui->liViewInfo->activate("", ""); ui->liViewInfo->activate("", "");
else else {
ui->treeWidgetAlarms->selectedItems().size() == 1 ? AlarmTreeWidget *atw = ui->tabWidget->currentIndex() == 0 ? ui->treeWidgetAlarms : ui->twDisabledAlarms;
ui->liViewInfo->activate(ui->treeWidgetAlarms->selectedItems().first()->data(AlarmTreeWidgetItem::Device, Qt::UserRole).toString(), atw->selectedItems().size() == 1 ?
ui->treeWidgetAlarms->selectedItems().first()->text(AlarmTreeWidgetItem::Alarm)) ui->liViewInfo->activate(atw->selectedItems().first()->data(AlarmTreeWidgetItem::Device, Qt::UserRole).toString(),
atw->selectedItems().first()->text(AlarmTreeWidgetItem::Alarm))
: ui->liViewInfo->activate("", ""); : ui->liViewInfo->activate("", "");
}
} }
void Alarm::onItemSelectionChange() { void Alarm::onItemSelectionChange() {
QList<QTreeWidgetItem *> sits = ui->treeWidgetAlarms->selectedItems(); QList<QTreeWidgetItem *> sits = qobject_cast<AlarmTreeWidget *>(sender())->selectedItems();
QTreeWidgetItem *it = nullptr; QTreeWidgetItem *it = nullptr;
if(sits.size() == 1) if(sits.size() == 1)
it = sits.first(); it = sits.first();
...@@ -286,12 +297,12 @@ void Alarm::onItemSelectionChange() { ...@@ -286,12 +297,12 @@ void Alarm::onItemSelectionChange() {
} }
void Alarm::onItemDoubleClicked(const QModelIndex &mi) { void Alarm::onItemDoubleClicked(const QModelIndex &mi) {
// if(mi.column() == AlarmTreeWidgetItem::Alarm) // if(mi.column() == AlarmTreeWidgetItem::Alarm)
ui->pbInfo->setChecked(true); ui->pbInfo->setChecked(true);
} }
void Alarm::tabChanged(int t) { void Alarm::tabChanged(int t) {
if(t == 1) { if(t > 1) {
ui->pBAckAll->setHidden(true); ui->pBAckAll->setHidden(true);
ui->pBConfHistory->setHidden(false); ui->pBConfHistory->setHidden(false);
ui->pBConfHistory->setChecked(true); ui->pBConfHistory->setChecked(true);
...@@ -300,12 +311,13 @@ void Alarm::tabChanged(int t) { ...@@ -300,12 +311,13 @@ void Alarm::tabChanged(int t) {
ui->pBConfHistory->setHidden(true); ui->pBConfHistory->setHidden(true);
ui->pBStopSound->setHidden(true); ui->pBStopSound->setHidden(true);
} }
else if(t == 0) { else if(t < 2) {
ui->pBStopSound->setHidden(false); ui->pBStopSound->setHidden(false);
ui->pBAckAll->setHidden(false); ui->pBAckAll->setHidden(false);
ui->pBConfHistory->setHidden(true); ui->pBConfHistory->setHidden(true);
ui->groupBoxFilter->setDisabled(false); ui->groupBoxFilter->setDisabled(false);
ui->pBFilter->setHidden(false); ui->pBFilter->setHidden(false);
onInfoListViewVisibilityChange(ui->liViewInfo->isVisible());
} }
} }
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>846</width> <width>855</width>
<height>468</height> <height>718</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -19,22 +19,22 @@ ...@@ -19,22 +19,22 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Alarm</string> <string>Alarm</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QSplitter" name="splitter">
<property name="currentIndex"> <property name="orientation">
<number>0</number> <enum>Qt::Vertical</enum>
</property> </property>
<widget class="QWidget" name="tabAlarms"> <widget class="QTabWidget" name="tabWidget">
<attribute name="title"> <property name="currentIndex">
<string>Alarms</string> <number>0</number>
</attribute> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QWidget" name="tabAlarms">
<item> <attribute name="title">
<widget class="QSplitter" name="splitter"> <string>Alarms</string>
<property name="orientation"> </attribute>
<enum>Qt::Vertical</enum> <layout class="QVBoxLayout" name="verticalLayout_3">
</property> <item>
<widget class="AlarmTreeWidget" name="treeWidgetAlarms"> <widget class="AlarmTreeWidget" name="treeWidgetAlarms">
<property name="verticalScrollBarPolicy"> <property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum> <enum>Qt::ScrollBarAlwaysOn</enum>
...@@ -48,140 +48,162 @@ ...@@ -48,140 +48,162 @@
</property> </property>
</column> </column>
</widget> </widget>
<widget class="AlarmInfoW" name="liViewInfo"/> </item>
</widget> </layout>
</item> </widget>
<item> <widget class="QWidget" name="tab">
<widget class="QLabel" name="msgLabel"> <attribute name="title">
<property name="sizePolicy"> <string>Disabled Alarms</string>
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> </attribute>
<horstretch>1</horstretch> <layout class="QVBoxLayout" name="verticalLayout_2">
<verstretch>0</verstretch> <item>
</sizepolicy> <widget class="AlarmTreeWidget" name="twDisabledAlarms">
</property> <property name="verticalScrollBarPolicy">
<property name="text"> <enum>Qt::ScrollBarAlwaysOn</enum>
<string>Alarm messages</string> </property>
</property> <property name="horizontalScrollBarPolicy">
<property name="alignment"> <enum>Qt::ScrollBarAlwaysOn</enum>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property>
</property> <column>
<property name="wordWrap"> <property name="text">
<bool>true</bool> <string>Date/Time</string>
</property> </property>
</widget> </column>
</item> </widget>
</layout> </item>
</widget> </layout>
<widget class="QWidget" name="tabTest"> </widget>
<attribute name="title"> <widget class="QWidget" name="tabTest">
<string>Test</string> <attribute name="title">
</attribute> <string>Test</string>
<layout class="QGridLayout"> </attribute>
<item row="0" column="0"> <layout class="QGridLayout">
<widget class="QGroupBox" name="groupBoxTestSound"> <item row="0" column="0">
<property name="sizePolicy"> <widget class="QGroupBox" name="groupBoxTestSound">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <property name="sizePolicy">
<horstretch>1</horstretch> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<verstretch>0</verstretch> <horstretch>1</horstretch>
</sizepolicy> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="title"> </property>
<string>Sound system</string> <property name="title">
</property> <string>Sound system</string>
<layout class="QVBoxLayout"> </property>
<item> <layout class="QVBoxLayout">
<widget class="QPushButton" name="pBTestSoundOn"> <item>
<property name="toolTip"> <widget class="QPushButton" name="pBTestSoundOn">
<string>Click to test if the sound is correctly configured in this workstation. Then click on Stop beep.</string> <property name="toolTip">
</property> <string>Click to test if the sound is correctly configured in this workstation. Then click on Stop beep.</string>
<property name="text"> </property>
<string>Test Beep</string> <property name="text">
</property> <string>Test Beep</string>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QPushButton" name="pBTestSoundOff"> <item>
<property name="toolTip"> <widget class="QPushButton" name="pBTestSoundOff">
<string>Click to stop the sound test.</string> <property name="toolTip">
</property> <string>Click to stop the sound test.</string>
<property name="text"> </property>
<string>Stop Beep</string> <property name="text">
</property> <string>Stop Beep</string>
</widget> </property>
</item> </widget>
</layout> </item>
</widget> </layout>
</item> </widget>
<item row="0" column="1"> </item>
<spacer> <item row="0" column="1">
<property name="orientation"> <spacer>
<enum>Qt::Horizontal</enum> <property name="orientation">
</property> <enum>Qt::Horizontal</enum>
<property name="sizeHint" stdset="0"> </property>
<size> <property name="sizeHint" stdset="0">
<width>441</width> <size>
<height>20</height> <width>441</width>
</size> <height>20</height>
</property> </size>
</spacer> </property>
</item> </spacer>
<item row="1" column="0"> </item>
<widget class="QGroupBox" name="groupBoxTestCycle"> <item row="1" column="0">
<property name="title"> <widget class="QGroupBox" name="groupBoxTestCycle">
<string>Alarm System</string> <property name="title">
</property> <string>Alarm System</string>
<layout class="QVBoxLayout"> </property>
<item> <layout class="QVBoxLayout">
<widget class="QuButton" name="tPBTestAlarm"> <item>
<property name="toolTip"> <widget class="QuButton" name="tPBTestAlarm">
<string>Click to test the Alarm System with a simulation. You must then click on Stop Test when happy.</string> <property name="toolTip">
</property> <string>Click to test the Alarm System with a simulation. You must then click on Stop Test when happy.</string>
<property name="text"> </property>
<string>Start Test</string> <property name="text">
</property> <string>Start Test</string>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QuButton" name="tPBTestAlarmStop"> <item>
<property name="toolTip"> <widget class="QuButton" name="tPBTestAlarmStop">
<string>Click this button to stop the test.</string> <property name="toolTip">
</property> <string>Click this button to stop the test.</string>
<property name="text"> </property>
<string>Stop Test</string> <property name="text">
</property> <string>Stop Test</string>
</widget> </property>
</item> </widget>
</layout> </item>
</widget> </layout>
</item> </widget>
<item row="1" column="1"> </item>
<spacer> <item row="1" column="1">
<property name="orientation"> <spacer>
<enum>Qt::Horizontal</enum> <property name="orientation">
</property> <enum>Qt::Horizontal</enum>
<property name="sizeHint" stdset="0"> </property>
<size> <property name="sizeHint" stdset="0">
<width>441</width> <size>
<height>20</height> <width>441</width>
</size> <height>20</height>
</property> </size>
</spacer> </property>
</item> </spacer>
<item row="2" column="0"> </item>
<spacer> <item row="2" column="0">
<property name="orientation"> <spacer>
<enum>Qt::Vertical</enum> <property name="orientation">
</property> <enum>Qt::Vertical</enum>
<property name="sizeHint" stdset="0"> </property>
<size> <property name="sizeHint" stdset="0">
<width>20</width> <size>
<height>40</height> <width>20</width>
</size> <height>40</height>
</property> </size>
</spacer> </property>
</item> </spacer>
</layout> </item>
</layout>
</widget>
</widget> </widget>
<widget class="AlarmInfoW" name="liViewInfo"/>
</widget>
</item>
<item>
<widget class="QLabel" name="msgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Alarm messages</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
......
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