mirror of https://github.com/procxx/kepka.git
parent
296e009808
commit
5c5bccae0b
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/effects/radial_animation.h"
|
#include "ui/effects/radial_animation.h"
|
||||||
|
#include "window/themes/window_theme.h"
|
||||||
#include "boxes/connection_box.h"
|
#include "boxes/connection_box.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
|
@ -65,7 +66,9 @@ void Progress::step(TimeMs ms, bool timer) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class ConnectingWidget::ProxyIcon : public Ui::RpWidget {
|
class ConnectingWidget::ProxyIcon
|
||||||
|
: public Ui::RpWidget
|
||||||
|
, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
ProxyIcon(QWidget *parent);
|
ProxyIcon(QWidget *parent);
|
||||||
|
|
||||||
|
@ -76,6 +79,8 @@ protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void refreshCacheImages();
|
||||||
|
|
||||||
float64 _opacity = 1.;
|
float64 _opacity = 1.;
|
||||||
QPixmap _cacheOn;
|
QPixmap _cacheOn;
|
||||||
QPixmap _cacheOff;
|
QPixmap _cacheOff;
|
||||||
|
@ -92,10 +97,22 @@ ConnectingWidget::ProxyIcon::ProxyIcon(QWidget *parent) : RpWidget(parent) {
|
||||||
st::connectingRadial.size.height(),
|
st::connectingRadial.size.height(),
|
||||||
st::connectingProxyOn.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) {
|
const auto prepareCache = [&](const style::icon &icon) {
|
||||||
auto image = QImage(
|
auto image = QImage(
|
||||||
size() * cIntRetinaFactor(),
|
size() * cIntRetinaFactor(),
|
||||||
QImage::Format_ARGB32_Premultiplied);
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
|
image.setDevicePixelRatio(cRetinaFactor());
|
||||||
image.fill(st::windowBg->c);
|
image.fill(st::windowBg->c);
|
||||||
{
|
{
|
||||||
Painter p(&image);
|
Painter p(&image);
|
||||||
|
|
Loading…
Reference in New Issue