Extract PeerShortInfoCover from the box.
This commit is contained in:
parent
b5f50a4b9f
commit
bcddda3cd3
File diff suppressed because it is too large
Load Diff
|
@ -9,6 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
|
|
||||||
|
namespace style {
|
||||||
|
struct ShortInfoCover;
|
||||||
|
} // namespace style
|
||||||
|
|
||||||
namespace Media::Streaming {
|
namespace Media::Streaming {
|
||||||
class Document;
|
class Document;
|
||||||
class Instance;
|
class Instance;
|
||||||
|
@ -47,48 +51,39 @@ struct PeerShortInfoUserpic {
|
||||||
crl::time videoStartPosition = 0;
|
crl::time videoStartPosition = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PeerShortInfoBox final : public Ui::BoxContent {
|
class PeerShortInfoCover final {
|
||||||
public:
|
public:
|
||||||
PeerShortInfoBox(
|
PeerShortInfoCover(
|
||||||
QWidget*,
|
not_null<QWidget*> parent,
|
||||||
PeerShortInfoType type,
|
const style::ShortInfoCover &st,
|
||||||
rpl::producer<PeerShortInfoFields> fields,
|
rpl::producer<QString> name,
|
||||||
rpl::producer<QString> status,
|
rpl::producer<QString> status,
|
||||||
rpl::producer<PeerShortInfoUserpic> userpic,
|
rpl::producer<PeerShortInfoUserpic> userpic,
|
||||||
Fn<bool()> videoPaused);
|
Fn<bool()> videoPaused);
|
||||||
~PeerShortInfoBox();
|
~PeerShortInfoCover();
|
||||||
|
|
||||||
|
[[nodiscard]] object_ptr<Ui::RpWidget> takeOwned();
|
||||||
|
|
||||||
|
void setScrollTop(int scrollTop);
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<> openRequests() const;
|
|
||||||
[[nodiscard]] rpl::producer<int> moveRequests() const;
|
[[nodiscard]] rpl::producer<int> moveRequests() const;
|
||||||
|
|
||||||
|
[[nodiscard]] rpl::lifetime &lifetime();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CustomLabelStyle;
|
struct CustomLabelStyle;
|
||||||
struct Radial;
|
struct Radial;
|
||||||
|
|
||||||
void prepare() override;
|
void paint(QPainter &p);
|
||||||
void prepareRows();
|
|
||||||
RectParts customCornersFilling() override;
|
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
|
||||||
|
|
||||||
void paintCover(QPainter &p);
|
|
||||||
void paintCoverImage(QPainter &p, const QImage &image);
|
void paintCoverImage(QPainter &p, const QImage &image);
|
||||||
void paintBars(QPainter &p);
|
void paintBars(QPainter &p);
|
||||||
void paintShadow(QPainter &p);
|
void paintShadow(QPainter &p);
|
||||||
void paintRadial(QPainter &p);
|
void paintRadial(QPainter &p);
|
||||||
|
|
||||||
void refreshRoundedTopImage(const QColor &color);
|
|
||||||
int fillRoundedTopHeight();
|
|
||||||
|
|
||||||
[[nodiscard]] QImage currentVideoFrame() const;
|
[[nodiscard]] QImage currentVideoFrame() const;
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<QString> nameValue() const;
|
|
||||||
[[nodiscard]] rpl::producer<TextWithEntities> linkValue() const;
|
|
||||||
[[nodiscard]] rpl::producer<QString> phoneValue() const;
|
|
||||||
[[nodiscard]] rpl::producer<QString> usernameValue() const;
|
|
||||||
[[nodiscard]] rpl::producer<TextWithEntities> aboutValue() const;
|
|
||||||
void applyUserpic(PeerShortInfoUserpic &&value);
|
void applyUserpic(PeerShortInfoUserpic &&value);
|
||||||
QRect radialRect() const;
|
[[nodiscard]] QRect radialRect() const;
|
||||||
|
|
||||||
void videoWaiting();
|
void videoWaiting();
|
||||||
void checkStreamedIsStarted();
|
void checkStreamedIsStarted();
|
||||||
|
@ -100,16 +95,11 @@ private:
|
||||||
void updateRadialState();
|
void updateRadialState();
|
||||||
void refreshCoverCursor();
|
void refreshCoverCursor();
|
||||||
void refreshBarImages();
|
void refreshBarImages();
|
||||||
void radialCallback();
|
|
||||||
|
|
||||||
const PeerShortInfoType _type = PeerShortInfoType::User;
|
const style::ShortInfoCover &_st;
|
||||||
|
|
||||||
rpl::variable<PeerShortInfoFields> _fields;
|
object_ptr<Ui::RpWidget> _owned;
|
||||||
|
const not_null<Ui::RpWidget*> _widget;
|
||||||
object_ptr<Ui::RpWidget> _topRoundBackground;
|
|
||||||
object_ptr<Ui::ScrollArea> _scroll;
|
|
||||||
not_null<Ui::VerticalLayout*> _rows;
|
|
||||||
not_null<Ui::RpWidget*> _cover;
|
|
||||||
std::unique_ptr<CustomLabelStyle> _nameStyle;
|
std::unique_ptr<CustomLabelStyle> _nameStyle;
|
||||||
object_ptr<Ui::FlatLabel> _name;
|
object_ptr<Ui::FlatLabel> _name;
|
||||||
std::unique_ptr<CustomLabelStyle> _statusStyle;
|
std::unique_ptr<CustomLabelStyle> _statusStyle;
|
||||||
|
@ -117,11 +107,10 @@ private:
|
||||||
|
|
||||||
QImage _userpicImage;
|
QImage _userpicImage;
|
||||||
QImage _roundedTopImage;
|
QImage _roundedTopImage;
|
||||||
QColor _roundedTopColor;
|
|
||||||
QImage _roundedTop;
|
|
||||||
QImage _barSmall;
|
QImage _barSmall;
|
||||||
QImage _barLarge;
|
QImage _barLarge;
|
||||||
QImage _shadowTop;
|
QImage _shadowTop;
|
||||||
|
int _scrollTop = 0;
|
||||||
int _smallWidth = 0;
|
int _smallWidth = 0;
|
||||||
int _largeWidth = 0;
|
int _largeWidth = 0;
|
||||||
int _index = 0;
|
int _index = 0;
|
||||||
|
@ -139,7 +128,52 @@ private:
|
||||||
std::unique_ptr<Radial> _radial;
|
std::unique_ptr<Radial> _radial;
|
||||||
float64 _photoLoadingProgress = 0.;
|
float64 _photoLoadingProgress = 0.;
|
||||||
|
|
||||||
rpl::event_stream<> _openRequests;
|
|
||||||
rpl::event_stream<int> _moveRequests;
|
rpl::event_stream<int> _moveRequests;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PeerShortInfoBox final : public Ui::BoxContent {
|
||||||
|
public:
|
||||||
|
PeerShortInfoBox(
|
||||||
|
QWidget*,
|
||||||
|
PeerShortInfoType type,
|
||||||
|
rpl::producer<PeerShortInfoFields> fields,
|
||||||
|
rpl::producer<QString> status,
|
||||||
|
rpl::producer<PeerShortInfoUserpic> userpic,
|
||||||
|
Fn<bool()> videoPaused);
|
||||||
|
~PeerShortInfoBox();
|
||||||
|
|
||||||
|
[[nodiscard]] rpl::producer<> openRequests() const;
|
||||||
|
[[nodiscard]] rpl::producer<int> moveRequests() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void prepare() override;
|
||||||
|
void prepareRows();
|
||||||
|
RectParts customCornersFilling() override;
|
||||||
|
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
|
void refreshRoundedTopImage(const QColor &color);
|
||||||
|
int fillRoundedTopHeight();
|
||||||
|
|
||||||
|
[[nodiscard]] rpl::producer<QString> nameValue() const;
|
||||||
|
[[nodiscard]] rpl::producer<TextWithEntities> linkValue() const;
|
||||||
|
[[nodiscard]] rpl::producer<QString> phoneValue() const;
|
||||||
|
[[nodiscard]] rpl::producer<QString> usernameValue() const;
|
||||||
|
[[nodiscard]] rpl::producer<TextWithEntities> aboutValue() const;
|
||||||
|
|
||||||
|
const PeerShortInfoType _type = PeerShortInfoType::User;
|
||||||
|
|
||||||
|
rpl::variable<PeerShortInfoFields> _fields;
|
||||||
|
|
||||||
|
QColor _roundedTopColor;
|
||||||
|
QImage _roundedTop;
|
||||||
|
|
||||||
|
object_ptr<Ui::RpWidget> _topRoundBackground;
|
||||||
|
object_ptr<Ui::ScrollArea> _scroll;
|
||||||
|
not_null<Ui::VerticalLayout*> _rows;
|
||||||
|
PeerShortInfoCover _cover;
|
||||||
|
|
||||||
|
rpl::event_stream<> _openRequests;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
|
@ -953,27 +953,8 @@ infoAboutGigagroup: FlatLabel(defaultFlatLabel) {
|
||||||
infoScrollDateHideTimeout: historyScrollDateHideTimeout;
|
infoScrollDateHideTimeout: historyScrollDateHideTimeout;
|
||||||
infoDateFadeDuration: historyDateFadeDuration;
|
infoDateFadeDuration: historyDateFadeDuration;
|
||||||
|
|
||||||
shortInfoName: FlatLabel(defaultFlatLabel) {
|
|
||||||
textFg: groupCallVideoTextFg;
|
|
||||||
maxHeight: 19px;
|
|
||||||
style: TextStyle(defaultTextStyle) {
|
|
||||||
font: font(15px semibold);
|
|
||||||
linkFont: font(15px semibold);
|
|
||||||
linkFontOver: font(15px semibold underline);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
shortInfoStatus: FlatLabel(defaultFlatLabel) {
|
|
||||||
textFg: groupCallVideoSubTextFg;
|
|
||||||
maxHeight: 18px;
|
|
||||||
}
|
|
||||||
shortInfoWidth: 304px;
|
shortInfoWidth: 304px;
|
||||||
shortInfoNamePosition: point(25px, 37px);
|
|
||||||
shortInfoStatusPosition: point(25px, 14px);
|
|
||||||
shortInfoShadowHeight: 80px;
|
|
||||||
shortInfoLabeledPadding: margins(20px, 16px, 20px, 0px);
|
shortInfoLabeledPadding: margins(20px, 16px, 20px, 0px);
|
||||||
shortInfoLinePadding: 8px;
|
|
||||||
shortInfoLineSkip: 4px;
|
|
||||||
shortInfoLine: 2px;
|
|
||||||
shortInfoScroll: ScrollArea(defaultScrollArea) {
|
shortInfoScroll: ScrollArea(defaultScrollArea) {
|
||||||
deltat: 3px;
|
deltat: 3px;
|
||||||
deltab: 0px;
|
deltab: 0px;
|
||||||
|
@ -985,7 +966,41 @@ shortInfoScroll: ScrollArea(defaultScrollArea) {
|
||||||
hiding: 1000;
|
hiding: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
shortInfoRadialAnimation: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
|
ShortInfoCover {
|
||||||
color: radialFg;
|
size: pixels;
|
||||||
thickness: 2px;
|
name: FlatLabel;
|
||||||
|
namePosition: point;
|
||||||
|
status: FlatLabel;
|
||||||
|
statusPosition: point;
|
||||||
|
linePadding: pixels;
|
||||||
|
lineSkip: pixels;
|
||||||
|
line: pixels;
|
||||||
|
shadowHeight: pixels;
|
||||||
|
radialAnimation: InfiniteRadialAnimation;
|
||||||
|
}
|
||||||
|
shortInfoCover: ShortInfoCover {
|
||||||
|
size: shortInfoWidth;
|
||||||
|
name: FlatLabel(defaultFlatLabel) {
|
||||||
|
textFg: groupCallVideoTextFg;
|
||||||
|
maxHeight: 19px;
|
||||||
|
style: TextStyle(defaultTextStyle) {
|
||||||
|
font: font(15px semibold);
|
||||||
|
linkFont: font(15px semibold);
|
||||||
|
linkFontOver: font(15px semibold underline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
namePosition: point(25px, 37px);
|
||||||
|
status: FlatLabel(defaultFlatLabel) {
|
||||||
|
textFg: groupCallVideoSubTextFg;
|
||||||
|
maxHeight: 18px;
|
||||||
|
}
|
||||||
|
statusPosition: point(25px, 14px);
|
||||||
|
linePadding: 8px;
|
||||||
|
lineSkip: 4px;
|
||||||
|
line: 2px;
|
||||||
|
shadowHeight: 80px;
|
||||||
|
radialAnimation: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
|
||||||
|
color: radialFg;
|
||||||
|
thickness: 2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue