alarm.h 3.13 KB
Newer Older
Giacomo Strangolino's avatar
Giacomo Strangolino committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/***************************************************************************
 *   Copyright (C) 2007 by Claudio Scafuri, Giacomo Strangolino   *
 *   claudio@hyo   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#ifndef alarm_H
#define alarm_H

25
#include "ui/ui_alarm.h"
Giacomo Strangolino's avatar
Giacomo Strangolino committed
26
27
28
29
#include <vector>
#include <QString>
#include <QHash>
#include <QMap>
30
#include <tango.h>
Giacomo Strangolino's avatar
Giacomo Strangolino committed
31
32
#include "Sound.h"

33
34
35
36
37
38
39
// cumbia
#include <qulogimpl.h>
#include <cucontrolsfactorypool.h>
class CumbiaPool;
class CuData;
// cumbia

Giacomo Strangolino's avatar
Giacomo Strangolino committed
40
41
42
43
class AlarmFilter;
class AlarmSQLHandle;
class AlarmHistoryTree;
class AlarmTreeWidgetItem;
44
class QTreeWidgetItem;
Giacomo Strangolino's avatar
Giacomo Strangolino committed
45

46
class Alarm: public QWidget
Giacomo Strangolino's avatar
Giacomo Strangolino committed
47
48
49
50
{
   Q_OBJECT

public:
51
   Alarm(CumbiaPool *cu_p, QWidget *);
Giacomo Strangolino's avatar
Giacomo Strangolino committed
52
53
54
55
   ~Alarm();

public slots:

56
   void queryDB();
Giacomo Strangolino's avatar
Giacomo Strangolino committed
57
protected slots:
58
59
   void refresh(const CuData &da);
   void onDevList(const CuData& da);
60
   void onGroupList(const CuData &da);
61
   void m_connect_devs(const QStringList &devs);
62

Giacomo Strangolino's avatar
Giacomo Strangolino committed
63
64
65
   void ack();
   void ackAll();
   void silence();
66
   void enable();
Giacomo Strangolino's avatar
Giacomo Strangolino committed
67
68
69
   void stopSound();
   void testSound();
   void tabChanged(int);
70
71
72
   void onInfoListViewVisibilityChange(bool vis);

   void onItemSelectionChange();
73
   void onItemDoubleClicked(const QModelIndex &mi);
74
75
76
   void onFilterNameChanged(const QString& n);
   void onFilterStatusChanged(const QString& s);
   void onFilterStatusEnabled(bool en);
Giacomo Strangolino's avatar
Giacomo Strangolino committed
77

78
79
   void beep();

80
81
   void openUrl(const QString& u) const;

Giacomo Strangolino's avatar
Giacomo Strangolino committed
82
83
84
protected:
   void closeEvent(QCloseEvent *);

85
86
private slots:
   void enableFrameHistoryInterval(int i);
Giacomo Strangolino's avatar
Giacomo Strangolino committed
87
88
private:
   void insertItem(const QStringList &s, int index);
89
   void tangoStringListCommand(const QString &device_name, const QStringList &names, const char *cmdname);
90
   void mRemoveStaleItems(const QSet<QString> stale_names);
Giacomo Strangolino's avatar
Giacomo Strangolino committed
91
92
   QList<QTreeWidgetItem *> mGetSelectedItems();

93
   Ui::Alarm *ui;
Giacomo Strangolino's avatar
Giacomo Strangolino committed
94
95
   Sound *sound;
   bool filtering;
96
   AlarmFilter *m_filter;
97
98
99
100
101

   // cumbia
   CumbiaPool *cu_pool;
   QuLogImpl m_log_impl;
   CuControlsFactoryPool m_ctrl_factory_pool;
102
   QStringList m_handlers;
103
   // cumbia
Giacomo Strangolino's avatar
Giacomo Strangolino committed
104
105
106
107
};


#endif