OpenWalnut  1.5.0dev
WQtMessageDock.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WQTMESSAGEDOCK_H
26 #define WQTMESSAGEDOCK_H
27 
28 #include <QDockWidget>
29 #include <QListWidget>
30 #include <QComboBox>
31 
32 #include "core/common/WLogEntry.h"
33 
34 #include "guiElements/WQtDockWidget.h"
35 #include "WQtMessagePopup.h"
36 
37 /**
38  * Dock widget for showing messages and logs
39  */
41 {
42  Q_OBJECT
43 public:
44  /**
45  * Constructor
46  *
47  * \param dockTitle the title
48  * \param parent parent widget
49  */
50  WQtMessageDock( QString dockTitle, QWidget* parent );
51 
52  /**
53  * Destructor.
54  */
55  virtual ~WQtMessageDock();
56 
57  /**
58  * Add a message to the dock
59  *
60  * \param title the title
61  * \param message the message
62  * \param type the type
63  */
64  void addMessage( QString title, QString message, WQtMessagePopup::MessageType type );
65 
66  /**
67  * Add a message to the dock
68  *
69  * \param sender who sent the message
70  * \param message the message
71  * \param type the type
72  */
73  void addLogMessage( QString sender, QString message, WQtMessagePopup::MessageType type );
74 
75  /**
76  * Add message to the dock
77  *
78  * \param entry use this log entry
79  */
80  void addLogMessage( const WLogEntry& entry );
81 
82  /**
83  * Save state to settings
84  */
85  void saveSettings();
86 
87 public slots:
88  /**
89  * Clear the message list.
90  */
91  void clearMessages();
92 
93 protected slots:
94  /**
95  * Handles changes in the filter combo
96  */
97  void handleFilterUpdate();
98 private:
99  /**
100  * The list
101  */
102  QListWidget* m_logList;
103 
104  /**
105  * The message filter
106  */
107  QComboBox* m_filterCombo;
108 };
109 
110 #endif // WQTMESSAGEDOCK_H
111 
Represents a simple log message with some attributes.
Definition: WLogEntry.h:57
Advanced QDockWidget.
Definition: WQtDockWidget.h:50
Dock widget for showing messages and logs.
void saveSettings()
Save state to settings.
QListWidget * m_logList
The list.
void addMessage(QString title, QString message, WQtMessagePopup::MessageType type)
Add a message to the dock.
void addLogMessage(QString sender, QString message, WQtMessagePopup::MessageType type)
Add a message to the dock.
QComboBox * m_filterCombo
The message filter.
WQtMessageDock(QString dockTitle, QWidget *parent)
Constructor.
void clearMessages()
Clear the message list.
virtual ~WQtMessageDock()
Destructor.
void handleFilterUpdate()
Handles changes in the filter combo.