Commit 54daa731 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

hidden microsecs column. Removed Count column. Checks

parent c9a57214
......@@ -23,41 +23,28 @@ using namespace std;
AlarmTreeWidget::AlarmTreeWidget(QWidget *parent) : QTreeWidget(parent)
{
setColumnCount(9);
setColumnCount(Columns::COLUMN_COUNT);
setColumnHidden(MICROSEC, true);
setRootIsDecorated(false);
setAutoScroll(true);
setSelectionMode(QAbstractItemView::ExtendedSelection);
setHeaderLabels(QStringList() << "Date/time" << "microsecs" << "Alarm" << "Status" << "Ack" << "Count" << "Level" << "Silenced min." << "Device" << "Message");
setHeaderLabels(QStringList() << "Date/time" << "microsecs" << "Alarm" << "Status" << "Ack" << "Level" << "Sil. min." << "Device" << "Message");
// setSortingEnabled(true);
#if QT_VERSION > 0x050000
header()->setSectionResizeMode( QHeaderView::ResizeToContents);
#else
header()->setResizeMode( QHeaderView::ResizeToContents);
#endif
_filter_enabled = false;
setMouseTracking(true);
connect(this, SIGNAL(itemEntered(QTreeWidgetItem*,int)), this, SLOT(slotItemEntered(QTreeWidgetItem*,int)));
}
void AlarmTreeWidget::showEvent(QShowEvent *e)
{
// header()->setResizeMode( QHeaderView::Interactive);
QWidget::showEvent(e);
}
void AlarmTreeWidget::applyFilter(AlarmFilter f)
{
QList<QTreeWidgetItem *> items;
int i;
if(_filter_enabled)
removeFilter();
items = findItems("*", Qt::MatchWildcard);
if(f.ack_enable)
{
if(f.ack_enable) {
QString sack = f.ack ? "ACK" : "NACK";
for(i = 0; i < items.size(); i++)
if(items[i]->text(ACK) != sack)
......@@ -67,14 +54,10 @@ void AlarmTreeWidget::applyFilter(AlarmFilter f)
else
headerItem()->setIcon(ACK, QIcon(ICON_PATH + ""));
if(f.lev)
{
for(i = 0; i < items.size(); i++)
{
if(f.lev) {
for(i = 0; i < items.size(); i++) {
/* must not have been hidden previously */
if(!items[i]->isHidden())
{
if(!items[i]->isHidden()) {
if(items[i]->text(LEVEL) != f.level)
items[i]->setHidden(true);
}
......@@ -85,13 +68,10 @@ void AlarmTreeWidget::applyFilter(AlarmFilter f)
headerItem()->setIcon(LEVEL, QIcon(ICON_PATH + ""));
if(f.stat)
{
for(i = 0; i < items.size(); i++)
{
if(f.stat) {
for(i = 0; i < items.size(); i++) {
/* must not have been hidden previously */
if(!items[i]->isHidden())
{
if(!items[i]->isHidden()) {
if(items[i]->text(STATUS) != f.status)
items[i]->setHidden(true);
}
......@@ -102,17 +82,13 @@ void AlarmTreeWidget::applyFilter(AlarmFilter f)
headerItem()->setIcon(STATUS, QIcon(ICON_PATH + ""));
if(f.grp)
{
for(i = 0; i < items.size(); i++)
{
if(f.grp) {
for(i = 0; i < items.size(); i++) {
/* must not have been hidden previously */
if(!items[i]->isHidden())
{
for(int j = 0; j < f.groups.size(); j++)
{
if(!items[i]->text(DEVICE).contains(f.groups[j]))
{
for(int j = 0; j < f.groups.size(); j++) {
if(!items[i]->text(DEVICE).contains(f.groups[j])) {
items[i]->setHidden(true);
break;
}
......@@ -290,7 +266,6 @@ void AlarmTreeWidget::contextMenuEvent(QContextMenuEvent *e)
void AlarmTreeWidget::m_insert_item(const QString& src, const QStringList &list, int index)
{
qDebug() << __PRETTY_FUNCTION__ << "inserting " << list << index;
AlarmTreeWidgetItem *item;
QStringList fields(list);
bool isNew = false;
......
......@@ -16,7 +16,7 @@ class AlarmTreeWidget : public QTreeWidget
Q_OBJECT
public:
enum Type {AlarmType, InternalErrorTyp };
enum columns { DATET, MICROSEC, ALARM, STATUS, ACK, COUNT, LEVEL, SILENCED, DEVICE, MESSAGE };
enum Columns { DATET, MICROSEC, ALARM, STATUS, ACK, LEVEL, SILENCED, DEVICE, MESSAGE, COLUMN_COUNT };
AlarmTreeWidget(QWidget *parent);
void applyFilter(AlarmFilter f);
......@@ -40,7 +40,6 @@ signals:
void ack();
protected:
void showEvent(QShowEvent *e);
void mouseMoveEvent(QMouseEvent *event);
void contextMenuEvent(QContextMenuEvent *);
......
......@@ -10,7 +10,7 @@ class AlarmTreeWidgetItem : public QTreeWidgetItem
{
public:
enum Columns { DateTime, muSecs, Alarm, Status, Ack, Count, Level,
enum Columns { DateTime, muSecs, Alarm, Status, Ack, Level,
SilencedMin, Device, Message };
AlarmTreeWidgetItem(QTreeWidget *parent, QStringList &strings);
......
......@@ -25,20 +25,15 @@
#include "AlarmTreeWidget.h"
#include "AlarmTreeWidgetItem.h"
#include <QMessageBox>
#include <QDateTime>
#include <QHeaderView>
#include <QCloseEvent>
#include "AlarmHistoryTree.h"
#include <QDebug>
#include <QMap>
#include <QDesktopServices> // open url
// cumbia
#include <qulogimpl.h>
#include <cucontrolsfactorypool.h>
#include <cumbiapool.h>
#include <cuserviceprovider.h>
#include <cumacros.h>
#include <quapps.h>
#include <quwriter.h>
#include <quwatcher.h>
......
......@@ -83,8 +83,7 @@ int main( int argc, char ** argv )
}
if(argc > 1)
w->setWindowTitle(argv[1]);
w->setWindowTitle("Alarm [ng]");
// exec application loop
......
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