OpenWalnut
1.5.0dev
src
qtgui
WQtMessagePopup.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 WQTMESSAGEPOPUP_H
26
#define WQTMESSAGEPOPUP_H
27
28
#include <QWidget>
29
#include <QDialog>
30
#include <QtCore/QString>
31
#include <QtCore/QTimer>
32
33
#include "core/common/WLogEntry.h"
34
35
/**
36
* Nice looking message popup.
37
*/
38
class
WQtMessagePopup
:
public
QDialog
39
{
40
Q_OBJECT
41
public
:
42
/**
43
* Describe the kind of message
44
*/
45
typedef
LogLevel
MessageType
;
46
47
/**
48
* Constructor
49
*
50
* \param parent parent widget
51
* \param title title
52
* \param message message
53
* \param type the message type
54
*/
55
WQtMessagePopup
( QWidget* parent,
const
QString& title,
const
QString& message, MessageType type );
56
57
/**
58
* Destructor.
59
*/
60
virtual
~WQtMessagePopup
();
61
62
/**
63
* When set to true, the widget gets closed when loosing focus or when clicking the detail button. If not, the widget needs to be closed
64
* manually.
65
*
66
* \param autoClose close flag
67
*/
68
void
setAutoClose
(
bool
autoClose =
true
);
69
70
/**
71
* Show or hide the close button
72
*
73
* \param showCloseButton true to show
74
*/
75
void
setShowCloseButton
(
bool
showCloseButton =
true
);
76
77
/**
78
* If true, the widget moves itself to the bottom of its parent widget. As this is not useful sometimes, you can disable this by using
79
* false here.
80
*
81
* \param autoPosition false if widget should not move automatically
82
*/
83
void
setAutoPosition
(
bool
autoPosition =
true
);
84
85
/**
86
* Get this popups message type.
87
*
88
* \return the type
89
*/
90
MessageType
getType
()
const
;
91
92
/**
93
* Reimplement show from QWidget to be able to auto-close it.
94
*/
95
void
show
();
96
97
signals:
98
/**
99
* Called when closing the popup
100
*
101
* \param me the pointer to the widget getting close
102
*/
103
void
onClose
(
WQtMessagePopup
* me );
104
105
public
slots:
106
/**
107
* Shows the message
108
*/
109
void
showMessage
();
110
111
/**
112
* Cloes this popup. Use instead of close() slot.
113
*/
114
void
closePopup
();
115
protected
:
116
/**
117
* On show. Called when opening the widget.
118
*
119
* \param event
120
*/
121
virtual
void
showEvent
( QShowEvent* event );
122
private
:
123
/**
124
* Title Text
125
*/
126
QString
m_title
;
127
128
/**
129
* The message text.
130
*/
131
QString
m_message
;
132
133
/**
134
* What kind of message is this.
135
*/
136
MessageType
m_type
;
137
138
/**
139
* Close button
140
*/
141
QPushButton*
m_closeBtn
;
142
143
/**
144
* See \ref setAutoClose.
145
*/
146
bool
m_autoClose
;
147
148
/**
149
* See \ref setAutoPosition.
150
*/
151
bool
m_autoMove
;
152
};
153
154
#endif
// WQTMESSAGEPOPUP_H
QDialog
WQtMessagePopup
Nice looking message popup.
Definition:
WQtMessagePopup.h:39
WQtMessagePopup::setAutoClose
void setAutoClose(bool autoClose=true)
When set to true, the widget gets closed when loosing focus or when clicking the detail button.
Definition:
WQtMessagePopup.cpp:236
WQtMessagePopup::getType
MessageType getType() const
Get this popups message type.
Definition:
WQtMessagePopup.cpp:267
WQtMessagePopup::show
void show()
Reimplement show from QWidget to be able to auto-close it.
Definition:
WQtMessagePopup.cpp:230
WQtMessagePopup::onClose
void onClose(WQtMessagePopup *me)
Called when closing the popup.
WQtMessagePopup::setShowCloseButton
void setShowCloseButton(bool showCloseButton=true)
Show or hide the close button.
Definition:
WQtMessagePopup.cpp:257
WQtMessagePopup::showEvent
virtual void showEvent(QShowEvent *event)
On show.
Definition:
WQtMessagePopup.cpp:188
WQtMessagePopup::~WQtMessagePopup
virtual ~WQtMessagePopup()
Destructor.
Definition:
WQtMessagePopup.cpp:203
WQtMessagePopup::m_type
MessageType m_type
What kind of message is this.
Definition:
WQtMessagePopup.h:136
WQtMessagePopup::m_autoMove
bool m_autoMove
See setAutoPosition.
Definition:
WQtMessagePopup.h:151
WQtMessagePopup::MessageType
LogLevel MessageType
Describe the kind of message.
Definition:
WQtMessagePopup.h:45
WQtMessagePopup::showMessage
void showMessage()
Shows the message.
Definition:
WQtMessagePopup.cpp:208
WQtMessagePopup::closePopup
void closePopup()
Cloes this popup.
Definition:
WQtMessagePopup.cpp:251
WQtMessagePopup::WQtMessagePopup
WQtMessagePopup(QWidget *parent, const QString &title, const QString &message, MessageType type)
Constructor.
Definition:
WQtMessagePopup.cpp:49
WQtMessagePopup::setAutoPosition
void setAutoPosition(bool autoPosition=true)
If true, the widget moves itself to the bottom of its parent widget.
Definition:
WQtMessagePopup.cpp:262
WQtMessagePopup::m_message
QString m_message
The message text.
Definition:
WQtMessagePopup.h:131
WQtMessagePopup::m_autoClose
bool m_autoClose
See setAutoClose.
Definition:
WQtMessagePopup.h:146
WQtMessagePopup::m_closeBtn
QPushButton * m_closeBtn
Close button.
Definition:
WQtMessagePopup.h:141
WQtMessagePopup::m_title
QString m_title
Title Text.
Definition:
WQtMessagePopup.h:126
Generated by
1.9.1