mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Move some group call modules.
This commit is contained in:
parent
c9d07cd0f8
commit
6e34360f7e
24 changed files with 168 additions and 71 deletions
|
@ -272,23 +272,25 @@ PRIVATE
|
|||
boxes/url_auth_box.h
|
||||
boxes/username_box.cpp
|
||||
boxes/username_box.h
|
||||
calls/group/calls_choose_join_as.cpp
|
||||
calls/group/calls_choose_join_as.h
|
||||
calls/group/calls_group_call.cpp
|
||||
calls/group/calls_group_call.h
|
||||
calls/group/calls_group_common.h
|
||||
calls/group/calls_group_members.cpp
|
||||
calls/group/calls_group_members.h
|
||||
calls/group/calls_group_menu.cpp
|
||||
calls/group/calls_group_menu.h
|
||||
calls/group/calls_group_panel.cpp
|
||||
calls/group/calls_group_panel.h
|
||||
calls/group/calls_group_settings.cpp
|
||||
calls/group/calls_group_settings.h
|
||||
calls/group/calls_volume_item.cpp
|
||||
calls/group/calls_volume_item.h
|
||||
calls/calls_box_controller.cpp
|
||||
calls/calls_box_controller.h
|
||||
calls/calls_call.cpp
|
||||
calls/calls_call.h
|
||||
calls/calls_choose_join_as.cpp
|
||||
calls/calls_choose_join_as.h
|
||||
calls/calls_group_call.cpp
|
||||
calls/calls_group_call.h
|
||||
calls/calls_group_common.h
|
||||
calls/calls_group_members.cpp
|
||||
calls/calls_group_members.h
|
||||
calls/calls_group_menu.cpp
|
||||
calls/calls_group_menu.h
|
||||
calls/calls_group_panel.cpp
|
||||
calls/calls_group_panel.h
|
||||
calls/calls_group_settings.cpp
|
||||
calls/calls_group_settings.h
|
||||
calls/calls_emoji_fingerprint.cpp
|
||||
calls/calls_emoji_fingerprint.h
|
||||
calls/calls_instance.cpp
|
||||
|
@ -303,8 +305,6 @@ PRIVATE
|
|||
calls/calls_userpic.h
|
||||
calls/calls_video_bubble.cpp
|
||||
calls/calls_video_bubble.h
|
||||
calls/calls_volume_item.cpp
|
||||
calls/calls_volume_item.h
|
||||
chat_helpers/bot_keyboard.cpp
|
||||
chat_helpers/bot_keyboard.h
|
||||
chat_helpers/emoji_keywords.cpp
|
||||
|
|
|
@ -741,6 +741,32 @@ PeerListContent::PeerListContent(
|
|||
_repaintByStatus.setCallback([this] { update(); });
|
||||
}
|
||||
|
||||
void PeerListContent::setMode(Mode mode) {
|
||||
if (mode == Mode::Default && _mode == Mode::Default) {
|
||||
return;
|
||||
}
|
||||
_mode = mode;
|
||||
switch (_mode) {
|
||||
case Mode::Default:
|
||||
_rowHeight = _st.item.height;
|
||||
break;
|
||||
case Mode::Custom:
|
||||
_rowHeight = _controller->customRowHeight();
|
||||
break;
|
||||
}
|
||||
const auto wasMouseSelection = _mouseSelection;
|
||||
const auto wasLastMousePosition = _lastMousePosition;
|
||||
_contextMenu = nullptr;
|
||||
if (wasMouseSelection) {
|
||||
setSelected(Selected());
|
||||
}
|
||||
setPressed(Selected());
|
||||
refreshRows();
|
||||
if (wasMouseSelection && wasLastMousePosition) {
|
||||
selectByMouse(*wasLastMousePosition);
|
||||
}
|
||||
}
|
||||
|
||||
void PeerListContent::appendRow(std::unique_ptr<PeerListRow> row) {
|
||||
Expects(row != nullptr);
|
||||
|
||||
|
@ -1080,25 +1106,25 @@ void PeerListContent::clearSearchRows() {
|
|||
void PeerListContent::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto clip = e->rect();
|
||||
const auto clip = e->rect();
|
||||
p.fillRect(clip, _st.item.button.textBg);
|
||||
|
||||
auto repaintByStatusAfter = _repaintByStatus.remainingTime();
|
||||
const auto repaintByStatusAfter = _repaintByStatus.remainingTime();
|
||||
auto repaintAfterMin = repaintByStatusAfter;
|
||||
|
||||
auto rowsTopCached = rowsTop();
|
||||
auto ms = crl::now();
|
||||
auto yFrom = clip.y() - rowsTopCached;
|
||||
auto yTo = clip.y() + clip.height() - rowsTopCached;
|
||||
const auto rowsTopCached = rowsTop();
|
||||
const auto now = crl::now();
|
||||
const auto yFrom = clip.y() - rowsTopCached;
|
||||
const auto yTo = clip.y() + clip.height() - rowsTopCached;
|
||||
p.translate(0, rowsTopCached);
|
||||
auto count = shownRowsCount();
|
||||
const auto count = shownRowsCount();
|
||||
if (count > 0) {
|
||||
auto from = floorclamp(yFrom, _rowHeight, 0, count);
|
||||
auto to = ceilclamp(yTo, _rowHeight, 0, count);
|
||||
const auto from = floorclamp(yFrom, _rowHeight, 0, count);
|
||||
const auto to = ceilclamp(yTo, _rowHeight, 0, count);
|
||||
p.translate(0, from * _rowHeight);
|
||||
for (auto index = from; index != to; ++index) {
|
||||
auto repaintAfter = paintRow(p, ms, RowIndex(index));
|
||||
if (repaintAfter >= 0
|
||||
const auto repaintAfter = paintRow(p, now, RowIndex(index));
|
||||
if (repaintAfter > 0
|
||||
&& (repaintAfterMin < 0
|
||||
|| repaintAfterMin > repaintAfter)) {
|
||||
repaintAfterMin = repaintAfter;
|
||||
|
@ -1307,7 +1333,7 @@ void PeerListContent::setPressed(Selected pressed) {
|
|||
|
||||
crl::time PeerListContent::paintRow(
|
||||
Painter &p,
|
||||
crl::time ms,
|
||||
crl::time now,
|
||||
RowIndex index) {
|
||||
const auto row = getRow(index);
|
||||
Assert(row != nullptr);
|
||||
|
@ -1315,13 +1341,15 @@ crl::time PeerListContent::paintRow(
|
|||
row->lazyInitialize(_st.item);
|
||||
|
||||
auto refreshStatusAt = row->refreshStatusTime();
|
||||
if (refreshStatusAt >= 0 && ms >= refreshStatusAt) {
|
||||
if (refreshStatusAt > 0 && now >= refreshStatusAt) {
|
||||
row->refreshStatus();
|
||||
refreshStatusAt = row->refreshStatusTime();
|
||||
}
|
||||
const auto refreshStatusIn = (refreshStatusAt > 0)
|
||||
? std::max(refreshStatusAt - now, crl::time(1))
|
||||
: 0;
|
||||
|
||||
const auto peer = row->special() ? nullptr : row->peer().get();
|
||||
const auto user = peer ? peer->asUser() : nullptr;
|
||||
const auto active = (_contexted.index.value >= 0)
|
||||
? _contexted
|
||||
: (_pressed.index.value >= 0)
|
||||
|
@ -1330,6 +1358,11 @@ crl::time PeerListContent::paintRow(
|
|||
const auto selected = (active.index == index);
|
||||
const auto actionSelected = (selected && active.action);
|
||||
|
||||
if (_mode == Mode::Custom) {
|
||||
_controller->customRowPaint(p, now, row, selected);
|
||||
return refreshStatusIn;
|
||||
}
|
||||
|
||||
const auto &bg = selected
|
||||
? _st.item.button.textBgOver
|
||||
: _st.item.button.textBg;
|
||||
|
@ -1412,7 +1445,7 @@ crl::time PeerListContent::paintRow(
|
|||
} else {
|
||||
row->paintStatusText(p, _st.item, _st.item.statusPosition.x(), _st.item.statusPosition.y(), statusw, width(), selected);
|
||||
}
|
||||
return (refreshStatusAt - ms);
|
||||
return refreshStatusIn;
|
||||
}
|
||||
|
||||
PeerListContent::SkipResult PeerListContent::selectSkip(int direction) {
|
||||
|
@ -1740,15 +1773,21 @@ void PeerListContent::selectByMouse(QPoint globalPosition) {
|
|||
_mouseSelection = true;
|
||||
_lastMousePosition = globalPosition;
|
||||
const auto point = mapFromGlobal(globalPosition);
|
||||
const auto customMode = (_mode == Mode::Custom);
|
||||
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;
|
||||
if (selected.index.value >= 0) {
|
||||
auto row = getRow(selected.index);
|
||||
if (row->disabled()) {
|
||||
const auto row = getRow(selected.index);
|
||||
if (row->disabled()
|
||||
|| (customMode
|
||||
&& !_controller->customRowSelectionPoint(
|
||||
row,
|
||||
point.x(),
|
||||
rowsPointY))) {
|
||||
selected = Selected();
|
||||
} else {
|
||||
} else if (!customMode) {
|
||||
if (getActiveActionRect(row, selected.index).contains(point)) {
|
||||
selected.action = true;
|
||||
}
|
||||
|
|
|
@ -450,6 +450,23 @@ public:
|
|||
[[nodiscard]] virtual bool respectSavedMessagesChat() const {
|
||||
return false;
|
||||
}
|
||||
[[nodiscard]] virtual int customRowHeight() {
|
||||
Unexpected("Unimplemented PeerListController::customRowHeight.");
|
||||
}
|
||||
virtual void customRowPaint(
|
||||
Painter &p,
|
||||
crl::time now,
|
||||
not_null<PeerListRow*> row,
|
||||
bool selected) {
|
||||
Unexpected("Unimplemented PeerListController::customRowPaint.");
|
||||
}
|
||||
[[nodiscard]] virtual bool customRowSelectionPoint(
|
||||
not_null<PeerListRow*> row,
|
||||
int x,
|
||||
int y) {
|
||||
Unexpected(
|
||||
"Unimplemented PeerListController::customRowSelectionPoint.");
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual rpl::producer<int> onlineCountValue() const;
|
||||
|
||||
|
@ -514,6 +531,12 @@ public:
|
|||
SkipResult selectSkip(int direction);
|
||||
void selectSkipPage(int height, int direction);
|
||||
|
||||
enum class Mode {
|
||||
Default,
|
||||
Custom,
|
||||
};
|
||||
void setMode(Mode mode);
|
||||
|
||||
[[nodiscard]] rpl::producer<int> selectedIndexValue() const;
|
||||
[[nodiscard]] bool hasSelection() const;
|
||||
[[nodiscard]] bool hasPressed() const;
|
||||
|
@ -658,7 +681,7 @@ private:
|
|||
QPoint globalPos,
|
||||
Fn<void(not_null<Ui::PopupMenu*>)> destroyed = nullptr);
|
||||
|
||||
crl::time paintRow(Painter &p, crl::time ms, RowIndex index);
|
||||
crl::time paintRow(Painter &p, crl::time now, RowIndex index);
|
||||
|
||||
void addRowEntry(not_null<PeerListRow*> row);
|
||||
void addToSearchIndex(not_null<PeerListRow*> row);
|
||||
|
@ -688,6 +711,7 @@ private:
|
|||
not_null<PeerListController*> _controller;
|
||||
PeerListSearchMode _searchMode = PeerListSearchMode::Disabled;
|
||||
|
||||
Mode _mode = Mode::Default;
|
||||
int _rowHeight = 0;
|
||||
int _visibleTop = 0;
|
||||
int _visibleBottom = 0;
|
||||
|
|
|
@ -1018,3 +1018,7 @@ groupCallCountdownTop: 52px;
|
|||
|
||||
desktopCaptureSourceSize: size(160px, 120px);
|
||||
desktopCaptureSourceSkip: 12px;
|
||||
|
||||
groupCallNarrowSkip: 9px;
|
||||
groupCallNarrowRowSkip: 8px;
|
||||
groupCallNarrowSize: size(90px, 90px);
|
||||
|
|
|
@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "calls/calls_instance.h"
|
||||
|
||||
#include "calls/calls_group_common.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "mtproto/mtproto_dh_utils.h"
|
||||
#include "core/application.h"
|
||||
#include "main/main_session.h"
|
||||
|
@ -15,10 +15,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "apiwrap.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "calls/group/calls_group_call.h"
|
||||
#include "calls/group/calls_group_panel.h"
|
||||
#include "calls/calls_call.h"
|
||||
#include "calls/calls_group_call.h"
|
||||
#include "calls/calls_panel.h"
|
||||
#include "calls/calls_group_panel.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_group_call.h"
|
||||
#include "data/data_channel.h"
|
||||
|
|
|
@ -9,8 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "mtproto/sender.h"
|
||||
#include "calls/calls_call.h"
|
||||
#include "calls/calls_group_call.h"
|
||||
#include "calls/calls_choose_join_as.h"
|
||||
#include "calls/group/calls_group_call.h"
|
||||
#include "calls/group/calls_choose_join_as.h"
|
||||
|
||||
namespace Platform {
|
||||
enum class PermissionType;
|
||||
|
|
|
@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "calls/calls_call.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "calls/calls_signal_bars.h"
|
||||
#include "calls/calls_group_menu.h" // Group::LeaveBox.
|
||||
#include "calls/group/calls_group_menu.h" // Group::LeaveBox.
|
||||
#include "history/view/history_view_group_call_tracker.h" // ContentByCall.
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_group_call.h"
|
||||
|
|
|
@ -5,10 +5,10 @@ the official desktop application for the Telegram messaging service.
|
|||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "calls/calls_choose_join_as.h"
|
||||
#include "calls/group/calls_choose_join_as.h"
|
||||
|
||||
#include "calls/calls_group_common.h"
|
||||
#include "calls/calls_group_menu.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "calls/group/calls_group_menu.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_channel.h"
|
|
@ -5,9 +5,9 @@ the official desktop application for the Telegram messaging service.
|
|||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "calls/calls_group_call.h"
|
||||
#include "calls/group/calls_group_call.h"
|
||||
|
||||
#include "calls/calls_group_common.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "main/main_session.h"
|
||||
#include "api/api_send_progress.h"
|
||||
#include "api/api_updates.h"
|
|
@ -5,12 +5,12 @@ the official desktop application for the Telegram messaging service.
|
|||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "calls/calls_group_members.h"
|
||||
#include "calls/group/calls_group_members.h"
|
||||
|
||||
#include "calls/calls_group_call.h"
|
||||
#include "calls/calls_group_common.h"
|
||||
#include "calls/calls_group_menu.h"
|
||||
#include "calls/calls_volume_item.h"
|
||||
#include "calls/group/calls_group_call.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "calls/group/calls_group_menu.h"
|
||||
#include "calls/group/calls_volume_item.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_user.h"
|
||||
|
@ -305,6 +305,17 @@ public:
|
|||
QRect rect,
|
||||
IconState state) override;
|
||||
|
||||
int customRowHeight() override;
|
||||
void customRowPaint(
|
||||
Painter &p,
|
||||
crl::time now,
|
||||
not_null<PeerListRow*> row,
|
||||
bool selected) override;
|
||||
bool customRowSelectionPoint(
|
||||
not_null<PeerListRow*> row,
|
||||
int x,
|
||||
int y) override;
|
||||
|
||||
private:
|
||||
[[nodiscard]] std::unique_ptr<Row> createRowForMe();
|
||||
[[nodiscard]] std::unique_ptr<Row> createRow(
|
||||
|
@ -1563,6 +1574,25 @@ void MembersController::rowPaintIcon(
|
|||
_inactiveCrossLine.paint(p, left, top, crossProgress, iconColor);
|
||||
}
|
||||
|
||||
int MembersController::customRowHeight() {
|
||||
return st::groupCallNarrowSize.height() + st::groupCallNarrowRowSkip;
|
||||
}
|
||||
|
||||
void MembersController::customRowPaint(
|
||||
Painter &p,
|
||||
crl::time now,
|
||||
not_null<PeerListRow*> row,
|
||||
bool selected) {
|
||||
const auto real = static_cast<Row*>(row.get());
|
||||
}
|
||||
|
||||
bool MembersController::customRowSelectionPoint(
|
||||
not_null<PeerListRow*> row,
|
||||
int x,
|
||||
int y) {
|
||||
return y < st::groupCallNarrowSize.height();
|
||||
}
|
||||
|
||||
auto MembersController::kickParticipantRequests() const
|
||||
-> rpl::producer<not_null<PeerData*>>{
|
||||
return _kickParticipantRequests.events();
|
|
@ -5,11 +5,11 @@ the official desktop application for the Telegram messaging service.
|
|||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "calls/calls_group_menu.h"
|
||||
#include "calls/group/calls_group_menu.h"
|
||||
|
||||
#include "calls/calls_group_call.h"
|
||||
#include "calls/calls_group_settings.h"
|
||||
#include "calls/calls_group_panel.h"
|
||||
#include "calls/group/calls_group_call.h"
|
||||
#include "calls/group/calls_group_settings.h"
|
||||
#include "calls/group/calls_group_panel.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_group_call.h"
|
||||
#include "info/profile/info_profile_values.h" // Info::Profile::NameValue.
|
|
@ -5,12 +5,12 @@ the official desktop application for the Telegram messaging service.
|
|||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "calls/calls_group_panel.h"
|
||||
#include "calls/group/calls_group_panel.h"
|
||||
|
||||
#include "calls/calls_group_common.h"
|
||||
#include "calls/calls_group_members.h"
|
||||
#include "calls/calls_group_settings.h"
|
||||
#include "calls/calls_group_menu.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "calls/group/calls_group_members.h"
|
||||
#include "calls/group/calls_group_settings.h"
|
||||
#include "calls/group/calls_group_menu.h"
|
||||
#include "calls/group/ui/desktop_capture_choose_source.h"
|
||||
#include "ui/platform/ui_platform_window_title.h"
|
||||
#include "ui/platform/ui_platform_utility.h"
|
|
@ -10,8 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/weak_ptr.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/object_ptr.h"
|
||||
#include "calls/calls_group_call.h"
|
||||
#include "calls/calls_choose_join_as.h"
|
||||
#include "calls/group/calls_group_call.h"
|
||||
#include "calls/group/calls_choose_join_as.h"
|
||||
#include "calls/group/ui/desktop_capture_choose_source.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "ui/rp_widget.h"
|
|
@ -5,13 +5,13 @@ the official desktop application for the Telegram messaging service.
|
|||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "calls/calls_group_settings.h"
|
||||
#include "calls/group/calls_group_settings.h"
|
||||
|
||||
#include "calls/calls_group_call.h"
|
||||
#include "calls/calls_group_menu.h" // LeaveBox.
|
||||
#include "calls/calls_group_common.h"
|
||||
#include "calls/group/calls_group_call.h"
|
||||
#include "calls/group/calls_group_menu.h" // LeaveBox.
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "calls/group/calls_choose_join_as.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "calls/calls_choose_join_as.h"
|
||||
#include "ui/widgets/level_meter.h"
|
||||
#include "ui/widgets/continuous_sliders.h"
|
||||
#include "ui/widgets/buttons.h"
|
|
@ -5,9 +5,9 @@ the official desktop application for the Telegram messaging service.
|
|||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "calls/calls_volume_item.h"
|
||||
#include "calls/group/calls_volume_item.h"
|
||||
|
||||
#include "calls/calls_group_common.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "ui/effects/animation_value.h"
|
||||
#include "ui/effects/cross_line.h"
|
||||
#include "ui/widgets/continuous_sliders.h"
|
|
@ -14,8 +14,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_session.h"
|
||||
#include "main/main_session.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "calls/calls_group_call.h"
|
||||
#include "calls/calls_group_common.h"
|
||||
#include "calls/group/calls_group_call.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "core/application.h"
|
||||
#include "apiwrap.h"
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/chat/group_call_bar.h"
|
||||
#include "ui/chat/group_call_userpics.h"
|
||||
#include "ui/painter.h"
|
||||
#include "calls/calls_group_call.h"
|
||||
#include "calls/group/calls_group_call.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "core/application.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
|
Loading…
Add table
Reference in a new issue