mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Allow showing boxes in passport panel.
This commit is contained in:
parent
f1519b76f6
commit
d0e854e9d8
32 changed files with 293 additions and 236 deletions
|
@ -1525,7 +1525,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_passport_policy" = "{bot} privacy policy";
|
"lng_passport_policy" = "{bot} privacy policy";
|
||||||
"lng_passport_authorize" = "Authorize";
|
"lng_passport_authorize" = "Authorize";
|
||||||
"lng_passport_form_error" = "Could not get authorization form.";
|
"lng_passport_form_error" = "Could not get authorization form.";
|
||||||
"lng_passport_save_value" = "Done";
|
"lng_passport_save_value" = "Save";
|
||||||
|
"lng_passport_saving" = "Saving...";
|
||||||
|
"lng_passport_uploading" = "Uploading...";
|
||||||
"lng_passport_upload_header" = "Scans";
|
"lng_passport_upload_header" = "Scans";
|
||||||
"lng_passport_scan_index" = "Scan {index}";
|
"lng_passport_scan_index" = "Scan {index}";
|
||||||
"lng_passport_upload_scans" = "Upload scans";
|
"lng_passport_upload_scans" = "Upload scans";
|
||||||
|
|
|
@ -227,8 +227,8 @@ void BoxContent::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractBox::AbstractBox(QWidget *parent, Window::Controller *controller, object_ptr<BoxContent> content) : LayerWidget(parent)
|
AbstractBox::AbstractBox(QWidget *parent, object_ptr<BoxContent> content)
|
||||||
, _controller(controller)
|
: LayerWidget(parent)
|
||||||
, _content(std::move(content)) {
|
, _content(std::move(content)) {
|
||||||
subscribe(Lang::Current().updated(), [this] { refreshLang(); });
|
subscribe(Lang::Current().updated(), [this] { refreshLang(); });
|
||||||
_content->setParent(this);
|
_content->setParent(this);
|
||||||
|
|
|
@ -23,14 +23,8 @@ class FlatLabel;
|
||||||
class FadeShadow;
|
class FadeShadow;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Window {
|
|
||||||
class Controller;
|
|
||||||
} // namespace Window
|
|
||||||
|
|
||||||
class BoxContentDelegate {
|
class BoxContentDelegate {
|
||||||
public:
|
public:
|
||||||
virtual Window::Controller *controller() const = 0;
|
|
||||||
|
|
||||||
virtual void setLayerType(bool layerType) = 0;
|
virtual void setLayerType(bool layerType) = 0;
|
||||||
virtual void setTitle(base::lambda<TextWithEntities()> titleFactory) = 0;
|
virtual void setTitle(base::lambda<TextWithEntities()> titleFactory) = 0;
|
||||||
virtual void setAdditionalTitle(base::lambda<QString()> additionalFactory) = 0;
|
virtual void setAdditionalTitle(base::lambda<QString()> additionalFactory) = 0;
|
||||||
|
@ -108,10 +102,6 @@ public:
|
||||||
finishPrepare();
|
finishPrepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::Controller *controller() {
|
|
||||||
return getDelegate()->controller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onScrollToY(int top, int bottom = -1);
|
void onScrollToY(int top, int bottom = -1);
|
||||||
|
|
||||||
|
@ -215,11 +205,8 @@ class AbstractBox
|
||||||
, public BoxContentDelegate
|
, public BoxContentDelegate
|
||||||
, protected base::Subscriber {
|
, protected base::Subscriber {
|
||||||
public:
|
public:
|
||||||
AbstractBox(QWidget *parent, Window::Controller *controller, object_ptr<BoxContent> content);
|
AbstractBox(QWidget *parent, object_ptr<BoxContent> content);
|
||||||
|
|
||||||
Window::Controller *controller() const override {
|
|
||||||
return _controller;
|
|
||||||
}
|
|
||||||
void parentResized() override;
|
void parentResized() override;
|
||||||
|
|
||||||
void setLayerType(bool layerType) override;
|
void setLayerType(bool layerType) override;
|
||||||
|
@ -275,7 +262,6 @@ private:
|
||||||
int countRealHeight() const;
|
int countRealHeight() const;
|
||||||
void updateSize();
|
void updateSize();
|
||||||
|
|
||||||
Window::Controller *_controller = nullptr;
|
|
||||||
int _fullHeight = 0;
|
int _fullHeight = 0;
|
||||||
|
|
||||||
bool _noContentMargin = false;
|
bool _noContentMargin = false;
|
||||||
|
|
|
@ -241,7 +241,7 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
if (_gifPreview && _gifPreview->started()) {
|
if (_gifPreview && _gifPreview->started()) {
|
||||||
auto s = QSize(_thumbw, _thumbh);
|
auto s = QSize(_thumbw, _thumbh);
|
||||||
auto paused = controller()->isGifPausedAtLeastFor(Window::GifPauseReason::Layer);
|
auto paused = _controller->isGifPausedAtLeastFor(Window::GifPauseReason::Layer);
|
||||||
auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, RectPart::None, paused ? 0 : getms());
|
auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, RectPart::None, paused ? 0 : getms());
|
||||||
p.drawPixmap(_thumbx, st::boxPhotoPadding.top(), frame);
|
p.drawPixmap(_thumbx, st::boxPhotoPadding.top(), frame);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,6 +21,10 @@ namespace Ui {
|
||||||
class InputField;
|
class InputField;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
class Controller;
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
class EditCaptionBox : public BoxContent, public RPCSender {
|
class EditCaptionBox : public BoxContent, public RPCSender {
|
||||||
public:
|
public:
|
||||||
EditCaptionBox(
|
EditCaptionBox(
|
||||||
|
|
|
@ -66,7 +66,6 @@ class EditParticipantBox::Inner : public TWidget {
|
||||||
public:
|
public:
|
||||||
Inner(
|
Inner(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
not_null<UserData*> user,
|
not_null<UserData*> user,
|
||||||
bool hasAdminRights);
|
bool hasAdminRights);
|
||||||
|
@ -101,7 +100,6 @@ private:
|
||||||
|
|
||||||
EditParticipantBox::Inner::Inner(
|
EditParticipantBox::Inner::Inner(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
not_null<UserData*> user,
|
not_null<UserData*> user,
|
||||||
bool hasAdminRights)
|
bool hasAdminRights)
|
||||||
|
@ -110,7 +108,6 @@ EditParticipantBox::Inner::Inner(
|
||||||
, _user(user)
|
, _user(user)
|
||||||
, _userPhoto(
|
, _userPhoto(
|
||||||
this,
|
this,
|
||||||
controller,
|
|
||||||
_user,
|
_user,
|
||||||
Ui::UserpicButton::Role::Custom,
|
Ui::UserpicButton::Role::Custom,
|
||||||
st::rightsPhotoButton)
|
st::rightsPhotoButton)
|
||||||
|
@ -184,7 +181,6 @@ EditParticipantBox::EditParticipantBox(QWidget*, not_null<ChannelData*> channel,
|
||||||
void EditParticipantBox::prepare() {
|
void EditParticipantBox::prepare() {
|
||||||
_inner = setInnerWidget(object_ptr<Inner>(
|
_inner = setInnerWidget(object_ptr<Inner>(
|
||||||
this,
|
this,
|
||||||
controller(),
|
|
||||||
_channel,
|
_channel,
|
||||||
_user,
|
_user,
|
||||||
hasAdminRights()));
|
hasAdminRights()));
|
||||||
|
|
|
@ -32,7 +32,6 @@ void MuteSettingsBox::prepare() {
|
||||||
|
|
||||||
const auto icon = object_ptr<Ui::UserpicButton>(
|
const auto icon = object_ptr<Ui::UserpicButton>(
|
||||||
this,
|
this,
|
||||||
controller(),
|
|
||||||
_peer,
|
_peer,
|
||||||
Ui::UserpicButton::Role::Custom,
|
Ui::UserpicButton::Role::Custom,
|
||||||
st::mutePhotoButton);
|
st::mutePhotoButton);
|
||||||
|
|
|
@ -277,7 +277,6 @@ object_ptr<Ui::RpWidget> Controller::createPhotoEdit() {
|
||||||
_wrap,
|
_wrap,
|
||||||
object_ptr<Ui::UserpicButton>(
|
object_ptr<Ui::UserpicButton>(
|
||||||
_wrap,
|
_wrap,
|
||||||
_box->controller(),
|
|
||||||
_peer,
|
_peer,
|
||||||
Ui::UserpicButton::Role::ChangePhoto,
|
Ui::UserpicButton::Role::ChangePhoto,
|
||||||
st::defaultUserpicButton),
|
st::defaultUserpicButton),
|
||||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "history/admin_log/history_admin_log_section.h"
|
#include "history/admin_log/history_admin_log_section.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
#include "profile/profile_channel_controllers.h"
|
#include "profile/profile_channel_controllers.h"
|
||||||
#include "info/profile/info_profile_button.h"
|
#include "info/profile/info_profile_button.h"
|
||||||
#include "info/profile/info_profile_icon.h"
|
#include "info/profile/info_profile_icon.h"
|
||||||
|
@ -88,9 +89,9 @@ bool HasRecentActions(not_null<ChannelData*> channel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowRecentActions(
|
void ShowRecentActions(
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Navigation*> navigation,
|
||||||
not_null<ChannelData*> channel) {
|
not_null<ChannelData*> channel) {
|
||||||
controller->showSection(AdminLog::SectionMemento(channel));
|
navigation->showSection(AdminLog::SectionMemento(channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasEditInfoBox(not_null<ChannelData*> channel) {
|
bool HasEditInfoBox(not_null<ChannelData*> channel) {
|
||||||
|
@ -104,7 +105,7 @@ bool HasEditInfoBox(not_null<ChannelData*> channel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillManageBox(
|
void FillManageBox(
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Navigation*> navigation,
|
||||||
not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
not_null<Ui::VerticalLayout*> content) {
|
not_null<Ui::VerticalLayout*> content) {
|
||||||
using Profile::ParticipantsBoxController;
|
using Profile::ParticipantsBoxController;
|
||||||
|
@ -123,7 +124,7 @@ void FillManageBox(
|
||||||
AddButton(
|
AddButton(
|
||||||
content,
|
content,
|
||||||
Lang::Viewer(lng_manage_peer_recent_actions),
|
Lang::Viewer(lng_manage_peer_recent_actions),
|
||||||
[=] { ShowRecentActions(controller, channel); },
|
[=] { ShowRecentActions(navigation, channel); },
|
||||||
st::infoIconRecentActions);
|
st::infoIconRecentActions);
|
||||||
}
|
}
|
||||||
if (channel->canViewMembers()) {
|
if (channel->canViewMembers()) {
|
||||||
|
@ -134,7 +135,7 @@ void FillManageBox(
|
||||||
| ToPositiveNumberString(),
|
| ToPositiveNumberString(),
|
||||||
[=] {
|
[=] {
|
||||||
ParticipantsBoxController::Start(
|
ParticipantsBoxController::Start(
|
||||||
controller,
|
navigation,
|
||||||
channel,
|
channel,
|
||||||
ParticipantsBoxController::Role::Members);
|
ParticipantsBoxController::Role::Members);
|
||||||
},
|
},
|
||||||
|
@ -148,7 +149,7 @@ void FillManageBox(
|
||||||
| ToPositiveNumberString(),
|
| ToPositiveNumberString(),
|
||||||
[=] {
|
[=] {
|
||||||
ParticipantsBoxController::Start(
|
ParticipantsBoxController::Start(
|
||||||
controller,
|
navigation,
|
||||||
channel,
|
channel,
|
||||||
ParticipantsBoxController::Role::Admins);
|
ParticipantsBoxController::Role::Admins);
|
||||||
},
|
},
|
||||||
|
@ -163,7 +164,7 @@ void FillManageBox(
|
||||||
| ToPositiveNumberString(),
|
| ToPositiveNumberString(),
|
||||||
[=] {
|
[=] {
|
||||||
ParticipantsBoxController::Start(
|
ParticipantsBoxController::Start(
|
||||||
controller,
|
navigation,
|
||||||
channel,
|
channel,
|
||||||
ParticipantsBoxController::Role::Restricted);
|
ParticipantsBoxController::Role::Restricted);
|
||||||
},
|
},
|
||||||
|
@ -176,7 +177,7 @@ void FillManageBox(
|
||||||
| ToPositiveNumberString(),
|
| ToPositiveNumberString(),
|
||||||
[=] {
|
[=] {
|
||||||
ParticipantsBoxController::Start(
|
ParticipantsBoxController::Start(
|
||||||
controller,
|
navigation,
|
||||||
channel,
|
channel,
|
||||||
ParticipantsBoxController::Role::Kicked);
|
ParticipantsBoxController::Role::Kicked);
|
||||||
},
|
},
|
||||||
|
@ -218,7 +219,7 @@ void ManagePeerBox::prepare() {
|
||||||
|
|
||||||
void ManagePeerBox::setupContent() {
|
void ManagePeerBox::setupContent() {
|
||||||
auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||||
FillManageBox(controller(), _channel, content);
|
FillManageBox(App::wnd()->controller(), _channel, content);
|
||||||
widthValue(
|
widthValue(
|
||||||
) | rpl::start_with_next([=](int width) {
|
) | rpl::start_with_next([=](int width) {
|
||||||
content->resizeToWidth(width);
|
content->resizeToWidth(width);
|
||||||
|
|
|
@ -1361,7 +1361,7 @@ void SendFilesBox::prepareSingleFilePreview() {
|
||||||
Expects(_list.files.size() == 1);
|
Expects(_list.files.size() == 1);
|
||||||
|
|
||||||
const auto &file = _list.files[0];
|
const auto &file = _list.files[0];
|
||||||
const auto media = SingleMediaPreview::Create(this, controller(), file);
|
const auto media = SingleMediaPreview::Create(this, _controller, file);
|
||||||
if (media) {
|
if (media) {
|
||||||
if (!media->canSendAsPhoto()) {
|
if (!media->canSendAsPhoto()) {
|
||||||
_compressConfirm = CompressConfirm::None;
|
_compressConfirm = CompressConfirm::None;
|
||||||
|
@ -1424,8 +1424,6 @@ void SendFilesBox::setupShadows(
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::prepare() {
|
void SendFilesBox::prepare() {
|
||||||
Expects(controller() != nullptr);
|
|
||||||
|
|
||||||
_send = addButton(langFactory(lng_send_button), [this] { send(); });
|
_send = addButton(langFactory(lng_send_button), [this] { send(); });
|
||||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||||
setupCaption();
|
setupCaption();
|
||||||
|
|
|
@ -26,6 +26,10 @@ class InputField;
|
||||||
struct GroupMediaLayout;
|
struct GroupMediaLayout;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
class Controller;
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
enum class SendFilesWay {
|
enum class SendFilesWay {
|
||||||
Album,
|
Album,
|
||||||
Photos,
|
Photos,
|
||||||
|
|
|
@ -4703,15 +4703,20 @@ void HistoryWidget::handleHistoryChange(not_null<const History*> history) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::grapWithoutTopBarShadow() {
|
QPixmap HistoryWidget::grabForShowAnimation(
|
||||||
grabStart();
|
const Window::SectionSlideParams ¶ms) {
|
||||||
_topShadow->hide();
|
if (params.withTopBarShadow) {
|
||||||
}
|
_topShadow->hide();
|
||||||
|
}
|
||||||
void HistoryWidget::grabFinish() {
|
_inGrab = true;
|
||||||
|
updateControlsGeometry();
|
||||||
|
auto result = Ui::GrabWidget(this);
|
||||||
_inGrab = false;
|
_inGrab = false;
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
_topShadow->show();
|
if (params.withTopBarShadow) {
|
||||||
|
_topShadow->show();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryWidget::skipItemRepaint() {
|
bool HistoryWidget::skipItemRepaint() {
|
||||||
|
@ -5894,7 +5899,10 @@ void HistoryWidget::editMessage(not_null<HistoryItem*> item) {
|
||||||
}
|
}
|
||||||
if (!_editMsgId) {
|
if (!_editMsgId) {
|
||||||
if (_replyToId || !_field->empty()) {
|
if (_replyToId || !_field->empty()) {
|
||||||
_history->setLocalDraft(std::make_unique<Data::Draft>(_field, _replyToId, _previewCancelled));
|
_history->setLocalDraft(std::make_unique<Data::Draft>(
|
||||||
|
_field,
|
||||||
|
_replyToId,
|
||||||
|
_previewCancelled));
|
||||||
} else {
|
} else {
|
||||||
_history->clearLocalDraft();
|
_history->clearLocalDraft();
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,12 +327,7 @@ public:
|
||||||
|
|
||||||
bool contentOverlapped(const QRect &globalRect);
|
bool contentOverlapped(const QRect &globalRect);
|
||||||
|
|
||||||
void grabStart() override {
|
QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms);
|
||||||
_inGrab = true;
|
|
||||||
updateControlsGeometry();
|
|
||||||
}
|
|
||||||
void grapWithoutTopBarShadow();
|
|
||||||
void grabFinish() override;
|
|
||||||
|
|
||||||
void forwardSelected();
|
void forwardSelected();
|
||||||
void confirmDeleteSelected();
|
void confirmDeleteSelected();
|
||||||
|
|
|
@ -2285,33 +2285,7 @@ Window::SectionSlideParams MainWidget::prepareShowAnimation(
|
||||||
} else if (_mainSection) {
|
} else if (_mainSection) {
|
||||||
result.oldContentCache = _mainSection->grabForShowAnimation(result);
|
result.oldContentCache = _mainSection->grabForShowAnimation(result);
|
||||||
} else {
|
} else {
|
||||||
if (result.withTopBarShadow) {
|
result.oldContentCache = _history->grabForShowAnimation(result);
|
||||||
_history->grapWithoutTopBarShadow();
|
|
||||||
} else {
|
|
||||||
_history->grabStart();
|
|
||||||
}
|
|
||||||
if (Adaptive::OneColumn()) {
|
|
||||||
result.oldContentCache = Ui::GrabWidget(this, QRect(
|
|
||||||
0,
|
|
||||||
sectionTop,
|
|
||||||
_dialogsWidth,
|
|
||||||
height() - sectionTop));
|
|
||||||
} else {
|
|
||||||
_sideShadow->hide();
|
|
||||||
if (_thirdShadow) {
|
|
||||||
_thirdShadow->hide();
|
|
||||||
}
|
|
||||||
result.oldContentCache = Ui::GrabWidget(this, QRect(
|
|
||||||
_dialogsWidth,
|
|
||||||
sectionTop,
|
|
||||||
width() - _dialogsWidth,
|
|
||||||
height() - sectionTop));
|
|
||||||
_sideShadow->show();
|
|
||||||
if (_thirdShadow) {
|
|
||||||
_thirdShadow->show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_history->grabFinish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerVolumeVisible) {
|
if (playerVolumeVisible) {
|
||||||
|
|
|
@ -301,17 +301,17 @@ void MainWindow::showSpecialLayer(
|
||||||
|
|
||||||
if (layer) {
|
if (layer) {
|
||||||
ensureLayerCreated();
|
ensureLayerCreated();
|
||||||
_layerBg->showSpecialLayer(std::move(layer), animated);
|
_layer->showSpecialLayer(std::move(layer), animated);
|
||||||
} else if (_layerBg) {
|
} else if (_layer) {
|
||||||
_layerBg->hideSpecialLayer(animated);
|
_layer->hideSpecialLayer(animated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::showSectionInExistingLayer(
|
bool MainWindow::showSectionInExistingLayer(
|
||||||
not_null<Window::SectionMemento*> memento,
|
not_null<Window::SectionMemento*> memento,
|
||||||
const Window::SectionShow ¶ms) {
|
const Window::SectionShow ¶ms) {
|
||||||
if (_layerBg) {
|
if (_layer) {
|
||||||
return _layerBg->showSectionInternal(memento, params);
|
return _layer->showSectionInternal(memento, params);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -322,12 +322,16 @@ void MainWindow::showMainMenu() {
|
||||||
if (isHidden()) showFromTray();
|
if (isHidden()) showFromTray();
|
||||||
|
|
||||||
ensureLayerCreated();
|
ensureLayerCreated();
|
||||||
_layerBg->showMainMenu(anim::type::normal);
|
_layer->showMainMenu(controller(), anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ensureLayerCreated() {
|
void MainWindow::ensureLayerCreated() {
|
||||||
if (!_layerBg) {
|
if (!_layer) {
|
||||||
_layerBg.create(bodyWidget(), controller());
|
_layer.create(bodyWidget());
|
||||||
|
_layer->hideFinishEvents(
|
||||||
|
) | rpl::start_with_next([=, pointer = _layer.data()] {
|
||||||
|
layerHidden(pointer);
|
||||||
|
}, _layer->lifetime());
|
||||||
if (controller()) {
|
if (controller()) {
|
||||||
controller()->enableGifPauseReason(Window::GifPauseReason::Layer);
|
controller()->enableGifPauseReason(Window::GifPauseReason::Layer);
|
||||||
}
|
}
|
||||||
|
@ -335,8 +339,8 @@ void MainWindow::ensureLayerCreated() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::destroyLayerDelayed() {
|
void MainWindow::destroyLayerDelayed() {
|
||||||
if (_layerBg) {
|
if (_layer) {
|
||||||
_layerBg.destroyDelayed();
|
_layer.destroyDelayed();
|
||||||
if (controller()) {
|
if (controller()) {
|
||||||
controller()->disableGifPauseReason(Window::GifPauseReason::Layer);
|
controller()->disableGifPauseReason(Window::GifPauseReason::Layer);
|
||||||
}
|
}
|
||||||
|
@ -344,8 +348,8 @@ void MainWindow::destroyLayerDelayed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ui_hideSettingsAndLayer(anim::type animated) {
|
void MainWindow::ui_hideSettingsAndLayer(anim::type animated) {
|
||||||
if (_layerBg) {
|
if (_layer) {
|
||||||
_layerBg->hideAll(animated);
|
_layer->hideAll(animated);
|
||||||
if (animated == anim::type::instant) {
|
if (animated == anim::type::instant) {
|
||||||
destroyLayerDelayed();
|
destroyLayerDelayed();
|
||||||
}
|
}
|
||||||
|
@ -366,21 +370,13 @@ void MainWindow::ui_showBox(
|
||||||
anim::type animated) {
|
anim::type animated) {
|
||||||
if (box) {
|
if (box) {
|
||||||
ensureLayerCreated();
|
ensureLayerCreated();
|
||||||
if (options & LayerOption::KeepOther) {
|
_layer->showBox(std::move(box), options, animated);
|
||||||
if (options & LayerOption::ShowAfterOther) {
|
|
||||||
_layerBg->prependBox(std::move(box), animated);
|
|
||||||
} else {
|
|
||||||
_layerBg->appendBox(std::move(box), animated);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_layerBg->showBox(std::move(box), animated);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (_layerBg) {
|
if (_layer) {
|
||||||
_layerBg->hideTopLayer(animated);
|
_layer->hideTopLayer(animated);
|
||||||
if ((animated == anim::type::instant)
|
if ((animated == anim::type::instant)
|
||||||
&& _layerBg
|
&& _layer
|
||||||
&& !_layerBg->layerShown()) {
|
&& !_layer->layerShown()) {
|
||||||
destroyLayerDelayed();
|
destroyLayerDelayed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,7 +385,7 @@ void MainWindow::ui_showBox(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::ui_isLayerShown() {
|
bool MainWindow::ui_isLayerShown() {
|
||||||
return _layerBg != nullptr;
|
return _layer != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ui_showMediaPreview(DocumentData *document) {
|
void MainWindow::ui_showMediaPreview(DocumentData *document) {
|
||||||
|
@ -476,15 +472,15 @@ void MainWindow::checkHistoryActivation() {
|
||||||
|
|
||||||
bool MainWindow::contentOverlapped(const QRect &globalRect) {
|
bool MainWindow::contentOverlapped(const QRect &globalRect) {
|
||||||
if (_main && _main->contentOverlapped(globalRect)) return true;
|
if (_main && _main->contentOverlapped(globalRect)) return true;
|
||||||
if (_layerBg && _layerBg->contentOverlapped(globalRect)) return true;
|
if (_layer && _layer->contentOverlapped(globalRect)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setInnerFocus() {
|
void MainWindow::setInnerFocus() {
|
||||||
if (_testingThemeWarning) {
|
if (_testingThemeWarning) {
|
||||||
_testingThemeWarning->setFocus();
|
_testingThemeWarning->setFocus();
|
||||||
} else if (_layerBg && _layerBg->canSetFocus()) {
|
} else if (_layer && _layer->canSetFocus()) {
|
||||||
_layerBg->setInnerFocus();
|
_layer->setInnerFocus();
|
||||||
} else if (_passcode) {
|
} else if (_passcode) {
|
||||||
_passcode->setInnerFocus();
|
_passcode->setInnerFocus();
|
||||||
} else if (_main) {
|
} else if (_main) {
|
||||||
|
@ -641,34 +637,25 @@ void MainWindow::noIntro(Intro::Widget *was) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::noLayerStack(Window::LayerStackWidget *was) {
|
void MainWindow::layerHidden(not_null<Window::LayerStackWidget*> layer) {
|
||||||
if (was == _layerBg) {
|
if (_layer != layer) {
|
||||||
_layerBg = nullptr;
|
return;
|
||||||
if (controller()) {
|
|
||||||
controller()->disableGifPauseReason(
|
|
||||||
Window::GifPauseReason::Layer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::layerFinishedHide(Window::LayerStackWidget *was) {
|
|
||||||
if (was == _layerBg) {
|
|
||||||
auto resetFocus = Ui::InFocusChain(was);
|
|
||||||
if (resetFocus) setFocus();
|
|
||||||
destroyLayerDelayed();
|
|
||||||
if (resetFocus) setInnerFocus();
|
|
||||||
InvokeQueued(this, [this] {
|
|
||||||
checkHistoryActivation();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
auto resetFocus = Ui::InFocusChain(layer);
|
||||||
|
if (resetFocus) setFocus();
|
||||||
|
destroyLayerDelayed();
|
||||||
|
if (resetFocus) setInnerFocus();
|
||||||
|
InvokeQueued(this, [this] {
|
||||||
|
checkHistoryActivation();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::takeThirdSectionFromLayer() {
|
bool MainWindow::takeThirdSectionFromLayer() {
|
||||||
return _layerBg ? _layerBg->takeToThirdSection() : false;
|
return _layer ? _layer->takeToThirdSection() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::fixOrder() {
|
void MainWindow::fixOrder() {
|
||||||
if (_layerBg) _layerBg->raise();
|
if (_layer) _layer->raise();
|
||||||
if (_mediaPreview) _mediaPreview->raise();
|
if (_mediaPreview) _mediaPreview->raise();
|
||||||
if (_testingThemeWarning) _testingThemeWarning->raise();
|
if (_testingThemeWarning) _testingThemeWarning->raise();
|
||||||
}
|
}
|
||||||
|
@ -759,7 +746,7 @@ void MainWindow::updateControlsGeometry() {
|
||||||
if (_passcode) _passcode->setGeometry(body);
|
if (_passcode) _passcode->setGeometry(body);
|
||||||
if (_main) _main->setGeometry(body);
|
if (_main) _main->setGeometry(body);
|
||||||
if (_intro) _intro->setGeometry(body);
|
if (_intro) _intro->setGeometry(body);
|
||||||
if (_layerBg) _layerBg->setGeometry(body);
|
if (_layer) _layer->setGeometry(body);
|
||||||
if (_mediaPreview) _mediaPreview->setGeometry(body);
|
if (_mediaPreview) _mediaPreview->setGeometry(body);
|
||||||
if (_testingThemeWarning) _testingThemeWarning->setGeometry(body);
|
if (_testingThemeWarning) _testingThemeWarning->setGeometry(body);
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,7 @@ public:
|
||||||
void activate();
|
void activate();
|
||||||
|
|
||||||
void noIntro(Intro::Widget *was);
|
void noIntro(Intro::Widget *was);
|
||||||
void noLayerStack(Window::LayerStackWidget *was);
|
void layerHidden(not_null<Window::LayerStackWidget*> layer);
|
||||||
void layerFinishedHide(Window::LayerStackWidget *was);
|
|
||||||
bool takeThirdSectionFromLayer();
|
bool takeThirdSectionFromLayer();
|
||||||
|
|
||||||
void checkHistoryActivation();
|
void checkHistoryActivation();
|
||||||
|
@ -177,7 +176,7 @@ private:
|
||||||
object_ptr<PasscodeWidget> _passcode = { nullptr };
|
object_ptr<PasscodeWidget> _passcode = { nullptr };
|
||||||
object_ptr<Intro::Widget> _intro = { nullptr };
|
object_ptr<Intro::Widget> _intro = { nullptr };
|
||||||
object_ptr<MainWidget> _main = { nullptr };
|
object_ptr<MainWidget> _main = { nullptr };
|
||||||
object_ptr<Window::LayerStackWidget> _layerBg = { nullptr };
|
object_ptr<Window::LayerStackWidget> _layer = { nullptr };
|
||||||
object_ptr<MediaPreviewWidget> _mediaPreview = { nullptr };
|
object_ptr<MediaPreviewWidget> _mediaPreview = { nullptr };
|
||||||
|
|
||||||
object_ptr<Window::Theme::WarningWidget> _testingThemeWarning = { nullptr };
|
object_ptr<Window::Theme::WarningWidget> _testingThemeWarning = { nullptr };
|
||||||
|
|
|
@ -75,6 +75,23 @@ void Controller::handleSeekFinished(float64 progress) {
|
||||||
refreshTimeTexts();
|
refreshTimeTexts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Callback>
|
||||||
|
void Controller::startFading(Callback start) {
|
||||||
|
if (!_fadeAnimation->animating()) {
|
||||||
|
showChildren();
|
||||||
|
_playbackSlider->hide();
|
||||||
|
_childrenHidden = false;
|
||||||
|
}
|
||||||
|
start();
|
||||||
|
if (_fadeAnimation->animating()) {
|
||||||
|
hideChildren();
|
||||||
|
_childrenHidden = true;
|
||||||
|
} else {
|
||||||
|
fadeFinished();
|
||||||
|
}
|
||||||
|
_playbackSlider->show();
|
||||||
|
}
|
||||||
|
|
||||||
void Controller::showAnimated() {
|
void Controller::showAnimated() {
|
||||||
startFading([this]() {
|
startFading([this]() {
|
||||||
_fadeAnimation->fadeIn(st::mediaviewShowDuration);
|
_fadeAnimation->fadeIn(st::mediaviewShowDuration);
|
||||||
|
@ -87,14 +104,8 @@ void Controller::hideAnimated() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Callback>
|
|
||||||
void Controller::startFading(Callback start) {
|
|
||||||
start();
|
|
||||||
_playbackSlider->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Controller::fadeFinished() {
|
void Controller::fadeFinished() {
|
||||||
fadeUpdated(1.);
|
fadeUpdated(_fadeAnimation->visible() ? 1. : 0.);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::fadeUpdated(float64 opacity) {
|
void Controller::fadeUpdated(float64 opacity) {
|
||||||
|
@ -160,7 +171,9 @@ void Controller::refreshTimeTexts() {
|
||||||
_toPlayLeft->setText(timeLeft, &leftChanged);
|
_toPlayLeft->setText(timeLeft, &leftChanged);
|
||||||
if (alreadyChanged || leftChanged) {
|
if (alreadyChanged || leftChanged) {
|
||||||
resizeEvent(nullptr);
|
resizeEvent(nullptr);
|
||||||
_fadeAnimation->refreshCache();
|
startFading([this]() {
|
||||||
|
_fadeAnimation->refreshCache();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,16 +186,6 @@ void Controller::setInFullScreen(bool inFullScreen) {
|
||||||
connect(_fullScreenToggle, SIGNAL(clicked()), this, handler);
|
connect(_fullScreenToggle, SIGNAL(clicked()), this, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::grabStart() {
|
|
||||||
showChildren();
|
|
||||||
_playbackSlider->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Controller::grabFinish() {
|
|
||||||
hideChildren();
|
|
||||||
_playbackSlider->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Controller::resizeEvent(QResizeEvent *e) {
|
void Controller::resizeEvent(QResizeEvent *e) {
|
||||||
int playTop = (height() - _playPauseResume->height()) / 2;
|
int playTop = (height() - _playPauseResume->height()) / 2;
|
||||||
_playPauseResume->moveToLeft(st::mediaviewPlayPauseLeft, playTop);
|
_playPauseResume->moveToLeft(st::mediaviewPlayPauseLeft, playTop);
|
||||||
|
@ -206,7 +209,11 @@ void Controller::paintEvent(QPaintEvent *e) {
|
||||||
if (_fadeAnimation->paint(p)) {
|
if (_fadeAnimation->paint(p)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (_childrenHidden) {
|
||||||
|
showChildren();
|
||||||
|
_playbackSlider->setFadeOpacity(1.);
|
||||||
|
_childrenHidden = false;
|
||||||
|
}
|
||||||
App::roundRect(p, rect(), st::mediaviewSaveMsgBg, MediaviewSaveCorners);
|
App::roundRect(p, rect(), st::mediaviewSaveMsgBg, MediaviewSaveCorners);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,6 @@ public:
|
||||||
void updatePlayback(const Player::TrackState &state);
|
void updatePlayback(const Player::TrackState &state);
|
||||||
void setInFullScreen(bool inFullScreen);
|
void setInFullScreen(bool inFullScreen);
|
||||||
|
|
||||||
void grabStart() override;
|
|
||||||
void grabFinish() override;
|
|
||||||
|
|
||||||
~Controller();
|
~Controller();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -69,6 +66,7 @@ private:
|
||||||
void refreshTimeTexts();
|
void refreshTimeTexts();
|
||||||
|
|
||||||
bool _showPause = false;
|
bool _showPause = false;
|
||||||
|
bool _childrenHidden = false;
|
||||||
QString _timeAlready, _timeLeft;
|
QString _timeAlready, _timeLeft;
|
||||||
TimeMs _seekPositionMs = -1;
|
TimeMs _seekPositionMs = -1;
|
||||||
TimeMs _lastDurationMs = 0;
|
TimeMs _lastDurationMs = 0;
|
||||||
|
|
|
@ -716,9 +716,9 @@ void FormController::sendSaveRequest(
|
||||||
data.vfiles.v,
|
data.vfiles.v,
|
||||||
base::take(value->filesInEdit));
|
base::take(value->filesInEdit));
|
||||||
|
|
||||||
Ui::show(Box<InformBox>("Saved"), LayerOption::KeepOther);
|
_view->show(Box<InformBox>("Saved"));
|
||||||
}).fail([=](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
Ui::show(Box<InformBox>("Error saving value"));
|
_view->show(Box<InformBox>("Error saving value:\n" + error.type()));
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,18 @@ public:
|
||||||
virtual void showPasswordUnconfirmed() = 0;
|
virtual void showPasswordUnconfirmed() = 0;
|
||||||
virtual void editScope(int index) = 0;
|
virtual void editScope(int index) = 0;
|
||||||
|
|
||||||
|
virtual void showBox(object_ptr<BoxContent> box) = 0;
|
||||||
|
|
||||||
virtual ~ViewController() {
|
virtual ~ViewController() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename BoxType>
|
||||||
|
QPointer<BoxType> show(object_ptr<BoxType> content) {
|
||||||
|
auto result = QPointer<BoxType>(content.data());
|
||||||
|
showBox(std::move(content));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Passport
|
} // namespace Passport
|
||||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/wrap/fade_wrap.h"
|
#include "ui/wrap/fade_wrap.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "window/layer_widget.h"
|
||||||
#include "messenger.h"
|
#include "messenger.h"
|
||||||
#include "styles/style_passport.h"
|
#include "styles/style_passport.h"
|
||||||
#include "styles/style_widgets.h"
|
#include "styles/style_widgets.h"
|
||||||
|
@ -32,7 +33,8 @@ Panel::Panel(not_null<PanelController*> controller)
|
||||||
lang(lng_passport_title),
|
lang(lng_passport_title),
|
||||||
Ui::FlatLabel::InitType::Simple,
|
Ui::FlatLabel::InitType::Simple,
|
||||||
st::passportPanelTitle)
|
st::passportPanelTitle)
|
||||||
, _back(this, object_ptr<Ui::IconButton>(this, st::passportPanelBack)) {
|
, _back(this, object_ptr<Ui::IconButton>(this, st::passportPanelBack))
|
||||||
|
, _body(this) {
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setWindowIcon(Window::CreateIcon());
|
setWindowIcon(Window::CreateIcon());
|
||||||
initControls();
|
initControls();
|
||||||
|
@ -209,42 +211,78 @@ void Panel::hideAndDestroy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::showAskPassword() {
|
void Panel::showAskPassword() {
|
||||||
showInner(base::make_unique_q<PanelAskPassword>(this, _controller));
|
showInner(base::make_unique_q<PanelAskPassword>(_body, _controller));
|
||||||
|
setBackAllowed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::showNoPassword() {
|
void Panel::showNoPassword() {
|
||||||
showInner(base::make_unique_q<PanelNoPassword>(this, _controller));
|
showInner(base::make_unique_q<PanelNoPassword>(_body, _controller));
|
||||||
|
setBackAllowed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::showPasswordUnconfirmed() {
|
void Panel::showPasswordUnconfirmed() {
|
||||||
showInner(base::make_unique_q<PanelPasswordUnconfirmed>(this, _controller));
|
showInner(
|
||||||
|
base::make_unique_q<PanelPasswordUnconfirmed>(_body, _controller));
|
||||||
|
setBackAllowed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::showForm() {
|
void Panel::showForm() {
|
||||||
showInner(base::make_unique_q<PanelForm>(this, _controller));
|
showInner(base::make_unique_q<PanelForm>(_body, _controller));
|
||||||
|
setBackAllowed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::showEditValue(object_ptr<Ui::RpWidget> from) {
|
void Panel::showEditValue(object_ptr<Ui::RpWidget> from) {
|
||||||
showInner(base::unique_qptr<Ui::RpWidget>(from.data()));
|
showInner(base::unique_qptr<Ui::RpWidget>(from.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Panel::showBox(object_ptr<BoxContent> box) {
|
||||||
|
ensureLayerCreated();
|
||||||
|
_layer->showBox(
|
||||||
|
std::move(box),
|
||||||
|
LayerOption::KeepOther,
|
||||||
|
anim::type::normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Panel::ensureLayerCreated() {
|
||||||
|
if (_layer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_layer.create(_body);
|
||||||
|
_layer->move(0, 0);
|
||||||
|
_body->sizeValue(
|
||||||
|
) | rpl::start_with_next([=](QSize size) {
|
||||||
|
_layer->resize(size);
|
||||||
|
}, _layer->lifetime());
|
||||||
|
_layer->hideFinishEvents(
|
||||||
|
) | rpl::start_with_next([=, pointer = _layer.data()]{
|
||||||
|
if (_layer != pointer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto saved = std::exchange(_layer, nullptr);
|
||||||
|
if (Ui::InFocusChain(saved)) {
|
||||||
|
setFocus();
|
||||||
|
}
|
||||||
|
saved.destroyDelayed();
|
||||||
|
}, _layer->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
void Panel::showInner(base::unique_qptr<Ui::RpWidget> inner) {
|
void Panel::showInner(base::unique_qptr<Ui::RpWidget> inner) {
|
||||||
_inner = std::move(inner);
|
_inner = std::move(inner);
|
||||||
_inner->setParent(this);
|
_inner->setParent(_body);
|
||||||
|
_inner->move(0, 0);
|
||||||
|
_body->sizeValue(
|
||||||
|
) | rpl::start_with_next([=](QSize size) {
|
||||||
|
_inner->resize(size);
|
||||||
|
}, _inner->lifetime());
|
||||||
_inner->show();
|
_inner->show();
|
||||||
|
|
||||||
sizeValue(
|
|
||||||
) | rpl::start_with_next([=] {
|
|
||||||
const auto top = _padding.top() + st::passportPanelTitleHeight;
|
|
||||||
_inner->setGeometry(
|
|
||||||
_padding.left(),
|
|
||||||
top,
|
|
||||||
width() - _padding.left() - _padding.right(),
|
|
||||||
height() - top - _padding.bottom());
|
|
||||||
}, _inner->lifetime());
|
|
||||||
|
|
||||||
showAndActivate();
|
showAndActivate();
|
||||||
if (!_inner->isHidden()) {
|
}
|
||||||
|
|
||||||
|
void Panel::focusInEvent(QFocusEvent *e) {
|
||||||
|
if (_layer) {
|
||||||
|
_layer->setInnerFocus();
|
||||||
|
} else if (!_inner->isHidden()) {
|
||||||
_inner->setFocus();
|
_inner->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,6 +309,12 @@ void Panel::resizeEvent(QResizeEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::updateControlsGeometry() {
|
void Panel::updateControlsGeometry() {
|
||||||
|
const auto top = _padding.top() + st::passportPanelTitleHeight;
|
||||||
|
_body->setGeometry(
|
||||||
|
_padding.left(),
|
||||||
|
top,
|
||||||
|
width() - _padding.left() - _padding.right(),
|
||||||
|
height() - top - _padding.bottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::paintEvent(QPaintEvent *e) {
|
void Panel::paintEvent(QPaintEvent *e) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class IconButton;
|
class IconButton;
|
||||||
|
@ -16,6 +17,10 @@ template <typename Widget>
|
||||||
class FadeWrapScaled;
|
class FadeWrapScaled;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
class LayerStackWidget;
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
namespace Passport {
|
namespace Passport {
|
||||||
|
|
||||||
class PanelController;
|
class PanelController;
|
||||||
|
@ -35,6 +40,7 @@ public:
|
||||||
void showPasswordUnconfirmed();
|
void showPasswordUnconfirmed();
|
||||||
void showForm();
|
void showForm();
|
||||||
void showEditValue(object_ptr<Ui::RpWidget> form);
|
void showEditValue(object_ptr<Ui::RpWidget> form);
|
||||||
|
void showBox(object_ptr<BoxContent> box);
|
||||||
|
|
||||||
rpl::producer<> backRequests() const;
|
rpl::producer<> backRequests() const;
|
||||||
void setBackAllowed(bool allowed);
|
void setBackAllowed(bool allowed);
|
||||||
|
@ -43,6 +49,7 @@ protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void closeEvent(QCloseEvent *e) override;
|
void closeEvent(QCloseEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void focusInEvent(QFocusEvent *e) override;
|
||||||
void mousePressEvent(QMouseEvent *e) override;
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *e) override;
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
void mouseMoveEvent(QMouseEvent *e) override;
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
@ -59,6 +66,7 @@ private:
|
||||||
void createBorderImage();
|
void createBorderImage();
|
||||||
void opacityCallback();
|
void opacityCallback();
|
||||||
void showInner(base::unique_qptr<Ui::RpWidget> inner);
|
void showInner(base::unique_qptr<Ui::RpWidget> inner);
|
||||||
|
void ensureLayerCreated();
|
||||||
|
|
||||||
void updateTitlePosition();
|
void updateTitlePosition();
|
||||||
void paintShadowBorder(Painter &p) const;
|
void paintShadowBorder(Painter &p) const;
|
||||||
|
@ -72,7 +80,9 @@ private:
|
||||||
object_ptr<Ui::IconButton> _close;
|
object_ptr<Ui::IconButton> _close;
|
||||||
object_ptr<Ui::FlatLabel> _title;
|
object_ptr<Ui::FlatLabel> _title;
|
||||||
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _back;
|
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _back;
|
||||||
|
object_ptr<Ui::RpWidget> _body;
|
||||||
base::unique_qptr<Ui::RpWidget> _inner;
|
base::unique_qptr<Ui::RpWidget> _inner;
|
||||||
|
object_ptr<Window::LayerStackWidget> _layer = { nullptr };
|
||||||
|
|
||||||
bool _useTransparency = true;
|
bool _useTransparency = true;
|
||||||
style::margins _padding;
|
style::margins _padding;
|
||||||
|
|
|
@ -450,7 +450,6 @@ void PanelController::editScope(int index) {
|
||||||
_panel->backRequests(
|
_panel->backRequests(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
cancelValueEdit(index);
|
cancelValueEdit(index);
|
||||||
_panel->setBackAllowed(false);
|
|
||||||
_panel->showForm();
|
_panel->showForm();
|
||||||
}, content->lifetime());
|
}, content->lifetime());
|
||||||
_panel->showEditValue(std::move(content));
|
_panel->showEditValue(std::move(content));
|
||||||
|
@ -497,6 +496,10 @@ void PanelController::cancelAuth() {
|
||||||
_form->cancel();
|
_form->cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PanelController::showBox(object_ptr<BoxContent> box) {
|
||||||
|
_panel->showBox(std::move(box));
|
||||||
|
}
|
||||||
|
|
||||||
rpl::lifetime &PanelController::lifetime() {
|
rpl::lifetime &PanelController::lifetime() {
|
||||||
return _lifetime;
|
return _lifetime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,8 @@ public:
|
||||||
void editScope(int index) override;
|
void editScope(int index) override;
|
||||||
void saveScope(ValueMap &&data, ValueMap &&filesData);
|
void saveScope(ValueMap &&data, ValueMap &&filesData);
|
||||||
|
|
||||||
|
void showBox(object_ptr<BoxContent> box) override;
|
||||||
|
|
||||||
void cancelAuth();
|
void cancelAuth();
|
||||||
|
|
||||||
rpl::lifetime &lifetime();
|
rpl::lifetime &lifetime();
|
||||||
|
|
|
@ -22,6 +22,7 @@ FadeAnimation::FadeAnimation(TWidget *widget, float64 scale)
|
||||||
bool FadeAnimation::paint(Painter &p) {
|
bool FadeAnimation::paint(Painter &p) {
|
||||||
if (_cache.isNull()) return false;
|
if (_cache.isNull()) return false;
|
||||||
|
|
||||||
|
const auto cache = _cache;
|
||||||
auto opacity = _animation.current(getms(), _visible ? 1. : 0.);
|
auto opacity = _animation.current(getms(), _visible ? 1. : 0.);
|
||||||
p.setOpacity(opacity);
|
p.setOpacity(opacity);
|
||||||
if (_scale < 1.) {
|
if (_scale < 1.) {
|
||||||
|
@ -45,9 +46,9 @@ bool FadeAnimation::paint(Painter &p) {
|
||||||
shownHeight,
|
shownHeight,
|
||||||
shownWidth,
|
shownWidth,
|
||||||
shownHeight);
|
shownHeight);
|
||||||
p.drawPixmap(targetRect.marginsAdded(margins), _cache);
|
p.drawPixmap(targetRect.marginsAdded(margins), cache);
|
||||||
} else {
|
} else {
|
||||||
p.drawPixmap(0, 0, _cache);
|
p.drawPixmap(0, 0, cache);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -94,10 +95,7 @@ void FadeAnimation::setUpdatedCallback(UpdatedCallback &&callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeAnimation::show() {
|
void FadeAnimation::show() {
|
||||||
if (!_visible) {
|
_visible = true;
|
||||||
_visible = true;
|
|
||||||
_widget->showChildren();
|
|
||||||
}
|
|
||||||
stopAnimation();
|
stopAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,9 +108,6 @@ void FadeAnimation::stopAnimation() {
|
||||||
_animation.finish();
|
_animation.finish();
|
||||||
if (!_cache.isNull()) {
|
if (!_cache.isNull()) {
|
||||||
_cache = QPixmap();
|
_cache = QPixmap();
|
||||||
if (_visible) {
|
|
||||||
_widget->showChildren();
|
|
||||||
}
|
|
||||||
if (_finishedCallback) {
|
if (_finishedCallback) {
|
||||||
_finishedCallback();
|
_finishedCallback();
|
||||||
}
|
}
|
||||||
|
@ -138,10 +133,8 @@ void FadeAnimation::fadeOut(int duration) {
|
||||||
|
|
||||||
void FadeAnimation::startAnimation(int duration) {
|
void FadeAnimation::startAnimation(int duration) {
|
||||||
if (_cache.isNull()) {
|
if (_cache.isNull()) {
|
||||||
_widget->showChildren();
|
|
||||||
_cache = grabContent();
|
_cache = grabContent();
|
||||||
Assert(!_cache.isNull());
|
Assert(!_cache.isNull());
|
||||||
_widget->hideChildren();
|
|
||||||
}
|
}
|
||||||
auto from = _visible ? 0. : 1.;
|
auto from = _visible ? 0. : 1.;
|
||||||
auto to = _visible ? 1. : 0.;
|
auto to = _visible ? 1. : 0.;
|
||||||
|
|
|
@ -426,7 +426,7 @@ UserpicButton::UserpicButton(
|
||||||
, _peer(peer)
|
, _peer(peer)
|
||||||
, _peerForCrop(_peer->id)
|
, _peerForCrop(_peer->id)
|
||||||
, _role(role) {
|
, _role(role) {
|
||||||
Expects(_role == Role::Custom);
|
Expects(_role != Role::OpenProfile);
|
||||||
|
|
||||||
_waiting = false;
|
_waiting = false;
|
||||||
prepare();
|
prepare();
|
||||||
|
|
|
@ -175,7 +175,7 @@ void SendPendingMoveResizeEvents(not_null<QWidget*> target) {
|
||||||
SendPendingEventsRecursive(target, !target->isVisible());
|
SendPendingEventsRecursive(target, !target->isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap GrabWidget(not_null<TWidget*> target, QRect rect, QColor bg) {
|
QPixmap GrabWidget(not_null<QWidget*> target, QRect rect, QColor bg) {
|
||||||
SendPendingMoveResizeEvents(target);
|
SendPendingMoveResizeEvents(target);
|
||||||
if (rect.isNull()) {
|
if (rect.isNull()) {
|
||||||
rect = target->rect();
|
rect = target->rect();
|
||||||
|
@ -186,19 +186,15 @@ QPixmap GrabWidget(not_null<TWidget*> target, QRect rect, QColor bg) {
|
||||||
if (!target->testAttribute(Qt::WA_OpaquePaintEvent)) {
|
if (!target->testAttribute(Qt::WA_OpaquePaintEvent)) {
|
||||||
result.fill(bg);
|
result.fill(bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
target->grabStart();
|
|
||||||
target->render(
|
target->render(
|
||||||
&result,
|
&result,
|
||||||
QPoint(0, 0),
|
QPoint(0, 0),
|
||||||
rect,
|
rect,
|
||||||
QWidget::DrawChildren | QWidget::IgnoreMask);
|
QWidget::DrawChildren | QWidget::IgnoreMask);
|
||||||
target->grabFinish();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage GrabWidgetToImage(not_null<TWidget*> target, QRect rect, QColor bg) {
|
QImage GrabWidgetToImage(not_null<QWidget*> target, QRect rect, QColor bg) {
|
||||||
Ui::SendPendingMoveResizeEvents(target);
|
Ui::SendPendingMoveResizeEvents(target);
|
||||||
if (rect.isNull()) {
|
if (rect.isNull()) {
|
||||||
rect = target->rect();
|
rect = target->rect();
|
||||||
|
@ -211,15 +207,11 @@ QImage GrabWidgetToImage(not_null<TWidget*> target, QRect rect, QColor bg) {
|
||||||
if (!target->testAttribute(Qt::WA_OpaquePaintEvent)) {
|
if (!target->testAttribute(Qt::WA_OpaquePaintEvent)) {
|
||||||
result.fill(bg);
|
result.fill(bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
target->grabStart();
|
|
||||||
target->render(
|
target->render(
|
||||||
&result,
|
&result,
|
||||||
QPoint(0, 0),
|
QPoint(0, 0),
|
||||||
rect,
|
rect,
|
||||||
QWidget::DrawChildren | QWidget::IgnoreMask);
|
QWidget::DrawChildren | QWidget::IgnoreMask);
|
||||||
target->grabFinish();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,11 @@ inline ChildWidget *AttachParentChild(
|
||||||
void SendPendingMoveResizeEvents(not_null<QWidget*> target);
|
void SendPendingMoveResizeEvents(not_null<QWidget*> target);
|
||||||
|
|
||||||
QPixmap GrabWidget(
|
QPixmap GrabWidget(
|
||||||
not_null<TWidget*> target,
|
not_null<QWidget*> target,
|
||||||
QRect rect = QRect(),
|
QRect rect = QRect(),
|
||||||
QColor bg = QColor(255, 255, 255, 0));
|
QColor bg = QColor(255, 255, 255, 0));
|
||||||
QImage GrabWidgetToImage(
|
QImage GrabWidgetToImage(
|
||||||
not_null<TWidget*> target,
|
not_null<QWidget*> target,
|
||||||
QRect rect = QRect(),
|
QRect rect = QRect(),
|
||||||
QColor bg = QColor(255, 255, 255, 0));
|
QColor bg = QColor(255, 255, 255, 0));
|
||||||
|
|
||||||
|
@ -326,10 +326,6 @@ class TWidget : public TWidgetHelper<QWidget> {
|
||||||
public:
|
public:
|
||||||
TWidget(QWidget *parent = nullptr) : TWidgetHelper<QWidget>(parent) {
|
TWidget(QWidget *parent = nullptr) : TWidgetHelper<QWidget>(parent) {
|
||||||
}
|
}
|
||||||
virtual void grabStart() {
|
|
||||||
}
|
|
||||||
virtual void grabFinish() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool inFocusChain() const {
|
bool inFocusChain() const {
|
||||||
return Ui::InFocusChain(this);
|
return Ui::InFocusChain(this);
|
||||||
|
|
|
@ -95,9 +95,7 @@ QPixmap Shadow::grab(
|
||||||
{
|
{
|
||||||
Painter p(&result);
|
Painter p(&result);
|
||||||
Ui::Shadow::paint(p, full.marginsRemoved(extend), full.width(), shadow);
|
Ui::Shadow::paint(p, full.marginsRemoved(extend), full.width(), shadow);
|
||||||
target->grabStart();
|
|
||||||
target->render(&p, QPoint(extend.left(), extend.top()), rect, QWidget::DrawChildren | QWidget::IgnoreMask);
|
target->render(&p, QPoint(extend.left(), extend.top()), rect, QWidget::DrawChildren | QWidget::IgnoreMask);
|
||||||
target->grabFinish();
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,15 +34,33 @@ FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggle(
|
||||||
auto changed = (shown != _animation.visible());
|
auto changed = (shown != _animation.visible());
|
||||||
if (shown) {
|
if (shown) {
|
||||||
if (animated == anim::type::normal) {
|
if (animated == anim::type::normal) {
|
||||||
|
if (!_animation.animating()) {
|
||||||
|
wrapped()->show();
|
||||||
|
}
|
||||||
_animation.fadeIn(_duration);
|
_animation.fadeIn(_duration);
|
||||||
|
if (_animation.animating()) {
|
||||||
|
wrapped()->hide();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_animation.show();
|
_animation.show();
|
||||||
|
if (!_animation.animating()) {
|
||||||
|
wrapped()->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (animated == anim::type::normal) {
|
if (animated == anim::type::normal) {
|
||||||
|
if (!_animation.animating()) {
|
||||||
|
wrapped()->show();
|
||||||
|
}
|
||||||
_animation.fadeOut(_duration);
|
_animation.fadeOut(_duration);
|
||||||
|
if (_animation.animating()) {
|
||||||
|
wrapped()->hide();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_animation.hide();
|
_animation.hide();
|
||||||
|
if (!_animation.animating()) {
|
||||||
|
wrapped()->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
@ -53,6 +71,7 @@ FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggle(
|
||||||
|
|
||||||
FadeWrap<RpWidget> *FadeWrap<RpWidget>::finishAnimating() {
|
FadeWrap<RpWidget> *FadeWrap<RpWidget>::finishAnimating() {
|
||||||
_animation.finish();
|
_animation.finish();
|
||||||
|
wrapped()->show();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +88,19 @@ FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggleOn(
|
||||||
|
|
||||||
void FadeWrap<RpWidget>::paintEvent(QPaintEvent *e) {
|
void FadeWrap<RpWidget>::paintEvent(QPaintEvent *e) {
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
_animation.paint(p);
|
if (_animation.paint(p)) {
|
||||||
|
if (!_animation.animating() && _animation.visible()) {
|
||||||
|
crl::on_main(this, [=] {
|
||||||
|
if (!_animation.animating() && _animation.visible()) {
|
||||||
|
wrapped()->show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!_animation.animating()) {
|
||||||
|
wrapped()->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FadeShadow::FadeShadow(QWidget *parent)
|
FadeShadow::FadeShadow(QWidget *parent)
|
||||||
|
|
|
@ -314,11 +314,8 @@ void LayerStackWidget::BackgroundWidget::animationCallback() {
|
||||||
checkIfDone();
|
checkIfDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerStackWidget::LayerStackWidget(
|
LayerStackWidget::LayerStackWidget(QWidget *parent)
|
||||||
QWidget *parent,
|
: RpWidget(parent)
|
||||||
Controller *controller)
|
|
||||||
: TWidget(parent)
|
|
||||||
, _controller(controller)
|
|
||||||
, _background(this) {
|
, _background(this) {
|
||||||
setGeometry(parentWidget()->rect());
|
setGeometry(parentWidget()->rect());
|
||||||
hide();
|
hide();
|
||||||
|
@ -326,7 +323,7 @@ LayerStackWidget::LayerStackWidget(
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerWidget::setInnerFocus() {
|
void LayerWidget::setInnerFocus() {
|
||||||
if (!isAncestorOf(App::wnd()->focusWidget())) {
|
if (!isAncestorOf(window()->focusWidget())) {
|
||||||
doSetInnerFocus();
|
doSetInnerFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,13 +403,13 @@ void LayerStackWidget::setCacheImages() {
|
||||||
if (auto layer = currentLayer()) {
|
if (auto layer = currentLayer()) {
|
||||||
layerCache = Ui::Shadow::grab(layer, st::boxRoundShadow);
|
layerCache = Ui::Shadow::grab(layer, st::boxRoundShadow);
|
||||||
}
|
}
|
||||||
if (isAncestorOf(App::wnd()->focusWidget())) {
|
if (isAncestorOf(window()->focusWidget())) {
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
if (_mainMenu) {
|
if (_mainMenu) {
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||||
hideChildren();
|
hideChildren();
|
||||||
bodyCache = Ui::GrabWidget(App::wnd()->bodyWidget());
|
bodyCache = Ui::GrabWidget(parentWidget());
|
||||||
showChildren();
|
showChildren();
|
||||||
mainMenuCache = Ui::Shadow::grab(_mainMenu, st::boxRoundShadow, RectPart::Right);
|
mainMenuCache = Ui::Shadow::grab(_mainMenu, st::boxRoundShadow, RectPart::Right);
|
||||||
}
|
}
|
||||||
|
@ -541,6 +538,21 @@ void LayerStackWidget::resizeEvent(QResizeEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::showBox(
|
void LayerStackWidget::showBox(
|
||||||
|
object_ptr<BoxContent> box,
|
||||||
|
LayerOptions options,
|
||||||
|
anim::type animated) {
|
||||||
|
if (options & LayerOption::KeepOther) {
|
||||||
|
if (options & LayerOption::ShowAfterOther) {
|
||||||
|
prependBox(std::move(box), animated);
|
||||||
|
} else {
|
||||||
|
appendBox(std::move(box), animated);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
replaceBox(std::move(box), animated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::replaceBox(
|
||||||
object_ptr<BoxContent> box,
|
object_ptr<BoxContent> box,
|
||||||
anim::type animated) {
|
anim::type animated) {
|
||||||
auto pointer = pushBox(std::move(box), animated);
|
auto pointer = pushBox(std::move(box), animated);
|
||||||
|
@ -585,13 +597,17 @@ void LayerStackWidget::animationDone() {
|
||||||
hidden = false;
|
hidden = false;
|
||||||
}
|
}
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
App::wnd()->layerFinishedHide(this);
|
_hideFinishStream.fire({});
|
||||||
} else {
|
} else {
|
||||||
showFinished();
|
showFinished();
|
||||||
}
|
}
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<> LayerStackWidget::hideFinishEvents() const {
|
||||||
|
return _hideFinishStream.events();
|
||||||
|
}
|
||||||
|
|
||||||
void LayerStackWidget::showFinished() {
|
void LayerStackWidget::showFinished() {
|
||||||
fixOrder();
|
fixOrder();
|
||||||
sendFakeMouseEvent();
|
sendFakeMouseEvent();
|
||||||
|
@ -602,8 +618,8 @@ void LayerStackWidget::showFinished() {
|
||||||
if (auto layer = currentLayer()) {
|
if (auto layer = currentLayer()) {
|
||||||
layer->showFinished();
|
layer->showFinished();
|
||||||
}
|
}
|
||||||
if (auto window = App::wnd()) {
|
if (canSetFocus()) {
|
||||||
window->setInnerFocus();
|
setInnerFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,9 +651,11 @@ void LayerStackWidget::hideSpecialLayer(anim::type animated) {
|
||||||
}, Action::HideSpecialLayer, animated);
|
}, Action::HideSpecialLayer, animated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::showMainMenu(anim::type animated) {
|
void LayerStackWidget::showMainMenu(
|
||||||
startAnimation([this] {
|
not_null<Window::Controller*> controller,
|
||||||
_mainMenu.create(this, _controller);
|
anim::type animated) {
|
||||||
|
startAnimation([&] {
|
||||||
|
_mainMenu.create(this, controller);
|
||||||
_mainMenu->setGeometryToLeft(0, 0, _mainMenu->width(), height());
|
_mainMenu->setGeometryToLeft(0, 0, _mainMenu->width(), height());
|
||||||
_mainMenu->setParent(this);
|
_mainMenu->setParent(this);
|
||||||
}, [this] {
|
}, [this] {
|
||||||
|
@ -662,7 +680,6 @@ LayerWidget *LayerStackWidget::pushBox(
|
||||||
}
|
}
|
||||||
auto layer = object_ptr<AbstractBox>(
|
auto layer = object_ptr<AbstractBox>(
|
||||||
this,
|
this,
|
||||||
_controller,
|
|
||||||
std::move(box));
|
std::move(box));
|
||||||
_layers.push_back(layer);
|
_layers.push_back(layer);
|
||||||
initChildLayer(layer);
|
initChildLayer(layer);
|
||||||
|
@ -685,9 +702,10 @@ void LayerStackWidget::prependBox(
|
||||||
object_ptr<BoxContent> box,
|
object_ptr<BoxContent> box,
|
||||||
anim::type animated) {
|
anim::type animated) {
|
||||||
if (_layers.empty()) {
|
if (_layers.empty()) {
|
||||||
return showBox(std::move(box), animated);
|
replaceBox(std::move(box), animated);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
auto layer = object_ptr<AbstractBox>(this, _controller, std::move(box));
|
auto layer = object_ptr<AbstractBox>(this, std::move(box));
|
||||||
layer->hide();
|
layer->hide();
|
||||||
_layers.push_front(layer);
|
_layers.push_front(layer);
|
||||||
initChildLayer(layer);
|
initChildLayer(layer);
|
||||||
|
@ -775,7 +793,6 @@ LayerStackWidget::~LayerStackWidget() {
|
||||||
layer->hide();
|
layer->hide();
|
||||||
delete layer;
|
delete layer;
|
||||||
}
|
}
|
||||||
if (App::wnd()) App::wnd()->noLayerStack(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
|
@ -77,29 +77,24 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LayerStackWidget : public TWidget {
|
class LayerStackWidget : public Ui::RpWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LayerStackWidget(QWidget *parent, Controller *controller);
|
LayerStackWidget(QWidget *parent);
|
||||||
|
|
||||||
Controller *controller() const {
|
|
||||||
return _controller;
|
|
||||||
}
|
|
||||||
void finishAnimating();
|
void finishAnimating();
|
||||||
|
rpl::producer<> hideFinishEvents() const;
|
||||||
|
|
||||||
void showBox(
|
void showBox(
|
||||||
object_ptr<BoxContent> box,
|
object_ptr<BoxContent> box,
|
||||||
|
LayerOptions options,
|
||||||
anim::type animated);
|
anim::type animated);
|
||||||
void showSpecialLayer(
|
void showSpecialLayer(
|
||||||
object_ptr<LayerWidget> layer,
|
object_ptr<LayerWidget> layer,
|
||||||
anim::type animated);
|
anim::type animated);
|
||||||
void showMainMenu(anim::type animated);
|
void showMainMenu(
|
||||||
void appendBox(
|
not_null<Window::Controller*> controller,
|
||||||
object_ptr<BoxContent> box,
|
|
||||||
anim::type animated);
|
|
||||||
void prependBox(
|
|
||||||
object_ptr<BoxContent> box,
|
|
||||||
anim::type animated);
|
anim::type animated);
|
||||||
bool takeToThirdSection();
|
bool takeToThirdSection();
|
||||||
|
|
||||||
|
@ -132,6 +127,16 @@ private slots:
|
||||||
void onLayerResized();
|
void onLayerResized();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void appendBox(
|
||||||
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated);
|
||||||
|
void prependBox(
|
||||||
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated);
|
||||||
|
void replaceBox(
|
||||||
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated);
|
||||||
|
|
||||||
LayerWidget *pushBox(
|
LayerWidget *pushBox(
|
||||||
object_ptr<BoxContent> box,
|
object_ptr<BoxContent> box,
|
||||||
anim::type animated);
|
anim::type animated);
|
||||||
|
@ -171,8 +176,6 @@ private:
|
||||||
return const_cast<LayerStackWidget*>(this)->currentLayer();
|
return const_cast<LayerStackWidget*>(this)->currentLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller *_controller = nullptr;
|
|
||||||
|
|
||||||
QList<LayerWidget*> _layers;
|
QList<LayerWidget*> _layers;
|
||||||
|
|
||||||
object_ptr<LayerWidget> _specialLayer = { nullptr };
|
object_ptr<LayerWidget> _specialLayer = { nullptr };
|
||||||
|
@ -181,6 +184,8 @@ private:
|
||||||
class BackgroundWidget;
|
class BackgroundWidget;
|
||||||
object_ptr<BackgroundWidget> _background;
|
object_ptr<BackgroundWidget> _background;
|
||||||
|
|
||||||
|
rpl::event_stream<> _hideFinishStream;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
Loading…
Add table
Reference in a new issue