2016-11-11 22:51:59 +03:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-11-11 22:51:59 +03:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-11-11 22:51:59 +03:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-06-29 22:09:10 +03:00
|
|
|
#include "base/timer.h"
|
2018-10-20 23:04:10 +04:00
|
|
|
#include "ui/rp_widget.h"
|
2017-06-29 22:09:10 +03:00
|
|
|
|
2016-11-11 22:51:59 +03:00
|
|
|
namespace Ui {
|
2017-04-05 12:21:38 +03:00
|
|
|
class IconButton;
|
2016-11-16 13:44:06 +03:00
|
|
|
class FlatLabel;
|
2016-11-11 22:51:59 +03:00
|
|
|
class Menu;
|
2016-11-16 13:44:06 +03:00
|
|
|
class UserpicButton;
|
2019-05-16 11:39:45 +03:00
|
|
|
class PopupMenu;
|
2017-11-13 19:50:10 +04:00
|
|
|
} // namespace Ui
|
2016-11-16 13:44:06 +03:00
|
|
|
|
2016-11-11 22:51:59 +03:00
|
|
|
namespace Window {
|
|
|
|
|
2019-06-06 13:21:40 +03:00
|
|
|
class SessionController;
|
2017-11-13 19:50:10 +04:00
|
|
|
|
2018-10-20 23:04:10 +04:00
|
|
|
class MainMenu : public Ui::RpWidget, private base::Subscriber {
|
2016-11-11 22:51:59 +03:00
|
|
|
public:
|
2019-06-06 13:21:40 +03:00
|
|
|
MainMenu(QWidget *parent, not_null<SessionController*> controller);
|
2016-11-11 22:51:59 +03:00
|
|
|
|
2016-11-17 14:03:49 +03:00
|
|
|
void setInnerFocus() {
|
|
|
|
setFocus();
|
|
|
|
}
|
2016-11-16 13:44:06 +03:00
|
|
|
|
2016-11-11 22:51:59 +03:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
|
|
|
private:
|
2016-11-16 13:44:06 +03:00
|
|
|
void updateControlsGeometry();
|
2017-05-07 12:00:49 +03:00
|
|
|
void updatePhone();
|
2018-10-20 23:04:10 +04:00
|
|
|
void initResetScaleButton();
|
2017-04-28 20:16:14 +03:00
|
|
|
void refreshMenu();
|
2019-05-24 21:46:52 +03:00
|
|
|
void refreshBackground();
|
2016-11-16 13:44:06 +03:00
|
|
|
|
2018-10-20 23:04:10 +04:00
|
|
|
class ResetScaleButton;
|
2019-06-06 13:21:40 +03:00
|
|
|
not_null<SessionController*> _controller;
|
2017-11-13 19:50:10 +04:00
|
|
|
object_ptr<Ui::UserpicButton> _userpicButton = { nullptr };
|
2017-04-05 12:21:38 +03:00
|
|
|
object_ptr<Ui::IconButton> _cloudButton = { nullptr };
|
2019-05-16 11:39:45 +03:00
|
|
|
object_ptr<Ui::IconButton> _archiveButton = { nullptr };
|
2018-10-20 23:04:10 +04:00
|
|
|
object_ptr<ResetScaleButton> _resetScaleButton = { nullptr };
|
2016-12-13 20:07:56 +03:00
|
|
|
object_ptr<Ui::Menu> _menu;
|
|
|
|
object_ptr<Ui::FlatLabel> _telegram;
|
|
|
|
object_ptr<Ui::FlatLabel> _version;
|
2017-06-29 22:09:10 +03:00
|
|
|
std::shared_ptr<QPointer<QAction>> _nightThemeAction;
|
|
|
|
base::Timer _nightThemeSwitch;
|
2019-05-16 11:39:45 +03:00
|
|
|
base::unique_qptr<Ui::PopupMenu> _contextMenu;
|
2016-11-16 13:44:06 +03:00
|
|
|
|
2017-05-07 12:00:49 +03:00
|
|
|
QString _phoneText;
|
2019-05-24 21:46:52 +03:00
|
|
|
QImage _background;
|
2016-11-11 22:51:59 +03:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Window
|