Improve Emoji-Stickers-GIFs panel.

Fix broken minimal panel size.
Remove HistoryWidget context menu from the panel.
This commit is contained in:
John Preston 2017-04-16 00:05:57 +03:00
parent 6226cf2809
commit 8e241e8b78
6 changed files with 16 additions and 15 deletions

View File

@ -98,8 +98,10 @@ void TabbedPanel::updateContentHeight() {
}
auto addedHeight = innerPadding().top() + innerPadding().bottom();
auto wantedContentHeight = qRound(st::emojiPanHeightRatio * _bottom) - addedHeight;
auto contentHeight = snap(wantedContentHeight, st::emojiPanMinHeight, st::emojiPanMaxHeight);
auto marginsHeight = _selector->marginTop() + _selector->marginBottom();
auto availableHeight = _bottom - marginsHeight;
auto wantedContentHeight = qRound(st::emojiPanHeightRatio * availableHeight) - addedHeight;
auto contentHeight = marginsHeight + snap(wantedContentHeight, st::emojiPanMinHeight, st::emojiPanMaxHeight);
auto resultTop = _bottom - addedHeight - contentHeight;
if (contentHeight == _contentHeight) {
move(x(), resultTop);

View File

@ -61,6 +61,9 @@ public:
void beforeHiding();
void afterShown();
int marginTop() const;
int marginBottom() const;
bool preventAutoHide() const;
bool isSliding() const {
return _a_slide.animating();
@ -135,8 +138,6 @@ private:
};
int marginTop() const;
int marginBottom() const;
void paintSlideFrame(Painter &p, TimeMs ms);
void paintContent(Painter &p);

View File

@ -1200,6 +1200,10 @@ void HistoryInner::mouseDoubleClickEvent(QMouseEvent *e) {
}
}
void HistoryInner::contextMenuEvent(QContextMenuEvent *e) {
showContextMenu(e);
}
void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
if (_menu) {
_menu->deleteLater();

View File

@ -41,8 +41,6 @@ public:
void messagesReceived(PeerData *peer, const QVector<MTPMessage> &messages);
void messagesReceivedDown(PeerData *peer, const QVector<MTPMessage> &messages);
void showContextMenu(QContextMenuEvent *e, bool showFromTouch = false);
TextWithEntities getSelectedText() const;
void dragActionStart(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton);
@ -108,8 +106,9 @@ protected:
void leaveEventHook(QEvent *e) override;
void resizeEvent(QResizeEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
void contextMenuEvent(QContextMenuEvent *e) override;
public slots:
public slots:
void onUpdateSelected();
void onParentGeometryChanged();
@ -126,11 +125,13 @@ protected:
void onTouchScrollTimer();
void onDragExec();
private slots:
private slots:
void onScrollDateCheck();
void onScrollDateHideByTimer();
private:
void showContextMenu(QContextMenuEvent *e, bool showFromTouch = false);
void itemRemoved(HistoryItem *item);
void savePhotoToFile(PhotoData *photo);
void saveDocumentToFile(DocumentData *document);

View File

@ -3610,12 +3610,6 @@ void HistoryWidget::onCmdStart() {
setFieldText({ qsl("/"), TextWithTags::Tags() }, 0, Ui::FlatTextarea::AddToUndoHistory);
}
void HistoryWidget::contextMenuEvent(QContextMenuEvent *e) {
if (!_list) return;
return _list->showContextMenu(e);
}
void HistoryWidget::forwardMessage() {
auto item = App::contextItem();
if (!item || item->id < 0 || item->serviceMsg()) return;

View File

@ -363,7 +363,6 @@ protected:
void leaveEventHook(QEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
void contextMenuEvent(QContextMenuEvent *e) override;
signals:
void cancelled();