mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Allow more file attach layout customization.
This commit is contained in:
parent
b13471672d
commit
dd52c53ec0
5 changed files with 28 additions and 23 deletions
|
@ -138,8 +138,8 @@ QSize Contact::countOptimalSize() {
|
|||
|
||||
const auto &st = _userId ? st::msgFileThumbLayout : st::msgFileLayout;
|
||||
|
||||
const auto tleft = st.padding.left() + st.thumbSize + st.padding.right();
|
||||
const auto tright = st.padding.left();
|
||||
const auto tleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||
const auto tright = st.padding.right();
|
||||
if (_userId) {
|
||||
accumulate_max(maxWidth, tleft + _phonew + tright);
|
||||
} else {
|
||||
|
@ -168,9 +168,9 @@ void Contact::draw(Painter &p, const PaintContext &context) const {
|
|||
|
||||
const auto &st = _userId ? st::msgFileThumbLayout : st::msgFileLayout;
|
||||
const auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.padding.right();
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||
const auto nametop = st.nameTop - topMinus;
|
||||
const auto nameright = st.padding.left();
|
||||
const auto nameright = st.padding.right();
|
||||
const auto statustop = st.statusTop - topMinus;
|
||||
const auto linkshift = st::msgDateFont->height / 2;
|
||||
const auto linktop = st.linkTop - topMinus - linkshift;
|
||||
|
@ -216,7 +216,7 @@ TextState Contact::textState(QPoint point, StateRequest request) const {
|
|||
if (_userId) {
|
||||
const auto &st = _userId ? st::msgFileThumbLayout : st::msgFileLayout;
|
||||
const auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.padding.right();
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||
const auto linkshift = st::msgDateFont->height / 2;
|
||||
const auto linktop = st.linkTop - topMinus - linkshift;
|
||||
if (style::rtlrect(nameleft, linktop, _linkw, st::semiboldFont->height, width()).contains(point)) {
|
||||
|
|
|
@ -337,8 +337,8 @@ QSize Document::countOptimalSize() {
|
|||
|
||||
auto maxWidth = st::msgFileMinWidth;
|
||||
|
||||
const auto tleft = st.padding.left() + st.thumbSize + st.padding.right();
|
||||
const auto tright = st.padding.left();
|
||||
const auto tleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||
const auto tright = st.padding.right();
|
||||
if (thumbed) {
|
||||
accumulate_max(maxWidth, tleft + MaxStatusWidth(_data) + tright);
|
||||
} else {
|
||||
|
@ -458,9 +458,9 @@ void Document::draw(
|
|||
const auto &st = (mode == LayoutMode::Full)
|
||||
? (thumbed ? st::msgFileThumbLayout : st::msgFileLayout)
|
||||
: (thumbed ? st::msgFileThumbLayoutGrouped : st::msgFileLayoutGrouped);
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.padding.right();
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||
const auto nametop = st.nameTop - topMinus;
|
||||
const auto nameright = st.padding.left();
|
||||
const auto nameright = st.padding.right();
|
||||
const auto statustop = st.statusTop - topMinus;
|
||||
const auto linktop = st.linkTop - topMinus;
|
||||
const auto bottom = st.padding.top() + st.thumbSize + st.padding.bottom() - topMinus;
|
||||
|
@ -852,9 +852,9 @@ TextState Document::textState(
|
|||
const auto &st = (mode == LayoutMode::Full)
|
||||
? (thumbed ? st::msgFileThumbLayout : st::msgFileLayout)
|
||||
: (thumbed ? st::msgFileThumbLayoutGrouped : st::msgFileLayoutGrouped);
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.padding.right();
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||
const auto nametop = st.nameTop - topMinus;
|
||||
const auto nameright = st.padding.left();
|
||||
const auto nameright = st.padding.right();
|
||||
const auto linktop = st.linkTop - topMinus;
|
||||
auto bottom = st.padding.top() + st.thumbSize + st.padding.bottom() - topMinus;
|
||||
const auto rthumb = style::rtlrect(st.padding.left(), st.padding.top() - topMinus, st.thumbSize, st.thumbSize, width);
|
||||
|
@ -975,8 +975,8 @@ void Document::updatePressed(QPoint point) {
|
|||
if (voice->seeking()) {
|
||||
const auto thumbed = Get<HistoryDocumentThumbed>();
|
||||
const auto &st = thumbed ? st::msgFileThumbLayout : st::msgFileLayout;
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.padding.right();
|
||||
const auto nameright = st.padding.left();
|
||||
const auto nameleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||
const auto nameright = st.padding.right();
|
||||
voice->setSeekingCurrent(std::clamp(
|
||||
(point.x() - nameleft)
|
||||
/ float64(width() - nameleft - nameright),
|
||||
|
@ -1170,7 +1170,7 @@ QMargins Document::bubbleMargins() const {
|
|||
return st::msgPadding;
|
||||
}
|
||||
const auto padding = st::msgFileThumbLayout.padding;
|
||||
return QMargins(padding.left(), padding.top(), padding.left(), padding.bottom());
|
||||
return QMargins(padding.left(), padding.top(), padding.right(), padding.bottom());
|
||||
}
|
||||
|
||||
QSize Document::sizeForGroupingOptimal(int maxWidth) const {
|
||||
|
|
|
@ -86,7 +86,7 @@ void AbstractSingleFilePreview::paintEvent(QPaintEvent *e) {
|
|||
const auto &st = !isThumbedLayout(_data)
|
||||
? st::attachPreviewLayout
|
||||
: st::attachPreviewThumbLayout;
|
||||
const auto nameleft = st.thumbSize + st.padding.right();
|
||||
const auto nameleft = st.thumbSize + st.thumbSkip;
|
||||
const auto nametop = st.nameTop;
|
||||
const auto statustop = st.statusTop;
|
||||
const auto x = (width() - w) / 2, y = 0;
|
||||
|
@ -164,7 +164,7 @@ void AbstractSingleFilePreview::updateTextWidthFor(Data &data) {
|
|||
: 0;
|
||||
const auto availableFileWidth = st::sendMediaPreviewSize
|
||||
- st.thumbSize
|
||||
- st.padding.right()
|
||||
- st.thumbSkip
|
||||
// Right buttons.
|
||||
- st::sendBoxAlbumGroupButtonFile.width * buttonsCount
|
||||
- st::sendBoxAlbumGroupEditInternalSkip * buttonsCount
|
||||
|
|
|
@ -768,20 +768,23 @@ HistoryFileLayout {
|
|||
statusTop: pixels;
|
||||
linkTop: pixels;
|
||||
thumbSize: pixels;
|
||||
thumbSkip: pixels;
|
||||
}
|
||||
|
||||
msgFileLayout: HistoryFileLayout {
|
||||
padding: margins(14px, 10px, 11px, 10px);
|
||||
padding: margins(12px, 8px, 10px, 8px);
|
||||
nameTop: 16px;
|
||||
statusTop: 37px;
|
||||
thumbSize: 44px;
|
||||
thumbSkip: 11px;
|
||||
}
|
||||
msgFileThumbLayout: HistoryFileLayout {
|
||||
padding: margins(10px, 10px, 14px, 10px);
|
||||
padding: margins(10px, 10px, 10px, 10px);
|
||||
nameTop: 12px;
|
||||
statusTop: 32px;
|
||||
linkTop: 60px;
|
||||
thumbSize: 72px;
|
||||
thumbSkip: 14px;
|
||||
}
|
||||
msgFileLayoutGrouped: HistoryFileLayout(msgFileLayout) {
|
||||
padding: margins(14px, 7px, 11px, 7px);
|
||||
|
@ -795,16 +798,18 @@ msgFileThumbLayoutGrouped: HistoryFileLayout(msgFileThumbLayout) {
|
|||
linkTop: 57px;
|
||||
}
|
||||
attachPreviewLayout: HistoryFileLayout {
|
||||
padding: margins(0px, 0px, 11px, 0px);
|
||||
padding: margins(0px, 0px, 0px, 0px);
|
||||
nameTop: 6px;
|
||||
statusTop: 27px;
|
||||
thumbSize: 44px;
|
||||
thumbSkip: 11px;
|
||||
}
|
||||
attachPreviewThumbLayout: HistoryFileLayout {
|
||||
padding: margins(0px, 0px, 10px, 0px);
|
||||
padding: margins(0px, 0px, 0px, 0px);
|
||||
nameTop: 7px;
|
||||
statusTop: 37px;
|
||||
thumbSize: 64px;
|
||||
thumbSkip: 10px;
|
||||
}
|
||||
|
||||
msgFileMenuSize: size(36px, 36px);
|
||||
|
|
|
@ -259,7 +259,7 @@ void Generator::addAudioBubble(QVector<int> waveform, int waveactive, QString wa
|
|||
|
||||
auto width = st::msgFileMinWidth;
|
||||
const auto &st = st::msgFileLayout;
|
||||
auto tleft = st.padding.left() + st.thumbSize + st.padding.right();
|
||||
auto tleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||
accumulate_max(width, tleft + st::normalFont->width(wavestatus) + skipBlock.width() + st::msgPadding.right());
|
||||
accumulate_min(width, st::msgMaxWidth);
|
||||
|
||||
|
@ -839,8 +839,8 @@ void Generator::paintBubble(const Bubble &bubble) {
|
|||
bubble.text.draw(*_p, trect.x(), trect.y(), trect.width());
|
||||
} else if (!bubble.waveform.isEmpty()) {
|
||||
const auto &st = st::msgFileLayout;
|
||||
auto nameleft = x + st.padding.left() + st.thumbSize + st.padding.right();
|
||||
auto nameright = st.padding.left();
|
||||
auto nameleft = x + st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||
auto nameright = st.padding.right();
|
||||
auto statustop = y + st.statusTop;
|
||||
|
||||
auto inner = style::rtlrect(x + st.padding.left(), y + st.padding.top(), st.thumbSize, st.thumbSize, _rect.width());
|
||||
|
|
Loading…
Add table
Reference in a new issue