init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
This commit is contained in:
128
Telegram/SourceFiles/window/window_main_menu.h
Normal file
128
Telegram/SourceFiles/window/window_main_menu.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/timer.h"
|
||||
#include "base/object_ptr.h"
|
||||
#include "base/binary_guard.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/unread_badge.h"
|
||||
#include "ui/controls/swipe_handler_data.h"
|
||||
#include "ui/layers/layer_widget.h"
|
||||
|
||||
namespace base {
|
||||
enum class EventFilterResult;
|
||||
} // namespace base
|
||||
|
||||
namespace Ui {
|
||||
class IconButton;
|
||||
class FlatLabel;
|
||||
class UserpicButton;
|
||||
class PopupMenu;
|
||||
class ScrollArea;
|
||||
class VerticalLayout;
|
||||
class RippleButton;
|
||||
class PlainShadow;
|
||||
class SettingsButton;
|
||||
template <typename Widget>
|
||||
class SlideWrap;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Info::Profile {
|
||||
class Badge;
|
||||
class EmojiStatusPanel;
|
||||
} // namespace Info::Profile
|
||||
|
||||
namespace Main {
|
||||
class Account;
|
||||
} // namespace Main
|
||||
|
||||
namespace Window {
|
||||
|
||||
class SessionController;
|
||||
|
||||
class MainMenu final : public Ui::LayerWidget {
|
||||
public:
|
||||
MainMenu(QWidget *parent, not_null<SessionController*> controller);
|
||||
~MainMenu();
|
||||
|
||||
void parentResized() override;
|
||||
void showFinished() override;
|
||||
|
||||
private:
|
||||
class ToggleAccountsButton;
|
||||
class ResetScaleButton;
|
||||
|
||||
bool eventHook(QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void doSetInnerFocus() override {
|
||||
setFocus();
|
||||
}
|
||||
|
||||
void moveBadge();
|
||||
void setupUserpicButton();
|
||||
void setupAccounts();
|
||||
void setupAccountsToggle();
|
||||
void setupSetEmojiStatus();
|
||||
void setupArchive();
|
||||
void setupMenu();
|
||||
void updateControlsGeometry();
|
||||
void updateInnerControlsGeometry();
|
||||
void initResetScaleButton();
|
||||
void toggleAccounts();
|
||||
void chooseEmojiStatus();
|
||||
void setupSwipe();
|
||||
|
||||
[[nodiscard]] base::EventFilterResult redirectToInnerChecked(
|
||||
not_null<QEvent*> e);
|
||||
|
||||
void drawName(Painter &p);
|
||||
|
||||
const not_null<SessionController*> _controller;
|
||||
object_ptr<Ui::UserpicButton> _userpicButton;
|
||||
Ui::Text::String _name;
|
||||
int _nameVersion = 0;
|
||||
object_ptr<ToggleAccountsButton> _toggleAccounts;
|
||||
object_ptr<Ui::FlatLabel> _setEmojiStatus;
|
||||
std::unique_ptr<Info::Profile::EmojiStatusPanel> _emojiStatusPanel;
|
||||
std::unique_ptr<Info::Profile::Badge> _badge;
|
||||
object_ptr<ResetScaleButton> _resetScaleButton = { nullptr };
|
||||
object_ptr<Ui::ScrollArea> _scroll;
|
||||
not_null<Ui::VerticalLayout*> _inner;
|
||||
not_null<Ui::RpWidget*> _topShadowSkip;
|
||||
not_null<Ui::SlideWrap<Ui::VerticalLayout>*> _accounts;
|
||||
not_null<Ui::SlideWrap<Ui::PlainShadow>*> _shadow;
|
||||
not_null<Ui::VerticalLayout*> _menu;
|
||||
not_null<Ui::RpWidget*> _footer;
|
||||
not_null<Ui::FlatLabel*> _telegram;
|
||||
not_null<Ui::FlatLabel*> _version;
|
||||
QPointer<Ui::SettingsButton> _nightThemeToggle;
|
||||
rpl::event_stream<bool> _nightThemeSwitches;
|
||||
base::Timer _nightThemeSwitch;
|
||||
base::unique_qptr<Ui::PopupMenu> _contextMenu;
|
||||
|
||||
Ui::Controls::SwipeBackResult _swipeBackData;
|
||||
|
||||
rpl::variable<bool> _showFinished = false;
|
||||
bool _insideEventRedirect = false;
|
||||
|
||||
};
|
||||
|
||||
struct OthersUnreadState {
|
||||
int count = 0;
|
||||
bool allMuted = false;
|
||||
};
|
||||
|
||||
[[nodiscard]] OthersUnreadState OtherAccountsUnreadStateCurrent(
|
||||
not_null<Main::Account*> current);
|
||||
[[nodiscard]] rpl::producer<OthersUnreadState> OtherAccountsUnreadState(
|
||||
not_null<Main::Account*> current);
|
||||
|
||||
} // namespace Window
|
||||
Reference in New Issue
Block a user