mirror of https://github.com/procxx/kepka.git
Change *[Fast|Animated] to anim::type in SlideWrap.
This commit is contained in:
parent
83850d9b86
commit
f0ad78d808
|
@ -316,13 +316,21 @@ void EditPrivacyBox::createWidgets() {
|
||||||
|
|
||||||
_optionGroup->setChangedCallback([this](Option value) {
|
_optionGroup->setChangedCallback([this](Option value) {
|
||||||
_option = value;
|
_option = value;
|
||||||
_alwaysLink->toggleAnimated(showExceptionLink(Exception::Always));
|
_alwaysLink->toggle(
|
||||||
_neverLink->toggleAnimated(showExceptionLink(Exception::Never));
|
showExceptionLink(Exception::Always),
|
||||||
|
anim::type::normal);
|
||||||
|
_neverLink->toggle(
|
||||||
|
showExceptionLink(Exception::Never),
|
||||||
|
anim::type::normal);
|
||||||
});
|
});
|
||||||
|
|
||||||
showChildren();
|
showChildren();
|
||||||
_alwaysLink->toggleFast(showExceptionLink(Exception::Always));
|
_alwaysLink->toggle(
|
||||||
_neverLink->toggleFast(showExceptionLink(Exception::Never));
|
showExceptionLink(Exception::Always),
|
||||||
|
anim::type::instant);
|
||||||
|
_neverLink->toggle(
|
||||||
|
showExceptionLink(Exception::Never),
|
||||||
|
anim::type::instant);
|
||||||
|
|
||||||
setDimensions(st::boxWideWidth, resizeGetHeight(st::boxWideWidth));
|
setDimensions(st::boxWideWidth, resizeGetHeight(st::boxWideWidth));
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ void PeerListBox::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::setInnerFocus() {
|
void PeerListBox::setInnerFocus() {
|
||||||
if (!_select || _select->isHiddenOrHiding()) {
|
if (!_select || !_select->toggled()) {
|
||||||
content()->setFocus();
|
content()->setFocus();
|
||||||
} else {
|
} else {
|
||||||
_select->entity()->setInnerFocus();
|
_select->entity()->setInnerFocus();
|
||||||
|
@ -191,10 +191,10 @@ void PeerListBox::peerListSetSearchMode(PeerListSearchMode mode) {
|
||||||
auto selectVisible = (mode != PeerListSearchMode::Disabled);
|
auto selectVisible = (mode != PeerListSearchMode::Disabled);
|
||||||
if (selectVisible && !_select) {
|
if (selectVisible && !_select) {
|
||||||
createMultiSelect();
|
createMultiSelect();
|
||||||
_select->toggleFast(!selectVisible);
|
_select->toggle(!selectVisible, anim::type::instant);
|
||||||
}
|
}
|
||||||
if (_select) {
|
if (_select) {
|
||||||
_select->toggleAnimated(selectVisible);
|
_select->toggle(selectVisible, anim::type::normal);
|
||||||
_scrollBottomFixed = false;
|
_scrollBottomFixed = false;
|
||||||
setInnerFocus();
|
setInnerFocus();
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ void PeerListController::setSearchNoResultsText(const QString &text) {
|
||||||
void PeerListBox::addSelectItem(not_null<PeerData*> peer, PeerListRow::SetStyle style) {
|
void PeerListBox::addSelectItem(not_null<PeerData*> peer, PeerListRow::SetStyle style) {
|
||||||
if (!_select) {
|
if (!_select) {
|
||||||
createMultiSelect();
|
createMultiSelect();
|
||||||
_select->toggleFast(false);
|
_select->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
if (style == PeerListRow::SetStyle::Fast) {
|
if (style == PeerListRow::SetStyle::Fast) {
|
||||||
_select->entity()->addItemInBunch(peer->id, peer->shortName(), st::activeButtonBg, PaintUserpicCallback(peer));
|
_select->entity()->addItemInBunch(peer->id, peer->shortName(), st::activeButtonBg, PaintUserpicCallback(peer));
|
||||||
|
|
|
@ -47,7 +47,7 @@ object_ptr<Ui::SlideWrap<Ui::VerticalLayout>> CreateTextWithLabel(
|
||||||
| rpl::before_next([slide = result.data()](
|
| rpl::before_next([slide = result.data()](
|
||||||
const TextWithEntities &value) {
|
const TextWithEntities &value) {
|
||||||
if (value.text.isEmpty()) {
|
if (value.text.isEmpty()) {
|
||||||
slide->hideAnimated();
|
slide->hide(anim::type::normal);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
| rpl::filter([](const TextWithEntities &value) {
|
| rpl::filter([](const TextWithEntities &value) {
|
||||||
|
@ -55,7 +55,7 @@ object_ptr<Ui::SlideWrap<Ui::VerticalLayout>> CreateTextWithLabel(
|
||||||
})
|
})
|
||||||
| rpl::after_next([slide = result.data()](
|
| rpl::after_next([slide = result.data()](
|
||||||
const TextWithEntities &value) {
|
const TextWithEntities &value) {
|
||||||
slide->showAnimated();
|
slide->show(anim::type::normal);
|
||||||
});
|
});
|
||||||
auto labeled = layout->add(object_ptr<Ui::FlatLabel>(
|
auto labeled = layout->add(object_ptr<Ui::FlatLabel>(
|
||||||
layout,
|
layout,
|
||||||
|
|
|
@ -244,7 +244,7 @@ rpl::producer<bool> MultiLineTracker::atLeastOneShownValue() const {
|
||||||
auto shown = std::vector<rpl::producer<bool>>();
|
auto shown = std::vector<rpl::producer<bool>>();
|
||||||
shown.reserve(_widgets.size());
|
shown.reserve(_widgets.size());
|
||||||
for (auto &widget : _widgets) {
|
for (auto &widget : _widgets) {
|
||||||
shown.push_back(widget->shownValue());
|
shown.push_back(widget->toggledValue());
|
||||||
}
|
}
|
||||||
return rpl::combine(
|
return rpl::combine(
|
||||||
std::move(shown),
|
std::move(shown),
|
||||||
|
|
|
@ -1793,7 +1793,7 @@ void MainWidget::switchToPanelPlayer() {
|
||||||
if (_playerUsingPanel) return;
|
if (_playerUsingPanel) return;
|
||||||
_playerUsingPanel = true;
|
_playerUsingPanel = true;
|
||||||
|
|
||||||
_player->hideAnimated();
|
_player->hide(anim::type::normal);
|
||||||
_playerVolume.destroyDelayed();
|
_playerVolume.destroyDelayed();
|
||||||
_playerPlaylist->hideIgnoringEnterEvents();
|
_playerPlaylist->hideIgnoringEnterEvents();
|
||||||
|
|
||||||
|
@ -1807,7 +1807,7 @@ void MainWidget::switchToFixedPlayer() {
|
||||||
if (!_player) {
|
if (!_player) {
|
||||||
createPlayer();
|
createPlayer();
|
||||||
} else {
|
} else {
|
||||||
_player->showAnimated();
|
_player->show(anim::type::normal);
|
||||||
if (!_playerVolume) {
|
if (!_playerVolume) {
|
||||||
_playerVolume.create(this);
|
_playerVolume.create(this);
|
||||||
_player->entity()->volumeWidgetCreated(_playerVolume);
|
_player->entity()->volumeWidgetCreated(_playerVolume);
|
||||||
|
@ -1824,7 +1824,7 @@ void MainWidget::closeBothPlayers() {
|
||||||
_playerUsingPanel = false;
|
_playerUsingPanel = false;
|
||||||
_player.destroyDelayed();
|
_player.destroyDelayed();
|
||||||
} else {
|
} else {
|
||||||
_player->hideAnimated();
|
_player->hide(anim::type::normal);
|
||||||
}
|
}
|
||||||
_playerVolume.destroyDelayed();
|
_playerVolume.destroyDelayed();
|
||||||
|
|
||||||
|
@ -1852,16 +1852,16 @@ void MainWidget::createPlayer() {
|
||||||
_player->entity()->volumeWidgetCreated(_playerVolume);
|
_player->entity()->volumeWidgetCreated(_playerVolume);
|
||||||
orderWidgets();
|
orderWidgets();
|
||||||
if (_a_show.animating()) {
|
if (_a_show.animating()) {
|
||||||
_player->showFast();
|
_player->show(anim::type::instant);
|
||||||
_player->hide();
|
_player->setVisible(false);
|
||||||
Shortcuts::enableMediaShortcuts();
|
Shortcuts::enableMediaShortcuts();
|
||||||
} else {
|
} else {
|
||||||
_player->hideFast();
|
_player->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_player && _player->isHiddenOrHiding()) {
|
if (_player && !_player->toggled()) {
|
||||||
if (!_a_show.animating()) {
|
if (!_a_show.animating()) {
|
||||||
_player->showAnimated();
|
_player->show(anim::type::normal);
|
||||||
_playerHeight = _contentScrollAddToY = _player->contentHeight();
|
_playerHeight = _contentScrollAddToY = _player->contentHeight();
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
Shortcuts::enableMediaShortcuts();
|
Shortcuts::enableMediaShortcuts();
|
||||||
|
@ -1910,11 +1910,11 @@ void MainWidget::createCallTopBar() {
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
orderWidgets();
|
orderWidgets();
|
||||||
if (_a_show.animating()) {
|
if (_a_show.animating()) {
|
||||||
_callTopBar->showFast();
|
_callTopBar->show(anim::type::instant);
|
||||||
_callTopBar->hide();
|
_callTopBar->setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
_callTopBar->hideFast();
|
_callTopBar->hide(anim::type::instant);
|
||||||
_callTopBar->showAnimated();
|
_callTopBar->show(anim::type::normal);
|
||||||
_callTopBarHeight = _contentScrollAddToY = _callTopBar->height();
|
_callTopBarHeight = _contentScrollAddToY = _callTopBar->height();
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
}
|
}
|
||||||
|
@ -1922,7 +1922,7 @@ void MainWidget::createCallTopBar() {
|
||||||
|
|
||||||
void MainWidget::destroyCallTopBar() {
|
void MainWidget::destroyCallTopBar() {
|
||||||
if (_callTopBar) {
|
if (_callTopBar) {
|
||||||
_callTopBar->hideAnimated();
|
_callTopBar->hide(anim::type::normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3342,7 +3342,7 @@ void MainWidget::hideAll() {
|
||||||
_thirdShadow->hide();
|
_thirdShadow->hide();
|
||||||
}
|
}
|
||||||
if (_player) {
|
if (_player) {
|
||||||
_player->hide();
|
_player->setVisible(false);
|
||||||
_playerHeight = 0;
|
_playerHeight = 0;
|
||||||
}
|
}
|
||||||
for (auto &instance : _playerFloats) {
|
for (auto &instance : _playerFloats) {
|
||||||
|
@ -3421,7 +3421,7 @@ void MainWidget::showAll() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_player) {
|
if (_player) {
|
||||||
_player->show();
|
_player->setVisible(true);
|
||||||
_playerHeight = _player->contentHeight();
|
_playerHeight = _player->contentHeight();
|
||||||
}
|
}
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
|
|
|
@ -76,11 +76,11 @@ void AdvancedWidget::createControls() {
|
||||||
style::margins slidedPadding(0, marginLarge.bottom() / 2, 0, marginLarge.bottom() - (marginLarge.bottom() / 2));
|
style::margins slidedPadding(0, marginLarge.bottom() / 2, 0, marginLarge.bottom() - (marginLarge.bottom() / 2));
|
||||||
createChildRow(_useDefaultTheme, marginLarge, slidedPadding, lang(lng_settings_bg_use_default), SLOT(onUseDefaultTheme()));
|
createChildRow(_useDefaultTheme, marginLarge, slidedPadding, lang(lng_settings_bg_use_default), SLOT(onUseDefaultTheme()));
|
||||||
if (!Window::Theme::IsNonDefaultUsed()) {
|
if (!Window::Theme::IsNonDefaultUsed()) {
|
||||||
_useDefaultTheme->hideFast();
|
_useDefaultTheme->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
createChildRow(_toggleNightTheme, marginLarge, slidedPadding, getNightThemeToggleText(), SLOT(onToggleNightTheme()));
|
createChildRow(_toggleNightTheme, marginLarge, slidedPadding, getNightThemeToggleText(), SLOT(onToggleNightTheme()));
|
||||||
if (Window::Theme::IsNonDefaultUsed()) {
|
if (Window::Theme::IsNonDefaultUsed()) {
|
||||||
_toggleNightTheme->hideFast();
|
_toggleNightTheme->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createChildRow(_telegramFAQ, marginLarge, lang(lng_settings_faq), SLOT(onTelegramFAQ()));
|
createChildRow(_telegramFAQ, marginLarge, lang(lng_settings_faq), SLOT(onTelegramFAQ()));
|
||||||
|
@ -92,9 +92,13 @@ void AdvancedWidget::createControls() {
|
||||||
|
|
||||||
void AdvancedWidget::checkNonDefaultTheme() {
|
void AdvancedWidget::checkNonDefaultTheme() {
|
||||||
if (self()) return;
|
if (self()) return;
|
||||||
_useDefaultTheme->toggleAnimated(Window::Theme::IsNonDefaultUsed());
|
_useDefaultTheme->toggle(
|
||||||
|
Window::Theme::IsNonDefaultUsed(),
|
||||||
|
anim::type::normal);
|
||||||
_toggleNightTheme->entity()->setText(getNightThemeToggleText());
|
_toggleNightTheme->entity()->setText(getNightThemeToggleText());
|
||||||
_toggleNightTheme->toggleAnimated(!Window::Theme::IsNonDefaultUsed());
|
_toggleNightTheme->toggle(
|
||||||
|
!Window::Theme::IsNonDefaultUsed(),
|
||||||
|
anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvancedWidget::onManageLocalStorage() {
|
void AdvancedWidget::onManageLocalStorage() {
|
||||||
|
|
|
@ -208,7 +208,9 @@ BackgroundWidget::BackgroundWidget(QWidget *parent, UserData *self) : BlockWidge
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
subscribe(Adaptive::Changed(), [this]() {
|
subscribe(Adaptive::Changed(), [this]() {
|
||||||
_adaptive->toggleAnimated(Global::AdaptiveChatLayout() == Adaptive::ChatLayout::Wide);
|
_adaptive->toggle(
|
||||||
|
(Global::AdaptiveChatLayout() == Adaptive::ChatLayout::Wide),
|
||||||
|
anim::type::normal);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +227,7 @@ void BackgroundWidget::createControls() {
|
||||||
createChildRow(_tile, margin, lang(lng_settings_bg_tile), [this](bool) { onTile(); }, Window::Theme::Background()->tile());
|
createChildRow(_tile, margin, lang(lng_settings_bg_tile), [this](bool) { onTile(); }, Window::Theme::Background()->tile());
|
||||||
createChildRow(_adaptive, margin, slidedPadding, lang(lng_settings_adaptive_wide), [this](bool) { onAdaptive(); }, Global::AdaptiveForWide());
|
createChildRow(_adaptive, margin, slidedPadding, lang(lng_settings_adaptive_wide), [this](bool) { onAdaptive(); }, Global::AdaptiveForWide());
|
||||||
if (Global::AdaptiveChatLayout() != Adaptive::ChatLayout::Wide) {
|
if (Global::AdaptiveChatLayout() != Adaptive::ChatLayout::Wide) {
|
||||||
_adaptive->hideFast();
|
_adaptive->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ void ChatSettingsWidget::createControls() {
|
||||||
style::margins marginPath(st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
style::margins marginPath(st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||||
createChildRow(_downloadPath, marginPath, slidedPadding);
|
createChildRow(_downloadPath, marginPath, slidedPadding);
|
||||||
if (Global::AskDownloadPath()) {
|
if (Global::AskDownloadPath()) {
|
||||||
_downloadPath->hideFast();
|
_downloadPath->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
#endif // OS_WIN_STORE
|
#endif // OS_WIN_STORE
|
||||||
|
|
||||||
|
@ -190,7 +190,9 @@ void ChatSettingsWidget::onDontAskDownloadPath() {
|
||||||
Global::SetAskDownloadPath(!_dontAskDownloadPath->checked());
|
Global::SetAskDownloadPath(!_dontAskDownloadPath->checked());
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
#ifndef OS_WIN_STORE
|
#ifndef OS_WIN_STORE
|
||||||
_downloadPath->toggleAnimated(_dontAskDownloadPath->checked());
|
_downloadPath->toggle(
|
||||||
|
_dontAskDownloadPath->checked(),
|
||||||
|
anim::type::normal);
|
||||||
#endif // OS_WIN_STORE
|
#endif // OS_WIN_STORE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ void GeneralWidget::refreshControls() {
|
||||||
createChildRow(_updateRow, marginLink, slidedPadding);
|
createChildRow(_updateRow, marginLink, slidedPadding);
|
||||||
connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart()));
|
connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart()));
|
||||||
if (!cAutoUpdate()) {
|
if (!cAutoUpdate()) {
|
||||||
_updateRow->hideFast();
|
_updateRow->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void GeneralWidget::refreshControls() {
|
||||||
_startMinimized->entity()->setChecked(cStartMinimized() && !Global::LocalPasscode());
|
_startMinimized->entity()->setChecked(cStartMinimized() && !Global::LocalPasscode());
|
||||||
});
|
});
|
||||||
if (!cAutoStart()) {
|
if (!cAutoStart()) {
|
||||||
_startMinimized->hideFast();
|
_startMinimized->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
createChildRow(_addInSendTo, marginSmall, lang(lng_settings_add_sendto), [this](bool) { onAddInSendTo(); }, cSendToMenu());
|
createChildRow(_addInSendTo, marginSmall, lang(lng_settings_add_sendto), [this](bool) { onAddInSendTo(); }, cSendToMenu());
|
||||||
#endif // OS_WIN_STORE
|
#endif // OS_WIN_STORE
|
||||||
|
@ -234,7 +234,9 @@ void GeneralWidget::onRestart() {
|
||||||
void GeneralWidget::onUpdateAutomatically() {
|
void GeneralWidget::onUpdateAutomatically() {
|
||||||
cSetAutoUpdate(_updateAutomatically->checked());
|
cSetAutoUpdate(_updateAutomatically->checked());
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
_updateRow->toggleAnimated(cAutoUpdate());
|
_updateRow->toggle(
|
||||||
|
cAutoUpdate(),
|
||||||
|
anim::type::normal);
|
||||||
if (cAutoUpdate()) {
|
if (cAutoUpdate()) {
|
||||||
Sandbox::startUpdateCheck();
|
Sandbox::startUpdateCheck();
|
||||||
} else {
|
} else {
|
||||||
|
@ -282,7 +284,7 @@ void GeneralWidget::onAutoStart() {
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_startMinimized->toggleAnimated(cAutoStart());
|
_startMinimized->toggle(cAutoStart(), anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralWidget::onStartMinimized() {
|
void GeneralWidget::onStartMinimized() {
|
||||||
|
|
|
@ -143,7 +143,7 @@ void InfoWidget::setLabeledText(
|
||||||
copyText,
|
copyText,
|
||||||
width());
|
width());
|
||||||
}
|
}
|
||||||
row->toggleAnimated(nonEmptyText);
|
row->toggle(nonEmptyText, anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoWidget::LabeledWidget::LabeledWidget(QWidget *parent, const style::FlatLabel &valueSt) : RpWidget(parent)
|
InfoWidget::LabeledWidget::LabeledWidget(QWidget *parent, const style::FlatLabel &valueSt) : RpWidget(parent)
|
||||||
|
|
|
@ -60,11 +60,11 @@ void NotificationsWidget::createControls() {
|
||||||
createChildRow(_showSenderName, margin, slidedPadding, lang(lng_settings_show_name), [this](bool) { onShowSenderName(); }, Global::NotifyView() <= dbinvShowName);
|
createChildRow(_showSenderName, margin, slidedPadding, lang(lng_settings_show_name), [this](bool) { onShowSenderName(); }, Global::NotifyView() <= dbinvShowName);
|
||||||
createChildRow(_showMessagePreview, margin, slidedPadding, lang(lng_settings_show_preview), [this](bool) { onShowMessagePreview(); }, Global::NotifyView() <= dbinvShowPreview);
|
createChildRow(_showMessagePreview, margin, slidedPadding, lang(lng_settings_show_preview), [this](bool) { onShowMessagePreview(); }, Global::NotifyView() <= dbinvShowPreview);
|
||||||
if (!_showSenderName->entity()->checked()) {
|
if (!_showSenderName->entity()->checked()) {
|
||||||
_showMessagePreview->hideFast();
|
_showMessagePreview->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
if (!_desktopNotifications->checked()) {
|
if (!_desktopNotifications->checked()) {
|
||||||
_showSenderName->hideFast();
|
_showSenderName->hide(anim::type::instant);
|
||||||
_showMessagePreview->hideFast();
|
_showMessagePreview->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
createChildRow(_playSound, margin, lang(lng_settings_sound_notify), [this](bool) { onPlaySound(); }, Global::SoundNotify());
|
createChildRow(_playSound, margin, lang(lng_settings_sound_notify), [this](bool) { onPlaySound(); }, Global::SoundNotify());
|
||||||
createChildRow(_includeMuted, margin, lang(lng_settings_include_muted), [this](bool) { onIncludeMuted(); }, Global::IncludeMuted());
|
createChildRow(_includeMuted, margin, lang(lng_settings_include_muted), [this](bool) { onIncludeMuted(); }, Global::IncludeMuted());
|
||||||
|
@ -91,7 +91,7 @@ void NotificationsWidget::createNotificationsControls() {
|
||||||
}
|
}
|
||||||
createChildRow(_advanced, margin, slidedPadding, lang(lng_settings_advanced_notifications), SLOT(onAdvanced()));
|
createChildRow(_advanced, margin, slidedPadding, lang(lng_settings_advanced_notifications), SLOT(onAdvanced()));
|
||||||
if (!nativeNotificationsLabel.isEmpty() && Global::NativeNotifications()) {
|
if (!nativeNotificationsLabel.isEmpty() && Global::NativeNotifications()) {
|
||||||
_advanced->hideFast();
|
_advanced->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,8 +106,13 @@ void NotificationsWidget::onDesktopNotifications() {
|
||||||
|
|
||||||
void NotificationsWidget::desktopEnabledUpdated() {
|
void NotificationsWidget::desktopEnabledUpdated() {
|
||||||
_desktopNotifications->setChecked(Global::DesktopNotify());
|
_desktopNotifications->setChecked(Global::DesktopNotify());
|
||||||
_showSenderName->toggleAnimated(Global::DesktopNotify());
|
_showSenderName->toggle(
|
||||||
_showMessagePreview->toggleAnimated(Global::DesktopNotify() && _showSenderName->entity()->checked());
|
Global::DesktopNotify(),
|
||||||
|
anim::type::normal);
|
||||||
|
_showMessagePreview->toggle(
|
||||||
|
Global::DesktopNotify()
|
||||||
|
&& _showSenderName->entity()->checked(),
|
||||||
|
anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsWidget::onShowSenderName() {
|
void NotificationsWidget::onShowSenderName() {
|
||||||
|
@ -146,7 +151,9 @@ void NotificationsWidget::onShowMessagePreview() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsWidget::viewParamUpdated() {
|
void NotificationsWidget::viewParamUpdated() {
|
||||||
_showMessagePreview->toggleAnimated(_showSenderName->entity()->checked());
|
_showMessagePreview->toggle(
|
||||||
|
_showSenderName->entity()->checked(),
|
||||||
|
anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsWidget::onNativeNotifications() {
|
void NotificationsWidget::onNativeNotifications() {
|
||||||
|
@ -159,7 +166,9 @@ void NotificationsWidget::onNativeNotifications() {
|
||||||
|
|
||||||
Auth().notifications().createManager();
|
Auth().notifications().createManager();
|
||||||
|
|
||||||
_advanced->toggleAnimated(!Global::NativeNotifications());
|
_advanced->toggle(
|
||||||
|
!Global::NativeNotifications(),
|
||||||
|
anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsWidget::onAdvanced() {
|
void NotificationsWidget::onAdvanced() {
|
||||||
|
|
|
@ -191,7 +191,7 @@ void PrivacyWidget::createControls() {
|
||||||
auto value = GetAutoLockText();
|
auto value = GetAutoLockText();
|
||||||
createChildRow(_autoLock, marginSmall, slidedPadding, label, value, LabeledLink::Type::Primary, SLOT(onAutoLock()));
|
createChildRow(_autoLock, marginSmall, slidedPadding, label, value, LabeledLink::Type::Primary, SLOT(onAutoLock()));
|
||||||
if (!Global::LocalPasscode()) {
|
if (!Global::LocalPasscode()) {
|
||||||
_autoLock->hideFast();
|
_autoLock->hide(anim::type::instant);
|
||||||
}
|
}
|
||||||
createChildRow(_cloudPasswordState, marginSmall);
|
createChildRow(_cloudPasswordState, marginSmall);
|
||||||
createChildRow(_showAllSessions, marginSmall, lang(lng_settings_show_sessions), SLOT(onShowSessions()));
|
createChildRow(_showAllSessions, marginSmall, lang(lng_settings_show_sessions), SLOT(onShowSessions()));
|
||||||
|
@ -204,7 +204,9 @@ void PrivacyWidget::autoLockUpdated() {
|
||||||
_autoLock->entity()->link()->setText(value);
|
_autoLock->entity()->link()->setText(value);
|
||||||
resizeToWidth(width());
|
resizeToWidth(width());
|
||||||
}
|
}
|
||||||
_autoLock->toggleAnimated(Global::LocalPasscode());
|
_autoLock->toggle(
|
||||||
|
Global::LocalPasscode(),
|
||||||
|
anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivacyWidget::onBlockedUsers() {
|
void PrivacyWidget::onBlockedUsers() {
|
||||||
|
|
|
@ -41,7 +41,7 @@ FadeWrap<RpWidget> *FadeWrap<RpWidget>::setDuration(int duration) {
|
||||||
FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggle(
|
FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggle(
|
||||||
bool shown,
|
bool shown,
|
||||||
anim::type animated) {
|
anim::type animated) {
|
||||||
auto updated = (shown != _animation.visible());
|
auto changed = (shown != _animation.visible());
|
||||||
if (shown) {
|
if (shown) {
|
||||||
if (animated == anim::type::normal) {
|
if (animated == anim::type::normal) {
|
||||||
_animation.fadeIn(_duration);
|
_animation.fadeIn(_duration);
|
||||||
|
@ -55,7 +55,7 @@ FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggle(
|
||||||
_animation.hide();
|
_animation.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (updated) {
|
if (changed) {
|
||||||
_toggledChanged.fire_copy(shown);
|
_toggledChanged.fire_copy(shown);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -55,24 +55,29 @@ SlideWrap<RpWidget> *SlideWrap<RpWidget>::setDuration(int duration) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleAnimated(
|
SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggle(
|
||||||
bool shown) {
|
bool shown,
|
||||||
if (_shown != shown) {
|
anim::type animated) {
|
||||||
setShown(shown);
|
auto changed = (_toggled != shown);
|
||||||
_animation.start(
|
if (changed) {
|
||||||
[this] { animationStep(); },
|
_toggled = shown;
|
||||||
_shown ? 0. : 1.,
|
if (animated == anim::type::normal) {
|
||||||
_shown ? 1. : 0.,
|
_animation.start(
|
||||||
_duration,
|
[this] { animationStep(); },
|
||||||
anim::linear);
|
_toggled ? 0. : 1.,
|
||||||
|
_toggled ? 1. : 0.,
|
||||||
|
_duration,
|
||||||
|
anim::linear);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (animated == anim::type::normal) {
|
||||||
|
animationStep();
|
||||||
|
} else {
|
||||||
|
finishAnimating();
|
||||||
|
}
|
||||||
|
if (changed) {
|
||||||
|
_toggledChanged.fire_copy(_toggled);
|
||||||
}
|
}
|
||||||
animationStep();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleFast(bool shown) {
|
|
||||||
setShown(shown);
|
|
||||||
finishAnimating();
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +91,7 @@ SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleOn(
|
||||||
rpl::producer<bool> &&shown) {
|
rpl::producer<bool> &&shown) {
|
||||||
std::move(shown)
|
std::move(shown)
|
||||||
| rpl::start_with_next([this](bool shown) {
|
| rpl::start_with_next([this](bool shown) {
|
||||||
toggleAnimated(shown);
|
toggle(shown, anim::type::normal);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
finishAnimating();
|
finishAnimating();
|
||||||
return this;
|
return this;
|
||||||
|
@ -99,16 +104,16 @@ void SlideWrap<RpWidget>::animationStep() {
|
||||||
weak->moveToLeft(margins.left(), margins.top());
|
weak->moveToLeft(margins.left(), margins.top());
|
||||||
newWidth = weak->width();
|
newWidth = weak->width();
|
||||||
}
|
}
|
||||||
auto current = _animation.current(_shown ? 1. : 0.);
|
auto current = _animation.current(_toggled ? 1. : 0.);
|
||||||
auto newHeight = wrapped()
|
auto newHeight = wrapped()
|
||||||
? (_animation.animating()
|
? (_animation.animating()
|
||||||
? anim::interpolate(0, wrapped()->heightNoMargins(), current)
|
? anim::interpolate(0, wrapped()->heightNoMargins(), current)
|
||||||
: (_shown ? wrapped()->height() : 0))
|
: (_toggled ? wrapped()->height() : 0))
|
||||||
: 0;
|
: 0;
|
||||||
if (newWidth != width() || newHeight != height()) {
|
if (newWidth != width() || newHeight != height()) {
|
||||||
resize(newWidth, newHeight);
|
resize(newWidth, newHeight);
|
||||||
}
|
}
|
||||||
auto shouldBeHidden = !_shown && !_animation.animating();
|
auto shouldBeHidden = !_toggled && !_animation.animating();
|
||||||
if (shouldBeHidden != isHidden()) {
|
if (shouldBeHidden != isHidden()) {
|
||||||
setVisible(!shouldBeHidden);
|
setVisible(!shouldBeHidden);
|
||||||
if (shouldBeHidden) {
|
if (shouldBeHidden) {
|
||||||
|
@ -117,14 +122,9 @@ void SlideWrap<RpWidget>::animationStep() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlideWrap<RpWidget>::setShown(bool shown) {
|
|
||||||
_shown = shown;
|
|
||||||
_shownUpdated.fire_copy(_shown);
|
|
||||||
}
|
|
||||||
|
|
||||||
QMargins SlideWrap<RpWidget>::getMargins() const {
|
QMargins SlideWrap<RpWidget>::getMargins() const {
|
||||||
auto result = wrapped()->getMargins();
|
auto result = wrapped()->getMargins();
|
||||||
return (animating() || !_shown)
|
return (animating() || !_toggled)
|
||||||
? QMargins(result.left(), 0, result.right(), 0)
|
? QMargins(result.left(), 0, result.right(), 0)
|
||||||
: result;
|
: result;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ int SlideWrap<RpWidget>::resizeGetHeight(int newWidth) {
|
||||||
void SlideWrap<RpWidget>::wrappedSizeUpdated(QSize size) {
|
void SlideWrap<RpWidget>::wrappedSizeUpdated(QSize size) {
|
||||||
if (_animation.animating()) {
|
if (_animation.animating()) {
|
||||||
animationStep();
|
animationStep();
|
||||||
} else if (_shown) {
|
} else if (_toggled) {
|
||||||
resize(size);
|
resize(size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,39 +44,37 @@ public:
|
||||||
const style::margins &padding);
|
const style::margins &padding);
|
||||||
|
|
||||||
SlideWrap *setDuration(int duration);
|
SlideWrap *setDuration(int duration);
|
||||||
SlideWrap *toggleAnimated(bool shown);
|
SlideWrap *toggle(bool shown, anim::type animated);
|
||||||
SlideWrap *toggleFast(bool shown);
|
SlideWrap *show(anim::type animated) {
|
||||||
SlideWrap *showAnimated() { return toggleAnimated(true); }
|
return toggle(true, animated);
|
||||||
SlideWrap *hideAnimated() { return toggleAnimated(false); }
|
}
|
||||||
SlideWrap *showFast() { return toggleFast(true); }
|
SlideWrap *hide(anim::type animated) {
|
||||||
SlideWrap *hideFast() { return toggleFast(false); }
|
return toggle(false, animated);
|
||||||
|
}
|
||||||
SlideWrap *finishAnimating();
|
SlideWrap *finishAnimating();
|
||||||
SlideWrap *toggleOn(rpl::producer<bool> &&shown);
|
SlideWrap *toggleOn(rpl::producer<bool> &&shown);
|
||||||
|
|
||||||
bool animating() const {
|
bool animating() const {
|
||||||
return _animation.animating();
|
return _animation.animating();
|
||||||
}
|
}
|
||||||
|
bool toggled() const {
|
||||||
|
return _toggled;
|
||||||
|
}
|
||||||
|
auto toggledValue() const {
|
||||||
|
return _toggledChanged.events_starting_with_copy(_toggled);
|
||||||
|
}
|
||||||
|
|
||||||
QMargins getMargins() const override;
|
QMargins getMargins() const override;
|
||||||
|
|
||||||
bool isHiddenOrHiding() const {
|
|
||||||
return !_shown;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto shownValue() const {
|
|
||||||
return _shownUpdated.events_starting_with_copy(_shown);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int resizeGetHeight(int newWidth) override;
|
int resizeGetHeight(int newWidth) override;
|
||||||
void wrappedSizeUpdated(QSize size) override;
|
void wrappedSizeUpdated(QSize size) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void animationStep();
|
void animationStep();
|
||||||
void setShown(bool shown);
|
|
||||||
|
|
||||||
bool _shown = true;
|
bool _toggled = true;
|
||||||
rpl::event_stream<bool> _shownUpdated;
|
rpl::event_stream<bool> _toggledChanged;
|
||||||
Animation _animation;
|
Animation _animation;
|
||||||
int _duration = 0;
|
int _duration = 0;
|
||||||
|
|
||||||
|
@ -107,23 +105,14 @@ public:
|
||||||
SlideWrap *setDuration(int duration) {
|
SlideWrap *setDuration(int duration) {
|
||||||
return chain(Parent::setDuration(duration));
|
return chain(Parent::setDuration(duration));
|
||||||
}
|
}
|
||||||
SlideWrap *toggleAnimated(bool shown) {
|
SlideWrap *toggle(bool shown, anim::type animated) {
|
||||||
return chain(Parent::toggleAnimated(shown));
|
return chain(Parent::toggle(shown, animated));
|
||||||
}
|
}
|
||||||
SlideWrap *toggleFast(bool shown) {
|
SlideWrap *show(anim::type animated) {
|
||||||
return chain(Parent::toggleFast(shown));
|
return chain(Parent::show(animated));
|
||||||
}
|
}
|
||||||
SlideWrap *showAnimated() {
|
SlideWrap *hide(anim::type animated) {
|
||||||
return chain(Parent::showAnimated());
|
return chain(Parent::hide(animated));
|
||||||
}
|
|
||||||
SlideWrap *hideAnimated() {
|
|
||||||
return chain(Parent::hideAnimated());
|
|
||||||
}
|
|
||||||
SlideWrap *showFast() {
|
|
||||||
return chain(Parent::showFast());
|
|
||||||
}
|
|
||||||
SlideWrap *hideFast() {
|
|
||||||
return chain(Parent::hideFast());
|
|
||||||
}
|
}
|
||||||
SlideWrap *finishAnimating() {
|
SlideWrap *finishAnimating() {
|
||||||
return chain(Parent::finishAnimating());
|
return chain(Parent::finishAnimating());
|
||||||
|
|
Loading…
Reference in New Issue