Removed Adaptive namespace from top bar widgets.
This commit is contained in:
parent
1af8e89eb9
commit
0d814066d6
|
@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/special_buttons.h"
|
||||
#include "ui/unread_badge.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "window/window_adaptive.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "window/window_peer_menu.h"
|
||||
#include "calls/calls_instance.h"
|
||||
|
@ -117,7 +118,11 @@ TopBarWidget::TopBarWidget(
|
|||
_search->setForceRippled(searchInActiveChat, animated);
|
||||
}, lifetime());
|
||||
|
||||
subscribe(Adaptive::Changed(), [=] { updateAdaptiveLayout(); });
|
||||
controller->adaptive().changed(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateAdaptiveLayout();
|
||||
}, lifetime());
|
||||
|
||||
refreshUnreadBadge();
|
||||
{
|
||||
using AnimationUpdate = Data::Session::SendActionAnimationUpdate;
|
||||
|
@ -297,7 +302,8 @@ void TopBarWidget::showMenu() {
|
|||
}
|
||||
|
||||
void TopBarWidget::toggleInfoSection() {
|
||||
if (Adaptive::ThreeColumn()
|
||||
const auto isThreeColumn = _controller->adaptive().isThreeColumn();
|
||||
if (isThreeColumn
|
||||
&& (Core::App().settings().thirdSectionInfoEnabled()
|
||||
|| Core::App().settings().tabbedReplacedWithInfo())) {
|
||||
_controller->closeThirdSection();
|
||||
|
@ -305,7 +311,7 @@ void TopBarWidget::toggleInfoSection() {
|
|||
if (_controller->canShowThirdSection()) {
|
||||
Core::App().settings().setThirdSectionInfoEnabled(true);
|
||||
Core::App().saveSettingsDelayed();
|
||||
if (Adaptive::ThreeColumn()) {
|
||||
if (isThreeColumn) {
|
||||
_controller->showSection(
|
||||
Info::Memento::Default(_activeChat.key.peer()),
|
||||
Window::SectionShow().withThirdColumn());
|
||||
|
@ -672,7 +678,8 @@ void TopBarWidget::updateControlsGeometry() {
|
|||
auto hasSelected = showSelectedActions();
|
||||
auto selectedButtonsTop = countSelectedButtonsTop(_selectedShown.value(hasSelected ? 1. : 0.));
|
||||
auto otherButtonsTop = selectedButtonsTop + st::topBarHeight;
|
||||
auto buttonsLeft = st::topBarActionSkip + (Adaptive::OneColumn() ? 0 : st::lineWidth);
|
||||
auto buttonsLeft = st::topBarActionSkip
|
||||
+ (_controller->adaptive().isOneColumn() ? 0 : st::lineWidth);
|
||||
auto buttonsWidth = (_forward->isHidden() ? 0 : _forward->contentWidth())
|
||||
+ (_sendNow->isHidden() ? 0 : _sendNow->contentWidth())
|
||||
+ (_delete->isHidden() ? 0 : _delete->contentWidth())
|
||||
|
@ -767,13 +774,14 @@ void TopBarWidget::updateControlsVisibility() {
|
|||
_forward->setVisible(_canForward);
|
||||
_sendNow->setVisible(_canSendNow);
|
||||
|
||||
auto backVisible = Adaptive::OneColumn()
|
||||
const auto isOneColumn = _controller->adaptive().isOneColumn();
|
||||
auto backVisible = isOneColumn
|
||||
|| !_controller->content()->stackIsEmpty()
|
||||
|| _activeChat.key.folder();
|
||||
_back->setVisible(backVisible && !_chooseForReportReason);
|
||||
_cancelChoose->setVisible(_chooseForReportReason.has_value());
|
||||
if (_info) {
|
||||
_info->setVisible(Adaptive::OneColumn() && !_chooseForReportReason);
|
||||
_info->setVisible(isOneColumn && !_chooseForReportReason);
|
||||
}
|
||||
if (_unreadBadge) {
|
||||
_unreadBadge->setVisible(!_chooseForReportReason);
|
||||
|
@ -790,7 +798,7 @@ void TopBarWidget::updateControlsVisibility() {
|
|||
_menuToggle->setVisible(hasMenu && !_chooseForReportReason);
|
||||
_infoToggle->setVisible(historyMode
|
||||
&& !_activeChat.key.folder()
|
||||
&& !Adaptive::OneColumn()
|
||||
&& !isOneColumn
|
||||
&& _controller->canShowThirdSection()
|
||||
&& !_chooseForReportReason);
|
||||
const auto callsEnabled = [&] {
|
||||
|
@ -921,7 +929,7 @@ void TopBarWidget::updateAdaptiveLayout() {
|
|||
}
|
||||
|
||||
void TopBarWidget::refreshUnreadBadge() {
|
||||
if (!Adaptive::OneColumn() && !_activeChat.key.folder()) {
|
||||
if (!_controller->adaptive().isOneColumn() && !_activeChat.key.folder()) {
|
||||
_unreadBadge.destroy();
|
||||
return;
|
||||
} else if (_unreadBadge) {
|
||||
|
@ -965,7 +973,7 @@ void TopBarWidget::updateUnreadBadge() {
|
|||
}
|
||||
|
||||
void TopBarWidget::updateInfoToggleActive() {
|
||||
auto infoThirdActive = Adaptive::ThreeColumn()
|
||||
auto infoThirdActive = _controller->adaptive().isThreeColumn()
|
||||
&& (Core::App().settings().thirdSectionInfoEnabled()
|
||||
|| Core::App().settings().tabbedReplacedWithInfo());
|
||||
auto iconOverride = infoThirdActive
|
||||
|
|
|
@ -922,7 +922,8 @@ void MainWidget::createPlayer() {
|
|||
if (!_player) {
|
||||
_player.create(
|
||||
this,
|
||||
object_ptr<Media::Player::Widget>(this, &session()));
|
||||
object_ptr<Media::Player::Widget>(this, &session()),
|
||||
_controller->adaptive().oneColumnValue());
|
||||
rpl::merge(
|
||||
_player->heightValue() | rpl::map_to(true),
|
||||
_player->shownValue()
|
||||
|
@ -1088,7 +1089,8 @@ void MainWidget::setCurrentExportView(Export::View::PanelController *view) {
|
|||
void MainWidget::createExportTopBar(Export::View::Content &&data) {
|
||||
_exportTopBar.create(
|
||||
this,
|
||||
object_ptr<Export::View::TopBar>(this, std::move(data)));
|
||||
object_ptr<Export::View::TopBar>(this, std::move(data)),
|
||||
_controller->adaptive().oneColumnValue());
|
||||
_exportTopBar->entity()->clicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
if (_currentExportView) {
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
/*
|
||||
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/wrap/slide_wrap.h"
|
||||
#include "facades.h"
|
||||
|
||||
namespace Window {
|
||||
|
||||
|
@ -10,12 +16,21 @@ class TopBarWrapWidget : public Ui::SlideWrap<Inner> {
|
|||
using Parent = Ui::SlideWrap<Inner>;
|
||||
|
||||
public:
|
||||
TopBarWrapWidget(QWidget *parent, object_ptr<Inner> inner)
|
||||
TopBarWrapWidget(
|
||||
QWidget *parent,
|
||||
object_ptr<Inner> inner,
|
||||
rpl::producer<bool> oneColumnValue)
|
||||
: Parent(parent, std::move(inner)) {
|
||||
this->sizeValue(
|
||||
) | rpl::start_with_next([this](const QSize &size) {
|
||||
) | rpl::start_with_next([=](const QSize &size) {
|
||||
updateShadowGeometry(size);
|
||||
}, this->lifetime());
|
||||
|
||||
std::move(
|
||||
oneColumnValue
|
||||
) | rpl::start_with_next([=](bool oneColumn) {
|
||||
_isOneColumn = oneColumn;
|
||||
}, this->lifetime());
|
||||
}
|
||||
|
||||
void updateAdaptiveLayout() {
|
||||
|
@ -33,7 +48,7 @@ public:
|
|||
|
||||
private:
|
||||
void updateShadowGeometry(const QSize &size) {
|
||||
auto skip = Adaptive::OneColumn() ? 0 : st::lineWidth;
|
||||
const auto skip = _isOneColumn ? 0 : st::lineWidth;
|
||||
this->entity()->setShadowGeometryToLeft(
|
||||
skip,
|
||||
size.height() - st::lineWidth,
|
||||
|
@ -41,6 +56,8 @@ private:
|
|||
st::lineWidth);
|
||||
}
|
||||
|
||||
bool _isOneColumn = false;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Window
|
||||
|
|
Loading…
Reference in New Issue