1 /* 2 * This file is part of Licq, an instant messaging client for UNIX. 3 * Copyright (C) 2007-2012 Licq developers <licq-dev@googlegroups.com> 4 * 5 * Licq is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * Licq is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Licq; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef HISTORYVIEW_H 21 #define HISTORYVIEW_H 22 23 #include "mlview.h" 24 25 #include <QDate> 26 27 #include <licq/userid.h> 28 29 namespace Licq 30 { 31 class Event; 32 class UserEvent; 33 } 34 35 namespace LicqQtGui 36 { 37 class HistoryView : public MLView 38 { 39 Q_OBJECT 40 41 public: 42 static QStringList getStyleNames(bool includeHistoryStyles = false); 43 44 /** 45 * Constructor 46 * 47 * @param historyMode True to use history style setting, false to use chat style settings 48 * @param userId User to display chat history for 49 * @param parent Parent widget 50 */ 51 HistoryView(bool historyMode = false, const Licq::UserId& userId = Licq::UserId(), QWidget* parent = 0); 52 virtual ~HistoryView(); 53 54 void setHistoryConfig(int msgStyle, const QString& dateFormat, 55 bool extraSpacing, bool reverse); 56 void setChatConfig(int msgStyle, const QString& dateFormat, 57 bool extraSpacing, bool appendLineBreak, bool showNotices, bool dateHeader); 58 void setColors(const QString& back, const QString& rcv, const QString& snt, 59 const QString& rcvHist = QString(), const QString& sntHist = QString(), 60 const QString& notice = QString()); 61 void setReverse(bool reverse); 62 63 /** 64 * Change user this history is associated with 65 * 66 * @param userId New user 67 */ 68 void setOwner(const Licq::UserId& userId); 69 70 void updateContent(); 71 void clear(); 72 void addMsg(bool isReceiver, bool fromHistory, const QString& eventDescription, const QDateTime& date, 73 bool isDirect, bool isMultiRec, bool isUrgent, bool isEncrypted, 74 const QString& contactName, QString messageText, QString anchor = QString()); 75 void addNotice(const QDateTime& dateTime, QString messageText); 76 77 virtual QSize sizeHint() const; 78 79 public slots: 80 void addMsg(const Licq::UserEvent* event, const Licq::UserId& userId = Licq::UserId()); 81 void addMsg(const Licq::Event* event); 82 void setColors(); 83 84 signals: 85 void messageAdded(); 86 87 private: 88 void internalAddMsg(QString s, const QDate& date); 89 90 Licq::UserId myUserId; 91 int myMsgStyle; 92 QString myDateFormat; 93 bool myExtraSpacing; 94 bool myReverse; 95 bool myAppendLineBreak; 96 bool myUseBuffer; 97 bool myShowNotices; 98 bool myAddDateHeader; 99 QString myColorRcvHistory; 100 QString myColorSntHistory; 101 QString myColorRcv; 102 QString myColorSnt; 103 QString myColorNotice; 104 QString myBuffer; 105 QDate myLastDate; 106 }; 107 108 } // namespace LicqQtGui 109 110 #endif 111