etcp: переупорядочить close + защита state==2 во всех API-точках; topo: правильная очистка group nodes и registry; chat/member: новый модуль member_sync; chatgui: обновления транспорта и UI
This commit is contained in:
1 parent
b2e4aadbf0
commit
7f901c01e1
38 files changed
+1275
-540
No files matched your search
@@ -8,21 +8,21 @@ ChannelDelegate::ChannelDelegate(QObject *parent)
|
||||
QRect ChannelDelegate::inviteButtonRect(const QRect &itemRect) {
|
||||
const int margin = 6;
|
||||
return QRect(itemRect.right() - margin - InviteBtnSize,
|
||||
itemRect.bottom() - margin - InviteBtnSize,
|
||||
itemRect.top() + margin,
|
||||
InviteBtnSize, InviteBtnSize);
|
||||
}
|
||||
|
||||
QRect ChannelDelegate::inviteByLinkButtonRect(const QRect &itemRect) {
|
||||
const int margin = 6;
|
||||
return QRect(itemRect.right() - margin - InviteBtnSize * 2 - InviteBtnGap,
|
||||
itemRect.bottom() - margin - InviteBtnSize,
|
||||
itemRect.top() + margin,
|
||||
InviteBtnSize, InviteBtnSize);
|
||||
}
|
||||
|
||||
QRect ChannelDelegate::settingsButtonRect(const QRect &itemRect) {
|
||||
const int margin = 6;
|
||||
return QRect(itemRect.right() - margin - InviteBtnSize * 3 - InviteBtnGap * 2,
|
||||
itemRect.bottom() - margin - InviteBtnSize,
|
||||
itemRect.top() + margin,
|
||||
InviteBtnSize, InviteBtnSize);
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ void ChannelDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
|
||||
QRect nameRect = textRect;
|
||||
nameRect.setHeight(QFontMetrics(nameFont).height());
|
||||
nameRect.setRight(nameRect.right() - InviteBtnSize * 3 - InviteBtnGap * 2 - 4);
|
||||
painter->drawText(nameRect, Qt::AlignLeft | Qt::AlignTop,
|
||||
painter->fontMetrics().elidedText(name, Qt::ElideRight, nameRect.width()));
|
||||
|
||||
@@ -113,7 +114,7 @@ void ChannelDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
if (option.state & QStyle::State_Selected) nickColor = nickColor.lighter(140);
|
||||
|
||||
QRect msgRect(textRect.left(), nameRect.bottom() + 4,
|
||||
textRect.right() - InviteBtnSize - 6 - textRect.left(),
|
||||
textRect.width(),
|
||||
option.rect.bottom() - nameRect.bottom() - margin);
|
||||
QFontMetrics msgFm(msgFont);
|
||||
|
||||
@@ -163,21 +164,15 @@ void ChannelDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
painter->drawText(badgeRect, Qt::AlignCenter, unreadText);
|
||||
}
|
||||
|
||||
/* ── invite plus button (bottom-right) ── */
|
||||
/* ── invite plus button (top-right) ── */
|
||||
QRect plusRect = inviteButtonRect(option.rect);
|
||||
bool plusHovered = index.data(ChannelInviteBtnHoveredRole).toInt() != 0;
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
if (plusHovered) {
|
||||
painter->setBrush(QColor(0x33, 0x90, 0xEC));
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->drawEllipse(plusRect);
|
||||
painter->setPen(QPen(Qt::white, 2));
|
||||
} else {
|
||||
painter->setBrush(QColor(0x33, 0x90, 0xEC, 110));
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->drawEllipse(plusRect);
|
||||
painter->setPen(QPen(QColor(0x33, 0x90, 0xEC), 2));
|
||||
}
|
||||
QColor plusFill = plusHovered ? QColor(0x4A, 0xA4, 0xF0) : QColor(0x33, 0x90, 0xEC);
|
||||
painter->setBrush(plusFill);
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->drawEllipse(plusRect);
|
||||
painter->setPen(QPen(Qt::white, 2));
|
||||
painter->drawLine(plusRect.center().x(), plusRect.top() + 5,
|
||||
plusRect.center().x(), plusRect.bottom() - 5);
|
||||
painter->drawLine(plusRect.left() + 5, plusRect.center().y(),
|
||||
@@ -187,18 +182,12 @@ void ChannelDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
QRect invRect = inviteByLinkButtonRect(option.rect);
|
||||
bool invHovered = index.data(ChannelInviteByLinkBtnHoveredRole).toInt() != 0;
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
if (invHovered) {
|
||||
painter->setBrush(QColor(0xE6, 0x7E, 0x22));
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->drawRoundedRect(invRect, 3, 3);
|
||||
painter->setPen(QPen(Qt::white, 1.5));
|
||||
} else {
|
||||
painter->setBrush(QColor(0xE6, 0x7E, 0x22, 110));
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->drawRoundedRect(invRect, 3, 3);
|
||||
painter->setPen(QPen(QColor(0xE6, 0x7E, 0x22), 1.5));
|
||||
}
|
||||
/* arrow pointing into a box: →| or a simple arrow-left: ← */
|
||||
QColor invFill = invHovered ? QColor(0xF0, 0x90, 0x30) : QColor(0xE6, 0x7E, 0x22);
|
||||
painter->setBrush(invFill);
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->drawRoundedRect(invRect, 3, 3);
|
||||
painter->setPen(QPen(Qt::white, 1.5));
|
||||
/* arrow: ← */
|
||||
int cx = invRect.center().x(), cy = invRect.center().y();
|
||||
int dx = 3;
|
||||
painter->drawLine(cx + dx, cy - 3, cx - dx, cy);
|
||||
@@ -209,7 +198,7 @@ void ChannelDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
/* ── settings gear (left of invite-by-link button) ── */
|
||||
QRect gearRect = settingsButtonRect(option.rect);
|
||||
bool gearHovered = index.data(ChannelSettingsBtnHoveredRole).toInt() != 0;
|
||||
QColor gearColor = gearHovered ? QColor("#3390EC") : QColor("#888");
|
||||
QColor gearColor = gearHovered ? QColor("#3390EC") : QColor("#555");
|
||||
painter->setPen(QPen(gearColor, 2));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
int gr = 5;
|
||||
|
||||
Reference in new issue
Block a user