mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Replaced observable in EditColorBox with rpl.
This commit is contained in:
parent
658d5a1322
commit
5c7229f875
2 changed files with 17 additions and 19 deletions
|
@ -27,8 +27,8 @@ public:
|
|||
return _y;
|
||||
}
|
||||
|
||||
base::Observable<void> &changed() {
|
||||
return _changed;
|
||||
rpl::producer<> changed() const {
|
||||
return _changed.events();
|
||||
}
|
||||
void setHSB(HSB hsb);
|
||||
void setRGB(int red, int green, int blue);
|
||||
|
@ -61,7 +61,7 @@ private:
|
|||
float64 _y = 0.;
|
||||
|
||||
bool _choosing = false;
|
||||
base::Observable<void> _changed;
|
||||
rpl::event_stream<> _changed;
|
||||
|
||||
};
|
||||
|
||||
|
@ -234,7 +234,7 @@ void EditColorBox::Picker::updateCurrentPoint(QPoint localPosition) {
|
|||
_x = x;
|
||||
_y = y;
|
||||
update();
|
||||
_changed.notify();
|
||||
_changed.fire({});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,8 +284,8 @@ public:
|
|||
};
|
||||
Slider(QWidget *parent, Direction direction, Type type, QColor color);
|
||||
|
||||
base::Observable<void> &changed() {
|
||||
return _changed;
|
||||
rpl::producer<> changed() const {
|
||||
return _changed.events();
|
||||
}
|
||||
float64 value() const {
|
||||
return _value;
|
||||
|
@ -335,7 +335,7 @@ private:
|
|||
QBrush _transparent;
|
||||
|
||||
bool _choosing = false;
|
||||
base::Observable<void> _changed;
|
||||
rpl::event_stream<> _changed;
|
||||
|
||||
};
|
||||
|
||||
|
@ -540,7 +540,7 @@ void EditColorBox::Slider::updateCurrentPoint(QPoint localPosition) {
|
|||
if (_value != value) {
|
||||
_value = value;
|
||||
update();
|
||||
_changed.notify();
|
||||
_changed.fire({});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -826,16 +826,14 @@ void EditColorBox::prepare() {
|
|||
auto height = st::colorEditSkip + st::colorPickerSize + st::colorEditSkip + st::colorSliderWidth + st::colorEditSkip;
|
||||
setDimensions(st::colorEditWidth, height);
|
||||
|
||||
subscribe(_picker->changed(), [=] { updateFromControls(); });
|
||||
if (_hueSlider) {
|
||||
subscribe(_hueSlider->changed(), [=] { updateFromControls(); });
|
||||
}
|
||||
if (_opacitySlider) {
|
||||
subscribe(_opacitySlider->changed(), [=] { updateFromControls(); });
|
||||
}
|
||||
if (_lightnessSlider) {
|
||||
subscribe(_lightnessSlider->changed(), [=] { updateFromControls(); });
|
||||
}
|
||||
rpl::merge(
|
||||
_picker->changed(),
|
||||
(_hueSlider ? _hueSlider->changed() : rpl::never<>()),
|
||||
(_opacitySlider ? _opacitySlider->changed() : rpl::never<>()),
|
||||
(_lightnessSlider ? _lightnessSlider->changed() : rpl::never<>())
|
||||
) | rpl::start_with_next([=] {
|
||||
updateFromControls();
|
||||
}, lifetime());
|
||||
|
||||
boxClosing() | rpl::start_with_next([=] {
|
||||
if (_cancelCallback) {
|
||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "boxes/abstract_box.h"
|
||||
|
||||
class EditColorBox : public Ui::BoxContent, private base::Subscriber {
|
||||
class EditColorBox : public Ui::BoxContent {
|
||||
public:
|
||||
enum class Mode {
|
||||
RGBA,
|
||||
|
|
Loading…
Add table
Reference in a new issue