mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Added phrase for personal photo to short info box.
This commit is contained in:
parent
3a472d1b90
commit
65a344be76
4 changed files with 51 additions and 10 deletions
|
@ -1143,6 +1143,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_profile_shared_links#other" = "{count} shared links";
|
||||
"lng_profile_copy_phone" = "Copy Phone Number";
|
||||
"lng_profile_copy_fullname" = "Copy Name";
|
||||
"lng_profile_photo_by_you" = "photo set by you";
|
||||
|
||||
"lng_via_link_group_one" = "**{user}** restricts adding them to groups.\nYou can send them an invite link as message instead.";
|
||||
"lng_via_link_group_many#one" = "**{count} user** restricts adding them to groups.\nYou can send them an invite link as message instead.";
|
||||
|
|
|
@ -105,6 +105,7 @@ PeerShortInfoCover::PeerShortInfoCover(
|
|||
userpic
|
||||
) | rpl::start_with_next([=](PeerShortInfoUserpic &&value) {
|
||||
applyUserpic(std::move(value));
|
||||
applyAdditionalStatus(value.additionalStatus);
|
||||
}, lifetime());
|
||||
|
||||
style::PaletteChanged(
|
||||
|
@ -136,16 +137,7 @@ PeerShortInfoCover::PeerShortInfoCover(
|
|||
return base::EventFilterResult::Cancel;
|
||||
});
|
||||
|
||||
_name->moveToLeft(
|
||||
_st.namePosition.x(),
|
||||
_st.size - _st.namePosition.y() - _name->height(),
|
||||
_st.size);
|
||||
_status->moveToLeft(
|
||||
_st.statusPosition.x(),
|
||||
(_st.size
|
||||
- _st.statusPosition.y()
|
||||
- _status->height()),
|
||||
_st.size);
|
||||
refreshLabelsGeometry();
|
||||
|
||||
_roundedTopImage = QImage(
|
||||
QSize(_st.size, _st.radius) * style::DevicePixelRatio(),
|
||||
|
@ -415,6 +407,23 @@ QImage PeerShortInfoCover::currentVideoFrame() const {
|
|||
: QImage();
|
||||
}
|
||||
|
||||
void PeerShortInfoCover::applyAdditionalStatus(const QString &status) {
|
||||
if (status.isEmpty()) {
|
||||
if (_additionalStatus) {
|
||||
_additionalStatus.destroy();
|
||||
refreshLabelsGeometry();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_additionalStatus) {
|
||||
_additionalStatus->setText(status);
|
||||
} else {
|
||||
_additionalStatus.create(_widget.get(), status, _statusStyle->st);
|
||||
_additionalStatus->show();
|
||||
refreshLabelsGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
void PeerShortInfoCover::applyUserpic(PeerShortInfoUserpic &&value) {
|
||||
if (_index != value.index) {
|
||||
_index = value.index;
|
||||
|
@ -593,6 +602,28 @@ void PeerShortInfoCover::refreshBarImages() {
|
|||
_barLarge = makeBar(_largeWidth);
|
||||
}
|
||||
|
||||
void PeerShortInfoCover::refreshLabelsGeometry() {
|
||||
const auto statusTop = _st.size
|
||||
- _st.statusPosition.y()
|
||||
- _status->height();
|
||||
const auto diff = _st.namePosition.y()
|
||||
- _name->height()
|
||||
- _st.statusPosition.y();
|
||||
if (_additionalStatus) {
|
||||
_additionalStatus->moveToLeft(
|
||||
_status->x(),
|
||||
statusTop - diff - _additionalStatus->height());
|
||||
}
|
||||
_name->moveToLeft(
|
||||
_st.namePosition.x(),
|
||||
_st.size
|
||||
- _st.namePosition.y()
|
||||
- _name->height()
|
||||
- (_additionalStatus ? (diff + _additionalStatus->height()) : 0),
|
||||
_st.size);
|
||||
_status->moveToLeft(_st.statusPosition.x(), statusTop, _st.size);
|
||||
}
|
||||
|
||||
QRect PeerShortInfoCover::radialRect() const {
|
||||
const auto cover = _widget->rect();
|
||||
const auto size = st::boxLoadingSize;
|
||||
|
|
|
@ -50,6 +50,7 @@ struct PeerShortInfoUserpic {
|
|||
float64 photoLoadingProgress = 0.;
|
||||
std::shared_ptr<Media::Streaming::Document> videoDocument;
|
||||
crl::time videoStartPosition = 0;
|
||||
QString additionalStatus;
|
||||
};
|
||||
|
||||
class PeerShortInfoCover final {
|
||||
|
@ -87,6 +88,7 @@ private:
|
|||
[[nodiscard]] QImage currentVideoFrame() const;
|
||||
|
||||
void applyUserpic(PeerShortInfoUserpic &&value);
|
||||
void applyAdditionalStatus(const QString &status);
|
||||
[[nodiscard]] QRect radialRect() const;
|
||||
|
||||
void videoWaiting();
|
||||
|
@ -99,6 +101,7 @@ private:
|
|||
void updateRadialState();
|
||||
void refreshCoverCursor();
|
||||
void refreshBarImages();
|
||||
void refreshLabelsGeometry();
|
||||
|
||||
const style::ShortInfoCover &_st;
|
||||
|
||||
|
@ -108,6 +111,7 @@ private:
|
|||
object_ptr<Ui::FlatLabel> _name;
|
||||
std::unique_ptr<CustomLabelStyle> _statusStyle;
|
||||
object_ptr<Ui::FlatLabel> _status;
|
||||
object_ptr<Ui::FlatLabel> _additionalStatus = { nullptr };
|
||||
|
||||
std::array<QImage, 4> _roundMask;
|
||||
QImage _userpicImage;
|
||||
|
|
|
@ -335,6 +335,11 @@ bool ProcessCurrent(
|
|||
: state->photoView
|
||||
? state->photoView->owner().get()
|
||||
: nullptr;
|
||||
state->current.additionalStatus = ((state->photoId == userpicPhotoId)
|
||||
&& peer->isUser()
|
||||
&& peer->asUser()->hasPersonalPhoto())
|
||||
? tr::lng_profile_photo_by_you(tr::now)
|
||||
: QString();
|
||||
state->waitingLoad = false;
|
||||
if (!changedPhotoId
|
||||
&& (state->current.index > 0 || !changedUserpic)
|
||||
|
|
Loading…
Add table
Reference in a new issue