/***************************************************************************
- * Copyright (C) 2005-2010 by the Quassel Project *
+ * Copyright (C) 2005-2012 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
_cachedLayout = 0;
}
-void ChatItem::initLayout(QTextLayout *layout, QTextOption::WrapMode mode, Qt::Alignment alignment) const {
- initLayoutHelper(layout, mode, alignment);
- doLayout(layout);
-}
-
void ChatItem::initLayoutHelper(QTextLayout *layout, QTextOption::WrapMode wrapMode, Qt::Alignment alignment) const {
Q_ASSERT(layout);
layout->setAdditionalFormats(formatRanges);
}
+void ChatItem::initLayout(QTextLayout *layout) const {
+ initLayoutHelper(layout, QTextOption::NoWrap);
+ doLayout(layout);
+}
+
void ChatItem::doLayout(QTextLayout *layout) const {
layout->beginLayout();
QTextLine line = layout->createLine();
// SenderChatItem
// ************************************************************
+void SenderChatItem::initLayout(QTextLayout *layout) const {
+ initLayoutHelper(layout, QTextOption::ManualWrap, Qt::AlignRight);
+ doLayout(layout);
+}
+
void SenderChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
Q_UNUSED(option); Q_UNUSED(widget);
painter->save();
return h;
}
+void ContentsChatItem::initLayout(QTextLayout *layout) const {
+ initLayoutHelper(layout, QTextOption::WrapAtWordBoundaryOrAnywhere);
+ doLayout(layout);
+}
+
void ContentsChatItem::doLayout(QTextLayout *layout) const {
ChatLineModel::WrapList wrapList = data(ChatLineModel::WrapListRole).value<ChatLineModel::WrapList>();
if(!wrapList.count()) return; // empty chatitem
void ContentsChatItem::endHoverMode() {
if(privateData()) {
if(privateData()->currentClickable.isValid()) {
- chatLine()->setCursor(Qt::ArrowCursor);
+ chatLine()->unsetCursor();
privateData()->currentClickable = Clickable();
}
clearWebPreview();