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"
|
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;
|
2016-11-11 19:51:59 +00:00
|
|
|
class Menu;
|
2016-11-16 10:44:06 +00:00
|
|
|
class UserpicButton;
|
2019-05-16 08:39:45 +00:00
|
|
|
class PopupMenu;
|
2017-11-13 15:50:10 +00:00
|
|
|
} // namespace Ui
|
2016-11-16 10:44:06 +00:00
|
|
|
|
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
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
class MainMenu : public Ui::LayerWidget, private base::Subscriber {
|
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:
|
2016-11-16 10:44:06 +00:00
|
|
|
void updateControlsGeometry();
|
2017-05-07 09:00:49 +00:00
|
|
|
void updatePhone();
|
2018-10-20 19:04:10 +00:00
|
|
|
void initResetScaleButton();
|
2017-04-28 17:16:14 +00:00
|
|
|
void refreshMenu();
|
2019-05-24 18:46:52 +00:00
|
|
|
void refreshBackground();
|
2016-11-16 10:44:06 +00:00
|
|
|
|
2018-10-20 19:04:10 +00:00
|
|
|
class ResetScaleButton;
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<SessionController*> _controller;
|
2017-11-13 15:50:10 +00:00
|
|
|
object_ptr<Ui::UserpicButton> _userpicButton = { nullptr };
|
2017-04-05 09:21:38 +00:00
|
|
|
object_ptr<Ui::IconButton> _cloudButton = { nullptr };
|
2019-05-16 08:39:45 +00:00
|
|
|
object_ptr<Ui::IconButton> _archiveButton = { nullptr };
|
2018-10-20 19:04:10 +00:00
|
|
|
object_ptr<ResetScaleButton> _resetScaleButton = { nullptr };
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::Menu> _menu;
|
|
|
|
object_ptr<Ui::FlatLabel> _telegram;
|
|
|
|
object_ptr<Ui::FlatLabel> _version;
|
2017-06-29 19:09:10 +00:00
|
|
|
std::shared_ptr<QPointer<QAction>> _nightThemeAction;
|
|
|
|
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;
|
2019-05-24 18:46:52 +00:00
|
|
|
QImage _background;
|
2016-11-11 19:51:59 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Window
|