diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index b780847a0..b8ac60371 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -641,9 +641,10 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co connect(app_->player(), SIGNAL(Playing()), ui_->widget_playing, SLOT(Playing())); connect(app_->player(), SIGNAL(Stopped()), ui_->widget_playing, SLOT(Stopped())); connect(app_->player(), SIGNAL(Error()), ui_->widget_playing, SLOT(Error())); + connect(ui_->widget_playing, SIGNAL(ShowAboveStatusBarChanged(bool)), SLOT(PlayingWidgetPositionChanged(bool))); connect(ui_->action_console, SIGNAL(triggered()), SLOT(ShowConsole())); - PlayingWidgetPositionChanged(); + PlayingWidgetPositionChanged(ui_->widget_playing->show_above_status_bar()); // Load theme // This is tricky: we need to save the default/system palette now, @@ -1804,10 +1805,10 @@ void MainWindow::TaskCountChanged(int count) { } } -void MainWindow::PlayingWidgetPositionChanged() { +void MainWindow::PlayingWidgetPositionChanged(bool above_status_bar) { - ui_->status_bar->setParent(ui_->centralWidget); - //ui_->status_bar->setParent(ui_->player_controls_container); + if (above_status_bar) ui_->status_bar->setParent(ui_->centralWidget); + else ui_->status_bar->setParent(ui_->player_controls_container); ui_->status_bar->parentWidget()->layout()->addWidget(ui_->status_bar); ui_->status_bar->show(); diff --git a/src/core/mainwindow.h b/src/core/mainwindow.h index e3797a179..0430ef95b 100644 --- a/src/core/mainwindow.h +++ b/src/core/mainwindow.h @@ -232,7 +232,7 @@ signals: void CheckForUpdates(); - void PlayingWidgetPositionChanged(); + void PlayingWidgetPositionChanged(bool above_status_bar); void SongSaveComplete(TagReaderReply *reply, const QPersistentModelIndex& index); diff --git a/src/core/mainwindow.ui b/src/core/mainwindow.ui index 21985d849..545f5d2b6 100644 --- a/src/core/mainwindow.ui +++ b/src/core/mainwindow.ui @@ -300,6 +300,9 @@ + + 0 + diff --git a/src/widgets/playingwidget.cpp b/src/widgets/playingwidget.cpp index ba152c206..0b87c525e 100644 --- a/src/widgets/playingwidget.cpp +++ b/src/widgets/playingwidget.cpp @@ -73,6 +73,7 @@ PlayingWidget::PlayingWidget(QWidget *parent) album_cover_choice_controller_(nullptr), mode_(LargeSongDetails), menu_(new QMenu(this)), + above_statusbar_action_(nullptr), fit_cover_width_action_(nullptr), enabled_(false), visible_(false), @@ -142,6 +143,10 @@ void PlayingWidget::SetApplication(Application *app, AlbumCoverChoiceController menu_->addActions(cover_actions); menu_->addSeparator(); + above_statusbar_action_ = menu_->addAction(tr("Show above status bar")); + above_statusbar_action_->setCheckable(true); + connect(above_statusbar_action_, SIGNAL(toggled(bool)), SLOT(ShowAboveStatusBar(bool))); + connect(album_cover_choice_controller_, SIGNAL(AutomaticCoverSearchDone()), this, SLOT(AutomaticCoverSearchDone())); connect(album_cover_choice_controller_->search_cover_auto_action(), SIGNAL(triggered()), this, SLOT(SearchCoverAutomatically())); @@ -218,6 +223,7 @@ void PlayingWidget::SetMode(int mode) { QSettings s; s.beginGroup(kSettingsGroup); s.setValue("mode", mode_); + s.endGroup(); } @@ -232,6 +238,14 @@ void PlayingWidget::FitCoverWidth(bool fit) { s.setValue("fit_cover_width", fit_width_); } +void PlayingWidget::ShowAboveStatusBar(bool above) { + QSettings s; + s.beginGroup(kSettingsGroup); + s.setValue("above_status_bar", above); + emit ShowAboveStatusBarChanged(above); + s.endGroup(); +} + void PlayingWidget::Playing() { } diff --git a/src/widgets/playingwidget.h b/src/widgets/playingwidget.h index 966dfeb4d..42e0d1e8c 100644 --- a/src/widgets/playingwidget.h +++ b/src/widgets/playingwidget.h @@ -71,6 +71,7 @@ class PlayingWidget : public QWidget { void SetDisabled(); void set_ideal_height(int height); QSize sizeHint() const; + bool show_above_status_bar() const { return above_statusbar_action_->isChecked(); } signals: void ShowAboveStatusBarChanged(bool above); @@ -91,6 +92,7 @@ class PlayingWidget : public QWidget { private slots: void SetMode(int mode); + void ShowAboveStatusBar(bool above); void FitCoverWidth(bool fit); void SearchCoverAutomatically(); @@ -119,6 +121,7 @@ class PlayingWidget : public QWidget { AlbumCoverChoiceController *album_cover_choice_controller_; Mode mode_; QMenu *menu_; + QAction* above_statusbar_action_; QAction *fit_cover_width_action_; bool enabled_; bool visible_;