Use layers and boxes from lib_ui.
Before Width: | Height: | Size: 81 B |
Before Width: | Height: | Size: 85 B |
Before Width: | Height: | Size: 85 B |
Before Width: | Height: | Size: 106 B |
Before Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 88 B |
Before Width: | Height: | Size: 106 B |
Before Width: | Height: | Size: 104 B |
|
@ -2810,7 +2810,7 @@ void ApiWrap::requestAttachedStickerSets(not_null<PhotoData*> photo) {
|
|||
: MTP_inputStickerSetShortName(setData->vshort_name());
|
||||
Ui::show(
|
||||
Box<StickerSetBox>(App::wnd()->sessionController(), setId),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}).fail([=](const RPCError &error) {
|
||||
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
}).send();
|
||||
|
@ -4903,7 +4903,7 @@ void ApiWrap::editUploadedFile(
|
|||
_session->data().sendHistoryChangeNotifications();
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_edit_media_invalid_file(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
} else {
|
||||
sendMessageFail(error, peer);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_mediaview.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QtGui/QFontDatabase>
|
||||
|
|
|
@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/platform/base_platform_info.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "core/update_checker.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
|
|
@ -14,7 +14,7 @@ class LinkButton;
|
|||
class FlatLabel;
|
||||
} // namespace Ui
|
||||
|
||||
class AboutBox : public BoxContent {
|
||||
class AboutBox : public Ui::BoxContent {
|
||||
public:
|
||||
AboutBox(QWidget*);
|
||||
|
||||
|
|
|
@ -7,606 +7,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#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 "mainwindow.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 internal {
|
||||
|
||||
void showBox(
|
||||
object_ptr<BoxContent> content,
|
||||
LayerOptions options,
|
||||
anim::type animated) {
|
||||
object_ptr<BoxContent> content,
|
||||
LayerOptions options,
|
||||
anim::type animated) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_showBox(std::move(content), options, animated);
|
||||
}
|
||||
|
@ -634,14 +45,4 @@ bool isLayerShown() {
|
|||
return false;
|
||||
}
|
||||
|
||||
int DividerLabel::naturalWidth() const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DividerLabel::resizeEvent(QResizeEvent *e) {
|
||||
_background->lower();
|
||||
_background->setGeometry(rect());
|
||||
return PaddingWrap::resizeEvent(e);
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
|
|
@ -7,14 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "window/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"
|
||||
#include "ui/layers/box_layer_widget.h"
|
||||
|
||||
class Painter;
|
||||
|
||||
|
@ -32,413 +25,13 @@ class FlatLabel;
|
|||
class FadeShadow;
|
||||
} // 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.
|
||||
namespace Ui {
|
||||
namespace internal {
|
||||
|
||||
void showBox(
|
||||
object_ptr<BoxContent> content,
|
||||
LayerOptions options,
|
||||
Ui::LayerOptions options,
|
||||
anim::type animated);
|
||||
|
||||
} // namespace internal
|
||||
|
@ -446,7 +39,7 @@ void showBox(
|
|||
template <typename BoxType>
|
||||
QPointer<BoxType> show(
|
||||
object_ptr<BoxType> content,
|
||||
LayerOptions options = LayerOption::CloseOther,
|
||||
Ui::LayerOptions options = Ui::LayerOption::CloseOther,
|
||||
anim::type animated = anim::type::normal) {
|
||||
auto result = QPointer<BoxType>(content.data());
|
||||
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);
|
||||
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
|
||||
|
|
|
@ -7,8 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "boxes/add_contact_box.h"
|
||||
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "base/flat_set.h"
|
||||
|
@ -42,6 +40,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "observer_peer.h"
|
||||
#include "main/main_session.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
|
@ -164,7 +165,7 @@ void ShowAddParticipantsError(
|
|||
tr::lng_cant_invite_make_admin(tr::now),
|
||||
tr::lng_cancel(tr::now),
|
||||
makeAdmin),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +200,7 @@ void ShowAddParticipantsError(
|
|||
}
|
||||
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 {
|
||||
|
@ -588,16 +589,16 @@ void GroupInfoBox::createGroup(
|
|||
} else if (error.type() == qstr("USERS_TOO_FEW")) {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_cant_invite_privacy(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
} else if (error.type() == qstr("PEER_FLOOD")) {
|
||||
Ui::show(
|
||||
Box<InformBox>(
|
||||
PeerFloodErrorText(PeerFloodType::InviteGroup)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
} else if (error.type() == qstr("USER_RESTRICTED")) {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_cant_do_this(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
@ -636,7 +637,7 @@ void GroupInfoBox::submit() {
|
|||
Box<PeerListBox>(
|
||||
std::make_unique<AddParticipantsBoxController>(_navigation),
|
||||
std::move(initBox)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1032,7 @@ void SetupChannelBox::privacyChanged(Privacy value) {
|
|||
Box<RevokePublicLinkBox>(
|
||||
&_channel->session(),
|
||||
callback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
_link->show();
|
||||
|
@ -1126,14 +1127,14 @@ void SetupChannelBox::showRevokePublicLinkBoxForEdit() {
|
|||
const auto callback = [=] {
|
||||
Ui::show(
|
||||
Box<SetupChannelBox>(navigation, channel, existing),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
};
|
||||
closeBox();
|
||||
Ui::show(
|
||||
Box<RevokePublicLinkBox>(
|
||||
&channel->session(),
|
||||
callback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
bool SetupChannelBox::onFirstCheckFail(const RPCError &error) {
|
||||
|
@ -1412,7 +1413,7 @@ void RevokePublicLinkBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
|||
callback();
|
||||
}
|
||||
}).send();
|
||||
})), LayerOption::KeepOther);
|
||||
})), Ui::LayerOption::KeepOther);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ void ShowAddParticipantsError(
|
|||
not_null<PeerData*> chat,
|
||||
const std::vector<not_null<UserData*>> &users);
|
||||
|
||||
class AddContactBox : public BoxContent {
|
||||
class AddContactBox : public Ui::BoxContent {
|
||||
public:
|
||||
AddContactBox(QWidget*, not_null<Main::Session*> session);
|
||||
AddContactBox(
|
||||
|
@ -94,7 +94,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class GroupInfoBox : public BoxContent, private MTP::Sender {
|
||||
class GroupInfoBox : public Ui::BoxContent, private MTP::Sender {
|
||||
public:
|
||||
enum class Type {
|
||||
Group,
|
||||
|
@ -140,7 +140,7 @@ private:
|
|||
};
|
||||
|
||||
class SetupChannelBox
|
||||
: public BoxContent
|
||||
: public Ui::BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
|
@ -209,7 +209,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class EditNameBox : public BoxContent, public RPCSender {
|
||||
class EditNameBox : public Ui::BoxContent, public RPCSender {
|
||||
public:
|
||||
EditNameBox(QWidget*, not_null<UserData*> user);
|
||||
|
||||
|
@ -238,7 +238,7 @@ private:
|
|||
};
|
||||
|
||||
class RevokePublicLinkBox
|
||||
: public BoxContent
|
||||
: public Ui::BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/localstorage.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "export/view/export_view_settings.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ enum class Source;
|
|||
} // namespace AutoDownload
|
||||
} // namespace Data
|
||||
|
||||
class AutoDownloadBox : public BoxContent {
|
||||
class AutoDownloadBox : public Ui::BoxContent {
|
||||
public:
|
||||
AutoDownloadBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwindow.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
AutoLockBox::AutoLockBox(QWidget*, not_null<Main::Session*> session)
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Ui {
|
|||
class Radiobutton;
|
||||
} // namespace Ui
|
||||
|
||||
class AutoLockBox : public BoxContent {
|
||||
class AutoLockBox : public Ui::BoxContent {
|
||||
public:
|
||||
AutoLockBox(QWidget*, not_null<Main::Session*> session);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/confirm_box.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_overview.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
||||
|
@ -144,7 +145,7 @@ void BackgroundBox::prepare() {
|
|||
) | rpl::start_with_next([=](const Data::WallPaper &paper) {
|
||||
Ui::show(
|
||||
Box<BackgroundPreviewBox>(_session, paper),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}, _inner->lifetime());
|
||||
|
||||
_inner->removeRequests(
|
||||
|
@ -154,7 +155,7 @@ void BackgroundBox::prepare() {
|
|||
}
|
||||
|
||||
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 remove = [=, weak = Ui::MakeWeak(this)]{
|
||||
if (*box) {
|
||||
|
@ -176,7 +177,7 @@ void BackgroundBox::removePaper(const Data::WallPaper &paper) {
|
|||
tr::lng_selected_delete(tr::now),
|
||||
tr::lng_cancel(tr::now),
|
||||
remove),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
BackgroundBox::Inner::Inner(
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Data {
|
|||
class WallPaper;
|
||||
} // namespace Data
|
||||
|
||||
class BackgroundBox : public BoxContent {
|
||||
class BackgroundBox : public Ui::BoxContent {
|
||||
public:
|
||||
BackgroundBox(QWidget*, not_null<Main::Session*> session);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/background_preview_box.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
#include <QtGui/QClipboard>
|
||||
|
|
|
@ -24,7 +24,7 @@ class Checkbox;
|
|||
} // namespace Ui
|
||||
|
||||
class BackgroundPreviewBox
|
||||
: public BoxContent
|
||||
: public Ui::BoxContent
|
||||
, private HistoryView::SimpleElementDelegate
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
using "ui/basic.style";
|
||||
|
||||
using "ui/layers/layers.style";
|
||||
using "ui/widgets/widgets.style";
|
||||
using "intro/intro.style";
|
||||
|
||||
|
@ -31,135 +32,6 @@ FeedUserpicButton {
|
|||
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;
|
||||
countryRowNameFont: semiboldFont;
|
||||
countryRowNameFg: boxTextFg;
|
||||
|
@ -204,12 +76,6 @@ defaultFeedUserpicButton: FeedUserpicButton {
|
|||
innerPart: defaultUserpicButton;
|
||||
}
|
||||
|
||||
boxLoadingAnimation: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
|
||||
color: windowSubTextFg;
|
||||
thickness: 2px;
|
||||
}
|
||||
boxLoadingSize: 20px;
|
||||
|
||||
cropPointSize: 10px;
|
||||
cropSkip: 13px;
|
||||
cropMinSize: 20px;
|
||||
|
@ -768,7 +634,7 @@ rightsToggle: Toggle(defaultToggle) {
|
|||
stroke: 2px;
|
||||
duration: 120;
|
||||
}
|
||||
rightsDividerHeight: 10px;
|
||||
rightsDividerHeight: boxDividerHeight;
|
||||
rightsDividerMargin: margins(0px, 0px, 0px, 20px);
|
||||
rightsHeaderMargin: margins(23px, 0px, 23px, 8px);
|
||||
rightsToggleMargin: margins(23px, 8px, 23px, 8px);
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Ui {
|
|||
class IconButton;
|
||||
} // namespace Ui
|
||||
|
||||
class CalendarBox : public BoxContent, private base::Subscriber {
|
||||
class CalendarBox : public Ui::BoxContent, private base::Subscriber {
|
||||
public:
|
||||
CalendarBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace {
|
||||
|
@ -61,7 +62,7 @@ void createErrorLabel(
|
|||
|
||||
} // namespace
|
||||
|
||||
class ChangePhoneBox::EnterPhone : public BoxContent {
|
||||
class ChangePhoneBox::EnterPhone : public Ui::BoxContent {
|
||||
public:
|
||||
EnterPhone(QWidget*, not_null<Main::Session*> session);
|
||||
|
||||
|
@ -89,7 +90,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class ChangePhoneBox::EnterCode : public BoxContent {
|
||||
class ChangePhoneBox::EnterCode : public Ui::BoxContent {
|
||||
public:
|
||||
EnterCode(
|
||||
QWidget*,
|
||||
|
@ -214,7 +215,7 @@ void ChangePhoneBox::EnterPhone::sendPhoneDone(const QString &phoneNumber, const
|
|||
phoneCodeHash,
|
||||
codeLength,
|
||||
callTimeout),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
bool ChangePhoneBox::EnterPhone::sendPhoneFail(const QString &phoneNumber, const RPCError &error) {
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Main {
|
|||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class ChangePhoneBox : public BoxContent {
|
||||
class ChangePhoneBox : public Ui::BoxContent {
|
||||
public:
|
||||
ChangePhoneBox(QWidget*, not_null<Main::Session*> session);
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "boxes/confirm_box.h"
|
||||
|
||||
#include "styles/style_boxes.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
|
@ -36,6 +35,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "observer_peer.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
|
|
|
@ -20,7 +20,7 @@ class EmptyUserpic;
|
|||
} // namespace Ui
|
||||
|
||||
class InformBox;
|
||||
class ConfirmBox : public BoxContent, public ClickHandlerHost {
|
||||
class ConfirmBox : public Ui::BoxContent, public ClickHandlerHost {
|
||||
public:
|
||||
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()>());
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class MaxInviteBox : public BoxContent, private base::Subscriber {
|
||||
class MaxInviteBox : public Ui::BoxContent, private base::Subscriber {
|
||||
public:
|
||||
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:
|
||||
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:
|
||||
DeleteMessagesBox(
|
||||
QWidget*,
|
||||
|
@ -202,7 +202,7 @@ private:
|
|||
};
|
||||
|
||||
class ConfirmInviteBox
|
||||
: public BoxContent
|
||||
: public Ui::BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
|
@ -238,7 +238,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class ConfirmDontWarnBox : public BoxContent {
|
||||
class ConfirmDontWarnBox : public Ui::BoxContent {
|
||||
public:
|
||||
ConfirmDontWarnBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "boxes/confirm_phone_box.h"
|
||||
|
||||
#include "styles/style_boxes.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
|
@ -20,6 +19,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "numbers.h"
|
||||
#include "app.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -54,7 +55,7 @@ Locale: ") + Platform::SystemLanguage();
|
|||
} // namespace
|
||||
|
||||
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 = [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
|
|
|
@ -85,7 +85,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class ConfirmPhoneBox : public BoxContent, public RPCSender {
|
||||
class ConfirmPhoneBox : public Ui::BoxContent, public RPCSender {
|
||||
public:
|
||||
static void start(const QString &phone, const QString &hash);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/effects/radial_animation.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
#include "styles/style_info.h"
|
||||
|
@ -134,7 +135,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class ProxiesBox : public BoxContent {
|
||||
class ProxiesBox : public Ui::BoxContent {
|
||||
public:
|
||||
using View = ProxiesBoxController::ItemView;
|
||||
|
||||
|
@ -166,7 +167,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class ProxyBox : public BoxContent {
|
||||
class ProxyBox : public Ui::BoxContent {
|
||||
public:
|
||||
ProxyBox(
|
||||
QWidget*,
|
||||
|
@ -1029,7 +1030,7 @@ void ProxiesBoxController::ShowApplyConfirmation(
|
|||
if (const auto strong = box->data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
}), LayerOption::KeepOther);
|
||||
}), Ui::LayerOption::KeepOther);
|
||||
} else {
|
||||
Ui::show(Box<InformBox>(
|
||||
(proxy.status() == ProxyData::Status::Unsupported
|
||||
|
@ -1134,14 +1135,14 @@ void ProxiesBoxController::setupChecker(int id, const Checker &checker) {
|
|||
pointer->connect(pointer, &Connection::error, failed);
|
||||
}
|
||||
|
||||
object_ptr<BoxContent> ProxiesBoxController::CreateOwningBox() {
|
||||
object_ptr<Ui::BoxContent> ProxiesBoxController::CreateOwningBox() {
|
||||
auto controller = std::make_unique<ProxiesBoxController>();
|
||||
auto box = controller->create();
|
||||
Ui::AttachAsChild(box, std::move(controller));
|
||||
return box;
|
||||
}
|
||||
|
||||
object_ptr<BoxContent> ProxiesBoxController::create() {
|
||||
object_ptr<Ui::BoxContent> ProxiesBoxController::create() {
|
||||
auto result = Box<ProxiesBox>(this);
|
||||
for (const auto &item : _list) {
|
||||
updateView(item);
|
||||
|
@ -1249,7 +1250,7 @@ void ProxiesBoxController::setDeleted(int id, bool deleted) {
|
|||
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) {
|
||||
auto i = findById(id);
|
||||
auto j = ranges::find(
|
||||
|
@ -1300,7 +1301,7 @@ void ProxiesBoxController::replaceItemValue(
|
|||
saveDelayed();
|
||||
}
|
||||
|
||||
object_ptr<BoxContent> ProxiesBoxController::addNewItemBox() {
|
||||
object_ptr<Ui::BoxContent> ProxiesBoxController::addNewItemBox() {
|
||||
return Box<ProxyBox>(ProxyData(), [=](const ProxyData &result) {
|
||||
auto j = ranges::find(
|
||||
_list,
|
||||
|
|
|
@ -7,11 +7,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/object_ptr.h"
|
||||
#include "mtproto/connection_abstract.h"
|
||||
|
||||
namespace Ui {
|
||||
class BoxContent;
|
||||
class InputField;
|
||||
class PortInput;
|
||||
class PasswordInput;
|
||||
|
@ -32,8 +33,8 @@ public:
|
|||
Type type,
|
||||
const QMap<QString, QString> &fields);
|
||||
|
||||
static object_ptr<BoxContent> CreateOwningBox();
|
||||
object_ptr<BoxContent> create();
|
||||
static object_ptr<Ui::BoxContent> CreateOwningBox();
|
||||
object_ptr<Ui::BoxContent> create();
|
||||
|
||||
enum class ItemState {
|
||||
Connecting,
|
||||
|
@ -60,8 +61,8 @@ public:
|
|||
void restoreItem(int id);
|
||||
void shareItem(int id);
|
||||
void applyItem(int id);
|
||||
object_ptr<BoxContent> editItemBox(int id);
|
||||
object_ptr<BoxContent> addNewItemBox();
|
||||
object_ptr<Ui::BoxContent> editItemBox(int id);
|
||||
object_ptr<Ui::BoxContent> addNewItemBox();
|
||||
bool setProxySettings(ProxyData::Settings value);
|
||||
void setProxyForCalls(bool enabled);
|
||||
void setTryIPv6(bool enabled);
|
||||
|
|
|
@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "settings/settings_common.h"
|
||||
#include "base/unique_qptr.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
|
@ -724,7 +725,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
|||
this,
|
||||
SendMenuType::Scheduled,
|
||||
send),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
};
|
||||
const auto updateValid = [=] {
|
||||
valid->fire(isValidQuestion() && options->isValid());
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Main {
|
|||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class CreatePollBox : public BoxContent {
|
||||
class CreatePollBox : public Ui::BoxContent {
|
||||
public:
|
||||
struct Result {
|
||||
PollData poll;
|
||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/buttons.h"
|
||||
#include "platform/platform_specific.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
DownloadPathBox::DownloadPathBox(QWidget *parent)
|
||||
|
|
|
@ -18,7 +18,7 @@ class Radioenum;
|
|||
class LinkButton;
|
||||
} // namespace Ui
|
||||
|
||||
class DownloadPathBox : public BoxContent {
|
||||
class DownloadPathBox : public Ui::BoxContent {
|
||||
public:
|
||||
DownloadPathBox(QWidget *parent);
|
||||
|
||||
|
|
|
@ -29,9 +29,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "layout.h"
|
||||
#include "media/clip/media_clip_reader.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/widgets/input_fields.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
|
@ -42,6 +39,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "confirm_box.h"
|
||||
#include "facades.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>
|
||||
|
||||
|
@ -493,7 +494,7 @@ void EditCaptionBox::createEditMediaButton() {
|
|||
if (mimeType == qstr("image/webp")) {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_edit_media_invalid_file(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -521,7 +522,7 @@ void EditCaptionBox::createEditMediaButton() {
|
|||
|| file->type == Storage::PreparedFile::AlbumType::None) {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_edit_media_album_error(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -551,7 +552,7 @@ void EditCaptionBox::createEditMediaButton() {
|
|||
if (!valid) {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_edit_media_album_error(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -687,7 +688,7 @@ bool EditCaptionBox::fileFromClipboard(not_null<const QMimeData*> data) {
|
|||
&& _isAlbum) {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_edit_media_album_error(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class SessionController;
|
|||
} // namespace Window
|
||||
|
||||
class EditCaptionBox
|
||||
: public BoxContent
|
||||
: public Ui::BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "boxes/abstract_box.h"
|
||||
|
||||
class EditColorBox : public BoxContent, private base::Subscriber {
|
||||
class EditColorBox : public Ui::BoxContent, private base::Subscriber {
|
||||
public:
|
||||
enum class Mode {
|
||||
RGBA,
|
||||
|
|
|
@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_channel.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "styles/style_settings.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -170,7 +170,7 @@ void EditPrivacyBox::editExceptions(
|
|||
};
|
||||
Ui::show(
|
||||
Box<PeerListBox>(std::move(controller), std::move(initBox)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
QVector<MTPInputPrivacyRule> EditPrivacyBox::collectResult() {
|
||||
|
|
|
@ -23,6 +23,10 @@ template <typename Widget>
|
|||
class SlideWrap;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Window {
|
||||
class SessionController;
|
||||
} // namespace Window
|
||||
|
||||
class EditPrivacyBox;
|
||||
|
||||
class EditPrivacyController {
|
||||
|
@ -96,7 +100,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class EditPrivacyBox : public BoxContent, private MTP::Sender {
|
||||
class EditPrivacyBox : public Ui::BoxContent, private MTP::Sender {
|
||||
public:
|
||||
using Value = ApiWrap::Privacy;
|
||||
using Option = Value::Option;
|
||||
|
|
|
@ -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));
|
||||
}
|
|
@ -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) {
|
||||
}
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/multi_select.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/widgets/dropdown_menu.h"
|
||||
#include "ui/widgets/box_content_divider.h"
|
||||
#include "ui/text/text_entity.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
|
@ -27,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/application.h"
|
||||
#include "lang/lang_instance.h"
|
||||
#include "lang/lang_cloud_manager.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_passport.h"
|
||||
|
@ -896,9 +898,9 @@ void Content::setupContent(
|
|||
};
|
||||
const auto main = add(recent, false);
|
||||
const auto divider = content->add(
|
||||
object_ptr<Ui::SlideWrap<BoxContentDivider>>(
|
||||
object_ptr<Ui::SlideWrap<Ui::BoxContentDivider>>(
|
||||
content,
|
||||
object_ptr<BoxContentDivider>(content)));
|
||||
object_ptr<Ui::BoxContentDivider>(content)));
|
||||
const auto other = add(official, true);
|
||||
Ui::ResizeFitChild(this, content);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class MultiSelect;
|
|||
struct ScrollToRequest;
|
||||
} // namespace Ui
|
||||
|
||||
class LanguageBox : public BoxContent {
|
||||
class LanguageBox : public Ui::BoxContent {
|
||||
public:
|
||||
LanguageBox(QWidget*) {
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwindow.h"
|
||||
#include "main/main_session.h"
|
||||
#include "layout.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -28,7 +28,7 @@ class LabelSimple;
|
|||
class MediaSlider;
|
||||
} // namespace Ui
|
||||
|
||||
class LocalStorageBox : public BoxContent {
|
||||
class LocalStorageBox : public Ui::BoxContent {
|
||||
struct CreateTag {
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Copyright (C) 2017, Nicholas Guriev <guriev-ns@ya.ru>
|
|||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -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
|
||||
* turning off notifications from a chat. The widget is opened by a context menu
|
||||
* in the left list of dialogues. */
|
||||
class MuteSettingsBox : public BoxContent {
|
||||
class MuteSettingsBox : public Ui::BoxContent {
|
||||
public:
|
||||
MuteSettingsBox(QWidget *parent, not_null<PeerData*> peer);
|
||||
|
||||
|
|
|
@ -22,8 +22,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "passport/passport_encryption.h"
|
||||
#include "passport/passport_panel_edit_contact.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_passport.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -375,7 +376,7 @@ void PasscodeBox::validateEmail(
|
|||
Lang::Hard::EmailConfirmationExpired());
|
||||
weak->getDelegate()->show(
|
||||
std::move(box),
|
||||
LayerOption::CloseOther);
|
||||
Ui::LayerOption::CloseOther);
|
||||
}
|
||||
} else {
|
||||
errors->fire(Lang::Hard::ServerError());
|
||||
|
@ -531,7 +532,7 @@ void PasscodeBox::submitOnlyCheckCloudPassword(const QString &oldPassword) {
|
|||
if (_cloudFields.turningOff && _cloudFields.notEmptyPassport) {
|
||||
Assert(!_cloudFields.customCheckCallback);
|
||||
|
||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto confirmed = [=] {
|
||||
send();
|
||||
if (*box) {
|
||||
|
@ -738,7 +739,7 @@ void PasscodeBox::changeCloudPassword(
|
|||
}
|
||||
|
||||
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 = [=] {
|
||||
checkPasswordHash([=](const Core::CloudPasswordResult &check) {
|
||||
resetSecret(check, newPassword, [=] {
|
||||
|
@ -990,7 +991,7 @@ void RecoverBox::submit() {
|
|||
rpcFail(&RecoverBox::codeSubmitFail));
|
||||
});
|
||||
if (_notEmptyPassport) {
|
||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto confirmed = [=] {
|
||||
send();
|
||||
if (*box) {
|
||||
|
@ -1019,7 +1020,7 @@ void RecoverBox::codeSubmitDone(
|
|||
_passwordCleared.fire({});
|
||||
getDelegate()->show(
|
||||
Box<InformBox>(tr::lng_cloud_password_removed(tr::now)),
|
||||
LayerOption::CloseOther);
|
||||
Ui::LayerOption::CloseOther);
|
||||
}
|
||||
|
||||
bool RecoverBox::codeSubmitFail(const RPCError &error) {
|
||||
|
@ -1039,7 +1040,7 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
|
|||
_passwordCleared.fire({});
|
||||
getDelegate()->show(
|
||||
Box<InformBox>(tr::lng_cloud_password_removed(tr::now)),
|
||||
LayerOption::CloseOther);
|
||||
Ui::LayerOption::CloseOther);
|
||||
return true;
|
||||
} else if (err == qstr("PASSWORD_RECOVERY_NA")) {
|
||||
closeBox();
|
||||
|
@ -1070,7 +1071,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(const QString &pattern) {
|
|||
const auto errors = 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 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 cancels = std::make_shared<rpl::event_stream<>>();
|
||||
|
||||
|
@ -1084,7 +1085,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(const QString &pattern) {
|
|||
if (*weak) {
|
||||
(*weak)->getDelegate()->show(
|
||||
Box<InformBox>(tr::lng_cloud_password_was_set(tr::now)),
|
||||
LayerOption::CloseOther);
|
||||
Ui::LayerOption::CloseOther);
|
||||
}
|
||||
};
|
||||
const auto fail = [=](const RPCError &error) {
|
||||
|
@ -1105,7 +1106,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(const QString &pattern) {
|
|||
Lang::Hard::EmailConfirmationExpired());
|
||||
(*weak)->getDelegate()->show(
|
||||
std::move(box),
|
||||
LayerOption::CloseOther);
|
||||
Ui::LayerOption::CloseOther);
|
||||
}
|
||||
} else {
|
||||
errors->fire(Lang::Hard::ServerError());
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Core {
|
|||
struct CloudPasswordState;
|
||||
} // namespace Core
|
||||
|
||||
class PasscodeBox : public BoxContent, private MTP::Sender {
|
||||
class PasscodeBox : public Ui::BoxContent, private MTP::Sender {
|
||||
public:
|
||||
PasscodeBox(QWidget*, not_null<Main::Session*> session, bool turningOff);
|
||||
|
||||
|
@ -133,7 +133,7 @@ private:
|
|||
|
||||
QString _pattern;
|
||||
|
||||
QPointer<BoxContent> _replacedBy;
|
||||
QPointer<Ui::BoxContent> _replacedBy;
|
||||
bool _turningOff = false;
|
||||
bool _cloudPwd = false;
|
||||
CloudFields _cloudFields;
|
||||
|
@ -163,7 +163,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class RecoverBox : public BoxContent, public RPCSender {
|
||||
class RecoverBox : public Ui::BoxContent, public RPCSender {
|
||||
public:
|
||||
RecoverBox(QWidget*, const QString &pattern, bool notEmptyPassport);
|
||||
|
||||
|
@ -201,7 +201,7 @@ private:
|
|||
};
|
||||
|
||||
struct RecoveryEmailValidation {
|
||||
object_ptr<BoxContent> box;
|
||||
object_ptr<Ui::BoxContent> box;
|
||||
rpl::producer<> reloadRequests;
|
||||
rpl::producer<> cancelRequests;
|
||||
};
|
||||
|
|
|
@ -7,10 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#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 "mainwidget.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 "base/unixtime.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(
|
||||
not_null<PeerData*> peer,
|
||||
|
|
|
@ -752,7 +752,7 @@ private:
|
|||
};
|
||||
|
||||
class PeerListBox
|
||||
: public BoxContent
|
||||
: public Ui::BoxContent
|
||||
, public PeerListContentDelegate {
|
||||
public:
|
||||
PeerListBox(
|
||||
|
|
|
@ -464,7 +464,7 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
|
|||
}();
|
||||
Ui::show(
|
||||
Box<ConfirmBox>(confirmText, std::move(send)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
|
||||
|
@ -472,7 +472,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
|
|||
if (!megagroup->canAddMembers()) {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_error_cant_add_member(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
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);
|
||||
Ui::show(
|
||||
Box<ConfirmBox>(confirmText, send),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
auto AddBotToGroupBoxController::createRow(not_null<History*> history)
|
||||
|
|
|
@ -98,13 +98,13 @@ void AddParticipantsBoxController::rowClicked(not_null<PeerListRow*> row) {
|
|||
if (!_peer->isMegagroup()) {
|
||||
Ui::show(
|
||||
Box<MaxInviteBox>(_peer->asChannel()),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
} else if (count >= Global::ChatSizeMax()
|
||||
&& count < Global::MegagroupSizeMax()) {
|
||||
Ui::show(
|
||||
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>(
|
||||
std::move(controller),
|
||||
std::move(initBox)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void AddParticipantsBoxController::Start(
|
||||
|
@ -251,7 +251,7 @@ void AddParticipantsBoxController::Start(
|
|||
Box<PeerListBox>(
|
||||
std::move(controller),
|
||||
std::move(initBox)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void AddParticipantsBoxController::Start(
|
||||
|
@ -517,19 +517,19 @@ void AddSpecialBoxController::showAdmin(
|
|||
Box<ConfirmBox>(
|
||||
tr::lng_sure_add_admin_unremove(tr::now),
|
||||
showAdminSure),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Ui::show(Box<InformBox>(
|
||||
tr::lng_error_cant_add_admin_unban(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Ui::show(Box<InformBox>(
|
||||
tr::lng_error_cant_add_admin_invite(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
} else if (_additional.restrictedRights(user).has_value()) {
|
||||
|
@ -540,13 +540,13 @@ void AddSpecialBoxController::showAdmin(
|
|||
Box<ConfirmBox>(
|
||||
tr::lng_sure_add_admin_unremove(tr::now),
|
||||
showAdminSure),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Ui::show(Box<InformBox>(
|
||||
tr::lng_error_cant_add_admin_unban(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
} else if (_additional.isExternal(user)) {
|
||||
|
@ -560,13 +560,13 @@ void AddSpecialBoxController::showAdmin(
|
|||
Box<ConfirmBox>(
|
||||
text,
|
||||
showAdminSure),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_error_cant_add_admin_invite(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ void AddSpecialBoxController::showAdmin(
|
|||
});
|
||||
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(
|
||||
|
@ -669,13 +669,13 @@ void AddSpecialBoxController::showRestricted(
|
|||
Box<ConfirmBox>(
|
||||
tr::lng_sure_ban_admin(tr::now),
|
||||
showRestrictedSure),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_error_cant_ban_admin(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -704,7 +704,7 @@ void AddSpecialBoxController::showRestricted(
|
|||
box->setSaveCallback(
|
||||
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(
|
||||
|
@ -759,13 +759,13 @@ void AddSpecialBoxController::kickUser(
|
|||
Box<ConfirmBox>(
|
||||
tr::lng_sure_ban_admin(tr::now),
|
||||
kickUserSure),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_error_cant_ban_admin(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ void AddSpecialBoxController::kickUser(
|
|||
user->name);
|
||||
_editBox = Ui::show(
|
||||
Box<ConfirmBox>(text, kickUserSure),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,8 +126,8 @@ private:
|
|||
bool _allLoaded = false;
|
||||
ParticipantsAdditionalData _additional;
|
||||
std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
|
||||
BoxPointer _editBox;
|
||||
QPointer<BoxContent> _editParticipantBox;
|
||||
Ui::BoxPointer _editBox;
|
||||
QPointer<Ui::BoxContent> _editParticipantBox;
|
||||
AdminDoneCallback _adminDoneCallback;
|
||||
BannedDoneCallback _bannedDoneCallback;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "boxes/peers/edit_contact_box.h"
|
||||
|
||||
#include "boxes/generic_box.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_session.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 "apiwrap.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
|
@ -36,7 +36,7 @@ QString UserPhone(not_null<UserData*> user) {
|
|||
}
|
||||
|
||||
void SendRequest(
|
||||
QPointer<GenericBox> box,
|
||||
QPointer<Ui::GenericBox> box,
|
||||
not_null<UserData*> user,
|
||||
bool sharePhone,
|
||||
const QString &first,
|
||||
|
@ -82,7 +82,7 @@ void SendRequest(
|
|||
class Controller {
|
||||
public:
|
||||
Controller(
|
||||
not_null<GenericBox*> box,
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<UserData*> user);
|
||||
|
||||
|
@ -99,7 +99,7 @@ private:
|
|||
not_null<Ui::InputField*> last,
|
||||
bool inverted);
|
||||
|
||||
not_null<GenericBox*> _box;
|
||||
not_null<Ui::GenericBox*> _box;
|
||||
not_null<Window::Controller*> _window;
|
||||
not_null<UserData*> _user;
|
||||
Ui::Checkbox *_sharePhone = nullptr;
|
||||
|
@ -110,7 +110,7 @@ private:
|
|||
};
|
||||
|
||||
Controller::Controller(
|
||||
not_null<GenericBox*> box,
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<UserData*> user)
|
||||
: _box(box)
|
||||
|
@ -265,7 +265,7 @@ void Controller::setupSharePhoneNumber() {
|
|||
} // namespace
|
||||
|
||||
void EditContactBox(
|
||||
not_null<GenericBox*> box,
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<UserData*> user) {
|
||||
box->lifetime().make_state<Controller>(box, window, user)->prepare();
|
||||
|
|
|
@ -7,14 +7,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/layers/generic_box.h"
|
||||
|
||||
class UserData;
|
||||
class GenericBox;
|
||||
|
||||
namespace Window {
|
||||
class Controller;
|
||||
} // namespace Window
|
||||
|
||||
void EditContactBox(
|
||||
not_null<GenericBox*> box,
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<UserData*> user);
|
||||
|
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "apiwrap.h"
|
||||
#include "facades.h"
|
||||
#include "main/main_session.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
|
@ -145,7 +146,7 @@ void Controller::choose(not_null<ChannelData*> chat) {
|
|||
Ui::Text::RichLangValue));
|
||||
}
|
||||
}
|
||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto sure = [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
|
@ -158,7 +159,7 @@ void Controller::choose(not_null<ChannelData*> chat) {
|
|||
text,
|
||||
tr::lng_manage_discussion_group_link(tr::now),
|
||||
sure),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
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(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto sure = [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
|
@ -193,7 +194,7 @@ void Controller::choose(not_null<ChatData*> chat) {
|
|||
text,
|
||||
tr::lng_manage_discussion_group_link(tr::now),
|
||||
sure),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> SetupAbout(
|
||||
|
@ -256,7 +257,7 @@ object_ptr<Ui::RpWidget> SetupCreateGroup(
|
|||
GroupInfoBox::Type::Megagroup,
|
||||
channel->name + " Chat",
|
||||
guarded),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
@ -277,7 +278,7 @@ object_ptr<Ui::RpWidget> SetupUnlink(
|
|||
return result;
|
||||
}
|
||||
|
||||
object_ptr<BoxContent> EditLinkedChatBox(
|
||||
object_ptr<Ui::BoxContent> EditLinkedChatBox(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<ChannelData*> channel,
|
||||
ChannelData *chat,
|
||||
|
@ -324,7 +325,7 @@ object_ptr<BoxContent> EditLinkedChatBox(
|
|||
|
||||
} // namespace
|
||||
|
||||
object_ptr<BoxContent> EditLinkedChatBox(
|
||||
object_ptr<Ui::BoxContent> EditLinkedChatBox(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<ChannelData*> channel,
|
||||
std::vector<not_null<PeerData*>> &&chats,
|
||||
|
@ -338,7 +339,7 @@ object_ptr<BoxContent> EditLinkedChatBox(
|
|||
callback);
|
||||
}
|
||||
|
||||
object_ptr<BoxContent> EditLinkedChatBox(
|
||||
object_ptr<Ui::BoxContent> EditLinkedChatBox(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<ChannelData*> chat,
|
||||
|
|
|
@ -7,20 +7,24 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "base/object_ptr.h"
|
||||
|
||||
namespace Ui {
|
||||
class BoxContent;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Window {
|
||||
class SessionNavigation;
|
||||
} // namespace Window
|
||||
|
||||
object_ptr<BoxContent> EditLinkedChatBox(
|
||||
object_ptr<Ui::BoxContent> EditLinkedChatBox(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<ChannelData*> chat,
|
||||
bool canEdit,
|
||||
Fn<void(ChannelData*)> callback);
|
||||
|
||||
object_ptr<BoxContent> EditLinkedChatBox(
|
||||
object_ptr<Ui::BoxContent> EditLinkedChatBox(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<ChannelData*> channel,
|
||||
std::vector<not_null<PeerData*>> &&chats,
|
||||
|
|
|
@ -15,6 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/buttons.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/text/text_utilities.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 "settings/settings_privacy_security.h"
|
||||
#include "boxes/calendar_box.h"
|
||||
#include "boxes/generic_box.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "boxes/passcode_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 "facades.h"
|
||||
#include "main/main_session.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
|
@ -53,7 +55,7 @@ enum class PasswordErrorType {
|
|||
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(
|
||||
) | rpl::start_with_next([=] {
|
||||
using namespace Settings;
|
||||
|
@ -71,7 +73,7 @@ void SetCloudPassword(not_null<GenericBox*> box, not_null<UserData*> user) {
|
|||
}
|
||||
|
||||
void TransferPasswordError(
|
||||
not_null<GenericBox*> box,
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<UserData*> user,
|
||||
PasswordErrorType error) {
|
||||
box->setTitle(tr::lng_rights_transfer_check());
|
||||
|
@ -299,7 +301,7 @@ void EditAdminBox::prepare() {
|
|||
: tr::lng_channel_add_admin());
|
||||
|
||||
addControl(
|
||||
object_ptr<BoxContentDivider>(this),
|
||||
object_ptr<Ui::BoxContentDivider>(this),
|
||||
st::rightsDividerMargin);
|
||||
|
||||
const auto chat = peer()->asChat();
|
||||
|
@ -404,7 +406,7 @@ void EditAdminBox::prepare() {
|
|||
|
||||
not_null<Ui::InputField*> EditAdminBox::addRankInput() {
|
||||
addControl(
|
||||
object_ptr<BoxContentDivider>(this),
|
||||
object_ptr<Ui::BoxContentDivider>(this),
|
||||
st::rightsRankMargin);
|
||||
|
||||
addControl(
|
||||
|
@ -474,7 +476,7 @@ not_null<Ui::SlideWrap<Ui::RpWidget>*> EditAdminBox::setupTransferButton(
|
|||
const auto container = wrap->entity();
|
||||
|
||||
container->add(
|
||||
object_ptr<BoxContentDivider>(container),
|
||||
object_ptr<Ui::BoxContentDivider>(container),
|
||||
{ 0, st::infoProfileSkip, 0, st::infoProfileSkip });
|
||||
container->add(EditPeerInfoBox::CreateButton(
|
||||
this,
|
||||
|
@ -664,7 +666,7 @@ void EditRestrictedBox::prepare() {
|
|||
setTitle(tr::lng_rights_user_restrictions());
|
||||
|
||||
addControl(
|
||||
object_ptr<BoxContentDivider>(this),
|
||||
object_ptr<Ui::BoxContentDivider>(this),
|
||||
st::rightsDividerMargin);
|
||||
|
||||
const auto chat = peer()->asChat();
|
||||
|
@ -708,7 +710,7 @@ void EditRestrictedBox::prepare() {
|
|||
addControl(std::move(checkboxes), QMargins());
|
||||
|
||||
_until = prepareRights.c_chatBannedRights().vuntil_date().v;
|
||||
addControl(object_ptr<BoxContentDivider>(this), st::rightsUntilMargin);
|
||||
addControl(object_ptr<Ui::BoxContentDivider>(this), st::rightsUntilMargin);
|
||||
addControl(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
|
@ -759,7 +761,7 @@ void EditRestrictedBox::showRestrictUntil() {
|
|||
setRestrictUntil(
|
||||
static_cast<int>(QDateTime(date).toTime_t()));
|
||||
}),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
_restrictUntilBox->setMaxDate(
|
||||
QDate::currentDate().addDays(kMaxRestrictDelayDays));
|
||||
_restrictUntilBox->setMinDate(tomorrow);
|
||||
|
|
|
@ -27,7 +27,7 @@ struct CloudPasswordResult;
|
|||
class CalendarBox;
|
||||
class PasscodeBox;
|
||||
|
||||
class EditParticipantBox : public BoxContent {
|
||||
class EditParticipantBox : public Ui::BoxContent {
|
||||
public:
|
||||
EditParticipantBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -874,7 +874,7 @@ void ParticipantsBoxController::Start(
|
|||
};
|
||||
Ui::show(
|
||||
Box<PeerListBox>(std::move(controller), initBox),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void ParticipantsBoxController::addNewItem() {
|
||||
|
@ -907,7 +907,7 @@ void ParticipantsBoxController::addNewItem() {
|
|||
adminDone,
|
||||
restrictedDone),
|
||||
initBox),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void ParticipantsBoxController::addNewParticipants() {
|
||||
|
@ -929,7 +929,7 @@ void ParticipantsBoxController::addNewParticipants() {
|
|||
channel,
|
||||
{ already.begin(), already.end() });
|
||||
} 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));
|
||||
}
|
||||
_editParticipantBox = Ui::show(std::move(box), LayerOption::KeepOther);
|
||||
_editParticipantBox = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void ParticipantsBoxController::editAdminDone(
|
||||
|
@ -1552,7 +1552,7 @@ void ParticipantsBoxController::showRestricted(not_null<UserData*> user) {
|
|||
box->setSaveCallback(
|
||||
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(
|
||||
|
@ -1618,7 +1618,7 @@ void ParticipantsBoxController::kickMember(not_null<UserData*> user) {
|
|||
text,
|
||||
tr::lng_box_remove(tr::now),
|
||||
crl::guard(this, [=] { kickMemberSure(user); })),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void ParticipantsBoxController::unkickMember(not_null<UserData*> user) {
|
||||
|
@ -1661,7 +1661,7 @@ void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) {
|
|||
user->firstName),
|
||||
tr::lng_box_remove(tr::now),
|
||||
crl::guard(this, [=] { removeAdminSure(user); })),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void ParticipantsBoxController::removeAdminSure(not_null<UserData*> user) {
|
||||
|
|
|
@ -244,9 +244,9 @@ private:
|
|||
bool _allLoaded = false;
|
||||
ParticipantsAdditionalData _additional;
|
||||
std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
|
||||
BoxPointer _editBox;
|
||||
BoxPointer _addBox;
|
||||
QPointer<BoxContent> _editParticipantBox;
|
||||
Ui::BoxPointer _editBox;
|
||||
Ui::BoxPointer _addBox;
|
||||
QPointer<Ui::BoxContent> _editParticipantBox;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_chat.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ enum class HistoryVisibility {
|
|||
Hidden,
|
||||
};
|
||||
|
||||
class EditPeerHistoryVisibilityBox : public BoxContent {
|
||||
class EditPeerHistoryVisibilityBox : public Ui::BoxContent {
|
||||
public:
|
||||
EditPeerHistoryVisibilityBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -31,14 +31,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwindow.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "observer_peer.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/box_content_divider.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.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 "app.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -70,7 +72,7 @@ void AddSkip(
|
|||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
top));
|
||||
container->add(object_ptr<BoxContentDivider>(container));
|
||||
container->add(object_ptr<Ui::BoxContentDivider>(container));
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
bottom));
|
||||
|
@ -193,7 +195,7 @@ void SaveSlowmodeSeconds(
|
|||
void ShowEditPermissions(not_null<PeerData*> peer) {
|
||||
const auto box = Ui::show(
|
||||
Box<EditPeerPermissionsBox>(peer),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
const auto saving = box->lifetime().make_state<int>(0);
|
||||
const auto save = [=](
|
||||
not_null<PeerData*> peer,
|
||||
|
@ -244,7 +246,7 @@ class Controller
|
|||
public:
|
||||
Controller(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<BoxContent*> box,
|
||||
not_null<Ui::BoxContent*> box,
|
||||
not_null<PeerData*> peer);
|
||||
|
||||
object_ptr<Ui::VerticalLayout> createContent();
|
||||
|
@ -330,7 +332,7 @@ private:
|
|||
std::optional<bool> _signaturesSavedValue;
|
||||
|
||||
const not_null<Window::SessionNavigation*> _navigation;
|
||||
const not_null<BoxContent*> _box;
|
||||
const not_null<Ui::BoxContent*> _box;
|
||||
not_null<PeerData*> _peer;
|
||||
const bool _isGroup = false;
|
||||
|
||||
|
@ -351,7 +353,7 @@ private:
|
|||
|
||||
Controller::Controller(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<BoxContent*> box,
|
||||
not_null<Ui::BoxContent*> box,
|
||||
not_null<PeerData*> peer)
|
||||
: _navigation(navigation)
|
||||
, _box(box)
|
||||
|
@ -559,7 +561,7 @@ object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
|
|||
tr::lng_group_stickers_add(tr::now),
|
||||
st::editPeerInviteLinkButton)
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<StickersBox>(channel), LayerOption::KeepOther);
|
||||
Ui::show(Box<StickersBox>(channel), Ui::LayerOption::KeepOther);
|
||||
});
|
||||
|
||||
return std::move(result);
|
||||
|
@ -602,13 +604,13 @@ void Controller::showEditPeerTypeBox(
|
|||
_privacySavedValue,
|
||||
_usernameSavedValue,
|
||||
error),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void Controller::showEditLinkedChatBox() {
|
||||
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 callback = [=](ChannelData *result) {
|
||||
if (*box) {
|
||||
|
@ -633,7 +635,7 @@ void Controller::showEditLinkedChatBox() {
|
|||
chat,
|
||||
canEdit,
|
||||
callback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
} else if (!canEdit || _linkedChatsRequestId) {
|
||||
return;
|
||||
|
@ -660,7 +662,7 @@ void Controller::showEditLinkedChatBox() {
|
|||
channel,
|
||||
std::move(chats),
|
||||
callback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}).fail([=](const RPCError &error) {
|
||||
_linkedChatsRequestId = 0;
|
||||
}).send();
|
||||
|
@ -749,7 +751,7 @@ void Controller::fillInviteLinkButton() {
|
|||
Expects(_controls.buttonsLayout != nullptr);
|
||||
|
||||
const auto buttonCallback = [=] {
|
||||
Ui::show(Box<EditPeerTypeBox>(_peer), LayerOption::KeepOther);
|
||||
Ui::show(Box<EditPeerTypeBox>(_peer), Ui::LayerOption::KeepOther);
|
||||
};
|
||||
|
||||
AddButtonWithText(
|
||||
|
@ -807,7 +809,7 @@ void Controller::fillHistoryVisibilityButton() {
|
|||
_peer,
|
||||
boxCallback,
|
||||
*_historyVisibilitySavedValue),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
};
|
||||
AddButtonWithText(
|
||||
container,
|
||||
|
@ -1429,7 +1431,7 @@ void Controller::deleteWithConfirmation() {
|
|||
tr::lng_box_delete(tr::now),
|
||||
st::attentionBoxButton,
|
||||
deleteCallback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void Controller::deleteChannel() {
|
||||
|
|
|
@ -28,7 +28,7 @@ class Button;
|
|||
} // namespace Profile
|
||||
} // namespace Info
|
||||
|
||||
class EditPeerInfoBox : public BoxContent {
|
||||
class EditPeerInfoBox : public Ui::BoxContent {
|
||||
public:
|
||||
EditPeerInfoBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/continuous_sliders.h"
|
||||
#include "ui/widgets/box_content_divider.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "info/profile/info_profile_button.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 "mainwindow.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
|
@ -387,7 +389,7 @@ Fn<int()> EditPeerPermissionsBox::addSlowmodeSlider(
|
|||
channel ? channel->slowmodeSeconds() : 0);
|
||||
|
||||
container->add(
|
||||
object_ptr<BoxContentDivider>(container),
|
||||
object_ptr<Ui::BoxContentDivider>(container),
|
||||
{ 0, st::infoProfileSkip, 0, st::infoProfileSkip });
|
||||
|
||||
container->add(
|
||||
|
|
|
@ -15,7 +15,7 @@ class RoundButton;
|
|||
class VerticalLayout;
|
||||
} // namespace Ui
|
||||
|
||||
class EditPeerPermissionsBox : public BoxContent {
|
||||
class EditPeerPermissionsBox : public Ui::BoxContent {
|
||||
public:
|
||||
EditPeerPermissionsBox(QWidget*, not_null<PeerData*> peer);
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwindow.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "observer_peer.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/special_buttons.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/input_fields.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/box_content_divider.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/special_fields.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/QClipboard>
|
||||
|
||||
#include <rpl/flatten_latest.h>
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr auto kUsernameCheckTimeout = crl::time(200);
|
||||
|
@ -189,7 +192,7 @@ void Controller::createContent() {
|
|||
|
||||
fillPrivaciesButtons(_wrap, _privacySavedValue);
|
||||
// Skip.
|
||||
_wrap->add(object_ptr<BoxContentDivider>(_wrap));
|
||||
_wrap->add(object_ptr<Ui::BoxContentDivider>(_wrap));
|
||||
//
|
||||
_wrap->add(createInviteLinkCreate());
|
||||
_wrap->add(createInviteLinkEdit());
|
||||
|
@ -471,7 +474,7 @@ void Controller::askUsernameRevoke() {
|
|||
Box<RevokePublicLinkBox>(
|
||||
&_peer->session(),
|
||||
std::move(revokeCallback)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void Controller::usernameChanged() {
|
||||
|
@ -553,7 +556,7 @@ void Controller::exportInviteLink(const QString &confirmation) {
|
|||
auto box = Box<ConfirmBox>(
|
||||
confirmation,
|
||||
std::move(callback));
|
||||
*boxPointer = Ui::show(std::move(box), LayerOption::KeepOther);
|
||||
*boxPointer = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
bool Controller::canEditInviteLink() const {
|
||||
|
|
|
@ -35,7 +35,7 @@ enum class UsernameState {
|
|||
NotAvailable,
|
||||
};
|
||||
|
||||
class EditPeerTypeBox : public BoxContent {
|
||||
class EditPeerTypeBox : public Ui::BoxContent {
|
||||
public:
|
||||
// Edit just the invite link.
|
||||
EditPeerTypeBox(QWidget*, not_null<PeerData*> peer);
|
||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
PhotoCropBox::PhotoCropBox(
|
||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "boxes/abstract_box.h"
|
||||
|
||||
class PhotoCropBox : public BoxContent {
|
||||
class PhotoCropBox : public Ui::BoxContent {
|
||||
public:
|
||||
PhotoCropBox(QWidget*, const QImage &img, const QString &title);
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/rate_call_box.h"
|
||||
|
||||
#include "lang/lang_keys.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_calls.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
|
@ -17,6 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwindow.h"
|
||||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_calls.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Main {
|
|||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class RateCallBox : public BoxContent, private MTP::Sender {
|
||||
class RateCallBox : public Ui::BoxContent, private MTP::Sender {
|
||||
public:
|
||||
RateCallBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "mainwindow.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_profile.h"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class Radioenum;
|
|||
class InputField;
|
||||
} // namespace Ui
|
||||
|
||||
class ReportBox : public BoxContent, public RPCSender {
|
||||
class ReportBox : public Ui::BoxContent, public RPCSender {
|
||||
public:
|
||||
ReportBox(QWidget*, not_null<PeerData*> peer);
|
||||
ReportBox(QWidget*, not_null<PeerData*> peer, MessageIdsList ids);
|
||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/labels.h"
|
||||
#include "apiwrap.h"
|
||||
#include "main/main_session.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
SelfDestructionBox::SelfDestructionBox(
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Main {
|
|||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class SelfDestructionBox : public BoxContent, private MTP::Sender {
|
||||
class SelfDestructionBox : public Ui::BoxContent, private MTP::Sender {
|
||||
public:
|
||||
SelfDestructionBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
||||
|
@ -1981,7 +1982,7 @@ void SendFilesBox::sendScheduled() {
|
|||
const auto callback = [=](Api::SendOptions options) { send(options); };
|
||||
Ui::show(
|
||||
HistoryView::PrepareScheduleBox(this, _sendMenuType, callback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
SendFilesBox::~SendFilesBox() = default;
|
||||
|
|
|
@ -48,7 +48,7 @@ enum class SendFilesWay {
|
|||
Files,
|
||||
};
|
||||
|
||||
class SendFilesBox : public BoxContent {
|
||||
class SendFilesBox : public Ui::BoxContent {
|
||||
public:
|
||||
enum class SendLimit {
|
||||
One,
|
||||
|
|
|
@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/labels.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
@ -320,7 +321,7 @@ void SessionsBox::terminateOne(uint64 hash) {
|
|||
tr::lng_settings_reset_button(tr::now),
|
||||
st::attentionBoxButton,
|
||||
callback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void SessionsBox::terminateAll() {
|
||||
|
@ -346,7 +347,7 @@ void SessionsBox::terminateAll() {
|
|||
tr::lng_settings_reset_button(tr::now),
|
||||
st::attentionBoxButton,
|
||||
callback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
SessionsBox::Inner::Inner(QWidget *parent)
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Main {
|
|||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class SessionsBox : public BoxContent, private MTP::Sender {
|
||||
class SessionsBox : public Ui::BoxContent, private MTP::Sender {
|
||||
public:
|
||||
SessionsBox(QWidget*, not_null<Main::Session*> session);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_folder.h"
|
||||
#include "main/main_session.h"
|
||||
#include "core/application.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_history.h"
|
||||
|
||||
|
@ -479,7 +480,7 @@ void ShareBox::submitScheduled() {
|
|||
const auto callback = [=](Api::SendOptions options) { submit(options); };
|
||||
Ui::show(
|
||||
HistoryView::PrepareScheduleBox(this, sendMenuType(), callback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void ShareBox::copyLink() {
|
||||
|
|
|
@ -52,7 +52,7 @@ void ShareGameScoreByHash(
|
|||
not_null<Main::Session*> session,
|
||||
const QString &hash);
|
||||
|
||||
class ShareBox : public BoxContent, public RPCSender {
|
||||
class ShareBox : public Ui::BoxContent, public RPCSender {
|
||||
public:
|
||||
using CopyCallback = Fn<void()>;
|
||||
using SubmitCallback = Fn<void(
|
||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
||||
SingleChoiceBox::SingleChoiceBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Ui {
|
|||
class Radiobutton;
|
||||
} // namespace Ui
|
||||
|
||||
class SingleChoiceBox : public BoxContent {
|
||||
class SingleChoiceBox : public Ui::BoxContent {
|
||||
public:
|
||||
SingleChoiceBox(
|
||||
QWidget*,
|
||||
|
|
|
@ -30,7 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
|
@ -136,14 +136,14 @@ StickerSetBox::StickerSetBox(
|
|||
, _set(set) {
|
||||
}
|
||||
|
||||
QPointer<BoxContent> StickerSetBox::Show(
|
||||
QPointer<Ui::BoxContent> StickerSetBox::Show(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<DocumentData*> document) {
|
||||
if (const auto sticker = document->sticker()) {
|
||||
if (sticker->set.type() != mtpc_inputStickerSetEmpty) {
|
||||
return Ui::show(
|
||||
Box<StickerSetBox>(controller, sticker->set),
|
||||
LayerOption::KeepOther).data();
|
||||
Ui::LayerOption::KeepOther).data();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -695,7 +695,7 @@ void StickerSetBox::Inner::install() {
|
|||
if (isMasksSet()) {
|
||||
Ui::show(
|
||||
Box<InformBox>(tr::lng_stickers_masks_pack(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
} else if (_installRequest) {
|
||||
return;
|
||||
|
|
|
@ -21,14 +21,14 @@ namespace Ui {
|
|||
class PlainShadow;
|
||||
} // namespace Ui
|
||||
|
||||
class StickerSetBox : public BoxContent, public RPCSender {
|
||||
class StickerSetBox : public Ui::BoxContent, public RPCSender {
|
||||
public:
|
||||
StickerSetBox(
|
||||
QWidget*,
|
||||
not_null<Window::SessionController*> controller,
|
||||
const MTPInputStickerSet &set);
|
||||
|
||||
static QPointer<BoxContent> Show(
|
||||
static QPointer<Ui::BoxContent> Show(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<DocumentData*> document);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_session.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
||||
|
@ -1302,7 +1303,7 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
|||
Box<StickerSetBox>(
|
||||
App::wnd()->sessionController(),
|
||||
Stickers::inputSetId(*set)),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
};
|
||||
if (selectedIndex >= 0 && !_inDragArea) {
|
||||
|
|
|
@ -26,6 +26,7 @@ class RippleAnimation;
|
|||
class SettingsSlider;
|
||||
class SlideAnimation;
|
||||
class CrossButton;
|
||||
class BoxContentDivider;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Main {
|
||||
|
@ -33,7 +34,7 @@ class Session;
|
|||
} // namespace Main
|
||||
|
||||
class StickersBox final
|
||||
: public BoxContent
|
||||
: public Ui::BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
|
@ -365,7 +366,7 @@ private:
|
|||
object_ptr<AddressField> _megagroupSetField = { nullptr };
|
||||
object_ptr<Ui::PlainShadow> _megagroupSelectedShadow = { nullptr };
|
||||
object_ptr<Ui::CrossButton> _megagroupSelectedRemove = { nullptr };
|
||||
object_ptr<BoxContentDivider> _megagroupDivider = { nullptr };
|
||||
object_ptr<Ui::BoxContentDivider> _megagroupDivider = { nullptr };
|
||||
object_ptr<Ui::FlatLabel> _megagroupSubTitle = { nullptr };
|
||||
base::Timer _megagroupSetAddressChangedTimer;
|
||||
mtpRequestId _megagroupSetRequestId = 0;
|
||||
|
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
void UrlAuthBox::Activate(
|
||||
|
@ -85,7 +86,7 @@ void UrlAuthBox::Request(
|
|||
const auto bot = request.is_request_write_access()
|
||||
? session->data().processUser(request.vbot()).get()
|
||||
: nullptr;
|
||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto finishWithUrl = [=](const QString &url) {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
|
@ -122,7 +123,7 @@ void UrlAuthBox::Request(
|
|||
};
|
||||
*box = Ui::show(
|
||||
Box<UrlAuthBox>(session, url, qs(request.vdomain()), bot, callback),
|
||||
LayerOption::KeepOther);
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
UrlAuthBox::UrlAuthBox(
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Main {
|
|||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class UrlAuthBox : public BoxContent {
|
||||
class UrlAuthBox : public Ui::BoxContent {
|
||||
public:
|
||||
static void Activate(
|
||||
not_null<const HistoryItem*> message,
|
||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_session.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Main {
|
|||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class UsernameBox : public BoxContent, public RPCSender {
|
||||
class UsernameBox : public Ui::BoxContent, public RPCSender {
|
||||
public:
|
||||
UsernameBox(QWidget*, not_null<Main::Session*> session);
|
||||
|
||||
|
|
|
@ -22,14 +22,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "layout.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_calls.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
||||
namespace Calls {
|
||||
namespace {
|
||||
|
||||
constexpr auto kUpdateDebugTimeoutMs = crl::time(500);
|
||||
|
||||
class DebugInfoBox : public BoxContent {
|
||||
class DebugInfoBox : public Ui::BoxContent {
|
||||
public:
|
||||
DebugInfoBox(QWidget*, base::weak_ptr<Call> call);
|
||||
|
||||
|
|