diff --git a/callwidget.cpp b/callwidget.cpp index 7bc345c7e173de0f153bdf44aca308c8d21fd7d0..08bb4bfc228fb887a7ace7fd0109ef84fd17e87d 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -609,6 +609,7 @@ CallWidget::on_contactMethodComboBox_currentIndexChanged(const QString& number) this, SLOT(slotAccountMessageReceived(QMap,ContactMethod*,Media::Media::Direction))); ui->listMessageView->scrollToBottom(); + txtRecording->setAllRead(); } } @@ -618,10 +619,10 @@ CallWidget::slotAccountMessageReceived(const QMap message, Media::Media::Direction dir) { Q_UNUSED(message) - Q_UNUSED(cm) Q_UNUSED(dir) ui->listMessageView->scrollToBottom(); + cm->textRecording()->setAllRead(); } void diff --git a/smartlistdelegate.cpp b/smartlistdelegate.cpp index 755c261000164bbbe2b646be54fda927f320ca3c..ffa8bee1145083e89040c8c148030bf604ff5eb8 100644 --- a/smartlistdelegate.cpp +++ b/smartlistdelegate.cpp @@ -39,6 +39,8 @@ SmartListDelegate::paint(QPainter* painter , const QModelIndex& index ) const { + painter->setRenderHint(QPainter::Antialiasing); + QStyleOptionViewItem opt(option); painter->setRenderHint(QPainter::Antialiasing); @@ -63,15 +65,44 @@ SmartListDelegate::paint(QPainter* painter drawDecoration(painter, opt, rectAvatar, QPixmap::fromImage(index.data(Qt::DecorationRole).value())); - const int currentRow = index.row(); - if (currentRow == rowHighlighted_) - emit rowSelected(opt.rect); - QFont font(painter->font()); + + if (auto messageCount = index.data(static_cast(Ring::Role::UnreadTextMessageCount)).toInt()) { + + font.setPointSize(8); + QFontMetrics textFontMetrics(font); + QString messageCountText = QString::number(messageCount); + + QRect pastilleRect; + QRect(rectAvatar.right() - 7, rectAvatar.bottom() - 7, pinSize_, pinSize_); + pastilleRect = textFontMetrics.boundingRect(QRect(rectAvatar.left() + sizeImage_/3, + rectAvatar.bottom() - 6, sizeImage_, 0), + Qt::AlignCenter, messageCountText); + + painter->setOpacity(0.9); + QRect bubbleRect(pastilleRect.left(), pastilleRect.top(), + pastilleRect.width() + 3, pastilleRect.height()); + + QPainterPath path; + path.addRoundedRect(bubbleRect, 3, 3); + QPen pen(red_, 5); + painter->setPen(pen); + painter->fillPath(path, red_); + painter->drawPath(path); + + painter->setPen(Qt::white); + painter->setOpacity(1); + painter->setFont(font); + painter->drawText(bubbleRect, Qt::AlignCenter, messageCountText); + } font.setPointSize(fontSize_); QPen pen(painter->pen()); + const int currentRow = index.row(); + if (currentRow == rowHighlighted_) + emit rowSelected(opt.rect); + if (not (opt.state & QStyle::State_Selected)) { pen.setColor(lightGrey_); painter->setPen(pen); diff --git a/smartlistdelegate.h b/smartlistdelegate.h index a3f0d7ff7303a081bb10cbe3d06f88f1a587d38d..354577c2e836117a33498f1216f8370407c79f9a 100644 --- a/smartlistdelegate.h +++ b/smartlistdelegate.h @@ -40,11 +40,13 @@ private: constexpr static int dy_ = 6; constexpr static int dx_ = 12; constexpr static int fontSize_ = 10; + constexpr static int pinSize_ = 12; int rowHighlighted_ = -1; const QColor lightGrey_ {242, 242, 242}; const QColor lightBlack_ {63, 63, 63}; const QColor grey_ {192, 192, 192}; + const QColor red_ {251, 72, 71}; signals: void rowSelected(const QRect& rect) const;