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