1 #ifndef _NOTIFIERMESSAGE_H_ 2 #define _NOTIFIERMESSAGE_H_ 3 //============================================================================= 4 // 5 // File : NotifierMessage.h 6 // Creation date : Mar 02 Nov 2004 02:41:18 by Iacopo Palazzi 7 // 8 // This file is part of the KVIrc distribution 9 // Copyright (C) 2004 Szymon Stefanek (pragma at kvirc dot net) 10 // Copyright (C) 2004-2008 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it > 11 // Copyright (C) 2009 Fabio Bas < ctrlaltca at gmail dot com > 12 // 13 // This program is FREE software. You can redistribute it and/or 14 // modify it under the terms of the GNU General Public License 15 // as published by the Free Software Foundation; either version 2 16 // of the License, or (at your option) any later version. 17 // 18 // This program is distributed in the HOPE that it will be USEFUL, 19 // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 21 // See the GNU General Public License for more details. 22 // 23 // You should have received a copy of the GNU General Public License 24 // along with this program. If not, write to the Free Software Foundation, 25 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 26 // 27 //============================================================================= 28 29 #include <QHBoxLayout> 30 #include <QLabel> 31 #include <QPixmap> 32 #include <QString> 33 #include <QWidget> 34 35 /** 36 * \class NotifierMessage 37 * \brief A single message in a notifier window 38 * 39 * This is basically a single message that can appear in a notifier window 40 * It's made up of an icon and a rich text content 41 * This class is basically a QLabel with a method that translates a raw irc message to html code. 42 */ 43 class NotifierMessage : public QWidget 44 { 45 friend class NotifierWindow; 46 47 Q_OBJECT 48 public: 49 /** 50 * \brief Constructs the NotifierMessage object 51 * \param pPixmap pointer to a message icon, can be null 52 * \param szText const reference to message text in irc format 53 * \return NotifierMessage 54 */ 55 NotifierMessage(QPixmap * pPixmap, QString szText); 56 /** 57 * \brief Destroys the NotifierMessage object 58 */ 59 ~NotifierMessage(); 60 61 private: 62 /// The message text 63 QString m_szText; 64 /// The message icon (can be null) 65 QPixmap * m_pPixmap = nullptr; 66 /// Layout for the labels 67 QHBoxLayout * m_pHBox = nullptr; 68 /// Label for the message icon 69 QLabel * m_pLabel0 = nullptr; 70 /// Label for the message text 71 QLabel * m_pLabel1 = nullptr; 72 73 public: 74 /** 75 * \brief Returns the original irc message 76 * \return const QString & 77 */ text()78 const QString & text() const { return m_szText; } 79 /** 80 * \brief Returns the message icon 81 * \return QPixmap * 82 */ pixmap()83 QPixmap * pixmap() const { return m_pPixmap; } 84 /** 85 * \brief Updates the aspect of this message 86 * \return void 87 */ 88 void updateGui(); 89 }; 90 91 #endif //!_NOTIFIERMESSAGE_H_ 92