Show desktop radio subscription on the call icon and allow Android icon tint

This commit is contained in:
evgeny committed 2026-10-19 14:30:35 +02:00
1 parent aca14bfb70
commit fdd39e82e2
2 files changed
+7 -9

No files matched your search

@@ -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
+4 -7
View File
@@ -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;