"Fossies" - the Fresh Open Source Software Archive

Member "tdesktop-2.6.1/Telegram/SourceFiles/boxes/background_preview_box.h" (24 Feb 2021, 2359 Bytes) of package /linux/misc/tdesktop-2.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "background_preview_box.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2 This file is part of Telegram Desktop,
    3 the official desktop application for the Telegram messaging service.
    4 
    5 For license and copyright information please follow this link:
    6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
    7 */
    8 #pragma once
    9 
   10 #include "boxes/abstract_box.h"
   11 #include "base/binary_guard.h"
   12 #include "window/themes/window_theme.h"
   13 #include "history/admin_log/history_admin_log_item.h"
   14 #include "history/view/history_view_element.h"
   15 #include "ui/effects/animations.h"
   16 #include "ui/effects/radial_animation.h"
   17 
   18 namespace Data {
   19 class DocumentMedia;
   20 } // namespace Data
   21 
   22 namespace Window {
   23 class SessionController;
   24 } // namespace Window
   25 
   26 namespace Ui {
   27 class Checkbox;
   28 } // namespace Ui
   29 
   30 class BackgroundPreviewBox
   31     : public Ui::BoxContent
   32     , private HistoryView::SimpleElementDelegate
   33     , private base::Subscriber {
   34 public:
   35     BackgroundPreviewBox(
   36         QWidget*,
   37         not_null<Window::SessionController*> controller,
   38         const Data::WallPaper &paper);
   39 
   40     static bool Start(
   41         not_null<Window::SessionController*> controller,
   42         const QString &slug,
   43         const QMap<QString, QString> &params);
   44 
   45 protected:
   46     void prepare() override;
   47 
   48     void paintEvent(QPaintEvent *e) override;
   49 
   50 private:
   51     using Element = HistoryView::Element;
   52     not_null<HistoryView::ElementDelegate*> delegate();
   53     HistoryView::Context elementContext() override;
   54 
   55     void apply();
   56     void share();
   57     void radialAnimationCallback(crl::time now);
   58     QRect radialRect() const;
   59 
   60     void checkLoadedDocument();
   61     bool setScaledFromThumb();
   62     void setScaledFromImage(QImage &&image, QImage &&blurred);
   63     void updateServiceBg(std::optional<QColor> background);
   64     std::optional<QColor> patternBackgroundColor() const;
   65     void paintImage(Painter &p);
   66     void paintRadial(Painter &p);
   67     void paintTexts(Painter &p, crl::time ms);
   68     void paintDate(Painter &p);
   69     void createBlurCheckbox();
   70     int textsTop() const;
   71     void startFadeInFrom(QPixmap previous);
   72     void checkBlurAnimationStart();
   73 
   74     const not_null<Window::SessionController*> _controller;
   75     AdminLog::OwnedItem _text1;
   76     AdminLog::OwnedItem _text2;
   77     Data::WallPaper _paper;
   78     std::shared_ptr<Data::DocumentMedia> _media;
   79     QImage _full;
   80     QPixmap _scaled, _blurred, _fadeOutThumbnail;
   81     Ui::Animations::Simple _fadeIn;
   82     Ui::RadialAnimation _radial;
   83     base::binary_guard _generating;
   84     std::optional<QColor> _serviceBg;
   85     object_ptr<Ui::Checkbox> _blur = { nullptr };
   86 
   87 };