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