mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improve narrow topics column in forum.
This commit is contained in:
parent
ce17904dcc
commit
eab23df174
4 changed files with 33 additions and 17 deletions
|
@ -444,8 +444,16 @@ void ForumTopic::paintUserpic(
|
||||||
std::shared_ptr<Data::CloudImageView> &view,
|
std::shared_ptr<Data::CloudImageView> &view,
|
||||||
const Dialogs::Ui::PaintContext &context) const {
|
const Dialogs::Ui::PaintContext &context) const {
|
||||||
const auto &st = context.st;
|
const auto &st = context.st;
|
||||||
const auto position = QPoint(st->padding.left(), st->padding.top());
|
auto position = QPoint(st->padding.left(), st->padding.top());
|
||||||
if (_icon) {
|
if (_icon) {
|
||||||
|
if (context.narrow) {
|
||||||
|
const auto ratio = style::DevicePixelRatio();
|
||||||
|
const auto tag = Data::CustomEmojiManager::SizeTag::Normal;
|
||||||
|
const auto size = Data::FrameSizeFromTag(tag) / ratio;
|
||||||
|
position = QPoint(
|
||||||
|
(context.width - size) / 2,
|
||||||
|
(st->height - size) / 2);
|
||||||
|
}
|
||||||
_icon->paint(p, {
|
_icon->paint(p, {
|
||||||
.preview = st::windowBgOver->c,
|
.preview = st::windowBgOver->c,
|
||||||
.now = context.now,
|
.now = context.now,
|
||||||
|
@ -455,11 +463,16 @@ void ForumTopic::paintUserpic(
|
||||||
} else {
|
} else {
|
||||||
validateDefaultIcon();
|
validateDefaultIcon();
|
||||||
const auto size = st::defaultForumTopicIcon.size;
|
const auto size = st::defaultForumTopicIcon.size;
|
||||||
const auto esize = st::emojiSize;
|
if (context.narrow) {
|
||||||
const auto shift = (esize - size) / 2;
|
position = QPoint(
|
||||||
p.drawImage(
|
(context.width - size) / 2,
|
||||||
position + st::forumTopicIconPosition + QPoint(shift, 0),
|
(st->height - size) / 2);
|
||||||
_defaultIcon);
|
} else {
|
||||||
|
const auto esize = st::emojiSize;
|
||||||
|
const auto shift = (esize - size) / 2;
|
||||||
|
position += st::forumTopicIconPosition + QPoint(shift, 0);
|
||||||
|
}
|
||||||
|
p.drawImage(position, _defaultIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,7 @@ void PaintRow(
|
||||||
}
|
}
|
||||||
|
|
||||||
auto nameleft = context.st->nameLeft;
|
auto nameleft = context.st->nameLeft;
|
||||||
if (context.width <= nameleft) {
|
if (context.narrow) {
|
||||||
if (!draft && item && !item->isEmpty()) {
|
if (!draft && item && !item->isEmpty()) {
|
||||||
PaintNarrowCounter(p, context, badgesState);
|
PaintNarrowCounter(p, context, badgesState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,7 @@ void TopBarWidget::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::paintTopBar(Painter &p) {
|
void TopBarWidget::paintTopBar(Painter &p) {
|
||||||
if (!_activeChat.key) {
|
if (!_activeChat.key || _narrowMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto nameleft = _leftTaken;
|
auto nameleft = _leftTaken;
|
||||||
|
@ -855,6 +855,12 @@ void TopBarWidget::refreshInfoButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::resizeEvent(QResizeEvent *e) {
|
void TopBarWidget::resizeEvent(QResizeEvent *e) {
|
||||||
|
const auto narrowMode = (_activeChat.section == Section::ChatsList)
|
||||||
|
&& (width() < _back->width() + _search->width());
|
||||||
|
if (_narrowMode != narrowMode) {
|
||||||
|
_narrowMode = narrowMode;
|
||||||
|
updateControlsVisibility();
|
||||||
|
}
|
||||||
updateSearchVisibility();
|
updateSearchVisibility();
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
}
|
}
|
||||||
|
@ -865,11 +871,7 @@ int TopBarWidget::countSelectedButtonsTop(float64 selectedShown) {
|
||||||
|
|
||||||
void TopBarWidget::updateSearchVisibility() {
|
void TopBarWidget::updateSearchVisibility() {
|
||||||
const auto historyMode = (_activeChat.section == Section::History);
|
const auto historyMode = (_activeChat.section == Section::History);
|
||||||
const auto smallDialogsColumn = _activeChat.key.folder()
|
_search->setVisible(historyMode && !_chooseForReportReason);
|
||||||
&& (width() < _back->width() + _search->width());
|
|
||||||
_search->setVisible(historyMode
|
|
||||||
&& !smallDialogsColumn
|
|
||||||
&& !_chooseForReportReason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::updateControlsGeometry() {
|
void TopBarWidget::updateControlsGeometry() {
|
||||||
|
@ -915,9 +917,7 @@ void TopBarWidget::updateControlsGeometry() {
|
||||||
} else if (_back->isHidden()) {
|
} else if (_back->isHidden()) {
|
||||||
_leftTaken = st::topBarArrowPadding.right();
|
_leftTaken = st::topBarArrowPadding.right();
|
||||||
} else {
|
} else {
|
||||||
const auto smallDialogsColumn = _activeChat.key.folder()
|
_leftTaken = _narrowMode ? (width() - _back->width()) / 2 : 0;
|
||||||
&& (width() < _back->width() + _search->width());
|
|
||||||
_leftTaken = smallDialogsColumn ? (width() - _back->width()) / 2 : 0;
|
|
||||||
_back->moveToLeft(_leftTaken, otherButtonsTop);
|
_back->moveToLeft(_leftTaken, otherButtonsTop);
|
||||||
_leftTaken += _back->width();
|
_leftTaken += _back->width();
|
||||||
}
|
}
|
||||||
|
@ -1005,7 +1005,9 @@ void TopBarWidget::updateControlsVisibility() {
|
||||||
? (_activeChat.key.peer() && _activeChat.key.peer()->isForum())
|
? (_activeChat.key.peer() && _activeChat.key.peer()->isForum())
|
||||||
: false);
|
: false);
|
||||||
updateSearchVisibility();
|
updateSearchVisibility();
|
||||||
_menuToggle->setVisible(hasMenu && !_chooseForReportReason);
|
_menuToggle->setVisible(hasMenu
|
||||||
|
&& !_chooseForReportReason
|
||||||
|
&& !_narrowMode);
|
||||||
_infoToggle->setVisible(historyMode
|
_infoToggle->setVisible(historyMode
|
||||||
&& !_activeChat.key.folder()
|
&& !_activeChat.key.folder()
|
||||||
&& !isOneColumn
|
&& !isOneColumn
|
||||||
|
|
|
@ -195,6 +195,7 @@ private:
|
||||||
int _leftTaken = 0;
|
int _leftTaken = 0;
|
||||||
int _rightTaken = 0;
|
int _rightTaken = 0;
|
||||||
bool _animatingMode = false;
|
bool _animatingMode = false;
|
||||||
|
bool _narrowMode = false;
|
||||||
std::unique_ptr<Ui::InfiniteRadialAnimation> _connecting;
|
std::unique_ptr<Ui::InfiniteRadialAnimation> _connecting;
|
||||||
|
|
||||||
SendActionPainter *_sendAction = nullptr;
|
SendActionPainter *_sendAction = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue