mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Allow many custom elements in PeerListRow.
This commit is contained in:
parent
7f428f2eeb
commit
ab58aa020e
17 changed files with 222 additions and 124 deletions
|
@ -519,6 +519,55 @@ void PeerListRow::refreshName(const style::PeerListItem &st) {
|
|||
_name.setText(st.nameStyle, text, Ui::NameTextOptions());
|
||||
}
|
||||
|
||||
QRect PeerListRow::elementGeometry(int element, int outerWidth) const {
|
||||
if (element != 1) {
|
||||
return QRect();
|
||||
}
|
||||
const auto size = rightActionSize();
|
||||
if (size.isEmpty()) {
|
||||
return QRect();
|
||||
}
|
||||
const auto margins = rightActionMargins();
|
||||
const auto right = margins.right();
|
||||
const auto top = margins.top();
|
||||
const auto left = outerWidth - right - size.width();
|
||||
return QRect(QPoint(left, top), size);
|
||||
}
|
||||
|
||||
bool PeerListRow::elementDisabled(int element) const {
|
||||
return (element == 1) && rightActionDisabled();
|
||||
}
|
||||
|
||||
void PeerListRow::elementAddRipple(
|
||||
int element,
|
||||
QPoint point,
|
||||
Fn<void()> updateCallback) {
|
||||
if (element == 1) {
|
||||
rightActionAddRipple(point, std::move(updateCallback));
|
||||
}
|
||||
}
|
||||
|
||||
void PeerListRow::elementsStopLastRipple() {
|
||||
rightActionStopLastRipple();
|
||||
}
|
||||
|
||||
void PeerListRow::elementsPaint(
|
||||
Painter &p,
|
||||
int outerWidth,
|
||||
bool selected,
|
||||
int selectedElement) {
|
||||
const auto geometry = elementGeometry(1, outerWidth);
|
||||
if (!geometry.isEmpty()) {
|
||||
rightActionPaint(
|
||||
p,
|
||||
geometry.x(),
|
||||
geometry.y(),
|
||||
outerWidth,
|
||||
selected,
|
||||
(selectedElement == 1));
|
||||
}
|
||||
}
|
||||
|
||||
QString PeerListRow::generateName() {
|
||||
return peer()->name;
|
||||
}
|
||||
|
@ -1273,11 +1322,16 @@ void PeerListContent::mousePressEvent(QMouseEvent *e) {
|
|||
auto updateCallback = [this, row, hint = _selected.index] {
|
||||
updateRow(row, hint);
|
||||
};
|
||||
if (_selected.action) {
|
||||
auto actionRect = getActiveActionRect(row, _selected.index);
|
||||
if (!actionRect.isEmpty()) {
|
||||
auto point = mapFromGlobal(QCursor::pos()) - actionRect.topLeft();
|
||||
row->addActionRipple(point, std::move(updateCallback));
|
||||
if (_selected.element) {
|
||||
const auto elementRect = getElementRect(
|
||||
row,
|
||||
_selected.index,
|
||||
_selected.element);
|
||||
if (!elementRect.isEmpty()) {
|
||||
row->elementAddRipple(
|
||||
_selected.element,
|
||||
mapFromGlobal(QCursor::pos()) - elementRect.topLeft(),
|
||||
std::move(updateCallback));
|
||||
}
|
||||
} else {
|
||||
auto point = mapFromGlobal(QCursor::pos()) - QPoint(0, getRowTop(_selected.index));
|
||||
|
@ -1309,8 +1363,8 @@ void PeerListContent::mousePressReleased(Qt::MouseButton button) {
|
|||
setPressed(Selected());
|
||||
if (button == Qt::LeftButton && pressed == _selected) {
|
||||
if (auto row = getRow(pressed.index)) {
|
||||
if (pressed.action) {
|
||||
_controller->rowActionClicked(row);
|
||||
if (pressed.element) {
|
||||
_controller->rowElementClicked(row, pressed.element);
|
||||
} else {
|
||||
_controller->rowClicked(row);
|
||||
}
|
||||
|
@ -1387,9 +1441,11 @@ void PeerListContent::contextMenuEvent(QContextMenuEvent *e) {
|
|||
}
|
||||
|
||||
void PeerListContent::setPressed(Selected pressed) {
|
||||
if (auto row = getRow(_pressed.index)) {
|
||||
if (_pressed == pressed) {
|
||||
return;
|
||||
} else if (const auto row = getRow(_pressed.index)) {
|
||||
row->stopLastRipple();
|
||||
row->stopLastActionRipple();
|
||||
row->elementsStopLastRipple();
|
||||
}
|
||||
_pressed = pressed;
|
||||
}
|
||||
|
@ -1402,6 +1458,7 @@ crl::time PeerListContent::paintRow(
|
|||
Assert(row != nullptr);
|
||||
|
||||
row->lazyInitialize(_st.item);
|
||||
const auto outerWidth = width();
|
||||
|
||||
auto refreshStatusAt = row->refreshStatusTime();
|
||||
if (refreshStatusAt > 0 && now >= refreshStatusAt) {
|
||||
|
@ -1419,7 +1476,6 @@ crl::time PeerListContent::paintRow(
|
|||
? _pressed
|
||||
: _selected;
|
||||
const auto selected = (active.index == index);
|
||||
const auto actionSelected = (selected && active.action);
|
||||
|
||||
if (_mode == Mode::Custom) {
|
||||
_controller->customRowPaint(p, now, row, selected);
|
||||
|
@ -1429,27 +1485,29 @@ crl::time PeerListContent::paintRow(
|
|||
const auto &bg = selected
|
||||
? _st.item.button.textBgOver
|
||||
: _st.item.button.textBg;
|
||||
p.fillRect(0, 0, width(), _rowHeight, bg);
|
||||
row->paintRipple(p, 0, 0, width());
|
||||
p.fillRect(0, 0, outerWidth, _rowHeight, bg);
|
||||
row->paintRipple(p, 0, 0, outerWidth);
|
||||
row->paintUserpic(
|
||||
p,
|
||||
_st.item,
|
||||
_st.item.photoPosition.x(),
|
||||
_st.item.photoPosition.y(),
|
||||
width());
|
||||
outerWidth);
|
||||
|
||||
p.setPen(st::contactsNameFg);
|
||||
|
||||
auto skipRight = _st.item.photoPosition.x();
|
||||
auto actionSize = row->actionSize();
|
||||
auto actionMargins = actionSize.isEmpty() ? QMargins() : row->actionMargins();
|
||||
auto rightActionSize = row->rightActionSize();
|
||||
auto rightActionMargins = rightActionSize.isEmpty()
|
||||
? QMargins()
|
||||
: row->rightActionMargins();
|
||||
auto &name = row->name();
|
||||
auto namex = _st.item.namePosition.x();
|
||||
auto namew = width() - namex - skipRight;
|
||||
if (!actionSize.isEmpty()) {
|
||||
namew -= actionMargins.left()
|
||||
+ actionSize.width()
|
||||
+ actionMargins.right()
|
||||
auto namew = outerWidth - namex - skipRight;
|
||||
if (!rightActionSize.isEmpty()) {
|
||||
namew -= rightActionMargins.left()
|
||||
+ rightActionSize.width()
|
||||
+ rightActionMargins.right()
|
||||
- skipRight;
|
||||
}
|
||||
auto statusw = namew;
|
||||
|
@ -1466,20 +1524,6 @@ crl::time PeerListContent::paintRow(
|
|||
p.setPen(anim::pen(_st.item.nameFg, _st.item.nameFgChecked, nameCheckedRatio));
|
||||
name.drawLeftElided(p, namex, _st.item.namePosition.y(), namew, width());
|
||||
|
||||
if (!actionSize.isEmpty()) {
|
||||
auto actionLeft = width()
|
||||
- actionMargins.right()
|
||||
- actionSize.width();
|
||||
auto actionTop = actionMargins.top();
|
||||
row->paintAction(
|
||||
p,
|
||||
actionLeft,
|
||||
actionTop,
|
||||
width(),
|
||||
selected,
|
||||
actionSelected);
|
||||
}
|
||||
|
||||
p.setFont(st::contactsStatusFont);
|
||||
if (row->isSearchResult()
|
||||
&& !_mentionHighlight.isEmpty()
|
||||
|
@ -1508,6 +1552,9 @@ crl::time PeerListContent::paintRow(
|
|||
} else {
|
||||
row->paintStatusText(p, _st.item, _st.item.statusPosition.x(), _st.item.statusPosition.y(), statusw, width(), selected);
|
||||
}
|
||||
|
||||
row->elementsPaint(p, width(), selected, selected ? active.element : 0);
|
||||
|
||||
return refreshStatusIn;
|
||||
}
|
||||
|
||||
|
@ -1573,7 +1620,7 @@ PeerListContent::SkipResult PeerListContent::selectSkip(int direction) {
|
|||
}
|
||||
|
||||
_selected.index.value = newSelectedIndex;
|
||||
_selected.action = false;
|
||||
_selected.element = 0;
|
||||
if (newSelectedIndex >= 0) {
|
||||
auto top = (newSelectedIndex > 0) ? getRowTop(RowIndex(newSelectedIndex)) : 0;
|
||||
auto bottom = (newSelectedIndex + 1 < rowsCount) ? getRowTop(RowIndex(newSelectedIndex + 1)) : height();
|
||||
|
@ -1798,7 +1845,7 @@ void PeerListContent::setSelected(Selected selected) {
|
|||
}
|
||||
_selected = selected;
|
||||
updateRow(_selected.index);
|
||||
setCursor(_selected.action ? style::cur_pointer : style::cur_default);
|
||||
setCursor(_selected.element ? style::cur_pointer : style::cur_default);
|
||||
|
||||
_selectedIndex = _selected.index.value;
|
||||
}
|
||||
|
@ -1859,25 +1906,30 @@ void PeerListContent::selectByMouse(QPoint globalPosition) {
|
|||
rowsPointY - (selected.index.value * _rowHeight)))) {
|
||||
selected = Selected();
|
||||
} else if (!customMode) {
|
||||
if (getActiveActionRect(row, selected.index).contains(point)) {
|
||||
selected.action = true;
|
||||
for (auto i = 0, count = row->elementsCount(); i != count; ++i) {
|
||||
const auto rect = getElementRect(row, selected.index, i + 1);
|
||||
if (rect.contains(point)) {
|
||||
selected.element = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setSelected(selected);
|
||||
}
|
||||
|
||||
QRect PeerListContent::getActiveActionRect(not_null<PeerListRow*> row, RowIndex index) const {
|
||||
auto actionSize = row->actionSize();
|
||||
if (actionSize.isEmpty() || row->actionDisabled()) {
|
||||
QRect PeerListContent::getElementRect(
|
||||
not_null<PeerListRow*> row,
|
||||
RowIndex index,
|
||||
int element) const {
|
||||
if (row->elementDisabled(element)) {
|
||||
return QRect();
|
||||
}
|
||||
auto actionMargins = row->actionMargins();
|
||||
auto actionRight = actionMargins.right();
|
||||
auto actionTop = actionMargins.top();
|
||||
auto actionLeft = width() - actionRight - actionSize.width();
|
||||
auto rowTop = getRowTop(index);
|
||||
return myrtlrect(actionLeft, rowTop + actionTop, actionSize.width(), actionSize.height());
|
||||
const auto geometry = row->elementGeometry(element, width());
|
||||
if (geometry.isEmpty()) {
|
||||
return QRect();
|
||||
}
|
||||
return geometry.translated(0, getRowTop(index));
|
||||
}
|
||||
|
||||
int PeerListContent::rowsTop() const {
|
||||
|
|
|
@ -47,6 +47,7 @@ using PaintRoundImageCallback = Fn<void(
|
|||
bool respectSavedMessagesChat);
|
||||
|
||||
using PeerListRowId = uint64;
|
||||
|
||||
class PeerListRow {
|
||||
public:
|
||||
enum class State {
|
||||
|
@ -100,20 +101,17 @@ public:
|
|||
int y,
|
||||
int outerWidth,
|
||||
bool selected);
|
||||
virtual QSize actionSize() const {
|
||||
|
||||
virtual QSize rightActionSize() const {
|
||||
return QSize();
|
||||
}
|
||||
virtual bool actionDisabled() const {
|
||||
return false;
|
||||
}
|
||||
virtual QMargins actionMargins() const {
|
||||
virtual QMargins rightActionMargins() const {
|
||||
return QMargins();
|
||||
}
|
||||
virtual void addActionRipple(QPoint point, Fn<void()> updateCallback) {
|
||||
virtual bool rightActionDisabled() const {
|
||||
return false;
|
||||
}
|
||||
virtual void stopLastActionRipple() {
|
||||
}
|
||||
virtual void paintAction(
|
||||
virtual void rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
@ -121,6 +119,29 @@ public:
|
|||
bool selected,
|
||||
bool actionSelected) {
|
||||
}
|
||||
virtual void rightActionAddRipple(
|
||||
QPoint point,
|
||||
Fn<void()> updateCallback) {
|
||||
}
|
||||
virtual void rightActionStopLastRipple() {
|
||||
}
|
||||
|
||||
// By default elements code falls back to a simple right action code.
|
||||
virtual int elementsCount() const {
|
||||
return 1;
|
||||
}
|
||||
virtual QRect elementGeometry(int element, int outerWidth) const;
|
||||
virtual bool elementDisabled(int element) const;
|
||||
virtual void elementAddRipple(
|
||||
int element,
|
||||
QPoint point,
|
||||
Fn<void()> updateCallback);
|
||||
virtual void elementsStopLastRipple();
|
||||
virtual void elementsPaint(
|
||||
Painter &p,
|
||||
int outerWidth,
|
||||
bool selected,
|
||||
int selectedElement);
|
||||
|
||||
virtual void refreshName(const style::PeerListItem &st);
|
||||
const Ui::Text::String &name() const {
|
||||
|
@ -405,11 +426,21 @@ public:
|
|||
const style::PeerList &computeListSt() const;
|
||||
const style::MultiSelect &computeSelectSt() const;
|
||||
|
||||
virtual void prepare() = 0;
|
||||
virtual void rowClicked(not_null<PeerListRow*> row) = 0;
|
||||
virtual Main::Session &session() const = 0;
|
||||
virtual void rowActionClicked(not_null<PeerListRow*> row) {
|
||||
|
||||
virtual void prepare() = 0;
|
||||
|
||||
virtual void rowClicked(not_null<PeerListRow*> row) = 0;
|
||||
virtual void rowRightActionClicked(not_null<PeerListRow*> row) {
|
||||
}
|
||||
|
||||
// By default elements code falls back to a simple right action code.
|
||||
virtual void rowElementClicked(not_null<PeerListRow*> row, int element) {
|
||||
if (element == 1) {
|
||||
rowRightActionClicked(row);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void loadMoreRows() {
|
||||
}
|
||||
virtual void itemDeselectedHook(not_null<PeerData*> peer) {
|
||||
|
@ -653,15 +684,20 @@ private:
|
|||
struct Selected {
|
||||
Selected() {
|
||||
}
|
||||
Selected(RowIndex index, bool action) : index(index), action(action) {
|
||||
Selected(RowIndex index, int element)
|
||||
: index(index)
|
||||
, element(element) {
|
||||
}
|
||||
Selected(int index, bool action) : index(index), action(action) {
|
||||
Selected(int index, int element)
|
||||
: index(index)
|
||||
, element(element) {
|
||||
}
|
||||
|
||||
RowIndex index;
|
||||
bool action = false;
|
||||
int element = 0;
|
||||
};
|
||||
friend inline bool operator==(Selected a, Selected b) {
|
||||
return (a.index == b.index) && (a.action == b.action);
|
||||
return (a.index == b.index) && (a.element == b.element);
|
||||
}
|
||||
friend inline bool operator!=(Selected a, Selected b) {
|
||||
return !(a == b);
|
||||
|
@ -689,8 +725,13 @@ private:
|
|||
void updateRow(RowIndex row);
|
||||
int getRowTop(RowIndex row) const;
|
||||
PeerListRow *getRow(RowIndex element);
|
||||
RowIndex findRowIndex(not_null<PeerListRow*> row, RowIndex hint = RowIndex());
|
||||
QRect getActiveActionRect(not_null<PeerListRow*> row, RowIndex index) const;
|
||||
RowIndex findRowIndex(
|
||||
not_null<PeerListRow*> row,
|
||||
RowIndex hint = RowIndex());
|
||||
QRect getElementRect(
|
||||
not_null<PeerListRow*> row,
|
||||
RowIndex index,
|
||||
int element) const;
|
||||
|
||||
bool showRowMenu(
|
||||
RowIndex index,
|
||||
|
|
|
@ -136,11 +136,11 @@ void PeerListRowWithLink::lazyInitialize(const style::PeerListItem &st) {
|
|||
refreshActionLink();
|
||||
}
|
||||
|
||||
QSize PeerListRowWithLink::actionSize() const {
|
||||
QSize PeerListRowWithLink::rightActionSize() const {
|
||||
return QSize(_actionWidth, st::normalFont->height);
|
||||
}
|
||||
|
||||
QMargins PeerListRowWithLink::actionMargins() const {
|
||||
QMargins PeerListRowWithLink::rightActionMargins() const {
|
||||
return QMargins(
|
||||
st::contactsCheckPosition.x(),
|
||||
(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom() - st::normalFont->height) / 2,
|
||||
|
@ -148,7 +148,7 @@ QMargins PeerListRowWithLink::actionMargins() const {
|
|||
0);
|
||||
}
|
||||
|
||||
void PeerListRowWithLink::paintAction(
|
||||
void PeerListRowWithLink::rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
|
|
@ -47,9 +47,9 @@ public:
|
|||
|
||||
private:
|
||||
void refreshActionLink();
|
||||
QSize actionSize() const override;
|
||||
QMargins actionMargins() const override;
|
||||
void paintAction(
|
||||
QSize rightActionSize() const override;
|
||||
QMargins rightActionMargins() const override;
|
||||
void rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
|
|
@ -1438,7 +1438,7 @@ void ParticipantsBoxController::rowClicked(not_null<PeerListRow*> row) {
|
|||
}
|
||||
}
|
||||
|
||||
void ParticipantsBoxController::rowActionClicked(
|
||||
void ParticipantsBoxController::rowRightActionClicked(
|
||||
not_null<PeerListRow*> row) {
|
||||
const auto participant = row->peer();
|
||||
const auto user = participant->asUser();
|
||||
|
|
|
@ -157,7 +157,7 @@ public:
|
|||
Main::Session &session() const override;
|
||||
void prepare() override;
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
void rowActionClicked(not_null<PeerListRow*> row) override;
|
||||
void rowRightActionClicked(not_null<PeerListRow*> row) override;
|
||||
base::unique_qptr<Ui::PopupMenu> rowContextMenu(
|
||||
QWidget *parent,
|
||||
not_null<PeerListRow*> row) override;
|
||||
|
|
|
@ -61,9 +61,9 @@ class RequestedRow final : public PeerListRow {
|
|||
public:
|
||||
explicit RequestedRow(not_null<PeerData*> peer);
|
||||
|
||||
QSize actionSize() const override;
|
||||
QMargins actionMargins() const override;
|
||||
void paintAction(
|
||||
QSize rightActionSize() const override;
|
||||
QMargins rightActionMargins() const override;
|
||||
void rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
@ -77,21 +77,21 @@ RequestedRow::RequestedRow(not_null<PeerData*> peer)
|
|||
: PeerListRow(peer) {
|
||||
}
|
||||
|
||||
QSize RequestedRow::actionSize() const {
|
||||
QSize RequestedRow::rightActionSize() const {
|
||||
return QSize(
|
||||
st::inviteLinkThreeDotsIcon.width(),
|
||||
st::inviteLinkThreeDotsIcon.height());
|
||||
}
|
||||
|
||||
QMargins RequestedRow::actionMargins() const {
|
||||
QMargins RequestedRow::rightActionMargins() const {
|
||||
return QMargins(
|
||||
0,
|
||||
(st::inviteLinkList.item.height - actionSize().height()) / 2,
|
||||
(st::inviteLinkList.item.height - rightActionSize().height()) / 2,
|
||||
st::inviteLinkThreeDotsSkip,
|
||||
0);
|
||||
}
|
||||
|
||||
void RequestedRow::paintAction(
|
||||
void RequestedRow::rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
void prepare() override;
|
||||
void loadMoreRows() override;
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
void rowActionClicked(not_null<PeerListRow*> row) override;
|
||||
void rowRightActionClicked(not_null<PeerListRow*> row) override;
|
||||
Main::Session &session() const override;
|
||||
|
||||
rpl::producer<int> boxHeightValue() const override;
|
||||
|
@ -712,7 +712,7 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
|
|||
Ui::showPeerProfile(row->peer());
|
||||
}
|
||||
|
||||
void Controller::rowActionClicked(not_null<PeerListRow*> row) {
|
||||
void Controller::rowRightActionClicked(not_null<PeerListRow*> row) {
|
||||
if (_role != Role::Requested) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -91,9 +91,9 @@ public:
|
|||
QString generateShortName() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback() override;
|
||||
|
||||
QSize actionSize() const override;
|
||||
QMargins actionMargins() const override;
|
||||
void paintAction(
|
||||
QSize rightActionSize() const override;
|
||||
QMargins rightActionMargins() const override;
|
||||
void rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
@ -337,21 +337,21 @@ PaintRoundImageCallback Row::generatePaintUserpicCallback() {
|
|||
};
|
||||
}
|
||||
|
||||
QSize Row::actionSize() const {
|
||||
QSize Row::rightActionSize() const {
|
||||
return QSize(
|
||||
st::inviteLinkThreeDotsIcon.width(),
|
||||
st::inviteLinkThreeDotsIcon.height());
|
||||
}
|
||||
|
||||
QMargins Row::actionMargins() const {
|
||||
QMargins Row::rightActionMargins() const {
|
||||
return QMargins(
|
||||
0,
|
||||
(st::inviteLinkList.item.height - actionSize().height()) / 2,
|
||||
(st::inviteLinkList.item.height - rightActionSize().height()) / 2,
|
||||
st::inviteLinkThreeDotsSkip,
|
||||
0);
|
||||
}
|
||||
|
||||
void Row::paintAction(
|
||||
void Row::rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
@ -381,7 +381,7 @@ public:
|
|||
void prepare() override;
|
||||
void loadMoreRows() override;
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
void rowActionClicked(not_null<PeerListRow*> row) override;
|
||||
void rowRightActionClicked(not_null<PeerListRow*> row) override;
|
||||
base::unique_qptr<Ui::PopupMenu> rowContextMenu(
|
||||
QWidget *parent,
|
||||
not_null<PeerListRow*> row) override;
|
||||
|
@ -545,7 +545,7 @@ void LinksController::rowClicked(not_null<PeerListRow*> row) {
|
|||
ShowInviteLinkBox(_peer, static_cast<Row*>(row.get())->data());
|
||||
}
|
||||
|
||||
void LinksController::rowActionClicked(not_null<PeerListRow*> row) {
|
||||
void LinksController::rowRightActionClicked(not_null<PeerListRow*> row) {
|
||||
delegate()->peerListShowRowMenu(row, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,23 +102,25 @@ public:
|
|||
int availableWidth,
|
||||
int outerWidth,
|
||||
bool selected) override;
|
||||
void addActionRipple(QPoint point, Fn<void()> updateCallback) override;
|
||||
void stopLastActionRipple() override;
|
||||
void rightActionAddRipple(
|
||||
QPoint point,
|
||||
Fn<void()> updateCallback) override;
|
||||
void rightActionStopLastRipple() override;
|
||||
|
||||
int nameIconWidth() const override {
|
||||
return 0;
|
||||
}
|
||||
QSize actionSize() const override {
|
||||
QSize rightActionSize() const override {
|
||||
return peer()->isUser() ? QSize(_st->width, _st->height) : QSize();
|
||||
}
|
||||
QMargins actionMargins() const override {
|
||||
QMargins rightActionMargins() const override {
|
||||
return QMargins(
|
||||
0,
|
||||
0,
|
||||
st::defaultPeerListItem.photoPosition.x(),
|
||||
0);
|
||||
}
|
||||
void paintAction(
|
||||
void rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
@ -168,14 +170,14 @@ void BoxController::Row::paintStatusText(Painter &p, const style::PeerListItem &
|
|||
PeerListRow::paintStatusText(p, st, x, y, availableWidth, outerWidth, selected);
|
||||
}
|
||||
|
||||
void BoxController::Row::paintAction(
|
||||
void BoxController::Row::rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
bool selected,
|
||||
bool actionSelected) {
|
||||
auto size = actionSize();
|
||||
auto size = rightActionSize();
|
||||
if (_actionRipple) {
|
||||
_actionRipple->paint(
|
||||
p,
|
||||
|
@ -243,7 +245,7 @@ BoxController::Row::CallType BoxController::Row::ComputeCallType(
|
|||
return CallType::Voice;
|
||||
}
|
||||
|
||||
void BoxController::Row::addActionRipple(QPoint point, Fn<void()> updateCallback) {
|
||||
void BoxController::Row::rightActionAddRipple(QPoint point, Fn<void()> updateCallback) {
|
||||
if (!_actionRipple) {
|
||||
auto mask = Ui::RippleAnimation::ellipseMask(
|
||||
QSize(_st->rippleAreaSize, _st->rippleAreaSize));
|
||||
|
@ -255,7 +257,7 @@ void BoxController::Row::addActionRipple(QPoint point, Fn<void()> updateCallback
|
|||
_actionRipple->add(point - _st->rippleAreaPosition);
|
||||
}
|
||||
|
||||
void BoxController::Row::stopLastActionRipple() {
|
||||
void BoxController::Row::rightActionStopLastRipple() {
|
||||
if (_actionRipple) {
|
||||
_actionRipple->lastStop();
|
||||
}
|
||||
|
@ -379,7 +381,7 @@ void BoxController::rowClicked(not_null<PeerListRow*> row) {
|
|||
});
|
||||
}
|
||||
|
||||
void BoxController::rowActionClicked(not_null<PeerListRow*> row) {
|
||||
void BoxController::rowRightActionClicked(not_null<PeerListRow*> row) {
|
||||
auto user = row->peer()->asUser();
|
||||
Assert(user != nullptr);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
Main::Session &session() const override;
|
||||
void prepare() override;
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
void rowActionClicked(not_null<PeerListRow*> row) override;
|
||||
void rowRightActionClicked(not_null<PeerListRow*> row) override;
|
||||
void loadMoreRows() override;
|
||||
|
||||
base::unique_qptr<Ui::PopupMenu> rowContextMenu(
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
Main::Session &session() const override;
|
||||
void prepare() override;
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
void rowActionClicked(not_null<PeerListRow*> row) override;
|
||||
void rowRightActionClicked(not_null<PeerListRow*> row) override;
|
||||
base::unique_qptr<Ui::PopupMenu> rowContextMenu(
|
||||
QWidget *parent,
|
||||
not_null<PeerListRow*> row) override;
|
||||
|
@ -1159,7 +1159,7 @@ void Members::Controller::showRowMenu(
|
|||
delegate()->peerListShowRowMenu(row, highlightRow, cleanup);
|
||||
}
|
||||
|
||||
void Members::Controller::rowActionClicked(
|
||||
void Members::Controller::rowRightActionClicked(
|
||||
not_null<PeerListRow*> row) {
|
||||
showRowMenu(row, true);
|
||||
}
|
||||
|
|
|
@ -665,19 +665,19 @@ void MembersRow::paintComplexStatusText(
|
|||
: tr::lng_group_call_invited_status(tr::now)));
|
||||
}
|
||||
|
||||
QSize MembersRow::actionSize() const {
|
||||
QSize MembersRow::rightActionSize() const {
|
||||
return _delegate->rowIsNarrow() ? QSize() : QSize(
|
||||
st::groupCallActiveButton.width,
|
||||
st::groupCallActiveButton.height);
|
||||
}
|
||||
|
||||
bool MembersRow::actionDisabled() const {
|
||||
bool MembersRow::rightActionDisabled() const {
|
||||
return _delegate->rowIsMe(peer())
|
||||
|| (_state == State::Invited)
|
||||
|| !_delegate->rowCanMuteMembers();
|
||||
}
|
||||
|
||||
QMargins MembersRow::actionMargins() const {
|
||||
QMargins MembersRow::rightActionMargins() const {
|
||||
return QMargins(
|
||||
0,
|
||||
0,
|
||||
|
@ -685,14 +685,14 @@ QMargins MembersRow::actionMargins() const {
|
|||
0);
|
||||
}
|
||||
|
||||
void MembersRow::paintAction(
|
||||
void MembersRow::rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
bool selected,
|
||||
bool actionSelected) {
|
||||
auto size = actionSize();
|
||||
auto size = rightActionSize();
|
||||
const auto iconRect = style::rtlrect(
|
||||
x,
|
||||
y,
|
||||
|
@ -747,7 +747,9 @@ void MembersRow::refreshStatus() {
|
|||
_speaking);
|
||||
}
|
||||
|
||||
void MembersRow::addActionRipple(QPoint point, Fn<void()> updateCallback) {
|
||||
void MembersRow::rightActionAddRipple(
|
||||
QPoint point,
|
||||
Fn<void()> updateCallback) {
|
||||
if (!_actionRipple) {
|
||||
auto mask = Ui::RippleAnimation::ellipseMask(QSize(
|
||||
st::groupCallActiveButton.rippleAreaSize,
|
||||
|
@ -765,7 +767,7 @@ void MembersRow::refreshName(const style::PeerListItem &st) {
|
|||
//_narrowName = Ui::Text::String();
|
||||
}
|
||||
|
||||
void MembersRow::stopLastActionRipple() {
|
||||
void MembersRow::rightActionStopLastRipple() {
|
||||
if (_actionRipple) {
|
||||
_actionRipple->lastStop();
|
||||
}
|
||||
|
|
|
@ -104,15 +104,16 @@ public:
|
|||
return _raisedHandRating;
|
||||
}
|
||||
|
||||
void addActionRipple(QPoint point, Fn<void()> updateCallback) override;
|
||||
void stopLastActionRipple() override;
|
||||
|
||||
void refreshName(const style::PeerListItem &st) override;
|
||||
|
||||
QSize actionSize() const override;
|
||||
bool actionDisabled() const override;
|
||||
QMargins actionMargins() const override;
|
||||
void paintAction(
|
||||
void rightActionAddRipple(
|
||||
QPoint point,
|
||||
Fn<void()> updateCallback) override;
|
||||
void rightActionStopLastRipple() override;
|
||||
QSize rightActionSize() const override;
|
||||
bool rightActionDisabled() const override;
|
||||
QMargins rightActionMargins() const override;
|
||||
void rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
|
|
@ -37,7 +37,7 @@ void MemberListRow::setType(Type type) {
|
|||
_type = type;
|
||||
}
|
||||
|
||||
QSize MemberListRow::actionSize() const {
|
||||
QSize MemberListRow::rightActionSize() const {
|
||||
return canRemove()
|
||||
? QRect(
|
||||
QPoint(),
|
||||
|
@ -46,7 +46,7 @@ QSize MemberListRow::actionSize() const {
|
|||
: QSize();
|
||||
}
|
||||
|
||||
void MemberListRow::paintAction(
|
||||
void MemberListRow::rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
|
|
@ -31,8 +31,8 @@ public:
|
|||
MemberListRow(not_null<UserData*> user, Type type);
|
||||
|
||||
void setType(Type type);
|
||||
QSize actionSize() const override;
|
||||
void paintAction(
|
||||
QSize rightActionSize() const override;
|
||||
void rightActionPaint(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
|
|
|
@ -228,7 +228,7 @@ void BlockedBoxController::rowClicked(not_null<PeerListRow*> row) {
|
|||
});
|
||||
}
|
||||
|
||||
void BlockedBoxController::rowActionClicked(not_null<PeerListRow*> row) {
|
||||
void BlockedBoxController::rowRightActionClicked(not_null<PeerListRow*> row) {
|
||||
session().api().blockedPeers().unblock(row->peer());
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
Main::Session &session() const override;
|
||||
void prepare() override;
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
void rowActionClicked(not_null<PeerListRow*> row) override;
|
||||
void rowRightActionClicked(not_null<PeerListRow*> row) override;
|
||||
void loadMoreRows() override;
|
||||
|
||||
static void BlockNewPeer(not_null<Window::SessionController*> window);
|
||||
|
|
Loading…
Add table
Reference in a new issue