2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Version 0.10.15 alpha: crash fix in new player, close button added.

Also some grammar improvements and pinned message bar hiding fixed.
This commit is contained in:
John Preston
2016-10-18 18:19:13 +03:00
parent b33b59b8b9
commit 48a20f0e71
18 changed files with 132 additions and 62 deletions

View File

@@ -124,6 +124,7 @@ MainWidget::MainWidget(MainWindow *window) : TWidget(window)
if (Media::Player::exists()) {
_playerPanel->setPinCallback([this] { switchToFixedPlayer(); });
_playerPanel->setCloseCallback([this] { closeBothPlayers(); });
subscribe(Media::Player::instance()->titleButtonOver(), [this](bool over) {
if (over) {
_playerPanel->showFromOther();
@@ -1578,8 +1579,10 @@ void MainWidget::handleAudioUpdate(const AudioMsgId &audioId) {
}
if (playing == audioId && audioId.type() == AudioMsgId::Type::Song) {
if (!_playerUsingPanel && !_player && Media::Player::exists()) {
createPlayer();
if (!(playbackState.state & AudioPlayerStoppedMask) && playbackState.state != AudioPlayerFinishing) {
if (!_playerUsingPanel && !_player && Media::Player::exists()) {
createPlayer();
}
}
}
@@ -1623,6 +1626,22 @@ void MainWidget::switchToFixedPlayer() {
_playerPanel->hideIgnoringEnterEvents();
}
void MainWidget::closeBothPlayers() {
_playerUsingPanel = false;
_player.destroyDelayed();
_playerVolume.destroyDelayed();
if (Media::Player::exists()) {
Media::Player::instance()->usePanelPlayer().notify(false, true);
}
_playerPanel->hideIgnoringEnterEvents();
_playerPlaylist->hideIgnoringEnterEvents();
if (Media::Player::exists()) {
Media::Player::instance()->stop();
}
}
void MainWidget::createPlayer() {
_player.create(this, [this] { playerHeightUpdated(); });
_player->entity()->setCloseCallback([this] { switchToPanelPlayer(); });