Change button round radius.
This commit is contained in:
parent
a527d5c535
commit
dde94d486b
|
@ -597,8 +597,8 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
|
||||
QSize StickerSetBox::Inner::boundingBoxSize() const {
|
||||
return QSize(
|
||||
st::stickersSize.width() - st::buttonRadius * 2,
|
||||
st::stickersSize.height() - st::buttonRadius * 2);
|
||||
st::stickersSize.width() - st::roundRadiusSmall * 2,
|
||||
st::stickersSize.height() - st::roundRadiusSmall * 2);
|
||||
}
|
||||
|
||||
void StickerSetBox::Inner::visibleTopBottomUpdated(
|
||||
|
@ -684,7 +684,7 @@ void StickerSetBox::Inner::paintSticker(
|
|||
w = std::max(size.width(), 1);
|
||||
h = std::max(size.height(), 1);
|
||||
} else {
|
||||
auto coef = qMin((st::stickersSize.width() - st::buttonRadius * 2) / float64(document->dimensions.width()), (st::stickersSize.height() - st::buttonRadius * 2) / float64(document->dimensions.height()));
|
||||
auto coef = qMin((st::stickersSize.width() - st::roundRadiusSmall * 2) / float64(document->dimensions.width()), (st::stickersSize.height() - st::roundRadiusSmall * 2) / float64(document->dimensions.height()));
|
||||
if (coef > 1) coef = 1;
|
||||
w = std::max(qRound(coef * document->dimensions.width()), 1);
|
||||
h = std::max(qRound(coef * document->dimensions.height()), 1);
|
||||
|
|
|
@ -1369,7 +1369,7 @@ void StickersBox::Inner::setActionDown(int newActionDown) {
|
|||
if (_section == Section::Installed) {
|
||||
if (row->removed) {
|
||||
auto rippleSize = QSize(_undoWidth - st::stickersUndoRemove.width, st::stickersUndoRemove.height);
|
||||
auto rippleMask = Ui::RippleAnimation::roundRectMask(rippleSize, st::buttonRadius);
|
||||
auto rippleMask = Ui::RippleAnimation::roundRectMask(rippleSize, st::roundRadiusSmall);
|
||||
ensureRipple(st::stickersUndoRemove.ripple, std::move(rippleMask), removeButton);
|
||||
} else {
|
||||
auto rippleSize = st::stickersRemove.rippleAreaSize;
|
||||
|
@ -1378,7 +1378,7 @@ void StickersBox::Inner::setActionDown(int newActionDown) {
|
|||
}
|
||||
} else if (!row->installed || row->archived || row->removed) {
|
||||
auto rippleSize = QSize(_addWidth - st::stickersTrendingAdd.width, st::stickersTrendingAdd.height);
|
||||
auto rippleMask = Ui::RippleAnimation::roundRectMask(rippleSize, st::buttonRadius);
|
||||
auto rippleMask = Ui::RippleAnimation::roundRectMask(rippleSize, st::roundRadiusSmall);
|
||||
ensureRipple(st::stickersTrendingAdd.ripple, std::move(rippleMask), removeButton);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ object_ptr<Ui::RpWidget> CreateFingerprintAndSignalBars(
|
|||
fullBarsSize.width(),
|
||||
height);
|
||||
const auto bigRadius = height / 2;
|
||||
const auto smallRadius = st::buttonRadius;
|
||||
const auto smallRadius = st::roundRadiusSmall;
|
||||
const auto hq = PainterHighQualityEnabler(p);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(st::callBgButton);
|
||||
|
|
|
@ -69,7 +69,7 @@ void Style::repaint(not_null<const HistoryItem*> item) const {
|
|||
}
|
||||
|
||||
int Style::buttonRadius() const {
|
||||
return st::buttonRadius;
|
||||
return st::roundRadiusSmall;
|
||||
}
|
||||
|
||||
void Style::paintButtonBg(
|
||||
|
|
|
@ -478,7 +478,7 @@ EmojiListWidget::SectionInfo EmojiListWidget::sectionInfoByOffset(int yOffset) c
|
|||
}
|
||||
|
||||
int EmojiListWidget::countDesiredHeight(int newWidth) {
|
||||
auto fullWidth = (st::buttonRadius + newWidth + st::emojiScroll.width);
|
||||
auto fullWidth = (st::roundRadiusSmall + newWidth + st::emojiScroll.width);
|
||||
_columnCount = std::max(
|
||||
(fullWidth - st::emojiPadding * 2) / st::emojiPanDesiredSize,
|
||||
1);
|
||||
|
@ -487,7 +487,7 @@ int EmojiListWidget::countDesiredHeight(int newWidth) {
|
|||
auto rowsRight = std::max(_rowsLeft, st::emojiScroll.width);
|
||||
auto singleWidth = (fullWidth - _rowsLeft - rowsRight)
|
||||
/ _columnCount;
|
||||
_rowsLeft -= st::buttonRadius;
|
||||
_rowsLeft -= st::roundRadiusSmall;
|
||||
_singleSize = QSize(singleWidth, singleWidth - 4 * st::lineWidth);
|
||||
_picker->setSingleSize(_singleSize);
|
||||
return sectionInfo(kEmojiSectionCount - 1).rowsBottom + st::emojiPanPadding;
|
||||
|
@ -541,7 +541,7 @@ void EmojiListWidget::paintEvent(QPaintEvent *e) {
|
|||
if (info.section > 0 && r.top() < info.rowsTop) {
|
||||
p.setFont(st::emojiPanHeaderFont);
|
||||
p.setPen(st::emojiPanHeaderFg);
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::emojiPanHeaderTop, width(), ChatHelpers::EmojiCategoryTitle(info.section)(tr::now));
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::roundRadiusSmall, info.top + st::emojiPanHeaderTop, width(), ChatHelpers::EmojiCategoryTitle(info.section)(tr::now));
|
||||
}
|
||||
if (r.top() + r.height() > info.rowsTop) {
|
||||
ensureLoaded(info.section);
|
||||
|
@ -663,9 +663,9 @@ void EmojiListWidget::showPicker() {
|
|||
_picker->showEmoji(_emoji[section][sel]);
|
||||
|
||||
auto y = emojiRect(section, sel).y();
|
||||
y -= _picker->height() - st::buttonRadius + getVisibleTop();
|
||||
y -= _picker->height() - st::roundRadiusSmall + getVisibleTop();
|
||||
if (y < st::emojiPanHeader) {
|
||||
y += _picker->height() - st::buttonRadius + _singleSize.height() - st::buttonRadius;
|
||||
y += _picker->height() - st::roundRadiusSmall + _singleSize.height() - st::roundRadiusSmall;
|
||||
}
|
||||
auto xmax = width() - _picker->width();
|
||||
auto coef = float64(sel % _columnCount) / float64(_columnCount - 1);
|
||||
|
|
|
@ -801,8 +801,8 @@ void FieldAutocomplete::Inner::paintEvent(QPaintEvent *e) {
|
|||
} else {
|
||||
const auto coef = std::min(
|
||||
std::min(
|
||||
(st::stickerPanSize.width() - st::buttonRadius * 2) / float64(document->dimensions.width()),
|
||||
(st::stickerPanSize.height() - st::buttonRadius * 2) / float64(document->dimensions.height())),
|
||||
(st::stickerPanSize.width() - st::roundRadiusSmall * 2) / float64(document->dimensions.width()),
|
||||
(st::stickerPanSize.height() - st::roundRadiusSmall * 2) / float64(document->dimensions.height())),
|
||||
1.);
|
||||
w = std::max(qRound(coef * document->dimensions.width()), 1);
|
||||
h = std::max(qRound(coef * document->dimensions.height()), 1);
|
||||
|
@ -1220,8 +1220,8 @@ void FieldAutocomplete::Inner::setupLottie(StickerSuggestion &suggestion) {
|
|||
|
||||
QSize FieldAutocomplete::Inner::stickerBoundingBox() const {
|
||||
return QSize(
|
||||
st::stickerPanSize.width() - st::buttonRadius * 2,
|
||||
st::stickerPanSize.height() - st::buttonRadius * 2);
|
||||
st::stickerPanSize.width() - st::roundRadiusSmall * 2,
|
||||
st::stickerPanSize.height() - st::roundRadiusSmall * 2);
|
||||
}
|
||||
|
||||
void FieldAutocomplete::Inner::repaintSticker(
|
||||
|
|
|
@ -329,7 +329,7 @@ void GifsListWidget::paintInlineItems(Painter &p, QRect clip) {
|
|||
break;
|
||||
}
|
||||
if (top + inlineRow.height > clip.top()) {
|
||||
auto left = st::inlineResultsLeft - st::buttonRadius;
|
||||
auto left = st::inlineResultsLeft - st::roundRadiusSmall;
|
||||
if (row == rows - 1) context.lastRow = true;
|
||||
for (int col = 0, cols = inlineRow.items.size(); col < cols; ++col) {
|
||||
if (left >= tox) break;
|
||||
|
@ -559,7 +559,7 @@ bool GifsListWidget::inlineRowFinalize(Row &row, int32 &sumWidth, bool force) {
|
|||
auto full = (row.items.size() >= kInlineItemsMaxPerRow);
|
||||
|
||||
// Currently use the same GIFs layout for all widget sizes.
|
||||
// auto big = (sumWidth >= st::buttonRadius + width() - st::inlineResultsLeft);
|
||||
// auto big = (sumWidth >= st::roundRadiusSmall + width() - st::inlineResultsLeft);
|
||||
auto big = (sumWidth >= st::emojiPanWidth - st::inlineResultsLeft);
|
||||
if (full || big || force) {
|
||||
row.maxWidth = (full || big) ? sumWidth : 0;
|
||||
|
@ -701,7 +701,7 @@ void GifsListWidget::layoutInlineRow(Row &row, int fullWidth) {
|
|||
|
||||
auto desiredWidth = row.maxWidth;
|
||||
row.height = 0;
|
||||
int availw = fullWidth - (st::inlineResultsLeft - st::buttonRadius);
|
||||
int availw = fullWidth - (st::inlineResultsLeft - st::roundRadiusSmall);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
const auto index = indices[i];
|
||||
const auto &item = row.items[index];
|
||||
|
@ -1020,7 +1020,7 @@ void GifsListWidget::updateSelected() {
|
|||
}
|
||||
|
||||
auto p = mapFromGlobal(_lastMousePos);
|
||||
int sx = (rtl() ? width() - p.x() : p.x()) - (st::inlineResultsLeft - st::buttonRadius);
|
||||
int sx = (rtl() ? width() - p.x() : p.x()) - (st::inlineResultsLeft - st::roundRadiusSmall);
|
||||
int sy = p.y() - st::stickerPanPadding;
|
||||
int row = -1, col = -1, sel = -1;
|
||||
ClickHandlerPtr lnk;
|
||||
|
|
|
@ -1124,16 +1124,16 @@ int StickersListWidget::countDesiredHeight(int newWidth) {
|
|||
if (newWidth <= st::stickerPanWidthMin) {
|
||||
return 0;
|
||||
}
|
||||
auto availableWidth = newWidth - (st::stickerPanPadding - st::buttonRadius);
|
||||
auto availableWidth = newWidth - (st::stickerPanPadding - st::roundRadiusSmall);
|
||||
auto columnCount = availableWidth / st::stickerPanWidthMin;
|
||||
auto singleWidth = availableWidth / columnCount;
|
||||
auto fullWidth = (st::buttonRadius + newWidth + st::emojiScroll.width);
|
||||
auto fullWidth = (st::roundRadiusSmall + newWidth + st::emojiScroll.width);
|
||||
auto rowsRight = (fullWidth - columnCount * singleWidth) / 2;
|
||||
accumulate_max(rowsRight, st::emojiScroll.width);
|
||||
_rowsLeft = fullWidth
|
||||
- columnCount * singleWidth
|
||||
- rowsRight
|
||||
- st::buttonRadius;
|
||||
- st::roundRadiusSmall;
|
||||
_singleSize = QSize(singleWidth, singleWidth);
|
||||
setColumnCount(columnCount);
|
||||
|
||||
|
@ -1531,7 +1531,7 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
|
|||
? set.count
|
||||
: loadedCount;
|
||||
|
||||
auto widthForTitle = stickersRight() - (st::emojiPanHeaderLeft - st::buttonRadius);
|
||||
auto widthForTitle = stickersRight() - (st::emojiPanHeaderLeft - st::roundRadiusSmall);
|
||||
if (featuredHasAddButton(info.section)) {
|
||||
auto add = featuredAddRect(info.section);
|
||||
auto selected = selectedButton ? (selectedButton->section == info.section) : false;
|
||||
|
@ -1567,7 +1567,7 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
|
|||
}
|
||||
p.setFont(st::stickersTrendingHeaderFont);
|
||||
p.setPen(st::stickersTrendingHeaderFg);
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::stickersTrendingHeaderTop, width(), titleText, titleWidth);
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::roundRadiusSmall, info.top + st::stickersTrendingHeaderTop, width(), titleText, titleWidth);
|
||||
|
||||
if (set.flags & MTPDstickerSet_ClientFlag::f_unread) {
|
||||
p.setPen(Qt::NoPen);
|
||||
|
@ -1575,14 +1575,14 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
|
|||
|
||||
{
|
||||
PainterHighQualityEnabler hq(p);
|
||||
p.drawEllipse(style::rtlrect(st::emojiPanHeaderLeft - st::buttonRadius + titleWidth + st::stickersFeaturedUnreadSkip, info.top + st::stickersTrendingHeaderTop + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width()));
|
||||
p.drawEllipse(style::rtlrect(st::emojiPanHeaderLeft - st::roundRadiusSmall + titleWidth + st::stickersFeaturedUnreadSkip, info.top + st::stickersTrendingHeaderTop + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width()));
|
||||
}
|
||||
}
|
||||
|
||||
auto statusText = (count > 0) ? tr::lng_stickers_count(tr::now, lt_count, count) : tr::lng_contacts_loading(tr::now);
|
||||
p.setFont(st::stickersTrendingSubheaderFont);
|
||||
p.setPen(st::stickersTrendingSubheaderFg);
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::stickersTrendingSubheaderTop, width(), statusText);
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::roundRadiusSmall, info.top + st::stickersTrendingSubheaderTop, width(), statusText);
|
||||
|
||||
if (info.rowsTop >= clip.y() + clip.height()) {
|
||||
return true;
|
||||
|
@ -1602,7 +1602,7 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
|
|||
if (setHasTitle(set) && clip.top() < info.rowsTop) {
|
||||
auto titleText = set.title;
|
||||
auto titleWidth = st::stickersTrendingHeaderFont->width(titleText);
|
||||
auto widthForTitle = stickersRight() - (st::emojiPanHeaderLeft - st::buttonRadius);
|
||||
auto widthForTitle = stickersRight() - (st::emojiPanHeaderLeft - st::roundRadiusSmall);
|
||||
if (hasRemoveButton(info.section)) {
|
||||
auto remove = removeButtonRect(info.section);
|
||||
auto selected = selectedButton ? (selectedButton->section == info.section) : false;
|
||||
|
@ -1622,7 +1622,7 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
|
|||
}
|
||||
p.setFont(st::emojiPanHeaderFont);
|
||||
p.setPen(st::emojiPanHeaderFg);
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::emojiPanHeaderTop, width(), titleText, titleWidth);
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::roundRadiusSmall, info.top + st::emojiPanHeaderTop, width(), titleText, titleWidth);
|
||||
}
|
||||
if (clip.top() + clip.height() <= info.rowsTop) {
|
||||
return true;
|
||||
|
@ -1753,7 +1753,7 @@ void StickersListWidget::paintEmptySearchResults(Painter &p) {
|
|||
}
|
||||
|
||||
int StickersListWidget::megagroupSetInfoLeft() const {
|
||||
return st::emojiPanHeaderLeft - st::buttonRadius;
|
||||
return st::emojiPanHeaderLeft - st::roundRadiusSmall;
|
||||
}
|
||||
|
||||
void StickersListWidget::paintMegagroupEmptySet(Painter &p, int y, bool buttonSelected) {
|
||||
|
@ -1821,8 +1821,8 @@ void StickersListWidget::setupLottie(Set &set, int section, int index) {
|
|||
|
||||
QSize StickersListWidget::boundingBoxSize() const {
|
||||
return QSize(
|
||||
_singleSize.width() - st::buttonRadius * 2,
|
||||
_singleSize.height() - st::buttonRadius * 2);
|
||||
_singleSize.width() - st::roundRadiusSmall * 2,
|
||||
_singleSize.height() - st::roundRadiusSmall * 2);
|
||||
}
|
||||
|
||||
void StickersListWidget::paintSticker(Painter &p, Set &set, int y, int section, int index, bool selected, bool deleteSelected) {
|
||||
|
@ -1860,7 +1860,7 @@ void StickersListWidget::paintSticker(Painter &p, Set &set, int y, int section,
|
|||
w = std::max(size.width(), 1);
|
||||
h = std::max(size.height(), 1);
|
||||
} else {
|
||||
auto coef = qMin((_singleSize.width() - st::buttonRadius * 2) / float64(document->dimensions.width()), (_singleSize.height() - st::buttonRadius * 2) / float64(document->dimensions.height()));
|
||||
auto coef = qMin((_singleSize.width() - st::roundRadiusSmall * 2) / float64(document->dimensions.width()), (_singleSize.height() - st::roundRadiusSmall * 2) / float64(document->dimensions.height()));
|
||||
if (coef > 1) coef = 1;
|
||||
w = std::max(qRound(coef * document->dimensions.width()), 1);
|
||||
h = std::max(qRound(coef * document->dimensions.height()), 1);
|
||||
|
@ -1997,7 +1997,7 @@ void StickersListWidget::setPressed(OverState newPressed) {
|
|||
} else if (std::get_if<OverGroupAdd>(&_pressed)) {
|
||||
if (!_megagroupSetButtonRipple) {
|
||||
auto maskSize = _megagroupSetButtonRect.size();
|
||||
auto mask = Ui::RippleAnimation::roundRectMask(maskSize, st::buttonRadius);
|
||||
auto mask = Ui::RippleAnimation::roundRectMask(maskSize, st::roundRadiusSmall);
|
||||
_megagroupSetButtonRipple = std::make_unique<Ui::RippleAnimation>(st::stickerGroupCategoryAdd.ripple, std::move(mask), [this] {
|
||||
rtlupdate(megagroupSetButtonRectFinal());
|
||||
});
|
||||
|
@ -2025,7 +2025,7 @@ std::unique_ptr<Ui::RippleAnimation> StickersListWidget::createButtonRipple(int
|
|||
|
||||
if (shownSets()[section].externalLayout) {
|
||||
auto maskSize = QSize(_addWidth - st::stickersTrendingAdd.width, st::stickersTrendingAdd.height);
|
||||
auto mask = Ui::RippleAnimation::roundRectMask(maskSize, st::buttonRadius);
|
||||
auto mask = Ui::RippleAnimation::roundRectMask(maskSize, st::roundRadiusSmall);
|
||||
return std::make_unique<Ui::RippleAnimation>(
|
||||
st::stickersTrendingAdd.ripple,
|
||||
std::move(mask),
|
||||
|
|
|
@ -54,7 +54,7 @@ TabbedPanel::TabbedPanel(
|
|||
Expects(_selector != nullptr);
|
||||
|
||||
_selector->setParent(this);
|
||||
_selector->setRoundRadius(st::buttonRadius);
|
||||
_selector->setRoundRadius(st::roundRadiusSmall);
|
||||
_selector->setAfterShownCallback([=](SelectorTab tab) {
|
||||
if (tab == SelectorTab::Gifs || tab == SelectorTab::Stickers) {
|
||||
_controller->enableGifPauseReason(
|
||||
|
@ -441,8 +441,8 @@ bool TabbedPanel::overlaps(const QRect &globalRect) const {
|
|||
|
||||
auto testRect = QRect(mapFromGlobal(globalRect.topLeft()), globalRect.size());
|
||||
auto inner = rect().marginsRemoved(st::emojiPanMargins);
|
||||
return inner.marginsRemoved(QMargins(st::buttonRadius, 0, st::buttonRadius, 0)).contains(testRect)
|
||||
|| inner.marginsRemoved(QMargins(0, st::buttonRadius, 0, st::buttonRadius)).contains(testRect);
|
||||
return inner.marginsRemoved(QMargins(st::roundRadiusSmall, 0, st::roundRadiusSmall, 0)).contains(testRect)
|
||||
|| inner.marginsRemoved(QMargins(0, st::roundRadiusSmall, 0, st::roundRadiusSmall)).contains(testRect);
|
||||
}
|
||||
|
||||
TabbedPanel::~TabbedPanel() {
|
||||
|
|
|
@ -451,13 +451,13 @@ void TabbedSelector::resizeEvent(QResizeEvent *e) {
|
|||
st::lineWidth);
|
||||
}
|
||||
|
||||
auto scrollWidth = width() - st::buttonRadius;
|
||||
auto scrollWidth = width() - st::roundRadiusSmall;
|
||||
auto scrollHeight = height() - scrollTop() - marginBottom();
|
||||
auto inner = currentTab()->widget();
|
||||
auto innerWidth = scrollWidth - st::emojiScroll.width;
|
||||
auto updateScrollGeometry = [&] {
|
||||
_scroll->setGeometryToLeft(
|
||||
st::buttonRadius,
|
||||
st::roundRadiusSmall,
|
||||
scrollTop(),
|
||||
scrollWidth,
|
||||
scrollHeight);
|
||||
|
@ -561,7 +561,7 @@ void TabbedSelector::paintContent(Painter &p) {
|
|||
p.fillRect(0, sidesTop, width(), sidesHeight, st::emojiPanBg);
|
||||
} else {
|
||||
p.fillRect(myrtlrect(width() - st::emojiScroll.width, sidesTop, st::emojiScroll.width, sidesHeight), st::emojiPanBg);
|
||||
p.fillRect(myrtlrect(0, sidesTop, st::buttonRadius, sidesHeight), st::emojiPanBg);
|
||||
p.fillRect(myrtlrect(0, sidesTop, st::roundRadiusSmall, sidesHeight), st::emojiPanBg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -445,7 +445,7 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms
|
|||
const auto roundTop = (roundCorners & RectPart::TopLeft);
|
||||
const auto roundBottom = (roundCorners & RectPart::BottomLeft);
|
||||
const auto margin = inWebPage
|
||||
? st::buttonRadius
|
||||
? st::roundRadiusSmall
|
||||
: st::historyMessageRadius;
|
||||
const auto parts = roundCorners
|
||||
| RectPart::NoTopBottom
|
||||
|
|
|
@ -508,8 +508,8 @@ void Sticker::clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) {
|
|||
|
||||
QSize Sticker::getThumbSize() const {
|
||||
int width = qMax(content_width(), 1), height = qMax(content_height(), 1);
|
||||
float64 coefw = (st::stickerPanSize.width() - st::buttonRadius * 2) / float64(width);
|
||||
float64 coefh = (st::stickerPanSize.height() - st::buttonRadius * 2) / float64(height);
|
||||
float64 coefw = (st::stickerPanSize.width() - st::roundRadiusSmall * 2) / float64(width);
|
||||
float64 coefh = (st::stickerPanSize.height() - st::roundRadiusSmall * 2) / float64(height);
|
||||
float64 coef = qMin(qMin(coefw, coefh), 1.);
|
||||
int w = qRound(coef * content_width()), h = qRound(coef * content_height());
|
||||
return QSize(qMax(w, 1), qMax(h, 1));
|
||||
|
@ -522,8 +522,8 @@ void Sticker::setupLottie() const {
|
|||
_dataMedia.get(),
|
||||
ChatHelpers::StickerLottieSize::InlineResults,
|
||||
QSize(
|
||||
st::stickerPanSize.width() - st::buttonRadius * 2,
|
||||
st::stickerPanSize.height() - st::buttonRadius * 2
|
||||
st::stickerPanSize.width() - st::roundRadiusSmall * 2,
|
||||
st::stickerPanSize.height() - st::roundRadiusSmall * 2
|
||||
) * cIntRetinaFactor());
|
||||
|
||||
_lottie->updates(
|
||||
|
|
|
@ -37,7 +37,7 @@ Inner::Inner(
|
|||
, _controller(controller)
|
||||
, _updateInlineItems([=] { updateInlineItems(); })
|
||||
, _previewTimer([=] { showPreview(); }) {
|
||||
resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, st::inlineResultsMinHeight);
|
||||
resize(st::emojiPanWidth - st::emojiScroll.width - st::roundRadiusSmall, st::inlineResultsMinHeight);
|
||||
|
||||
setMouseTracking(true);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
|
@ -85,8 +85,8 @@ void Inner::checkRestrictedPeer() {
|
|||
if (!_restrictedLabel) {
|
||||
_restrictedLabel.create(this, *error, st::stickersRestrictedLabel);
|
||||
_restrictedLabel->show();
|
||||
_restrictedLabel->move(st::inlineResultsLeft - st::buttonRadius, st::stickerPanPadding);
|
||||
_restrictedLabel->resizeToNaturalWidth(width() - (st::inlineResultsLeft - st::buttonRadius) * 2);
|
||||
_restrictedLabel->move(st::inlineResultsLeft - st::roundRadiusSmall, st::stickerPanPadding);
|
||||
_restrictedLabel->resizeToNaturalWidth(width() - (st::inlineResultsLeft - st::roundRadiusSmall) * 2);
|
||||
if (_switchPmButton) {
|
||||
_switchPmButton->hide();
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ void Inner::paintInlineItems(Painter &p, const QRect &r) {
|
|||
auto &inlineRow = _rows[row];
|
||||
if (top >= r.top() + r.height()) break;
|
||||
if (top + inlineRow.height > r.top()) {
|
||||
auto left = st::inlineResultsLeft - st::buttonRadius;
|
||||
auto left = st::inlineResultsLeft - st::roundRadiusSmall;
|
||||
if (row == rows - 1) context.lastRow = true;
|
||||
for (int col = 0, cols = inlineRow.items.size(); col < cols; ++col) {
|
||||
if (left >= tox) break;
|
||||
|
@ -430,7 +430,7 @@ Inner::Row &Inner::layoutInlineRow(Row &row, int32 sumWidth) {
|
|||
});
|
||||
|
||||
row.height = 0;
|
||||
int availw = width() - (st::inlineResultsLeft - st::buttonRadius);
|
||||
int availw = width() - (st::inlineResultsLeft - st::roundRadiusSmall);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
int index = indices[i];
|
||||
int w = sumWidth ? (row.items.at(index)->maxWidth() * availw / sumWidth) : row.items.at(index)->maxWidth();
|
||||
|
@ -478,7 +478,7 @@ void Inner::refreshSwitchPmButton(const CacheEntry *entry) {
|
|||
_switchPmButton->setText(rpl::single(entry->switchPmText));
|
||||
_switchPmStartToken = entry->switchPmStartToken;
|
||||
const auto buttonTop = st::stickerPanPadding;
|
||||
_switchPmButton->move(st::inlineResultsLeft - st::buttonRadius, buttonTop);
|
||||
_switchPmButton->move(st::inlineResultsLeft - st::roundRadiusSmall, buttonTop);
|
||||
if (isRestrictedView()) {
|
||||
_switchPmButton->hide();
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ void Inner::updateSelected() {
|
|||
auto newSelected = -1;
|
||||
auto p = mapFromGlobal(_lastMousePos);
|
||||
|
||||
int sx = (rtl() ? width() - p.x() : p.x()) - (st::inlineResultsLeft - st::buttonRadius);
|
||||
int sx = (rtl() ? width() - p.x() : p.x()) - (st::inlineResultsLeft - st::roundRadiusSmall);
|
||||
int sy = p.y() - st::stickerPanPadding;
|
||||
if (_switchPmButton) {
|
||||
sy -= _switchPmButton->height() + st::inlineResultsSkip;
|
||||
|
|
|
@ -41,7 +41,7 @@ Widget::Widget(
|
|||
_width = width();
|
||||
_height = height();
|
||||
|
||||
_scroll->resize(st::emojiPanWidth - st::buttonRadius, _contentHeight);
|
||||
_scroll->resize(st::emojiPanWidth - st::roundRadiusSmall, _contentHeight);
|
||||
|
||||
_scroll->move(verticalRect().topLeft());
|
||||
_inner = _scroll->setOwnedWidget(object_ptr<Inner>(this, controller));
|
||||
|
@ -71,7 +71,7 @@ Widget::Widget(
|
|||
// But we should force it to repaint so that GIFs will continue to animate without update() calls.
|
||||
// We do that by creating a transparent widget above our _inner.
|
||||
auto forceRepaintOnScroll = object_ptr<TWidget>(this);
|
||||
forceRepaintOnScroll->setGeometry(innerRect().x() + st::buttonRadius, innerRect().y() + st::buttonRadius, st::buttonRadius, st::buttonRadius);
|
||||
forceRepaintOnScroll->setGeometry(innerRect().x() + st::roundRadiusSmall, innerRect().y() + st::roundRadiusSmall, st::roundRadiusSmall, st::roundRadiusSmall);
|
||||
forceRepaintOnScroll->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
forceRepaintOnScroll->show();
|
||||
|
||||
|
@ -154,7 +154,7 @@ void Widget::paintContent(Painter &p) {
|
|||
auto sidesTop = horizontal.y();
|
||||
auto sidesHeight = horizontal.height();
|
||||
p.fillRect(myrtlrect(inner.x() + inner.width() - st::emojiScroll.width, sidesTop, st::emojiScroll.width, sidesHeight), st::emojiPanBg);
|
||||
p.fillRect(myrtlrect(inner.x(), sidesTop, st::buttonRadius, sidesHeight), st::emojiPanBg);
|
||||
p.fillRect(myrtlrect(inner.x(), sidesTop, st::roundRadiusSmall, sidesHeight), st::emojiPanBg);
|
||||
}
|
||||
|
||||
void Widget::moveByBottom() {
|
||||
|
@ -303,11 +303,11 @@ QRect Widget::innerRect() const {
|
|||
}
|
||||
|
||||
QRect Widget::horizontalRect() const {
|
||||
return innerRect().marginsRemoved(style::margins(0, st::buttonRadius, 0, st::buttonRadius));
|
||||
return innerRect().marginsRemoved(style::margins(0, st::roundRadiusSmall, 0, st::roundRadiusSmall));
|
||||
}
|
||||
|
||||
QRect Widget::verticalRect() const {
|
||||
return innerRect().marginsRemoved(style::margins(st::buttonRadius, 0, st::buttonRadius, 0));
|
||||
return innerRect().marginsRemoved(style::margins(st::roundRadiusSmall, 0, st::roundRadiusSmall, 0));
|
||||
}
|
||||
|
||||
void Widget::clearInlineBot() {
|
||||
|
@ -319,8 +319,8 @@ bool Widget::overlaps(const QRect &globalRect) const {
|
|||
|
||||
auto testRect = QRect(mapFromGlobal(globalRect.topLeft()), globalRect.size());
|
||||
auto inner = rect().marginsRemoved(st::emojiPanMargins);
|
||||
return inner.marginsRemoved(QMargins(st::buttonRadius, 0, st::buttonRadius, 0)).contains(testRect)
|
||||
|| inner.marginsRemoved(QMargins(0, st::buttonRadius, 0, st::buttonRadius)).contains(testRect);
|
||||
return inner.marginsRemoved(QMargins(st::roundRadiusSmall, 0, st::roundRadiusSmall, 0)).contains(testRect)
|
||||
|| inner.marginsRemoved(QMargins(0, st::roundRadiusSmall, 0, st::roundRadiusSmall)).contains(testRect);
|
||||
}
|
||||
|
||||
void Widget::inlineBotChanged() {
|
||||
|
|
|
@ -96,11 +96,11 @@ private:
|
|||
// Rounded rect which has shadow around it.
|
||||
QRect innerRect() const;
|
||||
|
||||
// Inner rect with removed st::buttonRadius from top and bottom.
|
||||
// Inner rect with removed st::roundRadiusSmall from top and bottom.
|
||||
// This one is allowed to be not rounded.
|
||||
QRect horizontalRect() const;
|
||||
|
||||
// Inner rect with removed st::buttonRadius from left and right.
|
||||
// Inner rect with removed st::roundRadiusSmall from left and right.
|
||||
// This one is allowed to be not rounded.
|
||||
QRect verticalRect() const;
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ void VolumeWidget::paintEvent(QPaintEvent *e) {
|
|||
auto shadowedSides = RectPart::Left | RectPart::Right | RectPart::Bottom;
|
||||
Ui::Shadow::paint(p, shadowedRect, width(), st::defaultRoundShadow, shadowedSides);
|
||||
auto parts = RectPart::NoTopBottom | RectPart::FullBottom;
|
||||
Ui::FillRoundRect(p, QRect(shadowedRect.x(), -st::buttonRadius, shadowedRect.width(), shadowedRect.y() + shadowedRect.height() + st::buttonRadius), st::menuBg, Ui::MenuCorners, nullptr, parts);
|
||||
Ui::FillRoundRect(p, QRect(shadowedRect.x(), -st::roundRadiusSmall, shadowedRect.width(), shadowedRect.y() + shadowedRect.height() + st::roundRadiusSmall), st::menuBg, Ui::MenuCorners, nullptr, parts);
|
||||
}
|
||||
|
||||
void VolumeWidget::enterEventHook(QEvent *e) {
|
||||
|
|
|
@ -61,7 +61,7 @@ void PrepareCorners(CachedRoundCorners index, int32 radius, const QBrush &brush,
|
|||
|
||||
void CreateMaskCorners() {
|
||||
QImage mask[4];
|
||||
PrepareCorners(SmallMaskCorners, st::buttonRadius, QColor(255, 255, 255), nullptr, mask);
|
||||
PrepareCorners(SmallMaskCorners, st::roundRadiusSmall, QColor(255, 255, 255), nullptr, mask);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
CornersMaskSmall[i] = mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
CornersMaskSmall[i].setDevicePixelRatio(style::DevicePixelRatio());
|
||||
|
@ -74,12 +74,12 @@ void CreateMaskCorners() {
|
|||
}
|
||||
|
||||
void CreatePaletteCorners() {
|
||||
PrepareCorners(MenuCorners, st::buttonRadius, st::menuBg);
|
||||
PrepareCorners(MenuCorners, st::roundRadiusSmall, st::menuBg);
|
||||
PrepareCorners(BoxCorners, st::boxRadius, st::boxBg);
|
||||
PrepareCorners(BotKbOverCorners, st::dateRadius, st::msgBotKbOverBgAdd);
|
||||
PrepareCorners(StickerCorners, st::dateRadius, st::msgServiceBg);
|
||||
PrepareCorners(StickerSelectedCorners, st::dateRadius, st::msgServiceBgSelected);
|
||||
PrepareCorners(SelectedOverlaySmallCorners, st::buttonRadius, st::msgSelectOverlay);
|
||||
PrepareCorners(SelectedOverlaySmallCorners, st::roundRadiusSmall, st::msgSelectOverlay);
|
||||
PrepareCorners(SelectedOverlayLargeCorners, st::historyMessageRadius, st::msgSelectOverlay);
|
||||
PrepareCorners(DateCorners, st::dateRadius, st::msgDateImgBg);
|
||||
PrepareCorners(DateSelectedCorners, st::dateRadius, st::msgDateImgBgSelected);
|
||||
|
@ -89,15 +89,15 @@ void CreatePaletteCorners() {
|
|||
PrepareCorners(InSelectedShadowCorners, st::historyMessageRadius, st::msgInShadowSelected);
|
||||
PrepareCorners(ForwardCorners, st::historyMessageRadius, st::historyForwardChooseBg);
|
||||
PrepareCorners(MediaviewSaveCorners, st::mediaviewControllerRadius, st::mediaviewSaveMsgBg);
|
||||
PrepareCorners(EmojiHoverCorners, st::buttonRadius, st::emojiPanHover);
|
||||
PrepareCorners(StickerHoverCorners, st::buttonRadius, st::emojiPanHover);
|
||||
PrepareCorners(BotKeyboardCorners, st::buttonRadius, st::botKbBg);
|
||||
PrepareCorners(PhotoSelectOverlayCorners, st::buttonRadius, st::overviewPhotoSelectOverlay);
|
||||
PrepareCorners(EmojiHoverCorners, st::roundRadiusSmall, st::emojiPanHover);
|
||||
PrepareCorners(StickerHoverCorners, st::roundRadiusSmall, st::emojiPanHover);
|
||||
PrepareCorners(BotKeyboardCorners, st::roundRadiusSmall, st::botKbBg);
|
||||
PrepareCorners(PhotoSelectOverlayCorners, st::roundRadiusSmall, st::overviewPhotoSelectOverlay);
|
||||
|
||||
PrepareCorners(Doc1Corners, st::buttonRadius, st::msgFile1Bg);
|
||||
PrepareCorners(Doc2Corners, st::buttonRadius, st::msgFile2Bg);
|
||||
PrepareCorners(Doc3Corners, st::buttonRadius, st::msgFile3Bg);
|
||||
PrepareCorners(Doc4Corners, st::buttonRadius, st::msgFile4Bg);
|
||||
PrepareCorners(Doc1Corners, st::roundRadiusSmall, st::msgFile1Bg);
|
||||
PrepareCorners(Doc2Corners, st::roundRadiusSmall, st::msgFile2Bg);
|
||||
PrepareCorners(Doc3Corners, st::roundRadiusSmall, st::msgFile3Bg);
|
||||
PrepareCorners(Doc4Corners, st::roundRadiusSmall, st::msgFile4Bg);
|
||||
|
||||
PrepareCorners(MessageInCorners, st::historyMessageRadius, st::msgInBg, &st::msgInShadow);
|
||||
PrepareCorners(MessageInSelectedCorners, st::historyMessageRadius, st::msgInBgSelected, &st::msgInShadowSelected);
|
||||
|
@ -237,7 +237,7 @@ void FillRoundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color
|
|||
if (i == CornersMap.cend()) {
|
||||
QImage images[4];
|
||||
switch (radius) {
|
||||
case ImageRoundRadius::Small: PrepareCorners(SmallMaskCorners, st::buttonRadius, bg, nullptr, images); break;
|
||||
case ImageRoundRadius::Small: PrepareCorners(SmallMaskCorners, st::roundRadiusSmall, bg, nullptr, images); break;
|
||||
case ImageRoundRadius::Large: PrepareCorners(LargeMaskCorners, st::historyMessageRadius, bg, nullptr, images); break;
|
||||
default: p.fillRect(x, y, w, h, bg); return;
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ void EmptyUserpic::paint(
|
|||
|
||||
void EmptyUserpic::paintRounded(Painter &p, int x, int y, int outerWidth, int size) const {
|
||||
paint(p, x, y, outerWidth, size, [&p, x, y, size] {
|
||||
p.drawRoundedRect(x, y, size, size, st::buttonRadius, st::buttonRadius);
|
||||
p.drawRoundedRect(x, y, size, size, st::roundRadiusSmall, st::roundRadiusSmall);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ void EmptyUserpic::PaintSavedMessagesRounded(
|
|||
PainterHighQualityEnabler hq(p);
|
||||
p.setBrush(bg);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawRoundedRect(x, y, size, size, st::buttonRadius, st::buttonRadius);
|
||||
p.drawRoundedRect(x, y, size, size, st::roundRadiusSmall, st::roundRadiusSmall);
|
||||
|
||||
PaintSavedMessagesInner(p, x, y, size, bg, fg);
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ void EmptyUserpic::PaintRepliesMessagesRounded(
|
|||
PainterHighQualityEnabler hq(p);
|
||||
p.setBrush(bg);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawRoundedRect(x, y, size, size, st::buttonRadius, st::buttonRadius);
|
||||
p.drawRoundedRect(x, y, size, size, st::roundRadiusSmall, st::roundRadiusSmall);
|
||||
|
||||
PaintRepliesMessagesInner(p, x, y, size, bg, fg);
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ void Generator::paintDialogs() {
|
|||
_p->setBrush(st::dialogsFilter.bgColor[_palette]);
|
||||
{
|
||||
PainterHighQualityEnabler hq(*_p);
|
||||
_p->drawRoundedRect(QRectF(filter).marginsRemoved(QMarginsF(st::dialogsFilter.borderWidth / 2., st::dialogsFilter.borderWidth / 2., st::dialogsFilter.borderWidth / 2., st::dialogsFilter.borderWidth / 2.)), st::buttonRadius - (st::dialogsFilter.borderWidth / 2.), st::buttonRadius - (st::dialogsFilter.borderWidth / 2.));
|
||||
_p->drawRoundedRect(QRectF(filter).marginsRemoved(QMarginsF(st::dialogsFilter.borderWidth / 2., st::dialogsFilter.borderWidth / 2., st::dialogsFilter.borderWidth / 2., st::dialogsFilter.borderWidth / 2.)), st::roundRadiusSmall - (st::dialogsFilter.borderWidth / 2.), st::roundRadiusSmall - (st::dialogsFilter.borderWidth / 2.));
|
||||
}
|
||||
|
||||
if (!st::dialogsFilter.icon.empty()) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit ea840471d2330c2763567c2e46b2414af6e0429d
|
||||
Subproject commit dfc0f0b889375c10782a870a377936a19fcac7f3
|
Loading…
Reference in New Issue