Finalize rename / move of files.

Also rename EmojiPan to EmojiPanel.
This commit is contained in:
John Preston 2017-03-29 14:50:09 +03:00
parent 477f175f76
commit bed3aa1a7f
11 changed files with 185 additions and 185 deletions

View file

@ -37,7 +37,7 @@ QByteArray AuthSessionData::serialize() const {
QDataStream stream(&buffer); QDataStream stream(&buffer);
stream.setVersion(QDataStream::Qt_5_1); stream.setVersion(QDataStream::Qt_5_1);
stream << static_cast<qint32>(_variables.emojiPanTab); stream << static_cast<qint32>(_variables.emojiPanelTab);
stream << qint32(_variables.lastSeenWarningSeen ? 1 : 0); stream << qint32(_variables.lastSeenWarningSeen ? 1 : 0);
} }
return result; return result;
@ -55,7 +55,7 @@ void AuthSessionData::constructFromSerialized(const QByteArray &serialized) {
} }
QDataStream stream(&buffer); QDataStream stream(&buffer);
stream.setVersion(QDataStream::Qt_5_1); stream.setVersion(QDataStream::Qt_5_1);
qint32 emojiPanTab = static_cast<qint32>(EmojiPanTabType::Emoji); qint32 emojiPanTab = static_cast<qint32>(EmojiPanelTab::Emoji);
qint32 lastSeenWarningSeen = 0; qint32 lastSeenWarningSeen = 0;
stream >> emojiPanTab; stream >> emojiPanTab;
stream >> lastSeenWarningSeen; stream >> lastSeenWarningSeen;
@ -64,11 +64,11 @@ void AuthSessionData::constructFromSerialized(const QByteArray &serialized) {
return; return;
} }
auto uncheckedTab = static_cast<EmojiPanTabType>(emojiPanTab); auto uncheckedTab = static_cast<EmojiPanelTab>(emojiPanTab);
switch (uncheckedTab) { switch (uncheckedTab) {
case EmojiPanTabType::Emoji: case EmojiPanelTab::Emoji:
case EmojiPanTabType::Stickers: case EmojiPanelTab::Stickers:
case EmojiPanTabType::Gifs: _variables.emojiPanTab = uncheckedTab; break; case EmojiPanelTab::Gifs: _variables.emojiPanelTab = uncheckedTab; break;
} }
_variables.lastSeenWarningSeen = (lastSeenWarningSeen == 1); _variables.lastSeenWarningSeen = (lastSeenWarningSeen == 1);
} }

View file

@ -30,7 +30,7 @@ class System;
} // namespace Notifications } // namespace Notifications
} // namespace Window } // namespace Window
enum class EmojiPanTabType { enum class EmojiPanelTab {
Emoji, Emoji,
Stickers, Stickers,
Gifs, Gifs,
@ -60,17 +60,17 @@ public:
void setLastSeenWarningSeen(bool lastSeenWarningSeen) { void setLastSeenWarningSeen(bool lastSeenWarningSeen) {
_variables.lastSeenWarningSeen = lastSeenWarningSeen; _variables.lastSeenWarningSeen = lastSeenWarningSeen;
} }
EmojiPanTabType emojiPanTab() const { EmojiPanelTab emojiPanelTab() const {
return _variables.emojiPanTab; return _variables.emojiPanelTab;
} }
void setEmojiPanTab(EmojiPanTabType tab) { void setEmojiPanelTab(EmojiPanelTab tab) {
_variables.emojiPanTab = tab; _variables.emojiPanelTab = tab;
} }
private: private:
struct Variables { struct Variables {
bool lastSeenWarningSeen = false; bool lastSeenWarningSeen = false;
EmojiPanTabType emojiPanTab = EmojiPanTabType::Emoji; EmojiPanelTab emojiPanelTab = EmojiPanelTab::Emoji;
}; };
base::Variable<bool> _contactsLoaded = { false }; base::Variable<bool> _contactsLoaded = { false };

View file

@ -37,7 +37,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
namespace { namespace {
constexpr auto kStickerPanPerRow = Stickers::kPanPerRow; constexpr auto kStickersPanelPerRow = Stickers::kPanelPerRow;
} // namespace } // namespace
@ -187,8 +187,8 @@ void StickerSetBox::Inner::gotSet(const MTPmessages_StickerSet &set) {
if (_pack.isEmpty()) { if (_pack.isEmpty()) {
Ui::show(Box<InformBox>(lang(lng_stickers_not_found))); Ui::show(Box<InformBox>(lang(lng_stickers_not_found)));
} else { } else {
int32 rows = _pack.size() / kStickerPanPerRow + ((_pack.size() % kStickerPanPerRow) ? 1 : 0); int32 rows = _pack.size() / kStickersPanelPerRow + ((_pack.size() % kStickersPanelPerRow) ? 1 : 0);
resize(st::stickersPadding.left() + kStickerPanPerRow * st::stickersSize.width(), st::stickersPadding.top() + rows * st::stickersSize.height() + st::stickersPadding.bottom()); resize(st::stickersPadding.left() + kStickersPanelPerRow * st::stickersSize.width(), st::stickersPadding.top() + rows * st::stickersSize.height() + st::stickersPadding.bottom());
} }
_loaded = true; _loaded = true;
@ -325,8 +325,8 @@ void StickerSetBox::Inner::setSelected(int selected) {
void StickerSetBox::Inner::startOverAnimation(int index, float64 from, float64 to) { void StickerSetBox::Inner::startOverAnimation(int index, float64 from, float64 to) {
if (index >= 0 && index < _packOvers.size()) { if (index >= 0 && index < _packOvers.size()) {
_packOvers[index].start([this, index] { _packOvers[index].start([this, index] {
int row = index / kStickerPanPerRow; int row = index / kStickersPanelPerRow;
int column = index % kStickerPanPerRow; int column = index % kStickersPanelPerRow;
int left = st::stickersPadding.left() + column * st::stickersSize.width(); int left = st::stickersPadding.left() + column * st::stickersSize.width();
int top = st::stickersPadding.top() + row * st::stickersSize.height(); int top = st::stickersPadding.top() + row * st::stickersSize.height();
rtlupdate(left, top, st::stickersSize.width(), st::stickersSize.height()); rtlupdate(left, top, st::stickersSize.width(), st::stickersSize.height());
@ -347,8 +347,8 @@ int32 StickerSetBox::Inner::stickerFromGlobalPos(const QPoint &p) const {
if (rtl()) l.setX(width() - l.x()); if (rtl()) l.setX(width() - l.x());
int32 row = (l.y() >= st::stickersPadding.top()) ? qFloor((l.y() - st::stickersPadding.top()) / st::stickersSize.height()) : -1; int32 row = (l.y() >= st::stickersPadding.top()) ? qFloor((l.y() - st::stickersPadding.top()) / st::stickersSize.height()) : -1;
int32 col = (l.x() >= st::stickersPadding.left()) ? qFloor((l.x() - st::stickersPadding.left()) / st::stickersSize.width()) : -1; int32 col = (l.x() >= st::stickersPadding.left()) ? qFloor((l.x() - st::stickersPadding.left()) / st::stickersSize.width()) : -1;
if (row >= 0 && col >= 0 && col < kStickerPanPerRow) { if (row >= 0 && col >= 0 && col < kStickersPanelPerRow) {
int32 result = row * kStickerPanPerRow + col; int32 result = row * kStickersPanelPerRow + col;
return (result < _pack.size()) ? result : -1; return (result < _pack.size()) ? result : -1;
} }
return -1; return -1;
@ -361,12 +361,12 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) {
if (_pack.isEmpty()) return; if (_pack.isEmpty()) return;
auto ms = getms(); auto ms = getms();
int32 rows = _pack.size() / kStickerPanPerRow + ((_pack.size() % kStickerPanPerRow) ? 1 : 0); int32 rows = _pack.size() / kStickersPanelPerRow + ((_pack.size() % kStickersPanelPerRow) ? 1 : 0);
int32 from = qFloor(e->rect().top() / st::stickersSize.height()), to = qFloor(e->rect().bottom() / st::stickersSize.height()) + 1; int32 from = qFloor(e->rect().top() / st::stickersSize.height()), to = qFloor(e->rect().bottom() / st::stickersSize.height()) + 1;
for (int32 i = from; i < to; ++i) { for (int32 i = from; i < to; ++i) {
for (int32 j = 0; j < kStickerPanPerRow; ++j) { for (int32 j = 0; j < kStickersPanelPerRow; ++j) {
int32 index = i * kStickerPanPerRow + j; int32 index = i * kStickersPanelPerRow + j;
if (index >= _pack.size()) break; if (index >= _pack.size()) break;
t_assert(index < _packOvers.size()); t_assert(index < _packOvers.size());

View file

@ -42,7 +42,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "history/history_drag_area.h" #include "history/history_drag_area.h"
#include "profile/profile_block_group_members.h" #include "profile/profile_block_group_members.h"
#include "core/click_handler_types.h" #include "core/click_handler_types.h"
#include "stickers/emoji_pan.h" #include "stickers/emoji_panel.h"
#include "lang.h" #include "lang.h"
#include "application.h" #include "application.h"
#include "mainwidget.h" #include "mainwidget.h"
@ -3218,7 +3218,7 @@ HistoryWidget::HistoryWidget(QWidget *parent, gsl::not_null<Window::Controller*>
, _recordCancelWidth(st::historyRecordFont->width(lang(lng_record_cancel))) , _recordCancelWidth(st::historyRecordFont->width(lang(lng_record_cancel)))
, _a_recording(animation(this, &HistoryWidget::step_recording)) , _a_recording(animation(this, &HistoryWidget::step_recording))
, _kbScroll(this, st::botKbScroll) , _kbScroll(this, st::botKbScroll)
, _emojiPan(this) , _emojiPanel(this)
, _attachDragDocument(this) , _attachDragDocument(this)
, _attachDragPhoto(this) , _attachDragPhoto(this)
, _fileLoader(this, FileLoaderQueueStopTimeout) , _fileLoader(this, FileLoaderQueueStopTimeout)
@ -3249,11 +3249,11 @@ HistoryWidget::HistoryWidget(QWidget *parent, gsl::not_null<Window::Controller*>
connect(_field, SIGNAL(linksChanged()), this, SLOT(onPreviewCheck())); connect(_field, SIGNAL(linksChanged()), this, SLOT(onPreviewCheck()));
connect(App::wnd()->windowHandle(), SIGNAL(visibleChanged(bool)), this, SLOT(onWindowVisibleChanged())); connect(App::wnd()->windowHandle(), SIGNAL(visibleChanged(bool)), this, SLOT(onWindowVisibleChanged()));
connect(&_scrollTimer, SIGNAL(timeout()), this, SLOT(onScrollTimer())); connect(&_scrollTimer, SIGNAL(timeout()), this, SLOT(onScrollTimer()));
connect(_emojiPan, SIGNAL(emojiSelected(EmojiPtr)), _field, SLOT(onEmojiInsert(EmojiPtr))); connect(_emojiPanel, SIGNAL(emojiSelected(EmojiPtr)), _field, SLOT(onEmojiInsert(EmojiPtr)));
connect(_emojiPan, SIGNAL(stickerSelected(DocumentData*)), this, SLOT(onStickerSend(DocumentData*))); connect(_emojiPanel, SIGNAL(stickerSelected(DocumentData*)), this, SLOT(onStickerSend(DocumentData*)));
connect(_emojiPan, SIGNAL(photoSelected(PhotoData*)), this, SLOT(onPhotoSend(PhotoData*))); connect(_emojiPanel, SIGNAL(photoSelected(PhotoData*)), this, SLOT(onPhotoSend(PhotoData*)));
connect(_emojiPan, SIGNAL(inlineResultSelected(InlineBots::Result*,UserData*)), this, SLOT(onInlineResultSend(InlineBots::Result*,UserData*))); connect(_emojiPanel, SIGNAL(inlineResultSelected(InlineBots::Result*,UserData*)), this, SLOT(onInlineResultSend(InlineBots::Result*,UserData*)));
connect(_emojiPan, SIGNAL(updateStickers()), this, SLOT(updateStickers())); connect(_emojiPanel, SIGNAL(updateStickers()), this, SLOT(updateStickers()));
connect(&_sendActionStopTimer, SIGNAL(timeout()), this, SLOT(onCancelSendAction())); connect(&_sendActionStopTimer, SIGNAL(timeout()), this, SLOT(onCancelSendAction()));
connect(&_previewTimer, SIGNAL(timeout()), this, SLOT(onPreviewTimeout())); connect(&_previewTimer, SIGNAL(timeout()), this, SLOT(onPreviewTimeout()));
connect(Media::Capture::instance(), SIGNAL(error()), this, SLOT(onRecordError())); connect(Media::Capture::instance(), SIGNAL(error()), this, SLOT(onRecordError()));
@ -3329,13 +3329,13 @@ HistoryWidget::HistoryWidget(QWidget *parent, gsl::not_null<Window::Controller*>
_silent->hide(); _silent->hide();
_botCommandStart->hide(); _botCommandStart->hide();
_attachEmoji->installEventFilter(_emojiPan); _attachEmoji->installEventFilter(_emojiPanel);
connect(_botKeyboardShow, SIGNAL(clicked()), this, SLOT(onKbToggle())); connect(_botKeyboardShow, SIGNAL(clicked()), this, SLOT(onKbToggle()));
connect(_botKeyboardHide, SIGNAL(clicked()), this, SLOT(onKbToggle())); connect(_botKeyboardHide, SIGNAL(clicked()), this, SLOT(onKbToggle()));
connect(_botCommandStart, SIGNAL(clicked()), this, SLOT(onCmdStart())); connect(_botCommandStart, SIGNAL(clicked()), this, SLOT(onCmdStart()));
_emojiPan->hide(); _emojiPanel->hide();
_attachDragDocument->hide(); _attachDragDocument->hide();
_attachDragPhoto->hide(); _attachDragPhoto->hide();
@ -3360,7 +3360,7 @@ HistoryWidget::HistoryWidget(QWidget *parent, gsl::not_null<Window::Controller*>
void HistoryWidget::start() { void HistoryWidget::start() {
connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated())); connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));
connect(App::main(), SIGNAL(savedGifsUpdated()), _emojiPan, SLOT(refreshSavedGifs())); connect(App::main(), SIGNAL(savedGifsUpdated()), _emojiPanel, SLOT(refreshSavedGifs()));
updateRecentStickers(); updateRecentStickers();
if (App::main()) emit App::main()->savedGifsUpdated(); if (App::main()) emit App::main()->savedGifsUpdated();
@ -3369,7 +3369,7 @@ void HistoryWidget::start() {
} }
void HistoryWidget::onStickersUpdated() { void HistoryWidget::onStickersUpdated() {
_emojiPan->refreshStickers(); _emojiPanel->refreshStickers();
updateStickersByEmoji(); updateStickersByEmoji();
} }
@ -3456,7 +3456,7 @@ void HistoryWidget::orderWidgets() {
if (_inlineResults) { if (_inlineResults) {
_inlineResults->raise(); _inlineResults->raise();
} }
_emojiPan->raise(); _emojiPanel->raise();
_attachDragDocument->raise(); _attachDragDocument->raise();
_attachDragPhoto->raise(); _attachDragPhoto->raise();
} }
@ -3647,11 +3647,11 @@ void HistoryWidget::updateSendAction(History *history, SendAction::Type type, in
} }
void HistoryWidget::updateRecentStickers() { void HistoryWidget::updateRecentStickers() {
_emojiPan->refreshStickers(); _emojiPanel->refreshStickers();
} }
void HistoryWidget::stickersInstalled(uint64 setId) { void HistoryWidget::stickersInstalled(uint64 setId) {
_emojiPan->stickersInstalled(setId); _emojiPanel->stickersInstalled(setId);
} }
void HistoryWidget::sendActionDone(const MTPBool &result, mtpRequestId req) { void HistoryWidget::sendActionDone(const MTPBool &result, mtpRequestId req) {
@ -4581,7 +4581,7 @@ bool HistoryWidget::contentOverlapped(const QRect &globalRect) {
return (_attachDragDocument->overlaps(globalRect) return (_attachDragDocument->overlaps(globalRect)
|| _attachDragPhoto->overlaps(globalRect) || _attachDragPhoto->overlaps(globalRect)
|| _fieldAutocomplete->overlaps(globalRect) || _fieldAutocomplete->overlaps(globalRect)
|| _emojiPan->overlaps(globalRect) || _emojiPanel->overlaps(globalRect)
|| (_inlineResults && _inlineResults->overlaps(globalRect))); || (_inlineResults && _inlineResults->overlaps(globalRect)));
} }
@ -4713,7 +4713,7 @@ void HistoryWidget::updateControlsVisibility() {
_botKeyboardShow->hide(); _botKeyboardShow->hide();
_botKeyboardHide->hide(); _botKeyboardHide->hide();
_botCommandStart->hide(); _botCommandStart->hide();
_emojiPan->hide(); _emojiPanel->hide();
if (_inlineResults) { if (_inlineResults) {
_inlineResults->hide(); _inlineResults->hide();
} }
@ -4774,7 +4774,7 @@ void HistoryWidget::updateControlsVisibility() {
_botKeyboardShow->hide(); _botKeyboardShow->hide();
_botKeyboardHide->hide(); _botKeyboardHide->hide();
_botCommandStart->hide(); _botCommandStart->hide();
_emojiPan->hide(); _emojiPanel->hide();
if (_inlineResults) { if (_inlineResults) {
_inlineResults->hide(); _inlineResults->hide();
} }
@ -4888,7 +4888,7 @@ void HistoryWidget::updateControlsVisibility() {
_botKeyboardShow->hide(); _botKeyboardShow->hide();
_botKeyboardHide->hide(); _botKeyboardHide->hide();
_botCommandStart->hide(); _botCommandStart->hide();
_emojiPan->hide(); _emojiPanel->hide();
if (_inlineResults) { if (_inlineResults) {
_inlineResults->hide(); _inlineResults->hide();
} }
@ -5409,7 +5409,7 @@ bool HistoryWidget::saveEditMsgFail(History *history, const RPCError &error, mtp
void HistoryWidget::hideSelectorControlsAnimated() { void HistoryWidget::hideSelectorControlsAnimated() {
_fieldAutocomplete->hideAnimated(); _fieldAutocomplete->hideAnimated();
_emojiPan->hideAnimated(); _emojiPanel->hideAnimated();
if (_inlineResults) { if (_inlineResults) {
_inlineResults->hideAnimated(); _inlineResults->hideAnimated();
} }
@ -6524,7 +6524,7 @@ void HistoryWidget::moveFieldControls() {
_kbScroll->setGeometry(0, bottom, width(), keyboardHeight); _kbScroll->setGeometry(0, bottom, width(), keyboardHeight);
} }
// _attachToggle -------- _inlineResults ---------------------------------- _emojiPan -------- _fieldBarCancel // _attachToggle ------- _inlineResults ---------------------------------- _emojiPanel ------- _fieldBarCancel
// (_attachDocument|_attachPhoto) _field (_silent|_cmdStart|_kbShow) (_kbHide|_attachEmoji) [_broadcast] _send // (_attachDocument|_attachPhoto) _field (_silent|_cmdStart|_kbShow) (_kbHide|_attachEmoji) [_broadcast] _send
// (_botStart|_unblock|_joinChannel|_muteUnmute) // (_botStart|_unblock|_joinChannel|_muteUnmute)
@ -6544,7 +6544,7 @@ void HistoryWidget::moveFieldControls() {
if (_inlineResults) { if (_inlineResults) {
_inlineResults->moveBottom(_field->y() - st::historySendPadding); _inlineResults->moveBottom(_field->y() - st::historySendPadding);
} }
_emojiPan->moveBottom(_field->y() - st::historySendPadding); _emojiPanel->moveBottom(_field->y() - st::historySendPadding);
auto fullWidthButtonRect = QRect(0, bottom - _botStart->height(), width(), _botStart->height()); auto fullWidthButtonRect = QRect(0, bottom - _botStart->height(), width(), _botStart->height());
_botStart->setGeometry(fullWidthButtonRect); _botStart->setGeometry(fullWidthButtonRect);
@ -7164,7 +7164,7 @@ void HistoryWidget::onUpdateHistoryItems() {
} }
bool HistoryWidget::ui_isInlineItemBeingChosen() { bool HistoryWidget::ui_isInlineItemBeingChosen() {
return _emojiPan->ui_isInlineItemBeingChosen() return _emojiPanel->ui_isInlineItemBeingChosen()
|| (_inlineResults && _inlineResults->ui_isInlineItemBeingChosen()); || (_inlineResults && _inlineResults->ui_isInlineItemBeingChosen());
} }
@ -7218,8 +7218,8 @@ void HistoryWidget::updateControlsGeometry() {
updateHistoryDownPosition(); updateHistoryDownPosition();
_emojiPan->setMinTop(0); _emojiPanel->setMinTop(0);
_emojiPan->setMinBottom(_attachEmoji->height()); _emojiPanel->setMinBottom(_attachEmoji->height());
if (_inlineResults) { if (_inlineResults) {
_inlineResults->setMinTop(0); _inlineResults->setMinTop(0);
_inlineResults->setMinBottom(_attachEmoji->height()); _inlineResults->setMinBottom(_attachEmoji->height());

View file

@ -58,7 +58,7 @@ class TopBarWidget;
} // namespace Window } // namespace Window
class DragArea; class DragArea;
class EmojiPan; class EmojiPanel;
class SilentToggle; class SilentToggle;
class SendFilesBox; class SendFilesBox;
@ -1160,7 +1160,7 @@ private:
QTimer _membersDropdownShowTimer; QTimer _membersDropdownShowTimer;
object_ptr<InlineBots::Layout::Widget> _inlineResults = { nullptr }; object_ptr<InlineBots::Layout::Widget> _inlineResults = { nullptr };
object_ptr<EmojiPan> _emojiPan; object_ptr<EmojiPanel> _emojiPanel;
DragState _attachDrag = DragStateNone; DragState _attachDrag = DragStateNone;
object_ptr<DragArea> _attachDragDocument, _attachDragPhoto; object_ptr<DragArea> _attachDragDocument, _attachDragPhoto;

View file

@ -21,7 +21,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "settings.h" #include "settings.h"
#include "platform/platform_specific.h" #include "platform/platform_specific.h"
#include "stickers/emoji_pan.h"
#include "lang.h" #include "lang.h"
bool gRtl = false; bool gRtl = false;

View file

@ -18,7 +18,7 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/ */
#include "stickers/emoji_pan.h" #include "stickers/emoji_panel.h"
#include "styles/style_stickers.h" #include "styles/style_stickers.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
@ -45,9 +45,9 @@ namespace {
constexpr auto kSaveRecentEmojiTimeout = 3000; constexpr auto kSaveRecentEmojiTimeout = 3000;
constexpr auto kSaveChosenTabTimeout = 1000; constexpr auto kSaveChosenTabTimeout = 1000;
constexpr auto kEmojiPanPerRow = Ui::Emoji::kPanPerRow; constexpr auto kEmojiPanelPerRow = Ui::Emoji::kPanelPerRow;
constexpr auto kEmojiPanRowsPerPage = Ui::Emoji::kPanRowsPerPage; constexpr auto kEmojiPanelRowsPerPage = Ui::Emoji::kPanelRowsPerPage;
constexpr auto kStickerPanPerRow = Stickers::kPanPerRow; constexpr auto kStickersPanelPerRow = Stickers::kPanelPerRow;
} // namespace } // namespace
@ -312,7 +312,7 @@ bool EmojiPanInner::enumerateSections(Callback callback) const {
for (auto i = 0; i != kEmojiSectionCount; ++i) { for (auto i = 0; i != kEmojiSectionCount; ++i) {
info.section = i; info.section = i;
info.count = Ui::Emoji::GetPackCount(EmojiSectionAtIndex(i)); info.count = Ui::Emoji::GetPackCount(EmojiSectionAtIndex(i));
info.rowsCount = (info.count / kEmojiPanPerRow) + ((info.count % kEmojiPanPerRow) ? 1 : 0); info.rowsCount = (info.count / kEmojiPanelPerRow) + ((info.count % kEmojiPanelPerRow) ? 1 : 0);
info.rowsTop = info.top + (i == 0 ? st::emojiPanPadding : st::emojiPanHeader); info.rowsTop = info.top + (i == 0 ? st::emojiPanPadding : st::emojiPanHeader);
info.rowsBottom = info.rowsTop + info.rowsCount * st::emojiPanSize.height(); info.rowsBottom = info.rowsTop + info.rowsCount * st::emojiPanSize.height();
if (!callback(info)) { if (!callback(info)) {
@ -378,12 +378,12 @@ void EmojiPanInner::paintEvent(QPaintEvent *e) {
} }
p.fillRect(r, st::emojiPanBg); p.fillRect(r, st::emojiPanBg);
auto fromColumn = floorclamp(r.x() - st::emojiPanPadding, st::emojiPanSize.width(), 0, kEmojiPanPerRow); auto fromColumn = floorclamp(r.x() - st::emojiPanPadding, st::emojiPanSize.width(), 0, kEmojiPanelPerRow);
auto toColumn = ceilclamp(r.x() + r.width() - st::emojiPanPadding, st::emojiPanSize.width(), 0, kEmojiPanPerRow); auto toColumn = ceilclamp(r.x() + r.width() - st::emojiPanPadding, st::emojiPanSize.width(), 0, kEmojiPanelPerRow);
if (rtl()) { if (rtl()) {
qSwap(fromColumn, toColumn); qSwap(fromColumn, toColumn);
fromColumn = kEmojiPanPerRow - fromColumn; fromColumn = kEmojiPanelPerRow - fromColumn;
toColumn = kEmojiPanPerRow - toColumn; toColumn = kEmojiPanelPerRow - toColumn;
} }
enumerateSections([this, &p, r, fromColumn, toColumn](const SectionInfo &info) { enumerateSections([this, &p, r, fromColumn, toColumn](const SectionInfo &info) {
@ -403,7 +403,7 @@ void EmojiPanInner::paintEvent(QPaintEvent *e) {
auto toRow = ceilclamp(r.y() + r.height() - info.rowsTop, st::emojiPanSize.height(), 0, info.rowsCount); auto toRow = ceilclamp(r.y() + r.height() - info.rowsTop, st::emojiPanSize.height(), 0, info.rowsCount);
for (auto i = fromRow; i < toRow; ++i) { for (auto i = fromRow; i < toRow; ++i) {
for (auto j = fromColumn; j < toColumn; ++j) { for (auto j = fromColumn; j < toColumn; ++j) {
auto index = i * kEmojiPanPerRow + j; auto index = i * kEmojiPanelPerRow + j;
if (index >= info.count) break; if (index >= info.count) break;
auto selected = (!_picker->isHidden() && info.section * MatrixRowShift + index == _pickerSel) || (info.section * MatrixRowShift + index == _selected); auto selected = (!_picker->isHidden() && info.section * MatrixRowShift + index == _pickerSel) || (info.section * MatrixRowShift + index == _selected);
@ -526,7 +526,7 @@ void EmojiPanInner::selectEmoji(EmojiPtr emoji) {
} }
} }
if (i == e) { if (i == e) {
while (recent.size() >= kEmojiPanPerRow * kEmojiPanRowsPerPage) recent.pop_back(); while (recent.size() >= kEmojiPanelPerRow * kEmojiPanelRowsPerPage) recent.pop_back();
recent.push_back(qMakePair(emoji, 1)); recent.push_back(qMakePair(emoji, 1));
for (i = recent.end() - 1; i != recent.begin(); --i) { for (i = recent.end() - 1; i != recent.begin(); --i) {
if ((i - 1)->second > i->second) { if ((i - 1)->second > i->second) {
@ -554,7 +554,7 @@ void EmojiPanInner::onShowPicker() {
y += _picker->height() - st::buttonRadius + st::emojiPanSize.height() - st::buttonRadius; y += _picker->height() - st::buttonRadius + st::emojiPanSize.height() - st::buttonRadius;
} }
auto xmax = width() - _picker->width(); auto xmax = width() - _picker->width();
auto coef = float64(sel % kEmojiPanPerRow) / float64(kEmojiPanPerRow - 1); auto coef = float64(sel % kEmojiPanelPerRow) / float64(kEmojiPanelPerRow - 1);
if (rtl()) coef = 1. - coef; if (rtl()) coef = 1. - coef;
_picker->move(qRound(xmax * coef), y); _picker->move(qRound(xmax * coef), y);
@ -573,9 +573,9 @@ void EmojiPanInner::onPickerHidden() {
QRect EmojiPanInner::emojiRect(int section, int sel) { QRect EmojiPanInner::emojiRect(int section, int sel) {
auto info = sectionInfo(section); auto info = sectionInfo(section);
auto countTillItem = (sel - (sel % kEmojiPanPerRow)); auto countTillItem = (sel - (sel % kEmojiPanelPerRow));
auto rowsToSkip = (countTillItem / kEmojiPanPerRow) + ((countTillItem % kEmojiPanPerRow) ? 1 : 0); auto rowsToSkip = (countTillItem / kEmojiPanelPerRow) + ((countTillItem % kEmojiPanelPerRow) ? 1 : 0);
auto x = st::emojiPanPadding + ((sel % kEmojiPanPerRow) * st::emojiPanSize.width()); auto x = st::emojiPanPadding + ((sel % kEmojiPanelPerRow) * st::emojiPanSize.width());
auto y = info.rowsTop + rowsToSkip * st::emojiPanSize.height(); auto y = info.rowsTop + rowsToSkip * st::emojiPanSize.height();
return QRect(x, y, st::emojiPanSize.width(), st::emojiPanSize.height()); return QRect(x, y, st::emojiPanSize.width(), st::emojiPanSize.height());
} }
@ -668,8 +668,8 @@ void EmojiPanInner::updateSelected() {
auto info = sectionInfoByOffset(p.y()); auto info = sectionInfoByOffset(p.y());
if (p.y() >= info.rowsTop && p.y() < info.rowsBottom) { if (p.y() >= info.rowsTop && p.y() < info.rowsBottom) {
auto sx = (rtl() ? width() - p.x() : p.x()) - st::emojiPanPadding; auto sx = (rtl() ? width() - p.x() : p.x()) - st::emojiPanPadding;
if (sx >= 0 && sx < kEmojiPanPerRow * st::emojiPanSize.width()) { if (sx >= 0 && sx < kEmojiPanelPerRow * st::emojiPanSize.width()) {
newSelected = qFloor((p.y() - info.rowsTop) / st::emojiPanSize.height()) * kEmojiPanPerRow + qFloor(sx / st::emojiPanSize.width()); newSelected = qFloor((p.y() - info.rowsTop) / st::emojiPanSize.height()) * kEmojiPanelPerRow + qFloor(sx / st::emojiPanSize.width());
if (newSelected >= _emoji[info.section].size()) { if (newSelected >= _emoji[info.section].size()) {
newSelected = -1; newSelected = -1;
} else { } else {
@ -789,7 +789,7 @@ void StickerPanInner::readVisibleSets() {
if (i * rowHeight < itemsVisibleTop || (i + 1) * rowHeight > itemsVisibleBottom) { if (i * rowHeight < itemsVisibleTop || (i + 1) * rowHeight > itemsVisibleBottom) {
continue; continue;
} }
int count = qMin(set.pack.size(), static_cast<int>(kStickerPanPerRow)); int count = qMin(set.pack.size(), static_cast<int>(kStickersPanelPerRow));
int loaded = 0; int loaded = 0;
for (int j = 0; j < count; ++j) { for (int j = 0; j < count; ++j) {
if (set.pack[j]->thumb->loaded() || set.pack[j]->loaded()) { if (set.pack[j]->thumb->loaded() || set.pack[j]->loaded()) {
@ -813,7 +813,7 @@ bool StickerPanInner::enumerateSections(Callback callback) const {
for (auto i = 0; i != _mySets.size(); ++i) { for (auto i = 0; i != _mySets.size(); ++i) {
info.section = i; info.section = i;
info.count = _mySets[i].pack.size(); info.count = _mySets[i].pack.size();
info.rowsCount = (info.count / kStickerPanPerRow) + ((info.count % kStickerPanPerRow) ? 1 : 0); info.rowsCount = (info.count / kStickersPanelPerRow) + ((info.count % kStickersPanelPerRow) ? 1 : 0);
info.rowsTop = info.top + (i == 0 ? st::stickerPanPadding : st::emojiPanHeader); info.rowsTop = info.top + (i == 0 ? st::stickerPanPadding : st::emojiPanHeader);
info.rowsBottom = info.rowsTop + info.rowsCount * st::stickerPanSize.height(); info.rowsBottom = info.rowsTop + info.rowsCount * st::stickerPanSize.height();
if (!callback(info)) { if (!callback(info)) {
@ -911,9 +911,9 @@ QRect StickerPanInner::stickerRect(int section, int sel) {
if (sel >= _mySets[section].pack.size()) { if (sel >= _mySets[section].pack.size()) {
sel -= _mySets[section].pack.size(); sel -= _mySets[section].pack.size();
} }
auto countTillItem = (sel - (sel % kStickerPanPerRow)); auto countTillItem = (sel - (sel % kStickersPanelPerRow));
auto rowsToSkip = (countTillItem / kStickerPanPerRow) + ((countTillItem % kStickerPanPerRow) ? 1 : 0); auto rowsToSkip = (countTillItem / kStickersPanelPerRow) + ((countTillItem % kStickersPanelPerRow) ? 1 : 0);
x = stickersLeft() + ((sel % kStickerPanPerRow) * st::stickerPanSize.width()); x = stickersLeft() + ((sel % kStickersPanelPerRow) * st::stickerPanSize.width());
y = info.rowsTop + rowsToSkip * st::stickerPanSize.height(); y = info.rowsTop + rowsToSkip * st::stickerPanSize.height();
} }
return QRect(x, y, st::stickerPanSize.width(), st::stickerPanSize.height()); return QRect(x, y, st::stickerPanSize.width(), st::stickerPanSize.height());
@ -979,12 +979,12 @@ void StickerPanInner::paintInlineItems(Painter &p, QRect clip) {
} }
void StickerPanInner::paintFeaturedStickers(Painter &p, QRect clip) { void StickerPanInner::paintFeaturedStickers(Painter &p, QRect clip) {
auto fromColumn = floorclamp(clip.x() - stickersLeft(), st::stickerPanSize.width(), 0, kStickerPanPerRow); auto fromColumn = floorclamp(clip.x() - stickersLeft(), st::stickerPanSize.width(), 0, kStickersPanelPerRow);
auto toColumn = ceilclamp(clip.x() + clip.width() - stickersLeft(), st::stickerPanSize.width(), 0, kStickerPanPerRow); auto toColumn = ceilclamp(clip.x() + clip.width() - stickersLeft(), st::stickerPanSize.width(), 0, kStickersPanelPerRow);
if (rtl()) { if (rtl()) {
qSwap(fromColumn, toColumn); qSwap(fromColumn, toColumn);
fromColumn = kStickerPanPerRow - fromColumn; fromColumn = kStickersPanelPerRow - fromColumn;
toColumn = kStickerPanPerRow - toColumn; toColumn = kStickersPanelPerRow - toColumn;
} }
auto &sets = shownSets(); auto &sets = shownSets();
@ -1076,12 +1076,12 @@ void StickerPanInner::paintFeaturedStickers(Painter &p, QRect clip) {
} }
void StickerPanInner::paintStickers(Painter &p, QRect clip) { void StickerPanInner::paintStickers(Painter &p, QRect clip) {
auto fromColumn = floorclamp(clip.x() - stickersLeft(), st::stickerPanSize.width(), 0, kStickerPanPerRow); auto fromColumn = floorclamp(clip.x() - stickersLeft(), st::stickerPanSize.width(), 0, kStickersPanelPerRow);
auto toColumn = ceilclamp(clip.x() + clip.width() - stickersLeft(), st::stickerPanSize.width(), 0, kStickerPanPerRow); auto toColumn = ceilclamp(clip.x() + clip.width() - stickersLeft(), st::stickerPanSize.width(), 0, kStickersPanelPerRow);
if (rtl()) { if (rtl()) {
qSwap(fromColumn, toColumn); qSwap(fromColumn, toColumn);
fromColumn = kStickerPanPerRow - fromColumn; fromColumn = kStickersPanelPerRow - fromColumn;
toColumn = kStickerPanPerRow - toColumn; toColumn = kStickersPanelPerRow - toColumn;
} }
auto &sets = shownSets(); auto &sets = shownSets();
@ -1113,7 +1113,7 @@ void StickerPanInner::paintStickers(Painter &p, QRect clip) {
auto toRow = ceilclamp(clip.y() + clip.height() - info.rowsTop, st::stickerPanSize.height(), 0, info.rowsCount); auto toRow = ceilclamp(clip.y() + clip.height() - info.rowsTop, st::stickerPanSize.height(), 0, info.rowsCount);
for (int i = fromRow; i < toRow; ++i) { for (int i = fromRow; i < toRow; ++i) {
for (int j = fromColumn; j < toColumn; ++j) { for (int j = fromColumn; j < toColumn; ++j) {
int index = i * kStickerPanPerRow + j; int index = i * kStickersPanelPerRow + j;
if (index >= info.count) break; if (index >= info.count) break;
auto selected = (selsection == info.section && selindex == index); auto selected = (selsection == info.section && selindex == index);
@ -1130,7 +1130,7 @@ void StickerPanInner::paintSticker(Painter &p, Set &set, int y, int index, bool
auto sticker = set.pack[index]; auto sticker = set.pack[index];
if (!sticker->sticker()) return; if (!sticker->sticker()) return;
int row = (index / kStickerPanPerRow), col = (index % kStickerPanPerRow); int row = (index / kStickersPanelPerRow), col = (index % kStickersPanelPerRow);
auto pos = QPoint(stickersLeft() + col * st::stickerPanSize.width(), y + row * st::stickerPanSize.height()); auto pos = QPoint(stickersLeft() + col * st::stickerPanSize.width(), y + row * st::stickerPanSize.height());
if (selected) { if (selected) {
@ -1174,7 +1174,7 @@ bool StickerPanInner::featuredHasAddButton(int index) const {
} }
int StickerPanInner::featuredContentWidth() const { int StickerPanInner::featuredContentWidth() const {
return stickersLeft() + (kStickerPanPerRow * st::stickerPanSize.width()); return stickersLeft() + (kStickersPanelPerRow * st::stickerPanSize.width());
} }
QRect StickerPanInner::featuredAddRect(int index) const { QRect StickerPanInner::featuredAddRect(int index) const {
@ -1644,10 +1644,10 @@ void StickerPanInner::preloadImages() {
for (int i = 0, l = sets.size(), k = 0; i < l; ++i) { for (int i = 0, l = sets.size(), k = 0; i < l; ++i) {
int count = sets[i].pack.size(); int count = sets[i].pack.size();
if (_section == Section::Featured) { if (_section == Section::Featured) {
accumulate_min(count, kStickerPanPerRow); accumulate_min(count, kStickersPanelPerRow);
} }
for (int j = 0; j != count; ++j) { for (int j = 0; j != count; ++j) {
if (++k > kStickerPanPerRow * (kStickerPanPerRow + 1)) break; if (++k > kStickersPanelPerRow * (kStickersPanelPerRow + 1)) break;
auto sticker = sets.at(i).pack.at(j); auto sticker = sets.at(i).pack.at(j);
if (!sticker || !sticker->sticker()) continue; if (!sticker || !sticker->sticker()) continue;
@ -1659,7 +1659,7 @@ void StickerPanInner::preloadImages() {
sticker->automaticLoad(0); sticker->automaticLoad(0);
} }
} }
if (k > kStickerPanPerRow * (kStickerPanPerRow + 1)) break; if (k > kStickersPanelPerRow * (kStickersPanelPerRow + 1)) break;
} }
} }
@ -2081,7 +2081,7 @@ void StickerPanInner::updateSelected() {
newSelectedFeaturedSet = section; newSelectedFeaturedSet = section;
} }
} else if (yOffset >= st::stickersTrendingHeader && yOffset < st::stickersTrendingHeader + st::stickerPanSize.height()) { } else if (yOffset >= st::stickersTrendingHeader && yOffset < st::stickersTrendingHeader + st::stickerPanSize.height()) {
if (sx >= 0 && sx < kStickerPanPerRow * st::stickerPanSize.width()) { if (sx >= 0 && sx < kStickersPanelPerRow * st::stickerPanSize.width()) {
newSelected = qFloor(sx / st::stickerPanSize.width()); newSelected = qFloor(sx / st::stickerPanSize.width());
if (newSelected >= set.pack.size()) { if (newSelected >= set.pack.size()) {
newSelected = -1; newSelected = -1;
@ -2100,13 +2100,13 @@ void StickerPanInner::updateSelected() {
auto &set = sets[info.section]; auto &set = sets[info.section];
auto special = ((set.flags & MTPDstickerSet::Flag::f_official) != 0); auto special = ((set.flags & MTPDstickerSet::Flag::f_official) != 0);
auto rowIndex = qFloor(yOffset / st::stickerPanSize.height()); auto rowIndex = qFloor(yOffset / st::stickerPanSize.height());
newSelected = rowIndex * kStickerPanPerRow + qFloor(sx / st::stickerPanSize.width()); newSelected = rowIndex * kStickersPanelPerRow + qFloor(sx / st::stickerPanSize.width());
if (newSelected >= set.pack.size()) { if (newSelected >= set.pack.size()) {
newSelected = -1; newSelected = -1;
} else { } else {
if (set.id == Stickers::RecentSetId && _custom[newSelected]) { if (set.id == Stickers::RecentSetId && _custom[newSelected]) {
auto inx = sx - (newSelected % kStickerPanPerRow) * st::stickerPanSize.width(); auto inx = sx - (newSelected % kStickersPanelPerRow) * st::stickerPanSize.width();
auto iny = yOffset - ((newSelected / kStickerPanPerRow) * st::stickerPanSize.height()); auto iny = yOffset - ((newSelected / kStickersPanelPerRow) * st::stickerPanSize.height());
if (inx >= st::stickerPanSize.width() - st::stickerPanDelete.width() && iny < st::stickerPanDelete.height()) { if (inx >= st::stickerPanSize.width() - st::stickerPanDelete.width() && iny < st::stickerPanDelete.height()) {
newSelected += set.pack.size(); newSelected += set.pack.size();
} }
@ -2276,7 +2276,7 @@ FORCE_INLINE uint32 oneImageOnBgWithAlpha(
} // namespace } // namespace
class EmojiPan::SlideAnimation : public Ui::RoundShadowAnimation { class EmojiPanel::SlideAnimation : public Ui::RoundShadowAnimation {
public: public:
enum class Direction { enum class Direction {
LeftToRight, LeftToRight,
@ -2311,7 +2311,7 @@ private:
}; };
void EmojiPan::SlideAnimation::setFinalImages(Direction direction, QImage &&left, QImage &&right, QRect inner) { void EmojiPanel::SlideAnimation::setFinalImages(Direction direction, QImage &&left, QImage &&right, QRect inner) {
t_assert(!started()); t_assert(!started());
_direction = direction; _direction = direction;
_leftImage = QPixmap::fromImage(std::move(left).convertToFormat(QImage::Format_ARGB32_Premultiplied), Qt::ColorOnly); _leftImage = QPixmap::fromImage(std::move(left).convertToFormat(QImage::Format_ARGB32_Premultiplied), Qt::ColorOnly);
@ -2347,7 +2347,7 @@ void EmojiPan::SlideAnimation::setFinalImages(Direction direction, QImage &&left
_painterCategoriesTop = _painterInnerBottom - st::emojiCategory.height; _painterCategoriesTop = _painterInnerBottom - st::emojiCategory.height;
} }
void EmojiPan::SlideAnimation::start() { void EmojiPanel::SlideAnimation::start() {
t_assert(!_leftImage.isNull()); t_assert(!_leftImage.isNull());
t_assert(!_rightImage.isNull()); t_assert(!_rightImage.isNull());
RoundShadowAnimation::start(_width, _height, _leftImage.devicePixelRatio()); RoundShadowAnimation::start(_width, _height, _leftImage.devicePixelRatio());
@ -2363,7 +2363,7 @@ void EmojiPan::SlideAnimation::start() {
_frameIntsPerLineAdd = (_width - _innerWidth) + _frameIntsPerLineAdded; _frameIntsPerLineAdd = (_width - _innerWidth) + _frameIntsPerLineAdded;
} }
void EmojiPan::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64 opacity) { void EmojiPanel::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64 opacity) {
t_assert(started()); t_assert(started());
t_assert(dt >= 0.); t_assert(dt >= 0.);
@ -2494,26 +2494,26 @@ void EmojiPan::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64 opaci
p.drawImage(outerLeft / cIntRetinaFactor(), outerTop / cIntRetinaFactor(), _frame, outerLeft, outerTop, outerRight - outerLeft, outerBottom - outerTop); p.drawImage(outerLeft / cIntRetinaFactor(), outerTop / cIntRetinaFactor(), _frame, outerLeft, outerTop, outerRight - outerLeft, outerBottom - outerTop);
} }
EmojiPan::Tab::Tab(TabType type, object_ptr<internal::BasicPanInner> widget) EmojiPanel::Tab::Tab(TabType type, object_ptr<internal::BasicPanInner> widget)
: _type(type) : _type(type)
, _widget(std::move(widget)) , _widget(std::move(widget))
, _weak(_widget) { , _weak(_widget) {
} }
object_ptr<internal::BasicPanInner> EmojiPan::Tab::takeWidget() { object_ptr<internal::BasicPanInner> EmojiPanel::Tab::takeWidget() {
return std::move(_widget); return std::move(_widget);
} }
void EmojiPan::Tab::returnWidget(object_ptr<internal::BasicPanInner> widget) { void EmojiPanel::Tab::returnWidget(object_ptr<internal::BasicPanInner> widget) {
_widget = std::move(widget); _widget = std::move(widget);
Ensures(_widget == _weak); Ensures(_widget == _weak);
} }
void EmojiPan::Tab::saveScrollTop() { void EmojiPanel::Tab::saveScrollTop() {
_scrollTop = widget()->getVisibleTop(); _scrollTop = widget()->getVisibleTop();
} }
EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent) EmojiPanel::EmojiPanel(QWidget *parent) : TWidget(parent)
, _recent(this, st::emojiCategoryRecent) , _recent(this, st::emojiCategoryRecent)
, _people(this, st::emojiCategoryPeople) , _people(this, st::emojiCategoryPeople)
, _nature(this, st::emojiCategoryNature) , _nature(this, st::emojiCategoryNature)
@ -2522,7 +2522,7 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
, _travel(this, st::emojiCategoryTravel) , _travel(this, st::emojiCategoryTravel)
, _objects(this, st::emojiCategoryObjects) , _objects(this, st::emojiCategoryObjects)
, _symbols(this, st::emojiCategorySymbols) , _symbols(this, st::emojiCategorySymbols)
, _a_icons(animation(this, &EmojiPan::step_icons)) , _a_icons(animation(this, &EmojiPanel::step_icons))
, _scroll(this, st::emojiScroll) , _scroll(this, st::emojiScroll)
, _tabsSlider(this, st::emojiTabs) , _tabsSlider(this, st::emojiTabs)
, _topShadow(this, st::shadowFg) , _topShadow(this, st::shadowFg)
@ -2532,7 +2532,7 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
Tab { TabType::Stickers, object_ptr<internal::StickerPanInner>(this, false) }, Tab { TabType::Stickers, object_ptr<internal::StickerPanInner>(this, false) },
Tab { TabType::Gifs, object_ptr<internal::StickerPanInner>(this, true) }, Tab { TabType::Gifs, object_ptr<internal::StickerPanInner>(this, true) },
} }
, _currentTabType(AuthSession::Current().data().emojiPanTab()) { , _currentTabType(AuthSession::Current().data().emojiPanelTab()) {
resize(QRect(0, 0, st::emojiPanWidth, st::emojiPanMaxHeight).marginsAdded(innerPadding()).size()); resize(QRect(0, 0, st::emojiPanWidth, st::emojiPanMaxHeight).marginsAdded(innerPadding()).size());
_width = width(); _width = width();
_height = height(); _height = height();
@ -2617,22 +2617,22 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
hideChildren(); hideChildren();
} }
void EmojiPan::setMinTop(int minTop) { void EmojiPanel::setMinTop(int minTop) {
_minTop = minTop; _minTop = minTop;
updateContentHeight(); updateContentHeight();
} }
void EmojiPan::setMinBottom(int minBottom) { void EmojiPanel::setMinBottom(int minBottom) {
_minBottom = minBottom; _minBottom = minBottom;
updateContentHeight(); updateContentHeight();
} }
void EmojiPan::moveBottom(int bottom) { void EmojiPanel::moveBottom(int bottom) {
_bottom = bottom; _bottom = bottom;
updateContentHeight(); updateContentHeight();
} }
void EmojiPan::updateContentHeight() { void EmojiPanel::updateContentHeight() {
auto wantedBottom = countBottom(); auto wantedBottom = countBottom();
auto maxContentHeight = wantedBottom - st::emojiPanMargins.top() - st::emojiPanMargins.bottom() - marginTop() - marginBottom(); auto maxContentHeight = wantedBottom - st::emojiPanMargins.top() - st::emojiPanMargins.bottom() - marginTop() - marginBottom();
auto contentHeight = qMin(_contentMaxHeight, maxContentHeight); auto contentHeight = qMin(_contentMaxHeight, maxContentHeight);
@ -2674,32 +2674,32 @@ void EmojiPan::updateContentHeight() {
update(); update();
} }
void EmojiPan::prepareSection(int &left, int top, int _width, Ui::IconButton *sectionIcon, DBIEmojiSection value) { void EmojiPanel::prepareSection(int &left, int top, int _width, Ui::IconButton *sectionIcon, DBIEmojiSection value) {
sectionIcon->moveToLeft(left, top, _width); sectionIcon->moveToLeft(left, top, _width);
left += sectionIcon->width(); left += sectionIcon->width();
sectionIcon->setClickedCallback([this, value] { setActiveSection(value); }); sectionIcon->setClickedCallback([this, value] { setActiveSection(value); });
} }
void EmojiPan::onWndActiveChanged() { void EmojiPanel::onWndActiveChanged() {
if (!App::wnd()->windowHandle()->isActive() && !isHidden()) { if (!App::wnd()->windowHandle()->isActive() && !isHidden()) {
leaveEvent(0); leaveEvent(0);
} }
} }
void EmojiPan::onSaveConfig() { void EmojiPanel::onSaveConfig() {
Local::writeUserSettings(); Local::writeUserSettings();
} }
void EmojiPan::onSaveConfigDelayed(int delay) { void EmojiPanel::onSaveConfigDelayed(int delay) {
_saveConfigTimer.start(delay); _saveConfigTimer.start(delay);
} }
void EmojiPan::paintStickerSettingsIcon(Painter &p) const { void EmojiPanel::paintStickerSettingsIcon(Painter &p) const {
int settingsLeft = _iconsLeft + 7 * st::emojiCategory.width; int settingsLeft = _iconsLeft + 7 * st::emojiCategory.width;
st::stickersSettings.paint(p, settingsLeft + st::emojiCategory.iconPosition.x(), _iconsTop + st::emojiCategory.iconPosition.y(), width()); st::stickersSettings.paint(p, settingsLeft + st::emojiCategory.iconPosition.x(), _iconsTop + st::emojiCategory.iconPosition.y(), width());
} }
void EmojiPan::paintFeaturedStickerSetsBadge(Painter &p, int iconLeft) const { void EmojiPanel::paintFeaturedStickerSetsBadge(Painter &p, int iconLeft) const {
if (auto unread = Global::FeaturedStickerSetsUnreadCount()) { if (auto unread = Global::FeaturedStickerSetsUnreadCount()) {
Dialogs::Layout::UnreadBadgeStyle unreadSt; Dialogs::Layout::UnreadBadgeStyle unreadSt;
unreadSt.sizeId = Dialogs::Layout::UnreadBadgeInStickersPanel; unreadSt.sizeId = Dialogs::Layout::UnreadBadgeInStickersPanel;
@ -2711,7 +2711,7 @@ void EmojiPan::paintFeaturedStickerSetsBadge(Painter &p, int iconLeft) const {
} }
} }
void EmojiPan::paintEvent(QPaintEvent *e) { void EmojiPanel::paintEvent(QPaintEvent *e) {
Painter p(this); Painter p(this);
auto ms = getms(); auto ms = getms();
@ -2758,7 +2758,7 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
} }
} }
void EmojiPan::paintSlideFrame(Painter &p, TimeMs ms) { void EmojiPanel::paintSlideFrame(Painter &p, TimeMs ms) {
Ui::Shadow::paint(p, innerRect(), width(), st::emojiPanAnimation.shadow); Ui::Shadow::paint(p, innerRect(), width(), st::emojiPanAnimation.shadow);
auto inner = innerRect(); auto inner = innerRect();
@ -2769,7 +2769,7 @@ void EmojiPan::paintSlideFrame(Painter &p, TimeMs ms) {
_slideAnimation->paintFrame(p, slideDt, _a_opacity.current(_hiding ? 0. : 1.)); _slideAnimation->paintFrame(p, slideDt, _a_opacity.current(_hiding ? 0. : 1.));
} }
void EmojiPan::paintContent(Painter &p) { void EmojiPanel::paintContent(Painter &p) {
auto inner = innerRect(); auto inner = innerRect();
auto topPart = QRect(inner.x(), inner.y(), inner.width(), _tabsSlider->height() + st::buttonRadius); auto topPart = QRect(inner.x(), inner.y(), inner.width(), _tabsSlider->height() + st::buttonRadius);
App::roundRect(p, topPart, st::emojiPanBg, ImageRoundRadius::Small, App::RectPart::TopFull | App::RectPart::NoTopBottom); App::roundRect(p, topPart, st::emojiPanBg, ImageRoundRadius::Small, App::RectPart::TopFull | App::RectPart::NoTopBottom);
@ -2862,32 +2862,32 @@ void EmojiPan::paintContent(Painter &p) {
} }
} }
int EmojiPan::marginTop() const { int EmojiPanel::marginTop() const {
return _tabsSlider->height() - st::lineWidth; return _tabsSlider->height() - st::lineWidth;
} }
int EmojiPan::marginBottom() const { int EmojiPanel::marginBottom() const {
return st::emojiCategory.height; return st::emojiCategory.height;
} }
int EmojiPan::countBottom() const { int EmojiPanel::countBottom() const {
return (parentWidget()->height() - _minBottom); return (parentWidget()->height() - _minBottom);
} }
void EmojiPan::moveByBottom() { void EmojiPanel::moveByBottom() {
moveToRight(0, y()); moveToRight(0, y());
updateContentHeight(); updateContentHeight();
} }
void EmojiPan::enterEventHook(QEvent *e) { void EmojiPanel::enterEventHook(QEvent *e) {
showAnimated(); showAnimated();
} }
bool EmojiPan::preventAutoHide() const { bool EmojiPanel::preventAutoHide() const {
return _removingSetId || _displayingSetId; return _removingSetId || _displayingSetId;
} }
void EmojiPan::leaveEventHook(QEvent *e) { void EmojiPanel::leaveEventHook(QEvent *e) {
if (preventAutoHide()) { if (preventAutoHide()) {
return; return;
} }
@ -2900,11 +2900,11 @@ void EmojiPan::leaveEventHook(QEvent *e) {
return TWidget::leaveEventHook(e); return TWidget::leaveEventHook(e);
} }
void EmojiPan::otherEnter() { void EmojiPanel::otherEnter() {
showAnimated(); showAnimated();
} }
void EmojiPan::otherLeave() { void EmojiPanel::otherLeave() {
if (preventAutoHide()) { if (preventAutoHide()) {
return; return;
} }
@ -2917,7 +2917,7 @@ void EmojiPan::otherLeave() {
} }
} }
void EmojiPan::mousePressEvent(QMouseEvent *e) { void EmojiPanel::mousePressEvent(QMouseEvent *e) {
if (_currentTabType != TabType::Stickers || e->button() != Qt::LeftButton) { if (_currentTabType != TabType::Stickers || e->button() != Qt::LeftButton) {
return; return;
} }
@ -2933,7 +2933,7 @@ void EmojiPan::mousePressEvent(QMouseEvent *e) {
} }
} }
void EmojiPan::mouseMoveEvent(QMouseEvent *e) { void EmojiPanel::mouseMoveEvent(QMouseEvent *e) {
if (_currentTabType != TabType::Stickers) { if (_currentTabType != TabType::Stickers) {
return; return;
} }
@ -2956,7 +2956,7 @@ void EmojiPan::mouseMoveEvent(QMouseEvent *e) {
} }
} }
void EmojiPan::mouseReleaseEvent(QMouseEvent *e) { void EmojiPanel::mouseReleaseEvent(QMouseEvent *e) {
if (_currentTabType != TabType::Stickers || _icons.isEmpty()) { if (_currentTabType != TabType::Stickers || _icons.isEmpty()) {
return; return;
} }
@ -2985,7 +2985,7 @@ void EmojiPan::mouseReleaseEvent(QMouseEvent *e) {
} }
} }
bool EmojiPan::event(QEvent *e) { bool EmojiPanel::event(QEvent *e) {
if (e->type() == QEvent::TouchBegin) { if (e->type() == QEvent::TouchBegin) {
} else if (e->type() == QEvent::Wheel) { } else if (e->type() == QEvent::Wheel) {
@ -3012,7 +3012,7 @@ bool EmojiPan::event(QEvent *e) {
return TWidget::event(e); return TWidget::event(e);
} }
void EmojiPan::hideFast() { void EmojiPanel::hideFast() {
if (isHidden()) return; if (isHidden()) return;
_hideTimer.stop(); _hideTimer.stop();
@ -3021,7 +3021,7 @@ void EmojiPan::hideFast() {
hideFinished(); hideFinished();
} }
void EmojiPan::refreshStickers() { void EmojiPanel::refreshStickers() {
stickers()->refreshStickers(); stickers()->refreshStickers();
if (_currentTabType != TabType::Stickers) { if (_currentTabType != TabType::Stickers) {
stickers()->preloadImages(); stickers()->preloadImages();
@ -3029,14 +3029,14 @@ void EmojiPan::refreshStickers() {
update(); update();
} }
void EmojiPan::refreshSavedGifs() { void EmojiPanel::refreshSavedGifs() {
gifs()->refreshSavedGifs(); gifs()->refreshSavedGifs();
if (_currentTabType != TabType::Gifs) { if (_currentTabType != TabType::Gifs) {
gifs()->preloadImages(); gifs()->preloadImages();
} }
} }
void EmojiPan::onRefreshIcons(bool scrollAnimation) { void EmojiPanel::onRefreshIcons(bool scrollAnimation) {
_iconOver = -1; _iconOver = -1;
stickers()->fillIcons(_icons); stickers()->fillIcons(_icons);
_iconsX.finish(); _iconsX.finish();
@ -3059,7 +3059,7 @@ void EmojiPan::onRefreshIcons(bool scrollAnimation) {
updateIcons(); updateIcons();
} }
void EmojiPan::leaveToChildEvent(QEvent *e, QWidget *child) { void EmojiPanel::leaveToChildEvent(QEvent *e, QWidget *child) {
if (_currentTabType != TabType::Stickers) { if (_currentTabType != TabType::Stickers) {
return; return;
} }
@ -3067,7 +3067,7 @@ void EmojiPan::leaveToChildEvent(QEvent *e, QWidget *child) {
updateSelected(); updateSelected();
} }
void EmojiPan::updateSelected() { void EmojiPanel::updateSelected() {
if (_iconDown >= 0) { if (_iconDown >= 0) {
return; return;
} }
@ -3094,7 +3094,7 @@ void EmojiPan::updateSelected() {
} }
} }
void EmojiPan::updateIcons() { void EmojiPanel::updateIcons() {
if (_currentTabType != TabType::Stickers) { if (_currentTabType != TabType::Stickers) {
return; return;
} }
@ -3103,7 +3103,7 @@ void EmojiPan::updateIcons() {
update(verticalInner.left(), _iconsTop, verticalInner.width(), st::emojiCategory.height); update(verticalInner.left(), _iconsTop, verticalInner.width(), st::emojiCategory.height);
} }
void EmojiPan::step_icons(TimeMs ms, bool timer) { void EmojiPanel::step_icons(TimeMs ms, bool timer) {
if (_currentTabType != TabType::Stickers) { if (_currentTabType != TabType::Stickers) {
_a_icons.stop(); _a_icons.stop();
return; return;
@ -3129,7 +3129,7 @@ void EmojiPan::step_icons(TimeMs ms, bool timer) {
} }
} }
void EmojiPan::opacityAnimationCallback() { void EmojiPanel::opacityAnimationCallback() {
update(); update();
if (!_a_opacity.animating()) { if (!_a_opacity.animating()) {
if (_hiding) { if (_hiding) {
@ -3141,13 +3141,13 @@ void EmojiPan::opacityAnimationCallback() {
} }
} }
void EmojiPan::hideByTimerOrLeave() { void EmojiPanel::hideByTimerOrLeave() {
if (isHidden() || preventAutoHide()) return; if (isHidden() || preventAutoHide()) return;
hideAnimated(); hideAnimated();
} }
void EmojiPan::prepareCache() { void EmojiPanel::prepareCache() {
if (_a_opacity.animating()) return; if (_a_opacity.animating()) return;
auto showAnimation = base::take(_a_show); auto showAnimation = base::take(_a_show);
@ -3163,7 +3163,7 @@ void EmojiPan::prepareCache() {
} }
} }
void EmojiPan::startOpacityAnimation(bool hiding) { void EmojiPanel::startOpacityAnimation(bool hiding) {
_hiding = false; _hiding = false;
prepareCache(); prepareCache();
_hiding = hiding; _hiding = hiding;
@ -3171,7 +3171,7 @@ void EmojiPan::startOpacityAnimation(bool hiding) {
_a_opacity.start([this] { opacityAnimationCallback(); }, _hiding ? 1. : 0., _hiding ? 0. : 1., st::emojiPanDuration); _a_opacity.start([this] { opacityAnimationCallback(); }, _hiding ? 1. : 0., _hiding ? 0. : 1., st::emojiPanDuration);
} }
void EmojiPan::startShowAnimation() { void EmojiPanel::startShowAnimation() {
if (!_a_show.animating()) { if (!_a_show.animating()) {
auto image = grabForComplexAnimation(GrabType::Panel); auto image = grabForComplexAnimation(GrabType::Panel);
@ -3186,7 +3186,7 @@ void EmojiPan::startShowAnimation() {
_a_show.start([this] { update(); }, 0., 1., st::emojiPanShowDuration); _a_show.start([this] { update(); }, 0., 1., st::emojiPanShowDuration);
} }
QImage EmojiPan::grabForComplexAnimation(GrabType type) { QImage EmojiPanel::grabForComplexAnimation(GrabType type) {
auto cache = base::take(_cache); auto cache = base::take(_cache);
auto opacityAnimation = base::take(_a_opacity); auto opacityAnimation = base::take(_a_opacity);
auto slideAnimationData = base::take(_slideAnimation); auto slideAnimationData = base::take(_slideAnimation);
@ -3218,7 +3218,7 @@ QImage EmojiPan::grabForComplexAnimation(GrabType type) {
return result; return result;
} }
void EmojiPan::hideAnimated() { void EmojiPanel::hideAnimated() {
if (isHidden()) return; if (isHidden()) return;
if (_hiding) return; if (_hiding) return;
@ -3230,9 +3230,9 @@ void EmojiPan::hideAnimated() {
} }
} }
EmojiPan::~EmojiPan() = default; EmojiPanel::~EmojiPanel() = default;
void EmojiPan::hideFinished() { void EmojiPanel::hideFinished() {
hide(); hide();
currentTab()->widget()->hideFinish(true); currentTab()->widget()->hideFinish(true);
_a_show.finish(); _a_show.finish();
@ -3255,13 +3255,13 @@ void EmojiPan::hideFinished() {
Notify::clipStopperHidden(ClipStopperSavedGifsPanel); Notify::clipStopperHidden(ClipStopperSavedGifsPanel);
} }
void EmojiPan::showAnimated() { void EmojiPanel::showAnimated() {
_hideTimer.stop(); _hideTimer.stop();
_hideAfterSlide = false; _hideAfterSlide = false;
showStarted(); showStarted();
} }
void EmojiPan::showStarted() { void EmojiPanel::showStarted() {
if (isHidden()) { if (isHidden()) {
emit updateStickers(); emit updateStickers();
currentTab()->widget()->refreshRecent(); currentTab()->widget()->refreshRecent();
@ -3276,7 +3276,7 @@ void EmojiPan::showStarted() {
} }
} }
bool EmojiPan::eventFilter(QObject *obj, QEvent *e) { bool EmojiPanel::eventFilter(QObject *obj, QEvent *e) {
if (e->type() == QEvent::Enter) { if (e->type() == QEvent::Enter) {
otherEnter(); otherEnter();
} else if (e->type() == QEvent::Leave) { } else if (e->type() == QEvent::Leave) {
@ -3291,7 +3291,7 @@ bool EmojiPan::eventFilter(QObject *obj, QEvent *e) {
return false; return false;
} }
void EmojiPan::stickersInstalled(uint64 setId) { void EmojiPanel::stickersInstalled(uint64 setId) {
_tabsSlider->setActiveSection(static_cast<int>(TabType::Stickers)); _tabsSlider->setActiveSection(static_cast<int>(TabType::Stickers));
if (isHidden()) { if (isHidden()) {
moveByBottom(); moveByBottom();
@ -3304,11 +3304,11 @@ void EmojiPan::stickersInstalled(uint64 setId) {
showAnimated(); showAnimated();
} }
bool EmojiPan::ui_isInlineItemBeingChosen() { bool EmojiPanel::ui_isInlineItemBeingChosen() {
return (_currentTabType == TabType::Gifs && !isHidden()); return (_currentTabType == TabType::Gifs && !isHidden());
} }
void EmojiPan::showAll() { void EmojiPanel::showAll() {
if (_currentTabType == TabType::Emoji) { if (_currentTabType == TabType::Emoji) {
_recent->show(); _recent->show();
_people->show(); _people->show();
@ -3334,18 +3334,18 @@ void EmojiPan::showAll() {
_tabsSlider->show(); _tabsSlider->show();
} }
void EmojiPan::hideForSliding() { void EmojiPanel::hideForSliding() {
hideChildren(); hideChildren();
_tabsSlider->show(); _tabsSlider->show();
_topShadow->show(); _topShadow->show();
currentTab()->widget()->clearSelection(); currentTab()->widget()->clearSelection();
} }
void EmojiPan::setActiveSection(DBIEmojiSection tab) { void EmojiPanel::setActiveSection(DBIEmojiSection tab) {
emoji()->showEmojiSection(tab); emoji()->showEmojiSection(tab);
} }
void EmojiPan::onScroll() { void EmojiPanel::onScroll() {
auto scrollTop = _scroll->scrollTop(); auto scrollTop = _scroll->scrollTop();
auto scrollBottom = scrollTop + _scroll->height(); auto scrollBottom = scrollTop + _scroll->height();
currentTab()->widget()->setVisibleTopBottom(scrollTop, scrollBottom); currentTab()->widget()->setVisibleTopBottom(scrollTop, scrollBottom);
@ -3369,7 +3369,7 @@ void EmojiPan::onScroll() {
} }
} }
void EmojiPan::setCurrentSectionIcon(DBIEmojiSection section) { void EmojiPanel::setCurrentSectionIcon(DBIEmojiSection section) {
_recent->setIconOverride((section == dbiesRecent) ? &st::emojiRecentActive : nullptr); _recent->setIconOverride((section == dbiesRecent) ? &st::emojiRecentActive : nullptr);
_people->setIconOverride((section == dbiesPeople) ? &st::emojiPeopleActive : nullptr); _people->setIconOverride((section == dbiesPeople) ? &st::emojiPeopleActive : nullptr);
_nature->setIconOverride((section == dbiesNature) ? &st::emojiNatureActive : nullptr); _nature->setIconOverride((section == dbiesNature) ? &st::emojiNatureActive : nullptr);
@ -3380,7 +3380,7 @@ void EmojiPan::setCurrentSectionIcon(DBIEmojiSection section) {
_symbols->setIconOverride((section == dbiesSymbols) ? &st::emojiSymbolsActive : nullptr); _symbols->setIconOverride((section == dbiesSymbols) ? &st::emojiSymbolsActive : nullptr);
} }
void EmojiPan::validateSelectedIcon(ValidateIconAnimations animations) { void EmojiPanel::validateSelectedIcon(ValidateIconAnimations animations) {
auto setId = stickers()->currentSet(_scroll->scrollTop()); auto setId = stickers()->currentSet(_scroll->scrollTop());
auto newSel = 0; auto newSel = 0;
for (auto i = 0, l = _icons.size(); i != l; ++i) { for (auto i = 0, l = _icons.size(); i != l; ++i) {
@ -3411,23 +3411,23 @@ void EmojiPan::validateSelectedIcon(ValidateIconAnimations animations) {
} }
} }
style::margins EmojiPan::innerPadding() const { style::margins EmojiPanel::innerPadding() const {
return st::emojiPanMargins; return st::emojiPanMargins;
} }
QRect EmojiPan::innerRect() const { QRect EmojiPanel::innerRect() const {
return rect().marginsRemoved(innerPadding()); return rect().marginsRemoved(innerPadding());
} }
QRect EmojiPan::horizontalRect() const { QRect EmojiPanel::horizontalRect() const {
return innerRect().marginsRemoved(style::margins(0, st::buttonRadius, 0, st::buttonRadius)); return innerRect().marginsRemoved(style::margins(0, st::buttonRadius, 0, st::buttonRadius));
} }
QRect EmojiPan::verticalRect() const { QRect EmojiPanel::verticalRect() const {
return innerRect().marginsRemoved(style::margins(st::buttonRadius, 0, st::buttonRadius, 0)); return innerRect().marginsRemoved(style::margins(st::buttonRadius, 0, st::buttonRadius, 0));
} }
void EmojiPan::createTabsSlider() { void EmojiPanel::createTabsSlider() {
_tabsSlider->setSectionActivatedCallback([this] { _tabsSlider->setSectionActivatedCallback([this] {
switchTab(); switchTab();
}); });
@ -3442,7 +3442,7 @@ void EmojiPan::createTabsSlider() {
_topShadow->setGeometry(_tabsSlider->x(), _tabsSlider->bottomNoMargins() - st::lineWidth, _tabsSlider->width(), st::lineWidth); _topShadow->setGeometry(_tabsSlider->x(), _tabsSlider->bottomNoMargins() - st::lineWidth, _tabsSlider->width(), st::lineWidth);
} }
void EmojiPan::switchTab() { void EmojiPanel::switchTab() {
auto tab = _tabsSlider->activeSection(); auto tab = _tabsSlider->activeSection();
t_assert(tab >= 0 && tab < Tab::kCount); t_assert(tab >= 0 && tab < Tab::kCount);
auto newTabType = static_cast<TabType>(tab); auto newTabType = static_cast<TabType>(tab);
@ -3497,10 +3497,11 @@ void EmojiPan::switchTab() {
_a_slide.start([this] { update(); }, 0., 1., st::emojiPanSlideDuration, anim::linear); _a_slide.start([this] { update(); }, 0., 1., st::emojiPanSlideDuration, anim::linear);
update(); update();
AuthSession::Current().data().setEmojiPanelTab(_currentTabType);
onSaveConfigDelayed(internal::kSaveChosenTabTimeout); onSaveConfigDelayed(internal::kSaveChosenTabTimeout);
} }
void EmojiPan::setWidgetToScrollArea() { void EmojiPanel::setWidgetToScrollArea() {
_scroll->setOwnedWidget(currentTab()->takeWidget()); _scroll->setOwnedWidget(currentTab()->takeWidget());
_scroll->disableScroll(false); _scroll->disableScroll(false);
currentTab()->widget()->moveToLeft(0, 0); currentTab()->widget()->moveToLeft(0, 0);
@ -3509,7 +3510,7 @@ void EmojiPan::setWidgetToScrollArea() {
onScroll(); onScroll();
} }
void EmojiPan::onDisplaySet(quint64 setId) { void EmojiPanel::onDisplaySet(quint64 setId) {
auto &sets = Global::StickerSets(); auto &sets = Global::StickerSets();
auto it = sets.constFind(setId); auto it = sets.constFind(setId);
if (it != sets.cend()) { if (it != sets.cend()) {
@ -3519,7 +3520,7 @@ void EmojiPan::onDisplaySet(quint64 setId) {
} }
} }
void EmojiPan::onInstallSet(quint64 setId) { void EmojiPanel::onInstallSet(quint64 setId) {
auto &sets = Global::StickerSets(); auto &sets = Global::StickerSets();
auto it = sets.constFind(setId); auto it = sets.constFind(setId);
if (it != sets.cend()) { if (it != sets.cend()) {
@ -3537,7 +3538,7 @@ void EmojiPan::onInstallSet(quint64 setId) {
} }
} }
void EmojiPan::onRemoveSet(quint64 setId) { void EmojiPanel::onRemoveSet(quint64 setId) {
auto &sets = Global::StickerSets(); auto &sets = Global::StickerSets();
auto it = sets.constFind(setId); auto it = sets.constFind(setId);
if (it != sets.cend() && !(it->flags & MTPDstickerSet::Flag::f_official)) { if (it != sets.cend() && !(it->flags & MTPDstickerSet::Flag::f_official)) {
@ -3581,7 +3582,7 @@ void EmojiPan::onRemoveSet(quint64 setId) {
} }
} }
void EmojiPan::onDelayedHide() { void EmojiPanel::onDelayedHide() {
if (!rect().contains(mapFromGlobal(QCursor::pos()))) { if (!rect().contains(mapFromGlobal(QCursor::pos()))) {
_hideTimer.start(3000); _hideTimer.start(3000);
} }
@ -3589,11 +3590,11 @@ void EmojiPan::onDelayedHide() {
_displayingSetId = 0; _displayingSetId = 0;
} }
void EmojiPan::clearInlineBot() { void EmojiPanel::clearInlineBot() {
inlineBotChanged(); inlineBotChanged();
} }
bool EmojiPan::overlaps(const QRect &globalRect) const { bool EmojiPanel::overlaps(const QRect &globalRect) const {
if (isHidden() || !_cache.isNull()) return false; if (isHidden() || !_cache.isNull()) return false;
auto testRect = QRect(mapFromGlobal(globalRect.topLeft()), globalRect.size()); auto testRect = QRect(mapFromGlobal(globalRect.topLeft()), globalRect.size());
@ -3602,7 +3603,7 @@ bool EmojiPan::overlaps(const QRect &globalRect) const {
|| inner.marginsRemoved(QMargins(0, st::buttonRadius, 0, st::buttonRadius)).contains(testRect); || inner.marginsRemoved(QMargins(0, st::buttonRadius, 0, st::buttonRadius)).contains(testRect);
} }
void EmojiPan::inlineBotChanged() { void EmojiPanel::inlineBotChanged() {
if (!_inlineBot) return; if (!_inlineBot) return;
if (!isHidden() && !_hiding) { if (!isHidden() && !_hiding) {
@ -3622,7 +3623,7 @@ void EmojiPan::inlineBotChanged() {
Notify::inlineBotRequesting(false); Notify::inlineBotRequesting(false);
} }
void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) { void EmojiPanel::inlineResultsDone(const MTPmessages_BotResults &result) {
_inlineRequestId = 0; _inlineRequestId = 0;
Notify::inlineBotRequesting(false); Notify::inlineBotRequesting(false);
@ -3668,7 +3669,7 @@ void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) {
onScroll(); onScroll();
} }
void EmojiPan::queryInlineBot(UserData *bot, PeerData *peer, QString query) { void EmojiPanel::queryInlineBot(UserData *bot, PeerData *peer, QString query) {
bool force = false; bool force = false;
_inlineQueryPeer = peer; _inlineQueryPeer = peer;
if (bot != _inlineBot) { if (bot != _inlineBot) {
@ -3700,7 +3701,7 @@ void EmojiPan::queryInlineBot(UserData *bot, PeerData *peer, QString query) {
} }
} }
void EmojiPan::onInlineRequest() { void EmojiPanel::onInlineRequest() {
if (_inlineRequestId || !_inlineBot || !_inlineQueryPeer) return; if (_inlineRequestId || !_inlineBot || !_inlineQueryPeer) return;
_inlineQuery = _inlineNextQuery; _inlineQuery = _inlineNextQuery;
@ -3720,7 +3721,7 @@ void EmojiPan::onInlineRequest() {
}).handleAllErrors().send(); }).handleAllErrors().send();
} }
void EmojiPan::onEmptyInlineRows() { void EmojiPanel::onEmptyInlineRows() {
if (!_inlineBot) { if (!_inlineBot) {
gifs()->hideInlineRowsPanel(); gifs()->hideInlineRowsPanel();
} else { } else {
@ -3728,7 +3729,7 @@ void EmojiPan::onEmptyInlineRows() {
} }
} }
bool EmojiPan::refreshInlineRows(int32 *added) { bool EmojiPanel::refreshInlineRows(int32 *added) {
auto it = _inlineCache.find(_inlineQuery); auto it = _inlineCache.find(_inlineQuery);
const internal::InlineCacheEntry *entry = nullptr; const internal::InlineCacheEntry *entry = nullptr;
if (it != _inlineCache.cend()) { if (it != _inlineCache.cend()) {
@ -3743,7 +3744,7 @@ bool EmojiPan::refreshInlineRows(int32 *added) {
return (entry != nullptr); return (entry != nullptr);
} }
int32 EmojiPan::showInlineRows(bool newResults) { int32 EmojiPanel::showInlineRows(bool newResults) {
int32 added = 0; int32 added = 0;
bool clear = !refreshInlineRows(&added); bool clear = !refreshInlineRows(&added);
if (newResults) { if (newResults) {

View file

@ -445,11 +445,11 @@ private:
} // namespace internal } // namespace internal
class EmojiPan : public TWidget, private MTP::Sender { class EmojiPanel : public TWidget, private MTP::Sender {
Q_OBJECT Q_OBJECT
public: public:
EmojiPan(QWidget *parent); EmojiPanel(QWidget *parent);
void setMinTop(int minTop); void setMinTop(int minTop);
void setMinBottom(int minBottom); void setMinBottom(int minBottom);
@ -476,7 +476,7 @@ public:
void showAnimated(); void showAnimated();
void hideAnimated(); void hideAnimated();
~EmojiPan(); ~EmojiPanel();
protected: protected:
void enterEventHook(QEvent *e) override; void enterEventHook(QEvent *e) override;
@ -524,7 +524,7 @@ signals:
void updateStickers(); void updateStickers();
private: private:
using TabType = EmojiPanTabType; using TabType = EmojiPanelTab;
class Tab { class Tab {
public: public:
static constexpr auto kCount = 3; static constexpr auto kCount = 3;

View file

@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
namespace Stickers { namespace Stickers {
constexpr auto kPanPerRow = 5; constexpr auto kPanelPerRow = 5;
void applyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d); void applyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d);
bool applyArchivedResultFake(); // For testing. bool applyArchivedResultFake(); // For testing.

View file

@ -51,8 +51,8 @@ EmojiPtr FindReplace(const QChar *ch, const QChar *end, int *outLength = nullptr
void Init(); void Init();
constexpr auto kPostfix = static_cast<ushort>(0xFE0F); constexpr auto kPostfix = static_cast<ushort>(0xFE0F);
constexpr auto kPanPerRow = 7; constexpr auto kPanelPerRow = 7;
constexpr auto kPanRowsPerPage = 6; constexpr auto kPanelRowsPerPage = 6;
class One { class One {
struct CreationTag { struct CreationTag {
@ -314,7 +314,7 @@ inline RecentEmojiPack &GetRecent() {
} }
} }
} }
uint64 defaultRecent[] = { auto defaultRecent = {
0xD83DDE02LLU, 0xD83DDE02LLU,
0xD83DDE18LLU, 0xD83DDE18LLU,
0x2764LLU, 0x2764LLU,
@ -351,7 +351,7 @@ inline RecentEmojiPack &GetRecent() {
0xD83DDE15LLU, 0xD83DDE15LLU,
}; };
for (auto oldKey : defaultRecent) { for (auto oldKey : defaultRecent) {
if (result.size() >= kPanPerRow * kPanRowsPerPage) break; if (result.size() >= kPanelPerRow * kPanelRowsPerPage) break;
if (auto emoji = Ui::Emoji::FromOldKey(oldKey)) { if (auto emoji = Ui::Emoji::FromOldKey(oldKey)) {
if (!haveAlready(emoji)) { if (!haveAlready(emoji)) {

View file

@ -330,8 +330,8 @@
<(src_loc)/settings/settings_scale_widget.h <(src_loc)/settings/settings_scale_widget.h
<(src_loc)/settings/settings_widget.cpp <(src_loc)/settings/settings_widget.cpp
<(src_loc)/settings/settings_widget.h <(src_loc)/settings/settings_widget.h
<(src_loc)/stickers/emoji_pan.cpp <(src_loc)/stickers/emoji_panel.cpp
<(src_loc)/stickers/emoji_pan.h <(src_loc)/stickers/emoji_panel.h
<(src_loc)/stickers/stickers.cpp <(src_loc)/stickers/stickers.cpp
<(src_loc)/stickers/stickers.h <(src_loc)/stickers/stickers.h
<(src_loc)/storage/file_download.cpp <(src_loc)/storage/file_download.cpp