diff --git a/Telegram/SourceFiles/window/window_connecting_widget.cpp b/Telegram/SourceFiles/window/window_connecting_widget.cpp index 59fca8434c..232b3327fd 100644 --- a/Telegram/SourceFiles/window/window_connecting_widget.cpp +++ b/Telegram/SourceFiles/window/window_connecting_widget.cpp @@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/buttons.h" #include "ui/effects/radial_animation.h" +#include "window/themes/window_theme.h" #include "boxes/connection_box.h" #include "lang/lang_keys.h" #include "styles/style_window.h" @@ -65,7 +66,9 @@ void Progress::step(TimeMs ms, bool timer) { } // namespace -class ConnectingWidget::ProxyIcon : public Ui::RpWidget { +class ConnectingWidget::ProxyIcon + : public Ui::RpWidget + , private base::Subscriber { public: ProxyIcon(QWidget *parent); @@ -76,6 +79,8 @@ protected: void paintEvent(QPaintEvent *e) override; private: + void refreshCacheImages(); + float64 _opacity = 1.; QPixmap _cacheOn; QPixmap _cacheOff; @@ -92,10 +97,22 @@ ConnectingWidget::ProxyIcon::ProxyIcon(QWidget *parent) : RpWidget(parent) { st::connectingRadial.size.height(), st::connectingProxyOn.height())); + using namespace Window::Theme; + subscribe(Background(), [=](const BackgroundUpdate &update) { + if (update.paletteChanged()) { + refreshCacheImages(); + } + }); + + refreshCacheImages(); +} + +void ConnectingWidget::ProxyIcon::refreshCacheImages() { const auto prepareCache = [&](const style::icon &icon) { auto image = QImage( size() * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); + image.setDevicePixelRatio(cRetinaFactor()); image.fill(st::windowBg->c); { Painter p(&image);