MythTV  master
musiccommon.cpp
Go to the documentation of this file.
1 // ANSI C includes
2 #include <cstdlib>
3 
4 // C++ includes
5 #include <iostream>
6 using namespace std;
7 
8 // Qt includes
9 #include <QApplication>
10 #include <QLocale>
11 
12 // mythtv
13 #include <mythuitextedit.h>
14 #include <mythuistatetype.h>
15 #include <mythuiprogressbar.h>
16 #include <mythuibutton.h>
17 #include <mythuiimage.h>
18 #include <mythdialogbox.h>
19 #include <mythuibuttonlist.h>
20 #include <mythuibuttontree.h>
21 #include <mythuicheckbox.h>
22 #include <mythuivideo.h>
23 #include <mythuitext.h>
24 #include <audiooutput.h>
25 #include <compat.h>
26 #include <lcddevice.h>
27 #include <musicmetadata.h>
28 
29 // MythMusic includes
30 #include "musicdata.h"
31 #include "constants.h"
32 #include "decoder.h"
33 #include "mainvisual.h"
34 #include "smartplaylist.h"
35 #include "playlistcontainer.h"
36 #include "search.h"
37 #include "editmetadata.h"
38 #include "playlist.h"
39 
40 #include "musiccommon.h"
41 #include "playlistview.h"
42 #include "playlisteditorview.h"
43 #include "streamview.h"
44 #include "visualizerview.h"
45 #include "searchview.h"
46 #include "lyricsview.h"
47 
49  const QString &name)
50  : MythScreenType(parent, name),
51  m_parentScreen(parentScreen),
52  m_currentView()
53 {
54  m_cycleVisualizer = gCoreContext->GetBoolSetting("VisualCycleOnSongChange", false);
55 
56  if (LCD *lcd = LCD::Get())
57  {
58  lcd->switchToTime();
59  lcd->setFunctionLEDs(FUNC_MUSIC, true);
60  }
61 }
62 
64 {
65  gPlayer->removeListener(this);
66 
67  if (m_mainvisual)
68  {
70  delete m_mainvisual;
71  m_mainvisual = nullptr;
72  }
73 
74  if (LCD *lcd = LCD::Get())
75  {
76  lcd->switchToTime();
77  lcd->setFunctionLEDs(FUNC_MUSIC, false);
78  }
79 }
80 
82 {
83  bool err = false;
84  UIUtilW::Assign(this, m_timeText, "time", &err);
85  UIUtilW::Assign(this, m_infoText, "info", &err);
86  UIUtilW::Assign(this, m_visualText, "visualizername", &err);
87  UIUtilW::Assign(this, m_noTracksText, "notracks", &err);
88 
89  UIUtilW::Assign(this, m_shuffleState, "shufflestate", &err);
90  UIUtilW::Assign(this, m_repeatState, "repeatstate", &err);
91  UIUtilW::Assign(this, m_movingTracksState, "movingtracksstate", &err);
92 
93  UIUtilW::Assign(this, m_ratingState, "ratingstate", &err);
94 
95  UIUtilW::Assign(this, m_trackProgress, "progress", &err);
96  UIUtilW::Assign(this, m_trackProgressText, "trackprogress", &err);
97  UIUtilW::Assign(this, m_trackSpeedText, "trackspeed", &err);
98  UIUtilW::Assign(this, m_trackState, "trackstate", &err);
99 
100  UIUtilW::Assign(this, m_volumeText, "volume", &err);
101  UIUtilW::Assign(this, m_muteState, "mutestate", &err);
102 
103  UIUtilW::Assign(this, m_playlistProgress, "playlistprogress", &err);
104 
105  UIUtilW::Assign(this, m_prevButton, "prev", &err);
106  UIUtilW::Assign(this, m_rewButton, "rew", &err);
107  UIUtilW::Assign(this, m_pauseButton, "pause", &err);
108  UIUtilW::Assign(this, m_playButton, "play", &err);
109  UIUtilW::Assign(this, m_stopButton, "stop", &err);
110  UIUtilW::Assign(this, m_ffButton, "ff", &err);
111  UIUtilW::Assign(this, m_nextButton, "next", &err);
112 
113  UIUtilW::Assign(this, m_coverartImage, "coverart", &err);
114 
115  UIUtilW::Assign(this, m_currentPlaylist, "currentplaylist", &err);
116  UIUtilW::Assign(this, m_playedTracksList, "playedtrackslist", &err);
117 
118  UIUtilW::Assign(this, m_visualizerVideo, "visualizer", &err);
119 
120  if (m_prevButton)
121  connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(previous()));
122 
123  if (m_rewButton)
124  connect(m_rewButton, SIGNAL(Clicked()), this, SLOT(seekback()));
125 
126  if (m_pauseButton)
127  {
128  m_pauseButton->SetLockable(true);
129  connect(m_pauseButton, SIGNAL(Clicked()), this, SLOT(pause()));
130  }
131 
132  if (m_playButton)
133  {
134  m_playButton->SetLockable(true);
135  connect(m_playButton, SIGNAL(Clicked()), this, SLOT(play()));
136  }
137 
138  if (m_stopButton)
139  {
140  m_stopButton->SetLockable(true);
141  connect(m_stopButton, SIGNAL(Clicked()), this, SLOT(stop()));
142  }
143 
144  if (m_ffButton)
145  connect(m_ffButton, SIGNAL(Clicked()), this, SLOT(seekforward()));
146 
147  if (m_nextButton)
148  connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(next()));
149 
150  if (m_currentPlaylist)
151  {
152  connect(m_currentPlaylist, SIGNAL(itemClicked(MythUIButtonListItem*)),
154  connect(m_currentPlaylist, SIGNAL(itemVisible(MythUIButtonListItem*)),
156 
157  m_currentPlaylist->SetSearchFields("**search**");
158  }
159 
160  init();
161 
162  return err;
163 }
164 
166 {
167  gPlayer->addListener(this);
168 
169  if (startPlayback)
170  {
171  if (!gPlayer->isPlaying())
172  {
173  if (m_currentView == MV_RADIO)
177  else
179 
181  }
182  else
183  {
184  // if we are playing but we are switching to a view from a different playmode
185  // we need to restart playback in the new mode
187  {
188  // these views can be used in both play modes
189  }
191  {
192  gPlayer->stop(true);
193 
196  else
198 
200  }
202  {
203  gPlayer->stop(true);
206  }
207  }
208  }
209 
211 
213  if (curMeta)
214  updateTrackInfo(curMeta);
215 
217 
218  if (m_currentPlaylist)
220 
221  if (m_visualizerVideo)
222  {
224 
226 
227  m_fullscreenBlank = false;
228 
229  m_randomVisualizer = gCoreContext->GetBoolSetting("VisualRandomize", false);
230 
232 
233  // sanity check
234  if (m_currentVisual >= static_cast<uint>(m_visualModes.count()))
235  {
236  LOG(VB_GENERAL, LOG_ERR, QString("MusicCommon: Got a bad saved visualizer: %1").arg(m_currentVisual));
237  m_currentVisual = 0;
238  }
239 
241 
242  if (gPlayer->isPlaying())
243  startVisualizer();
244  }
245 
246  m_controlVolume = gCoreContext->GetBoolSetting("MythControlsVolume", false);
247  updateVolume();
248 
251 
252  if (m_stopButton)
254  if (m_playButton)
256  if (m_pauseButton)
258  if (m_trackState)
259  {
260  if (gPlayer->isPlaying())
261  m_trackState->DisplayState("playing");
262  else if (gPlayer->isPaused())
263  m_trackState->DisplayState("paused");
264  else
265  m_trackState->DisplayState("stopped");
266 
267  }
268 
271 
275 
276  if (m_playlistProgress)
277  {
280  }
281 
283 
285 }
286 
288 {
289  if (m_repeatState)
290  {
291  switch (gPlayer->getRepeatMode())
292  {
294  m_repeatState->DisplayState("off");
295  if (class LCD *lcd = LCD::Get())
296  lcd->setMusicRepeat (LCD::MUSIC_REPEAT_NONE);
297  break;
299  m_repeatState->DisplayState("track");
300  if (class LCD *lcd = LCD::Get())
301  lcd->setMusicRepeat (LCD::MUSIC_REPEAT_TRACK);
302  break;
304  m_repeatState->DisplayState("all");
305  if (class LCD *lcd = LCD::Get())
306  lcd->setMusicRepeat (LCD::MUSIC_REPEAT_ALL);
307  break;
308  default:
309  m_repeatState->DisplayState("off");
310  if (class LCD *lcd = LCD::Get())
311  lcd->setMusicRepeat (LCD::MUSIC_REPEAT_NONE);
312  break;
313  }
314  }
315 
316  // need this to update the next track info
318  if (curMeta)
319  updateTrackInfo(curMeta);
320 }
321 
322 void MusicCommon::updateShuffleMode(bool updateUIList)
323 {
324  if (m_shuffleState)
325  {
326  switch (gPlayer->getShuffleMode())
327  {
330  if (class LCD *lcd = LCD::Get())
331  lcd->setMusicShuffle(LCD::MUSIC_SHUFFLE_NONE);
332  break;
334  m_shuffleState->DisplayState("random");
335  if (class LCD *lcd = LCD::Get())
336  lcd->setMusicShuffle(LCD::MUSIC_SHUFFLE_RAND);
337  break;
339  m_shuffleState->DisplayState("intelligent");
340  if (class LCD *lcd = LCD::Get())
341  lcd->setMusicShuffle(LCD::MUSIC_SHUFFLE_SMART);
342  break;
344  m_shuffleState->DisplayState("album");
345  if (class LCD *lcd = LCD::Get())
346  lcd->setMusicShuffle(LCD::MUSIC_SHUFFLE_ALBUM);
347  break;
349  m_shuffleState->DisplayState("artist");
350  if (class LCD *lcd = LCD::Get())
351  lcd->setMusicShuffle(LCD::MUSIC_SHUFFLE_ARTIST);
352  break;
353  default:
355  if (class LCD *lcd = LCD::Get())
356  lcd->setMusicShuffle(LCD::MUSIC_SHUFFLE_NONE);
357  break;
358  }
359  }
360 
361  if (updateUIList)
362  {
364 
369 
370  // need this to update the next track info
372  if (curMeta)
373  updateTrackInfo(curMeta);
374  }
375 }
376 
378 {
379  // can we switch to this view from the current view?
380  switch (m_currentView)
381  {
382  case MV_PLAYLIST:
383  {
384  if (view != MV_PLAYLISTEDITORTREE && view != MV_PLAYLISTEDITORGALLERY &&
385  view != MV_SEARCH && view != MV_VISUALIZER && view != MV_LYRICS)
386  return;
387  break;
388  }
389 
391  {
392  if (view != MV_PLAYLISTEDITORGALLERY && view != MV_SEARCH && view != MV_VISUALIZER && view != MV_LYRICS)
393  return;
394  break;
395  }
396 
398  {
399  if (view != MV_PLAYLISTEDITORTREE && view != MV_SEARCH && view != MV_VISUALIZER && view != MV_LYRICS)
400  return;
401  break;
402  }
403 
404  case MV_SEARCH:
405  {
406  if (view != MV_VISUALIZER && view != MV_LYRICS)
407  return;
408  break;
409  }
410 
411  case MV_VISUALIZER:
412  {
413  return;
414  }
415 
416  case MV_LYRICS:
417  {
418  if (view != MV_VISUALIZER && view != MV_SEARCH)
419  return;
420  break;
421  }
422 
423  case MV_RADIO:
424  {
425  if (view != MV_VISUALIZER && view != MV_LYRICS)
426  return;
427  break;
428  }
429 
430  default:
431  return;
432  }
433 
435 
436  stopVisualizer();
437 
438  if (m_mainvisual)
439  {
440  delete m_mainvisual;
441  m_mainvisual = nullptr;
442  }
443 
444  gPlayer->removeListener(this);
445  gPlayer->setAllowRestorePos(false);
446 
447  switch (view)
448  {
449  case MV_PLAYLIST:
450  {
451  auto *plview = new PlaylistView(mainStack, this);
452 
453  if (plview->Create())
454  {
455  mainStack->AddScreen(plview);
456  connect(plview, SIGNAL(Exiting()), this, SLOT(viewExited()));
457  }
458  else
459  delete plview;
460 
461  break;
462  }
463 
465  {
466  // if we are switching playlist editor views save and restore
467  // the current position in the tree
468  bool restorePos = (m_currentView == MV_PLAYLISTEDITORGALLERY);
469  auto *oldView = dynamic_cast<PlaylistEditorView *>(this);
470  if (oldView)
471  oldView->saveTreePosition();
472 
473  MythScreenType *parentScreen = (oldView != nullptr ? m_parentScreen : this);
474 
475  auto *pleview = new PlaylistEditorView(mainStack, parentScreen, "tree", restorePos);
476 
477  if (pleview->Create())
478  {
479  mainStack->AddScreen(pleview);
480  connect(pleview, SIGNAL(Exiting()), this, SLOT(viewExited()));
481  }
482  else
483  delete pleview;
484 
485  if (oldView)
486  {
487  disconnect(this , SIGNAL(Exiting()));
488  Close();
489  }
490 
491  break;
492  }
493 
495  {
496  // if we are switching playlist editor views save and restore
497  // the current position in the tree
498  bool restorePos = (m_currentView == MV_PLAYLISTEDITORTREE);
499  auto *oldView = dynamic_cast<PlaylistEditorView *>(this);
500  if (oldView)
501  oldView->saveTreePosition();
502 
503  MythScreenType *parentScreen = (oldView != nullptr ? m_parentScreen : this);
504 
505  auto *pleview = new PlaylistEditorView(mainStack, parentScreen, "gallery", restorePos);
506 
507  if (pleview->Create())
508  {
509  mainStack->AddScreen(pleview);
510  connect(pleview, SIGNAL(Exiting()), this, SLOT(viewExited()));
511  }
512  else
513  delete pleview;
514 
515  if (oldView)
516  {
517  disconnect(this , SIGNAL(Exiting()));
518  Close();
519  }
520 
521  break;
522  }
523 
524  case MV_SEARCH:
525  {
526  auto *sview = new SearchView(mainStack, this);
527 
528  if (sview->Create())
529  {
530  mainStack->AddScreen(sview);
531  connect(sview, SIGNAL(Exiting()), this, SLOT(viewExited()));
532  }
533  else
534  delete sview;
535 
536  break;
537  }
538 
539  case MV_VISUALIZER:
540  {
541  auto *vview = new VisualizerView(mainStack, this);
542 
543  if (vview->Create())
544  {
545  mainStack->AddScreen(vview);
546  connect(vview, SIGNAL(Exiting()), this, SLOT(viewExited()));
547  }
548  else
549  delete vview;
550 
551  break;
552  }
553 
554  case MV_LYRICS:
555  {
556  auto *lview = new LyricsView(mainStack, this);
557 
558  if (lview->Create())
559  {
560  mainStack->AddScreen(lview);
561  connect(lview, SIGNAL(Exiting()), this, SLOT(viewExited()));
562  }
563  else
564  delete lview;
565 
566  break;
567  }
568 
569  default:
570  break;
571  }
572 
574 }
575 
577 {
578  init(false);
579 }
580 
582 {
583  bool handled = false;
584 
585  // if there is a pending jump point pass the key press to the default handler
586  if (GetMythMainWindow()->IsExitingToMain())
587  {
589 
590  // do we need to stop playing?
591  if (gPlayer->isPlaying() && gCoreContext->GetSetting("MusicJumpPointAction", "stop") == "stop")
592  gPlayer->stop(true);
593 
595  }
596 
597  QStringList actions;
598  handled = GetMythMainWindow()->TranslateKeyPress("Music", e, actions, true);
599 
600  for (int i = 0; i < actions.size() && !handled; i++)
601  {
602  QString action = actions[i];
603  handled = true;
604 
605  // if we are currently moving an item,
606  // we only accept UP/DOWN/SELECT/ESCAPE
608  {
610  if (!item)
611  return false;
612 
613  if (action == "SELECT" || action == "ESCAPE")
614  {
615  m_movingTrack = false;
616  item->DisplayState("off", "movestate");
617  }
618  else if (action == "UP")
619  {
621  item->MoveUpDown(true);
628  }
629  else if (action == "DOWN")
630  {
632  item->MoveUpDown(false);
639  }
640 
641  return true;
642  }
643 
644  if (action == "ESCAPE")
645  {
646  // if we was started from another music view screen return to it
647  if (m_parentScreen)
648  {
649  handled = false;
650  }
651  else
652  {
653  // this is the top music view screen so prompt to continue playing
654  QString exit_action = gCoreContext->GetSetting("MusicExitAction", "prompt");
655 
656  if (!gPlayer->isPlaying())
657  {
659  stopAll();
660  Close();
661  }
662  else
663  {
664  if (exit_action == "stop")
665  {
667  stopAll();
668  Close();
669  }
670  else if (exit_action == "play")
671  Close();
672  else
673  showExitMenu();
674  }
675  }
676  }
677  else if (action == "THMBUP")
678  changeRating(true);
679  else if (action == "THMBDOWN")
680  changeRating(false);
681  else if (action == "NEXTTRACK")
682  {
683  if (m_nextButton)
684  m_nextButton->Push();
685  else
686  next();
687  }
688  else if (action == "PREVTRACK")
689  {
690  if (m_prevButton)
691  m_prevButton->Push();
692  else
693  previous();
694  }
695  else if (action == "FFWD")
696  {
698  {
699  if (m_ffButton)
700  m_ffButton->Push();
701  else
702  seekforward();
703  }
704  }
705  else if (action == "RWND")
706  {
708  {
709  if (m_rewButton)
710  m_rewButton->Push();
711  else
712  seekback();
713  }
714  }
715  else if (action == "PAUSE")
716  {
718  {
719  // ignore if we are already playing a radio stream
720  }
721  else if (gPlayer->isPlaying() || (gPlayer->getOutput() && gPlayer->getOutput()->IsPaused()))
722  {
723  // if we are playing or are paused PAUSE will toggle the pause state
724  if (m_pauseButton)
725  m_pauseButton->Push();
726  else
727  pause();
728  }
729  else
730  {
731  // not playing or paused so PAUSE acts the same as PLAY
732  if (m_playButton)
733  m_playButton->Push();
734  else
735  play();
736  }
737  }
738  else if (action == "PLAY")
739  {
740  if (m_playButton)
741  m_playButton->Push();
742  else
743  play();
744  }
745  else if (action == "STOP")
746  {
747  if (m_stopButton)
748  m_stopButton->Push();
749  else
750  stop();
751  m_currentTime = 0;
752  }
753  else if (action == "CYCLEVIS")
754  cycleVisualizer();
755  else if (action == "BLANKSCR")
756  {
757  // change to the blank visualizer
758  if (m_mainvisual)
759  switchVisualizer("Blank");
760 
761  // switch to the full screen visualiser view
764  }
765  else if (action == "VOLUMEDOWN")
766  changeVolume(false);
767  else if (action == "VOLUMEUP")
768  changeVolume(true);
769  else if (action == "SPEEDDOWN")
770  changeSpeed(false);
771  else if (action == "SPEEDUP")
772  changeSpeed(true);
773  else if (action == "MUTE")
774  toggleMute();
775  else if (action == "TOGGLEUPMIX")
776  toggleUpmix();
777  else if (action == "INFO" || action == "EDIT")
778  {
780  {
782  {
783  auto *mdata = m_currentPlaylist->GetItemCurrent()->GetData().value<MusicMetadata*>();
784  if (mdata)
785  {
786  if (action == "INFO")
787  showTrackInfo(mdata);
788  else
789  editTrackInfo(mdata);
790  }
791  }
792  }
793  else
794  {
795  if (action == "INFO")
797  else
799  }
800  }
801  else if (action == "DELETE" && m_currentPlaylist && GetFocusWidget() == m_currentPlaylist)
802  {
804  if (item)
805  {
806  auto *mdata = item->GetData().value<MusicMetadata*>();
807  if (mdata)
808  gPlayer->removeTrack(mdata->ID());
809  }
810  }
811  else if (action == "MENU")
812  ShowMenu();
813  else if (action == "REFRESH")
814  {
815  if (m_currentPlaylist)
817  }
818  else if (action == "MARK")
819  {
820  if (!m_moveTrackMode)
821  {
822  m_moveTrackMode = true;
823  m_movingTrack = false;
824 
827  }
828  else
829  {
830  m_moveTrackMode = false;
831 
833  {
835  if (item)
836  item->DisplayState("off", "movestate");
837 
838  m_movingTrack = false;
839  }
840 
843  }
844  }
845  else if (action == "SWITCHTOPLAYLIST" && m_currentView != MV_PLAYLIST)
847  else if (action == "SWITCHTOPLAYLISTEDITORTREE" && m_currentView != MV_PLAYLISTEDITORTREE)
849  else if (action == "SWITCHTOPLAYLISTEDITORGALLERY" && m_currentView != MV_PLAYLISTEDITORGALLERY)
851  else if (action == "SWITCHTOSEARCH" && m_currentView != MV_SEARCH)
853  else if (action == "SWITCHTOVISUALISER" && m_currentView != MV_VISUALIZER)
855  else if (action == "SWITCHTORADIO" && m_currentView != MV_RADIO)
857  else if (action == "TOGGLESHUFFLE")
858  {
860  updateShuffleMode(true);
861  }
862  else if (action == "TOGGLEREPEAT")
863  {
866  }
867  else
868  handled = false;
869  }
870 
871  if (!handled && MythScreenType::keyPressEvent(e))
872  handled = true;
873  return handled;
874 }
875 
876 void MusicCommon::changeVolume(bool up) const
877 {
879  {
880  if (up)
881  gPlayer->incVolume();
882  else
883  gPlayer->decVolume();
884  showVolume();
885  }
886 }
887 
889 {
891  {
892  if (up)
893  gPlayer->incSpeed();
894  else
895  gPlayer->decSpeed();
896  showSpeed(true);
897  }
898 }
899 
901 {
902  if (m_controlVolume)
903  {
904  gPlayer->toggleMute();
905  showVolume();
906  }
907 }
908 
910 {
911  if (gPlayer->getOutput())
913 }
914 
916 {
917  if (!m_trackProgress)
918  return;
919 
921  {
922  // radio mode so show the buffer fill level since we don't know the track length
923  int available = 0;
924  int maxSize = 0;
925  gPlayer->getBufferStatus(&available, &maxSize);
926 
927  if (m_infoText)
928  {
929  QString status = QString("%1%").arg((int)(100.0 / ((double)maxSize / (double)available)));
930  m_infoText->SetText(status);
931  }
932 
933  if (m_trackProgress)
934  {
935  m_trackProgress->SetTotal(maxSize);
936  m_trackProgress->SetUsed(available);
937  }
938  }
939  else
940  {
941  // show the track played time
942  int percentplayed = 1;
943  if (m_maxTime)
944  percentplayed = (int)(((double)m_currentTime / (double)m_maxTime) * 100);
946  m_trackProgress->SetUsed(percentplayed);
947  }
948 }
949 
951 {
952  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
953 
954  auto *vol = new MythMusicVolumeDialog(popupStack, "volumepopup");
955 
956  if (!vol->Create())
957  {
958  delete vol;
959  return;
960  }
961 
962  popupStack->AddScreen(vol);
963 }
964 
966 {
967  (void) show;
968 }
969 
970 void MusicCommon::switchVisualizer(const QString &visual)
971 {
972  switchVisualizer(m_visualModes.indexOf(visual));
973 }
974 
976 {
977  if (!m_mainvisual)
978  return;
979 
980  if (visual < 0 || visual > m_visualModes.count() - 1)
981  visual = 0;
982 
983  m_currentVisual = visual;
984 
986 
987  if (m_visualText)
989 }
990 
992 {
993  if (!m_mainvisual)
994  return;
995 
996  // Only change the visualizer if there is more than 1 visualizer
997  // and the user currently has a visualizer active
998  if (m_visualModes.count() > 1)
999  {
1000  if (m_randomVisualizer)
1001  {
1002  unsigned int next_visualizer = 0;
1003 
1004  //Find a visual thats not like the previous visual
1005  do
1006  next_visualizer = random() % m_visualModes.count();
1007  while (next_visualizer == m_currentVisual);
1008  m_currentVisual = next_visualizer;
1009  }
1010  else
1011  {
1012  //Change to the next selected visual
1013  m_currentVisual = (m_currentVisual + 1) % m_visualModes.count();
1014  }
1015 
1016  //Change to the new visualizer
1018  }
1019 }
1020 
1022 {
1024  return;
1025 
1027 }
1028 
1030 {
1032  return;
1033 
1035 }
1036 
1038 {
1039  LCD *lcd = LCD::Get();
1040  if (!lcd || !mdata)
1041  return;
1042 
1043  // Set the Artist and Tract on the LCD
1044  lcd->switchToMusic(mdata->Artist(),
1045  mdata->Album(),
1046  mdata->Title());
1047 }
1048 
1050 {
1051  if (LCD *lcd = LCD::Get())
1052  {
1053  lcd->switchToTime();
1054  }
1055 
1056  stopVisualizer();
1057 
1058  gPlayer->stop(true);
1059 }
1060 
1062 {
1063  gPlayer->play();
1064 }
1065 
1067 {
1068  gPlayer->pause();
1069 }
1070 
1072 {
1073  gPlayer->stop();
1074 
1075  QString time_string = getTimeString(m_maxTime, 0);
1076 
1077  if (m_timeText)
1078  m_timeText->SetText(time_string);
1079  if (m_infoText)
1080  m_infoText->Reset();
1081 }
1082 
1084 {
1085  if (m_cycleVisualizer)
1086  cycleVisualizer();
1087 
1088 
1089  gPlayer->next();
1090 }
1091 
1093 {
1094  if (m_cycleVisualizer)
1095  cycleVisualizer();
1096 
1097  gPlayer->previous();
1098 }
1099 
1101 {
1102  int nextTime = m_currentTime + 5;
1103  if (nextTime > m_maxTime)
1104  nextTime = m_maxTime;
1105  seek(nextTime);
1106 }
1107 
1109 {
1110  int nextTime = m_currentTime - 5;
1111  if (nextTime < 0)
1112  nextTime = 0;
1113  seek(nextTime);
1114 }
1115 
1116 void MusicCommon::seek(int pos)
1117 {
1118  if (gPlayer->getOutput())
1119  {
1120  if (gPlayer->getDecoder() && gPlayer->getDecoder()->isRunning())
1121  {
1122  gPlayer->getDecoder()->lock();
1123  gPlayer->getDecoder()->seek(pos);
1124 
1125  if (m_mainvisual)
1126  {
1127  m_mainvisual->mutex()->lock();
1128  m_mainvisual->prepare();
1129  m_mainvisual->mutex()->unlock();
1130  }
1131 
1132  gPlayer->getDecoder()->unlock();
1133  }
1134 
1135  gPlayer->getOutput()->SetTimecode(pos*1000);
1136 
1137  if (!gPlayer->isPlaying())
1138  {
1139  m_currentTime = pos;
1140  if (m_timeText)
1142 
1144 
1145  if (LCD *lcd = LCD::Get())
1146  {
1147  float percent_heard = m_maxTime <= 0 ? 0.0F : ((float)pos /
1148  (float)m_maxTime);
1149 
1150  QString lcd_time_string = getTimeString(pos, m_maxTime);
1151 
1152  // if the string is longer than the LCD width, remove all spaces
1153  if (lcd_time_string.length() > (int)lcd->getLCDWidth())
1154  lcd_time_string.remove(' ');
1155 
1156  lcd->setMusicProgress(lcd_time_string, percent_heard);
1157  }
1158  }
1159  }
1160 }
1161 
1162 void MusicCommon::changeRating(bool increase)
1163 {
1165  return;
1166 
1167  // Rationale here is that if you can't get visual feedback on ratings
1168  // adjustments, you probably should not be changing them
1169  // TODO: should check if the rating is visible in the playlist buttontlist
1170  //if (!m_ratingState)
1171  // return;
1172 
1174  if (!curMeta)
1175  return;
1176 
1177 
1178  if (increase)
1179  curMeta->incRating();
1180  else
1181  curMeta->decRating();
1182 
1183  gPlayer->sendTrackStatsChangedEvent(curMeta->ID());
1184 }
1185 
1186 void MusicCommon::customEvent(QEvent *event)
1187 {
1188  QString statusString;
1189 
1190  if (event->type() == OutputEvent::Playing)
1191  {
1193  if (curMeta)
1194  updateTrackInfo(curMeta);
1195 
1196  statusString = tr("Playing stream.");
1197  if (gPlayer->isPlaying())
1198  {
1199  if (m_stopButton)
1200  m_stopButton->SetLocked(false);
1201  if (m_playButton)
1202  m_playButton->SetLocked(true);
1203  if (m_pauseButton)
1204  m_pauseButton->SetLocked(false);
1205  if (m_trackState)
1206  m_trackState->DisplayState("playing");
1207 
1208  if (m_currentPlaylist)
1209  {
1211  if (item)
1212  {
1213  item->SetFontState("running");
1214  item->DisplayState("playing", "playstate");
1215  }
1216  }
1217 
1218  startVisualizer();
1219 
1220  updateVolume();
1221  }
1222  }
1223  else if (event->type() == OutputEvent::Buffering)
1224  {
1225  statusString = tr("Buffering stream.");
1226  }
1227  else if (event->type() == OutputEvent::Paused)
1228  {
1229  statusString = tr("Stream paused.");
1230 
1231  if (m_stopButton)
1232  m_stopButton->SetLocked(false);
1233  if (m_playButton)
1234  m_playButton->SetLocked(false);
1235  if (m_pauseButton)
1236  m_pauseButton->SetLocked(true);
1237  if (m_trackState)
1238  m_trackState->DisplayState("paused");
1239 
1240  if (m_currentPlaylist)
1241  {
1243  if (item)
1244  {
1245  item->SetFontState("idle");
1246  item->DisplayState("paused", "playstate");
1247  }
1248  }
1249  }
1250  else if (event->type() == OutputEvent::Info)
1251  {
1252 
1253  auto *oe = dynamic_cast<OutputEvent *>(event);
1254 
1255  if (!oe)
1256  return;
1257 
1258  int rs = 0;
1260 
1262  {
1263  if (curMeta)
1264  m_currentTime = rs = curMeta->Length() / 1000;
1265  else
1266  m_currentTime = 0;
1267  }
1268  else
1269  m_currentTime = rs = oe->elapsedSeconds();
1270 
1271  QString time_string = getTimeString(rs, m_maxTime);
1272 
1274 
1275  if (curMeta)
1276  {
1277  if (LCD *lcd = LCD::Get())
1278  {
1279  float percent_heard = m_maxTime <= 0 ?
1280  0.0F:((float)rs / (float)curMeta->Length()) * 1000.0F;
1281 
1282  QString lcd_time_string = time_string;
1283 
1284  // if the string is longer than the LCD width, remove all spaces
1285  if (time_string.length() > (int)lcd->getLCDWidth())
1286  lcd_time_string.remove(' ');
1287 
1288  lcd->setMusicProgress(lcd_time_string, percent_heard);
1289  }
1290  }
1291 
1292  QString info_string;
1293 
1294  // Hack around for cd bitrates
1295  if (oe->bitrate() < 2000)
1296  {
1297  info_string = QString("%1 "+tr("kbps")+ " %2 "+ tr("kHz")+ " %3 "+ tr("ch"))
1298  .arg(oe->bitrate())
1299  .arg(static_cast<double>(oe->frequency()) / 1000.0,0,'f',1,QChar('0'))
1300  .arg(oe->channels() > 1 ? "2" : "1");
1301  }
1302  else
1303  {
1304  info_string = QString("%1 "+ tr("kHz")+ " %2 "+ tr("ch"))
1305  .arg(static_cast<double>(oe->frequency()) / 1000.0,0,'f',1,QChar('0'))
1306  .arg(oe->channels() > 1 ? "2" : "1");
1307  }
1308 
1309  if (curMeta)
1310  {
1311  if (m_timeText)
1312  m_timeText->SetText(time_string);
1313  if (m_infoText)
1314  m_infoText->SetText(info_string);
1315  }
1316 
1317  // TODO only need to update the playlist times here
1319  }
1320  else if (event->type() == OutputEvent::Stopped)
1321  {
1322  statusString = tr("Stream stopped.");
1323  if (m_stopButton)
1324  m_stopButton->SetLocked(true);
1325  if (m_playButton)
1326  m_playButton->SetLocked(false);
1327  if (m_pauseButton)
1328  m_pauseButton->SetLocked(false);
1329  if (m_trackState)
1330  m_trackState->DisplayState("stopped");
1331 
1332  if (m_currentPlaylist)
1333  {
1335  if (item)
1336  {
1337  item->SetFontState("normal");
1338  item->DisplayState("stopped", "playstate");
1339  }
1340  }
1341 
1342  stopVisualizer();
1343  }
1344  else if (event->type() == DialogCompletionEvent::kEventType)
1345  {
1346  auto *dce = dynamic_cast<DialogCompletionEvent*>(event);
1347 
1348  // make sure the user didn't ESCAPE out of the menu
1349  if ((dce == nullptr) || (dce->GetResult() < 0))
1350  return;
1351 
1352  QString resultid = dce->GetId();
1353  QString resulttext = dce->GetResultText();
1354 
1355  if (resultid == "mainmenu")
1356  {
1357  if (resulttext == tr("Fullscreen Visualizer"))
1359  else if (resulttext == tr("Playlist Editor"))
1360  {
1361  if (gCoreContext->GetSetting("MusicPlaylistEditorView", "tree") == "tree")
1363  else
1365  }
1366  else if (resulttext == tr("Search for Music"))
1368  else if (resulttext == tr("Switch To Gallery View"))
1370  else if (resulttext == tr("Switch To Tree View"))
1372  else if (resulttext == tr("Lyrics"))
1374  }
1375  else if (resultid == "submenu")
1376  {
1377  if (resulttext == tr("Search List..."))
1378  searchButtonList();
1379  }
1380  else if (resultid == "playlistmenu")
1381  {
1382  if (resulttext == tr("Sync List With Current Track"))
1383  {
1385  }
1386  else if (resulttext == tr("Remove Selected Track"))
1387  {
1389  if (item)
1390  {
1391  auto *mdata = item->GetData().value<MusicMetadata*>();
1392  if (mdata)
1393  gPlayer->removeTrack(mdata->ID());
1394  }
1395  }
1396  else if (resulttext == tr("Remove All Tracks"))
1397  {
1398  if (gPlayer->getCurrentPlaylist())
1399  {
1401  gPlayer->activePlaylistChanged(-1, true);
1402  }
1403  }
1404  else if (resulttext == tr("Save To New Playlist"))
1405  {
1406  QString message = tr("Enter new playlist name");
1407 
1408  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
1409 
1410  auto *inputdialog = new MythTextInputDialog(popupStack, message);
1411 
1412  if (inputdialog->Create())
1413  {
1414  inputdialog->SetReturnEvent(this, "addplaylist");
1415  popupStack->AddScreen(inputdialog);
1416  }
1417  else
1418  delete inputdialog;
1419  }
1420  else if (resulttext == tr("Save To Existing Playlist"))
1421  {
1422  QString message = tr("Select the playlist to save to");
1423  QStringList playlists = gMusicData->m_all_playlists->getPlaylistNames();
1424 
1425  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
1426 
1427  auto *searchdialog = new MythUISearchDialog(popupStack, message, playlists);
1428 
1429  if (searchdialog->Create())
1430  {
1431  searchdialog->SetReturnEvent(this, "updateplaylist");
1432  popupStack->AddScreen(searchdialog);
1433  }
1434  }
1435  else if (resulttext == tr("Switch To Move Mode"))
1436  {
1437  m_moveTrackMode = true;
1438  m_movingTrack = false;
1439 
1440  if (m_movingTracksState)
1442  }
1443  else if (resulttext == tr("Switch To Select Mode"))
1444  {
1445  m_moveTrackMode = false;
1446 
1448  {
1450  if (item)
1451  item->DisplayState("off", "movestate");
1452 
1453  m_movingTrack = false;
1454  }
1455 
1456  if (m_movingTracksState)
1458  }
1459  }
1460  else if (resultid == "repeatmenu")
1461  {
1462  int mode = dce->GetData().toInt();
1464  updateRepeatMode();
1465  }
1466  else if (resultid == "shufflemenu")
1467  {
1468  int mode = dce->GetData().toInt();
1470  updateShuffleMode(true);
1471  }
1472  else if (resultid == "exitmenu")
1473  {
1474  if (resulttext == tr("No - Exit, Stop Playing"))
1475  {
1476  gPlayer->savePosition();
1477  stopAll();
1478  Close();
1479  }
1480  else if (resulttext == tr("Yes - Exit, Continue Playing"))
1481  {
1482  Close();
1483  }
1484  }
1485  else if (resultid == "playermenu")
1486  {
1487  if (resulttext == tr("Change Volume"))
1488  showVolume();
1489  else if (resulttext == tr("Mute"))
1490  toggleMute();
1491  else if (resulttext == tr("Previous Track"))
1492  previous();
1493  else if (resulttext == tr("Next Track"))
1494  next();
1495  else if (resulttext == tr("Jump Back"))
1496  seekback();
1497  else if (resulttext == tr("Jump Forward"))
1498  seekforward();
1499  else if (resulttext == tr("Play"))
1500  play();
1501  else if (resulttext == tr("Stop"))
1502  stop();
1503  else if (resulttext == tr("Pause"))
1504  pause();
1505  }
1506  else if (resultid == "quickplaylistmenu")
1507  {
1508  if (resulttext == tr("All Tracks"))
1509  allTracks();
1510  else if (resulttext == tr("From CD"))
1511  fromCD();
1512  else if (resulttext == tr("Tracks By Current Artist"))
1513  byArtist();
1514  else if (resulttext == tr("Tracks From Current Genre"))
1515  byGenre();
1516  else if (resulttext == tr("Tracks From Current Album"))
1517  byAlbum();
1518  else if (resulttext == tr("Tracks From Current Year"))
1519  byYear();
1520  else if (resulttext == tr("Tracks With Same Title"))
1521  byTitle();
1522  }
1523  else if (resultid == "playlistoptionsmenu")
1524  {
1525  if (resulttext == tr("Replace Tracks"))
1526  {
1528  doUpdatePlaylist();
1529  }
1530  else if (resulttext == tr("Add Tracks"))
1531  {
1533  doUpdatePlaylist();
1534  }
1535  }
1536  else if (resultid == "visualizermenu")
1537  {
1538  if (dce->GetResult() >= 0)
1539  {
1540  m_currentVisual = dce->GetData().toInt();
1541 
1542  //Change to the new visualizer
1544  }
1545  }
1546  else if (resultid == "addplaylist")
1547  {
1549  Playlist *playlist = gMusicData->m_all_playlists->getPlaylist(resulttext);
1550  gPlayer->playlistChanged(playlist->getID());
1551  }
1552  else if (resultid == "updateplaylist")
1553  {
1554  if (gPlayer->getCurrentPlaylist())
1555  {
1556  Playlist *playlist = gMusicData->m_all_playlists->getPlaylist(resulttext);
1557  QString songList = gPlayer->getCurrentPlaylist()->toRawSonglist();
1558  playlist->removeAllTracks();
1559  playlist->fillSongsFromSonglist(songList);
1560  playlist->changed();
1561  gPlayer->playlistChanged(playlist->getID());
1562  }
1563  }
1564  }
1565  else if (event->type() == MusicPlayerEvent::TrackChangeEvent)
1566  {
1567  auto *mpe = dynamic_cast<MusicPlayerEvent *>(event);
1568 
1569  if (!mpe)
1570  return;
1571 
1572  int trackNo = mpe->m_trackID;
1573 
1574  if (m_currentPlaylist)
1575  {
1576  if (m_currentTrack >= 0 && m_currentTrack < m_currentPlaylist->GetCount())
1577  {
1579  if (item)
1580  {
1581  item->SetFontState("normal");
1582  item->DisplayState("default", "playstate");
1583  }
1584  }
1585 
1586  if (trackNo >= 0 && trackNo < m_currentPlaylist->GetCount())
1587  {
1590 
1592  if (item)
1593  {
1594  item->SetFontState("running");
1595  item->DisplayState("playing", "playstate");
1596  }
1597  }
1598  }
1599 
1600  m_currentTrack = trackNo;
1601 
1602  if (gPlayer->getCurrentPlaylist())
1605  if (m_playlistProgress)
1606  {
1609  }
1610 
1613  }
1614  else if (event->type() == MusicPlayerEvent::VolumeChangeEvent)
1615  {
1616  updateVolume();
1617  }
1618  else if (event->type() == MusicPlayerEvent::TrackRemovedEvent)
1619  {
1620  auto *mpe = dynamic_cast<MusicPlayerEvent *>(event);
1621 
1622  if (!mpe)
1623  return;
1624 
1625  int trackID = mpe->m_trackID;
1626 
1627  if (m_currentPlaylist)
1628  {
1629  // find and remove the list item for the removed track
1630  for (int x = 0; x < m_currentPlaylist->GetCount(); x++)
1631  {
1633  auto *mdata = item->GetData().value<MusicMetadata*>();
1634  if (mdata && mdata->ID() == (MusicMetadata::IdType) trackID)
1635  {
1637  break;
1638  }
1639  }
1640  }
1641 
1643 
1644  // if we have just removed the playing track from the playlist
1645  // move to the next track
1646  if (gPlayer->getCurrentMetadata())
1647  {
1648  if (gPlayer->getCurrentMetadata()->ID() == (MusicMetadata::IdType) trackID)
1649  gPlayer->next();
1650  }
1651 
1652  if (gPlayer->getCurrentPlaylist())
1657 
1660  }
1661  else if (event->type() == MusicPlayerEvent::TrackAddedEvent)
1662  {
1663  auto *mpe = dynamic_cast<MusicPlayerEvent *>(event);
1664 
1665  if (!mpe)
1666  return;
1667 
1668  int trackID = mpe->m_trackID;
1669 
1670  if (m_currentPlaylist)
1671  {
1672  if (trackID == -1)
1673  {
1674  // more than one track has been added so easier to just reload the list
1675  updateUIPlaylist();
1676  }
1677  else
1678  {
1679  // just one track was added so just add that track to the end of the list
1680  MusicMetadata *mdata = gMusicData->m_all_music->getMetadata(trackID);
1681 
1682  if (mdata)
1683  {
1684  InfoMap metadataMap;
1685  mdata->toMap(metadataMap);
1686 
1687  auto *item = new MythUIButtonListItem(m_currentPlaylist, "",
1688  QVariant::fromValue(mdata));
1689 
1690  item->SetTextFromMap(metadataMap);
1691 
1693  mdata->ID() == gPlayer->getCurrentMetadata()->ID())
1694  {
1695  item->SetFontState("running");
1696  item->DisplayState("playing", "playstate");
1697  }
1698  else
1699  {
1700  item->SetFontState("normal");
1701  item->DisplayState("default", "playstate");
1702  }
1703 
1704  if (!gPlayer->getCurrentMetadata())
1706  }
1707 
1710  }
1711  }
1712 
1713  if (gPlayer->getCurrentPlaylist())
1716 
1719  }
1720  else if (event->type() == MusicPlayerEvent::AllTracksRemovedEvent)
1721  {
1722  updateUIPlaylist();
1724  updateTrackInfo(nullptr);
1725  }
1726  else if (event->type() == MusicPlayerEvent::MetadataChangedEvent ||
1728  {
1729  auto *mpe = dynamic_cast<MusicPlayerEvent *>(event);
1730 
1731  if (!mpe)
1732  return;
1733 
1734  uint trackID = mpe->m_trackID;
1735 
1736  if (m_currentPlaylist)
1737  {
1738  for (int x = 0; x < m_currentPlaylist->GetCount(); x++)
1739  {
1741  auto *mdata = item->GetData().value<MusicMetadata*>();
1742 
1743  if (mdata && mdata->ID() == trackID)
1744  {
1745  InfoMap metadataMap;
1746  mdata->toMap(metadataMap);
1747  item->SetTextFromMap(metadataMap);
1748 
1749  item->DisplayState(QString("%1").arg(mdata->Rating()), "ratingstate");
1750  }
1751  }
1752  }
1753 
1754  if (m_playedTracksList)
1755  {
1756  for (int x = 0; x < m_playedTracksList->GetCount(); x++)
1757  {
1759  auto *mdata = item->GetData().value<MusicMetadata*>();
1760 
1761  if (mdata && mdata->ID() == trackID)
1762  {
1763  InfoMap metadataMap;
1764  mdata->toMap(metadataMap);
1765  item->SetTextFromMap(metadataMap);
1766  }
1767  }
1768  }
1769 
1770  if (gPlayer->getCurrentMetadata() && trackID == gPlayer->getCurrentMetadata()->ID())
1772 
1773  // this will ensure the next track info gets updated
1774  if (gPlayer->getNextMetadata() && trackID == gPlayer->getNextMetadata()->ID())
1776  }
1777  else if (event->type() == MusicPlayerEvent::AlbumArtChangedEvent)
1778  {
1779  auto *mpe = dynamic_cast<MusicPlayerEvent *>(event);
1780 
1781  if (!mpe)
1782  return;
1783 
1784  uint trackID = mpe->m_trackID;
1785 
1786  if (m_currentPlaylist)
1787  {
1788  for (int x = 0; x < m_currentPlaylist->GetCount(); x++)
1789  {
1791  auto *mdata = item->GetData().value<MusicMetadata*>();
1792  if (mdata && mdata->ID() == trackID)
1793  {
1794  // reload the albumart image if one has already been loaded for this track
1795  if (!item->GetImageFilename().isEmpty())
1796  {
1797  QString artFile = mdata->getAlbumArtFile();
1798  if (artFile.isEmpty())
1799  {
1800  item->SetImage("");
1801  item->SetImage("", "coverart");
1802  }
1803  else
1804  {
1805  item->SetImage(mdata->getAlbumArtFile());
1806  item->SetImage(mdata->getAlbumArtFile(), "coverart");
1807  }
1808  }
1809  }
1810  }
1811  }
1812 
1813  if (gPlayer->getCurrentMetadata() && trackID == gPlayer->getCurrentMetadata()->ID())
1815  }
1816  else if (event->type() == MusicPlayerEvent::TrackUnavailableEvent)
1817  {
1818  auto *mpe = dynamic_cast<MusicPlayerEvent *>(event);
1819 
1820  if (!mpe)
1821  return;
1822 
1823  uint trackID = mpe->m_trackID;
1824 
1825  if (m_currentPlaylist)
1826  {
1827  for (int x = 0; x < m_currentPlaylist->GetCount(); x++)
1828  {
1830  auto *mdata = item->GetData().value<MusicMetadata*>();
1831  if (mdata && mdata->ID() == trackID)
1832  {
1833  item->SetFontState("disabled");
1834  item->DisplayState("unavailable", "playstate");
1835  }
1836  }
1837  }
1838  }
1839 }
1840 
1842 {
1843  if (!m_controlVolume)
1844  {
1845  if (m_volumeText)
1846  m_volumeText->Hide();
1847 
1848  if (m_muteState)
1849  m_muteState->Hide();
1850 
1851  return;
1852  }
1853 
1854  if (m_volumeText)
1855  {
1856  InfoMap map;
1857  gPlayer->toMap(map);
1859  }
1860 
1861  if (m_muteState)
1862  {
1863  bool muted = gPlayer->isMuted();
1864  m_muteState->DisplayState(muted ? "on" : "off");
1865  }
1866 }
1867 
1869 {
1870  if (!mdata)
1871  return;
1872 
1874 
1875  auto *editDialog = new EditMetadataDialog(mainStack, mdata);
1876 
1877  if (!editDialog->Create())
1878  {
1879  delete editDialog;
1880  return;
1881  }
1882 
1883  mainStack->AddScreen(editDialog);
1884 }
1885 
1887 {
1888  if (!mdata)
1889  {
1890  InfoMap metadataMap;
1891  MusicMetadata metadata;
1892  metadata.toMap(metadataMap);
1893  metadata.toMap(metadataMap, "next");
1894  ResetMap(metadataMap);
1895 
1896  if (m_coverartImage)
1898  if (m_ratingState)
1900  if (m_timeText)
1901  m_timeText->Reset();
1902  if (m_infoText)
1903  m_infoText->Reset();
1904  if (m_trackProgress)
1906 
1907  if (m_mainvisual)
1909 
1910  return;
1911  }
1912 
1914  m_maxTime = 0;
1915  else
1916  m_maxTime = mdata->Length() / 1000;
1917 
1918  // get map for current track
1919  InfoMap metadataMap;
1920  mdata->toMap(metadataMap);
1921 
1922  // add the map from the next track
1923  MusicMetadata *nextMetadata = gPlayer->getNextMetadata();
1924  if (nextMetadata)
1925  nextMetadata->toMap(metadataMap, "next");
1926 
1927  // now set text using the map
1928  SetTextFromMap(metadataMap);
1929 
1930  if (m_coverartImage)
1931  {
1932  QString filename = mdata->getAlbumArtFile();
1933  if (!filename.isEmpty())
1934  {
1936  m_coverartImage->Load();
1937  }
1938  else
1940  }
1941 
1942  if (m_ratingState)
1943  m_ratingState->DisplayState(QString("%1").arg(mdata->Rating()));
1944 
1945  setTrackOnLCD(mdata);
1946 }
1947 
1949 {
1950  if (!mdata)
1951  return;
1952 
1953  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
1954 
1955  auto *dlg = new TrackInfoDialog(popupStack, mdata, "trackinfopopup");
1956 
1957  if (!dlg->Create())
1958  {
1959  delete dlg;
1960  return;
1961  }
1962 
1963  popupStack->AddScreen(dlg);
1964 }
1965 
1967 {
1968  if (!item)
1969  return;
1970 
1971  if (m_moveTrackMode)
1972  {
1974 
1975  if (m_movingTrack)
1976  item->DisplayState("on", "movestate");
1977  else
1978  item->DisplayState("off", "movestate");
1979  }
1980  else
1982 
1983  if (m_cycleVisualizer)
1984  cycleVisualizer();
1985 }
1986 
1988 {
1989  if (!item)
1990  return;
1991 
1992  auto *mdata = item->GetData().value<MusicMetadata*>();
1993  if (mdata && item->GetText() == " ")
1994  {
1995  if (item->GetImageFilename().isEmpty())
1996  {
1997  QString artFile = mdata->getAlbumArtFile();
1998  if (artFile.isEmpty())
1999  {
2000  item->SetImage("");
2001  item->SetImage("", "coverart");
2002  }
2003  else
2004  {
2005  item->SetImage(mdata->getAlbumArtFile());
2006  item->SetImage(mdata->getAlbumArtFile(), "coverart");
2007  }
2008  }
2009 
2010  InfoMap metadataMap;
2011  mdata->toMap(metadataMap);
2012  item->SetText("");
2013  item->SetTextFromMap(metadataMap);
2014  item->DisplayState(QString("%1").arg(mdata->Rating()), "ratingstate");
2015  }
2016 }
2017 
2019 {
2022 
2023  if (!m_currentPlaylist)
2024  return;
2025 
2027 
2028  m_currentTrack = -1;
2029 
2030  Playlist *playlist = gPlayer->getCurrentPlaylist();
2031 
2032  if (!playlist)
2033  return;
2034 
2035  for (int x = 0; x < playlist->getTrackCount(); x++)
2036  {
2037  MusicMetadata *mdata = playlist->getSongAt(x);
2038  if (mdata)
2039  {
2040  auto *item = new MythUIButtonListItem(m_currentPlaylist, " ",
2041  QVariant::fromValue(mdata));
2042 
2043  item->SetText(mdata->Artist() + mdata->Album() + mdata->Title(), "**search**");
2044  item->SetFontState("normal");
2045  item->DisplayState("default", "playstate");
2046 
2047  // if this is the current track update its play state to match the player
2048  if (gPlayer->getCurrentMetadata() && mdata->ID() == gPlayer->getCurrentMetadata()->ID())
2049  {
2050  if (gPlayer->isPlaying())
2051  {
2052  item->SetFontState("running");
2053  item->DisplayState("playing", "playstate");
2054  }
2055  else if (gPlayer->isPaused())
2056  {
2057  item->SetFontState("idle");
2058  item->DisplayState("paused", "playstate");
2059  }
2060  else
2061  {
2062  item->SetFontState("normal");
2063  item->DisplayState("stopped", "playstate");
2064  }
2065 
2068  }
2069  }
2070  }
2071 }
2072 
2074 {
2075  if (!m_playedTracksList)
2076  return;
2077 
2079 
2080  QList<MusicMetadata*> playedList = gPlayer->getPlayedTracksList();
2081 
2082  for (int x = playedList.count(); x > 0; x--)
2083  {
2084  MusicMetadata *mdata = playedList[x-1];
2085  auto *item = new MythUIButtonListItem(m_playedTracksList, "",
2086  QVariant::fromValue(mdata));
2087 
2088  InfoMap metadataMap;
2089  mdata->toMap(metadataMap);
2090  item->SetTextFromMap(metadataMap);
2091 
2092  item->SetFontState("normal");
2093  item->DisplayState("default", "playstate");
2094 
2095  item->SetImage(mdata->getAlbumArtFile());
2096  }
2097 }
2098 
2100 {
2101  int trackCount = 0;
2102 
2103  if (gPlayer->getCurrentPlaylist())
2104  trackCount = gPlayer->getCurrentPlaylist()->getTrackCount();
2105 
2106  InfoMap map;
2107  if (gPlayer->isPlaying() && trackCount > 0)
2108  {
2109  QString playlistcurrent = QLocale::system().toString(m_currentTrack + 1);
2110  QString playlisttotal = QLocale::system().toString(trackCount);
2111 
2112  map["playlistposition"] = tr("%1 of %2").arg(playlistcurrent)
2113  .arg(playlisttotal);
2114  map["playlistcurrent"] = playlistcurrent;
2115  map["playlistcount"] = playlisttotal;
2117  map["playlistplayedtime"] = getTimeString(m_playlistPlayedTime + m_currentTime, 0);
2118  map["playlisttotaltime"] = getTimeString(m_playlistMaxTime, 0);
2119  QString playlistName = gPlayer->getCurrentPlaylist() ? gPlayer->getCurrentPlaylist()->getName() : "";
2120  if (playlistName == "default_playlist_storage")
2121  playlistName = tr("Default Playlist");
2122  else if (playlistName == "stream_playlist")
2123  playlistName = tr("Stream Playlist");
2124  map["playlistname"] = playlistName;
2125  }
2126  else
2127  {
2128  map["playlistposition"] = "";
2129  map["playlistcurrent"] = "";
2130  map["playlistcount"] = "";
2131  map["playlisttime"] = "";
2132  map["playlistplayedtime"] = "";
2133  map["playlisttotaltime"] = "";
2134  map["playlistname"] = "";
2135  }
2136 
2137  SetTextFromMap(map);
2138 
2139  if (m_playlistProgress)
2141 }
2142 
2143 QString MusicCommon::getTimeString(int exTime, int maxTime)
2144 {
2145  if (maxTime <= 0)
2146  return MythFormatTime(exTime,
2147  (exTime >= ONEHOURINSEC) ? "H:mm:ss" : "mm:ss");
2148 
2149  QString fmt = (maxTime >= ONEHOURINSEC) ? "H:mm:ss" : "mm:ss";
2150  return MythFormatTime(exTime, fmt) + " / " + MythFormatTime(maxTime, fmt);
2151 }
2152 
2154 {
2155  auto *buttonList = dynamic_cast<MythUIButtonList *>(GetFocusWidget());
2156  if (buttonList)
2157  buttonList->ShowSearchDialog();
2158 
2159  auto *buttonTree = dynamic_cast<MythUIButtonTree *>(GetFocusWidget());
2160  if (buttonTree)
2161  buttonTree->ShowSearchDialog();
2162 }
2163 
2165 {
2166  MythMenu *mainMenu = createMainMenu();
2167 
2168  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
2169 
2170  auto *menuPopup = new MythDialogBox(mainMenu, popupStack, "actionmenu");
2171 
2172  if (menuPopup->Create())
2173  popupStack->AddScreen(menuPopup);
2174  else
2175  delete mainMenu;
2176 }
2177 
2179 {
2180  QString label = tr("View Actions");
2181 
2182  auto *menu = new MythMenu(label, this, "mainmenu");
2183 
2185  menu->AddItem(tr("Switch To Gallery View"));
2187  menu->AddItem(tr("Switch To Tree View"));
2188  else if (m_currentView == MV_PLAYLIST)
2189  menu->AddItem(MusicCommon::tr("Playlist Editor"));
2190 
2191  QStringList screenList;
2192  MythScreenType *screen = this;
2193  while (screen)
2194  {
2195  screenList.append(screen->objectName());
2196  screen = dynamic_cast<MusicCommon*>(screen)->m_parentScreen;
2197  }
2198 
2199  if (!screenList.contains("searchview") && !screenList.contains("streamview"))
2200  menu->AddItem(tr("Search for Music"));
2201 
2202  if (!screenList.contains("visualizerview"))
2203  menu->AddItem(tr("Fullscreen Visualizer"));
2204 
2205  if (!screenList.contains("lyricsview"))
2206  menu->AddItem(tr("Lyrics"));
2207 
2208  menu->AddItem(tr("More Options"), nullptr, createSubMenu());
2209 
2210  return menu;
2211 }
2212 
2214 {
2215  QString label = tr("Actions");
2216 
2217  auto *menu = new MythMenu(label, this, "submenu");
2218 
2219  if (GetFocusWidget() && (GetFocusWidget()->inherits("MythUIButtonList") ||
2220  GetFocusWidget()->inherits("MythUIButtonTree")))
2221  menu->AddItem(tr("Search List..."));
2222 
2224  {
2225  menu->AddItem(tr("Playlist Options"), nullptr, createPlaylistMenu());
2226  menu->AddItem(tr("Set Shuffle Mode"), nullptr, createShuffleMenu());
2227  menu->AddItem(tr("Set Repeat Mode"), nullptr, createRepeatMenu());
2228  }
2229 
2230  menu->AddItem(tr("Player Options"), nullptr, createPlayerMenu());
2231 
2233  menu->AddItem(tr("Quick Playlists"), nullptr, createQuickPlaylistsMenu());
2234 
2235  if (m_visualizerVideo)
2236  menu->AddItem(tr("Change Visualizer"), nullptr, createVisualizerMenu());
2237 
2238  return menu;
2239 }
2240 
2242 {
2243  QString label = tr("Playlist Options");
2244 
2245  auto *menu = new MythMenu(label, this, "playlistmenu");
2246 
2247  if (m_currentPlaylist)
2248  {
2249  menu->AddItem(tr("Sync List With Current Track"));
2250  menu->AddItem(tr("Remove Selected Track"));
2251  }
2252 
2253  menu->AddItem(tr("Remove All Tracks"));
2254 
2255  if (m_currentPlaylist)
2256  {
2257  menu->AddItem(tr("Save To New Playlist"));
2258  menu->AddItem(tr("Save To Existing Playlist"));
2259 
2260  if (m_moveTrackMode)
2261  menu->AddItem(tr("Switch To Select Mode"));
2262  else
2263  menu->AddItem(tr("Switch To Move Mode"));
2264  }
2265 
2266  return menu;
2267 }
2268 
2270 {
2271  QString label = tr("Exiting Music Player.\n\n"
2272  "Do you want to continue playing in the background?");
2273 
2274  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
2275 
2276  auto *menu = new MythDialogBox(label, popupStack, "exitmenu");
2277 
2278  if (!menu->Create())
2279  {
2280  delete menu;
2281  return;
2282  }
2283 
2284  menu->SetReturnEvent(this, "exitmenu");
2285 
2286  menu->AddButton(tr("No - Exit, Stop Playing"));
2287  menu->AddButton(tr("Yes - Exit, Continue Playing"));
2288  menu->AddButton(tr("Cancel"));
2289 
2290  popupStack->AddScreen(menu);
2291 }
2292 
2294 {
2295  QString label = tr("Player Actions");
2296 
2297  auto *menu = new MythMenu(label, this, "playermenu");
2298 
2299  menu->AddItem(tr("Change Volume"));
2300  menu->AddItem(tr("Mute"));
2301  menu->AddItem(tr("Previous Track"));
2302  menu->AddItem(tr("Next Track"));
2303 
2305  {
2306  menu->AddItem(tr("Jump Back"));
2307  menu->AddItem(tr("Jump Forward"));
2308  }
2309 
2310  menu->AddItem(tr("Play"));
2311  menu->AddItem(tr("Stop"));
2312 
2314  menu->AddItem(tr("Pause"));
2315 
2316  return menu;
2317 }
2318 
2320 {
2321  QString label = tr("Set Repeat Mode");
2322 
2323  auto *menu = new MythMenu(label, this, "repeatmenu");
2324 
2325  menu->AddItem(tr("None"), QVariant::fromValue((int)MusicPlayer::REPEAT_OFF));
2326  menu->AddItem(tr("Track"), QVariant::fromValue((int)MusicPlayer::REPEAT_TRACK));
2327  menu->AddItem(tr("All"), QVariant::fromValue((int)MusicPlayer::REPEAT_ALL));
2328 
2329  menu->SetSelectedByData(static_cast<int>(gPlayer->getRepeatMode()));
2330 
2331  return menu;
2332 }
2333 
2335 {
2336  QString label = tr("Set Shuffle Mode");
2337 
2338  auto *menu = new MythMenu(label, this, "shufflemenu");
2339 
2340  menu->AddItem(tr("None"), QVariant::fromValue((int)MusicPlayer::SHUFFLE_OFF));
2341  menu->AddItem(tr("Random"), QVariant::fromValue((int)MusicPlayer::SHUFFLE_RANDOM));
2342  menu->AddItem(tr("Smart"), QVariant::fromValue((int)MusicPlayer::SHUFFLE_INTELLIGENT));
2343  menu->AddItem(tr("Album"), QVariant::fromValue((int)MusicPlayer::SHUFFLE_ALBUM));
2344  menu->AddItem(tr("Artist"), QVariant::fromValue((int)MusicPlayer::SHUFFLE_ARTIST));
2345 
2346  menu->SetSelectedByData(static_cast<int>(gPlayer->getShuffleMode()));
2347 
2348  return menu;
2349 }
2350 
2352 {
2353  QString label = tr("Quick Playlists");
2354 
2355  auto *menu = new MythMenu(label, this, "quickplaylistmenu");
2356 
2357  menu->AddItem(tr("All Tracks"));
2358 
2360  menu->AddItem(tr("From CD"));
2361 
2362  if (gPlayer->getCurrentMetadata())
2363  {
2364  menu->AddItem(tr("Tracks By Current Artist"));
2365  menu->AddItem(tr("Tracks From Current Album"));
2366  menu->AddItem(tr("Tracks From Current Genre"));
2367  menu->AddItem(tr("Tracks From Current Year"));
2368  menu->AddItem(tr("Tracks With Same Title"));
2369  }
2370 
2371  return menu;
2372 }
2373 
2375 {
2376  QString label = tr("Choose Visualizer");
2377 
2378  auto *menu = new MythMenu(label, this, "visualizermenu");
2379 
2380  for (uint x = 0; x < static_cast<uint>(m_visualModes.count()); x++)
2381  menu->AddItem(m_visualModes.at(x), QVariant::fromValue(x));
2382 
2383  menu->SetSelectedByData(m_currentVisual);
2384 
2385  return menu;
2386 }
2387 
2389 {
2390  QString label = tr("Add to Playlist Options");
2391 
2392  auto *menu = new MythMenu(label, this, "playlistoptionsmenu");
2393 
2394  menu->AddItem(tr("Replace Tracks"));
2395  menu->AddItem(tr("Add Tracks"));
2396 
2397  return menu;
2398 }
2399 
2401 {
2402  m_whereClause = "ORDER BY music_artists.artist_name, album_name, disc_number, track";
2404 }
2405 
2407 {
2408  m_whereClause = "";
2409  m_songList.clear();
2410 
2411  // get the list of cd tracks
2412  for (int x = 1; x <= gMusicData->m_all_music->getCDTrackCount(); x++)
2413  {
2415  if (mdata)
2416  {
2417  m_songList.append((mdata)->ID());
2418  }
2419  }
2420 
2422 }
2423 
2425 {
2427  if (!mdata)
2428  return;
2429 
2430  QString value = formattedFieldValue(mdata->Artist().toUtf8().constData());
2431  m_whereClause = "WHERE music_artists.artist_name = " + value +
2432  " ORDER BY album_name, disc_number, track";
2433 
2435 }
2436 
2438 {
2440  if (!mdata)
2441  return;
2442 
2443  QString value = formattedFieldValue(mdata->Album().toUtf8().constData());
2444  m_whereClause = "WHERE album_name = " + value +
2445  " ORDER BY disc_number, track";
2446 
2448 }
2449 
2451 {
2453  if (!mdata)
2454  return;
2455 
2456  QString value = formattedFieldValue(mdata->Genre().toUtf8().constData());
2457  m_whereClause = "WHERE genre = " + value +
2458  " ORDER BY music_artists.artist_name, album_name, disc_number, track";
2459 
2461 }
2462 
2464 {
2466  if (!mdata)
2467  return;
2468 
2469  QString value = formattedFieldValue(mdata->Year());
2470  m_whereClause = "WHERE music_songs.year = " + value +
2471  " ORDER BY music_artists.artist_name, album_name, disc_number, track";
2472 
2474 }
2475 
2477 {
2479  if (!mdata)
2480  return;
2481 
2482  QString value = formattedFieldValue(mdata->Title().toUtf8().constData());
2483  m_whereClause = "WHERE music_songs.name = " + value +
2484  " ORDER BY music_artists.artist_name, album_name, disc_number, track";
2485 
2487 }
2488 
2490 {
2491  if (!gPlayer->getCurrentPlaylist())
2492  return;
2493 
2495 
2496  // Don't bother showing the dialog if the current playlist is empty
2497  if (gPlayer->getCurrentPlaylist()->getTrackCount() == 0)
2498  {
2500  doUpdatePlaylist();
2501  return;
2502  }
2503 
2505 
2506  if (addMainMenu)
2507  menu->AddItem(tr("More Options"), nullptr, createMainMenu());
2508 
2509  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
2510 
2511  auto *menuPopup = new MythDialogBox(menu, popupStack, "playlistoptionsmenu");
2512 
2513  if (menuPopup->Create())
2514  popupStack->AddScreen(menuPopup);
2515  else
2516  delete menu;
2517 }
2518 
2520 {
2521  int curTrackID = -1;
2522  int trackCount = 0;
2523  int curPos = gPlayer->getCurrentTrackPos();
2524 
2525  if (gPlayer->getCurrentPlaylist())
2526  trackCount = gPlayer->getCurrentPlaylist()->getTrackCount();
2527 
2528  // store id of current track
2529  if (gPlayer->getCurrentMetadata())
2530  curTrackID = gPlayer->getCurrentMetadata()->ID();
2531 
2532  if (!m_whereClause.isEmpty())
2533  {
2534  // update playlist from quick playlist
2536  m_whereClause, true,
2537  m_playlistOptions.insertPLOption, curTrackID);
2538  m_whereClause.clear();
2539  }
2540  else if (!m_songList.isEmpty())
2541  {
2542  // update playlist from song list (from the playlist editor)
2544  m_songList, true,
2545  m_playlistOptions.insertPLOption, curTrackID);
2546 
2547  m_songList.clear();
2548  }
2549 
2551 
2552  updateUIPlaylist();
2553 
2554  if (m_currentTrack == -1)
2555  playFirstTrack();
2556  else
2557  {
2559  {
2560  case PL_CURRENT:
2561  {
2562  if (!restorePosition(curTrackID))
2563  playFirstTrack();
2564 
2565  break;
2566  }
2567 
2568  case PL_FIRST:
2569  playFirstTrack();
2570  break;
2571 
2572  case PL_FIRSTNEW:
2573  {
2575  {
2576  case PL_REPLACE:
2577  playFirstTrack();
2578  break;
2579 
2580  case PL_INSERTATEND:
2581  {
2582  pause();
2583  if (!gPlayer->setCurrentTrackPos(trackCount))
2584  playFirstTrack();
2585  break;
2586  }
2587 
2588  case PL_INSERTAFTERCURRENT:
2589  if (!gPlayer->setCurrentTrackPos(curPos + 1))
2590  playFirstTrack();
2591  break;
2592 
2593  default:
2594  playFirstTrack();
2595  }
2596 
2597  break;
2598  }
2599  }
2600  }
2601 
2602  if (gPlayer->getCurrentPlaylist())
2607 }
2608 
2610 {
2611  // try to move to the current track
2612  bool foundTrack = false;
2613 
2614  if (trackID != -1 && gPlayer->getCurrentPlaylist())
2615  {
2616  for (int x = 0; x < gPlayer->getCurrentPlaylist()->getTrackCount(); x++)
2617  {
2619  if (mdata && mdata->ID() == (MusicMetadata::IdType) trackID)
2620  {
2621  m_currentTrack = x;
2622  if (m_currentPlaylist)
2623  {
2626  if (item)
2627  {
2628  item->SetFontState("running");
2629  item->DisplayState("playing", "playstate");
2630  }
2631  }
2632 
2633  foundTrack = true;
2634 
2635  break;
2636  }
2637  }
2638  }
2639 
2640  return foundTrack;
2641 }
2642 
2644 {
2646 }
2647 
2648 //---------------------------------------------------------
2649 // MythMusicVolumeDialog
2650 //---------------------------------------------------------
2651 #define MUSICVOLUMEPOPUPTIME (4 * 1000)
2652 
2654 {
2655  if (m_displayTimer)
2656  {
2657  m_displayTimer->stop();
2658  delete m_displayTimer;
2659  m_displayTimer = nullptr;
2660  }
2661 }
2662 
2664 {
2665  if (!LoadWindowFromXML("music-ui.xml", "volume_popup", this))
2666  return false;
2667 
2668  UIUtilW::Assign(this, m_volText, "volume");
2669  UIUtilW::Assign(this, m_volProgress, "volumeprogress");
2670  UIUtilW::Assign(this, m_muteState, "mutestate");
2671 
2672  if (m_volProgress)
2673  m_volProgress->SetTotal(100);
2674 
2675  updateDisplay();
2676 
2677  m_displayTimer = new QTimer(this);
2678  connect(m_displayTimer, SIGNAL(timeout()), this, SLOT(Close()));
2679  m_displayTimer->setSingleShot(true);
2681 
2682  return true;
2683 }
2684 
2686 {
2687  QStringList actions;
2688  bool handled = GetMythMainWindow()->TranslateKeyPress("Music", event, actions, false);
2689 
2690  for (int i = 0; i < actions.size() && !handled; i++)
2691  {
2692  QString action = actions[i];
2693  handled = true;
2694 
2695  if (action == "UP" || action == "VOLUMEUP")
2696  increaseVolume();
2697  else if (action == "DOWN" || action == "VOLUMEDOWN")
2698  decreaseVolume();
2699  else if (action == "MUTE" || action == "SELECT")
2700  toggleMute();
2701  else
2702  handled = false;
2703  }
2704 
2705  if (!handled && MythScreenType::keyPressEvent(event))
2706  handled = true;
2707 
2708  // Restart the display timer only if we handled this keypress, if nothing
2709  // has changed there's no need to keep the volume on-screen
2710  if (handled)
2712 
2713  return handled;
2714 }
2715 
2717 {
2718  gPlayer->incVolume();
2719  updateDisplay();
2720 }
2721 
2723 {
2724  gPlayer->decVolume();
2725  updateDisplay();
2726 }
2727 
2729 {
2730  gPlayer->toggleMute();
2731  updateDisplay();
2732 }
2733 
2735 {
2736  if (m_muteState)
2737  m_muteState->DisplayState(gPlayer->isMuted() ? "on" : "off");
2738 
2739  if (m_volProgress)
2741 
2742  if (m_volText)
2743  {
2744  InfoMap map;
2745  gPlayer->toMap(map);
2746  m_volText->SetTextFromMap(map);
2747  }
2748 }
2749 
2750 //---------------------------------------------------------
2751 // TrackInfoDialog
2752 //---------------------------------------------------------
2754 {
2755  if (!LoadWindowFromXML("music-ui.xml", "trackdetail_popup", this))
2756  return false;
2757 
2758  InfoMap metadataMap;
2759  m_metadata->toMap(metadataMap);
2760  SetTextFromMap(metadataMap);
2761 
2762  MythUIStateType *ratingState = dynamic_cast<MythUIStateType *>(GetChild("rating_state"));
2763  if (ratingState)
2764  ratingState->DisplayState(QString("%1").arg(m_metadata->Rating()));
2765 
2766  MythUIImage *albumImage = dynamic_cast<MythUIImage *>(GetChild("coverart"));
2767  if (albumImage)
2768  {
2769  if (!m_metadata->getAlbumArtFile().isEmpty())
2770  {
2771  albumImage->SetFilename(m_metadata->getAlbumArtFile());
2772  albumImage->Load();
2773  }
2774  }
2775 
2776  // hide the song ID by default
2777  MythUIText *songID = dynamic_cast<MythUIText *>(GetChild("songid"));
2778  if (songID)
2779  songID->Hide();
2780 
2781  return true;
2782 }
2783 
2784 bool TrackInfoDialog::keyPressEvent(QKeyEvent *event)
2785 {
2786  QStringList actions;
2787  bool handled = GetMythMainWindow()->TranslateKeyPress("Music", event, actions, false);
2788 
2789  for (int i = 0; i < actions.size() && !handled; i++)
2790  {
2791  QString action = actions[i];
2792  handled = true;
2793 
2794  if (action == "INFO")
2795  Close();
2796  if (action == "0")
2797  {
2798  // if it's available show the song ID
2799  MythUIText *songID = dynamic_cast<MythUIText *>(GetChild("songid"));
2800  if (songID)
2801  songID->Show();
2802  }
2803  else
2804  handled = false;
2805  }
2806 
2807  if (!handled && MythScreenType::keyPressEvent(event))
2808  handled = true;
2809 
2810  return handled;
2811 }
LCD::MUSIC_SHUFFLE_ALBUM
@ MUSIC_SHUFFLE_ALBUM
Definition: lcddevice.h:194
MusicPlayer::addVisual
void addVisual(MainVisual *visual)
Definition: musicplayer.cpp:175
FUNC_MUSIC
@ FUNC_MUSIC
Definition: lcddevice.h:160
MythMusicVolumeDialog::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: musiccommon.cpp:2685
MusicCommon::m_currentView
MusicView m_currentView
Definition: musiccommon.h:139
MusicCommon::stopAll
void stopAll(void)
Definition: musiccommon.cpp:1049
MusicPlayer::PLAYMODE_TRACKSEDITOR
@ PLAYMODE_TRACKSEDITOR
Definition: musicplayer.h:65
MythUIButtonList::GetItemAt
MythUIButtonListItem * GetItemAt(int pos) const
Definition: mythuibuttonlist.cpp:1676
MusicPlayer::toggleMute
void toggleMute(void)
Definition: musicplayer.cpp:1396
MusicCommon::m_movingTracksState
MythUIStateType * m_movingTracksState
Definition: musiccommon.h:179
mythuibuttontree.h
MusicPlayer::SHUFFLE_INTELLIGENT
@ SHUFFLE_INTELLIGENT
Definition: musicplayer.h:166
MusicPlayer::getDecoder
Decoder * getDecoder(void)
Definition: musicplayer.h:115
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:304
MusicCommon::init
void init(bool startPlayback=true)
Definition: musiccommon.cpp:165
e
QDomElement e
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1417
MusicCommon::editTrackInfo
static void editTrackInfo(MusicMetadata *mdata)
Definition: musiccommon.cpp:1868
playlistcontainer.h
MusicCommon::m_trackProgressText
MythUIText * m_trackProgressText
Definition: musiccommon.h:184
MusicPlayer::getOutput
AudioOutput * getOutput(void)
Definition: musicplayer.h:117
MythUISearchDialog
Provide a dialog to quickly find an entry in a list.
Definition: mythdialogbox.h:348
PL_REPLACE
@ PL_REPLACE
Definition: playlist.h:24
MusicMetadata::Title
QString Title() const
Definition: musicmetadata.h:162
MythUIButton::SetLocked
void SetLocked(bool locked)
Definition: mythuibutton.cpp:203
gPlayer
MusicPlayer * gPlayer
Definition: musicplayer.cpp:35
MV_MINIPLAYER
@ MV_MINIPLAYER
Definition: musiccommon.h:42
MusicCommon::m_currentTrack
int m_currentTrack
Definition: musiccommon.h:155
Playlist::getSongAt
MusicMetadata * getSongAt(int pos) const
Definition: playlist.cpp:1090
MythUIButtonList::GetItemCurrent
MythUIButtonListItem * GetItemCurrent() const
Definition: mythuibuttonlist.cpp:1590
hardwareprofile.smolt.timeout
float timeout
Definition: smolt.py:103
formattedFieldValue
QString formattedFieldValue(const QVariant &value)
Definition: smartplaylist.cpp:108
ONEHOURINSEC
#define ONEHOURINSEC
Definition: mythmiscutil.h:97
MusicPlayer::setCurrentTrackPos
bool setCurrentTrackPos(int pos)
Definition: musicplayer.cpp:1033
mythuitext.h
MusicPlayer::getRepeatMode
RepeatMode getRepeatMode(void)
Definition: musicplayer.h:180
mythuiprogressbar.h
MythMusicVolumeDialog
Definition: musiccommon.h:209
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
OutputEvent::Buffering
static Type Buffering
Definition: output.h:64
MythMusicVolumeDialog::m_volText
MythUIText * m_volText
Definition: musiccommon.h:229
MusicCommon::m_repeatState
MythUIStateType * m_repeatState
Definition: musiccommon.h:177
DialogCompletionEvent::GetId
QString GetId()
Definition: mythdialogbox.h:52
MusicMetadata::Genre
QString Genre() const
Definition: musicmetadata.h:175
MythUIText::Reset
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitext.cpp:83
editmetadata.h
MusicCommon::setTrackOnLCD
static void setTrackOnLCD(MusicMetadata *mdata)
Definition: musiccommon.cpp:1037
MusicCommon::m_playButton
MythUIButton * m_playButton
Definition: musiccommon.h:196
MusicPlayer::toMap
void toMap(InfoMap &infoMap) const
Definition: musicplayer.cpp:1412
MusicCommon::m_whereClause
QString m_whereClause
Definition: musiccommon.h:165
mythuivideo.h
MusicCommon::m_trackSpeedText
MythUIText * m_trackSpeedText
Definition: musiccommon.h:185
MusicCommon::seekforward
void seekforward(void)
Definition: musiccommon.cpp:1100
MusicCommon::m_ffButton
MythUIButton * m_ffButton
Definition: musiccommon.h:198
MythMusicVolumeDialog::increaseVolume
void increaseVolume(void)
Definition: musiccommon.cpp:2716
MythUIButtonListItem::DisplayState
void DisplayState(const QString &state, const QString &name)
Definition: mythuibuttonlist.cpp:3507
MusicCommon::switchView
void switchView(MusicView view)
Definition: musiccommon.cpp:377
MythUIComposite::ResetMap
virtual void ResetMap(const InfoMap &infoMap)
Definition: mythuicomposite.cpp:28
OutputEvent
Definition: output.h:29
MusicCommon::CreateCommon
bool CreateCommon(void)
Definition: musiccommon.cpp:81
MusicPlayerEvent
Definition: musicplayer.h:21
MusicCommon::createPlaylistOptionsMenu
MythMenu * createPlaylistOptionsMenu(void)
Definition: musiccommon.cpp:2388
MythScreenType::Close
virtual void Close()
Definition: mythscreentype.cpp:402
PlaylistEditorView
Definition: playlisteditorview.h:64
MusicCommon::m_playlistMaxTime
uint m_playlistMaxTime
Definition: musiccommon.h:161
OutputEvent::Stopped
static Type Stopped
Definition: output.h:67
MusicCommon::keyPressEvent
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
Definition: musiccommon.cpp:581
TrackInfoDialog::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: musiccommon.cpp:2784
MV_PLAYLISTEDITORTREE
@ MV_PLAYLISTEDITORTREE
Definition: musiccommon.h:34
MythMainWindow::TranslateKeyPress
bool TranslateKeyPress(const QString &context, QKeyEvent *e, QStringList &actions, bool allowJumps=true)
Get a list of actions for a keypress in the given context.
Definition: mythmainwindow.cpp:1106
MythUIType::GetChild
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:130
MusicCommon::showPlaylistOptionsMenu
void showPlaylistOptionsMenu(bool addMainMenu=false)
Definition: musiccommon.cpp:2489
MusicCommon::playlistItemClicked
void playlistItemClicked(MythUIButtonListItem *item)
Definition: musiccommon.cpp:1966
MythUIButtonList::RemoveItem
void RemoveItem(MythUIButtonListItem *item)
Definition: mythuibuttonlist.cpp:1488
MusicCommon::createVisualizerMenu
MythMenu * createVisualizerMenu(void)
Definition: musiccommon.cpp:2374
MusicCommon::m_songList
QList< int > m_songList
Definition: musiccommon.h:168
MusicCommon::m_fullscreenBlank
bool m_fullscreenBlank
Definition: musiccommon.h:143
MusicCommon::m_muteState
MythUIStateType * m_muteState
Definition: musiccommon.h:188
MythUIImage::Load
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
Definition: mythuiimage.cpp:967
MusicPlayer::decVolume
void decVolume(void)
Definition: musicplayer.cpp:1371
DialogCompletionEvent::kEventType
static Type kEventType
Definition: mythdialogbox.h:57
MusicCommon::previous
void previous(void)
Definition: musiccommon.cpp:1092
MusicCommon::createSubMenu
MythMenu * createSubMenu(void)
Definition: musiccommon.cpp:2213
PlaylistOptions::insertPLOption
InsertPLOption insertPLOption
Definition: playlist.h:39
Playlist
Definition: playlist.h:45
Playlist::getName
QString getName(void)
Definition: playlist.h:106
MusicCommon::toggleMute
void toggleMute(void) const
Definition: musiccommon.cpp:900
LCD::MUSIC_REPEAT_ALL
@ MUSIC_REPEAT_ALL
Definition: lcddevice.h:187
TrackInfoDialog
Definition: musiccommon.h:234
MusicCommon::updatePlaylistStats
void updatePlaylistStats(void)
Definition: musiccommon.cpp:2099
MusicCommon::seekback
void seekback(void)
Definition: musiccommon.cpp:1108
MythUIProgressBar::SetUsed
void SetUsed(int value)
Definition: mythuiprogressbar.cpp:59
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:15
arg
arg(title).arg(filename).arg(doDelete))
MusicPlayerEvent::TrackStatsChangedEvent
static Type TrackStatsChangedEvent
Definition: musicplayer.h:47
AudioOutput::SetTimecode
virtual void SetTimecode(int64_t timecode)=0
MusicCommon::byTitle
void byTitle(void)
Definition: musiccommon.cpp:2476
MusicPlayer::setShuffleMode
void setShuffleMode(ShuffleMode mode)
Definition: musicplayer.cpp:1238
MusicMetadata::ID
IdType ID() const
Definition: musicmetadata.h:217
MusicCommon::next
void next(void)
Definition: musiccommon.cpp:1083
MusicCommon::doUpdatePlaylist
void doUpdatePlaylist(void)
Definition: musiccommon.cpp:2519
MV_PLAYLIST
@ MV_PLAYLIST
Definition: musiccommon.h:32
MusicCommon::~MusicCommon
~MusicCommon(void) override
Definition: musiccommon.cpp:63
MusicCommon::playFirstTrack
static void playFirstTrack()
Definition: musiccommon.cpp:2643
MusicPlayer::getCurrentTrackPos
int getCurrentTrackPos(void) const
Definition: musicplayer.h:132
MusicPlayerEvent::TrackAddedEvent
static Type TrackAddedEvent
Definition: musicplayer.h:42
MusicPlayer::isPlaying
bool isPlaying(void) const
Definition: musicplayer.h:102
MusicCommon::m_ratingState
MythUIStateType * m_ratingState
Definition: musiccommon.h:181
MusicCommon::m_rewButton
MythUIButton * m_rewButton
Definition: musiccommon.h:194
PlaylistContainer::copyNewPlaylist
void copyNewPlaylist(const QString &name)
Definition: playlistcontainer.cpp:194
MusicCommon::showTrackInfo
static void showTrackInfo(MusicMetadata *mdata)
Definition: musiccommon.cpp:1948
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MusicCommon::m_pauseButton
MythUIButton * m_pauseButton
Definition: musiccommon.h:195
MythUIButton::SetLockable
void SetLockable(bool lockable)
Definition: mythuibutton.h:39
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:44
mythuistatetype.h
show
static void show(uint8_t *buf, int length)
Definition: ringbuffer.cpp:319
MusicCommon::fromCD
void fromCD(void)
Definition: musiccommon.cpp:2406
playlisteditorview.h
MusicMetadata
Definition: musicmetadata.h:80
MusicCommon::createPlaylistMenu
MythMenu * createPlaylistMenu(void)
Definition: musiccommon.cpp:2241
MusicPlayerEvent::MetadataChangedEvent
static Type MetadataChangedEvent
Definition: musicplayer.h:46
MusicCommon::switchVisualizer
void switchVisualizer(const QString &visual)
Definition: musiccommon.cpp:970
PlaylistContainer::getPlaylistNames
QStringList getPlaylistNames(void)
Definition: playlistcontainer.cpp:290
MusicCommon::getTimeString
static QString getTimeString(int exTime, int maxTime)
Definition: musiccommon.cpp:2143
MusicPlayer::getCurrentPlaylist
Playlist * getCurrentPlaylist(void)
Definition: musicplayer.cpp:1595
MythUIButtonList::SetSearchFields
void SetSearchFields(const QString &fields)
Definition: mythuibuttonlist.h:206
playlistview.h
MythUIImage::Reset
void Reset(void) override
Reset the image back to the default defined in the theme.
Definition: mythuiimage.cpp:644
MusicPlayer::removeListener
void removeListener(QObject *listener)
Definition: musicplayer.cpp:159
MusicMetadata::Artist
QString Artist() const
Definition: musicmetadata.h:126
MainVisual::prepare
void prepare(void) override
Definition: mainvisual.cpp:139
menu
static MythThemedMenu * menu
Definition: mythtv/programs/mythtv-setup/main.cpp:55
MusicPlayer::setPlayMode
void setPlayMode(PlayMode mode)
Definition: musicplayer.cpp:950
MusicPlayer::pause
void pause(void)
Definition: musicplayer.cpp:286
MythMainWindow::GetStack
MythScreenStack * GetStack(const QString &stackname)
Definition: mythmainwindow.cpp:309
mythuibuttonlist.h
PlaylistView
Definition: playlistview.h:17
LCD::Get
static LCD * Get(void)
Definition: lcddevice.cpp:64
MusicPlayer::getPlayMode
PlayMode getPlayMode(void)
Definition: musicplayer.h:70
mythuiimage.h
MythUIButtonList::GetCount
int GetCount() const
Definition: mythuibuttonlist.cpp:1655
Playlist::toRawSonglist
QString toRawSonglist(bool shuffled=false, bool tracksOnly=false)
Definition: playlist.cpp:857
MV_RADIO
@ MV_RADIO
Definition: musiccommon.h:41
PL_FIRSTNEW
@ PL_FIRSTNEW
Definition: playlist.h:33
MythMusicVolumeDialog::Create
bool Create(void) override
Definition: musiccommon.cpp:2663
MusicPlayer::isStopped
bool isStopped(void)
Definition: musicplayer.h:104
MusicCommon::play
static void play(void)
Definition: musiccommon.cpp:1061
MusicCommon::changeSpeed
static void changeSpeed(bool up)
Definition: musiccommon.cpp:888
MythMusicVolumeDialog::m_displayTimer
QTimer * m_displayTimer
Definition: musiccommon.h:227
VisualizerView
Definition: visualizerview.h:16
MusicPlayer::changeCurrentTrack
void changeCurrentTrack(int trackNo)
change the current track to the given track
Definition: musicplayer.cpp:1133
AllMusic::getCDMetadata
MusicMetadata * getCDMetadata(int m_the_track)
Definition: musicmetadata.cpp:1717
MusicCommon::byArtist
void byArtist(void)
Definition: musiccommon.cpp:2424
MythScreenType::GetFocusWidget
MythUIType * GetFocusWidget(void) const
Definition: mythscreentype.cpp:112
MainVisual::setVisual
void setVisual(const QString &name)
Definition: mainvisual.cpp:81
PlaylistContainer::getActive
Playlist * getActive(void)
Definition: playlistcontainer.h:45
MusicCommon::m_visualModes
QStringList m_visualModes
Definition: musiccommon.h:147
MusicCommon::m_playlistOptions
PlaylistOptions m_playlistOptions
Definition: musiccommon.h:164
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythUIButtonListItem::SetText
void SetText(const QString &text, const QString &name="", const QString &state="")
Definition: mythuibuttonlist.cpp:3272
MusicPlayer::sendTrackStatsChangedEvent
void sendTrackStatsChangedEvent(int trackID)
Definition: musicplayer.cpp:1338
MusicPlayer::getCurrentMetadata
MusicMetadata * getCurrentMetadata(void)
get the metadata for the current track in the playlist
Definition: musicplayer.cpp:1155
LCD::MUSIC_REPEAT_NONE
@ MUSIC_REPEAT_NONE
Definition: lcddevice.h:185
MusicCommon::showVolume
static void showVolume(void)
Definition: musiccommon.cpp:950
MythUIButtonListItem
Definition: mythuibuttonlist.h:27
MusicCommon::m_moveTrackMode
bool m_moveTrackMode
Definition: musiccommon.h:150
MusicPlayer::SHUFFLE_OFF
@ SHUFFLE_OFF
Definition: musicplayer.h:164
MusicPlayer::toggleRepeatMode
RepeatMode toggleRepeatMode(void)
Definition: musicplayer.cpp:1192
MusicCommon::m_currentVisual
unsigned int m_currentVisual
Definition: musiccommon.h:148
MusicPlayerEvent::TrackChangeEvent
static Type TrackChangeEvent
Definition: musicplayer.h:40
Playlist::fillSonglistFromQuery
void fillSonglistFromQuery(const QString &whereClause, bool removeDuplicates=false, InsertPLOption insertOption=PL_REPLACE, int currentTrackID=0)
Definition: playlist.cpp:684
MythUIProgressBar::SetTotal
void SetTotal(int value)
Definition: mythuiprogressbar.cpp:71
MusicPlayer::removeVisual
void removeVisual(MainVisual *visual)
Definition: musicplayer.cpp:189
OutputEvent::Playing
static Type Playing
Definition: output.h:63
MythUIType::Show
void Show(void)
Definition: mythuitype.cpp:1118
MusicPlayer::incVolume
void incVolume(void)
Definition: musicplayer.cpp:1362
MusicCommon::byYear
void byYear(void)
Definition: musiccommon.cpp:2463
MusicCommon::m_cycleVisualizer
bool m_cycleVisualizer
Definition: musiccommon.h:144
Decoder::unlock
virtual void unlock(void)
Definition: decoder.h:81
Playlist::changed
void changed(void)
Definition: playlist.cpp:988
MythUIButtonList::GetCurrentPos
int GetCurrentPos() const
Definition: mythuibuttonlist.h:190
MusicCommon::m_playlistTrackCount
uint m_playlistTrackCount
Definition: musiccommon.h:159
MusicMetadata::toMap
void toMap(InfoMap &metadataMap, const QString &prefix="")
Definition: musicmetadata.cpp:1099
MV_VISUALIZER
@ MV_VISUALIZER
Definition: musiccommon.h:36
MusicPlayer::toggleShuffleMode
ShuffleMode toggleShuffleMode(void)
Definition: musicplayer.cpp:1211
MusicCommon::m_playlistProgress
MythUIProgressBar * m_playlistProgress
Definition: musiccommon.h:191
MusicCommon::playlistItemVisible
static void playlistItemVisible(MythUIButtonListItem *item)
Definition: musiccommon.cpp:1987
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:137
LCD::MUSIC_SHUFFLE_RAND
@ MUSIC_SHUFFLE_RAND
Definition: lcddevice.h:192
compat.h
MusicMetadata::getAlbumArtFile
QString getAlbumArtFile(void)
Definition: musicmetadata.cpp:1270
MusicCommon::byGenre
void byGenre(void)
Definition: musiccommon.cpp:2450
MythTV::Visual::mutex
QMutex * mutex()
Definition: visual.h:25
searchview.h
MusicCommon::m_prevButton
MythUIButton * m_prevButton
Definition: musiccommon.h:193
MusicCommon::createQuickPlaylistsMenu
MythMenu * createQuickPlaylistsMenu(void)
Definition: musiccommon.cpp:2351
Playlist::getTrackCount
int getTrackCount(void)
Definition: playlist.h:82
MusicPlayer::REPEAT_TRACK
@ REPEAT_TRACK
Definition: musicplayer.h:159
EditMetadataDialog
Definition: editvideometadata.h:19
MythUIComposite::SetTextFromMap
virtual void SetTextFromMap(const InfoMap &infoMap)
Definition: mythuicomposite.cpp:9
PlaylistContainer::getPlaylist
Playlist * getPlaylist(int id)
Definition: playlistcontainer.cpp:134
MythUIButton::Push
void Push(bool lock=false)
Definition: mythuibutton.cpp:172
MusicCommon::m_currentPlaylist
MythUIButtonList * m_currentPlaylist
Definition: musiccommon.h:203
MythFormatTime
QString MythFormatTime(int secs, QString fmt)
Format a seconds time value.
Definition: mythmiscutil.cpp:1237
MV_PLAYLISTEDITORGALLERY
@ MV_PLAYLISTEDITORGALLERY
Definition: musiccommon.h:35
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:634
MusicPlayer::incSpeed
void incSpeed()
Definition: musicplayer.cpp:1314
MythUIButtonTree
A tree widget for displaying and navigating a MythGenericTree()
Definition: mythuibuttontree.h:16
MusicCommon::updateProgressBar
void updateProgressBar(void)
Definition: musiccommon.cpp:915
MusicCommon::stopVisualizer
void stopVisualizer(void)
Definition: musiccommon.cpp:1029
MUSICVOLUMEPOPUPTIME
#define MUSICVOLUMEPOPUPTIME
Definition: musiccommon.cpp:2651
AllMusic::getCDTrackCount
int getCDTrackCount(void) const
Definition: musicmetadata.h:441
MusicCommon::m_mainvisual
MainVisual * m_mainvisual
Definition: musiccommon.h:142
MythMusicVolumeDialog::m_muteState
MythUIStateType * m_muteState
Definition: musiccommon.h:230
MusicCommon::createRepeatMenu
MythMenu * createRepeatMenu(void)
Definition: musiccommon.cpp:2319
MusicPlayer::getShuffleMode
ShuffleMode getShuffleMode(void)
Definition: musicplayer.h:184
MusicPlayer::SHUFFLE_ARTIST
@ SHUFFLE_ARTIST
Definition: musicplayer.h:168
MusicPlayerEvent::m_trackID
int m_trackID
Definition: musicplayer.h:34
MusicPlayer::savePosition
void savePosition(void)
Definition: musicplayer.cpp:1048
MV_LYRICS
@ MV_LYRICS
Definition: musiccommon.h:33
MusicCommon::viewExited
void viewExited(void)
Definition: musiccommon.cpp:576
LCD::MUSIC_SHUFFLE_NONE
@ MUSIC_SHUFFLE_NONE
Definition: lcddevice.h:191
MythUIButtonListItem::GetData
QVariant GetData()
Definition: mythuibuttonlist.cpp:3588
LCD::MUSIC_SHUFFLE_ARTIST
@ MUSIC_SHUFFLE_ARTIST
Definition: lcddevice.h:195
MusicPlayer::playlistChanged
void playlistChanged(int playlistID)
Definition: musicplayer.cpp:1484
AllMusic::getMetadata
MusicMetadata * getMetadata(int an_id)
Definition: musicmetadata.cpp:1647
uint
unsigned int uint
Definition: compat.h:140
MusicPlayer::removeTrack
void removeTrack(int trackID)
Definition: musicplayer.cpp:1577
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:57
MusicData::m_all_playlists
PlaylistContainer * m_all_playlists
Definition: musicdata.h:54
MusicPlayer::next
void next(void)
Definition: musicplayer.cpp:417
MusicPlayer::isPaused
bool isPaused(void)
Definition: musicplayer.h:103
MusicCommon::updateUIPlayedList
void updateUIPlayedList(void)
Definition: musiccommon.cpp:2073
smartplaylist.h
MusicCommon::updateRepeatMode
void updateRepeatMode(void)
Definition: musiccommon.cpp:287
MusicPlayerEvent::AllTracksRemovedEvent
static Type AllTracksRemovedEvent
Definition: musicplayer.h:45
MusicCommon::m_trackState
MythUIStateType * m_trackState
Definition: musiccommon.h:186
MusicCommon::createShuffleMenu
MythMenu * createShuffleMenu(void)
Definition: musiccommon.cpp:2334
MusicCommon::m_coverartImage
MythUIImage * m_coverartImage
Definition: musiccommon.h:201
LyricsView
Definition: lyricsview.h:17
MusicCommon::m_infoText
MythUIText * m_infoText
Definition: musiccommon.h:172
musicdata.h
UIUtilDisp::Assign
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27
TrackInfoDialog::m_metadata
MusicMetadata * m_metadata
Definition: musiccommon.h:247
MythUIType::Hide
void Hide(void)
Definition: mythuitype.cpp:1113
MythMusicVolumeDialog::toggleMute
void toggleMute(void)
Definition: musiccommon.cpp:2728
MythUIButtonListItem::SetTextFromMap
void SetTextFromMap(const InfoMap &infoMap, const QString &state="")
Definition: mythuibuttonlist.cpp:3289
MusicPlayer::SHUFFLE_RANDOM
@ SHUFFLE_RANDOM
Definition: musicplayer.h:165
musiccommon.h
MusicCommon::m_visualizerVideo
MythUIVideo * m_visualizerVideo
Definition: musiccommon.h:206
MusicMetadata::Album
QString Album() const
Definition: musicmetadata.h:150
MusicCommon::createPlayerMenu
MythMenu * createPlayerMenu(void)
Definition: musiccommon.cpp:2293
gMusicData
MusicData * gMusicData
Definition: musicdata.cpp:20
streamview.h
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:907
MusicCommon::changeRating
static void changeRating(bool increase)
Definition: musiccommon.cpp:1162
MythUIButtonListItem::GetText
QString GetText(const QString &name="") const
Definition: mythuibuttonlist.cpp:3313
MusicCommon::m_stopButton
MythUIButton * m_stopButton
Definition: musiccommon.h:197
MusicMetadata::IdType
uint32_t IdType
Definition: musicmetadata.h:86
MusicPlayer::PLAYMODE_TRACKSPLAYLIST
@ PLAYMODE_TRACKSPLAYLIST
Definition: musicplayer.h:64
MusicPlayer::getNextMetadata
MusicMetadata * getNextMetadata(void)
get the metadata for the next track in the playlist
Definition: musicplayer.cpp:1167
LCD::MUSIC_SHUFFLE_SMART
@ MUSIC_SHUFFLE_SMART
Definition: lcddevice.h:193
MusicCommon::m_timeText
MythUIText * m_timeText
Definition: musiccommon.h:171
OutputEvent::Paused
static Type Paused
Definition: output.h:66
MainVisual::getVisualizations
QStringList getVisualizations(void)
Definition: mainvisual.h:57
PL_INSERTATEND
@ PL_INSERTATEND
Definition: playlist.h:26
MainVisual::getCurrentVisual
int getCurrentVisual(void) const
Definition: mainvisual.h:59
MusicCommon::updateVolume
void updateVolume(void)
Definition: musiccommon.cpp:1841
MusicCommon::updateTrackInfo
void updateTrackInfo(MusicMetadata *mdata)
Definition: musiccommon.cpp:1886
MainVisual
Definition: mainvisual.h:33
MusicPlayer::getPlayedTracksList
QList< MusicMetadata * > & getPlayedTracksList(void)
Definition: musicplayer.h:130
MusicCommon::m_trackProgress
MythUIProgressBar * m_trackProgress
Definition: musiccommon.h:183
MusicCommon::createMainMenu
MythMenu * createMainMenu(void)
Definition: musiccommon.cpp:2178
MythUIButtonListItem::SetFontState
void SetFontState(const QString &state, const QString &name="")
Definition: mythuibuttonlist.cpp:3391
MusicPlayer::previous
void previous(void)
Definition: musicplayer.cpp:454
MusicCommon::m_currentTime
int m_currentTime
Definition: musiccommon.h:156
lyricsview.h
MythMenu
Definition: mythdialogbox.h:92
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
MusicCommon::updateShuffleMode
void updateShuffleMode(bool updateUIList=false)
Definition: musiccommon.cpp:322
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythscreentype.cpp:414
MusicPlayer::decSpeed
void decSpeed()
Definition: musicplayer.cpp:1320
MusicPlayerEvent::TrackUnavailableEvent
static Type TrackUnavailableEvent
Definition: musicplayer.h:44
MusicCommon::showExitMenu
void showExitMenu(void)
Definition: musiccommon.cpp:2269
MusicPlayer::activePlaylistChanged
void activePlaylistChanged(int trackID, bool deleted)
Definition: musicplayer.cpp:1421
MythMusicVolumeDialog::~MythMusicVolumeDialog
~MythMusicVolumeDialog(void) override
Definition: musiccommon.cpp:2653
MusicPlayer::setRepeatMode
void setRepeatMode(RepeatMode mode)
Definition: musicplayer.h:181
MusicMetadata::decRating
void decRating()
Definition: musicmetadata.cpp:1175
MusicPlayer::REPEAT_OFF
@ REPEAT_OFF
Definition: musicplayer.h:158
MythMusicVolumeDialog::updateDisplay
void updateDisplay(void)
Definition: musiccommon.cpp:2734
mythuitextedit.h
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition: xmlparsebase.cpp:692
MythUIButtonListItem::SetImage
void SetImage(MythImage *image, const QString &name="")
Sets an image directly, should only be used in special circumstances since it bypasses the cache.
Definition: mythuibuttonlist.cpp:3406
MusicCommon::searchButtonList
void searchButtonList(void)
Definition: musiccommon.cpp:2153
MusicPlayer::RepeatMode
RepeatMode
Definition: musicplayer.h:157
random
static long int random(void)
Definition: compat.h:149
PL_INSERTAFTERCURRENT
@ PL_INSERTAFTERCURRENT
Definition: playlist.h:27
MusicPlayer::SHUFFLE_ALBUM
@ SHUFFLE_ALBUM
Definition: musicplayer.h:167
MusicCommon::cycleVisualizer
void cycleVisualizer(void)
Definition: musiccommon.cpp:991
constants.h
OutputEvent::Info
static Type Info
Definition: output.h:65
DialogCompletionEvent
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
audiooutput.h
MusicCommon::m_playlistPlayedTime
uint m_playlistPlayedTime
Definition: musiccommon.h:160
MusicPlayerEvent::VolumeChangeEvent
static Type VolumeChangeEvent
Definition: musicplayer.h:41
MusicCommon::showSpeed
static void showSpeed(bool show)
Definition: musiccommon.cpp:965
MythUIText::SetTextFromMap
void SetTextFromMap(const InfoMap &map)
Definition: mythuitext.cpp:158
MusicPlayerEvent::TrackRemovedEvent
static Type TrackRemovedEvent
Definition: musicplayer.h:43
MusicView
MusicView
Definition: musiccommon.h:30
MythUIText::SetText
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:135
MusicPlayer::isMuted
bool isMuted(void) const
Definition: musicplayer.h:82
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1080
startPlayback
static void startPlayback(void)
Definition: mythtv/programs/mythfrontend/main.cpp:560
MusicCommon::m_movingTrack
bool m_movingTrack
Definition: musiccommon.h:151
MusicCommon::seek
void seek(int pos)
Definition: musiccommon.cpp:1116
MythUIButtonList::Reset
void Reset() override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuibuttonlist.cpp:113
MusicCommon::changeVolume
void changeVolume(bool up) const
Definition: musiccommon.cpp:876
MusicCommon::startVisualizer
void startVisualizer(void)
Definition: musiccommon.cpp:1021
mainvisual.h
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:107
MThread::isRunning
bool isRunning(void) const
Definition: mthread.cpp:272
visualizerview.h
Playlist::getStats
void getStats(uint *trackCount, uint *totalLength, uint currentTrack=0, uint *playedLength=nullptr) const
Definition: playlist.cpp:495
MythUIButtonList::SetItemCurrent
void SetItemCurrent(MythUIButtonListItem *item)
Definition: mythuibuttonlist.cpp:1557
MusicPlayer::setAllowRestorePos
void setAllowRestorePos(bool allow)
Definition: musicplayer.h:143
build_compdb.action
action
Definition: build_compdb.py:9
PlaylistEditorView::saveTreePosition
void saveTreePosition(void)
Definition: playlisteditorview.cpp:1700
MusicCommon::m_playedTracksList
MythUIButtonList * m_playedTracksList
Definition: musiccommon.h:204
MusicPlayer::PLAYMODE_RADIO
@ PLAYMODE_RADIO
Definition: musicplayer.h:66
MusicCommon::pause
static void pause(void)
Definition: musiccommon.cpp:1066
MusicCommon::stop
void stop(void)
Definition: musiccommon.cpp:1071
MusicPlayer::play
void play(void)
Definition: musicplayer.cpp:304
MythScreenType::Exiting
void Exiting()
LCD::switchToMusic
void switchToMusic(const QString &artist, const QString &album, const QString &track)
Definition: lcddevice.cpp:559
mythuibutton.h
PlaylistOptions::playPLOption
PlayPLOption playPLOption
Definition: playlist.h:40
MusicPlayer::restorePosition
void restorePosition(void)
Definition: musicplayer.cpp:1065
MV_SEARCH
@ MV_SEARCH
Definition: musiccommon.h:37
MusicData::m_all_music
AllMusic * m_all_music
Definition: musicdata.h:55
MusicCommon::byAlbum
void byAlbum(void)
Definition: musiccommon.cpp:2437
MusicCommon::MusicCommon
MusicCommon(MythScreenStack *parent, MythScreenType *parentScreen, const QString &name)
Definition: musiccommon.cpp:48
MusicMetadata::Rating
int Rating() const
Definition: musicmetadata.h:238
LCD::MUSIC_REPEAT_TRACK
@ MUSIC_REPEAT_TRACK
Definition: lcddevice.h:186
MythUIButtonTree::ShowSearchDialog
void ShowSearchDialog(void)
Definition: mythuibuttontree.cpp:357
MusicCommon::updateUIPlaylist
void updateUIPlaylist(void)
Definition: musiccommon.cpp:2018
MythThemedMenuState::Create
bool Create(void) override
Definition: myththemedmenu.cpp:36
Playlist::fillSongsFromSonglist
void fillSongsFromSonglist(const QString &songList)
Definition: playlist.cpp:635
MusicMetadata::incRating
void incRating()
Definition: musicmetadata.cpp:1184
MythUIButtonListItem::GetImageFilename
QString GetImageFilename(const QString &name="") const
Definition: mythuibuttonlist.cpp:3494
Decoder::lock
virtual void lock(void)
Definition: decoder.h:80
Playlist::removeAllTracks
void removeAllTracks(void)
Definition: playlist.cpp:87
PL_FIRST
@ PL_FIRST
Definition: playlist.h:32
MusicPlayer::stop
void stop(bool stopAll=false)
Definition: musicplayer.cpp:237
Playlist::getID
int getID(void) const
Definition: playlist.h:111
MusicCommon::m_volumeText
MythUIText * m_volumeText
Definition: musiccommon.h:189
playlist.h
Playlist::fillSonglistFromList
void fillSonglistFromList(const QList< int > &songList, bool removeDuplicates, InsertPLOption insertOption, int currentTrackID)
Definition: playlist.cpp:784
MythTextInputDialog
Dialog prompting the user to enter a text string.
Definition: mythdialogbox.h:263
lcddevice.h
mythuicheckbox.h
PL_CURRENT
@ PL_CURRENT
Definition: playlist.h:34
MusicPlayer::getBufferStatus
void getBufferStatus(int *bufferAvailable, int *bufferSize) const
Definition: musicplayer.cpp:944
MythUIImage::SetFilename
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
Definition: mythuiimage.cpp:675
MythUIButtonList::ShowSearchDialog
void ShowSearchDialog(void)
Definition: mythuibuttonlist.cpp:3104
MusicCommon::m_shuffleState
MythUIStateType * m_shuffleState
Definition: musiccommon.h:176
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:143
MusicPlayerEvent::AlbumArtChangedEvent
static Type AlbumArtChangedEvent
Definition: musicplayer.h:48
MusicCommon::m_visualText
MythUIText * m_visualText
Definition: musiccommon.h:173
Decoder::seek
virtual void seek(double)=0
MusicCommon::m_noTracksText
MythUIText * m_noTracksText
Definition: musiccommon.h:174
MusicPlayer::getVolume
uint getVolume(void) const
Definition: musicplayer.cpp:1389
MusicCommon::m_parentScreen
MythScreenType * m_parentScreen
Definition: musiccommon.h:138
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:49
MythUIButtonListItem::MoveUpDown
bool MoveUpDown(bool flag)
Definition: mythuibuttonlist.cpp:3593
MusicCommon::restorePosition
bool restorePosition(int trackID)
Definition: musiccommon.cpp:2609
MusicCommon::m_randomVisualizer
bool m_randomVisualizer
Definition: musiccommon.h:145
MusicMetadata::Length
int Length() const
Definition: musicmetadata.h:205
SearchView
Definition: searchview.h:18
AudioOutput::ToggleUpmix
virtual bool ToggleUpmix(void)
Definition: audiooutput.h:158
MusicCommon::customEvent
void customEvent(QEvent *event) override
Definition: musiccommon.cpp:1186
musicmetadata.h
MusicCommon::m_controlVolume
bool m_controlVolume
Definition: musiccommon.h:153
TrackInfoDialog::Create
bool Create(void) override
Definition: musiccommon.cpp:2753
MusicCommon::m_nextButton
MythUIButton * m_nextButton
Definition: musiccommon.h:199
LCD
Definition: lcddevice.h:169
MusicMetadata::Year
int Year() const
Definition: musicmetadata.h:196
MusicCommon::m_maxTime
int m_maxTime
Definition: musiccommon.h:157
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:22
AudioOutput::IsPaused
virtual bool IsPaused(void) const =0
MythMusicVolumeDialog::decreaseVolume
void decreaseVolume(void)
Definition: musiccommon.cpp:2722
MusicPlayer::addListener
void addListener(QObject *listener)
Definition: musicplayer.cpp:143
MusicCommon::toggleUpmix
static void toggleUpmix(void)
Definition: musiccommon.cpp:909
MythUIStateType::DisplayState
bool DisplayState(const QString &name)
Definition: mythuistatetype.cpp:84
MusicCommon
Definition: musiccommon.h:47
decoder.h
MusicCommon::ShowMenu
void ShowMenu(void) override
Definition: musiccommon.cpp:2164
MusicPlayer::ShuffleMode
ShuffleMode
Definition: musicplayer.h:163
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:901
MythMusicVolumeDialog::m_volProgress
MythUIProgressBar * m_volProgress
Definition: musiccommon.h:231
MusicCommon::allTracks
void allTracks(void)
Definition: musiccommon.cpp:2400
MusicPlayer::REPEAT_ALL
@ REPEAT_ALL
Definition: musicplayer.h:160
MusicPlayer::moveTrackUpDown
void moveTrackUpDown(bool moveUp, int whichTrack)
Definition: musicplayer.cpp:1015