diff --git a/Telegram/SourceFiles/media/player/media_player_widget.cpp b/Telegram/SourceFiles/media/player/media_player_widget.cpp index 73f279ccf..cc95ee291 100644 --- a/Telegram/SourceFiles/media/player/media_player_widget.cpp +++ b/Telegram/SourceFiles/media/player/media_player_widget.cpp @@ -281,6 +281,23 @@ void Widget::mouseMoveEvent(QMouseEvent *e) { updateOverLabelsState(e->pos()); } +void Widget::mousePressEvent(QMouseEvent *e) { + _labelsDown = _labelsOver; +} + +void Widget::mouseReleaseEvent(QMouseEvent *e) { + if (auto downLabels = base::take(_labelsDown)) { + if (_labelsOver == downLabels) { + if (_type == AudioMsgId::Type::Voice) { + auto current = instance()->current(_type); + if (auto item = App::histItemById(current.contextId())) { + Ui::showPeerHistoryAtItem(item); + } + } + } + } +} + void Widget::updateOverLabelsState(QPoint pos) { auto left = getLabelsLeft(); auto right = getLabelsRight(); @@ -290,7 +307,11 @@ void Widget::updateOverLabelsState(QPoint pos) { } void Widget::updateOverLabelsState(bool over) { - instance()->playerWidgetOver().notify(over, true); + _labelsOver = over; + auto pressShowsItem = _labelsOver && (_type == AudioMsgId::Type::Voice); + setCursor(pressShowsItem ? style::cur_pointer : style::cur_default); + auto showPlaylist = over && (_type == AudioMsgId::Type::Song); + instance()->playerWidgetOver().notify(showPlaylist, true); } void Widget::updatePlayPrevNextPositions() { @@ -365,6 +386,7 @@ void Widget::setType(AudioMsgId::Type type) { updateLabelsGeometry(); handleSongChange(); handleSongUpdate(mixer()->currentState(_type)); + updateOverLabelsState(_labelsOver); } } diff --git a/Telegram/SourceFiles/media/player/media_player_widget.h b/Telegram/SourceFiles/media/player/media_player_widget.h index 94df72751..6b370cd0b 100644 --- a/Telegram/SourceFiles/media/player/media_player_widget.h +++ b/Telegram/SourceFiles/media/player/media_player_widget.h @@ -62,6 +62,8 @@ protected: void leaveEventHook(QEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override; + void mousePressEvent(QMouseEvent *e) override; + void mouseReleaseEvent(QMouseEvent *e) override; private: void handleSeekProgress(float64 progress); @@ -100,6 +102,9 @@ private: AudioMsgId::Type _type = AudioMsgId::Type::Unknown; bool _voiceIsActive = false; + bool _labelsOver = false; + bool _labelsDown = false; + class PlayButton; object_ptr _nameLabel; object_ptr _timeLabel;