From 5fc4cf7f94ebdf8709caf0dde2a89deee9f2f91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Faisant?= Date: Thu, 2 Dec 2021 01:07:38 +0100 Subject: [PATCH] build background streams menus programatically --- src/ui/mainwindow.cpp | 40 +++++++++++++++++++++++----------------- src/ui/mainwindow.ui | 27 --------------------------- 2 files changed, 23 insertions(+), 44 deletions(-) diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index eb7c5476e..ecd077250 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -396,14 +396,6 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, IconLoader::Load("document-save", IconLoader::Base)); ui_->action_full_library_scan->setIcon( IconLoader::Load("view-refresh", IconLoader::Base)); -#ifdef HAVE_BACKGROUND_STREAMS - ui_->action_rain->setIcon( - IconLoader::Load("weather-showers-scattered", IconLoader::Base)); - ui_->action_hypnotoad->setIcon( - IconLoader::Load("hypnotoad", IconLoader::Base)); - ui_->action_enterprise->setIcon( - IconLoader::Load("enterprise", IconLoader::Base)); -#endif ui_->action_kittens->setIcon(IconLoader::Load("kittens", IconLoader::Base)); ui_->action_love->setIcon(IconLoader::Load("love", IconLoader::Lastfm)); @@ -501,15 +493,29 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, connect(this, SIGNAL(NewDebugConsole(Console*)), app_, SIGNAL(NewDebugConsole(Console*))); + // Add menus for background streams #ifdef HAVE_BACKGROUND_STREAMS - background_streams_->AddAction("Rain", ui_->action_rain); - background_streams_->AddAction("Hypnotoad", ui_->action_hypnotoad); - background_streams_->AddAction("Make it so!", ui_->action_enterprise); -#else - ui_->action_rain->setVisible(false); - ui_->action_hypnotoad->setVisible(false); - ui_->action_enterprise->setVisible(false); -#endif // HAVE_BACKGROUND_STREAMS + QAction* action_rain = + ui_->menu_extras->addAction(tr("Rain")); + action_rain->setIcon( + IconLoader::Load("weather-showers-scattered", IconLoader::Base)); + action_rain->setCheckable(true); + background_streams_->AddAction("Rain", action_rain); + + QAction* action_hypnotoad = + ui_->menu_extras->addAction(tr("All Glory to the Hypnotoad!")); + action_hypnotoad->setIcon( + IconLoader::Load("hypnotoad", IconLoader::Base)); + action_hypnotoad->setCheckable(true); + background_streams_->AddAction("Hypnotoad", action_hypnotoad); + + QAction* action_enterprise = + ui_->menu_extras->addAction(tr("Make it so!")); + action_enterprise->setIcon( + IconLoader::Load("enterprise", IconLoader::Base)); + action_enterprise->setCheckable(true); + background_streams_->AddAction("Make it so!", action_enterprise); +#endif // Playlist view actions ui_->action_next_playlist->setShortcuts( @@ -951,7 +957,7 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, connect(ui_->now_playing, SIGNAL(ShowAboveStatusBarChanged(bool)), SLOT(NowPlayingWidgetPositionChanged(bool))); #ifdef HAVE_BACKGROUND_STREAMS - connect(ui_->action_hypnotoad, SIGNAL(toggled(bool)), ui_->now_playing, + connect(action_hypnotoad, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(AllHail(bool))); #endif connect(ui_->action_kittens, SIGNAL(toggled(bool)), ui_->now_playing, diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui index bf9ce44b6..5f66450e5 100644 --- a/src/ui/mainwindow.ui +++ b/src/ui/mainwindow.ui @@ -541,9 +541,6 @@ &Extras - - - @@ -735,30 +732,6 @@ Cover Manager - - - true - - - Rain - - - - - true - - - All Glory to the Hypnotoad! - - - - - true - - - Make it so! - - true