Playlist appearance added to the new media player.

Also itemRemoved() now is fired as a global observable.
This commit is contained in:
John Preston
2016-10-14 20:10:15 +03:00
parent 4f0cff5467
commit 31a847fb9d
38 changed files with 677 additions and 271 deletions
+11 -12
View File
@@ -103,18 +103,8 @@ TitleWidget::TitleWidget(QWidget *parent) : TWidget(parent)
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
if (Media::Player::exists()) {
subscribe(Media::Player::instance()->createdNotifier(), [this](const Media::Player::PanelEvent &e) {
if (!_player) {
_player.create(this);
updateControlsVisibility();
}
_player->installEventFilter(e.panel);
});
subscribe(Media::Player::instance()->destroyedNotifier(), [this](const Media::Player::PanelEvent &e) {
if (_player) {
_player.destroyDelayed();
updateControlsVisibility();
}
subscribe(Media::Player::instance()->usePanelPlayer(), [this](bool usePanel) {
updatePlayerButton(usePanel);
});
}
@@ -179,6 +169,15 @@ void TitleWidget::onAbout() {
Ui::showLayer(new AboutBox());
}
void TitleWidget::updatePlayerButton(bool usePanel) {
if (usePanel && !_player) {
_player.create(this);
} else if (!usePanel && _player) {
_player.destroyDelayed();
}
updateControlsVisibility();
}
void TitleWidget::updateControlsPosition() {
QPoint p(width() - ((cPlatform() == dbipWindows && lastMaximized) ? 0 : st::sysBtnDelta), 0);