Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cs
gui
alarm-ng
Commits
223c6aa6
Commit
223c6aa6
authored
Jan 22, 2021
by
Giacomo Strangolino
Browse files
issues
#1
,
#2
and
#3
https://gitlab.elettra.eu/cs/gui/alarm-ng/-/issues
parent
19e4e284
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/AlarmTreeWidget.cpp
View file @
223c6aa6
...
...
@@ -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
;
}
...
...
src/acmd.cpp
View file @
223c6aa6
...
...
@@ -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
;
...
...
src/acmd.h
View file @
223c6aa6
...
...
@@ -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
;
...
...
src/alarm.cpp
View file @
223c6aa6
...
...
@@ -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
();
}
...
...
src/alarminfow.cpp
View file @
223c6aa6
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment