X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=1abfcfb2eb8b39dc227ef0e9fd4cd011ff31f2bb;hp=d4c83909ffd10077707a7d227635df01870a096b;hb=0b9f74984780aacbe85ca04c44ec6304c86557c2;hpb=858cba7fac9928549219de070397be65e1b92cde;ds=sidebyside diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index d4c83909..1abfcfb2 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -18,37 +18,66 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include +#include +#include + +#include "bufferinfo.h" +#include "chatitem.h" #include "chatline.h" -#include "chatlinemodel.h" #include "qtui.h" -#include "uistyle.h" -Chatline::Chatline(const Message &msg) : MessageItem(msg) { - _msg = QtUi::style()->styleMessage(msg); +Chatline::Chatline(const QModelIndex &index, QGraphicsItem *parent) : QGraphicsItem(parent) { + _timestampItem = new ChatItem(QPersistentModelIndex(index.sibling(index.row(), ChatlineModel::TimestampColumn)), this); + _senderItem = new ChatItem(QPersistentModelIndex(index.sibling(index.row(), ChatlineModel::SenderColumn)), this); + _contentsItem = new ChatItem(QPersistentModelIndex(index.sibling(index.row(), ChatlineModel::ContentsColumn)), this); + + _senderItem->setPos(80, 0); + _contentsItem->setPos(160, 0); +} + +Chatline::~Chatline() { } +QRectF Chatline::boundingRect () const { + return childrenBoundingRect(); +} + +void Chatline::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + +} -QVariant Chatline::data(int column, int role) const { - switch(role) { - case ChatlineModel::DisplayRole: - switch(column) { - case ChatlineModel::TimestampColumn: return _msg.timestamp.text; - case ChatlineModel::SenderColumn: return _msg.sender.text; - case ChatlineModel::TextColumn: return _msg.text.text; - } - break; - case ChatlineModel::FormatRole: - switch(column) { - case ChatlineModel::TimestampColumn: return QVariant::fromValue(_msg.timestamp.formats); - case ChatlineModel::SenderColumn: return QVariant::fromValue(_msg.sender.formats); - case ChatlineModel::TextColumn: return QVariant::fromValue(_msg.text.formats); - } - break; +/* +void ChatLine::setColumnWidths(int tsColWidth, int senderColWidth, int textColWidth) { + if(tsColWidth >= 0) { + _tsColWidth = tsColWidth; + _tsItem->setWidth(tsColWidth); } - return MessageItem::data(column, role); + if(senderColWidth >= 0) { + _senderColWidth = senderColWidth; + _senderItem->setWidth(senderColWidth); + } + if(textColWidth >= 0) { + _textColWidth = textColWidth; + _textItem->setWidth(textColWidth); + } + layout(); +} + +void ChatLine::layout() { + prepareGeometryChange(); + _tsItem->setPos(QPointF(0, 0)); + _senderItem->setPos(QPointF(_tsColWidth + QtUi::style()->sepTsSender(), 0)); + _textItem->setPos(QPointF(_tsColWidth + QtUi::style()->sepTsSender() + _senderColWidth + QtUi::style()->sepSenderText(), 0)); } -bool Chatline::setData(int column, const QVariant &value, int role) { + +bool ChatLine::sceneEvent ( QEvent * event ) { + qDebug() <<(void*)this<< "receiving event"; + event->ignore(); return false; } +*/ + +