"Fossies" - the Fresh Open Source Software Archive

Member "tdesktop-2.6.1/Telegram/SourceFiles/ui/controls/send_button.h" (24 Feb 2021, 1374 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 "send_button.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 "ui/widgets/buttons.h"
   11 
   12 namespace Ui {
   13 
   14 class SendButton final : public RippleButton {
   15 public:
   16     SendButton(QWidget *parent);
   17 
   18     static constexpr auto kSlowmodeDelayLimit = 100 * 60;
   19 
   20     enum class Type {
   21         Send,
   22         Schedule,
   23         Save,
   24         Record,
   25         Cancel,
   26         Slowmode,
   27     };
   28     [[nodiscard]] Type type() const {
   29         return _type;
   30     }
   31     void setType(Type state);
   32     void setSlowmodeDelay(int seconds);
   33     void finishAnimating();
   34 
   35 protected:
   36     void paintEvent(QPaintEvent *e) override;
   37 
   38     QImage prepareRippleMask() const override;
   39     QPoint prepareRippleStartPosition() const override;
   40 
   41 private:
   42     [[nodiscard]] QPixmap grabContent();
   43     [[nodiscard]] bool isSlowmode() const;
   44 
   45     void paintRecord(Painter &p, bool over);
   46     void paintSave(Painter &p, bool over);
   47     void paintCancel(Painter &p, bool over);
   48     void paintSend(Painter &p, bool over);
   49     void paintSchedule(Painter &p, bool over);
   50     void paintSlowmode(Painter &p);
   51 
   52     Type _type = Type::Send;
   53     Type _afterSlowmodeType = Type::Send;
   54     QPixmap _contentFrom, _contentTo;
   55 
   56     Ui::Animations::Simple _a_typeChanged;
   57 
   58     int _slowmodeDelay = 0;
   59     QString _slowmodeDelayText;
   60 
   61 };
   62 
   63 } // namespace Ui