mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-05 14:47:39 +00:00
parent
296e009808
commit
5c5bccae0b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user