Improve box rounding and buttons.
This commit is contained in:
parent
f93c2bb5e5
commit
681da392eb
4 changed files with 27 additions and 20 deletions
|
|
@ -42,7 +42,7 @@ BoxLayerWidget::BoxLayerWidget(
|
|||
: LayerWidget(layer)
|
||||
, _layer(layer)
|
||||
, _content(std::move(content))
|
||||
, _roundRect(ImageRoundRadius::Small, st().bg) {
|
||||
, _roundRect(st::boxRadius, st().bg) {
|
||||
_content->setParent(this);
|
||||
_content->setDelegate(this);
|
||||
|
||||
|
|
@ -270,6 +270,7 @@ QPointer<RoundButton> BoxLayerWidget::addButton(
|
|||
const style::RoundButton &st) {
|
||||
_buttons.emplace_back(this, std::move(text), st);
|
||||
auto result = QPointer<RoundButton>(_buttons.back());
|
||||
result->setTextTransform(RoundButton::TextTransform::NoTransform);
|
||||
result->setClickedCallback(std::move(clickCallback));
|
||||
result->show();
|
||||
result->widthValue(
|
||||
|
|
@ -285,6 +286,7 @@ QPointer<RoundButton> BoxLayerWidget::addLeftButton(
|
|||
const style::RoundButton &st) {
|
||||
_leftButton = object_ptr<RoundButton>(this, std::move(text), st);
|
||||
auto result = QPointer<RoundButton>(_leftButton);
|
||||
result->setTextTransform(RoundButton::TextTransform::NoTransform);
|
||||
result->setClickedCallback(std::move(clickCallback));
|
||||
result->show();
|
||||
result->widthValue(
|
||||
|
|
@ -377,14 +379,19 @@ int BoxLayerWidget::countFullHeight() const {
|
|||
}
|
||||
|
||||
int BoxLayerWidget::contentTop() const {
|
||||
return hasTitle() ? titleHeight() : (_noContentMargin ? 0 : st::boxTopMargin);
|
||||
return hasTitle()
|
||||
? titleHeight()
|
||||
: _noContentMargin
|
||||
?
|
||||
0
|
||||
: st::boxTopMargin;
|
||||
}
|
||||
|
||||
void BoxLayerWidget::resizeEvent(QResizeEvent *e) {
|
||||
updateButtonsPositions();
|
||||
updateTitlePosition();
|
||||
|
||||
auto top = contentTop();
|
||||
const auto top = contentTop();
|
||||
_content->resize(width(), height() - top - buttonsHeight());
|
||||
_content->moveToLeft(0, top);
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ private:
|
|||
|
||||
LayerStackWidget::BackgroundWidget::BackgroundWidget(QWidget *parent)
|
||||
: TWidget(parent)
|
||||
, _roundRect(ImageRoundRadius::Small, st::boxBg) {
|
||||
, _roundRect(st::boxRadius, st::boxBg) {
|
||||
}
|
||||
|
||||
void LayerStackWidget::BackgroundWidget::setCacheImages(
|
||||
|
|
|
|||
|
|
@ -32,13 +32,14 @@ Box {
|
|||
}
|
||||
|
||||
boxDuration: 200;
|
||||
boxRadius: 3px;
|
||||
boxRadius: 8px;
|
||||
|
||||
boxButtonFont: font(boxFontSize semibold);
|
||||
defaultBoxButton: RoundButton(defaultLightButton) {
|
||||
width: -24px;
|
||||
height: 36px;
|
||||
font: boxButtonFont;
|
||||
width: -30px;
|
||||
height: 34px;
|
||||
textTop: 7px;
|
||||
font: font(14px semibold);
|
||||
}
|
||||
|
||||
boxLabelStyle: TextStyle(boxTextStyle) {
|
||||
|
|
@ -74,25 +75,25 @@ boxRoundShadow: Shadow {
|
|||
fallback: windowShadowFgFallback;
|
||||
}
|
||||
|
||||
boxTitleFont: font(17px semibold);
|
||||
boxTitleFont: font(16px semibold);
|
||||
boxTitle: FlatLabel(defaultFlatLabel) {
|
||||
textFg: boxTitleFg;
|
||||
maxHeight: 24px;
|
||||
style: TextStyle(defaultTextStyle) {
|
||||
font: boxTitleFont;
|
||||
linkFont: boxTitleFont;
|
||||
linkFontOver: font(17px semibold underline);
|
||||
linkFontOver: font(16px semibold underline);
|
||||
}
|
||||
}
|
||||
boxTitlePosition: point(22px, 16px);
|
||||
boxTitleHeight: 56px;
|
||||
boxTitlePosition: point(24px, 18px);
|
||||
boxTitleHeight: 48px;
|
||||
boxTitleAdditionalSkip: 9px;
|
||||
boxTitleAdditionalFont: normalFont;
|
||||
boxScroll: defaultSolidScroll;
|
||||
|
||||
boxRowPadding: margins(22px, 0px, 22px, 0px);
|
||||
boxRowPadding: margins(24px, 0px, 24px, 0px);
|
||||
|
||||
boxTopMargin: 6px;
|
||||
boxTopMargin: 8px;
|
||||
|
||||
boxTitleClose: IconButton(defaultIconButton) {
|
||||
width: boxTitleHeight;
|
||||
|
|
@ -119,14 +120,14 @@ boxOptionInputSkip: 6px;
|
|||
|
||||
boxWidth: 320px;
|
||||
boxWideWidth: 364px;
|
||||
boxPadding: margins(22px, 30px, 22px, 8px);
|
||||
boxPadding: margins(24px, 30px, 24px, 8px);
|
||||
boxMaxListHeight: 492px;
|
||||
boxLittleSkip: 10px;
|
||||
boxMediumSkip: 20px;
|
||||
|
||||
defaultBox: Box {
|
||||
buttonPadding: margins(8px, 12px, 13px, 12px);
|
||||
buttonHeight: 36px;
|
||||
buttonPadding: margins(6px, 10px, 10px, 10px);
|
||||
buttonHeight: 34px;
|
||||
button: defaultBoxButton;
|
||||
margin: margins(0px, 10px, 0px, 10px);
|
||||
bg: boxBg;
|
||||
|
|
@ -134,7 +135,6 @@ defaultBox: Box {
|
|||
titleAdditionalFg: boxTitleAdditionalFg;
|
||||
}
|
||||
layerBox: Box(defaultBox) {
|
||||
buttonPadding: margins(8px, 8px, 8px, 8px);
|
||||
}
|
||||
boxLabel: FlatLabel(defaultFlatLabel) {
|
||||
minWidth: 274px;
|
||||
|
|
|
|||
|
|
@ -878,7 +878,7 @@ defaultPopupMenu: PopupMenu {
|
|||
defaultInputField: InputField {
|
||||
textBg: windowBg;
|
||||
textFg: windowFg;
|
||||
textMargins: margins(0px, 26px, 0px, 4px);
|
||||
textMargins: margins(0px, 28px, 0px, 4px);
|
||||
textAlign: align(topleft);
|
||||
|
||||
placeholderFg: windowSubTextFg;
|
||||
|
|
@ -901,7 +901,7 @@ defaultInputField: InputField {
|
|||
font: boxTextFont;
|
||||
menu: defaultPopupMenu;
|
||||
|
||||
heightMin: 52px;
|
||||
heightMin: 55px;
|
||||
heightMax: 148px;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue