Use layers and boxes from lib_ui.

This commit is contained in:
John Preston 2019-09-18 14:19:05 +03:00
parent 860353824b
commit a6c84c36c0
209 changed files with 586 additions and 3349 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

View file

@ -2810,7 +2810,7 @@ void ApiWrap::requestAttachedStickerSets(not_null<PhotoData*> photo) {
: MTP_inputStickerSetShortName(setData->vshort_name()); : MTP_inputStickerSetShortName(setData->vshort_name());
Ui::show( Ui::show(
Box<StickerSetBox>(App::wnd()->sessionController(), setId), Box<StickerSetBox>(App::wnd()->sessionController(), setId),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
}).fail([=](const RPCError &error) { }).fail([=](const RPCError &error) {
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now))); Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
}).send(); }).send();
@ -4903,7 +4903,7 @@ void ApiWrap::editUploadedFile(
_session->data().sendHistoryChangeNotifications(); _session->data().sendHistoryChangeNotifications();
Ui::show( Ui::show(
Box<InformBox>(tr::lng_edit_media_invalid_file(tr::now)), Box<InformBox>(tr::lng_edit_media_invalid_file(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} else { } else {
sendMessageFail(error, peer); sendMessageFail(error, peer);
} }

View file

@ -45,7 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_mediaview.h" #include "styles/style_mediaview.h"
#include "styles/style_chat_helpers.h" #include "styles/style_chat_helpers.h"
#include "styles/style_history.h" #include "styles/style_history.h"
#include "styles/style_boxes.h" #include "styles/style_layers.h"
#include <QtCore/QBuffer> #include <QtCore/QBuffer>
#include <QtGui/QFontDatabase> #include <QtGui/QFontDatabase>

View file

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/platform/base_platform_info.h" #include "base/platform/base_platform_info.h"
#include "core/click_handler_types.h" #include "core/click_handler_types.h"
#include "core/update_checker.h" #include "core/update_checker.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>

View file

@ -14,7 +14,7 @@ class LinkButton;
class FlatLabel; class FlatLabel;
} // namespace Ui } // namespace Ui
class AboutBox : public BoxContent { class AboutBox : public Ui::BoxContent {
public: public:
AboutBox(QWidget*); AboutBox(QWidget*);

View file

@ -7,606 +7,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "boxes/abstract_box.h" #include "boxes/abstract_box.h"
#include "styles/style_boxes.h"
#include "styles/style_profile.h"
#include "storage/localstorage.h"
#include "lang/lang_keys.h"
#include "ui/effects/radial_animation.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/scroll_area.h"
#include "ui/widgets/labels.h"
#include "ui/widgets/shadow.h"
#include "ui/wrap/fade_wrap.h"
#include "ui/text/text_utilities.h"
#include "ui/painter.h"
#include "base/timer.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "app.h" #include "app.h"
struct AbstractBox::LoadingProgress {
LoadingProgress(
Fn<void()> &&callback,
const style::InfiniteRadialAnimation &st);
Ui::InfiniteRadialAnimation animation;
base::Timer removeTimer;
};
AbstractBox::LoadingProgress::LoadingProgress(
Fn<void()> &&callback,
const style::InfiniteRadialAnimation &st)
: animation(std::move(callback), st) {
}
void BoxContent::setTitle(rpl::producer<QString> title) {
getDelegate()->setTitle(std::move(title) | Ui::Text::ToWithEntities());
}
QPointer<Ui::RoundButton> BoxContent::addButton(
rpl::producer<QString> text,
Fn<void()> clickCallback) {
return addButton(
std::move(text),
std::move(clickCallback),
st::defaultBoxButton);
}
QPointer<Ui::RoundButton> BoxContent::addLeftButton(
rpl::producer<QString> text,
Fn<void()> clickCallback) {
return getDelegate()->addLeftButton(
std::move(text),
std::move(clickCallback),
st::defaultBoxButton);
}
void BoxContent::setInner(object_ptr<TWidget> inner) {
setInner(std::move(inner), st::boxLayerScroll);
}
void BoxContent::setInner(object_ptr<TWidget> inner, const style::ScrollArea &st) {
if (inner) {
getDelegate()->setLayerType(true);
_scroll.create(this, st);
_scroll->setGeometryToLeft(0, _innerTopSkip, width(), 0);
_scroll->setOwnedWidget(std::move(inner));
if (_topShadow) {
_topShadow->raise();
_bottomShadow->raise();
} else {
_topShadow.create(this);
_bottomShadow.create(this);
}
if (!_preparing) {
// We didn't set dimensions yet, this will be called from finishPrepare();
finishScrollCreate();
}
} else {
getDelegate()->setLayerType(false);
_scroll.destroyDelayed();
_topShadow.destroyDelayed();
_bottomShadow.destroyDelayed();
}
}
void BoxContent::finishPrepare() {
_preparing = false;
if (_scroll) {
finishScrollCreate();
}
setInnerFocus();
}
void BoxContent::finishScrollCreate() {
Expects(_scroll != nullptr);
if (!_scroll->isHidden()) {
_scroll->show();
}
updateScrollAreaGeometry();
connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
connect(_scroll, SIGNAL(innerResized()), this, SLOT(onInnerResize()));
}
void BoxContent::scrollToWidget(not_null<QWidget*> widget) {
if (_scroll) {
_scroll->scrollToWidget(widget);
}
}
void BoxContent::onScrollToY(int top, int bottom) {
if (_scroll) {
_scroll->scrollToY(top, bottom);
}
}
void BoxContent::onDraggingScrollDelta(int delta) {
_draggingScrollDelta = _scroll ? delta : 0;
if (_draggingScrollDelta) {
if (!_draggingScrollTimer) {
_draggingScrollTimer.create(this);
_draggingScrollTimer->setSingleShot(false);
connect(_draggingScrollTimer, SIGNAL(timeout()), this, SLOT(onDraggingScrollTimer()));
}
_draggingScrollTimer->start(15);
} else {
_draggingScrollTimer.destroy();
}
}
void BoxContent::onDraggingScrollTimer() {
auto delta = (_draggingScrollDelta > 0) ? qMin(_draggingScrollDelta * 3 / 20 + 1, int32(Ui::kMaxScrollSpeed)) : qMax(_draggingScrollDelta * 3 / 20 - 1, -int32(Ui::kMaxScrollSpeed));
_scroll->scrollToY(_scroll->scrollTop() + delta);
}
void BoxContent::updateInnerVisibleTopBottom() {
if (auto widget = static_cast<TWidget*>(_scroll ? _scroll->widget() : nullptr)) {
auto top = _scroll->scrollTop();
widget->setVisibleTopBottom(top, top + _scroll->height());
}
}
void BoxContent::updateShadowsVisibility() {
if (!_scroll) return;
auto top = _scroll->scrollTop();
_topShadow->toggle(
(top > 0 || _innerTopSkip > 0),
anim::type::normal);
_bottomShadow->toggle(
(top < _scroll->scrollTopMax() || _innerBottomSkip > 0),
anim::type::normal);
}
void BoxContent::onScroll() {
updateInnerVisibleTopBottom();
updateShadowsVisibility();
}
void BoxContent::onInnerResize() {
updateInnerVisibleTopBottom();
updateShadowsVisibility();
}
void BoxContent::setDimensionsToContent(
int newWidth,
not_null<Ui::RpWidget*> content) {
content->resizeToWidth(newWidth);
content->heightValue(
) | rpl::start_with_next([=](int height) {
setDimensions(newWidth, height);
}, content->lifetime());
}
void BoxContent::setInnerTopSkip(int innerTopSkip, bool scrollBottomFixed) {
if (_innerTopSkip != innerTopSkip) {
auto delta = innerTopSkip - _innerTopSkip;
_innerTopSkip = innerTopSkip;
if (_scroll && width() > 0) {
auto scrollTopWas = _scroll->scrollTop();
updateScrollAreaGeometry();
if (scrollBottomFixed) {
_scroll->scrollToY(scrollTopWas + delta);
}
}
}
}
void BoxContent::setInnerBottomSkip(int innerBottomSkip) {
if (_innerBottomSkip != innerBottomSkip) {
auto delta = innerBottomSkip - _innerBottomSkip;
_innerBottomSkip = innerBottomSkip;
if (_scroll && width() > 0) {
updateScrollAreaGeometry();
}
}
}
void BoxContent::setInnerVisible(bool scrollAreaVisible) {
if (_scroll) {
_scroll->setVisible(scrollAreaVisible);
}
}
QPixmap BoxContent::grabInnerCache() {
auto isTopShadowVisible = !_topShadow->isHidden();
auto isBottomShadowVisible = !_bottomShadow->isHidden();
if (isTopShadowVisible) _topShadow->setVisible(false);
if (isBottomShadowVisible) _bottomShadow->setVisible(false);
auto result = Ui::GrabWidget(this, _scroll->geometry());
if (isTopShadowVisible) _topShadow->setVisible(true);
if (isBottomShadowVisible) _bottomShadow->setVisible(true);
return result;
}
void BoxContent::resizeEvent(QResizeEvent *e) {
if (_scroll) {
updateScrollAreaGeometry();
}
}
void BoxContent::keyPressEvent(QKeyEvent *e) {
if (e->key() == Qt::Key_Escape && !_closeByEscape) {
e->accept();
} else {
RpWidget::keyPressEvent(e);
}
}
void BoxContent::updateScrollAreaGeometry() {
auto newScrollHeight = height() - _innerTopSkip - _innerBottomSkip;
auto changed = (_scroll->height() != newScrollHeight);
_scroll->setGeometryToLeft(0, _innerTopSkip, width(), newScrollHeight);
_topShadow->entity()->resize(width(), st::lineWidth);
_topShadow->moveToLeft(0, _innerTopSkip);
_bottomShadow->entity()->resize(width(), st::lineWidth);
_bottomShadow->moveToLeft(
0,
height() - _innerBottomSkip - st::lineWidth);
if (changed) {
updateInnerVisibleTopBottom();
auto top = _scroll->scrollTop();
_topShadow->toggle(
(top > 0 || _innerTopSkip > 0),
anim::type::instant);
_bottomShadow->toggle(
(top < _scroll->scrollTopMax() || _innerBottomSkip > 0),
anim::type::instant);
}
}
object_ptr<TWidget> BoxContent::doTakeInnerWidget() {
return _scroll->takeWidget<TWidget>();
}
void BoxContent::paintEvent(QPaintEvent *e) {
Painter p(this);
if (testAttribute(Qt::WA_OpaquePaintEvent)) {
for (auto rect : e->region().rects()) {
p.fillRect(rect, st::boxBg);
}
}
}
AbstractBox::AbstractBox(
not_null<Window::LayerStackWidget*> layer,
object_ptr<BoxContent> content)
: LayerWidget(layer)
, _layer(layer)
, _content(std::move(content)) {
_content->setParent(this);
_content->setDelegate(this);
_additionalTitle.changes(
) | rpl::start_with_next([=] {
updateSize();
update();
}, lifetime());
}
AbstractBox::~AbstractBox() = default;
void AbstractBox::setLayerType(bool layerType) {
_layerType = layerType;
updateTitlePosition();
}
int AbstractBox::titleHeight() const {
return _layerType ? st::boxLayerTitleHeight : st::boxTitleHeight;
}
int AbstractBox::buttonsHeight() const {
const auto padding = _layerType
? st::boxLayerButtonPadding
: st::boxButtonPadding;
return padding.top() + st::defaultBoxButton.height + padding.bottom();
}
int AbstractBox::buttonsTop() const {
const auto padding = _layerType
? st::boxLayerButtonPadding
: st::boxButtonPadding;
return height() - padding.bottom() - st::defaultBoxButton.height;
}
QRect AbstractBox::loadingRect() const {
const auto padding = _layerType
? st::boxLayerButtonPadding
: st::boxButtonPadding;
const auto size = st::boxLoadingSize;
const auto skipx = _layerType
? st::boxLayerTitlePosition.x()
: st::boxTitlePosition.x();
const auto skipy = (st::defaultBoxButton.height - size) / 2;
return QRect(
skipx,
height() - padding.bottom() - skipy - size,
size,
size);
}
void AbstractBox::paintEvent(QPaintEvent *e) {
Painter p(this);
auto clip = e->rect();
auto paintTopRounded = clip.intersects(QRect(0, 0, width(), st::boxRadius));
auto paintBottomRounded = clip.intersects(QRect(0, height() - st::boxRadius, width(), st::boxRadius));
if (paintTopRounded || paintBottomRounded) {
auto parts = RectPart::None | 0;
if (paintTopRounded) parts |= RectPart::FullTop;
if (paintBottomRounded) parts |= RectPart::FullBottom;
App::roundRect(p, rect(), st::boxBg, BoxCorners, nullptr, parts);
}
auto other = e->region().intersected(QRect(0, st::boxRadius, width(), height() - 2 * st::boxRadius));
if (!other.isEmpty()) {
for (auto rect : other.rects()) {
p.fillRect(rect, st::boxBg);
}
}
if (!_additionalTitle.current().isEmpty()
&& clip.intersects(QRect(0, 0, width(), titleHeight()))) {
paintAdditionalTitle(p);
}
if (_loadingProgress) {
const auto rect = loadingRect();
_loadingProgress->animation.draw(
p,
rect.topLeft(),
rect.size(),
width());
}
}
void AbstractBox::paintAdditionalTitle(Painter &p) {
p.setFont(st::boxLayerTitleAdditionalFont);
p.setPen(st::boxTitleAdditionalFg);
p.drawTextLeft(_titleLeft + (_title ? _title->width() : 0) + st::boxLayerTitleAdditionalSkip, _titleTop + st::boxTitleFont->ascent - st::boxLayerTitleAdditionalFont->ascent, width(), _additionalTitle.current());
}
void AbstractBox::parentResized() {
auto newHeight = countRealHeight();
auto parentSize = parentWidget()->size();
setGeometry((parentSize.width() - width()) / 2, (parentSize.height() - newHeight) / 2, width(), newHeight);
update();
}
void AbstractBox::setTitle(rpl::producer<TextWithEntities> title) {
const auto wasTitle = hasTitle();
if (title) {
_title.create(this, std::move(title), st::boxTitle);
_title->show();
updateTitlePosition();
} else {
_title.destroy();
}
if (wasTitle != hasTitle()) {
updateSize();
}
}
void AbstractBox::setAdditionalTitle(rpl::producer<QString> additional) {
_additionalTitle = std::move(additional);
}
void AbstractBox::setCloseByOutsideClick(bool close) {
_closeByOutsideClick = close;
}
bool AbstractBox::closeByOutsideClick() const {
return _closeByOutsideClick;
}
bool AbstractBox::hasTitle() const {
return (_title != nullptr) || !_additionalTitle.current().isEmpty();
}
void AbstractBox::showBox(
object_ptr<BoxContent> box,
LayerOptions options,
anim::type animated) {
_layer->showBox(std::move(box), options, animated);
}
void AbstractBox::updateSize() {
setDimensions(width(), _maxContentHeight);
}
void AbstractBox::updateButtonsPositions() {
if (!_buttons.empty() || _leftButton) {
auto padding = _layerType ? st::boxLayerButtonPadding : st::boxButtonPadding;
auto right = padding.right();
auto top = buttonsTop();
if (_leftButton) {
_leftButton->moveToLeft(right, top);
}
for (const auto &button : _buttons) {
button->moveToRight(right, top);
right += button->width() + padding.left();
}
}
if (_topButton) {
_topButton->moveToRight(0, 0);
}
}
QPointer<QWidget> AbstractBox::outerContainer() {
return parentWidget();
}
void AbstractBox::updateTitlePosition() {
_titleLeft = _layerType ? st::boxLayerTitlePosition.x() : st::boxTitlePosition.x();
_titleTop = _layerType ? st::boxLayerTitlePosition.y() : st::boxTitlePosition.y();
if (_title) {
_title->resizeToWidth(qMin(_title->naturalWidth(), width() - _titleLeft * 2));
_title->moveToLeft(_titleLeft, _titleTop);
}
}
void AbstractBox::clearButtons() {
for (auto &button : base::take(_buttons)) {
button.destroy();
}
_leftButton.destroy();
_topButton = nullptr;
}
QPointer<Ui::RoundButton> AbstractBox::addButton(
rpl::producer<QString> text,
Fn<void()> clickCallback,
const style::RoundButton &st) {
_buttons.emplace_back(this, std::move(text), st);
auto result = QPointer<Ui::RoundButton>(_buttons.back());
result->setClickedCallback(std::move(clickCallback));
result->show();
result->widthValue(
) | rpl::start_with_next([=] {
updateButtonsPositions();
}, result->lifetime());
return result;
}
QPointer<Ui::RoundButton> AbstractBox::addLeftButton(
rpl::producer<QString> text,
Fn<void()> clickCallback,
const style::RoundButton &st) {
_leftButton = object_ptr<Ui::RoundButton>(this, std::move(text), st);
auto result = QPointer<Ui::RoundButton>(_leftButton);
result->setClickedCallback(std::move(clickCallback));
result->show();
result->widthValue(
) | rpl::start_with_next([=] {
updateButtonsPositions();
}, result->lifetime());
return result;
}
QPointer<Ui::IconButton> AbstractBox::addTopButton(const style::IconButton &st, Fn<void()> clickCallback) {
_topButton = base::make_unique_q<Ui::IconButton>(this, st);
auto result = QPointer<Ui::IconButton>(_topButton.get());
result->setClickedCallback(std::move(clickCallback));
result->show();
updateButtonsPositions();
return result;
}
void AbstractBox::showLoading(bool show) {
const auto &st = st::boxLoadingAnimation;
if (!show) {
if (_loadingProgress && !_loadingProgress->removeTimer.isActive()) {
_loadingProgress->removeTimer.callOnce(
st.sineDuration + st.sinePeriod);
_loadingProgress->animation.stop();
}
return;
}
if (!_loadingProgress) {
const auto callback = [=] {
if (!anim::Disabled()) {
const auto t = st::boxLoadingAnimation.thickness;
update(loadingRect().marginsAdded({ t, t, t, t }));
}
};
_loadingProgress = std::make_unique<LoadingProgress>(
callback,
st::boxLoadingAnimation);
_loadingProgress->removeTimer.setCallback([=] {
_loadingProgress = nullptr;
});
} else {
_loadingProgress->removeTimer.cancel();
}
_loadingProgress->animation.start();
}
void AbstractBox::setDimensions(int newWidth, int maxHeight, bool forceCenterPosition) {
_maxContentHeight = maxHeight;
auto fullHeight = countFullHeight();
if (width() != newWidth || _fullHeight != fullHeight) {
_fullHeight = fullHeight;
if (parentWidget()) {
auto oldGeometry = geometry();
resize(newWidth, countRealHeight());
auto newGeometry = geometry();
auto parentHeight = parentWidget()->height();
if (newGeometry.top() + newGeometry.height() + st::boxVerticalMargin > parentHeight
|| forceCenterPosition) {
const auto top1 = parentHeight - int(st::boxVerticalMargin) - newGeometry.height();
const auto top2 = (parentHeight - newGeometry.height()) / 2;
const auto newTop = forceCenterPosition
? std::min(top1, top2)
: std::max(top1, top2);
if (newTop != newGeometry.top()) {
move(newGeometry.left(), newTop);
resizeEvent(0);
}
}
parentWidget()->update(oldGeometry.united(geometry()).marginsAdded(st::boxRoundShadow.extend));
} else {
resize(newWidth, 0);
}
}
}
int AbstractBox::countRealHeight() const {
return qMin(_fullHeight, parentWidget()->height() - 2 * st::boxVerticalMargin);
}
int AbstractBox::countFullHeight() const {
return contentTop() + _maxContentHeight + buttonsHeight();
}
int AbstractBox::contentTop() const {
return hasTitle() ? titleHeight() : (_noContentMargin ? 0 : st::boxTopMargin);
}
void AbstractBox::resizeEvent(QResizeEvent *e) {
updateButtonsPositions();
updateTitlePosition();
auto top = contentTop();
_content->resize(width(), height() - top - buttonsHeight());
_content->moveToLeft(0, top);
LayerWidget::resizeEvent(e);
}
void AbstractBox::keyPressEvent(QKeyEvent *e) {
if (e->key() == Qt::Key_Escape) {
closeBox();
} else {
LayerWidget::keyPressEvent(e);
}
}
BoxContentDivider::BoxContentDivider(QWidget *parent)
: BoxContentDivider(parent, st::rightsDividerHeight) {
}
BoxContentDivider::BoxContentDivider(QWidget *parent, int height)
: RpWidget(parent) {
resize(width(), height);
}
void BoxContentDivider::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(e->rect(), st::contactsAboutBg);
auto dividerFillTop = myrtlrect(0, 0, width(), st::profileDividerTop.height());
st::profileDividerTop.fill(p, dividerFillTop);
auto dividerFillBottom = myrtlrect(0, height() - st::profileDividerBottom.height(), width(), st::profileDividerBottom.height());
st::profileDividerBottom.fill(p, dividerFillBottom);
}
namespace Ui { namespace Ui {
namespace internal { namespace internal {
void showBox( void showBox(
object_ptr<BoxContent> content, object_ptr<BoxContent> content,
LayerOptions options, LayerOptions options,
anim::type animated) { anim::type animated) {
if (auto w = App::wnd()) { if (auto w = App::wnd()) {
w->ui_showBox(std::move(content), options, animated); w->ui_showBox(std::move(content), options, animated);
} }
@ -634,14 +45,4 @@ bool isLayerShown() {
return false; return false;
} }
int DividerLabel::naturalWidth() const {
return -1;
}
void DividerLabel::resizeEvent(QResizeEvent *e) {
_background->lower();
_background->setGeometry(rect());
return PaddingWrap::resizeEvent(e);
}
} // namespace Ui } // namespace Ui

View file

@ -7,14 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#pragma once #pragma once
#include "window/layer_widget.h" #include "ui/layers/box_layer_widget.h"
#include "base/unique_qptr.h"
#include "base/flags.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/widgets/labels.h"
#include "ui/effects/animation_value.h"
#include "ui/text/text_entity.h"
#include "ui/rp_widget.h"
class Painter; class Painter;
@ -32,413 +25,13 @@ class FlatLabel;
class FadeShadow; class FadeShadow;
} // namespace Ui } // namespace Ui
class BoxContent;
class BoxContentDelegate {
public:
virtual void setLayerType(bool layerType) = 0;
virtual void setTitle(rpl::producer<TextWithEntities> title) = 0;
virtual void setAdditionalTitle(rpl::producer<QString> additional) = 0;
virtual void setCloseByOutsideClick(bool close) = 0;
virtual void clearButtons() = 0;
virtual QPointer<Ui::RoundButton> addButton(
rpl::producer<QString> text,
Fn<void()> clickCallback,
const style::RoundButton &st) = 0;
virtual QPointer<Ui::RoundButton> addLeftButton(
rpl::producer<QString> text,
Fn<void()> clickCallback,
const style::RoundButton &st) = 0;
virtual QPointer<Ui::IconButton> addTopButton(
const style::IconButton &st,
Fn<void()> clickCallback) = 0;
virtual void showLoading(bool show) = 0;
virtual void updateButtonsPositions() = 0;
virtual void showBox(
object_ptr<BoxContent> box,
LayerOptions options,
anim::type animated) = 0;
virtual void setDimensions(
int newWidth,
int maxHeight,
bool forceCenterPosition = false) = 0;
virtual void setNoContentMargin(bool noContentMargin) = 0;
virtual bool isBoxShown() const = 0;
virtual void closeBox() = 0;
template <typename BoxType>
QPointer<BoxType> show(
object_ptr<BoxType> content,
LayerOptions options = LayerOption::KeepOther,
anim::type animated = anim::type::normal) {
auto result = QPointer<BoxType>(content.data());
showBox(std::move(content), options, animated);
return result;
}
virtual QPointer<QWidget> outerContainer() = 0;
};
class BoxContent : public Ui::RpWidget {
Q_OBJECT
public:
BoxContent() {
setAttribute(Qt::WA_OpaquePaintEvent);
}
bool isBoxShown() const {
return getDelegate()->isBoxShown();
}
void closeBox() {
getDelegate()->closeBox();
}
void setTitle(rpl::producer<QString> title);
void setTitle(rpl::producer<TextWithEntities> title) {
getDelegate()->setTitle(std::move(title));
}
void setAdditionalTitle(rpl::producer<QString> additional) {
getDelegate()->setAdditionalTitle(std::move(additional));
}
void setCloseByEscape(bool close) {
_closeByEscape = close;
}
void setCloseByOutsideClick(bool close) {
getDelegate()->setCloseByOutsideClick(close);
}
void scrollToWidget(not_null<QWidget*> widget);
void clearButtons() {
getDelegate()->clearButtons();
}
QPointer<Ui::RoundButton> addButton(
rpl::producer<QString> text,
Fn<void()> clickCallback = nullptr);
QPointer<Ui::RoundButton> addLeftButton(
rpl::producer<QString> text,
Fn<void()> clickCallback = nullptr);
QPointer<Ui::IconButton> addTopButton(
const style::IconButton &st,
Fn<void()> clickCallback = nullptr) {
return getDelegate()->addTopButton(st, std::move(clickCallback));
}
QPointer<Ui::RoundButton> addButton(
rpl::producer<QString> text,
const style::RoundButton &st) {
return getDelegate()->addButton(std::move(text), nullptr, st);
}
QPointer<Ui::RoundButton> addButton(
rpl::producer<QString> text,
Fn<void()> clickCallback,
const style::RoundButton &st) {
return getDelegate()->addButton(
std::move(text),
std::move(clickCallback),
st);
}
void showLoading(bool show) {
getDelegate()->showLoading(show);
}
void updateButtonsGeometry() {
getDelegate()->updateButtonsPositions();
}
virtual void setInnerFocus() {
setFocus();
}
rpl::producer<> boxClosing() const {
return _boxClosingStream.events();
}
void notifyBoxClosing() {
_boxClosingStream.fire({});
}
void setDelegate(not_null<BoxContentDelegate*> newDelegate) {
_delegate = newDelegate;
_preparing = true;
prepare();
finishPrepare();
}
not_null<BoxContentDelegate*> getDelegate() const {
return _delegate;
}
public slots:
void onScrollToY(int top, int bottom = -1);
void onDraggingScrollDelta(int delta);
protected:
virtual void prepare() = 0;
void setLayerType(bool layerType) {
getDelegate()->setLayerType(layerType);
}
void setNoContentMargin(bool noContentMargin) {
if (_noContentMargin != noContentMargin) {
_noContentMargin = noContentMargin;
setAttribute(Qt::WA_OpaquePaintEvent, !_noContentMargin);
}
getDelegate()->setNoContentMargin(noContentMargin);
}
void setDimensions(
int newWidth,
int maxHeight,
bool forceCenterPosition = false) {
getDelegate()->setDimensions(
newWidth,
maxHeight,
forceCenterPosition);
}
void setDimensionsToContent(
int newWidth,
not_null<Ui::RpWidget*> content);
void setInnerTopSkip(int topSkip, bool scrollBottomFixed = false);
void setInnerBottomSkip(int bottomSkip);
template <typename Widget>
QPointer<Widget> setInnerWidget(
object_ptr<Widget> inner,
const style::ScrollArea &st,
int topSkip = 0,
int bottomSkip = 0) {
auto result = QPointer<Widget>(inner.data());
setInnerTopSkip(topSkip);
setInnerBottomSkip(bottomSkip);
setInner(std::move(inner), st);
return result;
}
template <typename Widget>
QPointer<Widget> setInnerWidget(
object_ptr<Widget> inner,
int topSkip = 0,
int bottomSkip = 0) {
auto result = QPointer<Widget>(inner.data());
setInnerTopSkip(topSkip);
setInnerBottomSkip(bottomSkip);
setInner(std::move(inner));
return result;
}
template <typename Widget>
object_ptr<Widget> takeInnerWidget() {
return object_ptr<Widget>::fromRaw(
static_cast<Widget*>(doTakeInnerWidget().release()));
}
void setInnerVisible(bool scrollAreaVisible);
QPixmap grabInnerCache();
void resizeEvent(QResizeEvent *e) override;
void paintEvent(QPaintEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
private slots:
void onScroll();
void onInnerResize();
void onDraggingScrollTimer();
private:
void finishPrepare();
void finishScrollCreate();
void setInner(object_ptr<TWidget> inner);
void setInner(object_ptr<TWidget> inner, const style::ScrollArea &st);
void updateScrollAreaGeometry();
void updateInnerVisibleTopBottom();
void updateShadowsVisibility();
object_ptr<TWidget> doTakeInnerWidget();
BoxContentDelegate *_delegate = nullptr;
bool _preparing = false;
bool _noContentMargin = false;
bool _closeByEscape = true;
int _innerTopSkip = 0;
int _innerBottomSkip = 0;
object_ptr<Ui::ScrollArea> _scroll = { nullptr };
object_ptr<Ui::FadeShadow> _topShadow = { nullptr };
object_ptr<Ui::FadeShadow> _bottomShadow = { nullptr };
object_ptr<QTimer> _draggingScrollTimer = { nullptr };
int _draggingScrollDelta = 0;
rpl::event_stream<> _boxClosingStream;
};
class AbstractBox : public Window::LayerWidget, public BoxContentDelegate {
public:
AbstractBox(
not_null<Window::LayerStackWidget*> layer,
object_ptr<BoxContent> content);
~AbstractBox();
void parentResized() override;
void setLayerType(bool layerType) override;
void setTitle(rpl::producer<TextWithEntities> title) override;
void setAdditionalTitle(rpl::producer<QString> additional) override;
void showBox(
object_ptr<BoxContent> box,
LayerOptions options,
anim::type animated) override;
void clearButtons() override;
QPointer<Ui::RoundButton> addButton(
rpl::producer<QString> text,
Fn<void()> clickCallback,
const style::RoundButton &st) override;
QPointer<Ui::RoundButton> addLeftButton(
rpl::producer<QString> text,
Fn<void()> clickCallback,
const style::RoundButton &st) override;
QPointer<Ui::IconButton> addTopButton(
const style::IconButton &st,
Fn<void()> clickCallback) override;
void showLoading(bool show) override;
void updateButtonsPositions() override;
QPointer<QWidget> outerContainer() override;
void setDimensions(
int newWidth,
int maxHeight,
bool forceCenterPosition = false) override;
void setNoContentMargin(bool noContentMargin) override {
if (_noContentMargin != noContentMargin) {
_noContentMargin = noContentMargin;
updateSize();
}
}
bool isBoxShown() const override {
return !isHidden();
}
void closeBox() override {
closeLayer();
}
void setCloseByOutsideClick(bool close) override;
bool closeByOutsideClick() const override;
protected:
void keyPressEvent(QKeyEvent *e) override;
void resizeEvent(QResizeEvent *e) override;
void paintEvent(QPaintEvent *e) override;
void doSetInnerFocus() override {
_content->setInnerFocus();
}
void closeHook() override {
_content->notifyBoxClosing();
}
private:
struct LoadingProgress;
void paintAdditionalTitle(Painter &p);
void updateTitlePosition();
[[nodiscard]] bool hasTitle() const;
[[nodiscard]] int titleHeight() const;
[[nodiscard]] int buttonsHeight() const;
[[nodiscard]] int buttonsTop() const;
[[nodiscard]] int contentTop() const;
[[nodiscard]] int countFullHeight() const;
[[nodiscard]] int countRealHeight() const;
[[nodiscard]] QRect loadingRect() const;
void updateSize();
not_null<Window::LayerStackWidget*> _layer;
int _fullHeight = 0;
bool _noContentMargin = false;
int _maxContentHeight = 0;
object_ptr<BoxContent> _content;
object_ptr<Ui::FlatLabel> _title = { nullptr };
Fn<TextWithEntities()> _titleFactory;
rpl::variable<QString> _additionalTitle;
int _titleLeft = 0;
int _titleTop = 0;
bool _layerType = false;
bool _closeByOutsideClick = true;
std::vector<object_ptr<Ui::RoundButton>> _buttons;
object_ptr<Ui::RoundButton> _leftButton = { nullptr };
base::unique_qptr<Ui::IconButton> _topButton = { nullptr };
std::unique_ptr<LoadingProgress> _loadingProgress;
};
class BoxContentDivider : public Ui::RpWidget {
public:
BoxContentDivider(QWidget *parent);
BoxContentDivider(QWidget *parent, int height);
protected:
void paintEvent(QPaintEvent *e) override;
};
class BoxPointer {
public:
BoxPointer() = default;
BoxPointer(const BoxPointer &other) = default;
BoxPointer(BoxPointer &&other) : _value(base::take(other._value)) {
}
BoxPointer &operator=(const BoxPointer &other) {
if (_value != other._value) {
destroy();
_value = other._value;
}
return *this;
}
BoxPointer &operator=(BoxPointer &&other) {
if (_value != other._value) {
destroy();
_value = base::take(other._value);
}
return *this;
}
BoxPointer &operator=(BoxContent *other) {
if (_value != other) {
destroy();
_value = other;
}
return *this;
}
~BoxPointer() {
destroy();
}
private:
void destroy() {
if (const auto value = base::take(_value)) {
value->closeBox();
}
}
QPointer<BoxContent> _value;
};
// Legacy global method. // Legacy global method.
namespace Ui { namespace Ui {
namespace internal { namespace internal {
void showBox( void showBox(
object_ptr<BoxContent> content, object_ptr<BoxContent> content,
LayerOptions options, Ui::LayerOptions options,
anim::type animated); anim::type animated);
} // namespace internal } // namespace internal
@ -446,7 +39,7 @@ void showBox(
template <typename BoxType> template <typename BoxType>
QPointer<BoxType> show( QPointer<BoxType> show(
object_ptr<BoxType> content, object_ptr<BoxType> content,
LayerOptions options = LayerOption::CloseOther, Ui::LayerOptions options = Ui::LayerOption::CloseOther,
anim::type animated = anim::type::normal) { anim::type animated = anim::type::normal) {
auto result = QPointer<BoxType>(content.data()); auto result = QPointer<BoxType>(content.data());
internal::showBox(std::move(content), options, animated); internal::showBox(std::move(content), options, animated);
@ -457,19 +50,4 @@ void hideLayer(anim::type animated = anim::type::normal);
void hideSettingsAndLayer(anim::type animated = anim::type::normal); void hideSettingsAndLayer(anim::type animated = anim::type::normal);
bool isLayerShown(); bool isLayerShown();
class DividerLabel : public PaddingWrap<FlatLabel> {
public:
using PaddingWrap::PaddingWrap;
int naturalWidth() const override;
protected:
void resizeEvent(QResizeEvent *e) override;
private:
object_ptr<BoxContentDivider> _background
= object_ptr<BoxContentDivider>(this);
};
} // namespace Ui } // namespace Ui

View file

@ -7,8 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "boxes/add_contact_box.h" #include "boxes/add_contact_box.h"
#include "styles/style_boxes.h"
#include "styles/style_dialogs.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "mtproto/sender.h" #include "mtproto/sender.h"
#include "base/flat_set.h" #include "base/flat_set.h"
@ -42,6 +40,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "observer_peer.h" #include "observer_peer.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "facades.h" #include "facades.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_dialogs.h"
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtGui/QClipboard> #include <QtGui/QClipboard>
@ -164,7 +165,7 @@ void ShowAddParticipantsError(
tr::lng_cant_invite_make_admin(tr::now), tr::lng_cant_invite_make_admin(tr::now),
tr::lng_cancel(tr::now), tr::lng_cancel(tr::now),
makeAdmin), makeAdmin),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} }
@ -199,7 +200,7 @@ void ShowAddParticipantsError(
} }
return tr::lng_failed_add_participant(tr::now); return tr::lng_failed_add_participant(tr::now);
}(); }();
Ui::show(Box<InformBox>(text), LayerOption::KeepOther); Ui::show(Box<InformBox>(text), Ui::LayerOption::KeepOther);
} }
class RevokePublicLinkBox::Inner : public TWidget, private MTP::Sender { class RevokePublicLinkBox::Inner : public TWidget, private MTP::Sender {
@ -588,16 +589,16 @@ void GroupInfoBox::createGroup(
} else if (error.type() == qstr("USERS_TOO_FEW")) { } else if (error.type() == qstr("USERS_TOO_FEW")) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_cant_invite_privacy(tr::now)), Box<InformBox>(tr::lng_cant_invite_privacy(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} else if (error.type() == qstr("PEER_FLOOD")) { } else if (error.type() == qstr("PEER_FLOOD")) {
Ui::show( Ui::show(
Box<InformBox>( Box<InformBox>(
PeerFloodErrorText(PeerFloodType::InviteGroup)), PeerFloodErrorText(PeerFloodType::InviteGroup)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} else if (error.type() == qstr("USER_RESTRICTED")) { } else if (error.type() == qstr("USER_RESTRICTED")) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_cant_do_this(tr::now)), Box<InformBox>(tr::lng_cant_do_this(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
}).send(); }).send();
} }
@ -636,7 +637,7 @@ void GroupInfoBox::submit() {
Box<PeerListBox>( Box<PeerListBox>(
std::make_unique<AddParticipantsBoxController>(_navigation), std::make_unique<AddParticipantsBoxController>(_navigation),
std::move(initBox)), std::move(initBox)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
} }
@ -1031,7 +1032,7 @@ void SetupChannelBox::privacyChanged(Privacy value) {
Box<RevokePublicLinkBox>( Box<RevokePublicLinkBox>(
&_channel->session(), &_channel->session(),
callback), callback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
_link->show(); _link->show();
@ -1126,14 +1127,14 @@ void SetupChannelBox::showRevokePublicLinkBoxForEdit() {
const auto callback = [=] { const auto callback = [=] {
Ui::show( Ui::show(
Box<SetupChannelBox>(navigation, channel, existing), Box<SetupChannelBox>(navigation, channel, existing),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
}; };
closeBox(); closeBox();
Ui::show( Ui::show(
Box<RevokePublicLinkBox>( Box<RevokePublicLinkBox>(
&channel->session(), &channel->session(),
callback), callback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
bool SetupChannelBox::onFirstCheckFail(const RPCError &error) { bool SetupChannelBox::onFirstCheckFail(const RPCError &error) {
@ -1412,7 +1413,7 @@ void RevokePublicLinkBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
callback(); callback();
} }
}).send(); }).send();
})), LayerOption::KeepOther); })), Ui::LayerOption::KeepOther);
} }
} }

View file

@ -54,7 +54,7 @@ void ShowAddParticipantsError(
not_null<PeerData*> chat, not_null<PeerData*> chat,
const std::vector<not_null<UserData*>> &users); const std::vector<not_null<UserData*>> &users);
class AddContactBox : public BoxContent { class AddContactBox : public Ui::BoxContent {
public: public:
AddContactBox(QWidget*, not_null<Main::Session*> session); AddContactBox(QWidget*, not_null<Main::Session*> session);
AddContactBox( AddContactBox(
@ -94,7 +94,7 @@ private:
}; };
class GroupInfoBox : public BoxContent, private MTP::Sender { class GroupInfoBox : public Ui::BoxContent, private MTP::Sender {
public: public:
enum class Type { enum class Type {
Group, Group,
@ -140,7 +140,7 @@ private:
}; };
class SetupChannelBox class SetupChannelBox
: public BoxContent : public Ui::BoxContent
, public RPCSender , public RPCSender
, private base::Subscriber { , private base::Subscriber {
public: public:
@ -209,7 +209,7 @@ private:
}; };
class EditNameBox : public BoxContent, public RPCSender { class EditNameBox : public Ui::BoxContent, public RPCSender {
public: public:
EditNameBox(QWidget*, not_null<UserData*> user); EditNameBox(QWidget*, not_null<UserData*> user);
@ -238,7 +238,7 @@ private:
}; };
class RevokePublicLinkBox class RevokePublicLinkBox
: public BoxContent : public Ui::BoxContent
, public RPCSender , public RPCSender
, private base::Subscriber { , private base::Subscriber {
public: public:

View file

@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/localstorage.h" #include "storage/localstorage.h"
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "export/view/export_view_settings.h" #include "export/view/export_view_settings.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_settings.h" #include "styles/style_settings.h"

View file

@ -19,7 +19,7 @@ enum class Source;
} // namespace AutoDownload } // namespace AutoDownload
} // namespace Data } // namespace Data
class AutoDownloadBox : public BoxContent { class AutoDownloadBox : public Ui::BoxContent {
public: public:
AutoDownloadBox( AutoDownloadBox(
QWidget*, QWidget*,

View file

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h" #include "mainwindow.h"
#include "ui/widgets/checkbox.h" #include "ui/widgets/checkbox.h"
#include "facades.h" #include "facades.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
AutoLockBox::AutoLockBox(QWidget*, not_null<Main::Session*> session) AutoLockBox::AutoLockBox(QWidget*, not_null<Main::Session*> session)

View file

@ -17,7 +17,7 @@ namespace Ui {
class Radiobutton; class Radiobutton;
} // namespace Ui } // namespace Ui
class AutoLockBox : public BoxContent { class AutoLockBox : public Ui::BoxContent {
public: public:
AutoLockBox(QWidget*, not_null<Main::Session*> session); AutoLockBox(QWidget*, not_null<Main::Session*> session);

View file

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/confirm_box.h" #include "boxes/confirm_box.h"
#include "app.h" #include "app.h"
#include "styles/style_overview.h" #include "styles/style_overview.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h" #include "styles/style_chat_helpers.h"
@ -144,7 +145,7 @@ void BackgroundBox::prepare() {
) | rpl::start_with_next([=](const Data::WallPaper &paper) { ) | rpl::start_with_next([=](const Data::WallPaper &paper) {
Ui::show( Ui::show(
Box<BackgroundPreviewBox>(_session, paper), Box<BackgroundPreviewBox>(_session, paper),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
}, _inner->lifetime()); }, _inner->lifetime());
_inner->removeRequests( _inner->removeRequests(
@ -154,7 +155,7 @@ void BackgroundBox::prepare() {
} }
void BackgroundBox::removePaper(const Data::WallPaper &paper) { void BackgroundBox::removePaper(const Data::WallPaper &paper) {
const auto box = std::make_shared<QPointer<BoxContent>>(); const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto session = _session; const auto session = _session;
const auto remove = [=, weak = Ui::MakeWeak(this)]{ const auto remove = [=, weak = Ui::MakeWeak(this)]{
if (*box) { if (*box) {
@ -176,7 +177,7 @@ void BackgroundBox::removePaper(const Data::WallPaper &paper) {
tr::lng_selected_delete(tr::now), tr::lng_selected_delete(tr::now),
tr::lng_cancel(tr::now), tr::lng_cancel(tr::now),
remove), remove),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
BackgroundBox::Inner::Inner( BackgroundBox::Inner::Inner(

View file

@ -17,7 +17,7 @@ namespace Data {
class WallPaper; class WallPaper;
} // namespace Data } // namespace Data
class BackgroundBox : public BoxContent { class BackgroundBox : public Ui::BoxContent {
public: public:
BackgroundBox(QWidget*, not_null<Main::Session*> session); BackgroundBox(QWidget*, not_null<Main::Session*> session);

View file

@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/background_preview_box.h" #include "boxes/background_preview_box.h"
#include "app.h" #include "app.h"
#include "styles/style_history.h" #include "styles/style_history.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include <QtGui/QClipboard> #include <QtGui/QClipboard>

View file

@ -24,7 +24,7 @@ class Checkbox;
} // namespace Ui } // namespace Ui
class BackgroundPreviewBox class BackgroundPreviewBox
: public BoxContent : public Ui::BoxContent
, private HistoryView::SimpleElementDelegate , private HistoryView::SimpleElementDelegate
, private base::Subscriber { , private base::Subscriber {
public: public:

View file

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
using "ui/basic.style"; using "ui/basic.style";
using "ui/layers/layers.style";
using "ui/widgets/widgets.style"; using "ui/widgets/widgets.style";
using "intro/intro.style"; using "intro/intro.style";
@ -31,135 +32,6 @@ FeedUserpicButton {
innerPart: UserpicButton; innerPart: UserpicButton;
} }
ServiceCheck {
margin: margins;
diameter: pixels;
shift: pixels;
thickness: pixels;
tip: point;
small: pixels;
large: pixels;
stroke: pixels;
color: color;
duration: int;
}
boxDuration: 200;
boxRadius: 3px;
boxButtonFont: font(boxFontSize semibold);
defaultBoxButton: RoundButton(defaultLightButton) {
width: -24px;
height: 36px;
font: boxButtonFont;
}
boxTextStyle: TextStyle(defaultTextStyle) {
font: font(boxFontSize);
linkFont: font(boxFontSize);
linkFontOver: font(boxFontSize underline);
}
boxLabelStyle: TextStyle(boxTextStyle) {
lineHeight: 22px;
}
attentionBoxButton: RoundButton(defaultBoxButton) {
textFg: attentionButtonFg;
textFgOver: attentionButtonFgOver;
textBgOver: attentionButtonBgOver;
ripple: RippleAnimation(defaultRippleAnimation) {
color: attentionButtonBgRipple;
}
}
defaultBoxCheckbox: Checkbox(defaultCheckbox) {
width: -46px;
textPosition: point(12px, 1px);
style: boxTextStyle;
}
boxRoundShadow: Shadow {
left: icon {{ "round_shadow_box_left", windowShadowFg }};
topLeft: icon {{ "round_shadow_box_top_left", windowShadowFg }};
top: icon {{ "round_shadow_box_top", windowShadowFg }};
topRight: icon {{ "round_shadow_box_top_left-flip_horizontal", windowShadowFg }};
right: icon {{ "round_shadow_box_left-flip_horizontal", windowShadowFg }};
bottomRight: icon {{ "round_shadow_box_bottom_left-flip_horizontal", windowShadowFg }};
bottom: icon {{ "round_shadow_box_bottom", windowShadowFg }};
bottomLeft: icon {{ "round_shadow_box_bottom_left", windowShadowFg }};
extend: margins(10px, 10px, 10px, 10px);
fallback: windowShadowFgFallback;
}
boxTitleFont: font(17px semibold);
boxTitle: FlatLabel(defaultFlatLabel) {
textFg: boxTitleFg;
maxHeight: 24px;
style: TextStyle(defaultTextStyle) {
font: boxTitleFont;
linkFont: boxTitleFont;
linkFontOver: font(17px semibold underline);
}
}
boxTitlePosition: point(23px, 16px);
boxTitleHeight: 56px;
boxLayerTitlePosition: point(23px, 16px);
boxLayerTitleHeight: 56px;
boxLayerTitleAdditionalSkip: 9px;
boxLayerTitleAdditionalFont: normalFont;
boxLayerScroll: defaultSolidScroll;
boxRowPadding: margins(23px, 0px, 23px, 0px);
boxTopMargin: 6px;
boxTitleClose: IconButton(defaultIconButton) {
width: boxTitleHeight;
height: boxTitleHeight;
icon: boxTitleCloseIcon;
iconOver: boxTitleCloseIconOver;
rippleAreaPosition: point(6px, 6px);
rippleAreaSize: 44px;
ripple: RippleAnimation(defaultRippleAnimation) {
color: windowBgOver;
}
}
boxLinkButton: LinkButton(defaultLinkButton) {
font: boxTextFont;
overFont: font(boxFontSize underline);
}
boxOptionListPadding: margins(0px, 0px, 0px, 0px);
boxOptionListSkip: 20px;
boxOptionInputSkip: 6px;
boxVerticalMargin: 10px;
boxWidth: 320px;
boxWideWidth: 364px;
boxPadding: margins(23px, 30px, 23px, 8px);
boxMaxListHeight: 492px;
boxLittleSkip: 10px;
boxMediumSkip: 20px;
boxButtonPadding: margins(8px, 12px, 13px, 12px);
boxLayerButtonPadding: margins(8px, 8px, 8px, 8px);
boxLabel: FlatLabel(defaultFlatLabel) {
minWidth: 274px;
align: align(topleft);
style: boxLabelStyle;
}
boxDividerLabel: FlatLabel(boxLabel) {
minWidth: 245px;
align: align(topleft);
textFg: windowSubTextFg;
style: defaultTextStyle;
}
countryRowHeight: 36px; countryRowHeight: 36px;
countryRowNameFont: semiboldFont; countryRowNameFont: semiboldFont;
countryRowNameFg: boxTextFg; countryRowNameFg: boxTextFg;
@ -204,12 +76,6 @@ defaultFeedUserpicButton: FeedUserpicButton {
innerPart: defaultUserpicButton; innerPart: defaultUserpicButton;
} }
boxLoadingAnimation: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
color: windowSubTextFg;
thickness: 2px;
}
boxLoadingSize: 20px;
cropPointSize: 10px; cropPointSize: 10px;
cropSkip: 13px; cropSkip: 13px;
cropMinSize: 20px; cropMinSize: 20px;
@ -768,7 +634,7 @@ rightsToggle: Toggle(defaultToggle) {
stroke: 2px; stroke: 2px;
duration: 120; duration: 120;
} }
rightsDividerHeight: 10px; rightsDividerHeight: boxDividerHeight;
rightsDividerMargin: margins(0px, 0px, 0px, 20px); rightsDividerMargin: margins(0px, 0px, 0px, 20px);
rightsHeaderMargin: margins(23px, 0px, 23px, 8px); rightsHeaderMargin: margins(23px, 0px, 23px, 8px);
rightsToggleMargin: margins(23px, 8px, 23px, 8px); rightsToggleMargin: margins(23px, 8px, 23px, 8px);

View file

@ -17,7 +17,7 @@ namespace Ui {
class IconButton; class IconButton;
} // namespace Ui } // namespace Ui
class CalendarBox : public BoxContent, private base::Subscriber { class CalendarBox : public Ui::BoxContent, private base::Subscriber {
public: public:
CalendarBox( CalendarBox(
QWidget*, QWidget*,

View file

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h" #include "data/data_session.h"
#include "data/data_user.h" #include "data/data_user.h"
#include "app.h" #include "app.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
namespace { namespace {
@ -61,7 +62,7 @@ void createErrorLabel(
} // namespace } // namespace
class ChangePhoneBox::EnterPhone : public BoxContent { class ChangePhoneBox::EnterPhone : public Ui::BoxContent {
public: public:
EnterPhone(QWidget*, not_null<Main::Session*> session); EnterPhone(QWidget*, not_null<Main::Session*> session);
@ -89,7 +90,7 @@ private:
}; };
class ChangePhoneBox::EnterCode : public BoxContent { class ChangePhoneBox::EnterCode : public Ui::BoxContent {
public: public:
EnterCode( EnterCode(
QWidget*, QWidget*,
@ -214,7 +215,7 @@ void ChangePhoneBox::EnterPhone::sendPhoneDone(const QString &phoneNumber, const
phoneCodeHash, phoneCodeHash,
codeLength, codeLength,
callTimeout), callTimeout),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
bool ChangePhoneBox::EnterPhone::sendPhoneFail(const QString &phoneNumber, const RPCError &error) { bool ChangePhoneBox::EnterPhone::sendPhoneFail(const QString &phoneNumber, const RPCError &error) {

View file

@ -13,7 +13,7 @@ namespace Main {
class Session; class Session;
} // namespace Main } // namespace Main
class ChangePhoneBox : public BoxContent { class ChangePhoneBox : public Ui::BoxContent {
public: public:
ChangePhoneBox(QWidget*, not_null<Main::Session*> session); ChangePhoneBox(QWidget*, not_null<Main::Session*> session);

View file

@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "boxes/confirm_box.h" #include "boxes/confirm_box.h"
#include "styles/style_boxes.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
@ -36,6 +35,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "observer_peer.h" #include "observer_peer.h"
#include "facades.h" #include "facades.h"
#include "app.h" #include "app.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtGui/QClipboard> #include <QtGui/QClipboard>

View file

@ -20,7 +20,7 @@ class EmptyUserpic;
} // namespace Ui } // namespace Ui
class InformBox; class InformBox;
class ConfirmBox : public BoxContent, public ClickHandlerHost { class ConfirmBox : public Ui::BoxContent, public ClickHandlerHost {
public: public:
ConfirmBox(QWidget*, const QString &text, FnMut<void()> confirmedCallback = FnMut<void()>(), FnMut<void()> cancelledCallback = FnMut<void()>()); ConfirmBox(QWidget*, const QString &text, FnMut<void()> confirmedCallback = FnMut<void()>(), FnMut<void()> cancelledCallback = FnMut<void()>());
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, FnMut<void()> confirmedCallback = FnMut<void()>(), FnMut<void()> cancelledCallback = FnMut<void()>()); ConfirmBox(QWidget*, const QString &text, const QString &confirmText, FnMut<void()> confirmedCallback = FnMut<void()>(), FnMut<void()> cancelledCallback = FnMut<void()>());
@ -95,7 +95,7 @@ public:
}; };
class MaxInviteBox : public BoxContent, private base::Subscriber { class MaxInviteBox : public Ui::BoxContent, private base::Subscriber {
public: public:
MaxInviteBox(QWidget*, not_null<ChannelData*> channel); MaxInviteBox(QWidget*, not_null<ChannelData*> channel);
@ -123,7 +123,7 @@ private:
}; };
class PinMessageBox : public BoxContent, public RPCSender { class PinMessageBox : public Ui::BoxContent, public RPCSender {
public: public:
PinMessageBox(QWidget*, not_null<PeerData*> peer, MsgId msgId); PinMessageBox(QWidget*, not_null<PeerData*> peer, MsgId msgId);
@ -148,7 +148,7 @@ private:
}; };
class DeleteMessagesBox : public BoxContent, public RPCSender { class DeleteMessagesBox : public Ui::BoxContent, public RPCSender {
public: public:
DeleteMessagesBox( DeleteMessagesBox(
QWidget*, QWidget*,
@ -202,7 +202,7 @@ private:
}; };
class ConfirmInviteBox class ConfirmInviteBox
: public BoxContent : public Ui::BoxContent
, public RPCSender , public RPCSender
, private base::Subscriber { , private base::Subscriber {
public: public:
@ -238,7 +238,7 @@ private:
}; };
class ConfirmDontWarnBox : public BoxContent { class ConfirmDontWarnBox : public Ui::BoxContent {
public: public:
ConfirmDontWarnBox( ConfirmDontWarnBox(
QWidget*, QWidget*,

View file

@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "boxes/confirm_phone_box.h" #include "boxes/confirm_phone_box.h"
#include "styles/style_boxes.h"
#include "boxes/confirm_box.h" #include "boxes/confirm_box.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h" #include "ui/widgets/input_fields.h"
@ -20,6 +19,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "numbers.h" #include "numbers.h"
#include "app.h" #include "app.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
namespace { namespace {
@ -54,7 +55,7 @@ Locale: ") + Platform::SystemLanguage();
} // namespace } // namespace
void ShowPhoneBannedError(const QString &phone) { void ShowPhoneBannedError(const QString &phone) {
const auto box = std::make_shared<QPointer<BoxContent>>(); const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto close = [=] { const auto close = [=] {
if (*box) { if (*box) {
(*box)->closeBox(); (*box)->closeBox();

View file

@ -85,7 +85,7 @@ private:
}; };
class ConfirmPhoneBox : public BoxContent, public RPCSender { class ConfirmPhoneBox : public Ui::BoxContent, public RPCSender {
public: public:
static void start(const QString &phone, const QString &hash); static void start(const QString &phone, const QString &hash);

View file

@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/radial_animation.h" #include "ui/effects/radial_animation.h"
#include "ui/text_options.h" #include "ui/text_options.h"
#include "facades.h" #include "facades.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h" #include "styles/style_chat_helpers.h"
#include "styles/style_info.h" #include "styles/style_info.h"
@ -134,7 +135,7 @@ private:
}; };
class ProxiesBox : public BoxContent { class ProxiesBox : public Ui::BoxContent {
public: public:
using View = ProxiesBoxController::ItemView; using View = ProxiesBoxController::ItemView;
@ -166,7 +167,7 @@ private:
}; };
class ProxyBox : public BoxContent { class ProxyBox : public Ui::BoxContent {
public: public:
ProxyBox( ProxyBox(
QWidget*, QWidget*,
@ -1029,7 +1030,7 @@ void ProxiesBoxController::ShowApplyConfirmation(
if (const auto strong = box->data()) { if (const auto strong = box->data()) {
strong->closeBox(); strong->closeBox();
} }
}), LayerOption::KeepOther); }), Ui::LayerOption::KeepOther);
} else { } else {
Ui::show(Box<InformBox>( Ui::show(Box<InformBox>(
(proxy.status() == ProxyData::Status::Unsupported (proxy.status() == ProxyData::Status::Unsupported
@ -1134,14 +1135,14 @@ void ProxiesBoxController::setupChecker(int id, const Checker &checker) {
pointer->connect(pointer, &Connection::error, failed); pointer->connect(pointer, &Connection::error, failed);
} }
object_ptr<BoxContent> ProxiesBoxController::CreateOwningBox() { object_ptr<Ui::BoxContent> ProxiesBoxController::CreateOwningBox() {
auto controller = std::make_unique<ProxiesBoxController>(); auto controller = std::make_unique<ProxiesBoxController>();
auto box = controller->create(); auto box = controller->create();
Ui::AttachAsChild(box, std::move(controller)); Ui::AttachAsChild(box, std::move(controller));
return box; return box;
} }
object_ptr<BoxContent> ProxiesBoxController::create() { object_ptr<Ui::BoxContent> ProxiesBoxController::create() {
auto result = Box<ProxiesBox>(this); auto result = Box<ProxiesBox>(this);
for (const auto &item : _list) { for (const auto &item : _list) {
updateView(item); updateView(item);
@ -1249,7 +1250,7 @@ void ProxiesBoxController::setDeleted(int id, bool deleted) {
updateView(*item); updateView(*item);
} }
object_ptr<BoxContent> ProxiesBoxController::editItemBox(int id) { object_ptr<Ui::BoxContent> ProxiesBoxController::editItemBox(int id) {
return Box<ProxyBox>(findById(id)->data, [=](const ProxyData &result) { return Box<ProxyBox>(findById(id)->data, [=](const ProxyData &result) {
auto i = findById(id); auto i = findById(id);
auto j = ranges::find( auto j = ranges::find(
@ -1300,7 +1301,7 @@ void ProxiesBoxController::replaceItemValue(
saveDelayed(); saveDelayed();
} }
object_ptr<BoxContent> ProxiesBoxController::addNewItemBox() { object_ptr<Ui::BoxContent> ProxiesBoxController::addNewItemBox() {
return Box<ProxyBox>(ProxyData(), [=](const ProxyData &result) { return Box<ProxyBox>(ProxyData(), [=](const ProxyData &result) {
auto j = ranges::find( auto j = ranges::find(
_list, _list,

View file

@ -7,11 +7,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#pragma once #pragma once
#include "boxes/abstract_box.h"
#include "base/timer.h" #include "base/timer.h"
#include "base/object_ptr.h"
#include "mtproto/connection_abstract.h" #include "mtproto/connection_abstract.h"
namespace Ui { namespace Ui {
class BoxContent;
class InputField; class InputField;
class PortInput; class PortInput;
class PasswordInput; class PasswordInput;
@ -32,8 +33,8 @@ public:
Type type, Type type,
const QMap<QString, QString> &fields); const QMap<QString, QString> &fields);
static object_ptr<BoxContent> CreateOwningBox(); static object_ptr<Ui::BoxContent> CreateOwningBox();
object_ptr<BoxContent> create(); object_ptr<Ui::BoxContent> create();
enum class ItemState { enum class ItemState {
Connecting, Connecting,
@ -60,8 +61,8 @@ public:
void restoreItem(int id); void restoreItem(int id);
void shareItem(int id); void shareItem(int id);
void applyItem(int id); void applyItem(int id);
object_ptr<BoxContent> editItemBox(int id); object_ptr<Ui::BoxContent> editItemBox(int id);
object_ptr<BoxContent> addNewItemBox(); object_ptr<Ui::BoxContent> addNewItemBox();
bool setProxySettings(ProxyData::Settings value); bool setProxySettings(ProxyData::Settings value);
void setProxyForCalls(bool enabled); void setProxyForCalls(bool enabled);
void setTryIPv6(bool enabled); void setTryIPv6(bool enabled);

View file

@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "base/unique_qptr.h" #include "base/unique_qptr.h"
#include "facades.h" #include "facades.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_settings.h" #include "styles/style_settings.h"
@ -724,7 +725,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
this, this,
SendMenuType::Scheduled, SendMenuType::Scheduled,
send), send),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
}; };
const auto updateValid = [=] { const auto updateValid = [=] {
valid->fire(isValidQuestion() && options->isValid()); valid->fire(isValidQuestion() && options->isValid());

View file

@ -21,7 +21,7 @@ namespace Main {
class Session; class Session;
} // namespace Main } // namespace Main
class CreatePollBox : public BoxContent { class CreatePollBox : public Ui::BoxContent {
public: public:
struct Result { struct Result {
PollData poll; PollData poll;

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "platform/platform_specific.h" #include "platform/platform_specific.h"
#include "facades.h" #include "facades.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
DownloadPathBox::DownloadPathBox(QWidget *parent) DownloadPathBox::DownloadPathBox(QWidget *parent)

View file

@ -18,7 +18,7 @@ class Radioenum;
class LinkButton; class LinkButton;
} // namespace Ui } // namespace Ui
class DownloadPathBox : public BoxContent { class DownloadPathBox : public Ui::BoxContent {
public: public:
DownloadPathBox(QWidget *parent); DownloadPathBox(QWidget *parent);

View file

@ -29,9 +29,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "layout.h" #include "layout.h"
#include "media/clip/media_clip_reader.h" #include "media/clip/media_clip_reader.h"
#include "storage/storage_media_prepare.h" #include "storage/storage_media_prepare.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_history.h"
#include "ui/image/image.h" #include "ui/image/image.h"
#include "ui/widgets/input_fields.h" #include "ui/widgets/input_fields.h"
#include "ui/widgets/checkbox.h" #include "ui/widgets/checkbox.h"
@ -42,6 +39,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "confirm_box.h" #include "confirm_box.h"
#include "facades.h" #include "facades.h"
#include "app.h" #include "app.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_history.h"
#include <QtCore/QMimeData> #include <QtCore/QMimeData>
@ -493,7 +494,7 @@ void EditCaptionBox::createEditMediaButton() {
if (mimeType == qstr("image/webp")) { if (mimeType == qstr("image/webp")) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_edit_media_invalid_file(tr::now)), Box<InformBox>(tr::lng_edit_media_invalid_file(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return false; return false;
} }
return true; return true;
@ -521,7 +522,7 @@ void EditCaptionBox::createEditMediaButton() {
|| file->type == Storage::PreparedFile::AlbumType::None) { || file->type == Storage::PreparedFile::AlbumType::None) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_edit_media_album_error(tr::now)), Box<InformBox>(tr::lng_edit_media_album_error(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} }
@ -551,7 +552,7 @@ void EditCaptionBox::createEditMediaButton() {
if (!valid) { if (!valid) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_edit_media_album_error(tr::now)), Box<InformBox>(tr::lng_edit_media_album_error(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} }
@ -687,7 +688,7 @@ bool EditCaptionBox::fileFromClipboard(not_null<const QMimeData*> data) {
&& _isAlbum) { && _isAlbum) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_edit_media_album_error(tr::now)), Box<InformBox>(tr::lng_edit_media_album_error(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return false; return false;
} }

View file

@ -36,7 +36,7 @@ class SessionController;
} // namespace Window } // namespace Window
class EditCaptionBox class EditCaptionBox
: public BoxContent : public Ui::BoxContent
, public RPCSender , public RPCSender
, private base::Subscriber { , private base::Subscriber {
public: public:

View file

@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/abstract_box.h" #include "boxes/abstract_box.h"
class EditColorBox : public BoxContent, private base::Subscriber { class EditColorBox : public Ui::BoxContent, private base::Subscriber {
public: public:
enum class Mode { enum class Mode {
RGBA, RGBA,

View file

@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_channel.h" #include "data/data_channel.h"
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include "styles/style_settings.h" #include "styles/style_settings.h"
#include "styles/style_boxes.h" #include "styles/style_layers.h"
namespace { namespace {
@ -170,7 +170,7 @@ void EditPrivacyBox::editExceptions(
}; };
Ui::show( Ui::show(
Box<PeerListBox>(std::move(controller), std::move(initBox)), Box<PeerListBox>(std::move(controller), std::move(initBox)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
QVector<MTPInputPrivacyRule> EditPrivacyBox::collectResult() { QVector<MTPInputPrivacyRule> EditPrivacyBox::collectResult() {

View file

@ -23,6 +23,10 @@ template <typename Widget>
class SlideWrap; class SlideWrap;
} // namespace Ui } // namespace Ui
namespace Window {
class SessionController;
} // namespace Window
class EditPrivacyBox; class EditPrivacyBox;
class EditPrivacyController { class EditPrivacyController {
@ -96,7 +100,7 @@ private:
}; };
class EditPrivacyBox : public BoxContent, private MTP::Sender { class EditPrivacyBox : public Ui::BoxContent, private MTP::Sender {
public: public:
using Value = ApiWrap::Privacy; using Value = ApiWrap::Privacy;
using Option = Value::Option; using Option = Value::Option;

View file

@ -1,25 +0,0 @@
/*
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/generic_box.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/wrap/wrap.h"
#include "styles/style_boxes.h"
void GenericBox::prepare() {
_init(this);
auto wrap = object_ptr<Ui::OverrideMargins>(this, std::move(_content));
setDimensionsToContent(_width ? _width : st::boxWidth, wrap.data());
setInnerWidget(std::move(wrap));
}
void GenericBox::addSkip(int height) {
addRow(object_ptr<Ui::FixedHeightWidget>(this, height));
}

View file

@ -1,154 +0,0 @@
/*
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 "boxes/abstract_box.h"
#include "ui/wrap/vertical_layout.h"
#include <tuple>
namespace st {
extern const style::margins &boxRowPadding;
} // namespace st
class GenericBox : public BoxContent {
public:
// InitMethod::operator()(not_null<GenericBox*> box, InitArgs...)
// init(box, args...)
template <
typename InitMethod,
typename ...InitArgs,
typename = decltype(std::declval<std::decay_t<InitMethod>>()(
std::declval<not_null<GenericBox*>>(),
std::declval<std::decay_t<InitArgs>>()...))>
GenericBox(
QWidget*,
InitMethod &&init,
InitArgs &&...args);
void setWidth(int width) {
_width = width;
}
void setFocusCallback(Fn<void()> callback) {
_focus = callback;
}
int rowsCount() const {
return _content->count();
}
template <
typename Widget,
typename = std::enable_if_t<
std::is_base_of_v<RpWidget, Widget>>>
Widget *insertRow(
int atPosition,
object_ptr<Widget> &&child,
const style::margins &margin = st::boxRowPadding) {
return _content->insert(
atPosition,
std::move(child),
margin);
}
template <
typename Widget,
typename = std::enable_if_t<
std::is_base_of_v<RpWidget, Widget>>>
Widget *addRow(
object_ptr<Widget> &&child,
const style::margins &margin = st::boxRowPadding) {
return _content->add(std::move(child), margin);
}
void addSkip(int height);
void setInnerFocus() override {
if (_focus) {
_focus();
}
}
protected:
void prepare() override;
private:
template <typename InitMethod, typename ...InitArgs>
struct Initer {
template <
typename OtherMethod,
typename ...OtherArgs,
typename = std::enable_if_t<
std::is_constructible_v<InitMethod, OtherMethod&&>>>
Initer(OtherMethod &&method, OtherArgs &&...args);
void operator()(not_null<GenericBox*> box);
template <std::size_t... I>
void call(
not_null<GenericBox*> box,
std::index_sequence<I...>);
InitMethod method;
std::tuple<InitArgs...> args;
};
template <typename InitMethod, typename ...InitArgs>
auto MakeIniter(InitMethod &&method, InitArgs &&...args)
-> Initer<std::decay_t<InitMethod>, std::decay_t<InitArgs>...>;
FnMut<void(not_null<GenericBox*>)> _init;
Fn<void()> _focus;
object_ptr<Ui::VerticalLayout> _content;
int _width = 0;
};
template <typename InitMethod, typename ...InitArgs>
template <typename OtherMethod, typename ...OtherArgs, typename>
GenericBox::Initer<InitMethod, InitArgs...>::Initer(
OtherMethod &&method,
OtherArgs &&...args)
: method(std::forward<OtherMethod>(method))
, args(std::forward<OtherArgs>(args)...) {
}
template <typename InitMethod, typename ...InitArgs>
inline void GenericBox::Initer<InitMethod, InitArgs...>::operator()(
not_null<GenericBox*> box) {
call(box, std::make_index_sequence<sizeof...(InitArgs)>());
}
template <typename InitMethod, typename ...InitArgs>
template <std::size_t... I>
inline void GenericBox::Initer<InitMethod, InitArgs...>::call(
not_null<GenericBox*> box,
std::index_sequence<I...>) {
std::invoke(method, box, std::get<I>(std::move(args))...);
}
template <typename InitMethod, typename ...InitArgs>
inline auto GenericBox::MakeIniter(InitMethod &&method, InitArgs &&...args)
-> Initer<std::decay_t<InitMethod>, std::decay_t<InitArgs>...> {
return {
std::forward<InitMethod>(method),
std::forward<InitArgs>(args)...
};
}
template <typename InitMethod, typename ...InitArgs, typename>
inline GenericBox::GenericBox(
QWidget*,
InitMethod &&init,
InitArgs &&...args)
: _init(
MakeIniter(
std::forward<InitMethod>(init),
std::forward<InitArgs>(args)...))
, _content(this) {
}

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/multi_select.h" #include "ui/widgets/multi_select.h"
#include "ui/widgets/scroll_area.h" #include "ui/widgets/scroll_area.h"
#include "ui/widgets/dropdown_menu.h" #include "ui/widgets/dropdown_menu.h"
#include "ui/widgets/box_content_divider.h"
#include "ui/text/text_entity.h" #include "ui/text/text_entity.h"
#include "ui/wrap/vertical_layout.h" #include "ui/wrap/vertical_layout.h"
#include "ui/wrap/slide_wrap.h" #include "ui/wrap/slide_wrap.h"
@ -27,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h" #include "core/application.h"
#include "lang/lang_instance.h" #include "lang/lang_instance.h"
#include "lang/lang_cloud_manager.h" #include "lang/lang_cloud_manager.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_info.h" #include "styles/style_info.h"
#include "styles/style_passport.h" #include "styles/style_passport.h"
@ -896,9 +898,9 @@ void Content::setupContent(
}; };
const auto main = add(recent, false); const auto main = add(recent, false);
const auto divider = content->add( const auto divider = content->add(
object_ptr<Ui::SlideWrap<BoxContentDivider>>( object_ptr<Ui::SlideWrap<Ui::BoxContentDivider>>(
content, content,
object_ptr<BoxContentDivider>(content))); object_ptr<Ui::BoxContentDivider>(content)));
const auto other = add(official, true); const auto other = add(official, true);
Ui::ResizeFitChild(this, content); Ui::ResizeFitChild(this, content);

View file

@ -16,7 +16,7 @@ class MultiSelect;
struct ScrollToRequest; struct ScrollToRequest;
} // namespace Ui } // namespace Ui
class LanguageBox : public BoxContent { class LanguageBox : public Ui::BoxContent {
public: public:
LanguageBox(QWidget*) { LanguageBox(QWidget*) {
} }

View file

@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h" #include "mainwindow.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "layout.h" #include "layout.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
namespace { namespace {

View file

@ -28,7 +28,7 @@ class LabelSimple;
class MediaSlider; class MediaSlider;
} // namespace Ui } // namespace Ui
class LocalStorageBox : public BoxContent { class LocalStorageBox : public Ui::BoxContent {
struct CreateTag { struct CreateTag {
}; };

View file

@ -15,6 +15,7 @@ Copyright (C) 2017, Nicholas Guriev <guriev-ns@ya.ru>
#include "ui/widgets/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "app.h" #include "app.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
namespace { namespace {

View file

@ -12,7 +12,7 @@ Copyright (C) 2017, Nicholas Guriev <guriev-ns@ya.ru>
/* This class implements a dialog-box with radio-buttons for pick duration of /* This class implements a dialog-box with radio-buttons for pick duration of
* turning off notifications from a chat. The widget is opened by a context menu * turning off notifications from a chat. The widget is opened by a context menu
* in the left list of dialogues. */ * in the left list of dialogues. */
class MuteSettingsBox : public BoxContent { class MuteSettingsBox : public Ui::BoxContent {
public: public:
MuteSettingsBox(QWidget *parent, not_null<PeerData*> peer); MuteSettingsBox(QWidget *parent, not_null<PeerData*> peer);

View file

@ -22,8 +22,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "passport/passport_encryption.h" #include "passport/passport_encryption.h"
#include "passport/passport_panel_edit_contact.h" #include "passport/passport_panel_edit_contact.h"
#include "facades.h" #include "facades.h"
#include "styles/style_boxes.h" #include "styles/style_layers.h"
#include "styles/style_passport.h" #include "styles/style_passport.h"
#include "styles/style_boxes.h"
namespace { namespace {
@ -375,7 +376,7 @@ void PasscodeBox::validateEmail(
Lang::Hard::EmailConfirmationExpired()); Lang::Hard::EmailConfirmationExpired());
weak->getDelegate()->show( weak->getDelegate()->show(
std::move(box), std::move(box),
LayerOption::CloseOther); Ui::LayerOption::CloseOther);
} }
} else { } else {
errors->fire(Lang::Hard::ServerError()); errors->fire(Lang::Hard::ServerError());
@ -531,7 +532,7 @@ void PasscodeBox::submitOnlyCheckCloudPassword(const QString &oldPassword) {
if (_cloudFields.turningOff && _cloudFields.notEmptyPassport) { if (_cloudFields.turningOff && _cloudFields.notEmptyPassport) {
Assert(!_cloudFields.customCheckCallback); Assert(!_cloudFields.customCheckCallback);
const auto box = std::make_shared<QPointer<BoxContent>>(); const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto confirmed = [=] { const auto confirmed = [=] {
send(); send();
if (*box) { if (*box) {
@ -738,7 +739,7 @@ void PasscodeBox::changeCloudPassword(
} }
void PasscodeBox::suggestSecretReset(const QString &newPassword) { void PasscodeBox::suggestSecretReset(const QString &newPassword) {
const auto box = std::make_shared<QPointer<BoxContent>>(); const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto resetSecretAndSave = [=] { const auto resetSecretAndSave = [=] {
checkPasswordHash([=](const Core::CloudPasswordResult &check) { checkPasswordHash([=](const Core::CloudPasswordResult &check) {
resetSecret(check, newPassword, [=] { resetSecret(check, newPassword, [=] {
@ -990,7 +991,7 @@ void RecoverBox::submit() {
rpcFail(&RecoverBox::codeSubmitFail)); rpcFail(&RecoverBox::codeSubmitFail));
}); });
if (_notEmptyPassport) { if (_notEmptyPassport) {
const auto box = std::make_shared<QPointer<BoxContent>>(); const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto confirmed = [=] { const auto confirmed = [=] {
send(); send();
if (*box) { if (*box) {
@ -1019,7 +1020,7 @@ void RecoverBox::codeSubmitDone(
_passwordCleared.fire({}); _passwordCleared.fire({});
getDelegate()->show( getDelegate()->show(
Box<InformBox>(tr::lng_cloud_password_removed(tr::now)), Box<InformBox>(tr::lng_cloud_password_removed(tr::now)),
LayerOption::CloseOther); Ui::LayerOption::CloseOther);
} }
bool RecoverBox::codeSubmitFail(const RPCError &error) { bool RecoverBox::codeSubmitFail(const RPCError &error) {
@ -1039,7 +1040,7 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
_passwordCleared.fire({}); _passwordCleared.fire({});
getDelegate()->show( getDelegate()->show(
Box<InformBox>(tr::lng_cloud_password_removed(tr::now)), Box<InformBox>(tr::lng_cloud_password_removed(tr::now)),
LayerOption::CloseOther); Ui::LayerOption::CloseOther);
return true; return true;
} else if (err == qstr("PASSWORD_RECOVERY_NA")) { } else if (err == qstr("PASSWORD_RECOVERY_NA")) {
closeBox(); closeBox();
@ -1070,7 +1071,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(const QString &pattern) {
const auto errors = std::make_shared<rpl::event_stream<QString>>(); const auto errors = std::make_shared<rpl::event_stream<QString>>();
const auto resent = std::make_shared<rpl::event_stream<QString>>(); const auto resent = std::make_shared<rpl::event_stream<QString>>();
const auto requestId = std::make_shared<mtpRequestId>(0); const auto requestId = std::make_shared<mtpRequestId>(0);
const auto weak = std::make_shared<QPointer<BoxContent>>(); const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
const auto reloads = std::make_shared<rpl::event_stream<>>(); const auto reloads = std::make_shared<rpl::event_stream<>>();
const auto cancels = std::make_shared<rpl::event_stream<>>(); const auto cancels = std::make_shared<rpl::event_stream<>>();
@ -1084,7 +1085,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(const QString &pattern) {
if (*weak) { if (*weak) {
(*weak)->getDelegate()->show( (*weak)->getDelegate()->show(
Box<InformBox>(tr::lng_cloud_password_was_set(tr::now)), Box<InformBox>(tr::lng_cloud_password_was_set(tr::now)),
LayerOption::CloseOther); Ui::LayerOption::CloseOther);
} }
}; };
const auto fail = [=](const RPCError &error) { const auto fail = [=](const RPCError &error) {
@ -1105,7 +1106,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(const QString &pattern) {
Lang::Hard::EmailConfirmationExpired()); Lang::Hard::EmailConfirmationExpired());
(*weak)->getDelegate()->show( (*weak)->getDelegate()->show(
std::move(box), std::move(box),
LayerOption::CloseOther); Ui::LayerOption::CloseOther);
} }
} else { } else {
errors->fire(Lang::Hard::ServerError()); errors->fire(Lang::Hard::ServerError());

View file

@ -25,7 +25,7 @@ namespace Core {
struct CloudPasswordState; struct CloudPasswordState;
} // namespace Core } // namespace Core
class PasscodeBox : public BoxContent, private MTP::Sender { class PasscodeBox : public Ui::BoxContent, private MTP::Sender {
public: public:
PasscodeBox(QWidget*, not_null<Main::Session*> session, bool turningOff); PasscodeBox(QWidget*, not_null<Main::Session*> session, bool turningOff);
@ -133,7 +133,7 @@ private:
QString _pattern; QString _pattern;
QPointer<BoxContent> _replacedBy; QPointer<Ui::BoxContent> _replacedBy;
bool _turningOff = false; bool _turningOff = false;
bool _cloudPwd = false; bool _cloudPwd = false;
CloudFields _cloudFields; CloudFields _cloudFields;
@ -163,7 +163,7 @@ private:
}; };
class RecoverBox : public BoxContent, public RPCSender { class RecoverBox : public Ui::BoxContent, public RPCSender {
public: public:
RecoverBox(QWidget*, const QString &pattern, bool notEmptyPassport); RecoverBox(QWidget*, const QString &pattern, bool notEmptyPassport);
@ -201,7 +201,7 @@ private:
}; };
struct RecoveryEmailValidation { struct RecoveryEmailValidation {
object_ptr<BoxContent> box; object_ptr<Ui::BoxContent> box;
rpl::producer<> reloadRequests; rpl::producer<> reloadRequests;
rpl::producer<> cancelRequests; rpl::producer<> cancelRequests;
}; };

View file

@ -7,10 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "boxes/peer_list_box.h" #include "boxes/peer_list_box.h"
#include <rpl/range.h>
#include "styles/style_boxes.h"
#include "styles/style_dialogs.h"
#include "styles/style_widgets.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "ui/widgets/multi_select.h" #include "ui/widgets/multi_select.h"
@ -30,6 +26,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h" #include "data/data_session.h"
#include "base/unixtime.h" #include "base/unixtime.h"
#include "window/themes/window_theme.h" #include "window/themes/window_theme.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_dialogs.h"
#include "styles/style_widgets.h"
#include <rpl/range.h>
auto PaintUserpicCallback( auto PaintUserpicCallback(
not_null<PeerData*> peer, not_null<PeerData*> peer,

View file

@ -752,7 +752,7 @@ private:
}; };
class PeerListBox class PeerListBox
: public BoxContent : public Ui::BoxContent
, public PeerListContentDelegate { , public PeerListContentDelegate {
public: public:
PeerListBox( PeerListBox(

View file

@ -464,7 +464,7 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
}(); }();
Ui::show( Ui::show(
Box<ConfirmBox>(confirmText, std::move(send)), Box<ConfirmBox>(confirmText, std::move(send)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) { void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
@ -472,7 +472,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
if (!megagroup->canAddMembers()) { if (!megagroup->canAddMembers()) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_error_cant_add_member(tr::now)), Box<InformBox>(tr::lng_error_cant_add_member(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} }
@ -482,7 +482,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
auto confirmText = tr::lng_bot_sure_invite(tr::now, lt_group, chat->name); auto confirmText = tr::lng_bot_sure_invite(tr::now, lt_group, chat->name);
Ui::show( Ui::show(
Box<ConfirmBox>(confirmText, send), Box<ConfirmBox>(confirmText, send),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
auto AddBotToGroupBoxController::createRow(not_null<History*> history) auto AddBotToGroupBoxController::createRow(not_null<History*> history)

View file

@ -98,13 +98,13 @@ void AddParticipantsBoxController::rowClicked(not_null<PeerListRow*> row) {
if (!_peer->isMegagroup()) { if (!_peer->isMegagroup()) {
Ui::show( Ui::show(
Box<MaxInviteBox>(_peer->asChannel()), Box<MaxInviteBox>(_peer->asChannel()),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
} else if (count >= Global::ChatSizeMax() } else if (count >= Global::ChatSizeMax()
&& count < Global::MegagroupSizeMax()) { && count < Global::MegagroupSizeMax()) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_profile_add_more_after_create(tr::now)), Box<InformBox>(tr::lng_profile_add_more_after_create(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
} }
@ -210,7 +210,7 @@ void AddParticipantsBoxController::Start(
Box<PeerListBox>( Box<PeerListBox>(
std::move(controller), std::move(controller),
std::move(initBox)), std::move(initBox)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void AddParticipantsBoxController::Start( void AddParticipantsBoxController::Start(
@ -251,7 +251,7 @@ void AddParticipantsBoxController::Start(
Box<PeerListBox>( Box<PeerListBox>(
std::move(controller), std::move(controller),
std::move(initBox)), std::move(initBox)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void AddParticipantsBoxController::Start( void AddParticipantsBoxController::Start(
@ -517,19 +517,19 @@ void AddSpecialBoxController::showAdmin(
Box<ConfirmBox>( Box<ConfirmBox>(
tr::lng_sure_add_admin_unremove(tr::now), tr::lng_sure_add_admin_unremove(tr::now),
showAdminSure), showAdminSure),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else { } else {
Ui::show(Box<InformBox>( Ui::show(Box<InformBox>(
tr::lng_error_cant_add_admin_unban(tr::now)), tr::lng_error_cant_add_admin_unban(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else { } else {
Ui::show(Box<InformBox>( Ui::show(Box<InformBox>(
tr::lng_error_cant_add_admin_invite(tr::now)), tr::lng_error_cant_add_admin_invite(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else if (_additional.restrictedRights(user).has_value()) { } else if (_additional.restrictedRights(user).has_value()) {
@ -540,13 +540,13 @@ void AddSpecialBoxController::showAdmin(
Box<ConfirmBox>( Box<ConfirmBox>(
tr::lng_sure_add_admin_unremove(tr::now), tr::lng_sure_add_admin_unremove(tr::now),
showAdminSure), showAdminSure),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else { } else {
Ui::show(Box<InformBox>( Ui::show(Box<InformBox>(
tr::lng_error_cant_add_admin_unban(tr::now)), tr::lng_error_cant_add_admin_unban(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else if (_additional.isExternal(user)) { } else if (_additional.isExternal(user)) {
@ -560,13 +560,13 @@ void AddSpecialBoxController::showAdmin(
Box<ConfirmBox>( Box<ConfirmBox>(
text, text,
showAdminSure), showAdminSure),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else { } else {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_error_cant_add_admin_invite(tr::now)), Box<InformBox>(tr::lng_error_cant_add_admin_invite(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} }
@ -597,7 +597,7 @@ void AddSpecialBoxController::showAdmin(
}); });
box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail)); box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail));
} }
_editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther); _editParticipantBox = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
} }
void AddSpecialBoxController::editAdminDone( void AddSpecialBoxController::editAdminDone(
@ -669,13 +669,13 @@ void AddSpecialBoxController::showRestricted(
Box<ConfirmBox>( Box<ConfirmBox>(
tr::lng_sure_ban_admin(tr::now), tr::lng_sure_ban_admin(tr::now),
showRestrictedSure), showRestrictedSure),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else { } else {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_error_cant_ban_admin(tr::now)), Box<InformBox>(tr::lng_error_cant_ban_admin(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} }
@ -704,7 +704,7 @@ void AddSpecialBoxController::showRestricted(
box->setSaveCallback( box->setSaveCallback(
SaveRestrictedCallback(_peer, user, done, fail)); SaveRestrictedCallback(_peer, user, done, fail));
} }
_editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther); _editParticipantBox = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
} }
void AddSpecialBoxController::editRestrictedDone( void AddSpecialBoxController::editRestrictedDone(
@ -759,13 +759,13 @@ void AddSpecialBoxController::kickUser(
Box<ConfirmBox>( Box<ConfirmBox>(
tr::lng_sure_ban_admin(tr::now), tr::lng_sure_ban_admin(tr::now),
kickUserSure), kickUserSure),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else { } else {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_error_cant_ban_admin(tr::now)), Box<InformBox>(tr::lng_error_cant_ban_admin(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} }
@ -780,7 +780,7 @@ void AddSpecialBoxController::kickUser(
user->name); user->name);
_editBox = Ui::show( _editBox = Ui::show(
Box<ConfirmBox>(text, kickUserSure), Box<ConfirmBox>(text, kickUserSure),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }

View file

@ -126,8 +126,8 @@ private:
bool _allLoaded = false; bool _allLoaded = false;
ParticipantsAdditionalData _additional; ParticipantsAdditionalData _additional;
std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter; std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
BoxPointer _editBox; Ui::BoxPointer _editBox;
QPointer<BoxContent> _editParticipantBox; QPointer<Ui::BoxContent> _editParticipantBox;
AdminDoneCallback _adminDoneCallback; AdminDoneCallback _adminDoneCallback;
BannedDoneCallback _bannedDoneCallback; BannedDoneCallback _bannedDoneCallback;

View file

@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "boxes/peers/edit_contact_box.h" #include "boxes/peers/edit_contact_box.h"
#include "boxes/generic_box.h"
#include "data/data_user.h" #include "data/data_user.h"
#include "data/data_session.h" #include "data/data_session.h"
#include "ui/wrap/vertical_layout.h" #include "ui/wrap/vertical_layout.h"
@ -21,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h" #include "main/main_session.h"
#include "apiwrap.h" #include "apiwrap.h"
#include "app.h" #include "app.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_info.h" #include "styles/style_info.h"
@ -36,7 +36,7 @@ QString UserPhone(not_null<UserData*> user) {
} }
void SendRequest( void SendRequest(
QPointer<GenericBox> box, QPointer<Ui::GenericBox> box,
not_null<UserData*> user, not_null<UserData*> user,
bool sharePhone, bool sharePhone,
const QString &first, const QString &first,
@ -82,7 +82,7 @@ void SendRequest(
class Controller { class Controller {
public: public:
Controller( Controller(
not_null<GenericBox*> box, not_null<Ui::GenericBox*> box,
not_null<Window::Controller*> window, not_null<Window::Controller*> window,
not_null<UserData*> user); not_null<UserData*> user);
@ -99,7 +99,7 @@ private:
not_null<Ui::InputField*> last, not_null<Ui::InputField*> last,
bool inverted); bool inverted);
not_null<GenericBox*> _box; not_null<Ui::GenericBox*> _box;
not_null<Window::Controller*> _window; not_null<Window::Controller*> _window;
not_null<UserData*> _user; not_null<UserData*> _user;
Ui::Checkbox *_sharePhone = nullptr; Ui::Checkbox *_sharePhone = nullptr;
@ -110,7 +110,7 @@ private:
}; };
Controller::Controller( Controller::Controller(
not_null<GenericBox*> box, not_null<Ui::GenericBox*> box,
not_null<Window::Controller*> window, not_null<Window::Controller*> window,
not_null<UserData*> user) not_null<UserData*> user)
: _box(box) : _box(box)
@ -265,7 +265,7 @@ void Controller::setupSharePhoneNumber() {
} // namespace } // namespace
void EditContactBox( void EditContactBox(
not_null<GenericBox*> box, not_null<Ui::GenericBox*> box,
not_null<Window::Controller*> window, not_null<Window::Controller*> window,
not_null<UserData*> user) { not_null<UserData*> user) {
box->lifetime().make_state<Controller>(box, window, user)->prepare(); box->lifetime().make_state<Controller>(box, window, user)->prepare();

View file

@ -7,14 +7,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#pragma once #pragma once
#include "ui/layers/generic_box.h"
class UserData; class UserData;
class GenericBox;
namespace Window { namespace Window {
class Controller; class Controller;
} // namespace Window } // namespace Window
void EditContactBox( void EditContactBox(
not_null<GenericBox*> box, not_null<Ui::GenericBox*> box,
not_null<Window::Controller*> window, not_null<Window::Controller*> window,
not_null<UserData*> user); not_null<UserData*> user);

View file

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "apiwrap.h" #include "apiwrap.h"
#include "facades.h" #include "facades.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_info.h" #include "styles/style_info.h"
@ -145,7 +146,7 @@ void Controller::choose(not_null<ChannelData*> chat) {
Ui::Text::RichLangValue)); Ui::Text::RichLangValue));
} }
} }
const auto box = std::make_shared<QPointer<BoxContent>>(); const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto sure = [=] { const auto sure = [=] {
if (*box) { if (*box) {
(*box)->closeBox(); (*box)->closeBox();
@ -158,7 +159,7 @@ void Controller::choose(not_null<ChannelData*> chat) {
text, text,
tr::lng_manage_discussion_group_link(tr::now), tr::lng_manage_discussion_group_link(tr::now),
sure), sure),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void Controller::choose(not_null<ChatData*> chat) { void Controller::choose(not_null<ChatData*> chat) {
@ -177,7 +178,7 @@ void Controller::choose(not_null<ChatData*> chat) {
text.append(tr::lng_manage_discussion_group_warning( text.append(tr::lng_manage_discussion_group_warning(
tr::now, tr::now,
Ui::Text::RichLangValue)); Ui::Text::RichLangValue));
const auto box = std::make_shared<QPointer<BoxContent>>(); const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto sure = [=] { const auto sure = [=] {
if (*box) { if (*box) {
(*box)->closeBox(); (*box)->closeBox();
@ -193,7 +194,7 @@ void Controller::choose(not_null<ChatData*> chat) {
text, text,
tr::lng_manage_discussion_group_link(tr::now), tr::lng_manage_discussion_group_link(tr::now),
sure), sure),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
object_ptr<Ui::RpWidget> SetupAbout( object_ptr<Ui::RpWidget> SetupAbout(
@ -256,7 +257,7 @@ object_ptr<Ui::RpWidget> SetupCreateGroup(
GroupInfoBox::Type::Megagroup, GroupInfoBox::Type::Megagroup,
channel->name + " Chat", channel->name + " Chat",
guarded), guarded),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
}); });
return result; return result;
} }
@ -277,7 +278,7 @@ object_ptr<Ui::RpWidget> SetupUnlink(
return result; return result;
} }
object_ptr<BoxContent> EditLinkedChatBox( object_ptr<Ui::BoxContent> EditLinkedChatBox(
not_null<Window::SessionNavigation*> navigation, not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel, not_null<ChannelData*> channel,
ChannelData *chat, ChannelData *chat,
@ -324,7 +325,7 @@ object_ptr<BoxContent> EditLinkedChatBox(
} // namespace } // namespace
object_ptr<BoxContent> EditLinkedChatBox( object_ptr<Ui::BoxContent> EditLinkedChatBox(
not_null<Window::SessionNavigation*> navigation, not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel, not_null<ChannelData*> channel,
std::vector<not_null<PeerData*>> &&chats, std::vector<not_null<PeerData*>> &&chats,
@ -338,7 +339,7 @@ object_ptr<BoxContent> EditLinkedChatBox(
callback); callback);
} }
object_ptr<BoxContent> EditLinkedChatBox( object_ptr<Ui::BoxContent> EditLinkedChatBox(
not_null<Window::SessionNavigation*> navigation, not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel, not_null<ChannelData*> channel,
not_null<ChannelData*> chat, not_null<ChannelData*> chat,

View file

@ -7,20 +7,24 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#pragma once #pragma once
#include "boxes/abstract_box.h" #include "base/object_ptr.h"
namespace Ui {
class BoxContent;
} // namespace Ui
namespace Window { namespace Window {
class SessionNavigation; class SessionNavigation;
} // namespace Window } // namespace Window
object_ptr<BoxContent> EditLinkedChatBox( object_ptr<Ui::BoxContent> EditLinkedChatBox(
not_null<Window::SessionNavigation*> navigation, not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel, not_null<ChannelData*> channel,
not_null<ChannelData*> chat, not_null<ChannelData*> chat,
bool canEdit, bool canEdit,
Fn<void(ChannelData*)> callback); Fn<void(ChannelData*)> callback);
object_ptr<BoxContent> EditLinkedChatBox( object_ptr<Ui::BoxContent> EditLinkedChatBox(
not_null<Window::SessionNavigation*> navigation, not_null<Window::SessionNavigation*> navigation,
not_null<ChannelData*> channel, not_null<ChannelData*> channel,
std::vector<not_null<PeerData*>> &&chats, std::vector<not_null<PeerData*>> &&chats,

View file

@ -15,6 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h" #include "ui/widgets/input_fields.h"
#include "ui/widgets/box_content_divider.h"
#include "ui/layers/generic_box.h"
#include "ui/toast/toast.h" #include "ui/toast/toast.h"
#include "ui/text/text_utilities.h" #include "ui/text/text_utilities.h"
#include "ui/text_options.h" #include "ui/text_options.h"
@ -23,7 +25,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/profile/info_profile_button.h" #include "info/profile/info_profile_button.h"
#include "settings/settings_privacy_security.h" #include "settings/settings_privacy_security.h"
#include "boxes/calendar_box.h" #include "boxes/calendar_box.h"
#include "boxes/generic_box.h"
#include "boxes/confirm_box.h" #include "boxes/confirm_box.h"
#include "boxes/passcode_box.h" #include "boxes/passcode_box.h"
#include "boxes/peers/edit_peer_permissions_box.h" #include "boxes/peers/edit_peer_permissions_box.h"
@ -37,6 +38,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "apiwrap.h" #include "apiwrap.h"
#include "facades.h" #include "facades.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_info.h" #include "styles/style_info.h"
@ -53,7 +55,7 @@ enum class PasswordErrorType {
Later, Later,
}; };
void SetCloudPassword(not_null<GenericBox*> box, not_null<UserData*> user) { void SetCloudPassword(not_null<Ui::GenericBox*> box, not_null<UserData*> user) {
user->session().api().passwordState( user->session().api().passwordState(
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
using namespace Settings; using namespace Settings;
@ -71,7 +73,7 @@ void SetCloudPassword(not_null<GenericBox*> box, not_null<UserData*> user) {
} }
void TransferPasswordError( void TransferPasswordError(
not_null<GenericBox*> box, not_null<Ui::GenericBox*> box,
not_null<UserData*> user, not_null<UserData*> user,
PasswordErrorType error) { PasswordErrorType error) {
box->setTitle(tr::lng_rights_transfer_check()); box->setTitle(tr::lng_rights_transfer_check());
@ -299,7 +301,7 @@ void EditAdminBox::prepare() {
: tr::lng_channel_add_admin()); : tr::lng_channel_add_admin());
addControl( addControl(
object_ptr<BoxContentDivider>(this), object_ptr<Ui::BoxContentDivider>(this),
st::rightsDividerMargin); st::rightsDividerMargin);
const auto chat = peer()->asChat(); const auto chat = peer()->asChat();
@ -404,7 +406,7 @@ void EditAdminBox::prepare() {
not_null<Ui::InputField*> EditAdminBox::addRankInput() { not_null<Ui::InputField*> EditAdminBox::addRankInput() {
addControl( addControl(
object_ptr<BoxContentDivider>(this), object_ptr<Ui::BoxContentDivider>(this),
st::rightsRankMargin); st::rightsRankMargin);
addControl( addControl(
@ -474,7 +476,7 @@ not_null<Ui::SlideWrap<Ui::RpWidget>*> EditAdminBox::setupTransferButton(
const auto container = wrap->entity(); const auto container = wrap->entity();
container->add( container->add(
object_ptr<BoxContentDivider>(container), object_ptr<Ui::BoxContentDivider>(container),
{ 0, st::infoProfileSkip, 0, st::infoProfileSkip }); { 0, st::infoProfileSkip, 0, st::infoProfileSkip });
container->add(EditPeerInfoBox::CreateButton( container->add(EditPeerInfoBox::CreateButton(
this, this,
@ -664,7 +666,7 @@ void EditRestrictedBox::prepare() {
setTitle(tr::lng_rights_user_restrictions()); setTitle(tr::lng_rights_user_restrictions());
addControl( addControl(
object_ptr<BoxContentDivider>(this), object_ptr<Ui::BoxContentDivider>(this),
st::rightsDividerMargin); st::rightsDividerMargin);
const auto chat = peer()->asChat(); const auto chat = peer()->asChat();
@ -708,7 +710,7 @@ void EditRestrictedBox::prepare() {
addControl(std::move(checkboxes), QMargins()); addControl(std::move(checkboxes), QMargins());
_until = prepareRights.c_chatBannedRights().vuntil_date().v; _until = prepareRights.c_chatBannedRights().vuntil_date().v;
addControl(object_ptr<BoxContentDivider>(this), st::rightsUntilMargin); addControl(object_ptr<Ui::BoxContentDivider>(this), st::rightsUntilMargin);
addControl( addControl(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
this, this,
@ -759,7 +761,7 @@ void EditRestrictedBox::showRestrictUntil() {
setRestrictUntil( setRestrictUntil(
static_cast<int>(QDateTime(date).toTime_t())); static_cast<int>(QDateTime(date).toTime_t()));
}), }),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
_restrictUntilBox->setMaxDate( _restrictUntilBox->setMaxDate(
QDate::currentDate().addDays(kMaxRestrictDelayDays)); QDate::currentDate().addDays(kMaxRestrictDelayDays));
_restrictUntilBox->setMinDate(tomorrow); _restrictUntilBox->setMinDate(tomorrow);

View file

@ -27,7 +27,7 @@ struct CloudPasswordResult;
class CalendarBox; class CalendarBox;
class PasscodeBox; class PasscodeBox;
class EditParticipantBox : public BoxContent { class EditParticipantBox : public Ui::BoxContent {
public: public:
EditParticipantBox( EditParticipantBox(
QWidget*, QWidget*,

View file

@ -874,7 +874,7 @@ void ParticipantsBoxController::Start(
}; };
Ui::show( Ui::show(
Box<PeerListBox>(std::move(controller), initBox), Box<PeerListBox>(std::move(controller), initBox),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void ParticipantsBoxController::addNewItem() { void ParticipantsBoxController::addNewItem() {
@ -907,7 +907,7 @@ void ParticipantsBoxController::addNewItem() {
adminDone, adminDone,
restrictedDone), restrictedDone),
initBox), initBox),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void ParticipantsBoxController::addNewParticipants() { void ParticipantsBoxController::addNewParticipants() {
@ -929,7 +929,7 @@ void ParticipantsBoxController::addNewParticipants() {
channel, channel,
{ already.begin(), already.end() }); { already.begin(), already.end() });
} else { } else {
Ui::show(Box<MaxInviteBox>(channel), LayerOption::KeepOther); Ui::show(Box<MaxInviteBox>(channel), Ui::LayerOption::KeepOther);
} }
} }
@ -1474,7 +1474,7 @@ void ParticipantsBoxController::showAdmin(not_null<UserData*> user) {
}); });
box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail)); box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail));
} }
_editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther); _editParticipantBox = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
} }
void ParticipantsBoxController::editAdminDone( void ParticipantsBoxController::editAdminDone(
@ -1552,7 +1552,7 @@ void ParticipantsBoxController::showRestricted(not_null<UserData*> user) {
box->setSaveCallback( box->setSaveCallback(
SaveRestrictedCallback(_peer, user, done, fail)); SaveRestrictedCallback(_peer, user, done, fail));
} }
_editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther); _editParticipantBox = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
} }
void ParticipantsBoxController::editRestrictedDone( void ParticipantsBoxController::editRestrictedDone(
@ -1618,7 +1618,7 @@ void ParticipantsBoxController::kickMember(not_null<UserData*> user) {
text, text,
tr::lng_box_remove(tr::now), tr::lng_box_remove(tr::now),
crl::guard(this, [=] { kickMemberSure(user); })), crl::guard(this, [=] { kickMemberSure(user); })),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void ParticipantsBoxController::unkickMember(not_null<UserData*> user) { void ParticipantsBoxController::unkickMember(not_null<UserData*> user) {
@ -1661,7 +1661,7 @@ void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) {
user->firstName), user->firstName),
tr::lng_box_remove(tr::now), tr::lng_box_remove(tr::now),
crl::guard(this, [=] { removeAdminSure(user); })), crl::guard(this, [=] { removeAdminSure(user); })),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void ParticipantsBoxController::removeAdminSure(not_null<UserData*> user) { void ParticipantsBoxController::removeAdminSure(not_null<UserData*> user) {

View file

@ -244,9 +244,9 @@ private:
bool _allLoaded = false; bool _allLoaded = false;
ParticipantsAdditionalData _additional; ParticipantsAdditionalData _additional;
std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter; std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
BoxPointer _editBox; Ui::BoxPointer _editBox;
BoxPointer _addBox; Ui::BoxPointer _addBox;
QPointer<BoxContent> _editParticipantBox; QPointer<Ui::BoxContent> _editParticipantBox;
}; };

View file

@ -13,13 +13,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_chat.h" #include "data/data_chat.h"
#include "data/data_peer.h" #include "data/data_peer.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"
#include "ui/widgets/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/wrap/padding_wrap.h" #include "ui/wrap/padding_wrap.h"
#include "ui/wrap/slide_wrap.h" #include "ui/wrap/slide_wrap.h"
#include "ui/wrap/vertical_layout.h" #include "ui/wrap/vertical_layout.h"
#include "styles/style_layers.h"
#include "styles/style_info.h"
namespace { namespace {

View file

@ -15,7 +15,7 @@ enum class HistoryVisibility {
Hidden, Hidden,
}; };
class EditPeerHistoryVisibilityBox : public BoxContent { class EditPeerHistoryVisibilityBox : public Ui::BoxContent {
public: public:
EditPeerHistoryVisibilityBox( EditPeerHistoryVisibilityBox(
QWidget*, QWidget*,

View file

@ -31,14 +31,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h" #include "mainwindow.h"
#include "mtproto/sender.h" #include "mtproto/sender.h"
#include "observer_peer.h" #include "observer_peer.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"
#include "ui/rp_widget.h" #include "ui/rp_widget.h"
#include "ui/special_buttons.h" #include "ui/special_buttons.h"
#include "ui/toast/toast.h" #include "ui/toast/toast.h"
#include "ui/widgets/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/input_fields.h" #include "ui/widgets/input_fields.h"
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/widgets/box_content_divider.h"
#include "ui/wrap/padding_wrap.h" #include "ui/wrap/padding_wrap.h"
#include "ui/wrap/slide_wrap.h" #include "ui/wrap/slide_wrap.h"
#include "ui/wrap/vertical_layout.h" #include "ui/wrap/vertical_layout.h"
@ -46,6 +45,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/profile/info_profile_icon.h" #include "info/profile/info_profile_icon.h"
#include "app.h" #include "app.h"
#include "facades.h" #include "facades.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"
namespace { namespace {
@ -70,7 +72,7 @@ void AddSkip(
container->add(object_ptr<Ui::FixedHeightWidget>( container->add(object_ptr<Ui::FixedHeightWidget>(
container, container,
top)); top));
container->add(object_ptr<BoxContentDivider>(container)); container->add(object_ptr<Ui::BoxContentDivider>(container));
container->add(object_ptr<Ui::FixedHeightWidget>( container->add(object_ptr<Ui::FixedHeightWidget>(
container, container,
bottom)); bottom));
@ -193,7 +195,7 @@ void SaveSlowmodeSeconds(
void ShowEditPermissions(not_null<PeerData*> peer) { void ShowEditPermissions(not_null<PeerData*> peer) {
const auto box = Ui::show( const auto box = Ui::show(
Box<EditPeerPermissionsBox>(peer), Box<EditPeerPermissionsBox>(peer),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
const auto saving = box->lifetime().make_state<int>(0); const auto saving = box->lifetime().make_state<int>(0);
const auto save = [=]( const auto save = [=](
not_null<PeerData*> peer, not_null<PeerData*> peer,
@ -244,7 +246,7 @@ class Controller
public: public:
Controller( Controller(
not_null<Window::SessionNavigation*> navigation, not_null<Window::SessionNavigation*> navigation,
not_null<BoxContent*> box, not_null<Ui::BoxContent*> box,
not_null<PeerData*> peer); not_null<PeerData*> peer);
object_ptr<Ui::VerticalLayout> createContent(); object_ptr<Ui::VerticalLayout> createContent();
@ -330,7 +332,7 @@ private:
std::optional<bool> _signaturesSavedValue; std::optional<bool> _signaturesSavedValue;
const not_null<Window::SessionNavigation*> _navigation; const not_null<Window::SessionNavigation*> _navigation;
const not_null<BoxContent*> _box; const not_null<Ui::BoxContent*> _box;
not_null<PeerData*> _peer; not_null<PeerData*> _peer;
const bool _isGroup = false; const bool _isGroup = false;
@ -351,7 +353,7 @@ private:
Controller::Controller( Controller::Controller(
not_null<Window::SessionNavigation*> navigation, not_null<Window::SessionNavigation*> navigation,
not_null<BoxContent*> box, not_null<Ui::BoxContent*> box,
not_null<PeerData*> peer) not_null<PeerData*> peer)
: _navigation(navigation) : _navigation(navigation)
, _box(box) , _box(box)
@ -559,7 +561,7 @@ object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
tr::lng_group_stickers_add(tr::now), tr::lng_group_stickers_add(tr::now),
st::editPeerInviteLinkButton) st::editPeerInviteLinkButton)
)->addClickHandler([=] { )->addClickHandler([=] {
Ui::show(Box<StickersBox>(channel), LayerOption::KeepOther); Ui::show(Box<StickersBox>(channel), Ui::LayerOption::KeepOther);
}); });
return std::move(result); return std::move(result);
@ -602,13 +604,13 @@ void Controller::showEditPeerTypeBox(
_privacySavedValue, _privacySavedValue,
_usernameSavedValue, _usernameSavedValue,
error), error),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void Controller::showEditLinkedChatBox() { void Controller::showEditLinkedChatBox() {
Expects(_peer->isChannel()); Expects(_peer->isChannel());
const auto box = std::make_shared<QPointer<BoxContent>>(); const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto channel = _peer->asChannel(); const auto channel = _peer->asChannel();
const auto callback = [=](ChannelData *result) { const auto callback = [=](ChannelData *result) {
if (*box) { if (*box) {
@ -633,7 +635,7 @@ void Controller::showEditLinkedChatBox() {
chat, chat,
canEdit, canEdit,
callback), callback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} else if (!canEdit || _linkedChatsRequestId) { } else if (!canEdit || _linkedChatsRequestId) {
return; return;
@ -660,7 +662,7 @@ void Controller::showEditLinkedChatBox() {
channel, channel,
std::move(chats), std::move(chats),
callback), callback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
}).fail([=](const RPCError &error) { }).fail([=](const RPCError &error) {
_linkedChatsRequestId = 0; _linkedChatsRequestId = 0;
}).send(); }).send();
@ -749,7 +751,7 @@ void Controller::fillInviteLinkButton() {
Expects(_controls.buttonsLayout != nullptr); Expects(_controls.buttonsLayout != nullptr);
const auto buttonCallback = [=] { const auto buttonCallback = [=] {
Ui::show(Box<EditPeerTypeBox>(_peer), LayerOption::KeepOther); Ui::show(Box<EditPeerTypeBox>(_peer), Ui::LayerOption::KeepOther);
}; };
AddButtonWithText( AddButtonWithText(
@ -807,7 +809,7 @@ void Controller::fillHistoryVisibilityButton() {
_peer, _peer,
boxCallback, boxCallback,
*_historyVisibilitySavedValue), *_historyVisibilitySavedValue),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
}; };
AddButtonWithText( AddButtonWithText(
container, container,
@ -1429,7 +1431,7 @@ void Controller::deleteWithConfirmation() {
tr::lng_box_delete(tr::now), tr::lng_box_delete(tr::now),
st::attentionBoxButton, st::attentionBoxButton,
deleteCallback), deleteCallback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void Controller::deleteChannel() { void Controller::deleteChannel() {

View file

@ -28,7 +28,7 @@ class Button;
} // namespace Profile } // namespace Profile
} // namespace Info } // namespace Info
class EditPeerInfoBox : public BoxContent { class EditPeerInfoBox : public Ui::BoxContent {
public: public:
EditPeerInfoBox( EditPeerInfoBox(
QWidget*, QWidget*,

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/widgets/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/continuous_sliders.h" #include "ui/widgets/continuous_sliders.h"
#include "ui/widgets/box_content_divider.h"
#include "ui/toast/toast.h" #include "ui/toast/toast.h"
#include "info/profile/info_profile_button.h" #include "info/profile/info_profile_button.h"
#include "info/profile/info_profile_icon.h" #include "info/profile/info_profile_icon.h"
@ -23,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "app.h" #include "app.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_info.h" #include "styles/style_info.h"
@ -387,7 +389,7 @@ Fn<int()> EditPeerPermissionsBox::addSlowmodeSlider(
channel ? channel->slowmodeSeconds() : 0); channel ? channel->slowmodeSeconds() : 0);
container->add( container->add(
object_ptr<BoxContentDivider>(container), object_ptr<Ui::BoxContentDivider>(container),
{ 0, st::infoProfileSkip, 0, st::infoProfileSkip }); { 0, st::infoProfileSkip, 0, st::infoProfileSkip });
container->add( container->add(

View file

@ -15,7 +15,7 @@ class RoundButton;
class VerticalLayout; class VerticalLayout;
} // namespace Ui } // namespace Ui
class EditPeerPermissionsBox : public BoxContent { class EditPeerPermissionsBox : public Ui::BoxContent {
public: public:
EditPeerPermissionsBox(QWidget*, not_null<PeerData*> peer); EditPeerPermissionsBox(QWidget*, not_null<PeerData*> peer);

View file

@ -24,8 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h" #include "mainwindow.h"
#include "mtproto/sender.h" #include "mtproto/sender.h"
#include "observer_peer.h" #include "observer_peer.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"
#include "ui/rp_widget.h" #include "ui/rp_widget.h"
#include "ui/special_buttons.h" #include "ui/special_buttons.h"
#include "ui/toast/toast.h" #include "ui/toast/toast.h"
@ -33,16 +31,21 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/input_fields.h" #include "ui/widgets/input_fields.h"
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/widgets/box_content_divider.h"
#include "ui/wrap/padding_wrap.h" #include "ui/wrap/padding_wrap.h"
#include "ui/wrap/slide_wrap.h" #include "ui/wrap/slide_wrap.h"
#include "ui/wrap/vertical_layout.h" #include "ui/wrap/vertical_layout.h"
#include "ui/special_fields.h" #include "ui/special_fields.h"
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include <rpl/flatten_latest.h> #include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtGui/QClipboard> #include <QtGui/QClipboard>
#include <rpl/flatten_latest.h>
namespace { namespace {
constexpr auto kUsernameCheckTimeout = crl::time(200); constexpr auto kUsernameCheckTimeout = crl::time(200);
@ -189,7 +192,7 @@ void Controller::createContent() {
fillPrivaciesButtons(_wrap, _privacySavedValue); fillPrivaciesButtons(_wrap, _privacySavedValue);
// Skip. // Skip.
_wrap->add(object_ptr<BoxContentDivider>(_wrap)); _wrap->add(object_ptr<Ui::BoxContentDivider>(_wrap));
// //
_wrap->add(createInviteLinkCreate()); _wrap->add(createInviteLinkCreate());
_wrap->add(createInviteLinkEdit()); _wrap->add(createInviteLinkEdit());
@ -471,7 +474,7 @@ void Controller::askUsernameRevoke() {
Box<RevokePublicLinkBox>( Box<RevokePublicLinkBox>(
&_peer->session(), &_peer->session(),
std::move(revokeCallback)), std::move(revokeCallback)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void Controller::usernameChanged() { void Controller::usernameChanged() {
@ -553,7 +556,7 @@ void Controller::exportInviteLink(const QString &confirmation) {
auto box = Box<ConfirmBox>( auto box = Box<ConfirmBox>(
confirmation, confirmation,
std::move(callback)); std::move(callback));
*boxPointer = Ui::show(std::move(box), LayerOption::KeepOther); *boxPointer = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
} }
bool Controller::canEditInviteLink() const { bool Controller::canEditInviteLink() const {

View file

@ -35,7 +35,7 @@ enum class UsernameState {
NotAvailable, NotAvailable,
}; };
class EditPeerTypeBox : public BoxContent { class EditPeerTypeBox : public Ui::BoxContent {
public: public:
// Edit just the invite link. // Edit just the invite link.
EditPeerTypeBox(QWidget*, not_null<PeerData*> peer); EditPeerTypeBox(QWidget*, not_null<PeerData*> peer);

View file

@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/ui_utility.h" #include "ui/ui_utility.h"
#include "app.h" #include "app.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
PhotoCropBox::PhotoCropBox( PhotoCropBox::PhotoCropBox(

View file

@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/abstract_box.h" #include "boxes/abstract_box.h"
class PhotoCropBox : public BoxContent { class PhotoCropBox : public Ui::BoxContent {
public: public:
PhotoCropBox(QWidget*, const QImage &img, const QString &title); PhotoCropBox(QWidget*, const QImage &img, const QString &title);

View file

@ -8,8 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/rate_call_box.h" #include "boxes/rate_call_box.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "styles/style_boxes.h"
#include "styles/style_calls.h"
#include "boxes/confirm_box.h" #include "boxes/confirm_box.h"
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
@ -17,6 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h" #include "mainwindow.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "apiwrap.h" #include "apiwrap.h"
#include "styles/style_layers.h"
#include "styles/style_calls.h"
namespace { namespace {

View file

@ -20,7 +20,7 @@ namespace Main {
class Session; class Session;
} // namespace Main } // namespace Main
class RateCallBox : public BoxContent, private MTP::Sender { class RateCallBox : public Ui::BoxContent, private MTP::Sender {
public: public:
RateCallBox( RateCallBox(
QWidget*, QWidget*,

View file

@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/input_fields.h" #include "ui/widgets/input_fields.h"
#include "ui/toast/toast.h" #include "ui/toast/toast.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_profile.h" #include "styles/style_profile.h"

View file

@ -17,7 +17,7 @@ class Radioenum;
class InputField; class InputField;
} // namespace Ui } // namespace Ui
class ReportBox : public BoxContent, public RPCSender { class ReportBox : public Ui::BoxContent, public RPCSender {
public: public:
ReportBox(QWidget*, not_null<PeerData*> peer); ReportBox(QWidget*, not_null<PeerData*> peer);
ReportBox(QWidget*, not_null<PeerData*> peer, MessageIdsList ids); ReportBox(QWidget*, not_null<PeerData*> peer, MessageIdsList ids);

View file

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "apiwrap.h" #include "apiwrap.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
SelfDestructionBox::SelfDestructionBox( SelfDestructionBox::SelfDestructionBox(

View file

@ -20,7 +20,7 @@ namespace Main {
class Session; class Session;
} // namespace Main } // namespace Main
class SelfDestructionBox : public BoxContent, private MTP::Sender { class SelfDestructionBox : public Ui::BoxContent, private MTP::Sender {
public: public:
SelfDestructionBox( SelfDestructionBox(
QWidget*, QWidget*,

View file

@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h" #include "facades.h"
#include "app.h" #include "app.h"
#include "styles/style_history.h" #include "styles/style_history.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h" #include "styles/style_chat_helpers.h"
@ -1981,7 +1982,7 @@ void SendFilesBox::sendScheduled() {
const auto callback = [=](Api::SendOptions options) { send(options); }; const auto callback = [=](Api::SendOptions options) { send(options); };
Ui::show( Ui::show(
HistoryView::PrepareScheduleBox(this, _sendMenuType, callback), HistoryView::PrepareScheduleBox(this, _sendMenuType, callback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
SendFilesBox::~SendFilesBox() = default; SendFilesBox::~SendFilesBox() = default;

View file

@ -48,7 +48,7 @@ enum class SendFilesWay {
Files, Files,
}; };
class SendFilesBox : public BoxContent { class SendFilesBox : public Ui::BoxContent {
public: public:
enum class SendLimit { enum class SendLimit {
One, One,

View file

@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/wrap/slide_wrap.h" #include "ui/wrap/slide_wrap.h"
#include "ui/wrap/vertical_layout.h" #include "ui/wrap/vertical_layout.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_info.h" #include "styles/style_info.h"
#include "styles/style_settings.h" #include "styles/style_settings.h"
@ -320,7 +321,7 @@ void SessionsBox::terminateOne(uint64 hash) {
tr::lng_settings_reset_button(tr::now), tr::lng_settings_reset_button(tr::now),
st::attentionBoxButton, st::attentionBoxButton,
callback), callback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void SessionsBox::terminateAll() { void SessionsBox::terminateAll() {
@ -346,7 +347,7 @@ void SessionsBox::terminateAll() {
tr::lng_settings_reset_button(tr::now), tr::lng_settings_reset_button(tr::now),
st::attentionBoxButton, st::attentionBoxButton,
callback), callback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
SessionsBox::Inner::Inner(QWidget *parent) SessionsBox::Inner::Inner(QWidget *parent)

View file

@ -22,7 +22,7 @@ namespace Main {
class Session; class Session;
} // namespace Main } // namespace Main
class SessionsBox : public BoxContent, private MTP::Sender { class SessionsBox : public Ui::BoxContent, private MTP::Sender {
public: public:
SessionsBox(QWidget*, not_null<Main::Session*> session); SessionsBox(QWidget*, not_null<Main::Session*> session);

View file

@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_folder.h" #include "data/data_folder.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "core/application.h" #include "core/application.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_history.h" #include "styles/style_history.h"
@ -479,7 +480,7 @@ void ShareBox::submitScheduled() {
const auto callback = [=](Api::SendOptions options) { submit(options); }; const auto callback = [=](Api::SendOptions options) { submit(options); };
Ui::show( Ui::show(
HistoryView::PrepareScheduleBox(this, sendMenuType(), callback), HistoryView::PrepareScheduleBox(this, sendMenuType(), callback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
void ShareBox::copyLink() { void ShareBox::copyLink() {

View file

@ -52,7 +52,7 @@ void ShareGameScoreByHash(
not_null<Main::Session*> session, not_null<Main::Session*> session,
const QString &hash); const QString &hash);
class ShareBox : public BoxContent, public RPCSender { class ShareBox : public Ui::BoxContent, public RPCSender {
public: public:
using CopyCallback = Fn<void()>; using CopyCallback = Fn<void()>;
using SubmitCallback = Fn<void( using SubmitCallback = Fn<void(

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/vertical_layout.h" #include "ui/wrap/vertical_layout.h"
#include "ui/wrap/padding_wrap.h" #include "ui/wrap/padding_wrap.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_layers.h"
SingleChoiceBox::SingleChoiceBox( SingleChoiceBox::SingleChoiceBox(
QWidget*, QWidget*,

View file

@ -14,7 +14,7 @@ namespace Ui {
class Radiobutton; class Radiobutton;
} // namespace Ui } // namespace Ui
class SingleChoiceBox : public BoxContent { class SingleChoiceBox : public Ui::BoxContent {
public: public:
SingleChoiceBox( SingleChoiceBox(
QWidget*, QWidget*,

View file

@ -30,7 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "app.h" #include "app.h"
#include "styles/style_boxes.h" #include "styles/style_layers.h"
#include "styles/style_chat_helpers.h" #include "styles/style_chat_helpers.h"
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
@ -136,14 +136,14 @@ StickerSetBox::StickerSetBox(
, _set(set) { , _set(set) {
} }
QPointer<BoxContent> StickerSetBox::Show( QPointer<Ui::BoxContent> StickerSetBox::Show(
not_null<Window::SessionController*> controller, not_null<Window::SessionController*> controller,
not_null<DocumentData*> document) { not_null<DocumentData*> document) {
if (const auto sticker = document->sticker()) { if (const auto sticker = document->sticker()) {
if (sticker->set.type() != mtpc_inputStickerSetEmpty) { if (sticker->set.type() != mtpc_inputStickerSetEmpty) {
return Ui::show( return Ui::show(
Box<StickerSetBox>(controller, sticker->set), Box<StickerSetBox>(controller, sticker->set),
LayerOption::KeepOther).data(); Ui::LayerOption::KeepOther).data();
} }
} }
return nullptr; return nullptr;
@ -695,7 +695,7 @@ void StickerSetBox::Inner::install() {
if (isMasksSet()) { if (isMasksSet()) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_stickers_masks_pack(tr::now)), Box<InformBox>(tr::lng_stickers_masks_pack(tr::now)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} else if (_installRequest) { } else if (_installRequest) {
return; return;

View file

@ -21,14 +21,14 @@ namespace Ui {
class PlainShadow; class PlainShadow;
} // namespace Ui } // namespace Ui
class StickerSetBox : public BoxContent, public RPCSender { class StickerSetBox : public Ui::BoxContent, public RPCSender {
public: public:
StickerSetBox( StickerSetBox(
QWidget*, QWidget*,
not_null<Window::SessionController*> controller, not_null<Window::SessionController*> controller,
const MTPInputStickerSet &set); const MTPInputStickerSet &set);
static QPointer<BoxContent> Show( static QPointer<Ui::BoxContent> Show(
not_null<Window::SessionController*> controller, not_null<Window::SessionController*> controller,
not_null<DocumentData*> document); not_null<DocumentData*> document);

View file

@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h" #include "main/main_session.h"
#include "facades.h" #include "facades.h"
#include "app.h" #include "app.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h" #include "styles/style_chat_helpers.h"
@ -1302,7 +1303,7 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
Box<StickerSetBox>( Box<StickerSetBox>(
App::wnd()->sessionController(), App::wnd()->sessionController(),
Stickers::inputSetId(*set)), Stickers::inputSetId(*set)),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
}; };
if (selectedIndex >= 0 && !_inDragArea) { if (selectedIndex >= 0 && !_inDragArea) {

View file

@ -26,6 +26,7 @@ class RippleAnimation;
class SettingsSlider; class SettingsSlider;
class SlideAnimation; class SlideAnimation;
class CrossButton; class CrossButton;
class BoxContentDivider;
} // namespace Ui } // namespace Ui
namespace Main { namespace Main {
@ -33,7 +34,7 @@ class Session;
} // namespace Main } // namespace Main
class StickersBox final class StickersBox final
: public BoxContent : public Ui::BoxContent
, public RPCSender , public RPCSender
, private base::Subscriber { , private base::Subscriber {
public: public:
@ -365,7 +366,7 @@ private:
object_ptr<AddressField> _megagroupSetField = { nullptr }; object_ptr<AddressField> _megagroupSetField = { nullptr };
object_ptr<Ui::PlainShadow> _megagroupSelectedShadow = { nullptr }; object_ptr<Ui::PlainShadow> _megagroupSelectedShadow = { nullptr };
object_ptr<Ui::CrossButton> _megagroupSelectedRemove = { nullptr }; object_ptr<Ui::CrossButton> _megagroupSelectedRemove = { nullptr };
object_ptr<BoxContentDivider> _megagroupDivider = { nullptr }; object_ptr<Ui::BoxContentDivider> _megagroupDivider = { nullptr };
object_ptr<Ui::FlatLabel> _megagroupSubTitle = { nullptr }; object_ptr<Ui::FlatLabel> _megagroupSubTitle = { nullptr };
base::Timer _megagroupSetAddressChangedTimer; base::Timer _megagroupSetAddressChangedTimer;
mtpRequestId _megagroupSetRequestId = 0; mtpRequestId _megagroupSetRequestId = 0;

View file

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h" #include "main/main_session.h"
#include "apiwrap.h" #include "apiwrap.h"
#include "app.h" #include "app.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
void UrlAuthBox::Activate( void UrlAuthBox::Activate(
@ -85,7 +86,7 @@ void UrlAuthBox::Request(
const auto bot = request.is_request_write_access() const auto bot = request.is_request_write_access()
? session->data().processUser(request.vbot()).get() ? session->data().processUser(request.vbot()).get()
: nullptr; : nullptr;
const auto box = std::make_shared<QPointer<BoxContent>>(); const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto finishWithUrl = [=](const QString &url) { const auto finishWithUrl = [=](const QString &url) {
if (*box) { if (*box) {
(*box)->closeBox(); (*box)->closeBox();
@ -122,7 +123,7 @@ void UrlAuthBox::Request(
}; };
*box = Ui::show( *box = Ui::show(
Box<UrlAuthBox>(session, url, qs(request.vdomain()), bot, callback), Box<UrlAuthBox>(session, url, qs(request.vdomain()), bot, callback),
LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
UrlAuthBox::UrlAuthBox( UrlAuthBox::UrlAuthBox(

View file

@ -16,7 +16,7 @@ namespace Main {
class Session; class Session;
} // namespace Main } // namespace Main
class UrlAuthBox : public BoxContent { class UrlAuthBox : public Ui::BoxContent {
public: public:
static void Activate( static void Activate(
not_null<const HistoryItem*> message, not_null<const HistoryItem*> message,

View file

@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h" #include "main/main_session.h"
#include "data/data_session.h" #include "data/data_session.h"
#include "data/data_user.h" #include "data/data_user.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>

View file

@ -18,7 +18,7 @@ namespace Main {
class Session; class Session;
} // namespace Main } // namespace Main
class UsernameBox : public BoxContent, public RPCSender { class UsernameBox : public Ui::BoxContent, public RPCSender {
public: public:
UsernameBox(QWidget*, not_null<Main::Session*> session); UsernameBox(QWidget*, not_null<Main::Session*> session);

View file

@ -22,14 +22,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "layout.h" #include "layout.h"
#include "app.h" #include "app.h"
#include "styles/style_calls.h" #include "styles/style_calls.h"
#include "styles/style_boxes.h" #include "styles/style_layers.h"
namespace Calls { namespace Calls {
namespace { namespace {
constexpr auto kUpdateDebugTimeoutMs = crl::time(500); constexpr auto kUpdateDebugTimeoutMs = crl::time(500);
class DebugInfoBox : public BoxContent { class DebugInfoBox : public Ui::BoxContent {
public: public:
DebugInfoBox(QWidget*, base::weak_ptr<Call> call); DebugInfoBox(QWidget*, base::weak_ptr<Call> call);

Some files were not shown because too many files have changed in this diff Show more