/* 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 #include "base/object_ptr.h" #include "core/core_settings.h" #include "settings/settings_type.h" #include "ui/effects/animations.h" #include "ui/rp_widget.h" namespace Ui { class Checkbox; class SettingsButton; class ToggleView; class VerticalLayout; template class SlideWrap; } // namespace Ui namespace Window { class SessionController; } // namespace Window namespace Data { enum class DefaultNotify : uint8_t; } // namespace Data namespace Settings { constexpr auto kMaxNotificationsCount = 5; [[nodiscard]] int CurrentNotificationsCount(); class NotificationsCount : public Ui::RpWidget { public: NotificationsCount( QWidget *parent, not_null controller); void setCount(int count); ~NotificationsCount(); protected: void paintEvent(QPaintEvent *e) override; void mousePressEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override; void leaveEventHook(QEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override; int resizeGetHeight(int newWidth) override; private: using ScreenCorner = Core::Settings::ScreenCorner; void setOverCorner(ScreenCorner corner); void clearOverCorner(); class SampleWidget; void removeSample(SampleWidget *widget); QRect getScreenRect() const; QRect getScreenRect(int width) const; int getContentLeft() const; void prepareNotificationSampleSmall(); void prepareNotificationSampleLarge(); void prepareNotificationSampleUserpic(); const not_null _controller; QPixmap _notificationSampleUserpic; QPixmap _notificationSampleSmall; QPixmap _notificationSampleLarge; ScreenCorner _chosenCorner; std::vector _sampleOpacities; bool _isOverCorner = false; ScreenCorner _overCorner = ScreenCorner::TopLeft; bool _isDownCorner = false; ScreenCorner _downCorner = ScreenCorner::TopLeft; int _oldCount; std::vector _cornerSamples[5]; }; struct NotifyViewCheckboxes { not_null*> wrap; not_null name; not_null preview; }; [[nodiscard]] NotifyViewCheckboxes SetupNotifyViewOptions( not_null controller, not_null container, bool nameShown, bool previewShown); struct SplitToggle { not_null button; not_null toggle; not_null checkView; }; [[nodiscard]] SplitToggle SetupSplitToggle( not_null container, rpl::producer title, const style::icon *icon, bool checked, rpl::producer details); [[nodiscard]] not_null AddTypeButton( not_null container, not_null controller, Data::DefaultNotify type, Fn showOther); } // namespace Settings