mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-14 01:32:56 +02:00
Implement nice topic mode editing.
This commit is contained in:
parent
4c8ff1c7ec
commit
fdce4bada7
20 changed files with 373 additions and 33 deletions
BIN
Telegram/Resources/animations/edit_peers/topics.tgs
Normal file
BIN
Telegram/Resources/animations/edit_peers/topics.tgs
Normal file
Binary file not shown.
BIN
Telegram/Resources/animations/edit_peers/topics_list.tgs
Normal file
BIN
Telegram/Resources/animations/edit_peers/topics_list.tgs
Normal file
Binary file not shown.
BIN
Telegram/Resources/animations/edit_peers/topics_tabs.tgs
Normal file
BIN
Telegram/Resources/animations/edit_peers/topics_tabs.tgs
Normal file
Binary file not shown.
|
@ -3216,6 +3216,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_feature_transcribe" = "Voice-to-Text Conversion";
|
||||
"lng_feature_autotranslate" = "Autotranslation of Messages";
|
||||
|
||||
"lng_edit_topics_enable" = "Enable Topics";
|
||||
"lng_edit_topics_about" = "The group chat will be divided into topics created by admins or users.";
|
||||
"lng_edit_topics_layout" = "Topics layout";
|
||||
"lng_edit_topics_layout_about" = "Choose how topics appear for all members.";
|
||||
"lng_edit_topics_tabs" = "Tabs";
|
||||
"lng_edit_topics_list" = "List";
|
||||
|
||||
"lng_giveaway_new_title" = "Boosts via Gifts";
|
||||
"lng_giveaway_new_about" = "Get more boosts for your channel by gifting Premium to your subscribers.";
|
||||
"lng_giveaway_new_about_group" = "Get more boosts for your group by gifting Premium to your members.";
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
<file alias="hello_status.tgs">../../animations/hello_status.tgs</file>
|
||||
<file alias="starref_link.tgs">../../animations/starref_link.tgs</file>
|
||||
<file alias="media_forbidden.tgs">../../animations/media_forbidden.tgs</file>
|
||||
<file alias="topics.tgs">../../animations/edit_peers/topics.tgs</file>
|
||||
<file alias="topics_tabs.tgs">../../animations/edit_peers/topics_tabs.tgs</file>
|
||||
<file alias="topics_list.tgs">../../animations/edit_peers/topics_list.tgs</file>
|
||||
|
||||
<file alias="dice_idle.tgs">../../animations/dice/dice_idle.tgs</file>
|
||||
<file alias="dart_idle.tgs">../../animations/dice/dart_idle.tgs</file>
|
||||
|
|
|
@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/peers/edit_peer_requests_box.h"
|
||||
#include "boxes/peers/edit_peer_reactions.h"
|
||||
#include "boxes/peers/replace_boost_box.h"
|
||||
#include "boxes/peers/toggle_topics_box.h"
|
||||
#include "boxes/peers/verify_peers_box.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "boxes/edit_privacy_box.h" // EditDirectMessagesPriceBox
|
||||
|
@ -377,6 +378,7 @@ private:
|
|||
std::optional<QString> description;
|
||||
std::optional<bool> hiddenPreHistory;
|
||||
std::optional<bool> forum;
|
||||
std::optional<bool> forumTabs;
|
||||
std::optional<bool> autotranslate;
|
||||
std::optional<bool> signatures;
|
||||
std::optional<bool> signatureProfiles;
|
||||
|
@ -481,6 +483,7 @@ private:
|
|||
std::optional<HistoryVisibility> _historyVisibilitySavedValue;
|
||||
std::optional<EditPeerTypeData> _typeDataSavedValue;
|
||||
std::optional<bool> _forumSavedValue;
|
||||
std::optional<bool> _forumTabsSavedValue;
|
||||
std::optional<bool> _autotranslateSavedValue;
|
||||
std::optional<bool> _signaturesSavedValue;
|
||||
std::optional<bool> _signatureProfilesSavedValue;
|
||||
|
@ -1104,21 +1107,30 @@ void Controller::fillDirectMessagesButton() {
|
|||
void Controller::fillForumButton() {
|
||||
Expects(_controls.buttonsLayout != nullptr);
|
||||
|
||||
_forumSavedValue = _peer->isForum();
|
||||
_forumTabsSavedValue = !_peer->isChannel()
|
||||
|| !_peer->isForum()
|
||||
|| _peer->asChannel()->useSubsectionTabs();
|
||||
|
||||
const auto changes = std::make_shared<rpl::event_stream<>>();
|
||||
const auto label = [=] {
|
||||
return !*_forumSavedValue
|
||||
? tr::lng_manage_monoforum_off(tr::now)
|
||||
: *_forumTabsSavedValue
|
||||
? tr::lng_edit_topics_tabs(tr::now)
|
||||
: tr::lng_edit_topics_list(tr::now);
|
||||
};
|
||||
const auto button = _controls.forumToggle = _controls.buttonsLayout->add(
|
||||
EditPeerInfoBox::CreateButton(
|
||||
_controls.buttonsLayout,
|
||||
tr::lng_forum_topics_switch(),
|
||||
rpl::single(QString()),
|
||||
changes->events_starting_with({}) | rpl::map(label),
|
||||
[] {},
|
||||
st::manageGroupTopicsButton,
|
||||
{ &st::menuIconTopics }));
|
||||
const auto unlocks = std::make_shared<rpl::event_stream<bool>>();
|
||||
button->toggleOn(
|
||||
rpl::single(_peer->isForum()) | rpl::then(unlocks->events())
|
||||
)->toggledValue(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
if (_controls.forumToggleLocked && toggled) {
|
||||
unlocks->fire(false);
|
||||
|
||||
button->setClickedCallback(crl::guard(this, [=] {
|
||||
if (!*_forumSavedValue && _controls.forumToggleLocked) {
|
||||
if (_discussionLinkSavedValue && *_discussionLinkSavedValue) {
|
||||
ShowForumForDiscussionError(_navigation);
|
||||
} else {
|
||||
|
@ -1130,13 +1142,21 @@ void Controller::fillForumButton() {
|
|||
Ui::Text::RichLangValue));
|
||||
}
|
||||
} else {
|
||||
_forumSavedValue = toggled;
|
||||
if (toggled) {
|
||||
_savingData.hiddenPreHistory = false;
|
||||
}
|
||||
refreshHistoryVisibility();
|
||||
_navigation->uiShow()->show(Box(
|
||||
Ui::ToggleTopicsBox,
|
||||
*_forumSavedValue,
|
||||
*_forumTabsSavedValue,
|
||||
crl::guard(this, [=](bool topics, bool topicsTabs) {
|
||||
_forumSavedValue = topics;
|
||||
_forumTabsSavedValue = !topics || topicsTabs;
|
||||
if (topics) {
|
||||
_savingData.hiddenPreHistory = false;
|
||||
}
|
||||
changes->fire({});
|
||||
refreshHistoryVisibility();
|
||||
})));
|
||||
}
|
||||
}, _controls.buttonsLayout->lifetime());
|
||||
}));
|
||||
refreshForumToggleLocked();
|
||||
}
|
||||
|
||||
|
@ -2143,6 +2163,7 @@ bool Controller::validateForum(Saving &to) const {
|
|||
return true;
|
||||
}
|
||||
to.forum = _forumSavedValue;
|
||||
to.forumTabs = _forumTabsSavedValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2589,8 +2610,13 @@ void Controller::togglePreHistoryHidden(
|
|||
|
||||
void Controller::saveForum() {
|
||||
const auto channel = _peer->asChannel();
|
||||
const auto nowForum = _peer->isForum();
|
||||
const auto nowForumTabs = !channel
|
||||
|| !nowForum
|
||||
|| channel->useSubsectionTabs();
|
||||
if (!_savingData.forum
|
||||
|| *_savingData.forum == _peer->isForum()) {
|
||||
|| (*_savingData.forum == nowForum
|
||||
&& *_savingData.forumTabs == nowForumTabs)) {
|
||||
return continueSave();
|
||||
} else if (!channel) {
|
||||
const auto saveForChannel = [=](not_null<ChannelData*> channel) {
|
||||
|
@ -2608,7 +2634,7 @@ void Controller::saveForum() {
|
|||
_api.request(MTPchannels_ToggleForum(
|
||||
channel->inputChannel,
|
||||
MTP_bool(*_savingData.forum),
|
||||
MTP_bool(channel->flags() & ChannelDataFlag::ForumTabs)
|
||||
MTP_bool(*_savingData.forum && *_savingData.forumTabs)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
const auto weak = base::make_weak(this);
|
||||
channel->session().api().applyUpdates(result);
|
||||
|
|
226
Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp
Normal file
226
Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp
Normal file
|
@ -0,0 +1,226 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "boxes/peers/toggle_topics_box.h"
|
||||
|
||||
#include "lang/lang_keys.h"
|
||||
#include "lottie/lottie_icon.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/vertical_list.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace {
|
||||
|
||||
enum class LayoutType {
|
||||
Tabs,
|
||||
List
|
||||
};
|
||||
|
||||
class LayoutButton final : public Ui::RippleButton {
|
||||
public:
|
||||
LayoutButton(
|
||||
QWidget *parent,
|
||||
LayoutType type,
|
||||
std::shared_ptr<Ui::RadioenumGroup<LayoutType>> group);
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
QImage prepareRippleMask() const override;
|
||||
|
||||
Ui::FlatLabel _text;
|
||||
Ui::Animations::Simple _activeAnimation;
|
||||
bool _active = false;
|
||||
|
||||
};
|
||||
|
||||
LayoutButton::LayoutButton(
|
||||
QWidget *parent,
|
||||
LayoutType type,
|
||||
std::shared_ptr<Ui::RadioenumGroup<LayoutType>> group)
|
||||
: RippleButton(parent, st::defaultRippleAnimationBgOver)
|
||||
, _text(this, st::topicsLayoutButtonLabel)
|
||||
, _active(group->current() == type) {
|
||||
_text.setText(type == LayoutType::Tabs
|
||||
? tr::lng_edit_topics_tabs(tr::now)
|
||||
: tr::lng_edit_topics_list(tr::now));
|
||||
const auto iconColorOverride = [=] {
|
||||
return anim::color(
|
||||
st::windowSubTextFg,
|
||||
st::windowActiveTextFg,
|
||||
_activeAnimation.value(_active ? 1. : 0.));
|
||||
};
|
||||
const auto iconSize = st::topicsLayoutButtonIconSize;
|
||||
auto [iconWidget, iconAnimate] = Settings::CreateLottieIcon(
|
||||
this,
|
||||
{
|
||||
.name = (type == LayoutType::Tabs
|
||||
? u"topics_tabs"_q
|
||||
: u"topics_list"_q),
|
||||
.color = &st::windowSubTextFg,
|
||||
.sizeOverride = { iconSize, iconSize },
|
||||
.colorizeUsingAlpha = true,
|
||||
},
|
||||
st::topicsLayoutButtonIconPadding,
|
||||
iconColorOverride);
|
||||
const auto icon = iconWidget.release();
|
||||
setClickedCallback([=] {
|
||||
group->setValue(type);
|
||||
});
|
||||
group->value() | rpl::start_with_next([=](LayoutType value) {
|
||||
const auto active = (value == type);
|
||||
_text.setTextColorOverride(active
|
||||
? st::windowFgActive->c
|
||||
: std::optional<QColor>());
|
||||
|
||||
if (_active == active) {
|
||||
return;
|
||||
}
|
||||
_active = active;
|
||||
_text.update();
|
||||
if (_active) {
|
||||
iconAnimate(anim::repeat::once);
|
||||
}
|
||||
_activeAnimation.start([=] {
|
||||
icon->update();
|
||||
}, _active ? 0. : 1., _active ? 0. : 1., st::fadeWrapDuration);
|
||||
}, lifetime());
|
||||
|
||||
_text.paintRequest() | rpl::start_with_next([=](QRect clip) {
|
||||
if (_active) {
|
||||
auto p = QPainter(&_text);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
const auto radius = _text.height() / 2.;
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(st::windowBgActive);
|
||||
p.drawRoundedRect(_text.rect(), radius, radius);
|
||||
}
|
||||
}, _text.lifetime());
|
||||
|
||||
const auto padding = st::topicsLayoutButtonPadding;
|
||||
const auto skip = st::topicsLayoutButtonSkip;
|
||||
const auto text = _text.height();
|
||||
|
||||
resize(
|
||||
padding.left() + icon->width() + padding.right(),
|
||||
padding.top() + icon->height() + skip + text + padding.bottom());
|
||||
icon->move(padding.left(), padding.top());
|
||||
_text.move(
|
||||
(width() - _text.width()) / 2,
|
||||
padding.top() + icon->height() + skip);
|
||||
}
|
||||
|
||||
void LayoutButton::paintEvent(QPaintEvent *e) {
|
||||
auto p = QPainter(this);
|
||||
const auto rippleBg = anim::color(
|
||||
st::windowBgOver,
|
||||
st::lightButtonBgOver,
|
||||
_activeAnimation.value(_active ? 1. : 0.));
|
||||
paintRipple(p, QPoint(), &rippleBg);
|
||||
}
|
||||
|
||||
QImage LayoutButton::prepareRippleMask() const {
|
||||
return Ui::RippleAnimation::RoundRectMask(size(), st::boxRadius);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void ToggleTopicsBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
bool enabled,
|
||||
bool tabs,
|
||||
Fn<void(bool enabled, bool tabs)> callback) {
|
||||
box->setTitle(tr::lng_forum_topics_switch());
|
||||
box->setWidth(st::boxWideWidth);
|
||||
|
||||
const auto container = box->verticalLayout();
|
||||
|
||||
Settings::AddDividerTextWithLottie(container, {
|
||||
.lottie = u"topics"_q,
|
||||
.lottieSize = st::settingsFilterIconSize,
|
||||
.lottieMargins = st::settingsFilterIconPadding,
|
||||
.showFinished = box->showFinishes(),
|
||||
.about = tr::lng_edit_topics_about(
|
||||
Ui::Text::RichLangValue
|
||||
),
|
||||
.aboutMargins = st::settingsFilterDividerLabelPadding,
|
||||
});
|
||||
|
||||
Ui::AddSkip(container);
|
||||
|
||||
const auto toggle = container->add(
|
||||
object_ptr<Ui::SettingsButton>(
|
||||
container,
|
||||
tr::lng_edit_topics_enable(),
|
||||
st::settingsButtonNoIcon));
|
||||
toggle->toggleOn(rpl::single(enabled));
|
||||
|
||||
const auto group = std::make_shared<Ui::RadioenumGroup<LayoutType>>(tabs
|
||||
? LayoutType::Tabs
|
||||
: LayoutType::List);
|
||||
|
||||
const auto layoutWrap = container->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
container,
|
||||
object_ptr<Ui::VerticalLayout>(container)));
|
||||
const auto layout = layoutWrap->entity();
|
||||
|
||||
Ui::AddSubsectionTitle(layout, tr::lng_edit_topics_layout());
|
||||
const auto buttons = layout->add(
|
||||
object_ptr<Ui::RpWidget>(layout),
|
||||
QMargins(0, 0, 0, st::defaultVerticalListSkip * 2));
|
||||
|
||||
const auto tabsButton = Ui::CreateChild<LayoutButton>(
|
||||
buttons,
|
||||
LayoutType::Tabs,
|
||||
group);
|
||||
const auto listButton = Ui::CreateChild<LayoutButton>(
|
||||
buttons,
|
||||
LayoutType::List,
|
||||
group);
|
||||
|
||||
buttons->resize(container->width(), tabsButton->height());
|
||||
buttons->widthValue() | rpl::start_with_next([=](int outer) {
|
||||
const auto skip = st::boxRowPadding.left() - st::boxRadius;
|
||||
tabsButton->moveToLeft(skip, 0, outer);
|
||||
listButton->moveToRight(skip, 0, outer);
|
||||
}, buttons->lifetime());
|
||||
|
||||
Ui::AddDividerText(
|
||||
layout,
|
||||
tr::lng_edit_topics_layout_about(Ui::Text::RichLangValue));
|
||||
|
||||
layoutWrap->toggle(enabled, anim::type::instant);
|
||||
toggle->toggledChanges(
|
||||
) | rpl::start_with_next([=](bool checked) {
|
||||
layoutWrap->toggle(checked, anim::type::normal);
|
||||
}, layoutWrap->lifetime());
|
||||
|
||||
box->addButton(tr::lng_settings_save(), [=] {
|
||||
const auto enabledValue = toggle->toggled();
|
||||
const auto tabsValue = (group->current() == LayoutType::Tabs);
|
||||
callback(enabledValue, tabsValue);
|
||||
box->closeBox();
|
||||
});
|
||||
|
||||
box->addButton(tr::lng_cancel(), [=] {
|
||||
box->closeBox();
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Ui
|
20
Telegram/SourceFiles/boxes/peers/toggle_topics_box.h
Normal file
20
Telegram/SourceFiles/boxes/peers/toggle_topics_box.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/layers/generic_box.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
void ToggleTopicsBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
bool enabled,
|
||||
bool tabs,
|
||||
Fn<void(bool enabled, bool tabs)> callback);
|
||||
|
||||
} // namespace Ui
|
|
@ -410,7 +410,7 @@ void ChannelData::setPendingRequestsCount(
|
|||
|
||||
bool ChannelData::useSubsectionTabs() const {
|
||||
return isForum()
|
||||
&& ((flags() & ChannelDataFlag::ForumTabs) || true); AssertIsDebug();
|
||||
&& (flags() & ChannelDataFlag::ForumTabs);
|
||||
}
|
||||
|
||||
ChatRestrictionsInfo ChannelData::KickedRestrictedRights(
|
||||
|
|
|
@ -979,12 +979,13 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
|||
| Flag::CallNotEmpty
|
||||
| Flag::Forbidden
|
||||
| (!minimal
|
||||
? (Flag::Left | Flag::Creator | Flag::ForumTabs)
|
||||
? (Flag::Left | Flag::Creator)
|
||||
: Flag())
|
||||
| Flag::NoForwards
|
||||
| Flag::JoinToWrite
|
||||
| Flag::RequestToJoin
|
||||
| Flag::Forum
|
||||
| Flag::ForumTabs
|
||||
| ((!minimal && !data.is_stories_hidden_min())
|
||||
? Flag::StoriesHidden
|
||||
: Flag())
|
||||
|
@ -1016,8 +1017,7 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
|||
: Flag())
|
||||
| (!minimal
|
||||
? ((data.is_left() ? Flag::Left : Flag())
|
||||
| (data.is_creator() ? Flag::Creator : Flag())
|
||||
| (data.is_forum_tabs() ? Flag::ForumTabs : Flag()))
|
||||
| (data.is_creator() ? Flag::Creator : Flag()))
|
||||
: Flag())
|
||||
| (data.is_noforwards() ? Flag::NoForwards : Flag())
|
||||
| (data.is_join_to_send() ? Flag::JoinToWrite : Flag())
|
||||
|
@ -1025,6 +1025,7 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
|||
| ((data.is_forum() && data.is_megagroup())
|
||||
? Flag::Forum
|
||||
: Flag())
|
||||
| (data.is_forum_tabs() ? Flag::ForumTabs : Flag())
|
||||
| ((!minimal
|
||||
&& !data.is_stories_hidden_min()
|
||||
&& data.is_stories_hidden())
|
||||
|
|
|
@ -2623,6 +2623,7 @@ void HistoryWidget::showHistory(
|
|||
channel->flagsValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
refreshJoinChannelText();
|
||||
validateSubsectionTabs();
|
||||
}, _list->lifetime());
|
||||
} else {
|
||||
refreshJoinChannelText();
|
||||
|
@ -8245,8 +8246,18 @@ void HistoryWidget::showPremiumToast(not_null<DocumentData*> document) {
|
|||
|
||||
void HistoryWidget::validateSubsectionTabs() {
|
||||
if (!_history || !HistoryView::SubsectionTabs::UsedFor(_history)) {
|
||||
_subsectionTabsLifetime.destroy();
|
||||
_subsectionTabs = nullptr;
|
||||
if (_subsectionTabs) {
|
||||
_subsectionTabsLifetime.destroy();
|
||||
_subsectionTabs = nullptr;
|
||||
updateControlsGeometry();
|
||||
if (const auto forum = _history->asForum()) {
|
||||
controller()->showForum(forum, {
|
||||
Window::SectionShow::Way::Backward,
|
||||
anim::type::normal,
|
||||
anim::activation::background,
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else if (_subsectionTabs) {
|
||||
return;
|
||||
|
@ -8259,6 +8270,7 @@ void HistoryWidget::validateSubsectionTabs() {
|
|||
_history);
|
||||
}
|
||||
_subsectionTabs->removeRequests() | rpl::start_with_next([=] {
|
||||
_subsectionTabsLifetime.destroy();
|
||||
_subsectionTabs = nullptr;
|
||||
updateControlsGeometry();
|
||||
}, _subsectionTabsLifetime);
|
||||
|
|
|
@ -928,6 +928,7 @@ void ChatWidget::setupComposeControls() {
|
|||
channel->flagsValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
refreshJoinGroupButton();
|
||||
validateSubsectionTabs();
|
||||
}, lifetime());
|
||||
} else {
|
||||
refreshJoinGroupButton();
|
||||
|
@ -1522,8 +1523,18 @@ void ChatWidget::edit(
|
|||
|
||||
void ChatWidget::validateSubsectionTabs() {
|
||||
if (!HistoryView::SubsectionTabs::UsedFor(_history)) {
|
||||
_subsectionTabsLifetime.destroy();
|
||||
_subsectionTabs = nullptr;
|
||||
if (_subsectionTabs) {
|
||||
_subsectionTabsLifetime.destroy();
|
||||
_subsectionTabs = nullptr;
|
||||
updateControlsGeometry();
|
||||
if (const auto forum = _history->asForum()) {
|
||||
controller()->showForum(forum, {
|
||||
Window::SectionShow::Way::Backward,
|
||||
anim::type::normal,
|
||||
anim::activation::background,
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else if (_subsectionTabs) {
|
||||
return;
|
||||
|
@ -1537,6 +1548,7 @@ void ChatWidget::validateSubsectionTabs() {
|
|||
thread);
|
||||
}
|
||||
_subsectionTabs->removeRequests() | rpl::start_with_next([=] {
|
||||
_subsectionTabsLifetime.destroy();
|
||||
_subsectionTabs = nullptr;
|
||||
updateControlsGeometry();
|
||||
}, _subsectionTabsLifetime);
|
||||
|
|
|
@ -1177,3 +1177,13 @@ infoGiftTooltip: ImportantTooltip(defaultImportantTooltip) {
|
|||
padding: margins(8px, 2px, 8px, 3px);
|
||||
}
|
||||
infoGiftTooltipFont: font(11px semibold);
|
||||
|
||||
topicsLayoutButtonLabel: FlatLabel(defaultFlatLabel) {
|
||||
style: semiboldTextStyle;
|
||||
margin: margins(10px, 4px, 10px, 4px);
|
||||
textFg: windowSubTextFg;
|
||||
}
|
||||
topicsLayoutButtonIconPadding: margins(4px, 0px, 4px, 0px);
|
||||
topicsLayoutButtonIconSize: 140px;
|
||||
topicsLayoutButtonPadding: margins(4px, 0px, 4px, 12px);
|
||||
topicsLayoutButtonSkip: 0px;
|
||||
|
|
|
@ -957,4 +957,3 @@ void InnerWidget::showFinished() {
|
|||
}
|
||||
|
||||
} // namespace Info::Statistics
|
||||
|
||||
|
|
|
@ -2506,6 +2506,7 @@ channels.restrictSponsoredMessages#9ae91519 channel:InputChannel restricted:Bool
|
|||
channels.searchPosts#d19f987b hashtag:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
|
||||
channels.updatePaidMessagesPrice#4b12327b flags:# broadcast_messages_allowed:flags.0?true channel:InputChannel send_paid_messages_stars:long = Updates;
|
||||
channels.toggleAutotranslation#167fc0a1 channel:InputChannel enabled:Bool = Updates;
|
||||
channels.getMessageAuthor#ece2a0e6 channel:InputChannel id:int = User;
|
||||
|
||||
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
|
||||
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
|
||||
|
|
|
@ -242,7 +242,8 @@ void AddDividerTextWithLottie(
|
|||
LottieIcon CreateLottieIcon(
|
||||
not_null<QWidget*> parent,
|
||||
Lottie::IconDescriptor &&descriptor,
|
||||
style::margins padding) {
|
||||
style::margins padding,
|
||||
Fn<QColor()> colorOverride) {
|
||||
Expects(!descriptor.frame); // I'm not sure it considers limitFps.
|
||||
|
||||
descriptor.limitFps = true;
|
||||
|
@ -262,7 +263,9 @@ LottieIcon CreateLottieIcon(
|
|||
const auto looped = raw->lifetime().make_state<bool>(true);
|
||||
|
||||
const auto start = [=] {
|
||||
icon->animate([=] { raw->update(); }, 0, icon->framesCount() - 1);
|
||||
icon->animate([=] {
|
||||
raw->update();
|
||||
}, 0, icon->framesCount() - 1);
|
||||
};
|
||||
const auto animate = [=](anim::repeat repeat) {
|
||||
*looped = (repeat == anim::repeat::loop);
|
||||
|
@ -272,7 +275,9 @@ LottieIcon CreateLottieIcon(
|
|||
) | rpl::start_with_next([=] {
|
||||
auto p = QPainter(raw);
|
||||
const auto left = (raw->width() - width) / 2;
|
||||
icon->paint(p, left, padding.top());
|
||||
icon->paint(p, left, padding.top(), colorOverride
|
||||
? colorOverride()
|
||||
: std::optional<QColor>());
|
||||
if (!icon->animating() && icon->frameIndex() > 0 && *looped) {
|
||||
start();
|
||||
}
|
||||
|
|
|
@ -204,7 +204,8 @@ struct LottieIcon {
|
|||
[[nodiscard]] LottieIcon CreateLottieIcon(
|
||||
not_null<QWidget*> parent,
|
||||
Lottie::IconDescriptor &&descriptor,
|
||||
style::margins padding = {});
|
||||
style::margins padding = {},
|
||||
Fn<QColor()> colorOverride = nullptr);
|
||||
|
||||
struct SliderWithLabel {
|
||||
object_ptr<Ui::RpWidget> widget;
|
||||
|
|
|
@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_saved_sublist.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_file_origin.h"
|
||||
#include "data/data_flags.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
|
@ -1896,10 +1897,11 @@ void SessionController::showForum(
|
|||
if (_shownForum.current() != forum) {
|
||||
return;
|
||||
}
|
||||
forum->destroyed(
|
||||
) | rpl::start_with_next([=, history = forum->history()] {
|
||||
const auto history = forum->history();
|
||||
const auto closeAndShowHistory = [=](bool showOnlyIfEmpty) {
|
||||
const auto now = activeChatCurrent().owningHistory();
|
||||
const auto showHistory = !now || (now == history);
|
||||
const auto showHistory = !now
|
||||
|| (!showOnlyIfEmpty && (now == history));
|
||||
const auto weak = base::make_weak(this);
|
||||
closeForum();
|
||||
if (weak && showHistory) {
|
||||
|
@ -1909,6 +1911,19 @@ void SessionController::showForum(
|
|||
anim::activation::background,
|
||||
});
|
||||
}
|
||||
};
|
||||
forum->destroyed(
|
||||
) | rpl::start_with_next([=] {
|
||||
closeAndShowHistory(false);
|
||||
}, _shownForumLifetime);
|
||||
using FlagChange = Data::Flags<ChannelDataFlags>::Change;
|
||||
forum->channel()->flagsValue(
|
||||
) | rpl::start_with_next([=](FlagChange change) {
|
||||
if (change.diff & ChannelDataFlag::ForumTabs) {
|
||||
if (HistoryView::SubsectionTabs::UsedFor(history)) {
|
||||
closeAndShowHistory(true);
|
||||
}
|
||||
}
|
||||
}, _shownForumLifetime);
|
||||
content()->showForum(forum, params);
|
||||
closeMonoforum();
|
||||
|
|
|
@ -58,6 +58,8 @@ PRIVATE
|
|||
|
||||
boxes/peers/edit_peer_history_visibility_box.cpp
|
||||
boxes/peers/edit_peer_history_visibility_box.h
|
||||
boxes/peers/toggle_topics_box.cpp
|
||||
boxes/peers/toggle_topics_box.h
|
||||
|
||||
calls/group/ui/calls_group_recording_box.cpp
|
||||
calls/group/ui/calls_group_recording_box.h
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4038a11f635311073f6d55786490920b043cb319
|
||||
Subproject commit 4fc3ac0ea52f271cc9b108481f83d56fd76ab0ed
|
Loading…
Add table
Reference in a new issue