// This Struct is taken from Harfbuzz. We use it only to calc it's size.
// we use a shared memory region so we do not have to malloc a buffer area for every line
// This Struct is taken from Harfbuzz. We use it only to calc it's size.
// we use a shared memory region so we do not have to malloc a buffer area for every line
/*HB_LineBreakType*/ unsigned lineBreakType : 2;
/*HB_Bool*/ unsigned whiteSpace : 1; /* A unicode whitespace character, except NBSP, ZWNBSP */
/*HB_Bool*/ unsigned charStop : 1; /* Valid cursor position (for left/right arrow) */
/*HB_Bool*/ unsigned wordBoundary : 1;
/*HB_Bool*/ unsigned sentenceBoundary : 1;
unsigned unused : 2;
/*HB_LineBreakType*/ unsigned lineBreakType : 2;
/*HB_Bool*/ unsigned whiteSpace : 1; /* A unicode whitespace character, except NBSP, ZWNBSP */
/*HB_Bool*/ unsigned charStop : 1; /* Valid cursor position (for left/right arrow) */
/*HB_Bool*/ unsigned wordBoundary : 1;
/*HB_Bool*/ unsigned sentenceBoundary : 1;
unsigned unused : 2;
unsigned char *ChatLineModelItem::TextBoundaryFinderBuffer = (unsigned char *)malloc(512 * sizeof(HB_CharAttributes_Dummy));
int ChatLineModelItem::TextBoundaryFinderBufferSize = 512 * (sizeof(HB_CharAttributes_Dummy) / sizeof(unsigned char));
unsigned char *ChatLineModelItem::TextBoundaryFinderBuffer = (unsigned char *)malloc(512 * sizeof(HB_CharAttributes_Dummy));
int ChatLineModelItem::TextBoundaryFinderBufferSize = 512 * (sizeof(HB_CharAttributes_Dummy) / sizeof(unsigned char));
QVariant ChatLineModelItem::data(int column, int role) const
{
if (role == ChatLineModel::MsgLabelRole)
QVariant ChatLineModelItem::data(int column, int role) const
{
if (role == ChatLineModel::MsgLabelRole)
case ChatLineModel::EditRole:
return _styledMsg.timestamp();
case ChatLineModel::BackgroundRole:
case ChatLineModel::EditRole:
return _styledMsg.timestamp();
case ChatLineModel::BackgroundRole:
- return QVariant::fromValue<UiStyle::FormatList>(UiStyle::FormatList()
- << qMakePair((quint16)0, (quint32) UiStyle::formatType(_styledMsg.type()) | UiStyle::Timestamp));
+ return QVariant::fromValue<UiStyle::FormatList>({std::make_pair(quint16{0}, UiStyle::Format{UiStyle::formatType(_styledMsg.type()) | UiStyle::FormatType::Timestamp, {}, {}})});
case ChatLineModel::EditRole:
return _styledMsg.plainSender();
case ChatLineModel::BackgroundRole:
case ChatLineModel::EditRole:
return _styledMsg.plainSender();
case ChatLineModel::BackgroundRole:
- return QVariant::fromValue<UiStyle::FormatList>(UiStyle::FormatList()
- << qMakePair((quint16)0, (quint32) UiStyle::formatType(_styledMsg.type()) | UiStyle::Sender));
+ return QVariant::fromValue<UiStyle::FormatList>({std::make_pair(quint16{0}, UiStyle::Format{UiStyle::formatType(_styledMsg.type()) | UiStyle::FormatType::Sender, {}, {}})});
case ChatLineModel::EditRole:
return _styledMsg.plainContents();
case ChatLineModel::BackgroundRole:
case ChatLineModel::EditRole:
return _styledMsg.plainContents();
case ChatLineModel::BackgroundRole:
case ChatLineModel::FormatRole:
return QVariant::fromValue<UiStyle::FormatList>(_styledMsg.contentsFormatList());
case ChatLineModel::WrapListRole:
case ChatLineModel::FormatRole:
return QVariant::fromValue<UiStyle::FormatList>(_styledMsg.contentsFormatList());
case ChatLineModel::WrapListRole:
- QTextCharFormat fmt = QtUi::style()->format(UiStyle::formatType(_styledMsg.type()) | subelement, messageLabel() | (selected ? UiStyle::Selected : 0));
+ QTextCharFormat fmt = QtUi::style()->format({UiStyle::formatType(_styledMsg.type()) | subelement, {}, {}},
+ messageLabel() | (selected ? UiStyle::MessageLabel::Selected : UiStyle::MessageLabel::None));
if (fmt.hasProperty(QTextFormat::BackgroundBrush))
return QVariant::fromValue<QBrush>(fmt.background());
return QVariant();
if (fmt.hasProperty(QTextFormat::BackgroundBrush))
return QVariant::fromValue<QBrush>(fmt.background());
return QVariant();