X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fqtui%2Fchatlinemodelitem.cpp;h=145185858a94f0fc97457a6c5154b3f66af7abbc;hb=20745bd0cbae035b84913127dfec9e8433d1282d;hp=66de6161fc1ac600762e35856755cef158e7b47d;hpb=e6f810169117c836c22ae1146e469e61dec95f6f;p=quassel.git diff --git a/src/qtui/chatlinemodelitem.cpp b/src/qtui/chatlinemodelitem.cpp index 66de6161..14518585 100644 --- a/src/qtui/chatlinemodelitem.cpp +++ b/src/qtui/chatlinemodelitem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 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 * @@ -28,14 +28,14 @@ // 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 -typedef struct { +using HB_CharAttributes_Dummy = struct { /*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_CharAttributes_Dummy; +}; unsigned char *ChatLineModelItem::TextBoundaryFinderBuffer = (unsigned char *)malloc(512 * sizeof(HB_CharAttributes_Dummy)); int ChatLineModelItem::TextBoundaryFinderBufferSize = 512 * (sizeof(HB_CharAttributes_Dummy) / sizeof(unsigned char)); @@ -65,7 +65,7 @@ bool ChatLineModelItem::setData(int column, const QVariant &value, int role) { switch (role) { case MessageModel::FlagsRole: - _styledMsg.setFlags((Message::Flags)value.toUInt()); + _styledMsg.setFlags((Message::Flags)value.toInt()); return true; default: return MessageModelItem::setData(column, value, role); @@ -79,7 +79,7 @@ QVariant ChatLineModelItem::data(int column, int role) const return QVariant::fromValue(messageLabel()); QVariant variant; - MessageModel::ColumnType col = (MessageModel::ColumnType)column; + auto col = (MessageModel::ColumnType)column; switch (col) { case ChatLineModel::TimestampColumn: variant = timestampData(role); @@ -160,7 +160,7 @@ UiStyle::MessageLabel ChatLineModelItem::messageLabel() const { using MessageLabel = UiStyle::MessageLabel; - MessageLabel label = static_cast(_styledMsg.senderHash() << 16); + auto label = static_cast(_styledMsg.senderHash() << 16); if (_styledMsg.flags() & Message::Self) label |= MessageLabel::OwnMsg; if (_styledMsg.flags() & Message::Highlight)