Updated lib_ui sources to TDesktop version 2.7.3+d984c59

This commit is contained in:
Eric Kotato 2021-04-28 01:24:02 +03:00
commit 0710f40dd1
10 changed files with 25 additions and 61 deletions

View file

@ -41,8 +41,9 @@ namespace details {
template <typename T, typename Derived> template <typename T, typename Derived>
class gradients { class gradients {
public: public:
gradients() = default;
gradients(base::flat_map<T, std::vector<QColor>> colors) { gradients(base::flat_map<T, std::vector<QColor>> colors) {
Expects(colors.size() > 0); Expects(!colors.empty());
for (const auto &[key, value] : colors) { for (const auto &[key, value] : colors) {
auto c = gradient_colors(std::move(value)); auto c = gradient_colors(std::move(value));
@ -50,7 +51,7 @@ public:
} }
} }
gradients(base::flat_map<T, gradient_colors> colors) { gradients(base::flat_map<T, gradient_colors> colors) {
Expects(colors.size() > 0); Expects(!colors.empty());
for (const auto &[key, c] : colors) { for (const auto &[key, c] : colors) {
_gradients.emplace(key, gradient_with_stops(std::move(c.stops))); _gradients.emplace(key, gradient_with_stops(std::move(c.stops)));
@ -58,6 +59,8 @@ public:
} }
QGradient gradient(T state1, T state2, float64 b_ratio) const { QGradient gradient(T state1, T state2, float64 b_ratio) const {
Expects(!_gradients.empty());
if (b_ratio == 0.) { if (b_ratio == 0.) {
return _gradients.find(state1)->second; return _gradients.find(state1)->second;
} else if (b_ratio == 1.) { } else if (b_ratio == 1.) {
@ -163,6 +166,7 @@ class linear_gradients final
using parent = details::gradients<T, linear_gradients<T>>; using parent = details::gradients<T, linear_gradients<T>>;
public: public:
linear_gradients() = default;
linear_gradients( linear_gradients(
base::flat_map<T, std::vector<QColor>> colors, base::flat_map<T, std::vector<QColor>> colors,
QPointF point1, QPointF point1,
@ -205,6 +209,7 @@ class radial_gradients final
using parent = details::gradients<T, radial_gradients<T>>; using parent = details::gradients<T, radial_gradients<T>>;
public: public:
radial_gradients() = default;
radial_gradients( radial_gradients(
base::flat_map<T, std::vector<QColor>> colors, base::flat_map<T, std::vector<QColor>> colors,
QPointF center, QPointF center,

View file

@ -36,6 +36,10 @@ void Integration::textActionsUpdated() {
void Integration::activationFromTopPanel() { void Integration::activationFromTopPanel() {
} }
bool Integration::screenIsLocked() {
return false;
}
QString Integration::timeFormat() { QString Integration::timeFormat() {
return u"hh:mm"_q; return u"hh:mm"_q;
} }

View file

@ -40,6 +40,7 @@ public:
virtual void textActionsUpdated(); virtual void textActionsUpdated();
virtual void activationFromTopPanel(); virtual void activationFromTopPanel();
[[nodiscard]] virtual bool screenIsLocked();
[[nodiscard]] virtual QString timeFormat(); [[nodiscard]] virtual QString timeFormat();
[[nodiscard]] virtual std::shared_ptr<ClickHandler> createLinkHandler( [[nodiscard]] virtual std::shared_ptr<ClickHandler> createLinkHandler(

View file

@ -86,12 +86,12 @@ void RadialBlob::paint(Painter &p, const QBrush &brush, float outerScale) {
auto path = QPainterPath(); auto path = QPainterPath();
auto m = QMatrix(); auto m = QMatrix();
p.save();
const auto scale = (_minScale + (1. - _minScale) * _scale) * outerScale; const auto scale = (_minScale + (1. - _minScale) * _scale) * outerScale;
if (scale == 0.) { if (scale == 0.) {
p.restore();
return; return;
} else if (scale != 1.) { }
p.save();
if (scale != 1.) {
p.scale(scale, scale); p.scale(scale, scale);
} }

View file

@ -189,6 +189,8 @@ bool IsContentVisible(
const auto activeOrNotOverlapped = [&] { const auto activeOrNotOverlapped = [&] {
if (const auto active = widget->isActiveWindow()) { if (const auto active = widget->isActiveWindow()) {
return active; return active;
} else if (Integration::Instance().screenIsLocked()) {
return false;
} }
const auto mappedRect = QHighDpi::toNativePixels( const auto mappedRect = QHighDpi::toNativePixels(

View file

@ -682,6 +682,8 @@ SettingsButton::SettingsButton(
}, lifetime()); }, lifetime());
} }
SettingsButton::~SettingsButton() = default;
SettingsButton *SettingsButton::toggleOn(rpl::producer<bool> &&toggled) { SettingsButton *SettingsButton::toggleOn(rpl::producer<bool> &&toggled) {
Expects(_toggle == nullptr); Expects(_toggle == nullptr);
_toggle = std::make_unique<Ui::ToggleView>( _toggle = std::make_unique<Ui::ToggleView>(

View file

@ -254,6 +254,7 @@ public:
QWidget *parent, QWidget *parent,
rpl::producer<QString> &&text, rpl::producer<QString> &&text,
const style::SettingsButton &st); const style::SettingsButton &st);
~SettingsButton();
SettingsButton *toggleOn(rpl::producer<bool> &&toggled); SettingsButton *toggleOn(rpl::producer<bool> &&toggled);
bool toggled() const; bool toggled() const;

View file

@ -27,7 +27,6 @@ Toggle::Toggle(
, _toggleShift(st.itemToggleShift) , _toggleShift(st.itemToggleShift)
, _itemToggle(st.itemToggle) , _itemToggle(st.itemToggle)
, _itemToggleOver(st.itemToggleOver) { , _itemToggleOver(st.itemToggleOver) {
const auto processAction = [=] { const auto processAction = [=] {
if (!action()->isCheckable()) { if (!action()->isCheckable()) {
_toggle.reset(); _toggle.reset();
@ -52,9 +51,10 @@ Toggle::Toggle(
} }
_toggle->setStyle(data.selected ? _itemToggleOver : _itemToggle); _toggle->setStyle(data.selected ? _itemToggleOver : _itemToggle);
}, lifetime()); }, lifetime());
} }
Toggle::~Toggle() = default;
void Toggle::paintEvent(QPaintEvent *e) { void Toggle::paintEvent(QPaintEvent *e) {
Action::paintEvent(e); Action::paintEvent(e);
if (_toggle) { if (_toggle) {

View file

@ -24,6 +24,7 @@ public:
Fn<void()> &&callback, Fn<void()> &&callback,
const style::icon *icon, const style::icon *icon,
const style::icon *iconOver); const style::icon *iconOver);
~Toggle();
void finishAnimating() override; void finishAnimating() override;

View file

@ -694,8 +694,8 @@ defaultScrollArea: ScrollArea {
deltat: 3px; deltat: 3px;
deltab: 3px; deltab: 3px;
topsh: 2px; topsh: 0px;
bottomsh: 2px; bottomsh: 0px;
shColor: shadowFg; shColor: shadowFg;
duration: 150; duration: 150;
@ -708,9 +708,6 @@ defaultSolidScroll: ScrollArea(defaultScrollArea) {
deltat: 6px; deltat: 6px;
deltab: 6px; deltab: 6px;
topsh: 0px;
bottomsh: 0px;
hiding: 0; hiding: 0;
} }
@ -1424,55 +1421,6 @@ defaultToast: Toast {
durationSlide: 160; durationSlide: 160;
} }
callMuteMainBlobMinRadius: 57px;
callMuteMainBlobMaxRadius: 63px;
callMuteMinorBlobMinRadius: 64px;
callMuteMinorBlobMaxRadius: 74px;
callMuteMajorBlobMinRadius: 67px;
callMuteMajorBlobMaxRadius: 77px;
callMuteButtonActiveInner: IconButton {
width: 136px;
height: 165px;
}
callMuteButtonLabel: FlatLabel(defaultFlatLabel) {
textFg: groupCallMembersFg;
style: TextStyle(defaultTextStyle) {
font: font(14px);
linkFont: font(14px);
linkFontOver: font(14px underline);
}
}
callMuteButtonSublabel: FlatLabel(defaultFlatLabel) {
textFg: groupCallMemberNotJoinedStatus;
}
callMuteButtonLabelsSkip: 5px;
callMuteButtonSublabelSkip: 19px;
callMuteButtonActive: CallButton {
button: callMuteButtonActiveInner;
bg: groupCallLive1;
bgSize: 100px;
bgPosition: point(18px, 18px);
outerRadius: 18px;
outerBg: callAnswerBgOuter;
label: callMuteButtonLabel;
}
callMuteButtonMuted: CallButton(callMuteButtonActive) {
bg: groupCallMuted1;
label: callMuteButtonLabel;
}
callMuteButtonConnecting: CallButton(callMuteButtonMuted) {
bg: callIconBg;
label: callMuteButtonLabel;
}
callMuteButtonLabelAdditional: 5px;
callConnectingRadial: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
color: lightButtonFg;
thickness: 4px;
size: size(100px, 100px);
}
shakeShift: 4px; shakeShift: 4px;
// Windows specific title // Windows specific title