1 /*
2  *   File name: PanelMessage.h
3  *   Summary:	Message in a panel with icon and close button
4  *   License:	GPL V2 - See file LICENSE for details.
5  *
6  *   Author:	Stefan Hundhammer <Stefan.Hundhammer@gmx.de>
7  */
8 
9 #ifndef PanelMessage_h
10 #define PanelMessage_h
11 
12 #include <QWidget>
13 #include "ui_panel-message.h"
14 
15 
16 namespace QDirStat
17 {
PanelMessage(QWidget * parent)18     class PanelMessage;
19 
20     /**
21      * Message in a small panel with an icon, a bold face heading,
22      * a message text, an optional "Details..." hyperlink
23      * and a small [x] window close button.
24      *
25      * Those panels are intended to be put into a MessagePanel
26      * (but any Qt container widget can be used as well).
27      *
28      * The close button calls deleteLater on the panel, so it is completely
29      * self-sufficient once set up.
30      **/
~PanelMessage()31     class PanelMessage: public QWidget
32     {
33 	Q_OBJECT
34 
35     public:
36 	/**
37 	 * Constructor.
38 	 **/
39 	PanelMessage( QWidget * parent = 0 );
40 
41 	/**
42 	 * Destructor.
43 	 **/
44 	virtual ~PanelMessage();
45 
46 	/**
47 	 * Set the heading text.
48 	 **/
49 	void setHeading( const QString & headingText );
50 
51 	/**
52 	 * Set the body text.
53 	 **/
54 	void setText( const QString & bodyText );
55 
56 	/**
57 	 * Set the icon. If not set, a generic light bulb icon is used.
58 	 **/
59 	void setIcon( const QPixmap & pixmap );
60 
61 	/**
62 	 * Connect the "Details..." hyperlink to a receiver's slot.
63 	 * The hyperlink is only shown if it is connected.
64 	 *
65 	 * Use the same Qt macros as if connecting a normal widget:
66 	 *
67 	 *   connectDetailsLink( someAction, SLOT( triggered() ) );
68 	 **/
69 	void connectDetailsLink( const QObject * receiver,
70 				 const char    * slotName );
71 
72         /**
73          * Connect the "Details..." hyperlink to a web URL that will be opened
74          * in an external browser.
75          **/
76         void setDetailsUrl( const QString url );
77 
78         /**
79          * Return the URL set with setDetailsUrl().
80          **/
81         QString detailsUrl() const { return _detailsUrl; }
82 
83 
84     protected slots:
85 
86         /**
87          * Open the URL set with setDetailsUrl() in an external browser.
88          **/
89         void openDetailsUrl() const;
90 
91 
92     protected:
93 
94 	Ui::PanelMessage * _ui;
95         QString            _detailsUrl;
96 
97     };	// class PanelMessage
98 
99 }	// namespace QDirStat
100 
101 #endif	// PanelMessage_h
102