X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatlinemodelitem.h;h=24f237e72f9d665ed1c994f02e40afa314d107a9;hp=d4979cdf1b55d75bde29175354301bae7e3f3dd8;hb=68878dc8366f2f4a0afe132847aad9a51a80cdbf;hpb=86831c8857f0a729580cee547e10c9621d50c780 diff --git a/src/qtui/chatlinemodelitem.h b/src/qtui/chatlinemodelitem.h index d4979cdf..24f237e7 100644 --- a/src/qtui/chatlinemodelitem.h +++ b/src/qtui/chatlinemodelitem.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,35 +15,55 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef CHATLINEMODELITEM_H_ -#define CHATLINEMODELITEM_H_ +#pragma once #include "messagemodel.h" -class ChatLineModelItemPrivate; +#include "uistyle.h" -class ChatLineModelItem : public MessageModelItem { +class ChatLineModelItem : public MessageModelItem +{ public: - ChatLineModelItem(const Message &); - ChatLineModelItem(const ChatLineModelItem &other); - ~ChatLineModelItem(); + ChatLineModelItem(const Message &); - virtual QVariant data(int column, int role) const; + virtual QVariant data(int column, int role) const; + virtual bool setData(int column, const QVariant &value, int role); - /// Used to store information about words to be used for wrapping - struct Word { - quint16 start; - qreal endX; - qreal width; - qreal trailing; - }; - typedef QVector WrapList; + virtual inline const Message &message() const { return _styledMsg; } + virtual inline const QDateTime ×tamp() const { return _styledMsg.timestamp(); } + virtual inline const MsgId &msgId() const { return _styledMsg.msgId(); } + virtual inline const BufferId &bufferId() const { return _styledMsg.bufferId(); } + virtual inline void setBufferId(BufferId bufferId) { _styledMsg.setBufferId(bufferId); } + virtual inline Message::Type msgType() const { return _styledMsg.type(); } + virtual inline Message::Flags msgFlags() const { return _styledMsg.flags(); } + + virtual inline void invalidateWrapList() { _wrapList.clear(); } + + /// Used to store information about words to be used for wrapping + struct Word { + quint16 start; + qreal endX; + qreal width; + qreal trailing; + }; + typedef QVector WrapList; private: - ChatLineModelItemPrivate *_data; -}; + QVariant timestampData(int role) const; + QVariant senderData(int role) const; + QVariant contentsData(int role) const; + + QVariant backgroundBrush(UiStyle::FormatType subelement, bool selected = false) const; + UiStyle::MessageLabel messageLabel() const; -#endif + void computeWrapList() const; + + mutable WrapList _wrapList; + UiStyle::StyledMessage _styledMsg; + + static unsigned char *TextBoundaryFinderBuffer; + static int TextBoundaryFinderBufferSize; +};