2016-08-19 19:26:31 +02:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-08-19 19:26:31 +02:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-08-19 19:26:31 +02:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "settings/settings_block_widget.h"
|
2016-09-28 13:15:03 +03:00
|
|
|
#include "ui/effects/radial_animation.h"
|
2017-09-13 19:57:44 +03:00
|
|
|
#include "ui/rp_widget.h"
|
2016-08-26 22:49:18 -06:00
|
|
|
|
2016-08-19 19:26:31 +02:00
|
|
|
namespace Settings {
|
|
|
|
|
2017-09-13 19:57:44 +03:00
|
|
|
class BackgroundRow : public Ui::RpWidget, private base::Subscriber {
|
2016-08-26 22:49:18 -06:00
|
|
|
Q_OBJECT
|
|
|
|
|
2016-08-19 19:26:31 +02:00
|
|
|
public:
|
2016-08-26 22:49:18 -06:00
|
|
|
BackgroundRow(QWidget *parent);
|
|
|
|
|
|
|
|
void updateImage();
|
2016-08-19 19:26:31 +02:00
|
|
|
|
|
|
|
protected:
|
2016-08-26 22:49:18 -06:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
|
2016-08-19 19:26:31 +02:00
|
|
|
int resizeGetHeight(int newWidth) override;
|
|
|
|
|
2016-08-26 22:49:18 -06:00
|
|
|
signals:
|
|
|
|
void chooseFromGallery();
|
|
|
|
void chooseFromFile();
|
2017-02-07 20:39:47 +03:00
|
|
|
void editTheme();
|
2016-12-20 16:03:51 +03:00
|
|
|
void useDefault();
|
2016-08-26 22:49:18 -06:00
|
|
|
|
2016-08-19 19:26:31 +02:00
|
|
|
private:
|
2016-12-20 16:03:51 +03:00
|
|
|
void checkNonDefaultTheme();
|
|
|
|
|
2016-08-26 22:49:18 -06:00
|
|
|
float64 radialProgress() const;
|
|
|
|
bool radialLoading() const;
|
|
|
|
QRect radialRect() const;
|
|
|
|
void radialStart();
|
2016-12-01 22:20:33 +03:00
|
|
|
TimeMs radialTimeShift() const;
|
|
|
|
void step_radial(TimeMs ms, bool timer);
|
2016-08-26 22:49:18 -06:00
|
|
|
|
|
|
|
QPixmap _background;
|
2016-12-21 11:38:36 +03:00
|
|
|
object_ptr<Ui::LinkButton> _useDefaultTheme = { nullptr };
|
2016-12-13 20:07:56 +03:00
|
|
|
object_ptr<Ui::LinkButton> _chooseFromGallery;
|
|
|
|
object_ptr<Ui::LinkButton> _chooseFromFile;
|
2017-02-07 20:39:47 +03:00
|
|
|
object_ptr<Ui::LinkButton> _editTheme;
|
2016-08-26 22:49:18 -06:00
|
|
|
|
2016-09-28 13:15:03 +03:00
|
|
|
Ui::RadialAnimation _radial;
|
2016-08-26 22:49:18 -06:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class BackgroundWidget : public BlockWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
BackgroundWidget(QWidget *parent, UserData *self);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onChooseFromGallery();
|
|
|
|
void onChooseFromFile();
|
2017-02-07 20:39:47 +03:00
|
|
|
void onEditTheme();
|
2016-12-21 11:38:36 +03:00
|
|
|
void onUseDefaultTheme();
|
2016-08-26 22:49:18 -06:00
|
|
|
void onTile();
|
|
|
|
void onAdaptive();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void createControls();
|
|
|
|
void needBackgroundUpdate(bool tile);
|
|
|
|
|
2017-09-13 19:57:44 +03:00
|
|
|
BackgroundRow *_background = nullptr;
|
|
|
|
Ui::Checkbox *_tile = nullptr;
|
|
|
|
Ui::SlideWrap<Ui::Checkbox> *_adaptive = nullptr;
|
2016-08-26 22:49:18 -06:00
|
|
|
|
2016-08-19 19:26:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Settings
|