1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-01-30 00:55:33 +01:00

Add "Show above status bar" as an option

This commit is contained in:
Jonas Kvinge 2018-09-05 19:03:21 +02:00
parent 9e4f3f9867
commit 032022c246
5 changed files with 26 additions and 5 deletions

View File

@ -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();

View File

@ -232,7 +232,7 @@ signals:
void CheckForUpdates();
void PlayingWidgetPositionChanged();
void PlayingWidgetPositionChanged(bool above_status_bar);
void SongSaveComplete(TagReaderReply *reply, const QPersistentModelIndex& index);

View File

@ -300,6 +300,9 @@
</property>
<item>
<widget class="QStackedWidget" name="status_bar_stack">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="MultiLoadingIndicator" name="multi_loading_indicator"/>
<widget class="QWidget" name="playlist_summary_page">
<layout class="QVBoxLayout" name="playlist_summary_layout">

View File

@ -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() {
}

View File

@ -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_;