Skip to content

Commit

Permalink
Improve RateCallBox design.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed May 9, 2017
1 parent c78cc33 commit 9606203
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 9 additions & 7 deletions Telegram/SourceFiles/boxes/rate_call_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down Expand Up @@ -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);
}
1 change: 0 additions & 1 deletion Telegram/SourceFiles/boxes/rate_call_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ private slots:
uint64 _callAccessHash = 0;
int _rating = 0;

object_ptr<Ui::FlatLabel> _label;
std::vector<object_ptr<Ui::IconButton>> _stars;
object_ptr<Ui::InputArea> _comment = { nullptr };

Expand Down
7 changes: 3 additions & 4 deletions Telegram/SourceFiles/calls/calls.style
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 9606203

Please sign in to comment.