Compare commits

...

6 Commits

27 changed files with 169 additions and 90 deletions

View File

@ -546,7 +546,7 @@ rightsToggle: Toggle(defaultToggle) {
vsize: 5px;
vshift: 1px;
stroke: 2px;
duration: 120;
duration: universalDuration;
}
rightsButton: SettingsButton(defaultSettingsButton) {

View File

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "api/api_user_names.h"
#include "main/main_session.h"
#include "ui/boxes/confirm_box.h"
#include "base/event_filter.h"
#include "boxes/peers/edit_participants_box.h"
#include "boxes/peers/edit_peer_color_box.h"
#include "boxes/peers/edit_peer_common.h"
@ -27,6 +28,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/stickers_box.h"
#include "boxes/username_box.h"
#include "chat_helpers/emoji_suggestions_widget.h"
#include "chat_helpers/tabbed_panel.h"
#include "chat_helpers/tabbed_selector.h"
#include "core/application.h"
#include "core/core_settings.h"
#include "data/data_channel.h"
@ -47,6 +50,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_app_config.h"
#include "settings/settings_common.h"
#include "ui/boxes/boost_box.h"
#include "ui/controls/emoji_button.h"
#include "ui/controls/userpic_button.h"
#include "ui/rp_widget.h"
#include "ui/vertical_list.h"
@ -61,6 +65,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/vertical_layout.h"
#include "window/window_session_controller.h"
#include "api/api_invite_links.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_layers.h"
#include "styles/style_menu_icons.h"
#include "styles/style_boxes.h"
@ -533,7 +538,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
_wrap,
object_ptr<Ui::InputField>(
_wrap,
st::defaultInputField,
st::editPeerTitleField,
(_isBot
? tr::lng_dlg_new_bot_name
: _isGroup
@ -555,6 +560,76 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
submitTitle();
}, result->entity()->lifetime());
{
const auto field = result->entity();
const auto container = _box->getDelegate()->outerContainer();
using Selector = ChatHelpers::TabbedSelector;
using PanelPtr = base::unique_qptr<ChatHelpers::TabbedPanel>;
const auto emojiPanelPtr = field->lifetime().make_state<PanelPtr>(
base::make_unique_q<ChatHelpers::TabbedPanel>(
container,
ChatHelpers::TabbedPanelDescriptor{
.ownedSelector = object_ptr<Selector>(
nullptr,
ChatHelpers::TabbedSelectorDescriptor{
.show = _navigation->uiShow(),
.st = st::defaultComposeControls.tabbed,
.level = Window::GifPauseReason::Layer,
.mode = Selector::Mode::PeerTitle,
}),
}));
const auto emojiPanel = emojiPanelPtr->get();
emojiPanel->setDesiredHeightValues(
1.,
st::emojiPanMinHeight / 2,
st::emojiPanMinHeight);
emojiPanel->hide();
emojiPanel->selector()->setCurrentPeer(_peer);
emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji);
field->setFocus();
}, field->lifetime());
emojiPanel->setDropDown(true);
const auto emojiToggle = Ui::CreateChild<Ui::EmojiButton>(
field,
st::defaultComposeControls.files.emoji);
emojiToggle->show();
emojiToggle->installEventFilter(emojiPanel);
emojiToggle->addClickHandler([=] { emojiPanel->toggleAnimated(); });
const auto updateEmojiPanelGeometry = [=] {
const auto parent = emojiPanel->parentWidget();
const auto global = emojiToggle->mapToGlobal({ 0, 0 });
const auto local = parent->mapFromGlobal(global);
emojiPanel->moveTopRight(
local.y() + emojiToggle->height(),
local.x() + emojiToggle->width() * 3);
};
base::install_event_filter(container, [=](not_null<QEvent*> event) {
const auto type = event->type();
if (type == QEvent::Move || type == QEvent::Resize) {
crl::on_main(field, [=] { updateEmojiPanelGeometry(); });
}
return base::EventFilterResult::Continue;
});
field->widthValue() | rpl::start_with_next([=](int width) {
const auto &p = st::editPeerTitleEmojiPosition;
emojiToggle->moveToRight(p.x(), p.y(), width);
updateEmojiPanelGeometry();
}, emojiToggle->lifetime());
base::install_event_filter(emojiToggle, [=](not_null<QEvent*> event) {
if (event->type() == QEvent::Enter) {
updateEmojiPanelGeometry();
}
return base::EventFilterResult::Continue;
});
}
_controls.title = result->entity();
return result;
}

View File

@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "boxes/abstract_box.h"
#include "base/timer.h"
#include "styles/style_basic.h"
#include "styles/style_calls.h"
#include "styles/style_chat_helpers.h" // style::GroupCallUserpics
#include "styles/style_layers.h"
@ -49,7 +50,6 @@ enum class BarState {
namespace {
constexpr auto kUpdateDebugTimeoutMs = crl::time(500);
constexpr auto kSwitchStateDuration = 120;
constexpr auto kMinorBlobAlpha = 76. / 255.;
@ -374,7 +374,7 @@ void TopBar::initControls() {
};
_switchStateAnimation.stop();
const auto duration = (to - from) * kSwitchStateDuration;
const auto duration = (to - from) * st::universalDuration;
_switchStateAnimation.start(
_switchStateCallback,
from,

View File

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/checkbox.h"
#include "ui/widgets/fields/input_field.h"
#include "ui/widgets/labels.h"
#include "styles/style_basic.h"
#include "styles/style_calls.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
@ -26,7 +27,6 @@ namespace {
constexpr auto kRoundRadius = 9;
constexpr auto kMaxGroupCallLength = 40;
constexpr auto kSwitchDuration = 200;
constexpr auto kSelectDuration = 120;
class GraphicButton final : public Ui::AbstractButton {
public:
@ -103,7 +103,7 @@ void GraphicButton::setToggled(bool value) {
[=] { update(); },
_toggled ? 0. : 1.,
_toggled ? 1. : 0.,
kSelectDuration);
st::universalDuration);
}
void GraphicButton::paintEvent(QPaintEvent *e) {

View File

@ -1108,8 +1108,6 @@ historyRecordVoiceFgOver: historyComposeIconFgOver;
historyRecordVoiceFgInactive: attentionButtonFg;
historyRecordVoiceFgActive: windowBgActive;
historyRecordVoiceFgActiveIcon: windowFgActive;
historyRecordVoiceShowDuration: 120;
historyRecordVoiceDuration: 120;
historyRecordVoice: icon {{ "chat/input_record", historyRecordVoiceFg }};
historyRecordVoiceOver: icon {{ "chat/input_record", historyRecordVoiceFgOver }};
historyRecordVoiceOnceBg: icon {{ "voice_lock/audio_once_bg", historySendIconFg }};

View File

@ -468,7 +468,8 @@ EmojiListWidget::EmojiListWidget(
std::move(descriptor.paused))
, _show(std::move(descriptor.show))
, _features(descriptor.features)
, _mode(descriptor.mode)
, _onlyUnicodeEmoji(descriptor.mode == Mode::PeerTitle)
, _mode(_onlyUnicodeEmoji ? Mode::Full : descriptor.mode)
, _api(&session().mtp())
, _staticCount(_mode == Mode::Full ? kEmojiSectionCount : 1)
, _premiumIcon(_mode == Mode::EmojiStatus
@ -490,7 +491,8 @@ EmojiListWidget::EmojiListWidget(
if (_mode != Mode::RecentReactions
&& _mode != Mode::BackgroundEmoji
&& _mode != Mode::ChannelStatus) {
&& _mode != Mode::ChannelStatus
&& !_onlyUnicodeEmoji) {
setupSearch();
}
@ -1052,7 +1054,7 @@ void EmojiListWidget::fillRecent() {
const auto test = session().isTestMode();
for (const auto &one : list) {
const auto document = std::get_if<RecentEmojiDocument>(&one.id.data);
if (document && document->test != test) {
if (document && ((document->test != test) || _onlyUnicodeEmoji)) {
continue;
}
_recent.push_back({
@ -2129,7 +2131,9 @@ void EmojiListWidget::refreshCustom() {
auto old = base::take(_custom);
const auto session = &this->session();
const auto premiumPossible = session->premiumPossible();
const auto premiumMayBeBought = premiumPossible
const auto onlyUnicodeEmoji = _onlyUnicodeEmoji || !premiumPossible;
const auto premiumMayBeBought = (!onlyUnicodeEmoji)
&& premiumPossible
&& !session->premium()
&& !_allowWithoutPremium;
const auto owner = &session->data();
@ -2189,7 +2193,7 @@ void EmojiListWidget::refreshCustom() {
}
return true;
}();
if (premium && !premiumPossible) {
if (premium && onlyUnicodeEmoji) {
return;
} else if (valid) {
i->thumbnailDocument = it->second->lookupThumbnailDocument();
@ -2223,7 +2227,7 @@ void EmojiListWidget::refreshCustom() {
}
}
}
if (premium && !premiumPossible) {
if (premium && onlyUnicodeEmoji) {
return;
}
_custom.push_back({

View File

@ -76,6 +76,7 @@ enum class EmojiListMode {
RecentReactions,
UserpicBuilder,
BackgroundEmoji,
PeerTitle,
};
struct EmojiListDescriptor {
@ -379,6 +380,7 @@ private:
const std::shared_ptr<Show> _show;
const ComposeFeatures _features;
const bool _onlyUnicodeEmoji;
Mode _mode = Mode::Full;
std::unique_ptr<Ui::TabbedSearch> _search;
MTP::Sender _api;

View File

@ -38,7 +38,6 @@ namespace {
constexpr auto kShowExactDelay = crl::time(300);
constexpr auto kMaxNonScrolledEmoji = 7;
constexpr auto kAnimationDuration = crl::time(120);
} // namespace
@ -528,7 +527,7 @@ void SuggestionsWidget::setSelected(int selected, anim::type animated) {
[=] { update(); },
_selected,
selected,
kAnimationDuration,
st::universalDuration,
anim::sineInOut);
if (_scrollMax > 0) {
const auto selectedMax = int(_rows.size()) - 3;
@ -560,7 +559,7 @@ void SuggestionsWidget::scrollTo(int value, anim::type animated) {
[=] { update(); },
_scrollValue,
value,
kAnimationDuration,
st::universalDuration,
anim::sineInOut);
}
_scrollValue = value;

View File

@ -540,6 +540,8 @@ TabbedSelector::Tab TabbedSelector::createTab(SelectorTab type, int index) {
? EmojiMode::FullReactions
: _mode == Mode::RecentReactions
? EmojiMode::RecentReactions
: _mode == Mode::PeerTitle
? EmojiMode::PeerTitle
: EmojiMode::Full),
.customTextColor = _customTextColor,
.paused = paused,
@ -958,6 +960,9 @@ void TabbedSelector::beforeHiding() {
_beforeHidingCallback(_currentTabType);
}
}
if (Ui::InFocusChain(this)) {
window()->setFocus();
}
}
void TabbedSelector::afterShown() {

View File

@ -86,6 +86,7 @@ enum class TabbedSelectorMode {
BackgroundEmoji,
FullReactions,
RecentReactions,
PeerTitle,
};
struct TabbedSelectorDescriptor {

View File

@ -116,7 +116,7 @@ dialogsSpeakingDenominator: 8.;
dialogsImportantBarHeight: 37px;
dialogsWidthDuration: 120;
dialogsWidthDuration: universalDuration;
dialogsTextWidthMin: 150px;
dialogsTextPalette: TextPalette(defaultTextPalette) {

View File

@ -290,7 +290,10 @@ RecentRow::RecentRow(not_null<PeerData*> peer)
} else if (const auto chat = peer->asChat()) {
if (chat->count > 0) {
setCustomStatus(
tr::lng_chat_status_members(tr::now, lt_count, chat->count));
tr::lng_chat_status_members(
tr::now,
lt_count_decimal,
chat->count));
}
} else if (const auto channel = peer->asChannel()) {
if (channel->membersCountKnown()) {
@ -298,7 +301,7 @@ RecentRow::RecentRow(not_null<PeerData*> peer)
? tr::lng_chat_status_subscribers
: tr::lng_chat_status_members)(
tr::now,
lt_count,
lt_count_decimal,
channel->membersCount()));
}
}
@ -655,7 +658,7 @@ void MyChannelsController::appendRow(not_null<ChannelData*> channel) {
? tr::lng_chat_status_subscribers
: tr::lng_chat_status_members)(
tr::now,
lt_count,
lt_count_decimal,
channel->membersCount()));
}
delegate()->peerListAppendRow(std::move(row));
@ -819,7 +822,7 @@ void RecommendationsController::appendRow(not_null<ChannelData*> channel) {
? tr::lng_chat_status_subscribers
: tr::lng_chat_status_members)(
tr::now,
lt_count,
lt_count_decimal,
channel->membersCount()));
}
delegate()->peerListAppendRow(std::move(row));

View File

@ -302,7 +302,7 @@ TTLButton::TTLButton(
[=] { update(); },
isActive ? 0. : 1.,
isActive ? 1. : 0.,
st::historyRecordVoiceShowDuration);
st::universalDuration);
});
Ui::RpWidget::shownValue() | rpl::start_with_next([=](bool shown) {
@ -1058,9 +1058,11 @@ void RecordLock::drawProgress(QPainter &p) {
}
void RecordLock::startLockingAnimation(float64 to) {
auto callback = [=](float64 value) { setProgress(value); };
const auto &duration = st::historyRecordVoiceShowDuration;
_lockEnderAnimation.start(std::move(callback), 0., to, duration);
_lockEnderAnimation.start(
[=](float64 value) { setProgress(value); },
0.,
to,
st::universalDuration);
}
void RecordLock::requestPaintProgress(float64 progress) {
@ -1453,7 +1455,7 @@ void VoiceRecordBar::init() {
if (!value) {
_listen = nullptr;
}
}, 1., 0., st::historyRecordVoiceShowDuration * 2);
}, 1., 0., st::universalDuration * 2);
setLevelAsSend();
return;
@ -1473,7 +1475,6 @@ void VoiceRecordBar::init() {
// _lockShowing = false;
const auto to = 1.;
const auto &duration = st::historyRecordVoiceShowDuration;
auto callback = [=](float64 value) {
paintShowListenCallback(value);
if (to == value) {
@ -1481,7 +1482,11 @@ void VoiceRecordBar::init() {
}
};
_showListenAnimation.stop();
_showListenAnimation.start(std::move(callback), 0., to, duration);
_showListenAnimation.start(
std::move(callback),
0.,
to,
st::universalDuration);
}, lifetime());
_lock->locks(
@ -1498,15 +1503,16 @@ void VoiceRecordBar::init() {
setLevelAsSend();
const auto &duration = st::historyRecordVoiceShowDuration;
const auto from = 0.;
const auto to = 1.;
auto callback = [=](float64 value) {
_lock->requestPaintLockToStopProgress(value);
update();
updateTTLGeometry(TTLAnimationType::RightLeft, value);
};
_lockToStopAnimation.start(std::move(callback), from, to, duration);
_lockToStopAnimation.start(
std::move(callback),
0.,
1.,
st::universalDuration);
}, lifetime());
_send->events(
@ -1523,7 +1529,7 @@ void VoiceRecordBar::init() {
return;
}
_recordingTipRequired = true;
_startTimer.callOnce(st::historyRecordVoiceShowDuration);
_startTimer.callOnce(st::universalDuration);
} else if (e->type() == QEvent::MouseButtonRelease) {
if (base::take(_recordingTipRequired)) {
_recordingTipRequests.fire({});
@ -1556,23 +1562,24 @@ void VoiceRecordBar::init() {
void VoiceRecordBar::activeAnimate(bool active) {
const auto to = active ? 1. : 0.;
const auto &duration = st::historyRecordVoiceDuration;
if (_activeAnimation.animating()) {
_activeAnimation.change(to, duration);
_activeAnimation.change(to, st::universalDuration);
} else {
auto callback = [=] {
update(_messageRect);
_level->requestPaintColor(activeAnimationRatio());
};
const auto from = active ? 0. : 1.;
_activeAnimation.start(std::move(callback), from, to, duration);
_activeAnimation.start(
std::move(callback),
active ? 0. : 1.,
to,
st::universalDuration);
}
}
void VoiceRecordBar::visibilityAnimate(bool show, Fn<void()> &&callback) {
const auto to = show ? 1. : 0.;
const auto from = show ? 0. : 1.;
const auto &duration = st::historyRecordVoiceShowDuration;
auto animationCallback = [=, callback = std::move(callback)](auto value) {
if (!_listen) {
_level->requestPaintProgress(value);
@ -1589,7 +1596,11 @@ void VoiceRecordBar::visibilityAnimate(bool show, Fn<void()> &&callback) {
}
}
};
_showAnimation.start(std::move(animationCallback), from, to, duration);
_showAnimation.start(
std::move(animationCallback),
from,
to,
st::universalDuration);
}
void VoiceRecordBar::setStartRecordingFilter(FilterCallback &&callback) {

View File

@ -196,8 +196,8 @@ void VoiceRecordButton::init() {
}
update();
};
const auto duration = st::historyRecordVoiceDuration * 2;
_stateChangedAnimation.start(std::move(callback), 0., to, duration);
constexpr auto kDuration = st::universalDuration * 2;
_stateChangedAnimation.start(std::move(callback), 0., to, kDuration);
}, lifetime());
}

View File

@ -548,8 +548,6 @@ QSize WebPage::countCurrentSize(int newWidth) {
const auto twoTitleLines = 2 * st::webPageTitleFont->height;
const auto descriptionLineHeight = st::webPageDescriptionFont->height;
if (asArticle() || specialRightPix) {
const auto sponsoredUserpic = (_sponsoredData
&& _sponsoredData->peer);
constexpr auto kSponsoredUserpicLines = 2;
_pixh = lineHeight
* (_stickerSet
@ -576,8 +574,7 @@ QSize WebPage::countCurrentSize(int newWidth) {
newHeight += _titleLines * lineHeight;
}
const auto descriptionHeight = _description.countHeight(
sponsoredUserpic ? innerWidth : wleft);
const auto descriptionHeight = _description.countHeight(wleft);
const auto restLines = (linesMax - _siteNameLines - _titleLines);
if (descriptionHeight < restLines * descriptionLineHeight) {
// We have height for all the lines.
@ -677,7 +674,6 @@ void WebPage::ensurePhotoMediaCreated() const {
bool WebPage::hasHeavyPart() const {
return _photoMedia
|| (_sponsoredData && !_sponsoredData->userpicView.null())
|| (_stickerSet)
|| (_attach ? _attach->hasHeavyPart() : false);
}
@ -688,9 +684,6 @@ void WebPage::unloadHeavyPart() {
}
_description.unloadPersistentAnimation();
_photoMedia = nullptr;
if (_sponsoredData) {
_sponsoredData->userpicView = Ui::PeerUserpicView();
}
}
void WebPage::draw(Painter &p, const PaintContext &context) const {
@ -834,21 +827,6 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
// as its width only affects the title.
paintw -= pw + st::webPagePhotoDelta;
}
} else if (asSponsored && _sponsoredData->peer) {
const auto size = _pixh;
const auto sizeHq = size * style::DevicePixelRatio();
const auto userpicPos = QPoint(inner.left() + paintw - size, tshift);
const auto &peer = _sponsoredData->peer;
auto &view = _sponsoredData->userpicView;
if (const auto cloud = peer->userpicCloudImage(view)) {
Ui::ValidateUserpicCache(view, cloud, nullptr, sizeHq, true);
p.drawImage(QRect(userpicPos, QSize(size, size)), view.cached);
} else {
const auto r = sizeHq * Ui::ForumUserpicRadiusMultiplier();
const auto empty = peer->generateUserpicImage(view, sizeHq, r);
p.drawImage(QRect(userpicPos, QSize(size, size)), empty);
}
// paintw -= size + st::webPagePhotoDelta;
}
if (_siteNameLines) {
p.setPen(cache->icon);

View File

@ -139,8 +139,6 @@ private:
std::unique_ptr<StickerSet> _stickerSet;
struct SponsoredData final {
PeerData *peer = nullptr;
Ui::PeerUserpicView userpicView;
QString buttonText;
bool isLinkInternal = false;

View File

@ -722,6 +722,10 @@ editPeerHistoryVisibilityTopSkip: 8px;
editPeerPhotoMargins: margins(22px, 8px, 22px, 8px);
editPeerTitle: defaultInputField;
editPeerTitleMargins: margins(27px, 13px, 22px, 8px);
editPeerTitleEmojiPosition: point(0px, 23px);
editPeerTitleField: InputField(defaultInputField) {
textMargins: margins(0px, 28px, 30px, 4px);
}
editPeerDescription: InputField(defaultInputField) {
textBg: transparent;
textMargins: margins(0px, 7px, 0px, 7px);

View File

@ -58,7 +58,16 @@ void PickUntilBox(not_null<Ui::GenericBox*> box, Fn<void(TimeId)> callback) {
EmojiStatusPanel::EmojiStatusPanel() = default;
EmojiStatusPanel::~EmojiStatusPanel() = default;
EmojiStatusPanel::~EmojiStatusPanel() {
if (hasFocus()) {
// Panel will try to return focus to the layer widget, the problem is
// we are destroying the layer widget probably right now and focusing
// it will lead to a crash, because it destroys its children (how we
// got here) after it clears focus out of itself. So if you return
// the focus inside a child destructor, it won't be cleared at all.
_panel->window()->setFocus();
}
}
void EmojiStatusPanel::setChooseFilter(Fn<bool(DocumentId)> filter) {
_chooseFilter = std::move(filter);

View File

@ -66,5 +66,3 @@ userpicBuilderEmojiColorPlus: IconButton(userpicBuilderEmojiColorMinus) {
}
userpicBuilderEmojiToggleStickersIcon: icon {{ "menu/stickers", emojiIconFg }};
userpicBuilderEmojiSlideDuration: 120;

View File

@ -137,7 +137,7 @@ void ColorsLine::fillButtons() {
wasChosen->setSelectedProgress(1. - progress);
}
nowChosen->setSelectedProgress(progress);
}, 0., 1., st::userpicBuilderEmojiSlideDuration);
}, 0., 1., st::universalDuration);
});
if (i < _colors->size()) {
button->setBrush((*_colors)[i]);
@ -164,7 +164,7 @@ void ColorsLine::fillButtons() {
setLastChosen();
});
for (const auto &wrap : _wraps) {
wrap->setDuration(st::userpicBuilderEmojiSlideDuration);
wrap->setDuration(st::universalDuration);
}
}
@ -213,7 +213,7 @@ void ColorsLine::processChange(
const auto left = anim::interpolate(wasLeft, nowLeft, value);
_wraps[i]->moveToLeft(left, 0);
}
}, 0., 1., st::userpicBuilderEmojiSlideDuration);
}, 0., 1., st::universalDuration);
}
void ColorsLine::setLastChosen() const {

View File

@ -493,7 +493,7 @@ not_null<Ui::VerticalLayout*> CreateUserpicBuilder(
1. - progress);
}
state->circleButtons[now]->setSelectedProgress(progress);
}, 0., 1., st::userpicBuilderEmojiSlideDuration);
}, 0., 1., st::universalDuration);
state->colorIndex = now;
const auto result = isSpecial

View File

@ -119,7 +119,6 @@ introCodeDigitFont: font(20px);
introCodeDigitHeight: 50px;
introCodeDigitBorderWidth: 4px;
introCodeDigitSkip: 10px;
introCodeDigitAnimatioDuration: 120;
introPasswordHint: FlatLabel(introDescription) {
textFg: windowFg;

View File

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/painter.h"
#include "ui/rect.h"
#include "ui/widgets/popup_menu.h"
#include "styles/style_basic.h"
#include "styles/style_intro.h"
#include "styles/style_layers.h" // boxRadius
@ -91,7 +92,6 @@ void CodeDigit::setDigit(int digit) {
}
_dataDigit = digit;
if (_viewDigit != digit) {
constexpr auto kDuration = st::introCodeDigitAnimatioDuration;
_animation.stop();
if (digit == kDigitNone) {
_animation.start([=](float64 value) {
@ -99,10 +99,10 @@ void CodeDigit::setDigit(int digit) {
if (!value) {
_viewDigit = digit;
}
}, 1., 0., kDuration);
}, 1., 0., st::universalDuration);
} else {
_viewDigit = digit;
_animation.start([=] { update(); }, 0., 1., kDuration);
_animation.start([=] { update(); }, 0, 1., st::universalDuration);
}
}
}

View File

@ -2644,6 +2644,10 @@ bool MainWidget::eventFilter(QObject *o, QEvent *e) {
if (e->type() == QEvent::FocusIn) {
if (widget && relevantForDialogsFocus(widget)) {
_dialogs->updateHasFocus(widget);
} else if (widget == window()) {
crl::on_main(this, [=] {
_controller->widget()->setInnerFocus();
});
}
} else if (e->type() == QEvent::MouseButtonPress) {
if (widget && (widget->window() == window())) {

View File

@ -165,16 +165,7 @@ Cover::Cover(
}, _name->lifetime());
}
Cover::~Cover() {
if (_emojiStatusPanel.hasFocus()) {
// Panel will try to return focus to the layer widget, the problem is
// we are destroying the layer widget probably right now and focusing
// it will lead to a crash, because it destroys its children (how we
// got here) after it clears focus out of itself. So if you return
// the focus inside a child destructor, it won't be cleared at all.
window()->setFocus();
}
}
Cover::~Cover() = default;
void Cover::setupChildGeometry() {
using namespace rpl::mappers;

View File

@ -632,7 +632,7 @@ historyPollRadio: Radio(defaultRadio) {
diameter: 18px;
thickness: 2px;
skip: 65px; // * 0.1
duration: 120;
duration: universalDuration;
rippleAreaPadding: 8px;
}
historyPollRadioOpacity: 0.7;

View File

@ -40,7 +40,7 @@ void SendButton::setType(Type type) {
[=] { update(); },
0.,
1.,
st::historyRecordVoiceDuration);
st::universalDuration);
setPointerCursor(_type != Type::Slowmode);
update();
}