init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
73
Telegram/lib_ui/ui/widgets/call_button.h
Normal file
73
Telegram/lib_ui/ui/widgets/call_button.h
Normal file
@@ -0,0 +1,73 @@
|
||||
// This file is part of Desktop App Toolkit,
|
||||
// a set of libraries for developing nice desktop applications.
|
||||
//
|
||||
// For license and copyright information please follow this link:
|
||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "base/object_ptr.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/effects/animations.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
class FlatLabel;
|
||||
|
||||
struct CallButtonColors {
|
||||
std::optional<QColor> bg;
|
||||
std::optional<QColor> ripple;
|
||||
};
|
||||
|
||||
class CallButton final : public RippleButton {
|
||||
public:
|
||||
CallButton(
|
||||
QWidget *parent,
|
||||
const style::CallButton &stFrom,
|
||||
const style::CallButton *stTo = nullptr);
|
||||
|
||||
void setProgress(float64 progress);
|
||||
void setOuterValue(float64 value);
|
||||
void setText(rpl::producer<QString> text);
|
||||
void setColorOverrides(rpl::producer<CallButtonColors> &&colors);
|
||||
|
||||
void setStyle(
|
||||
const style::CallButton &stFrom,
|
||||
const style::CallButton *stTo = nullptr);
|
||||
|
||||
[[nodiscard]] not_null<CallButton*> addCornerButton(
|
||||
const style::CallButton &stFrom,
|
||||
const style::CallButton *stTo = nullptr);
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
void onStateChanged(State was, StateChangeSource source) override;
|
||||
|
||||
QImage prepareRippleMask() const override;
|
||||
QPoint prepareRippleStartPosition() const override;
|
||||
|
||||
void init();
|
||||
QPoint iconPosition(not_null<const style::CallButton*> st) const;
|
||||
void mixIconMasks();
|
||||
|
||||
not_null<const style::CallButton*> _stFrom;
|
||||
const style::CallButton *_stTo = nullptr;
|
||||
CallButton *_corner = nullptr;
|
||||
float64 _progress = 0.;
|
||||
|
||||
object_ptr<FlatLabel> _label = { nullptr };
|
||||
|
||||
std::optional<QColor> _bgOverride;
|
||||
std::optional<QColor> _rippleOverride;
|
||||
|
||||
QImage _bgMask, _bg;
|
||||
QPixmap _bgFrom, _bgTo;
|
||||
QImage _iconMixedMask, _iconFrom, _iconTo, _iconMixed;
|
||||
|
||||
float64 _outerValue = 0.;
|
||||
Animations::Simple _outerAnimation;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Ui
|
||||
Reference in New Issue
Block a user