mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-27 07:52:57 +02:00
Removed redundant record methods from SendButton.
This commit is contained in:
parent
3e4866d3b7
commit
e7454e3849
2 changed files with 0 additions and 61 deletions
|
@ -66,15 +66,6 @@ void SendButton::finishAnimating() {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendButton::mouseMoveEvent(QMouseEvent *e) {
|
|
||||||
AbstractButton::mouseMoveEvent(e);
|
|
||||||
if (_recording) {
|
|
||||||
if (_recordUpdateCallback) {
|
|
||||||
_recordUpdateCallback(e->globalPos());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendButton::requestPaintRecord(float64 progress) {
|
void SendButton::requestPaintRecord(float64 progress) {
|
||||||
if (_type == Type::Record) {
|
if (_type == Type::Record) {
|
||||||
_recordProgress = progress;
|
_recordProgress = progress;
|
||||||
|
@ -189,27 +180,6 @@ void SendButton::paintSlowmode(Painter &p) {
|
||||||
style::al_center);
|
style::al_center);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendButton::onStateChanged(State was, StateChangeSource source) {
|
|
||||||
RippleButton::onStateChanged(was, source);
|
|
||||||
|
|
||||||
auto down = (state() & StateFlag::Down);
|
|
||||||
if ((was & StateFlag::Down) != down) {
|
|
||||||
if (down) {
|
|
||||||
if (_type == Type::Record) {
|
|
||||||
_recording = true;
|
|
||||||
if (_recordStartCallback) {
|
|
||||||
_recordStartCallback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (_recording) {
|
|
||||||
_recording = false;
|
|
||||||
if (_recordStopCallback) {
|
|
||||||
_recordStopCallback(_recordActive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SendButton::isSlowmode() const {
|
bool SendButton::isSlowmode() const {
|
||||||
return (_slowmodeDelay > 0);
|
return (_slowmodeDelay > 0);
|
||||||
}
|
}
|
||||||
|
@ -248,11 +218,4 @@ QPoint SendButton::prepareRippleStartPosition() const {
|
||||||
return real - QPoint((width() - size) / 2, y);
|
return real - QPoint((width() - size) / 2, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendButton::recordAnimationCallback() {
|
|
||||||
update();
|
|
||||||
if (_recordAnimationCallback) {
|
|
||||||
_recordAnimationCallback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
@ -29,35 +29,18 @@ public:
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
void setType(Type state);
|
void setType(Type state);
|
||||||
void setRecordActive(bool recordActive);
|
|
||||||
void setSlowmodeDelay(int seconds);
|
void setSlowmodeDelay(int seconds);
|
||||||
void finishAnimating();
|
void finishAnimating();
|
||||||
|
|
||||||
void setRecordStartCallback(Fn<void()> callback) {
|
|
||||||
_recordStartCallback = std::move(callback);
|
|
||||||
}
|
|
||||||
void setRecordUpdateCallback(Fn<void(QPoint globalPos)> callback) {
|
|
||||||
_recordUpdateCallback = std::move(callback);
|
|
||||||
}
|
|
||||||
void setRecordStopCallback(Fn<void(bool active)> callback) {
|
|
||||||
_recordStopCallback = std::move(callback);
|
|
||||||
}
|
|
||||||
void setRecordAnimationCallback(Fn<void()> callback) {
|
|
||||||
_recordAnimationCallback = std::move(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
void requestPaintRecord(float64 progress);
|
void requestPaintRecord(float64 progress);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QMouseEvent *e) override;
|
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void onStateChanged(State was, StateChangeSource source) override;
|
|
||||||
|
|
||||||
QImage prepareRippleMask() const override;
|
QImage prepareRippleMask() const override;
|
||||||
QPoint prepareRippleStartPosition() const override;
|
QPoint prepareRippleStartPosition() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void recordAnimationCallback();
|
|
||||||
[[nodiscard]] QPixmap grabContent();
|
[[nodiscard]] QPixmap grabContent();
|
||||||
[[nodiscard]] bool isSlowmode() const;
|
[[nodiscard]] bool isSlowmode() const;
|
||||||
|
|
||||||
|
@ -70,19 +53,12 @@ private:
|
||||||
|
|
||||||
Type _type = Type::Send;
|
Type _type = Type::Send;
|
||||||
Type _afterSlowmodeType = Type::Send;
|
Type _afterSlowmodeType = Type::Send;
|
||||||
bool _recordActive = false;
|
|
||||||
QPixmap _contentFrom, _contentTo;
|
QPixmap _contentFrom, _contentTo;
|
||||||
|
|
||||||
Ui::Animations::Simple _a_typeChanged;
|
Ui::Animations::Simple _a_typeChanged;
|
||||||
|
|
||||||
float64 _recordProgress = 0.;
|
float64 _recordProgress = 0.;
|
||||||
|
|
||||||
bool _recording = false;
|
|
||||||
Fn<void()> _recordStartCallback;
|
|
||||||
Fn<void(bool active)> _recordStopCallback;
|
|
||||||
Fn<void(QPoint globalPos)> _recordUpdateCallback;
|
|
||||||
Fn<void()> _recordAnimationCallback;
|
|
||||||
|
|
||||||
int _slowmodeDelay = 0;
|
int _slowmodeDelay = 0;
|
||||||
QString _slowmodeDelayText;
|
QString _slowmodeDelayText;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue