2016-11-11 19:51:59 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-11-11 19:51:59 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-11-11 19:51:59 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-06-29 19:09:10 +00:00
|
|
|
#include "base/timer.h"
|
2019-09-13 12:22:54 +00:00
|
|
|
#include "base/object_ptr.h"
|
2020-06-22 13:01:41 +00:00
|
|
|
#include "base/binary_guard.h"
|
2018-10-20 19:04:10 +00:00
|
|
|
#include "ui/rp_widget.h"
|
2019-09-18 11:19:05 +00:00
|
|
|
#include "ui/layers/layer_widget.h"
|
2017-06-29 19:09:10 +00:00
|
|
|
|
2016-11-11 19:51:59 +00:00
|
|
|
namespace Ui {
|
2017-04-05 09:21:38 +00:00
|
|
|
class IconButton;
|
2016-11-16 10:44:06 +00:00
|
|
|
class FlatLabel;
|
|
|
|
class UserpicButton;
|
2019-05-16 08:39:45 +00:00
|
|
|
class PopupMenu;
|
2020-06-22 13:01:41 +00:00
|
|
|
class ScrollArea;
|
|
|
|
class VerticalLayout;
|
|
|
|
class RippleButton;
|
|
|
|
class PlainShadow;
|
2022-02-09 13:54:16 +00:00
|
|
|
class SettingsButton;
|
2020-06-22 13:01:41 +00:00
|
|
|
template <typename Widget>
|
|
|
|
class SlideWrap;
|
2017-11-13 15:50:10 +00:00
|
|
|
} // namespace Ui
|
2016-11-16 10:44:06 +00:00
|
|
|
|
2020-06-22 13:01:41 +00:00
|
|
|
namespace Main {
|
|
|
|
class Account;
|
|
|
|
} // namespace Main
|
|
|
|
|
2016-11-11 19:51:59 +00:00
|
|
|
namespace Window {
|
|
|
|
|
2019-06-06 10:21:40 +00:00
|
|
|
class SessionController;
|
2017-11-13 15:50:10 +00:00
|
|
|
|
2021-07-15 11:12:38 +00:00
|
|
|
class MainMenu final : public Ui::LayerWidget {
|
2016-11-11 19:51:59 +00:00
|
|
|
public:
|
2019-06-06 10:21:40 +00:00
|
|
|
MainMenu(QWidget *parent, not_null<SessionController*> controller);
|
2016-11-11 19:51:59 +00:00
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
void parentResized() override;
|
2016-11-16 10:44:06 +00:00
|
|
|
|
2016-11-11 19:51:59 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
void doSetInnerFocus() override {
|
|
|
|
setFocus();
|
|
|
|
}
|
|
|
|
|
2016-11-11 19:51:59 +00:00
|
|
|
private:
|
2020-06-22 14:33:35 +00:00
|
|
|
class ToggleAccountsButton;
|
2020-06-22 13:01:41 +00:00
|
|
|
class ResetScaleButton;
|
|
|
|
|
|
|
|
void setupUserpicButton();
|
|
|
|
void setupAccounts();
|
2020-06-22 14:33:35 +00:00
|
|
|
void setupAccountsToggle();
|
2022-02-09 14:52:20 +00:00
|
|
|
void setupArchive();
|
2022-02-09 13:54:16 +00:00
|
|
|
void setupMenu();
|
2016-11-16 10:44:06 +00:00
|
|
|
void updateControlsGeometry();
|
2020-06-22 13:01:41 +00:00
|
|
|
void updateInnerControlsGeometry();
|
2017-05-07 09:00:49 +00:00
|
|
|
void updatePhone();
|
2018-10-20 19:04:10 +00:00
|
|
|
void initResetScaleButton();
|
2020-06-30 07:34:02 +00:00
|
|
|
void toggleAccounts();
|
2016-11-16 10:44:06 +00:00
|
|
|
|
2020-06-22 13:01:41 +00:00
|
|
|
const not_null<SessionController*> _controller;
|
|
|
|
object_ptr<Ui::UserpicButton> _userpicButton;
|
2020-06-22 14:33:35 +00:00
|
|
|
object_ptr<ToggleAccountsButton> _toggleAccounts;
|
2018-10-20 19:04:10 +00:00
|
|
|
object_ptr<ResetScaleButton> _resetScaleButton = { nullptr };
|
2020-06-22 13:01:41 +00:00
|
|
|
object_ptr<Ui::ScrollArea> _scroll;
|
|
|
|
not_null<Ui::VerticalLayout*> _inner;
|
2022-02-10 11:03:07 +00:00
|
|
|
not_null<Ui::RpWidget*> _topShadowSkip;
|
2020-06-22 13:01:41 +00:00
|
|
|
not_null<Ui::SlideWrap<Ui::VerticalLayout>*> _accounts;
|
|
|
|
not_null<Ui::SlideWrap<Ui::PlainShadow>*> _shadow;
|
2022-02-09 13:54:16 +00:00
|
|
|
not_null<Ui::VerticalLayout*> _menu;
|
2020-06-22 13:01:41 +00:00
|
|
|
not_null<Ui::RpWidget*> _footer;
|
|
|
|
not_null<Ui::FlatLabel*> _telegram;
|
|
|
|
not_null<Ui::FlatLabel*> _version;
|
2022-02-09 13:54:16 +00:00
|
|
|
QPointer<Ui::SettingsButton> _nightThemeToggle;
|
|
|
|
rpl::event_stream<bool> _nightThemeSwitches;
|
2017-06-29 19:09:10 +00:00
|
|
|
base::Timer _nightThemeSwitch;
|
2019-05-16 08:39:45 +00:00
|
|
|
base::unique_qptr<Ui::PopupMenu> _contextMenu;
|
2016-11-16 10:44:06 +00:00
|
|
|
|
2017-05-07 09:00:49 +00:00
|
|
|
QString _phoneText;
|
2016-11-11 19:51:59 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-07-24 05:41:51 +00:00
|
|
|
struct OthersUnreadState {
|
|
|
|
int count = 0;
|
|
|
|
bool allMuted = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
[[nodiscard]] OthersUnreadState OtherAccountsUnreadStateCurrent();
|
|
|
|
[[nodiscard]] rpl::producer<OthersUnreadState> OtherAccountsUnreadState();
|
|
|
|
|
2016-11-11 19:51:59 +00:00
|
|
|
} // namespace Window
|