2015-02-03 15:02:46 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2015-02-03 15:02:46 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2015-02-03 15:02:46 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2019-01-17 08:18:23 +00:00
|
|
|
#include "base/binary_guard.h"
|
2017-04-06 14:38:10 +00:00
|
|
|
#include "boxes/abstract_box.h"
|
2019-01-17 08:18:23 +00:00
|
|
|
#include "window/themes/window_theme.h"
|
|
|
|
#include "history/admin_log/history_admin_log_item.h"
|
|
|
|
#include "history/view/history_view_element.h"
|
|
|
|
#include "ui/effects/radial_animation.h"
|
2015-02-03 15:02:46 +00:00
|
|
|
|
2016-11-21 16:24:23 +00:00
|
|
|
namespace Ui {
|
|
|
|
class RoundCheckbox;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
class BackgroundBox : public BoxContent {
|
2015-02-03 15:02:46 +00:00
|
|
|
public:
|
2016-12-13 17:07:56 +00:00
|
|
|
BackgroundBox(QWidget*);
|
2015-02-03 15:02:46 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
protected:
|
|
|
|
void prepare() override;
|
2015-02-03 15:02:46 +00:00
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
private:
|
2016-12-13 17:07:56 +00:00
|
|
|
void backgroundChosen(int index);
|
|
|
|
|
2016-10-20 16:32:15 +00:00
|
|
|
class Inner;
|
2016-12-13 17:07:56 +00:00
|
|
|
QPointer<Inner> _inner;
|
2015-02-03 15:02:46 +00:00
|
|
|
|
|
|
|
};
|
2019-01-17 08:18:23 +00:00
|
|
|
|
|
|
|
class BackgroundPreviewBox
|
|
|
|
: public BoxContent
|
|
|
|
, public HistoryView::ElementDelegate {
|
|
|
|
public:
|
|
|
|
BackgroundPreviewBox(QWidget*, const Data::WallPaper &paper);
|
|
|
|
|
|
|
|
static bool Start(const QString &slug, const QString &mode);
|
|
|
|
|
|
|
|
using Element = HistoryView::Element;
|
|
|
|
HistoryView::Context elementContext() override;
|
|
|
|
std::unique_ptr<Element> elementCreate(
|
|
|
|
not_null<HistoryMessage*> message) override;
|
|
|
|
std::unique_ptr<Element> elementCreate(
|
|
|
|
not_null<HistoryService*> message) override;
|
|
|
|
bool elementUnderCursor(not_null<const Element*> view) override;
|
|
|
|
void elementAnimationAutoplayAsync(
|
|
|
|
not_null<const Element*> element) override;
|
|
|
|
TimeMs elementHighlightTime(
|
|
|
|
not_null<const Element*> element) override;
|
|
|
|
bool elementInSelectionMode() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void apply();
|
|
|
|
void step_radial(TimeMs ms, bool timer);
|
|
|
|
QRect radialRect() const;
|
|
|
|
|
|
|
|
void checkLoadedDocument();
|
|
|
|
void paintImage(Painter &p);
|
|
|
|
void paintRadial(Painter &p, TimeMs ms);
|
|
|
|
void paintTexts(Painter &p, TimeMs ms);
|
|
|
|
|
|
|
|
AdminLog::OwnedItem _text1;
|
|
|
|
AdminLog::OwnedItem _text2;
|
|
|
|
Data::WallPaper _paper;
|
|
|
|
QImage _full;
|
|
|
|
QPixmap _scaled;
|
|
|
|
Ui::RadialAnimation _radial;
|
|
|
|
base::binary_guard _generating;
|
|
|
|
|
|
|
|
};
|