mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Improve RateCallBox design.
This commit is contained in:
parent
c78cc331d1
commit
96062039c7
Telegram/SourceFiles
@ -38,11 +38,13 @@ constexpr auto kMaxRating = 5;
|
|||||||
|
|
||||||
RateCallBox::RateCallBox(QWidget*, uint64 callId, uint64 callAccessHash)
|
RateCallBox::RateCallBox(QWidget*, uint64 callId, uint64 callAccessHash)
|
||||||
: _callId(callId)
|
: _callId(callId)
|
||||||
, _callAccessHash(callAccessHash)
|
, _callAccessHash(callAccessHash) {
|
||||||
, _label(this, lang(lng_call_rate_label), Ui::FlatLabel::InitType::Simple, st::boxLabel) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RateCallBox::prepare() {
|
void RateCallBox::prepare() {
|
||||||
|
auto titleWidth = st::boxWideWidth - 2 * st::boxTitlePosition.x();
|
||||||
|
auto titleText = st::boxTitleFont->elided(lang(lng_call_rate_label), titleWidth);
|
||||||
|
setTitle(titleText);
|
||||||
addButton(lang(lng_cancel), [this] { closeBox(); });
|
addButton(lang(lng_cancel), [this] { closeBox(); });
|
||||||
|
|
||||||
for (auto i = 0; i < kMaxRating; ++i) {
|
for (auto i = 0; i < kMaxRating; ++i) {
|
||||||
@ -57,9 +59,9 @@ void RateCallBox::prepare() {
|
|||||||
void RateCallBox::resizeEvent(QResizeEvent *e) {
|
void RateCallBox::resizeEvent(QResizeEvent *e) {
|
||||||
BoxContent::resizeEvent(e);
|
BoxContent::resizeEvent(e);
|
||||||
|
|
||||||
_label->moveToLeft(st::callRatingPadding.left(), st::callRatingPadding.top());
|
auto starsWidth = (_stars.size() * st::callRatingStar.width);
|
||||||
auto starLeft = st::callRatingPadding.left() + st::callRatingStarLeft;
|
auto starLeft = (width() - starsWidth) / 2;
|
||||||
auto starTop = _label->bottomNoMargins() + st::callRatingStarTop;
|
auto starTop = st::callRatingStarTop;
|
||||||
for (auto &star : _stars) {
|
for (auto &star : _stars) {
|
||||||
star->moveToLeft(starLeft, starTop);
|
star->moveToLeft(starLeft, starTop);
|
||||||
starLeft += star->width();
|
starLeft += star->width();
|
||||||
@ -128,9 +130,9 @@ void RateCallBox::onSend() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RateCallBox::updateMaxHeight() {
|
void RateCallBox::updateMaxHeight() {
|
||||||
auto newHeight = st::callRatingPadding.top() + _label->heightNoMargins() + st::callRatingStarTop + _stars.back()->heightNoMargins() + st::callRatingPadding.bottom();
|
auto newHeight = st::callRatingPadding.top() + st::callRatingStarTop + _stars.back()->heightNoMargins() + st::callRatingPadding.bottom();
|
||||||
if (_comment) {
|
if (_comment) {
|
||||||
newHeight += st::callRatingCommentTop + _comment->height();
|
newHeight += st::callRatingCommentTop + _comment->height();
|
||||||
}
|
}
|
||||||
setDimensions(st::boxWidth, newHeight);
|
setDimensions(st::boxWideWidth, newHeight);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,6 @@ private:
|
|||||||
uint64 _callAccessHash = 0;
|
uint64 _callAccessHash = 0;
|
||||||
int _rating = 0;
|
int _rating = 0;
|
||||||
|
|
||||||
object_ptr<Ui::FlatLabel> _label;
|
|
||||||
std::vector<object_ptr<Ui::IconButton>> _stars;
|
std::vector<object_ptr<Ui::IconButton>> _stars;
|
||||||
object_ptr<Ui::InputArea> _comment = { nullptr };
|
object_ptr<Ui::InputArea> _comment = { nullptr };
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ callReDial: IconButton {
|
|||||||
rippleAreaSize: 40px;
|
rippleAreaSize: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
callRatingPadding: margins(24px, 26px, 24px, 8px);
|
callRatingPadding: margins(24px, 26px, 24px, 0px);
|
||||||
callRatingStar: IconButton {
|
callRatingStar: IconButton {
|
||||||
width: 36px;
|
width: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
@ -182,13 +182,12 @@ callRatingStar: IconButton {
|
|||||||
rippleAreaSize: 36px;
|
rippleAreaSize: 36px;
|
||||||
}
|
}
|
||||||
callRatingStarFilled: icon {{ "call_rating_filled", lightButtonFg }};
|
callRatingStarFilled: icon {{ "call_rating_filled", lightButtonFg }};
|
||||||
callRatingStarLeft: -7px;
|
callRatingStarTop: 4px;
|
||||||
callRatingStarTop: 6px;
|
|
||||||
callRatingComment: InputField(defaultInputField) {
|
callRatingComment: InputField(defaultInputField) {
|
||||||
textMargins: margins(1px, 26px, 1px, 4px);
|
textMargins: margins(1px, 26px, 1px, 4px);
|
||||||
heightMax: 135px;
|
heightMax: 135px;
|
||||||
}
|
}
|
||||||
callRatingCommentTop: 2px;
|
callRatingCommentTop: 8px;
|
||||||
|
|
||||||
callDebugLabel: FlatLabel(defaultFlatLabel) {
|
callDebugLabel: FlatLabel(defaultFlatLabel) {
|
||||||
margin: margins(24px, 0px, 24px, 0px);
|
margin: margins(24px, 0px, 24px, 0px);
|
||||||
|
Loading…
Reference in New Issue
Block a user