From fdd39e82e2f07f6b86b708199002a7e192e6b8ef Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 19 Oct 2026 14:30:35 +0200 Subject: [PATCH] Show desktop radio subscription on the call icon and allow Android icon tint --- .../com/utun/chat/ui/components/PortableRadioIcon.kt | 5 +++-- tools/chatgui/src/accountdelegate.cpp | 11 ++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/components/PortableRadioIcon.kt b/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/components/PortableRadioIcon.kt index 3af671c0..0edf9b0e 100644 --- a/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/components/PortableRadioIcon.kt +++ b/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/components/PortableRadioIcon.kt @@ -8,6 +8,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.CornerRadius import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Size +import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.semantics.contentDescription @@ -16,8 +17,8 @@ import androidx.compose.ui.unit.dp /* Общая портативная рация для кнопки и списка участников; размер задаёт вызывающий. */ @Composable -fun PortableRadioIcon(label: String, modifier: Modifier = Modifier.size(24.dp)) { - val color = LocalContentColor.current +fun PortableRadioIcon(label: String, modifier: Modifier = Modifier.size(24.dp), tint: Color = LocalContentColor.current) { + val color = tint Canvas(modifier.semantics { contentDescription = label }) { val unit = size.minDimension / 24f val stroke = 1.7f * unit diff --git a/tools/chatgui/src/accountdelegate.cpp b/tools/chatgui/src/accountdelegate.cpp index cae34313..5bab2e16 100644 --- a/tools/chatgui/src/accountdelegate.cpp +++ b/tools/chatgui/src/accountdelegate.cpp @@ -124,12 +124,6 @@ void AccountDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio FlagPainter::drawStorage(painter, flagX, option.rect.top() + (option.rect.height() - nameFont.pixelSize()) / 2, nameFont.pixelSize()); flagX += nameFont.pixelSize() + 2; } - if (flags & MEMBER_FLAG_RADIO) { - FlagPainter::drawRadio(painter, flagX, option.rect.top() + (option.rect.height() - nameFont.pixelSize()) / 2, - nameFont.pixelSize(), textColor); - flagX += nameFont.pixelSize() + 2; - } - QString name = index.data(Qt::DisplayRole).toString(); painter->drawText(QRect(flagX, option.rect.top() + 2, w - (flagX - x), yMid - option.rect.top() - 2), Qt::AlignLeft | Qt::AlignBottom, name); @@ -152,7 +146,8 @@ void AccountDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio const QColor color = index.data(MemberListModel::OnlineRole).toBool() ? textColor : option.palette.color(QPalette::Disabled, QPalette::Text); const QRect radio = actionRect(option.rect, Action::RadioCall); - FlagPainter::drawRadio(painter, radio.center().x() - 12, radio.center().y() - 12, 24, color); + const QColor radioColor = flags & CHAT_MEMBER_FLAG_RADIO ? QColor("#4CAF50") : color; + FlagPainter::drawRadio(painter, radio.center().x() - 12, radio.center().y() - 12, 24, radioColor); drawCallButton(painter, actionRect(option.rect, Action::Call), color); } painter->restore(); @@ -203,6 +198,8 @@ bool AccountDelegate::helpEvent(QHelpEvent* event, QAbstractItemView* view, cons const Action action = actionAt(event->pos(), option.rect, false); if (action == Action::RadioCall || action == Action::Call) { QString text = QCoreApplication::translate("ChatGui", action == Action::RadioCall ? "Call by radio" : "Call peer"); + if (action == Action::RadioCall && (index.data(Qt::UserRole + 3).toInt() & CHAT_MEMBER_FLAG_RADIO)) + text += QCoreApplication::translate("ChatGui", " · Radio enabled"); if (!index.data(MemberListModel::OnlineRole).toBool()) text += " · " + QCoreApplication::translate("ChatGui", "offline"); QToolTip::showText(event->globalPos(), text, view); return true;