mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Layers show/hide rewritten, animated show over mainmenu and settings.
This commit is contained in:
parent
d0f7c6c210
commit
31a66d66e2
54 changed files with 584 additions and 824 deletions
|
@ -315,10 +315,6 @@ searchedBarBG: #ebeef1;
|
|||
searchedBarBorder: unreadBarBorder;
|
||||
searchedBarColor: #a2aeb7;
|
||||
|
||||
layerSlideDuration: 200;
|
||||
layerHideDuration: 200;
|
||||
layerPadding: margins(10px, 10px, 10px, 10px);
|
||||
|
||||
simpleCloseIcon: icon {{ "simple_close", #c7c7c7 }};
|
||||
simpleCloseIconOver: icon {{ "simple_close", #a3a3a3 }};
|
||||
dialogsForwardCancelIcon: icon {{ "simple_close", dialogsForwardFg }};
|
||||
|
|
|
@ -834,7 +834,7 @@ void AppClass::cancelPhotoUpdate(const PeerId &peer) {
|
|||
|
||||
void AppClass::mtpPause() {
|
||||
MTP::pause();
|
||||
_mtpUnpauseTimer.start(st::layerSlideDuration * 2);
|
||||
_mtpUnpauseTimer.start(st::slideDuration * 2);
|
||||
}
|
||||
|
||||
void AppClass::mtpUnpause() {
|
||||
|
|
|
@ -49,14 +49,6 @@ AboutBox::AboutBox() : AbstractBox(st::aboutWidth)
|
|||
setAcceptDrops(true);
|
||||
}
|
||||
|
||||
void AboutBox::showAll() {
|
||||
_version->show();
|
||||
_text1->show();
|
||||
_text2->show();
|
||||
_text3->show();
|
||||
_done->show();
|
||||
}
|
||||
|
||||
void AboutBox::resizeEvent(QResizeEvent *e) {
|
||||
_version->moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutVersionTop);
|
||||
_text1->moveToLeft(st::boxPadding.left(), titleHeight() + st::aboutTextTop);
|
||||
|
|
|
@ -44,8 +44,6 @@ protected:
|
|||
void dragEnterEvent(QDragEnterEvent *e) override;
|
||||
void dropEvent(QDropEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
ChildWidget<Ui::LinkButton> _version;
|
||||
ChildWidget<Ui::FlatLabel> _text1;
|
||||
|
|
|
@ -36,7 +36,6 @@ AbstractBox::AbstractBox(int w) : LayerWidget(App::wnd()->bodyWidget()) {
|
|||
|
||||
void AbstractBox::prepare() {
|
||||
raiseShadow();
|
||||
showAll();
|
||||
}
|
||||
|
||||
void AbstractBox::keyPressEvent(QKeyEvent *e) {
|
||||
|
|
|
@ -35,9 +35,6 @@ class AbstractBox : public LayerWidget, protected base::Subscriber {
|
|||
public:
|
||||
AbstractBox(int w = 0);
|
||||
void parentResized() override;
|
||||
void showDone() override {
|
||||
showAll();
|
||||
}
|
||||
|
||||
void setBlockTitle(bool block);
|
||||
void raiseShadow();
|
||||
|
@ -59,8 +56,6 @@ protected:
|
|||
|
||||
virtual void closePressed() {
|
||||
}
|
||||
virtual void showAll() {
|
||||
}
|
||||
|
||||
private:
|
||||
int _maxHeight = 0;
|
||||
|
|
|
@ -90,14 +90,6 @@ void AddContactBox::initBox() {
|
|||
prepare();
|
||||
}
|
||||
|
||||
void AddContactBox::showAll() {
|
||||
_first->show();
|
||||
_last->show();
|
||||
_phone->show();
|
||||
_save->show();
|
||||
_cancel->show();
|
||||
}
|
||||
|
||||
void AddContactBox::doSetInnerFocus() {
|
||||
if ((_first->getLastText().isEmpty() && _last->getLastText().isEmpty()) || !_phone->isEnabled()) {
|
||||
(_invertOrder ? _last : _first)->setFocus();
|
||||
|
@ -230,10 +222,7 @@ void AddContactBox::onImportDone(const MTPcontacts_ImportedContacts &res) {
|
|||
Notify::userIsContactChanged(user, true);
|
||||
Ui::hideLayer();
|
||||
} else {
|
||||
_save->hide();
|
||||
_first->hide();
|
||||
_last->hide();
|
||||
_phone->hide();
|
||||
hideChildren();
|
||||
_retry->show();
|
||||
resizeEvent(0);
|
||||
update();
|
||||
|
@ -249,10 +238,9 @@ void AddContactBox::onSaveUserDone(const MTPcontacts_ImportedContacts &res) {
|
|||
void AddContactBox::onRetry() {
|
||||
_addRequest = 0;
|
||||
_contactId = 0;
|
||||
_save->show();
|
||||
showChildren();
|
||||
_retry->hide();
|
||||
resizeEvent(0);
|
||||
showAll();
|
||||
_first->setText(QString());
|
||||
_first->updatePlaceholder();
|
||||
_last->setText(QString());
|
||||
|
@ -280,6 +268,7 @@ _creationRequestId(0), _createdChannel(0) {
|
|||
|
||||
_description->setMaxLength(MaxChannelDescription);
|
||||
_description->resize(width() - st::boxPadding.left() - st::newGroupInfoPadding.left() - st::boxPadding.right(), _description->height());
|
||||
_description->setVisible(_creating == CreatingGroupChannel);
|
||||
|
||||
updateMaxHeight();
|
||||
connect(_description, SIGNAL(resized()), this, SLOT(onDescriptionResized()));
|
||||
|
@ -298,17 +287,6 @@ _creationRequestId(0), _createdChannel(0) {
|
|||
prepare();
|
||||
}
|
||||
|
||||
void GroupInfoBox::showAll() {
|
||||
_title->show();
|
||||
if (_creating == CreatingGroupChannel) {
|
||||
_description->show();
|
||||
} else {
|
||||
_description->hide();
|
||||
}
|
||||
_cancel->show();
|
||||
_next->show();
|
||||
}
|
||||
|
||||
void GroupInfoBox::doSetInnerFocus() {
|
||||
_title->setFocus();
|
||||
}
|
||||
|
@ -554,6 +532,7 @@ SetupChannelBox::SetupChannelBox(ChannelData *channel, bool existing) : Abstract
|
|||
connect(_skip, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
|
||||
connect(_link, SIGNAL(changed()), this, SLOT(onChange()));
|
||||
_link->setVisible(_public->checked());
|
||||
|
||||
_checkTimer.setSingleShot(true);
|
||||
connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));
|
||||
|
@ -564,18 +543,6 @@ SetupChannelBox::SetupChannelBox(ChannelData *channel, bool existing) : Abstract
|
|||
prepare();
|
||||
}
|
||||
|
||||
void SetupChannelBox::showAll() {
|
||||
_public->show();
|
||||
_private->show();
|
||||
if (_public->checked()) {
|
||||
_link->show();
|
||||
} else {
|
||||
_link->hide();
|
||||
}
|
||||
_save->show();
|
||||
_skip->show();
|
||||
}
|
||||
|
||||
void SetupChannelBox::doSetInnerFocus() {
|
||||
if (_link->isHidden()) {
|
||||
setFocus();
|
||||
|
@ -937,21 +904,11 @@ _invertOrder(!peer->isChat() && langFirstNameGoesSecond()) {
|
|||
|
||||
connect(_first, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(_last, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
_last->setVisible(!_peer->isChat());
|
||||
|
||||
prepare();
|
||||
}
|
||||
|
||||
void EditNameTitleBox::showAll() {
|
||||
_first->show();
|
||||
if (_peer->isChat()) {
|
||||
_last->hide();
|
||||
} else {
|
||||
_last->show();
|
||||
}
|
||||
_save->show();
|
||||
_cancel->show();
|
||||
}
|
||||
|
||||
void EditNameTitleBox::doSetInnerFocus() {
|
||||
(_invertOrder ? _last : _first)->setFocus();
|
||||
}
|
||||
|
@ -1109,27 +1066,12 @@ EditChannelBox::EditChannelBox(ChannelData *channel) : AbstractBox()
|
|||
connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
|
||||
connect(_publicLink, SIGNAL(clicked()), this, SLOT(onPublicLink()));
|
||||
_publicLink->setVisible(_channel->canEditUsername());
|
||||
_sign->setVisible(!_channel->isMegagroup());
|
||||
|
||||
prepare();
|
||||
}
|
||||
|
||||
void EditChannelBox::showAll() {
|
||||
_title->show();
|
||||
_description->show();
|
||||
_save->show();
|
||||
_cancel->show();
|
||||
if (_channel->canEditUsername()) {
|
||||
_publicLink->show();
|
||||
} else {
|
||||
_publicLink->hide();
|
||||
}
|
||||
if (_channel->isMegagroup()) {
|
||||
_sign->hide();
|
||||
} else {
|
||||
_sign->show();
|
||||
}
|
||||
}
|
||||
|
||||
void EditChannelBox::doSetInnerFocus() {
|
||||
_title->setFocus();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
@ -104,7 +103,6 @@ protected:
|
|||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
@ -165,7 +163,6 @@ protected:
|
|||
void leaveEvent(QEvent *e) override;
|
||||
|
||||
void closePressed() override;
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
@ -226,7 +223,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
@ -270,7 +266,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -55,13 +55,6 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) {
|
|||
prepare();
|
||||
}
|
||||
|
||||
void AutoLockBox::showAll() {
|
||||
_close->show();
|
||||
for (int32 i = 0, l = _options.size(); i < l; ++i) {
|
||||
_options[i]->show();
|
||||
}
|
||||
}
|
||||
|
||||
void AutoLockBox::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
if (paint(p)) return;
|
||||
|
|
|
@ -39,8 +39,6 @@ public slots:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
QVector<Ui::Radiobutton*> _options;
|
||||
ChildWidget<Ui::RoundButton> _close;
|
||||
|
|
|
@ -23,6 +23,8 @@ using "basic.style";
|
|||
using "ui/widgets/widgets.style";
|
||||
using "intro/intro.style";
|
||||
|
||||
boxDuration: 200;
|
||||
|
||||
boxButtonFont: font(boxFontSize semibold);
|
||||
defaultBoxButton: RoundButton {
|
||||
textFg: #2f9fea;
|
||||
|
@ -297,15 +299,8 @@ contactsMultiSelect: MultiSelect {
|
|||
fieldIcon: boxFieldSearchIcon;
|
||||
fieldIconSkip: 36px;
|
||||
|
||||
fieldCancel: IconButton {
|
||||
width: 41px;
|
||||
height: 48px;
|
||||
|
||||
icon: boxSearchCancelIcon;
|
||||
iconOver: boxSearchCancelIconOver;
|
||||
iconPosition: point(8px, 18px);
|
||||
}
|
||||
fieldCancelSkip: 34px;
|
||||
fieldCancel: boxBlockTitleClose;
|
||||
fieldCancelSkip: 40px;
|
||||
}
|
||||
contactsPhotoCheckbox: RoundImageCheckbox {
|
||||
imageRadius: 21px;
|
||||
|
|
|
@ -145,15 +145,6 @@ void ConfirmBox::closePressed() {
|
|||
emit cancelled();
|
||||
}
|
||||
|
||||
void ConfirmBox::showAll() {
|
||||
if (_informative) {
|
||||
_confirm->show();
|
||||
} else {
|
||||
_confirm->show();
|
||||
_cancel->show();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfirmBox::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||
onConfirmPressed();
|
||||
|
@ -269,10 +260,6 @@ void MaxInviteBox::step_good(float64 ms, bool timer) {
|
|||
if (timer) update();
|
||||
}
|
||||
|
||||
void MaxInviteBox::showAll() {
|
||||
_close->show();
|
||||
}
|
||||
|
||||
void MaxInviteBox::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
if (paint(p)) return;
|
||||
|
@ -362,11 +349,6 @@ bool ConvertToSupergroupBox::convertFail(const RPCError &error) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void ConvertToSupergroupBox::showAll() {
|
||||
_convert->show();
|
||||
_cancel->show();
|
||||
}
|
||||
|
||||
void ConvertToSupergroupBox::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||
onConvert();
|
||||
|
@ -427,13 +409,6 @@ void PinMessageBox::onPin() {
|
|||
_requestId = MTP::send(MTPchannels_UpdatePinnedMessage(MTP_flags(flags), _channel->inputChannel, MTP_int(_msgId)), rpcDone(&PinMessageBox::pinDone), rpcFail(&PinMessageBox::pinFail));
|
||||
}
|
||||
|
||||
void PinMessageBox::showAll() {
|
||||
_text->show();
|
||||
_notify->show();
|
||||
_pin->show();
|
||||
_cancel->show();
|
||||
}
|
||||
|
||||
void PinMessageBox::pinDone(const MTPUpdates &updates) {
|
||||
if (App::main()) {
|
||||
App::main()->sentUpdatesReceived(updates);
|
||||
|
@ -499,15 +474,6 @@ void RichDeleteMessageBox::onDelete() {
|
|||
Ui::hideLayer();
|
||||
}
|
||||
|
||||
void RichDeleteMessageBox::showAll() {
|
||||
_text->show();
|
||||
_banUser->show();
|
||||
_reportSpam->show();
|
||||
_deleteAll->show();
|
||||
_delete->show();
|
||||
_cancel->show();
|
||||
}
|
||||
|
||||
KickMemberBox::KickMemberBox(PeerData *chat, UserData *member)
|
||||
: ConfirmBox(lng_profile_sure_kick(lt_user, member->firstName), lang(lng_box_remove))
|
||||
, _chat(chat)
|
||||
|
@ -599,7 +565,3 @@ void ConfirmInviteBox::paintEvent(QPaintEvent *e) {
|
|||
left += _userWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void ConfirmInviteBox::showAll() {
|
||||
showChildren();
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@ protected:
|
|||
void leaveEvent(QEvent *e) override;
|
||||
|
||||
void closePressed() override;
|
||||
void showAll() override;
|
||||
|
||||
private slots:
|
||||
void onConfirmPressed();
|
||||
|
@ -163,8 +162,6 @@ protected:
|
|||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void updateSelected(const QPoint &cursorGlobalPosition);
|
||||
void step_good(float64 ms, bool timer);
|
||||
|
@ -200,8 +197,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void convertDone(const MTPUpdates &updates);
|
||||
bool convertFail(const RPCError &error);
|
||||
|
@ -227,8 +222,6 @@ public slots:
|
|||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void pinDone(const MTPUpdates &updates);
|
||||
bool pinFail(const RPCError &error);
|
||||
|
@ -258,8 +251,6 @@ public slots:
|
|||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
ChannelData *_channel;
|
||||
UserData *_from;
|
||||
|
@ -300,8 +291,6 @@ protected:
|
|||
void resizeEvent(QResizeEvent *e) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
ChildWidget<Ui::FlatLabel> _title;
|
||||
ChildWidget<Ui::FlatLabel> _status;
|
||||
|
|
|
@ -123,6 +123,7 @@ void ConfirmPhoneBox::launch() {
|
|||
|
||||
connect(&_callTimer, SIGNAL(timeout()), this, SLOT(onCallStatusTimer()));
|
||||
|
||||
showChildren();
|
||||
prepare();
|
||||
|
||||
Ui::showLayer(this);
|
||||
|
|
|
@ -44,9 +44,6 @@ private slots:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void showAll() override {
|
||||
showChildren();
|
||||
}
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -55,15 +55,12 @@ ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth)
|
|||
connect(_userInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
connect(_passwordInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
|
||||
updateControlsVisibility();
|
||||
|
||||
prepare();
|
||||
}
|
||||
|
||||
void ConnectionBox::showAll() {
|
||||
_autoRadio->show();
|
||||
_httpProxyRadio->show();
|
||||
_tcpProxyRadio->show();
|
||||
_tryIPv6->show();
|
||||
|
||||
void ConnectionBox::updateControlsVisibility() {
|
||||
int32 h = titleHeight() + st::boxOptionListPadding.top() + _autoRadio->height() + st::boxOptionListPadding.top() + _httpProxyRadio->height() + st::boxOptionListPadding.top() + _tcpProxyRadio->height() + st::boxOptionListPadding.top() + st::connectionIPv6Skip + _tryIPv6->height() + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _save->height() + st::boxButtonPadding.bottom();
|
||||
if (_httpProxyRadio->checked() || _tcpProxyRadio->checked()) {
|
||||
h += 2 * st::boxOptionListPadding.top() + 2 * _hostInput->height();
|
||||
|
@ -78,9 +75,6 @@ void ConnectionBox::showAll() {
|
|||
_passwordInput->hide();
|
||||
}
|
||||
|
||||
_save->show();
|
||||
_cancel->show();
|
||||
|
||||
setMaxHeight(h);
|
||||
resizeEvent(0);
|
||||
}
|
||||
|
@ -130,7 +124,7 @@ void ConnectionBox::resizeEvent(QResizeEvent *e) {
|
|||
}
|
||||
|
||||
void ConnectionBox::onChange() {
|
||||
showAll();
|
||||
updateControlsVisibility();
|
||||
if (_httpProxyRadio->checked() || _tcpProxyRadio->checked()) {
|
||||
_hostInput->setFocus();
|
||||
if (_httpProxyRadio->checked() && !_portInput->getLastText().toInt()) {
|
||||
|
@ -235,19 +229,6 @@ AutoDownloadBox::AutoDownloadBox() : AbstractBox(st::boxWidth)
|
|||
prepare();
|
||||
}
|
||||
|
||||
void AutoDownloadBox::showAll() {
|
||||
_photoPrivate->show();
|
||||
_photoGroups->show();
|
||||
_audioPrivate->show();
|
||||
_audioGroups->show();
|
||||
_gifPrivate->show();
|
||||
_gifGroups->show();
|
||||
_gifPlay->show();
|
||||
|
||||
_save->show();
|
||||
_cancel->show();
|
||||
}
|
||||
|
||||
void AutoDownloadBox::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
if (paint(p)) return;
|
||||
|
|
|
@ -46,10 +46,11 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
void updateControlsVisibility();
|
||||
|
||||
ChildWidget<Ui::InputField> _hostInput;
|
||||
ChildWidget<Ui::PortInput> _portInput;
|
||||
ChildWidget<Ui::InputField> _userInput;
|
||||
|
@ -77,8 +78,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
ChildWidget<Ui::Checkbox> _photoPrivate;
|
||||
ChildWidget<Ui::Checkbox> _photoGroups;
|
||||
|
|
|
@ -134,7 +134,11 @@ void ContactsBox::init() {
|
|||
}
|
||||
updateScrollSkips();
|
||||
});
|
||||
|
||||
if (_inner->chat() && _inner->membersFilter() == MembersFilter::Admins && _inner->allAdmins()) {
|
||||
_select->hideFast();
|
||||
} else {
|
||||
_select->showFast();
|
||||
}
|
||||
if (_inner->channel() && _inner->membersFilter() == MembersFilter::Admins) {
|
||||
_next->hide();
|
||||
_cancel->hide();
|
||||
|
@ -239,30 +243,6 @@ bool ContactsBox::peopleFailed(const RPCError &error, mtpRequestId req) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void ContactsBox::showAll() {
|
||||
if (_inner->chat() && _inner->membersFilter() == MembersFilter::Admins && _inner->allAdmins()) {
|
||||
_select->hideFast();
|
||||
} else {
|
||||
_select->showFast();
|
||||
}
|
||||
if (_inner->channel() && _inner->membersFilter() == MembersFilter::Admins) {
|
||||
_next->hide();
|
||||
_cancel->hide();
|
||||
} else if (_inner->chat() || _inner->channel()) {
|
||||
_next->show();
|
||||
_cancel->show();
|
||||
} else if (_inner->creating() != CreatingGroupNone) {
|
||||
_next->show();
|
||||
_cancel->show();
|
||||
} else {
|
||||
_next->hide();
|
||||
_cancel->hide();
|
||||
}
|
||||
_topShadow->show();
|
||||
if (_bottomShadow) _bottomShadow->show();
|
||||
ItemListBox::showAll();
|
||||
}
|
||||
|
||||
void ContactsBox::doSetInnerFocus() {
|
||||
if (_select->isHidden()) {
|
||||
_inner->setFocus();
|
||||
|
|
|
@ -79,7 +79,6 @@ protected:
|
|||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void closePressed() override;
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -50,22 +50,13 @@ DownloadPathBox::DownloadPathBox() : AbstractBox()
|
|||
if (!_path.isEmpty() && _path != qsl("tmp")) {
|
||||
setPathText(QDir::toNativeSeparators(_path));
|
||||
}
|
||||
updateControlsVisibility();
|
||||
|
||||
prepare();
|
||||
}
|
||||
|
||||
void DownloadPathBox::showAll() {
|
||||
_default->show();
|
||||
_temp->show();
|
||||
_dir->show();
|
||||
|
||||
if (_dir->checked()) {
|
||||
_pathLink->show();
|
||||
} else {
|
||||
_pathLink->hide();
|
||||
}
|
||||
|
||||
_save->show();
|
||||
_cancel->show();
|
||||
void DownloadPathBox::updateControlsVisibility() {
|
||||
_pathLink->setVisible(_dir->checked());
|
||||
|
||||
int32 h = titleHeight() + st::boxOptionListPadding.top() + _default->height() + st::boxOptionListPadding.top() + _temp->height() + st::boxOptionListPadding.top() + _dir->height();
|
||||
if (_dir->checked()) h += st::downloadPathSkip + _pathLink->height();
|
||||
|
@ -111,7 +102,7 @@ void DownloadPathBox::onChange() {
|
|||
} else {
|
||||
_path = QString();
|
||||
}
|
||||
showAll();
|
||||
updateControlsVisibility();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,8 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void updateControlsVisibility();
|
||||
void setPathText(const QString &text);
|
||||
|
||||
QString _path;
|
||||
|
|
|
@ -66,13 +66,6 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) {
|
|||
prepare();
|
||||
}
|
||||
|
||||
void LanguageBox::showAll() {
|
||||
_close->show();
|
||||
for (int32 i = 0, l = _langs.size(); i < l; ++i) {
|
||||
_langs[i]->show();
|
||||
}
|
||||
}
|
||||
|
||||
void LanguageBox::mousePressEvent(QMouseEvent *e) {
|
||||
if ((e->modifiers() & Qt::CTRL) && (e->modifiers() & Qt::ALT) && (e->modifiers() & Qt::SHIFT)) {
|
||||
for (int32 i = 1; i < languageCount; ++i) {
|
||||
|
|
|
@ -42,8 +42,6 @@ protected:
|
|||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
QVector<Ui::Radiobutton*> _langs;
|
||||
ChildWidget<Ui::RoundButton> _close;
|
||||
|
|
|
@ -38,6 +38,8 @@ LocalStorageBox::LocalStorageBox() : AbstractBox()
|
|||
|
||||
subscribe(FileDownload::ImageLoaded(), [this] { update(); });
|
||||
|
||||
updateControls();
|
||||
|
||||
checkLocalStoredCounts();
|
||||
prepare();
|
||||
}
|
||||
|
@ -56,11 +58,6 @@ void LocalStorageBox::updateControls() {
|
|||
update();
|
||||
}
|
||||
|
||||
void LocalStorageBox::showAll() {
|
||||
showChildren();
|
||||
_clear->setVisible(_imagesCount > 0 || _audiosCount > 0);
|
||||
}
|
||||
|
||||
void LocalStorageBox::checkLocalStoredCounts() {
|
||||
int imagesCount = Local::hasImages() + Local::hasStickers() + Local::hasWebFiles();
|
||||
int audiosCount = Local::hasAudios();
|
||||
|
|
|
@ -41,8 +41,6 @@ private slots:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void updateControls();
|
||||
void checkLocalStoredCounts();
|
||||
|
|
|
@ -30,13 +30,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "ui/widgets/input_fields.h"
|
||||
|
||||
PasscodeBox::PasscodeBox(bool turningOff) : AbstractBox(st::boxWidth)
|
||||
, _replacedBy(0)
|
||||
, _turningOff(turningOff)
|
||||
, _cloudPwd(false)
|
||||
, _setRequest(0)
|
||||
, _hasRecovery(false)
|
||||
, _skipEmailWarning(false)
|
||||
, _aboutHeight(0)
|
||||
, _about(st::boxWidth - st::boxPadding.left() * 1.5)
|
||||
, _saveButton(this, lang(_turningOff ? lng_passcode_remove_button : lng_settings_save), st::defaultBoxButton)
|
||||
, _cancelButton(this, lang(lng_cancel), st::cancelBoxButton)
|
||||
|
@ -47,19 +41,14 @@ PasscodeBox::PasscodeBox(bool turningOff) : AbstractBox(st::boxWidth)
|
|||
, _recoverEmail(this, st::defaultInputField, lang(lng_cloud_password_email))
|
||||
, _recover(this, lang(lng_signin_recover)) {
|
||||
init();
|
||||
prepare();
|
||||
}
|
||||
|
||||
PasscodeBox::PasscodeBox(const QByteArray &newSalt, const QByteArray &curSalt, bool hasRecovery, const QString &hint, bool turningOff) : AbstractBox(st::boxWidth)
|
||||
, _replacedBy(0)
|
||||
, _turningOff(turningOff)
|
||||
, _cloudPwd(true)
|
||||
, _setRequest(0)
|
||||
, _newSalt(newSalt)
|
||||
, _curSalt(curSalt)
|
||||
, _hasRecovery(hasRecovery)
|
||||
, _skipEmailWarning(false)
|
||||
, _aboutHeight(0)
|
||||
, _about(st::boxWidth - st::boxPadding.left() * 1.5)
|
||||
, _saveButton(this, lang(_turningOff ? lng_passcode_remove_button : lng_settings_save), st::defaultBoxButton)
|
||||
, _cancelButton(this, lang(lng_cancel), st::cancelBoxButton)
|
||||
|
@ -72,8 +61,8 @@ PasscodeBox::PasscodeBox(const QByteArray &newSalt, const QByteArray &curSalt, b
|
|||
textstyleSet(&st::usernameTextStyle);
|
||||
if (!hint.isEmpty()) _hintText.setText(st::normalFont, lng_signin_hint(lt_password_hint, hint));
|
||||
textstyleRestore();
|
||||
|
||||
init();
|
||||
prepare();
|
||||
}
|
||||
|
||||
void PasscodeBox::init() {
|
||||
|
@ -116,49 +105,16 @@ void PasscodeBox::init() {
|
|||
connect(_recoverEmail, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||
|
||||
connect(_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail()));
|
||||
}
|
||||
|
||||
void PasscodeBox::showAll() {
|
||||
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
|
||||
if (_turningOff) {
|
||||
_oldPasscode->show();
|
||||
if (_cloudPwd && _hasRecovery) {
|
||||
_recover->show();
|
||||
} else {
|
||||
_recover->hide();
|
||||
}
|
||||
_newPasscode->hide();
|
||||
_reenterPasscode->hide();
|
||||
_passwordHint->hide();
|
||||
_recoverEmail->hide();
|
||||
} else {
|
||||
if (has) {
|
||||
_oldPasscode->show();
|
||||
if (_cloudPwd && _hasRecovery) {
|
||||
_recover->show();
|
||||
} else {
|
||||
_recover->hide();
|
||||
}
|
||||
} else {
|
||||
_oldPasscode->hide();
|
||||
_recover->hide();
|
||||
}
|
||||
_newPasscode->show();
|
||||
_reenterPasscode->show();
|
||||
if (_cloudPwd) {
|
||||
_passwordHint->show();
|
||||
} else {
|
||||
_passwordHint->hide();
|
||||
}
|
||||
if (_cloudPwd && _curSalt.isEmpty()) {
|
||||
_recoverEmail->show();
|
||||
} else {
|
||||
_recoverEmail->hide();
|
||||
}
|
||||
}
|
||||
_saveButton->show();
|
||||
_cancelButton->show();
|
||||
AbstractBox::showAll();
|
||||
_oldPasscode->setVisible(_turningOff || has);
|
||||
_recover->setVisible((_turningOff || has) && _cloudPwd && _hasRecovery);
|
||||
_newPasscode->setVisible(!_turningOff);
|
||||
_reenterPasscode->setVisible(!_turningOff);
|
||||
_passwordHint->setVisible(!_turningOff && _cloudPwd);
|
||||
_recoverEmail->setVisible(!_turningOff && _cloudPwd && _curSalt.isEmpty());
|
||||
|
||||
prepare();
|
||||
}
|
||||
|
||||
void PasscodeBox::onSubmit() {
|
||||
|
@ -511,13 +467,6 @@ RecoverBox::RecoverBox(const QString &pattern) : AbstractBox(st::boxWidth)
|
|||
prepare();
|
||||
}
|
||||
|
||||
void RecoverBox::showAll() {
|
||||
_recoverCode->show();
|
||||
_saveButton->show();
|
||||
_cancelButton->show();
|
||||
AbstractBox::showAll();
|
||||
}
|
||||
|
||||
void RecoverBox::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
if (paint(p)) return;
|
||||
|
|
|
@ -54,7 +54,6 @@ signals:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
@ -69,14 +68,16 @@ private:
|
|||
void recover();
|
||||
QString _pattern;
|
||||
|
||||
AbstractBox *_replacedBy;
|
||||
bool _turningOff, _cloudPwd;
|
||||
mtpRequestId _setRequest;
|
||||
AbstractBox *_replacedBy = nullptr;
|
||||
bool _turningOff = false;
|
||||
bool _cloudPwd = false;
|
||||
mtpRequestId _setRequest = 0;
|
||||
|
||||
QByteArray _newSalt, _curSalt;
|
||||
bool _hasRecovery, _skipEmailWarning = false;
|
||||
bool _hasRecovery = false;
|
||||
bool _skipEmailWarning = false;
|
||||
|
||||
int32 _aboutHeight;
|
||||
int _aboutHeight = 0;
|
||||
|
||||
QString _boxTitle;
|
||||
Text _about, _hintText;
|
||||
|
@ -112,7 +113,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -304,8 +304,3 @@ void PhotoCropBox::onSend() {
|
|||
void PhotoCropBox::onReady(const QImage &tosend) {
|
||||
App::app()->uploadProfilePhoto(tosend, _peerId);
|
||||
}
|
||||
|
||||
void PhotoCropBox::showAll() {
|
||||
_done->show();
|
||||
_cancel->show();
|
||||
}
|
||||
|
|
|
@ -50,8 +50,6 @@ protected:
|
|||
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void init(const QImage &img, PeerData *peer);
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxW
|
|||
_statusw = qMax(_name.maxWidth(), st::normalFont->width(_status));
|
||||
_isImage = fileIsImage(_file->filename, _file->filemime);
|
||||
}
|
||||
|
||||
if (_file->type != PreparePhoto) {
|
||||
_compressed->hide();
|
||||
}
|
||||
|
@ -172,6 +173,7 @@ PhotoSendBox::PhotoSendBox(const QString &phone, const QString &fname, const QSt
|
|||
connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
|
||||
_compressed->hide();
|
||||
_caption->hide();
|
||||
|
||||
_name.setText(st::semiboldFont, lng_full_name(lt_first_name, _fname, lt_last_name, _lname), _textNameOptions);
|
||||
_status = _phone;
|
||||
|
@ -182,7 +184,6 @@ PhotoSendBox::PhotoSendBox(const QString &phone, const QString &fname, const QSt
|
|||
}
|
||||
|
||||
void PhotoSendBox::onCompressedChange() {
|
||||
showAll();
|
||||
if (_caption->isHidden()) {
|
||||
setFocus();
|
||||
} else {
|
||||
|
@ -313,20 +314,6 @@ void PhotoSendBox::closePressed() {
|
|||
}
|
||||
}
|
||||
|
||||
void PhotoSendBox::showAll() {
|
||||
_send->show();
|
||||
_cancel->show();
|
||||
if (_file) {
|
||||
if (_file->type == PreparePhoto) {
|
||||
_compressed->show();
|
||||
}
|
||||
_caption->show();
|
||||
} else {
|
||||
_caption->hide();
|
||||
_compressed->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void PhotoSendBox::doSetInnerFocus() {
|
||||
if (_caption->isHidden()) {
|
||||
setFocus();
|
||||
|
@ -630,12 +617,6 @@ void EditCaptionBox::resizeEvent(QResizeEvent *e) {
|
|||
AbstractBox::resizeEvent(e);
|
||||
}
|
||||
|
||||
void EditCaptionBox::showAll() {
|
||||
_save->show();
|
||||
_cancel->show();
|
||||
_field->show();
|
||||
}
|
||||
|
||||
void EditCaptionBox::doSetInnerFocus() {
|
||||
_field->setFocus();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ protected:
|
|||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void closePressed() override;
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
@ -95,7 +94,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -43,9 +43,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override {
|
||||
showChildren();
|
||||
}
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -32,7 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "styles/style_boxes.h"
|
||||
|
||||
SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
|
||||
, _loading(true)
|
||||
, _loading(false)
|
||||
, _inner(this, &_list, &_current)
|
||||
, _shadow(this)
|
||||
, _done(this, lang(lng_about_done), st::defaultBoxButton)
|
||||
|
@ -49,27 +49,25 @@ SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
|
|||
init(_inner, st::boxButtonPadding.bottom() + _done->height() + st::boxButtonPadding.top(), titleHeight());
|
||||
_inner->resize(width(), st::noContactsHeight);
|
||||
|
||||
setLoading(true);
|
||||
|
||||
prepare();
|
||||
|
||||
MTP::send(MTPaccount_GetAuthorizations(), rpcDone(&SessionsBox::gotAuthorizations));
|
||||
}
|
||||
|
||||
void SessionsBox::resizeEvent(QResizeEvent *e) {
|
||||
ScrollableBox::resizeEvent(e);
|
||||
_shadow.setGeometry(0, height() - st::boxButtonPadding.bottom() - _done->height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth);
|
||||
_done->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done->height());
|
||||
void SessionsBox::setLoading(bool loading) {
|
||||
if (_loading != loading) {
|
||||
_loading = loading;
|
||||
scrollArea()->setVisible(!_loading);
|
||||
_shadow->setVisible(!_loading);
|
||||
}
|
||||
}
|
||||
|
||||
void SessionsBox::showAll() {
|
||||
_done->show();
|
||||
if (_loading) {
|
||||
scrollArea()->hide();
|
||||
_shadow.hide();
|
||||
} else {
|
||||
scrollArea()->show();
|
||||
_shadow.show();
|
||||
}
|
||||
ScrollableBox::showAll();
|
||||
void SessionsBox::resizeEvent(QResizeEvent *e) {
|
||||
ScrollableBox::resizeEvent(e);
|
||||
_shadow->setGeometry(0, height() - st::boxButtonPadding.bottom() - _done->height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth);
|
||||
_done->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done->height());
|
||||
}
|
||||
|
||||
void SessionsBox::paintEvent(QPaintEvent *e) {
|
||||
|
@ -80,28 +78,33 @@ void SessionsBox::paintEvent(QPaintEvent *e) {
|
|||
p.translate(0, titleHeight());
|
||||
|
||||
if (_loading) {
|
||||
p.setFont(st::noContactsFont->f);
|
||||
p.setPen(st::noContactsColor->p);
|
||||
p.setFont(st::noContactsFont);
|
||||
p.setPen(st::noContactsColor);
|
||||
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_loading), style::al_center);
|
||||
}
|
||||
}
|
||||
|
||||
void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
|
||||
_loading = false;
|
||||
_shortPollRequest = 0;
|
||||
setLoading(false);
|
||||
|
||||
int32 availCurrent = st::boxWideWidth - st::sessionPadding.left() - st::sessionTerminateSkip;
|
||||
int32 availOther = availCurrent - st::sessionTerminate.iconPosition.x();// -st::sessionTerminate.width - st::sessionTerminateSkip;
|
||||
auto availCurrent = st::boxWideWidth - st::sessionPadding.left() - st::sessionTerminateSkip;
|
||||
auto availOther = availCurrent - st::sessionTerminate.iconPosition.x();// -st::sessionTerminate.width - st::sessionTerminateSkip;
|
||||
|
||||
_list.clear();
|
||||
const auto &v(result.c_account_authorizations().vauthorizations.c_vector().v);
|
||||
int32 l = v.size();
|
||||
if (l > 1) _list.reserve(l - 1);
|
||||
if (result.type() != mtpc_account_authorizations) {
|
||||
return;
|
||||
}
|
||||
auto &v = result.c_account_authorizations().vauthorizations.c_vector().v;
|
||||
_list.reserve(v.size());
|
||||
|
||||
const CountriesByISO2 &countries(countriesByISO2());
|
||||
|
||||
for (int32 i = 0; i < l; ++i) {
|
||||
const auto &d(v.at(i).c_authorization());
|
||||
for_const (auto &auth, v) {
|
||||
if (auth.type() != mtpc_authorization) {
|
||||
continue;
|
||||
}
|
||||
auto &d = auth.c_authorization();
|
||||
Data data;
|
||||
data.hash = d.vhash.v;
|
||||
|
||||
|
@ -195,30 +198,20 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
|
|||
}
|
||||
}
|
||||
_inner->listUpdated();
|
||||
if (!_done->isHidden()) {
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
_shortPollTimer.start(SessionsShortPollTimeout);
|
||||
}
|
||||
|
||||
void SessionsBox::onOneTerminated() {
|
||||
if (_list.isEmpty()) {
|
||||
if (!_done->isHidden()) {
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
void SessionsBox::onShortPollAuthorizations() {
|
||||
if (!_shortPollRequest) {
|
||||
_shortPollRequest = MTP::send(MTPaccount_GetAuthorizations(), rpcDone(&SessionsBox::gotAuthorizations));
|
||||
if (!_done->isHidden()) {
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,11 +229,7 @@ void SessionsBox::onAllTerminated() {
|
|||
}
|
||||
|
||||
void SessionsBox::onTerminateAll() {
|
||||
_loading = true;
|
||||
if (!_done->isHidden()) {
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
setLoading(true);
|
||||
}
|
||||
|
||||
SessionsBox::Inner::Inner(QWidget *parent, SessionsBox::List *list, SessionsBox::Data *current) : TWidget(parent)
|
||||
|
|
|
@ -48,9 +48,8 @@ protected:
|
|||
void resizeEvent(QResizeEvent *e) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void setLoading(bool loading);
|
||||
struct Data {
|
||||
uint64 hash;
|
||||
|
||||
|
@ -69,7 +68,7 @@ private:
|
|||
|
||||
class Inner;
|
||||
ChildWidget<Inner> _inner;
|
||||
ScrollableBoxShadow _shadow;
|
||||
ChildWidget<ScrollableBoxShadow> _shadow;
|
||||
ChildWidget<Ui::RoundButton> _done;
|
||||
|
||||
SingleTimer _shortPollTimer;
|
||||
|
|
|
@ -488,20 +488,6 @@ void StickersBox::onSave() {
|
|||
}
|
||||
}
|
||||
|
||||
void StickersBox::showAll() {
|
||||
if (_topShadow) {
|
||||
_topShadow->show();
|
||||
}
|
||||
if (_save) {
|
||||
_save->show();
|
||||
}
|
||||
if (_cancel) {
|
||||
_cancel->show();
|
||||
_bottomShadow->show();
|
||||
}
|
||||
ItemListBox::showAll();
|
||||
}
|
||||
|
||||
StickersBox::Inner::Inner(QWidget *parent, StickersBox::Section section) : TWidget(parent)
|
||||
, _section(section)
|
||||
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
||||
|
|
|
@ -62,7 +62,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
void closePressed() override;
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void setup();
|
||||
|
|
|
@ -57,6 +57,7 @@ StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::
|
|||
connect(_inner, SIGNAL(installed(uint64)), this, SLOT(onInstalled(uint64)));
|
||||
|
||||
onStickersUpdated();
|
||||
updateControlsVisibility();
|
||||
|
||||
onScroll();
|
||||
|
||||
|
@ -69,7 +70,7 @@ void StickerSetBox::onInstalled(uint64 setId) {
|
|||
}
|
||||
|
||||
void StickerSetBox::onStickersUpdated() {
|
||||
showAll();
|
||||
updateControlsVisibility();
|
||||
}
|
||||
|
||||
void StickerSetBox::onAddStickers() {
|
||||
|
@ -84,7 +85,7 @@ void StickerSetBox::onShareStickers() {
|
|||
|
||||
void StickerSetBox::onUpdateButtons() {
|
||||
if (!_cancel->isHidden() || !_done->isHidden()) {
|
||||
showAll();
|
||||
updateControlsVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,9 +95,7 @@ void StickerSetBox::onScroll() {
|
|||
_inner->setVisibleTopBottom(scrollTop, scrollTop + scroll->height());
|
||||
}
|
||||
|
||||
void StickerSetBox::showAll() {
|
||||
ScrollableBox::showAll();
|
||||
int32 cnt = _inner->notInstalled();
|
||||
void StickerSetBox::updateControlsVisibility() {
|
||||
if (_inner->loaded()) {
|
||||
_shadow.show();
|
||||
if (_inner->notInstalled()) {
|
||||
|
|
|
@ -54,9 +54,9 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void updateControlsVisibility();
|
||||
|
||||
class Inner;
|
||||
ChildWidget<Inner> _inner;
|
||||
ScrollableBoxShadow _shadow;
|
||||
|
|
|
@ -55,16 +55,9 @@ _about(st::boxWidth - st::usernamePadding.left()) {
|
|||
_checkTimer.setSingleShot(true);
|
||||
connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));
|
||||
|
||||
prepare();
|
||||
}
|
||||
|
||||
void UsernameBox::showAll() {
|
||||
_username->show();
|
||||
_save->show();
|
||||
_cancel->show();
|
||||
updateLinkText();
|
||||
|
||||
AbstractBox::showAll();
|
||||
prepare();
|
||||
}
|
||||
|
||||
void UsernameBox::doSetInnerFocus() {
|
||||
|
|
|
@ -46,7 +46,6 @@ protected:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void showAll() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -56,6 +56,31 @@ inline constexpr D up_cast(T object) {
|
|||
return internal::up_cast_helper<D>(std_::integral_constant<bool, std_::is_base_of<DV, TV>::value || std_::is_same<DV, TV>::value>(), object);
|
||||
}
|
||||
|
||||
template <typename Lambda>
|
||||
class scope_guard_helper {
|
||||
public:
|
||||
scope_guard_helper(Lambda on_scope_exit) : _handler(std_::move(on_scope_exit)) {
|
||||
}
|
||||
void dismiss() {
|
||||
_dismissed = true;
|
||||
}
|
||||
~scope_guard_helper() {
|
||||
if (!_dismissed) {
|
||||
_handler();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Lambda _handler;
|
||||
bool _dismissed = false;
|
||||
|
||||
};
|
||||
|
||||
template <typename Lambda>
|
||||
scope_guard_helper<Lambda> scope_guard(Lambda on_scope_exit) {
|
||||
return scope_guard_helper<Lambda>(std_::move(on_scope_exit));
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
template <typename Enum>
|
||||
|
|
|
@ -5679,11 +5679,12 @@ void HistoryWidget::leaveEvent(QEvent *e) {
|
|||
}
|
||||
|
||||
void HistoryWidget::mouseMoveEvent(QMouseEvent *e) {
|
||||
QPoint pos(e ? e->pos() : mapFromGlobal(QCursor::pos()));
|
||||
bool inRecord = _send->geometry().contains(pos);
|
||||
bool inField = pos.y() >= (_scroll->y() + _scroll->height()) && pos.y() < height() && pos.x() >= 0 && pos.x() < width();
|
||||
bool inReplyEdit = QRect(st::historyReplySkip, _field->y() - st::historySendPadding - st::historyReplyHeight, width() - st::historyReplySkip - _fieldBarCancel->width(), st::historyReplyHeight).contains(pos) && (_editMsgId || replyToId());
|
||||
bool inPinnedMsg = QRect(0, 0, width(), st::historyReplyHeight).contains(pos) && _pinnedBar;
|
||||
auto pos = e ? e->pos() : mapFromGlobal(QCursor::pos());
|
||||
auto inRecord = _send->geometry().contains(pos);
|
||||
auto inField = pos.y() >= (_scroll->y() + _scroll->height()) && pos.y() < height() && pos.x() >= 0 && pos.x() < width();
|
||||
auto inReplyEdit = QRect(st::historyReplySkip, _field->y() - st::historySendPadding - st::historyReplyHeight, width() - st::historyReplySkip - _fieldBarCancel->width(), st::historyReplyHeight).contains(pos) && (_editMsgId || replyToId());
|
||||
auto inPinnedMsg = QRect(0, 0, width(), st::historyReplyHeight).contains(pos) && _pinnedBar;
|
||||
auto inClickable = inRecord || inReplyEdit || inPinnedMsg;
|
||||
if (inRecord != _inRecord) {
|
||||
_inRecord = inRecord;
|
||||
update(_send->geometry());
|
||||
|
@ -5694,13 +5695,11 @@ void HistoryWidget::mouseMoveEvent(QMouseEvent *e) {
|
|||
a_recordCancelActive.start(_inField ? 0. : 1.);
|
||||
_a_record.start();
|
||||
}
|
||||
if (inReplyEdit != _inReplyEdit) {
|
||||
_inReplyEdit = inReplyEdit;
|
||||
setCursor(inReplyEdit ? style::cur_pointer : style::cur_default);
|
||||
}
|
||||
if (inPinnedMsg != _inPinnedMsg) {
|
||||
_inPinnedMsg = inPinnedMsg;
|
||||
setCursor(inPinnedMsg ? style::cur_pointer : style::cur_default);
|
||||
_inReplyEdit = inReplyEdit;
|
||||
_inPinnedMsg = inPinnedMsg;
|
||||
if (inClickable != _inClickable) {
|
||||
_inClickable = inClickable;
|
||||
setCursor(_inClickable ? style::cur_pointer : style::cur_default);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1103,6 +1103,7 @@ private:
|
|||
bool _inField = false;
|
||||
bool _inReplyEdit = false;
|
||||
bool _inPinnedMsg = false;
|
||||
bool _inClickable = false;
|
||||
anim::ivalue a_recordingLevel = { 0, 0 };
|
||||
int32 _recordingSamples = 0;
|
||||
anim::fvalue a_recordDown = { 0, 0 };
|
||||
|
|
|
@ -37,178 +37,315 @@ constexpr int kStickerPreviewEmojiLimit = 10;
|
|||
|
||||
} // namespace
|
||||
|
||||
void LayerWidget::setInnerFocus() {
|
||||
auto focused = App::wnd()->focusWidget();
|
||||
if (!isAncestorOf(focused)) {
|
||||
doSetInnerFocus();
|
||||
}
|
||||
}
|
||||
|
||||
class LayerStackWidget::BackgroundWidget : public TWidget {
|
||||
public:
|
||||
BackgroundWidget(QWidget *parent) : TWidget(parent)
|
||||
, _shadow(st::boxShadow) {
|
||||
}
|
||||
|
||||
void setBodyCache(QPixmap &&bodyCache) {
|
||||
_bodyCache = std_::move(bodyCache);
|
||||
void setDoneCallback(base::lambda_unique<void()> callback) {
|
||||
_doneCallback = std_::move(callback);
|
||||
}
|
||||
void setMainMenuCache(QPixmap &&mainMenuCache) {
|
||||
_mainMenuCache = std_::move(mainMenuCache);
|
||||
if (!_mainMenuCache.isNull()) {
|
||||
_mainMenuWidth = _mainMenuCache.width() / cIntRetinaFactor();
|
||||
_mainMenuRight = 0;
|
||||
}
|
||||
}
|
||||
void setMainMenuRight(int right) {
|
||||
_mainMenuRight = right;
|
||||
}
|
||||
void setLayerBox(const QRect &box, const QRect &hiddenSpecialBox) {
|
||||
_box = box;
|
||||
_hiddenSpecialBox = hiddenSpecialBox;
|
||||
update();
|
||||
}
|
||||
void setOpacity(float64 opacity) {
|
||||
_opacity = opacity;
|
||||
|
||||
void setLayerBoxes(const QRect &specialLayerBox, const QRect &layerBox);
|
||||
void setCacheImages(QPixmap &&bodyCache, QPixmap &&mainMenuCache, QPixmap &&specialLayerCache, QPixmap &&layerCache);
|
||||
void startAnimation(Action action);
|
||||
void finishAnimation();
|
||||
|
||||
bool animating() const {
|
||||
return _a_mainMenuShown.animating() || _a_specialLayerShown.animating() || _a_layerShown.animating();
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override {
|
||||
Painter p(this);
|
||||
|
||||
auto hasMainMenuCache = !_mainMenuCache.isNull();
|
||||
if (hasMainMenuCache || _mainMenuRight) {
|
||||
auto boxLeft = _mainMenuRight;
|
||||
auto cacheWidth = boxLeft * cIntRetinaFactor();
|
||||
if (left > 0 && hasMainMenuCache) {
|
||||
p.drawPixmapLeft(0, 0, width(), _mainMenuCache, rtlrect(_mainMenuCache.width() - cacheWidth, 0, cacheWidth, height() * cIntRetinaFactor(), _mainMenuCache.width()));
|
||||
}
|
||||
if (!_bodyCache.isNull()) {
|
||||
p.drawPixmapLeft(boxLeft, 0, width(), _bodyCache, rtlrect(cacheWidth, 0, _bodyCache.width() - cacheWidth, height() * cIntRetinaFactor(), _bodyCache.width() - cacheWidth));
|
||||
}
|
||||
_shadow.paint(p, QRect(0, 0, boxLeft, height()), 0, Ui::RectShadow::Side::Right);
|
||||
|
||||
p.setOpacity(_opacity);
|
||||
p.fillRect(myrtlrect(boxLeft, 0, width() - boxLeft, height()), st::layerBg);
|
||||
return;
|
||||
}
|
||||
if (!_bodyCache.isNull()) {
|
||||
p.drawPixmap(0, 0, _bodyCache);
|
||||
}
|
||||
p.setOpacity(_opacity);
|
||||
if (_box.isNull()) {
|
||||
p.fillRect(rect(), st::layerBg);
|
||||
} else {
|
||||
auto clip = QRegion(rect()) - _box;
|
||||
for (auto &r : clip.rects()) {
|
||||
p.fillRect(r, st::layerBg);
|
||||
}
|
||||
p.setClipRegion(clip);
|
||||
_shadow.paint(p, _box, st::boxShadowShift);
|
||||
if (!_hiddenSpecialBox.isNull()) {
|
||||
p.setClipRegion(QRegion(rect()) - _hiddenSpecialBox);
|
||||
_shadow.paint(p, _hiddenSpecialBox, st::boxShadowShift);
|
||||
}
|
||||
}
|
||||
}
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
private:
|
||||
bool isShown() const {
|
||||
return _mainMenuShown || _specialLayerShown || _layerShown;
|
||||
}
|
||||
void checkIfDone();
|
||||
void setMainMenuShown(bool shown);
|
||||
void setSpecialLayerShown(bool shown);
|
||||
void setLayerShown(bool shown);
|
||||
void checkWasShown(bool wasShown);
|
||||
void animationCallback();
|
||||
|
||||
QPixmap _bodyCache;
|
||||
QPixmap _mainMenuCache;
|
||||
int _mainMenuWidth = 0;
|
||||
int _mainMenuRight = 0;
|
||||
QPixmap _specialLayerCache;
|
||||
QPixmap _layerCache;
|
||||
|
||||
QRect _box, _hiddenSpecialBox;
|
||||
float64 _opacity = 0.;
|
||||
base::lambda_unique<void()> _doneCallback;
|
||||
|
||||
bool _wasAnimating = false;
|
||||
bool _inPaintEvent = false;
|
||||
FloatAnimation _a_shown;
|
||||
FloatAnimation _a_mainMenuShown;
|
||||
FloatAnimation _a_specialLayerShown;
|
||||
FloatAnimation _a_layerShown;
|
||||
|
||||
Ui::RectShadow _shadow;
|
||||
|
||||
QRect _specialLayerBox, _specialLayerCacheBox;
|
||||
QRect _layerBox, _layerCacheBox;
|
||||
int _mainMenuRight = 0;
|
||||
|
||||
bool _mainMenuShown = false;
|
||||
bool _specialLayerShown = false;
|
||||
bool _layerShown = false;
|
||||
|
||||
};
|
||||
|
||||
LayerStackWidget::LayerStackWidget(QWidget *parent) : TWidget(parent)
|
||||
, _background(this)
|
||||
, a_bg(0)
|
||||
, a_layer(0)
|
||||
, _a_background(animation(this, &LayerStackWidget::step_background)) {
|
||||
setGeometry(parentWidget()->rect());
|
||||
hide();
|
||||
void LayerStackWidget::BackgroundWidget::setCacheImages(QPixmap &&bodyCache, QPixmap &&mainMenuCache, QPixmap &&specialLayerCache, QPixmap &&layerCache) {
|
||||
_bodyCache = std_::move(bodyCache);
|
||||
_mainMenuCache = std_::move(mainMenuCache);
|
||||
_specialLayerCache = std_::move(specialLayerCache);
|
||||
_layerCache = std_::move(layerCache);
|
||||
_specialLayerCacheBox = _specialLayerBox;
|
||||
_layerCacheBox = _layerBox;
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, !_bodyCache.isNull());
|
||||
}
|
||||
|
||||
void LayerStackWidget::paintEvent(QPaintEvent *e) {
|
||||
if (!layer() && !_specialLayer && _layerCache.isNull()) {
|
||||
void LayerStackWidget::BackgroundWidget::startAnimation(Action action) {
|
||||
if (action == Action::ShowMainMenu) {
|
||||
setMainMenuShown(true);
|
||||
} else if (action != Action::HideLayer) {
|
||||
setMainMenuShown(false);
|
||||
}
|
||||
if (action == Action::ShowSpecialLayer) {
|
||||
setSpecialLayerShown(true);
|
||||
} else if (action == Action::ShowMainMenu || action == Action::HideAll) {
|
||||
setSpecialLayerShown(false);
|
||||
}
|
||||
if (action == Action::ShowLayer) {
|
||||
setLayerShown(true);
|
||||
} else {
|
||||
setLayerShown(false);
|
||||
}
|
||||
_wasAnimating = true;
|
||||
checkIfDone();
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::checkIfDone() {
|
||||
if (!_wasAnimating || _inPaintEvent || animating()) {
|
||||
return;
|
||||
}
|
||||
_wasAnimating = false;
|
||||
_bodyCache = _mainMenuCache = _specialLayerCache = _layerCache = QPixmap();
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||
if (_doneCallback) {
|
||||
_doneCallback();
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::setMainMenuShown(bool shown) {
|
||||
auto wasShown = isShown();
|
||||
if (_mainMenuShown != shown) {
|
||||
_mainMenuShown = shown;
|
||||
_a_mainMenuShown.start([this] { animationCallback(); }, _mainMenuShown ? 0. : 1., _mainMenuShown ? 1. : 0., st::boxDuration, anim::easeOutCirc);
|
||||
}
|
||||
_mainMenuRight = _mainMenuShown ? (_mainMenuCache.width() / cIntRetinaFactor()) : 0;
|
||||
checkWasShown(wasShown);
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::setSpecialLayerShown(bool shown) {
|
||||
auto wasShown = isShown();
|
||||
if (_specialLayerShown != shown) {
|
||||
_specialLayerShown = shown;
|
||||
_a_specialLayerShown.start([this] { animationCallback(); }, _specialLayerShown ? 0. : 1., _specialLayerShown ? 1. : 0., st::boxDuration);
|
||||
}
|
||||
checkWasShown(wasShown);
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::setLayerShown(bool shown) {
|
||||
auto wasShown = isShown();
|
||||
if (_layerShown != shown) {
|
||||
_layerShown = shown;
|
||||
_a_layerShown.start([this] { animationCallback(); }, _layerShown ? 0. : 1., _layerShown ? 1. : 0., st::boxDuration);
|
||||
}
|
||||
checkWasShown(wasShown);
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::checkWasShown(bool wasShown) {
|
||||
if (isShown() != wasShown) {
|
||||
_a_shown.start([this] { animationCallback(); }, wasShown ? 1. : 0., wasShown ? 0. : 1., st::boxDuration, anim::easeOutCirc);
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::setLayerBoxes(const QRect &specialLayerBox, const QRect &layerBox) {
|
||||
_specialLayerBox = specialLayerBox;
|
||||
_layerBox = layerBox;
|
||||
update();
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
_inPaintEvent = true;
|
||||
auto guard = base::scope_guard([this] {
|
||||
_inPaintEvent = false;
|
||||
checkIfDone();
|
||||
});
|
||||
|
||||
if (!_bodyCache.isNull()) {
|
||||
p.drawPixmap(0, 0, _bodyCache);
|
||||
}
|
||||
|
||||
auto specialLayerBox = _specialLayerCache.isNull() ? _specialLayerBox : _specialLayerCacheBox;
|
||||
auto layerBox = _layerCache.isNull() ? _layerBox : _layerCacheBox;
|
||||
|
||||
auto ms = getms();
|
||||
auto mainMenuProgress = _a_mainMenuShown.current(ms, -1);
|
||||
auto mainMenuRight = (_mainMenuCache.isNull() || mainMenuProgress < 0) ? _mainMenuRight : (mainMenuProgress < 0) ? _mainMenuRight : anim::interpolate(0, _mainMenuCache.width() / cIntRetinaFactor(), mainMenuProgress);
|
||||
if (mainMenuRight) {
|
||||
if (!_specialLayerCache.isNull()) {
|
||||
specialLayerBox.setX(specialLayerBox.x() + mainMenuRight / 2);
|
||||
}
|
||||
if (!_layerCache.isNull()) {
|
||||
layerBox.setX(layerBox.x() + mainMenuRight / 2);
|
||||
}
|
||||
}
|
||||
auto bgOpacity = _a_shown.current(ms, isShown() ? 1. : 0.);
|
||||
auto specialLayerOpacity = _a_specialLayerShown.current(ms, _specialLayerShown ? 1. : 0.);
|
||||
auto layerOpacity = _a_layerShown.current(ms, _layerShown ? 1. : 0.);
|
||||
if (bgOpacity == 0.) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_layerCache.isNull()) {
|
||||
Painter p(this);
|
||||
p.setClipRect(rect());
|
||||
p.setOpacity(a_layer.current());
|
||||
if (!_hiddenSpecialLayerCache.isNull()) {
|
||||
p.drawPixmap(_hiddenSpecialLayerCacheBox.topLeft(), _hiddenSpecialLayerCache);
|
||||
p.setOpacity(bgOpacity);
|
||||
auto bg = myrtlrect(mainMenuRight, 0, width() - mainMenuRight, height());
|
||||
p.fillRect(bg, st::layerBg);
|
||||
if (mainMenuRight > 0) {
|
||||
_shadow.paint(p, myrtlrect(0, 0, mainMenuRight, height()), 0, Ui::RectShadow::Side::Right);
|
||||
}
|
||||
if (!specialLayerBox.isEmpty()) {
|
||||
p.setClipRegion(QRegion(bg) - specialLayerBox);
|
||||
_shadow.paint(p, specialLayerBox, st::boxShadowShift);
|
||||
}
|
||||
|
||||
p.setClipping(false);
|
||||
if (!_specialLayerCache.isNull() && specialLayerOpacity > 0) {
|
||||
p.setOpacity(specialLayerOpacity);
|
||||
p.drawPixmap(specialLayerBox.topLeft(), _specialLayerCache);
|
||||
}
|
||||
if (!layerBox.isEmpty()) {
|
||||
if (!_specialLayerCache.isNull()) {
|
||||
p.setOpacity(layerOpacity * specialLayerOpacity);
|
||||
p.setClipRegion(QRegion(specialLayerBox) - layerBox);
|
||||
p.fillRect(specialLayerBox, st::layerBg);
|
||||
}
|
||||
p.drawPixmap(_layerCacheBox.topLeft(), _layerCache);
|
||||
p.setOpacity(layerOpacity);
|
||||
p.setClipRegion(QRegion(bg) - layerBox);
|
||||
_shadow.paint(p, layerBox, st::boxShadowShift);
|
||||
p.setClipping(false);
|
||||
}
|
||||
if (!_layerCache.isNull() && layerOpacity > 0) {
|
||||
p.setOpacity(layerOpacity);
|
||||
p.drawPixmap(layerBox.topLeft(), _layerCache);
|
||||
}
|
||||
if (!_mainMenuCache.isNull() && mainMenuRight > 0) {
|
||||
p.setOpacity(1.);
|
||||
auto shownWidth = mainMenuRight * cIntRetinaFactor();
|
||||
auto shownRect = rtlrect(_mainMenuCache.width() - shownWidth, 0, shownWidth, _mainMenuCache.height(), _mainMenuCache.width());
|
||||
p.drawPixmapLeft(0, 0, mainMenuRight, height(), width(), _mainMenuCache, shownRect);
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::finishAnimation() {
|
||||
_a_shown.finish();
|
||||
_a_mainMenuShown.finish();
|
||||
_a_specialLayerShown.finish();
|
||||
_a_layerShown.finish();
|
||||
checkIfDone();
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::animationCallback() {
|
||||
update();
|
||||
checkIfDone();
|
||||
}
|
||||
|
||||
LayerStackWidget::LayerStackWidget(QWidget *parent) : TWidget(parent)
|
||||
, _background(this) {
|
||||
setGeometry(parentWidget()->rect());
|
||||
hide();
|
||||
_background->setDoneCallback([this] { animationDone(); });
|
||||
}
|
||||
|
||||
void LayerWidget::setInnerFocus() {
|
||||
if (!isAncestorOf(App::wnd()->focusWidget())) {
|
||||
doSetInnerFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Escape) {
|
||||
onCloseCurrent();
|
||||
hideCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::mousePressEvent(QMouseEvent *e) {
|
||||
onCloseCurrent();
|
||||
hideCurrent();
|
||||
}
|
||||
|
||||
void LayerStackWidget::onCloseCurrent() {
|
||||
if (layer()) {
|
||||
onCloseLayers();
|
||||
} else {
|
||||
onClose();
|
||||
}
|
||||
void LayerStackWidget::hideCurrent() {
|
||||
return currentLayer() ? hideLayers() : hideAll();
|
||||
}
|
||||
|
||||
void LayerStackWidget::onCloseLayers() {
|
||||
if (_specialLayer) {
|
||||
void LayerStackWidget::hideLayers() {
|
||||
startAnimation([] {}, [this] {
|
||||
clearLayers();
|
||||
fixOrder();
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
} else {
|
||||
onClose();
|
||||
}, Action::HideLayer);
|
||||
}
|
||||
|
||||
void LayerStackWidget::hideAll() {
|
||||
startAnimation([] {}, [this] {
|
||||
clearLayers();
|
||||
_specialLayer.destroyDelayed();
|
||||
_mainMenu.destroyDelayed();
|
||||
}, Action::HideAll);
|
||||
}
|
||||
|
||||
void LayerStackWidget::setCacheImages() {
|
||||
auto bodyCache = QPixmap(), mainMenuCache = QPixmap();
|
||||
if (isAncestorOf(App::wnd()->focusWidget())) {
|
||||
setFocus();
|
||||
}
|
||||
if (_mainMenu) {
|
||||
hideChildren();
|
||||
bodyCache = myGrab(App::wnd()->bodyWidget());
|
||||
showChildren();
|
||||
mainMenuCache = myGrab(_mainMenu);
|
||||
}
|
||||
auto specialLayerCache = _specialLayer ? myGrab(_specialLayer) : QPixmap();
|
||||
auto layerCache = QPixmap();
|
||||
if (auto layer = currentLayer()) {
|
||||
layerCache = myGrab(layer);
|
||||
}
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, !bodyCache.isNull());
|
||||
updateLayerBoxes();
|
||||
_background->setCacheImages(std_::move(bodyCache), std_::move(mainMenuCache), std_::move(specialLayerCache), std_::move(layerCache));
|
||||
}
|
||||
|
||||
void LayerStackWidget::onClose() {
|
||||
startHide();
|
||||
}
|
||||
|
||||
void LayerStackWidget::onLayerClosed(LayerWidget *l) {
|
||||
l->deleteLater();
|
||||
if (l == _specialLayer) {
|
||||
onClose();
|
||||
_specialLayer = nullptr;
|
||||
} else if (l == layer()) {
|
||||
_layers.pop_back();
|
||||
if (auto newLayer = layer()) {
|
||||
l->hide();
|
||||
newLayer->parentResized();
|
||||
if (!_a_background.animating()) {
|
||||
newLayer->show();
|
||||
}
|
||||
} else if (_specialLayer) {
|
||||
l->hide();
|
||||
void LayerStackWidget::onLayerClosed(LayerWidget *layer) {
|
||||
layer->deleteLater();
|
||||
if (layer == _specialLayer) {
|
||||
hideAll();
|
||||
} else if (layer == currentLayer()) {
|
||||
if (_layers.size() == 1) {
|
||||
hideCurrent();
|
||||
} else {
|
||||
_layers.push_back(l); // For animation cache grab.
|
||||
onClose();
|
||||
layer->hide();
|
||||
_layers.pop_back();
|
||||
layer = currentLayer();
|
||||
layer->parentResized();
|
||||
if (!_background->animating()) {
|
||||
layer->show();
|
||||
showFinished();
|
||||
}
|
||||
}
|
||||
fixOrder();
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
updateLayerBox();
|
||||
sendFakeMouseEvent();
|
||||
} else {
|
||||
for (auto i = _layers.begin(), e = _layers.end(); i != e; ++i) {
|
||||
if (l == *i) {
|
||||
if (layer == *i) {
|
||||
_layers.erase(i);
|
||||
break;
|
||||
}
|
||||
|
@ -217,94 +354,35 @@ void LayerStackWidget::onLayerClosed(LayerWidget *l) {
|
|||
}
|
||||
|
||||
void LayerStackWidget::onLayerResized() {
|
||||
updateLayerBox();
|
||||
updateLayerBoxes();
|
||||
}
|
||||
|
||||
void LayerStackWidget::updateLayerBox() {
|
||||
void LayerStackWidget::updateLayerBoxes() {
|
||||
auto getLayerBox = [this]() {
|
||||
if (!_layerCache.isNull()) {
|
||||
return _layerCacheBox;
|
||||
} else if (auto l = layer()) {
|
||||
return l->geometry();
|
||||
} else if (_specialLayer) {
|
||||
return _specialLayer->geometry();
|
||||
if (auto layer = currentLayer()) {
|
||||
return layer->geometry();
|
||||
}
|
||||
return QRect();
|
||||
};
|
||||
auto getSpecialLayerBox = [this]() {
|
||||
if (!_layerCache.isNull()) {
|
||||
return _hiddenSpecialLayerCacheBox;
|
||||
} else if (auto l = layer()) {
|
||||
return _specialLayer ? _specialLayer->geometry() : QRect();
|
||||
}
|
||||
return QRect();
|
||||
return _specialLayer ? _specialLayer->geometry() : QRect();
|
||||
};
|
||||
_background->setLayerBox(getLayerBox(), getSpecialLayerBox());
|
||||
_background->setLayerBoxes(getSpecialLayerBox(), getLayerBox());
|
||||
update();
|
||||
}
|
||||
|
||||
void LayerStackWidget::startShow() {
|
||||
startAnimation(1);
|
||||
show();
|
||||
}
|
||||
|
||||
void LayerStackWidget::showFast() {
|
||||
if (_a_background.animating()) {
|
||||
_a_background.step(getms() + st::layerSlideDuration + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::startHide() {
|
||||
if (isHidden() || _hiding) {
|
||||
return;
|
||||
}
|
||||
_hiding = true;
|
||||
startAnimation(0);
|
||||
}
|
||||
|
||||
void LayerStackWidget::startAnimation(float64 toOpacity) {
|
||||
if (_mainMenu) {
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
hide();
|
||||
_background->setBodyCache(myGrab(App::wnd()->bodyWidget()));
|
||||
show();
|
||||
_mainMenu->hide();
|
||||
_background->setMainMenuCache(myGrab(_mainMenu));
|
||||
_background->setMainMenuRight(toOpacity ? 0 : _mainMenu->width());
|
||||
}
|
||||
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
a_bg.start(toOpacity);
|
||||
a_layer.start(toOpacity);
|
||||
_a_background.start();
|
||||
if (_layerCache.isNull()) {
|
||||
if (auto cacheLayer = layer() ? layer() : _specialLayer.ptr()) {
|
||||
_layerCache = myGrab(cacheLayer);
|
||||
_layerCacheBox = cacheLayer->geometry();
|
||||
if (layer() && _specialLayer) {
|
||||
_hiddenSpecialLayerCache = myGrab(_specialLayer);
|
||||
_hiddenSpecialLayerCacheBox = _specialLayer->geometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_specialLayer) {
|
||||
_specialLayer->hide();
|
||||
}
|
||||
if (auto l = layer()) {
|
||||
l->hide();
|
||||
}
|
||||
updateLayerBox();
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
void LayerStackWidget::finishAnimation() {
|
||||
_background->finishAnimation();
|
||||
}
|
||||
|
||||
bool LayerStackWidget::canSetFocus() const {
|
||||
return (layer() || _specialLayer || _mainMenu) && !_hiding;
|
||||
return (currentLayer() || _specialLayer || _mainMenu);
|
||||
}
|
||||
|
||||
void LayerStackWidget::setInnerFocus() {
|
||||
if (_a_background.animating()) {
|
||||
if (_background->animating()) {
|
||||
setFocus();
|
||||
} else if (auto l = layer()) {
|
||||
} else if (auto l = currentLayer()) {
|
||||
l->setInnerFocus();
|
||||
} else if (_specialLayer) {
|
||||
_specialLayer->setInnerFocus();
|
||||
|
@ -320,123 +398,179 @@ bool LayerStackWidget::contentOverlapped(const QRect &globalRect) {
|
|||
if (_specialLayer && _specialLayer->overlaps(globalRect)) {
|
||||
return true;
|
||||
}
|
||||
if (auto l = layer()) {
|
||||
return l->overlaps(globalRect);
|
||||
if (auto layer = currentLayer()) {
|
||||
return layer->overlaps(globalRect);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename SetupNew, typename ClearOld>
|
||||
void LayerStackWidget::startAnimation(SetupNew setupNewWidgets, ClearOld clearOldWidgets, Action action) {
|
||||
if (App::quitting()) return;
|
||||
|
||||
setupNewWidgets();
|
||||
setCacheImages();
|
||||
clearOldWidgets();
|
||||
prepareForAnimation();
|
||||
_background->startAnimation(action);
|
||||
}
|
||||
|
||||
void LayerStackWidget::resizeEvent(QResizeEvent *e) {
|
||||
_background->setGeometry(rect());
|
||||
if (_specialLayer) {
|
||||
_specialLayer->parentResized();
|
||||
}
|
||||
if (auto l = layer()) {
|
||||
l->parentResized();
|
||||
if (auto layer = currentLayer()) {
|
||||
layer->parentResized();
|
||||
}
|
||||
if (_mainMenu) {
|
||||
_mainMenu->resize(_mainMenu->width(), height());
|
||||
}
|
||||
updateLayerBox();
|
||||
updateLayerBoxes();
|
||||
}
|
||||
|
||||
void LayerStackWidget::showLayer(LayerWidget *l) {
|
||||
clearLayers();
|
||||
appendLayer(l);
|
||||
}
|
||||
void LayerStackWidget::showLayer(LayerWidget *layer) {
|
||||
appendLayer(layer);
|
||||
while (!_layers.isEmpty() && _layers.front() != layer) {
|
||||
auto removingLayer = _layers.front();
|
||||
_layers.pop_front();
|
||||
|
||||
void LayerStackWidget::showSpecialLayer(LayerWidget *l) {
|
||||
clearLayers();
|
||||
if (_specialLayer) {
|
||||
_specialLayer.destroyDelayed();
|
||||
removingLayer->hide();
|
||||
removingLayer->deleteLater();
|
||||
}
|
||||
_specialLayer = l;
|
||||
activateLayer(l);
|
||||
}
|
||||
|
||||
void LayerStackWidget::prepareForAnimation() {
|
||||
if (isHidden()) {
|
||||
show();
|
||||
}
|
||||
if (_mainMenu) {
|
||||
_mainMenu->hide();
|
||||
}
|
||||
if (_specialLayer) {
|
||||
_specialLayer->hide();
|
||||
}
|
||||
if (auto layer = currentLayer()) {
|
||||
layer->hide();
|
||||
}
|
||||
if (auto app = App::app()) {
|
||||
app->mtpPause();
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::animationDone() {
|
||||
bool hidden = true;
|
||||
if (_mainMenu) {
|
||||
_mainMenu->show();
|
||||
hidden = false;
|
||||
}
|
||||
if (_specialLayer) {
|
||||
_specialLayer->show();
|
||||
hidden = false;
|
||||
}
|
||||
if (auto layer = currentLayer()) {
|
||||
layer->show();
|
||||
hidden = false;
|
||||
}
|
||||
if (hidden) {
|
||||
App::wnd()->layerFinishedHide(this);
|
||||
} else {
|
||||
showFinished();
|
||||
}
|
||||
if (auto app = App::app()) {
|
||||
app->mtpUnpause();
|
||||
}
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||
}
|
||||
|
||||
void LayerStackWidget::showFinished() {
|
||||
fixOrder();
|
||||
sendFakeMouseEvent();
|
||||
updateLayerBoxes();
|
||||
if (_mainMenu) {
|
||||
_mainMenu->showFinished();
|
||||
}
|
||||
if (_specialLayer) {
|
||||
_specialLayer->showFinished();
|
||||
}
|
||||
if (auto layer = currentLayer()) {
|
||||
layer->showFinished();
|
||||
}
|
||||
if (auto window = App::wnd()) {
|
||||
window->setInnerFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::showSpecialLayer(LayerWidget *layer) {
|
||||
startAnimation([this, layer] {
|
||||
_specialLayer.destroyDelayed();
|
||||
_specialLayer = layer;
|
||||
initChildLayer(_specialLayer);
|
||||
}, [this] {
|
||||
clearLayers();
|
||||
_mainMenu.destroyDelayed();
|
||||
}, Action::ShowSpecialLayer);
|
||||
}
|
||||
|
||||
void LayerStackWidget::showMainMenu() {
|
||||
clearLayers();
|
||||
if (_specialLayer) {
|
||||
startAnimation([this] {
|
||||
_mainMenu.create(this);
|
||||
_mainMenu->setGeometryToLeft(0, 0, _mainMenu->width(), height());
|
||||
_mainMenu->setParent(this);
|
||||
}, [this] {
|
||||
clearLayers();
|
||||
_specialLayer.destroyDelayed();
|
||||
}
|
||||
_mainMenu.create(this);
|
||||
_mainMenu->setGeometryToLeft(0, 0, _mainMenu->width(), height());
|
||||
|
||||
_mainMenu->setParent(this);
|
||||
fixOrder();
|
||||
|
||||
if (isHidden()) {
|
||||
startShow();
|
||||
} else {
|
||||
_mainMenu->show();
|
||||
_mainMenu->showFinished();
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
updateLayerBox();
|
||||
}
|
||||
fixOrder();
|
||||
sendFakeMouseEvent();
|
||||
}, Action::ShowMainMenu);
|
||||
}
|
||||
|
||||
void LayerStackWidget::appendLayer(LayerWidget *l) {
|
||||
if (auto oldLayer = layer()) {
|
||||
void LayerStackWidget::appendLayer(LayerWidget *layer) {
|
||||
auto oldLayer = currentLayer();
|
||||
if (oldLayer) {
|
||||
oldLayer->hide();
|
||||
}
|
||||
_layers.push_back(l);
|
||||
activateLayer(l);
|
||||
_layers.push_back(layer);
|
||||
initChildLayer(layer);
|
||||
|
||||
if (_layers.size() > 1) {
|
||||
if (!_background->animating()) {
|
||||
layer->show();
|
||||
showFinished();
|
||||
}
|
||||
} else {
|
||||
startAnimation([] {}, [this] {
|
||||
_mainMenu.destroyDelayed();
|
||||
}, Action::ShowLayer);
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::prependLayer(LayerWidget *l) {
|
||||
void LayerStackWidget::prependLayer(LayerWidget *layer) {
|
||||
if (_layers.empty()) {
|
||||
showLayer(l);
|
||||
} else {
|
||||
l->hide();
|
||||
_layers.push_front(l);
|
||||
initChildLayer(l);
|
||||
return showLayer(layer);
|
||||
}
|
||||
layer->hide();
|
||||
_layers.push_front(layer);
|
||||
initChildLayer(layer);
|
||||
}
|
||||
|
||||
void LayerStackWidget::clearLayers() {
|
||||
for_const (auto oldLayer, _layers) {
|
||||
oldLayer->hide();
|
||||
oldLayer->deleteLater();
|
||||
for (auto layer : base::take(_layers)) {
|
||||
layer->hide();
|
||||
layer->deleteLater();
|
||||
}
|
||||
_layers.clear();
|
||||
updateLayerBox();
|
||||
sendFakeMouseEvent();
|
||||
}
|
||||
|
||||
void LayerStackWidget::initChildLayer(LayerWidget *l) {
|
||||
l->setParent(this);
|
||||
connect(l, SIGNAL(closed(LayerWidget*)), this, SLOT(onLayerClosed(LayerWidget*)));
|
||||
connect(l, SIGNAL(resized()), this, SLOT(onLayerResized()));
|
||||
connect(l, SIGNAL(destroyed(QObject*)), this, SLOT(onLayerDestroyed(QObject*)));
|
||||
l->parentResized();
|
||||
fixOrder();
|
||||
}
|
||||
|
||||
void LayerStackWidget::activateLayer(LayerWidget *l) {
|
||||
if (_mainMenu) {
|
||||
_mainMenu.destroyDelayed();
|
||||
_background->setMainMenuRight(0);
|
||||
_background->setMainMenuCache(QPixmap());
|
||||
}
|
||||
initChildLayer(l);
|
||||
if (isHidden()) {
|
||||
startShow();
|
||||
} else {
|
||||
l->show();
|
||||
l->showDone();
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
updateLayerBox();
|
||||
}
|
||||
fixOrder();
|
||||
sendFakeMouseEvent();
|
||||
void LayerStackWidget::initChildLayer(LayerWidget *layer) {
|
||||
layer->setParent(this);
|
||||
connect(layer, SIGNAL(closed(LayerWidget*)), this, SLOT(onLayerClosed(LayerWidget*)));
|
||||
connect(layer, SIGNAL(resized()), this, SLOT(onLayerResized()));
|
||||
connect(layer, SIGNAL(destroyed(QObject*)), this, SLOT(onLayerDestroyed(QObject*)));
|
||||
layer->parentResized();
|
||||
}
|
||||
|
||||
void LayerStackWidget::fixOrder() {
|
||||
if (auto l = layer()) {
|
||||
if (auto layer = currentLayer()) {
|
||||
_background->raise();
|
||||
l->raise();
|
||||
layer->raise();
|
||||
} else if (_specialLayer) {
|
||||
_specialLayer->raise();
|
||||
}
|
||||
|
@ -449,72 +583,21 @@ void LayerStackWidget::sendFakeMouseEvent() {
|
|||
sendSynteticMouseEvent(this, QEvent::MouseMove, Qt::NoButton);
|
||||
}
|
||||
|
||||
void LayerStackWidget::step_background(float64 ms, bool timer) {
|
||||
float64 dt = ms / (_hiding ? st::layerHideDuration : st::layerSlideDuration);
|
||||
if (dt >= 1) {
|
||||
a_bg.finish();
|
||||
a_layer.finish();
|
||||
_a_background.stop();
|
||||
_layerCache = _hiddenSpecialLayerCache = QPixmap();
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||
_background->setBodyCache(QPixmap());
|
||||
if (_hiding) {
|
||||
App::wnd()->layerFinishedHide(this);
|
||||
if (_mainMenu) {
|
||||
_background->setMainMenuRight(0);
|
||||
_background->setMainMenuCache(QPixmap());
|
||||
_mainMenu.destroyDelayed();
|
||||
}
|
||||
} else {
|
||||
if (_specialLayer) {
|
||||
_specialLayer->show();
|
||||
_specialLayer->showDone();
|
||||
}
|
||||
if (auto l = layer()) {
|
||||
l->show();
|
||||
l->showDone();
|
||||
}
|
||||
if (_mainMenu) {
|
||||
_background->setMainMenuRight(_mainMenu->width());
|
||||
_background->setMainMenuCache(QPixmap());
|
||||
_mainMenu->show();
|
||||
_mainMenu->showFinished();
|
||||
}
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
}
|
||||
updateLayerBox();
|
||||
if (App::app()) App::app()->mtpUnpause();
|
||||
} else {
|
||||
a_bg.update(dt, anim::easeOutCirc);
|
||||
a_layer.update(dt, anim::linear);
|
||||
if (_mainMenu) {
|
||||
_background->setMainMenuRight(a_bg.current() * _mainMenu->width());
|
||||
}
|
||||
}
|
||||
_background->setOpacity(a_bg.current());
|
||||
if (timer) {
|
||||
_background->update();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void LayerStackWidget::onLayerDestroyed(QObject *obj) {
|
||||
if (obj == _specialLayer) {
|
||||
_specialLayer = nullptr;
|
||||
onClose();
|
||||
} else if (obj == layer()) {
|
||||
hideAll();
|
||||
} else if (obj == currentLayer()) {
|
||||
_layers.pop_back();
|
||||
if (auto newLayer = layer()) {
|
||||
if (auto newLayer = currentLayer()) {
|
||||
newLayer->parentResized();
|
||||
if (!_a_background.animating()) {
|
||||
if (!_background->animating()) {
|
||||
newLayer->show();
|
||||
showFinished();
|
||||
}
|
||||
} else if (!_specialLayer) {
|
||||
onClose();
|
||||
hideAll();
|
||||
}
|
||||
fixOrder();
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
updateLayerBox();
|
||||
} else {
|
||||
for (auto i = _layers.begin(), e = _layers.end(); i != e; ++i) {
|
||||
if (obj == *i) {
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
using TWidget::TWidget;
|
||||
|
||||
virtual void parentResized() = 0;
|
||||
virtual void showDone() {
|
||||
virtual void showFinished() {
|
||||
}
|
||||
void setInnerFocus();
|
||||
|
||||
|
@ -65,55 +65,63 @@ class LayerStackWidget : public TWidget {
|
|||
public:
|
||||
LayerStackWidget(QWidget *parent);
|
||||
|
||||
void showFast();
|
||||
void finishAnimation();
|
||||
|
||||
void showLayer(LayerWidget *l);
|
||||
void showSpecialLayer(LayerWidget *l);
|
||||
void showLayer(LayerWidget *layer);
|
||||
void showSpecialLayer(LayerWidget *layer);
|
||||
void showMainMenu();
|
||||
void appendLayer(LayerWidget *l);
|
||||
void prependLayer(LayerWidget *l);
|
||||
void appendLayer(LayerWidget *layer);
|
||||
void prependLayer(LayerWidget *layer);
|
||||
|
||||
bool canSetFocus() const;
|
||||
void setInnerFocus();
|
||||
|
||||
bool contentOverlapped(const QRect &globalRect);
|
||||
|
||||
void onCloseCurrent();
|
||||
void onCloseLayers();
|
||||
void onClose();
|
||||
void hideLayers();
|
||||
void hideAll();
|
||||
|
||||
~LayerStackWidget();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
private slots:
|
||||
void onLayerDestroyed(QObject *obj);
|
||||
void onLayerClosed(LayerWidget *l);
|
||||
void onLayerClosed(LayerWidget *layer);
|
||||
void onLayerResized();
|
||||
|
||||
private:
|
||||
void showFinished();
|
||||
void hideCurrent();
|
||||
|
||||
enum class Action {
|
||||
ShowMainMenu,
|
||||
ShowSpecialLayer,
|
||||
ShowLayer,
|
||||
HideLayer,
|
||||
HideAll,
|
||||
};
|
||||
template <typename SetupNew, typename ClearOld>
|
||||
void startAnimation(SetupNew setupNewWidgets, ClearOld clearOldWidgets, Action action);
|
||||
|
||||
void prepareForAnimation();
|
||||
void animationDone();
|
||||
|
||||
void setCacheImages();
|
||||
void clearLayers();
|
||||
void initChildLayer(LayerWidget *l);
|
||||
void activateLayer(LayerWidget *l);
|
||||
void updateLayerBox();
|
||||
void initChildLayer(LayerWidget *layer);
|
||||
void updateLayerBoxes();
|
||||
void fixOrder();
|
||||
void sendFakeMouseEvent();
|
||||
|
||||
void startShow();
|
||||
void startHide();
|
||||
void startAnimation(float64 toOpacity);
|
||||
|
||||
void step_background(float64 ms, bool timer);
|
||||
|
||||
LayerWidget *layer() {
|
||||
LayerWidget *currentLayer() {
|
||||
return _layers.empty() ? nullptr : _layers.back();
|
||||
}
|
||||
const LayerWidget *layer() const {
|
||||
return const_cast<LayerStackWidget*>(this)->layer();
|
||||
const LayerWidget *currentLayer() const {
|
||||
return const_cast<LayerStackWidget*>(this)->currentLayer();
|
||||
}
|
||||
|
||||
using Layers = QList<LayerWidget*>;
|
||||
|
@ -125,16 +133,6 @@ private:
|
|||
class BackgroundWidget;
|
||||
ChildWidget<BackgroundWidget> _background;
|
||||
|
||||
anim::fvalue a_bg, a_layer;
|
||||
Animation _a_background;
|
||||
|
||||
QPixmap _layerCache;
|
||||
QRect _layerCacheBox;
|
||||
QPixmap _hiddenSpecialLayerCache;
|
||||
QRect _hiddenSpecialLayerCacheBox;
|
||||
|
||||
bool _hiding = false;
|
||||
|
||||
};
|
||||
|
||||
class MediaPreviewWidget : public TWidget, private base::Subscriber {
|
||||
|
|
|
@ -421,7 +421,7 @@ void MainWindow::showMainMenu() {
|
|||
|
||||
void MainWindow::ui_hideSettingsAndLayer(ShowLayerOptions options) {
|
||||
if (_layerBg) {
|
||||
_layerBg->onClose();
|
||||
_layerBg->hideAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -498,14 +498,14 @@ void MainWindow::ui_showLayer(LayerWidget *box, ShowLayerOptions options) {
|
|||
_layerBg->showLayer(box);
|
||||
}
|
||||
if (options.testFlag(ForceFastShowLayer)) {
|
||||
_layerBg->showFast();
|
||||
_layerBg->finishAnimation();
|
||||
}
|
||||
} else {
|
||||
if (_layerBg) {
|
||||
if (_settings) {
|
||||
_layerBg->onCloseLayers();
|
||||
_layerBg->hideLayers();
|
||||
} else {
|
||||
_layerBg->onClose();
|
||||
_layerBg->hideAll();
|
||||
if (options.testFlag(ForceFastShowLayer)) {
|
||||
_layerBg.destroyDelayed();
|
||||
}
|
||||
|
@ -606,6 +606,7 @@ void MainWindow::layerHidden() {
|
|||
_layerBg.destroyDelayed();
|
||||
hideMediaview();
|
||||
setInnerFocus();
|
||||
checkHistoryActivation();
|
||||
}
|
||||
|
||||
void MainWindow::onReActivate() {
|
||||
|
@ -1469,13 +1470,9 @@ MainWindow::~MainWindow() {
|
|||
_clearManager->stop();
|
||||
_clearManager = nullptr;
|
||||
}
|
||||
delete _connecting;
|
||||
delete _mediaView;
|
||||
delete trayIcon;
|
||||
delete trayIconMenu;
|
||||
delete _intro;
|
||||
delete _main;
|
||||
delete _settings;
|
||||
}
|
||||
|
||||
PreLaunchWindow *PreLaunchWindowInstance = 0;
|
||||
|
|
|
@ -64,8 +64,7 @@ void AdvancedWidget::createControls() {
|
|||
if (self()) {
|
||||
addChildRow(_askQuestion, marginSmall, lang(lng_settings_ask_question), SLOT(onAskQuestion()));
|
||||
}
|
||||
addChildRow(_telegramFAQ, marginSmall, lang(lng_settings_faq), SLOT(onTelegramFAQ()));
|
||||
addChildRow(_about, marginLarge, lang(lng_menu_about), SLOT(onAbout()));
|
||||
addChildRow(_telegramFAQ, marginLarge, lang(lng_settings_faq), SLOT(onTelegramFAQ()));
|
||||
if (self()) {
|
||||
style::margins marginLogout(0, 0, 0, 2 * st::settingsLargeSkip);
|
||||
addChildRow(_logOut, marginLogout, lang(lng_settings_logout), SLOT(onLogOut()));
|
||||
|
@ -125,13 +124,8 @@ void AdvancedWidget::onTelegramFAQ() {
|
|||
QDesktopServices::openUrl(telegramFaqLink());
|
||||
}
|
||||
|
||||
void AdvancedWidget::onAbout() {
|
||||
Ui::showLayer(new AboutBox());
|
||||
}
|
||||
|
||||
void AdvancedWidget::onLogOut() {
|
||||
App::wnd()->onLogout();
|
||||
}
|
||||
|
||||
|
||||
} // namespace Settings
|
||||
|
|
|
@ -39,7 +39,6 @@ private slots:
|
|||
void onAskQuestion();
|
||||
void onAskQuestionSure();
|
||||
void onTelegramFAQ();
|
||||
void onAbout();
|
||||
void onLogOut();
|
||||
|
||||
private:
|
||||
|
@ -55,7 +54,6 @@ private:
|
|||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
ChildWidget<Ui::LinkButton> _askQuestion = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _telegramFAQ = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _about = { nullptr };
|
||||
ChildWidget<Ui::LinkButton> _logOut = { nullptr };
|
||||
|
||||
mtpRequestId _supportGetRequest = 0;
|
||||
|
|
|
@ -64,6 +64,9 @@ void InnerWidget::refreshBlocks() {
|
|||
}
|
||||
_blocks.clear();
|
||||
|
||||
if (App::quitting()) {
|
||||
return;
|
||||
}
|
||||
if (_self) {
|
||||
_cover = new CoverWidget(this, _self);
|
||||
_blocks.push_back(new InfoWidget(this, _self));
|
||||
|
|
|
@ -193,7 +193,7 @@ void Widget::resizeUsingInnerHeight(int newWidth, int newContentLeft) {
|
|||
update();
|
||||
}
|
||||
|
||||
void Widget::showDone() {
|
||||
void Widget::showFinished() {
|
||||
_inner->showFinished();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
Widget(QWidget *parent);
|
||||
|
||||
void parentResized() override;
|
||||
void showDone() override;
|
||||
void showFinished() override;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
|
|
@ -246,12 +246,6 @@ void CountrySelectBox::resizeEvent(QResizeEvent *e) {
|
|||
_topShadow.setGeometry(0, titleHeight() + _select->height(), width(), st::lineWidth);
|
||||
}
|
||||
|
||||
void CountrySelectBox::showAll() {
|
||||
_select->show();
|
||||
_topShadow.show();
|
||||
ItemListBox::showAll();
|
||||
}
|
||||
|
||||
void CountrySelectBox::onFilterUpdate(const QString &query) {
|
||||
scrollArea()->scrollToY(0);
|
||||
_inner->updateFilter(query);
|
||||
|
|
|
@ -83,7 +83,6 @@ protected:
|
|||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void doSetInnerFocus() override;
|
||||
void showAll() override;
|
||||
|
||||
private:
|
||||
void onFilterUpdate(const QString &query);
|
||||
|
|
|
@ -141,7 +141,7 @@ void WarningWidget::startAnimation(bool hiding) {
|
|||
_hiddenCallback();
|
||||
}
|
||||
}
|
||||
}, _hiding ? 1. : 0., _hiding ? 0. : 1., st::layerSlideDuration);
|
||||
}, _hiding ? 1. : 0., _hiding ? 0. : 1., st::boxDuration);
|
||||
}
|
||||
|
||||
} // namespace Theme
|
||||
|
|
Loading…
Add table
Reference in a new issue