mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 09:41:41 -05:00
Improve RateCallBox design.
This commit is contained in:
parent
c78cc331d1
commit
96062039c7
3 changed files with 12 additions and 12 deletions
|
@ -38,11 +38,13 @@ constexpr auto kMaxRating = 5;
|
|||
|
||||
RateCallBox::RateCallBox(QWidget*, uint64 callId, uint64 callAccessHash)
|
||||
: _callId(callId)
|
||||
, _callAccessHash(callAccessHash)
|
||||
, _label(this, lang(lng_call_rate_label), Ui::FlatLabel::InitType::Simple, st::boxLabel) {
|
||||
, _callAccessHash(callAccessHash) {
|
||||
}
|
||||
|
||||
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(); });
|
||||
|
||||
for (auto i = 0; i < kMaxRating; ++i) {
|
||||
|
@ -57,9 +59,9 @@ void RateCallBox::prepare() {
|
|||
void RateCallBox::resizeEvent(QResizeEvent *e) {
|
||||
BoxContent::resizeEvent(e);
|
||||
|
||||
_label->moveToLeft(st::callRatingPadding.left(), st::callRatingPadding.top());
|
||||
auto starLeft = st::callRatingPadding.left() + st::callRatingStarLeft;
|
||||
auto starTop = _label->bottomNoMargins() + st::callRatingStarTop;
|
||||
auto starsWidth = (_stars.size() * st::callRatingStar.width);
|
||||
auto starLeft = (width() - starsWidth) / 2;
|
||||
auto starTop = st::callRatingStarTop;
|
||||
for (auto &star : _stars) {
|
||||
star->moveToLeft(starLeft, starTop);
|
||||
starLeft += star->width();
|
||||
|
@ -128,9 +130,9 @@ void RateCallBox::onSend() {
|
|||
}
|
||||
|
||||
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) {
|
||||
newHeight += st::callRatingCommentTop + _comment->height();
|
||||
}
|
||||
setDimensions(st::boxWidth, newHeight);
|
||||
setDimensions(st::boxWideWidth, newHeight);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ private:
|
|||
uint64 _callAccessHash = 0;
|
||||
int _rating = 0;
|
||||
|
||||
object_ptr<Ui::FlatLabel> _label;
|
||||
std::vector<object_ptr<Ui::IconButton>> _stars;
|
||||
object_ptr<Ui::InputArea> _comment = { nullptr };
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ callReDial: IconButton {
|
|||
rippleAreaSize: 40px;
|
||||
}
|
||||
|
||||
callRatingPadding: margins(24px, 26px, 24px, 8px);
|
||||
callRatingPadding: margins(24px, 26px, 24px, 0px);
|
||||
callRatingStar: IconButton {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
|
@ -182,13 +182,12 @@ callRatingStar: IconButton {
|
|||
rippleAreaSize: 36px;
|
||||
}
|
||||
callRatingStarFilled: icon {{ "call_rating_filled", lightButtonFg }};
|
||||
callRatingStarLeft: -7px;
|
||||
callRatingStarTop: 6px;
|
||||
callRatingStarTop: 4px;
|
||||
callRatingComment: InputField(defaultInputField) {
|
||||
textMargins: margins(1px, 26px, 1px, 4px);
|
||||
heightMax: 135px;
|
||||
}
|
||||
callRatingCommentTop: 2px;
|
||||
callRatingCommentTop: 8px;
|
||||
|
||||
callDebugLabel: FlatLabel(defaultFlatLabel) {
|
||||
margin: margins(24px, 0px, 24px, 0px);
|
||||
|
|
Loading…
Add table
Reference in a new issue