mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-16 04:02:09 +00:00
Return Saved Messages button to the main menu.
This commit is contained in:
parent
0227b5f2fa
commit
1bd0b03e8e
@ -491,6 +491,7 @@ MainMenu::MainMenu(
|
||||
st::mainMenuUserpic)
|
||||
, _toggleAccounts(this)
|
||||
, _archiveButton(this, st::mainMenuCloudButton)
|
||||
, _cloudButton(this, st::mainMenuCloudButton)
|
||||
, _scroll(this, st::defaultSolidScroll)
|
||||
, _inner(_scroll->setOwnedWidget(
|
||||
object_ptr<Ui::VerticalLayout>(_scroll.data())))
|
||||
@ -513,6 +514,7 @@ MainMenu::MainMenu(
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
|
||||
setupArchiveButton();
|
||||
setupCloudButton();
|
||||
setupUserpicButton();
|
||||
setupAccountsToggle();
|
||||
setupAccounts();
|
||||
@ -632,6 +634,15 @@ void MainMenu::setupArchiveButton() {
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void MainMenu::setupCloudButton() {
|
||||
_cloudButton->setClickedCallback([=] {
|
||||
_controller->content()->choosePeer(
|
||||
_controller->session().userPeerId(),
|
||||
ShowAtUnreadMsgId);
|
||||
});
|
||||
_cloudButton->show();
|
||||
}
|
||||
|
||||
void MainMenu::setupUserpicButton() {
|
||||
_userpicButton->setClickedCallback([=] {
|
||||
_controller->content()->choosePeer(
|
||||
@ -944,13 +955,22 @@ void MainMenu::resizeEvent(QResizeEvent *e) {
|
||||
}
|
||||
|
||||
void MainMenu::updateControlsGeometry() {
|
||||
_userpicButton->moveToLeft(st::mainMenuUserpicLeft, st::mainMenuUserpicTop);
|
||||
_userpicButton->moveToLeft(
|
||||
st::mainMenuUserpicLeft,
|
||||
st::mainMenuUserpicTop);
|
||||
if (_resetScaleButton) {
|
||||
_resetScaleButton->moveToRight(0, 0);
|
||||
_archiveButton->moveToRight(_resetScaleButton->width(), 0);
|
||||
_cloudButton->moveToRight(_resetScaleButton->width(), 0);
|
||||
_archiveButton->moveToRight(
|
||||
_resetScaleButton->width() + _cloudButton->width(),
|
||||
0);
|
||||
} else {
|
||||
const auto offset = st::mainMenuCloudSize / 4;
|
||||
_archiveButton->moveToRight(offset, offset);
|
||||
const auto right = st::mainMenuTogglePosition.x()
|
||||
- (_cloudButton->width() / 2);
|
||||
const auto top = st::mainMenuUserpicTop
|
||||
- (_cloudButton->height() - st::mainMenuCloudSize) / 2;
|
||||
_cloudButton->moveToRight(right, top);
|
||||
_archiveButton->moveToRight(right + _cloudButton->width(), top);
|
||||
}
|
||||
_toggleAccounts->setGeometry(
|
||||
0,
|
||||
@ -1012,6 +1032,18 @@ void MainMenu::paintEvent(QPaintEvent *e) {
|
||||
p.setFont(st::normalFont);
|
||||
p.drawTextLeft(st::mainMenuCoverTextLeft, st::mainMenuCoverStatusTop, width(), _phoneText);
|
||||
|
||||
// Draw Saved Messages button.
|
||||
if (!_cloudButton->isHidden()) {
|
||||
Ui::EmptyUserpic::PaintSavedMessages(
|
||||
p,
|
||||
_cloudButton->x() + (_cloudButton->width() - st::mainMenuCloudSize) / 2,
|
||||
_cloudButton->y() + (_cloudButton->height() - st::mainMenuCloudSize) / 2,
|
||||
width(),
|
||||
st::mainMenuCloudSize,
|
||||
isFill ? st::mainMenuCloudBg : st::msgServiceBg,
|
||||
isFill ? st::mainMenuCloudFg : st::msgServiceFg);
|
||||
}
|
||||
|
||||
// Draw Archive button.
|
||||
if (!_archiveButton->isHidden()) {
|
||||
const auto folder = _controller->session().data().folderLoaded(
|
||||
|
@ -55,6 +55,7 @@ private:
|
||||
class ResetScaleButton;
|
||||
|
||||
void setupArchiveButton();
|
||||
void setupCloudButton();
|
||||
void setupUserpicButton();
|
||||
void setupAccounts();
|
||||
void setupAccountsToggle();
|
||||
@ -72,6 +73,7 @@ private:
|
||||
object_ptr<Ui::UserpicButton> _userpicButton;
|
||||
object_ptr<ToggleAccountsButton> _toggleAccounts;
|
||||
object_ptr<Ui::IconButton> _archiveButton;
|
||||
object_ptr<Ui::IconButton> _cloudButton;
|
||||
object_ptr<ResetScaleButton> _resetScaleButton = { nullptr };
|
||||
object_ptr<Ui::ScrollArea> _scroll;
|
||||
not_null<Ui::VerticalLayout*> _inner;
|
||||
|
Loading…
Reference in New Issue
Block a user