]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/messages.hpp
qt4: cleaning the singletons implementation.
[vlc] / modules / gui / qt4 / dialogs / messages.hpp
1 /*****************************************************************************
2  * Messages.hpp : Information about a stream
3  ****************************************************************************
4  * Copyright (C) 2006-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef QVLC_MESSAGES_DIALOG_H_
25 #define QVLC_MESSAGES_DIALOG_H_ 1
26
27 #include "util/qvlcframe.hpp"
28
29 class QTabWidget;
30 class QPushButton;
31 class QSpinBox;
32 class QGridLayout;
33 class QLabel;
34 class QTextEdit;
35 class QTreeWidget;
36 class QTreeWidgetItem;
37
38 class MessagesDialog : public QVLCFrame
39 {
40     Q_OBJECT;
41 public:
42     static MessagesDialog * getInstance( intf_thread_t *p_intf )
43     {
44         if( !instance)
45             instance = new MessagesDialog( p_intf );
46         return instance;
47     }
48     static void killInstance()
49     {
50         delete instance;
51         instance = NULL;
52     }
53
54
55 private:
56     MessagesDialog( intf_thread_t * );
57     virtual ~MessagesDialog();
58
59     static MessagesDialog *instance;
60     QTabWidget *mainTab;
61     QSpinBox *verbosityBox;
62     QLabel *verbosityLabel;
63     QTextEdit *messages;
64     QTreeWidget *modulesTree;
65     QPushButton *clearUpdateButton;
66     QPushButton *saveLogButton;
67     msg_subscription_t *sub;
68     msg_cb_data_t *cbData;
69     static void sinkMessage( msg_cb_data_t *, msg_item_t *, unsigned );
70     void customEvent( QEvent * );
71     void sinkMessage( msg_item_t *item );
72
73 private slots:
74     void updateTab( int );
75     void clearOrUpdate();
76     bool save();
77 private:
78     void clear();
79     void updateTree();
80     void buildTree( QTreeWidgetItem *, vlc_object_t * );
81 };
82
83 #endif