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
ea6edd37
Commit
ea6edd37
authored
May 03, 2021
by
Giacomo Strangolino
Browse files
added alarm counter alongside tab text
parent
2bd703f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/AlarmTreeWidget.cpp
View file @
ea6edd37
...
...
@@ -234,6 +234,20 @@ int AlarmTreeWidget::findPos(time_t ts, const QString &pri, const QString& statu
return
i
;
}
int
AlarmTreeWidget
::
countAll
()
const
{
return
topLevelItemCount
();
}
int
AlarmTreeWidget
::
countAlarmed
()
const
{
int
cnt
=
0
;
for
(
int
i
=
0
;
i
<
topLevelItemCount
();
i
++
)
{
const
QString
&
s
=
topLevelItem
(
i
)
->
text
(
AlarmTreeWidgetItem
::
Status
);
if
(
(
s
==
"ALARM"
||
s
==
"ERROR"
)
&&
topLevelItem
(
i
)
->
text
(
AlarmTreeWidgetItem
::
Ack
)
==
"NACK"
)
cnt
++
;
}
return
cnt
;
}
void
AlarmTreeWidget
::
contextMenuEvent
(
QContextMenuEvent
*
e
)
{
bool
silenceAvail
=
true
;
...
...
src/AlarmTreeWidget.h
View file @
ea6edd37
...
...
@@ -23,6 +23,8 @@ public:
void
setType
(
Type
t
);
void
removeFilter
();
int
findPos
(
time_t
ts
,
const
QString
&
pri
,
const
QString
&
status
);
int
countAll
()
const
;
int
countAlarmed
()
const
;
public
slots
:
void
refresh
(
const
CuData
&
v
);
...
...
src/alarm.cpp
View file @
ea6edd37
...
...
@@ -156,11 +156,13 @@ Alarm::~Alarm() {
void
Alarm
::
refresh
(
const
CuData
&
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
())
applyFilter
();
QString
tn
=
"Alarm [%1]"
;
if
(
att
==
"alarm"
)
ui
->
tabWidget
->
setTabText
(
0
,
tn
.
arg
(
tw
->
countAlarmed
()));
else
ui
->
tabWidget
->
setTabText
(
1
,
tn
.
arg
(
tw
->
countAll
()));
}
void
Alarm
::
onDevList
(
const
CuData
&
da
)
{
...
...
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