2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Show members list in PanelMode::Wide.

This commit is contained in:
John Preston
2021-04-23 15:07:12 +04:00
parent c93ddf6aac
commit eb8f709943
15 changed files with 231 additions and 121 deletions

View File

@@ -729,10 +729,6 @@ termsAgePadding: margins(22px, 16px, 16px, 0px);
themesSmallSkip: 10px;
themesBackgroundSize: 120px;
themesScroll: ScrollArea(defaultScrollArea) {
bottomsh: 0px;
topsh: 0px;
}
themesMenuToggle: IconButton(defaultIconButton) {
width: 44px;
height: 44px;

View File

@@ -529,7 +529,7 @@ QString PeerListRow::generateShortName() {
: peer()->shortName();
}
std::shared_ptr<Data::CloudImageView> PeerListRow::ensureUserpicView() {
std::shared_ptr<Data::CloudImageView> &PeerListRow::ensureUserpicView() {
if (!_userpic) {
_userpic = peer()->createUserpicView();
}
@@ -588,11 +588,14 @@ void PeerListRow::paintStatusText(
_status.drawLeftElided(p, x, y, availableWidth, outerWidth);
}
template <typename UpdateCallback>
void PeerListRow::addRipple(const style::PeerListItem &st, QSize size, QPoint point, UpdateCallback updateCallback) {
template <typename MaskGenerator, typename UpdateCallback>
void PeerListRow::addRipple(const style::PeerListItem &st, MaskGenerator &&maskGenerator, QPoint point, UpdateCallback &&updateCallback) {
if (!_ripple) {
auto mask = Ui::RippleAnimation::rectMask(size);
_ripple = std::make_unique<Ui::RippleAnimation>(st.button.ripple, std::move(mask), std::move(updateCallback));
auto mask = maskGenerator();
if (mask.isNull()) {
return;
}
_ripple = std::make_unique<Ui::RippleAnimation>(st.button.ripple, std::move(mask), std::forward<UpdateCallback>(updateCallback));
}
_ripple->add(point);
}
@@ -1241,9 +1244,16 @@ void PeerListContent::mousePressEvent(QMouseEvent *e) {
row->addActionRipple(point, std::move(updateCallback));
}
} else {
auto size = QSize(width(), _rowHeight);
auto point = mapFromGlobal(QCursor::pos()) - QPoint(0, getRowTop(_selected.index));
row->addRipple(_st.item, size, point, std::move(updateCallback));
if (_mode == Mode::Custom) {
row->addRipple(_st.item, _controller->customRowRippleMaskGenerator(), point, std::move(updateCallback));
} else {
const auto maskGenerator = [&] {
return Ui::RippleAnimation::rectMask(
QSize(width(), _rowHeight));
};
row->addRipple(_st.item, maskGenerator, point, std::move(updateCallback));
}
}
}
if (anim::Disabled()) {
@@ -1779,7 +1789,11 @@ void PeerListContent::selectByMouse(QPoint globalPosition) {
auto in = parentWidget()->rect().contains(parentWidget()->mapFromGlobal(globalPosition));
auto selected = Selected();
auto rowsPointY = point.y() - rowsTop();
selected.index.value = (in && rowsPointY >= 0 && rowsPointY < shownRowsCount() * _rowHeight) ? (rowsPointY / _rowHeight) : -1;
selected.index.value = (in
&& rowsPointY >= 0
&& rowsPointY < shownRowsCount() * _rowHeight)
? (rowsPointY / _rowHeight)
: -1;
if (selected.index.value >= 0) {
const auto row = getRow(selected.index);
if (row->disabled()
@@ -1787,7 +1801,7 @@ void PeerListContent::selectByMouse(QPoint globalPosition) {
&& !_controller->customRowSelectionPoint(
row,
point.x(),
rowsPointY))) {
rowsPointY - (selected.index.value * _rowHeight)))) {
selected = Selected();
} else if (!customMode) {
if (getActiveActionRect(row, selected.index).contains(point)) {

View File

@@ -82,7 +82,7 @@ public:
return _id;
}
[[nodiscard]] std::shared_ptr<Data::CloudImageView> ensureUserpicView();
[[nodiscard]] std::shared_ptr<Data::CloudImageView> &ensureUserpicView();
[[nodiscard]] virtual QString generateName();
[[nodiscard]] virtual QString generateShortName();
@@ -172,12 +172,12 @@ public:
void finishCheckedAnimation();
void invalidatePixmapsCache();
template <typename UpdateCallback>
template <typename MaskGenerator, typename UpdateCallback>
void addRipple(
const style::PeerListItem &st,
QSize size,
MaskGenerator &&maskGenerator,
QPoint point,
UpdateCallback updateCallback);
UpdateCallback &&updateCallback);
void stopLastRipple();
void paintRipple(Painter &p, int x, int y, int outerWidth);
void paintUserpic(
@@ -451,21 +451,23 @@ public:
return false;
}
[[nodiscard]] virtual int customRowHeight() {
Unexpected("Unimplemented PeerListController::customRowHeight.");
Unexpected("PeerListController::customRowHeight.");
}
virtual void customRowPaint(
Painter &p,
crl::time now,
not_null<PeerListRow*> row,
bool selected) {
Unexpected("Unimplemented PeerListController::customRowPaint.");
Unexpected("PeerListController::customRowPaint.");
}
[[nodiscard]] virtual bool customRowSelectionPoint(
not_null<PeerListRow*> row,
int x,
int y) {
Unexpected(
"Unimplemented PeerListController::customRowSelectionPoint.");
Unexpected("PeerListController::customRowSelectionPoint.");
}
[[nodiscard]] virtual Fn<QImage()> customRowRippleMaskGenerator() {
Unexpected("PeerListController::customRowRippleMaskGenerator.");
}
[[nodiscard]] virtual rpl::producer<int> onlineCountValue() const;