2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Change button round radius.

This commit is contained in:
John Preston
2020-12-08 11:19:23 +04:00
parent a527d5c535
commit dde94d486b
20 changed files with 80 additions and 80 deletions

View File

@@ -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(

View File

@@ -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);

View File

@@ -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(

View File

@@ -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;

View File

@@ -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),

View File

@@ -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() {

View File

@@ -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);
}
}