From af105b377cb8eee5c4ea6b99c4e1eae12af335b4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 23 Apr 2021 14:56:06 +0400 Subject: [PATCH 1/5] Remove shadows from defaultScrollArea. --- ui/widgets/widgets.style | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ui/widgets/widgets.style b/ui/widgets/widgets.style index cb7eaa1..9bbffb1 100644 --- a/ui/widgets/widgets.style +++ b/ui/widgets/widgets.style @@ -694,8 +694,8 @@ defaultScrollArea: ScrollArea { deltat: 3px; deltab: 3px; - topsh: 2px; - bottomsh: 2px; + topsh: 0px; + bottomsh: 0px; shColor: shadowFg; duration: 150; @@ -708,9 +708,6 @@ defaultSolidScroll: ScrollArea(defaultScrollArea) { deltat: 6px; deltab: 6px; - topsh: 0px; - bottomsh: 0px; - hiding: 0; } From 372c57612745132e66e402e4f444eb069688370d Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 23 Apr 2021 21:36:08 +0400 Subject: [PATCH 2/5] Fix build with some headers includes. --- ui/widgets/buttons.cpp | 2 ++ ui/widgets/buttons.h | 1 + ui/widgets/menu/menu_toggle.cpp | 4 ++-- ui/widgets/menu/menu_toggle.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/widgets/buttons.cpp b/ui/widgets/buttons.cpp index 206ec73..29f7a56 100644 --- a/ui/widgets/buttons.cpp +++ b/ui/widgets/buttons.cpp @@ -682,6 +682,8 @@ SettingsButton::SettingsButton( }, lifetime()); } +SettingsButton::~SettingsButton() = default; + SettingsButton *SettingsButton::toggleOn(rpl::producer &&toggled) { Expects(_toggle == nullptr); _toggle = std::make_unique( diff --git a/ui/widgets/buttons.h b/ui/widgets/buttons.h index 239f6a7..7e0b83d 100644 --- a/ui/widgets/buttons.h +++ b/ui/widgets/buttons.h @@ -254,6 +254,7 @@ public: QWidget *parent, rpl::producer &&text, const style::SettingsButton &st); + ~SettingsButton(); SettingsButton *toggleOn(rpl::producer &&toggled); bool toggled() const; diff --git a/ui/widgets/menu/menu_toggle.cpp b/ui/widgets/menu/menu_toggle.cpp index eedc7bc..bc0da8c 100644 --- a/ui/widgets/menu/menu_toggle.cpp +++ b/ui/widgets/menu/menu_toggle.cpp @@ -27,7 +27,6 @@ Toggle::Toggle( , _toggleShift(st.itemToggleShift) , _itemToggle(st.itemToggle) , _itemToggleOver(st.itemToggleOver) { - const auto processAction = [=] { if (!action()->isCheckable()) { _toggle.reset(); @@ -52,9 +51,10 @@ Toggle::Toggle( } _toggle->setStyle(data.selected ? _itemToggleOver : _itemToggle); }, lifetime()); - } +Toggle::~Toggle() = default; + void Toggle::paintEvent(QPaintEvent *e) { Action::paintEvent(e); if (_toggle) { diff --git a/ui/widgets/menu/menu_toggle.h b/ui/widgets/menu/menu_toggle.h index 7806858..f83ad86 100644 --- a/ui/widgets/menu/menu_toggle.h +++ b/ui/widgets/menu/menu_toggle.h @@ -24,6 +24,7 @@ public: Fn &&callback, const style::icon *icon, const style::icon *iconOver); + ~Toggle(); void finishAnimating() override; From 594572199c032f01e075c673f36dfcda3f080321 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 26 Apr 2021 13:20:13 +0400 Subject: [PATCH 3/5] Move call mute button styles to td_ui. --- ui/paint/blob.cpp | 6 ++--- ui/widgets/widgets.style | 49 ---------------------------------------- 2 files changed, 3 insertions(+), 52 deletions(-) diff --git a/ui/paint/blob.cpp b/ui/paint/blob.cpp index 22ccf19..af9f830 100644 --- a/ui/paint/blob.cpp +++ b/ui/paint/blob.cpp @@ -86,12 +86,12 @@ void RadialBlob::paint(Painter &p, const QBrush &brush, float outerScale) { auto path = QPainterPath(); auto m = QMatrix(); - p.save(); const auto scale = (_minScale + (1. - _minScale) * _scale) * outerScale; if (scale == 0.) { - p.restore(); return; - } else if (scale != 1.) { + } + p.save(); + if (scale != 1.) { p.scale(scale, scale); } diff --git a/ui/widgets/widgets.style b/ui/widgets/widgets.style index 9bbffb1..f24bb1b 100644 --- a/ui/widgets/widgets.style +++ b/ui/widgets/widgets.style @@ -1419,55 +1419,6 @@ defaultToast: Toast { 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; // Windows specific title From db1df1b4bd3486404ce7146249c5eb204fe3ffc5 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 26 Apr 2021 13:44:28 +0400 Subject: [PATCH 4/5] Allow gradients default constructors. --- ui/effects/gradient.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/effects/gradient.h b/ui/effects/gradient.h index f6988c5..1c882f0 100644 --- a/ui/effects/gradient.h +++ b/ui/effects/gradient.h @@ -41,8 +41,9 @@ namespace details { template class gradients { public: + gradients() = default; gradients(base::flat_map> colors) { - Expects(colors.size() > 0); + Expects(!colors.empty()); for (const auto &[key, value] : colors) { auto c = gradient_colors(std::move(value)); @@ -50,7 +51,7 @@ public: } } gradients(base::flat_map colors) { - Expects(colors.size() > 0); + Expects(!colors.empty()); for (const auto &[key, c] : colors) { _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 { + Expects(!_gradients.empty()); + if (b_ratio == 0.) { return _gradients.find(state1)->second; } else if (b_ratio == 1.) { @@ -163,6 +166,7 @@ class linear_gradients final using parent = details::gradients>; public: + linear_gradients() = default; linear_gradients( base::flat_map> colors, QPointF point1, @@ -205,6 +209,7 @@ class radial_gradients final using parent = details::gradients>; public: + radial_gradients() = default; radial_gradients( base::flat_map> colors, QPointF center, From 14c67cf724a572186455a8c0639f037ae26cc762 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 27 Apr 2021 12:33:23 +0400 Subject: [PATCH 5/5] Handle locked screen as overlapping window. --- ui/integration.cpp | 4 ++++ ui/integration.h | 1 + ui/ui_utility.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/ui/integration.cpp b/ui/integration.cpp index 8bd1f71..ae25fc0 100644 --- a/ui/integration.cpp +++ b/ui/integration.cpp @@ -36,6 +36,10 @@ void Integration::textActionsUpdated() { void Integration::activationFromTopPanel() { } +bool Integration::screenIsLocked() { + return false; +} + QString Integration::timeFormat() { return u"hh:mm"_q; } diff --git a/ui/integration.h b/ui/integration.h index 94b09d3..c51f774 100644 --- a/ui/integration.h +++ b/ui/integration.h @@ -40,6 +40,7 @@ public: virtual void textActionsUpdated(); virtual void activationFromTopPanel(); + [[nodiscard]] virtual bool screenIsLocked(); [[nodiscard]] virtual QString timeFormat(); [[nodiscard]] virtual std::shared_ptr createLinkHandler( diff --git a/ui/ui_utility.cpp b/ui/ui_utility.cpp index 097cd74..10611d0 100644 --- a/ui/ui_utility.cpp +++ b/ui/ui_utility.cpp @@ -189,6 +189,8 @@ bool IsContentVisible( const auto activeOrNotOverlapped = [&] { if (const auto active = widget->isActiveWindow()) { return active; + } else if (Integration::Instance().screenIsLocked()) { + return false; } const auto mappedRect = QHighDpi::toNativePixels(