~ubuntu-branches/ubuntu/precise/mythtv/precise

« back to all changes in this revision

Viewing changes to mythplugins/mythmusic/mythmusic/musiccommon.cpp

  • Committer: Package Import Robot
  • Author(s): Mario Limonciello
  • Date: 2012-03-05 21:49:35 UTC
  • mfrom: (1.1.78)
  • Revision ID: package-import@ubuntu.com-20120305214935-vxn0sv24s35dl1sw
Tags: 2:0.25.0~master.20120305.6519666-0ubuntu1
* Drop mythtv-themes metapackage and childish theme.  Should be installed
  exclusively through theme chooser now.
* Update Mythbuntu theme git links to still create that theme package.
* Update configure without install patch.
* Tweak default max_connections for mysql to be 100 per requests from
  mythtv mailing lists.
* Update to a checkout post mythtv 0.25 beta release.
* New upstream checkout (6519666)
* >>Upstream changes since last upload (532cee8):
* [6519666] Use deleteLater() when deleting server sockets in
  ServerPool.
* [b08b41b] Silence unused variable warning
* [5112e25] Silence unused variable warning
* [40c69e1] AvFormatDecoder: add FORCE_DTS_TIMESTAMPS environment
  variable
* [dbb5ffb] Merge branches 'master' and 'master' of
  github.com:MythTV/mythtv
* [57687c8] Subtitles: Initialize the SRT error count to avoid bogus
  diagnostics.
* [6c3a799] Increase kMaxUIWaitTime to 10 seconds. The theory is that
  this timeout was to prevent a very delayed response to an
  availability check causing playlists to resume playing long after
  the user had moved on. The present timeout was very short though and
  didn't account for delays caused by disks needing to be spun up or
  just the latency of checking multiple storage groups for a file.
  Almost certainly fixes #8316
* [dd9a92a] Subtitles: Fix a null pointer dereference when splitting
  long lines.
* [5f98ce1] Fixes #10367. Adds new Motorolla DCX-3200 vendor and
  device id.
* [7347bf5] Fix for WSDL generation.
* [a454b79] Allow the processing of uncompressed data from Schedules
  Direct.
* [f19c9c2] Minor changes to allow compilation using VS2010
* [0607b58] Fix build after [6a200130eff4]
* [6a20013] Handle more ISO-639 codes
* [d1a6cc8] Fix universal package build with new osx-builder
* [20f2c45] Fix UPnP for Sony BluRay players
* [638192e] mythtranscode: --fifoinfo reports aspect ratio of first
  uncut frame
* [18fdd67] Look in more than one location for libdvdcss on mac.
* [871a1cd] Giving up on Qt, doing it with an external command.
* [4392c16] Delay first call to QTextCodec until after main
  QApplication has been created
* [da7626e] Do not disable mythmusic dependencies when using --
  disable-all
* [ca996e0] Updated Norwegian Bokmal MythFrontend and all plugins
  translation from Rune Evjen.
* [18ab21a] Rearrange code in AddRangeList to defeat compile warnings
* [2422b6f] Miscellaneous string fixes
* [5e898a1] Fix HLS AddVideoLiveStream with files in subdirectories.
* [f834940] MythArchive: Remove the Cancel options from the menus
* [366d96d] Correct issue passing python library name for dependency
  checking.
* [c09418f] MythBrowser: Remove the Cancel options from the menus
* [002d7c5] MythMusic: Remove the Cancel options from the menus
* [bb3d1a8] MythMusic: Add some context menus on the playlist editor
  screen
* [bf4ff78] Per 2075458f5 Remove deprecated attribute from
  dispatchNow(), we know it's deprecated but it's not going away any
  time soon
* [12bbcf0] Fix a warning about an unused variable in httpconfig.cpp
* [43dcfce] Fix a warning about an unused variable in videolist.cpp
* [4edcda6] Move the Recording Profiles editor into mythtv-setup where
  it belongs. This constantly gets overlooked because it's not in the
  right place, especially by users who chose to use a third party
  frontend.
* [d7c8dfb] Better default device (when MediaMonitor disabled) on OS
  X. Refs #10370
* [7b526c4] Rework AudioReencodeBuffer further to fix HLS audio
  buffering
* [a130e74] Bump ABI version.
* [5e976b4] Rename util.h into mythmiscutil.h
* [efe385c] Fix dcraw detection on FreeBSD (old sh, not bash)
* [f5aa5e8] Use QNetworkAddressEntry to get proper broadcast address
  for udplistener
* [b6f9e1d] Revert "Rename util.h into mythutil.h"
* [84275f1] Revert "util.h rename itself didn't get committed"
* [8ef8c0b] Merge branch 'master' of github.com:MythTV/mythtv
* [0fe6e14] Totally rework the AudioReencodeBuffer part in transcode
* [fb8004a] util.h rename itself didn't get committed
* [ef771da] Rename util.h into mythutil.h
* [ba9b5d3] Rewrite configure for mythplugins
* [a5557a3] Fix MythZoneMinder on mac; the proper way..
* [30ed8f0] DeleteMap tracker: Fix an error in 94d27c67f.
* [6ae9f66] Rewrite configure for mythplugins
* [0fc9853] Fix MythZoneMinder on mac; the proper way..
* [79f5133] Updated US English MythFrontend and all plugins
  translation from the US English Language Translation Team.
* [6952dc4] Miscellaneous typo and case fixes.
* [b85f5bb] MythArchive: various minor mythburn.py script improvements
* [7e9cd56] Missed a change from cda7871f - I forgot to make install
  when testing and missed the breakage.
* [9d83307] Remove an errant <value> tag from the mythgallery default
  theme. This was causing some confusion for translators.
* [cda7871] Fix the channel icon not loading in the OSD on remote
  frontends by switching to using the channel icon storage group. This
  bug has been around for years so it's nice to finally have a fix.
* [e0e321f] Additional case and spacing fixes.
* [47c7c48] Add a few missing spaces...
* [736524b] Various case and punctuation fixes.
* [eba28f4] MythMusic: Only abort ripping upon confirmation
* [81acf24] Tweak the space available for the channel number so that
  it remains hidden behind the poster.
* [fbba2ae] Show coverart in the Terra OSD, falling back to channel
  icon if the artwork isn't available and channel number if the
  channel icon isn't available.
* [ff4d601] DVD navigation: Reenable skipping past the last chapter of
  a title, and skipping previous to the first chapter of a title.  The
  limitation may have been left over from an older version of
  libdvdnav.
* [8ea557a] Fix 'depends'. I'm surprised I didn't notice this earlier,
  perhaps because I was using <group> a lot I missed that depends
  behaviour didn't work for immediate children of <window>.
* [eb87f9e] Fix 'depends' for inherited and copied screens.
* [38221b8] Only show poster in the default-wide OSD when we're not
  displaying the channum/icon/callsign. Also center the poster better
  in the available space.
* [69cae58] Merge commit 'e965387441ff189bb2c096f8ed5bdbf2b2a473e6'
* [e965387] Add setup script and readme
* [905e8e5] Split 'mythtv/bindings/python/MythTV/tmdb3/' into commit
  '565041dddf9d4937c31c0d57475c548e56882e89'
* [565041d] Enable search paging for TMDB v3 API.
* [367b05d] Enable search paging for TMDB v3 API.
* [6113151] Add proper language support to TMDB v3 API.
* [6410395] Add proper language support to TMDB v3 API.
* [c65d8eb] Remove TMDB API key from request.py
* [6c4c60a] Remove TMDB API key from request.py
* [b38f901] Fix some null strings in SQL inserts on NOT NULL columns.
* [55fd3bf] MythUI: Make ascent/descent/bearing adjustment a little
  easier to follow, by using moveTop/moveLeft instead of setX/setY
* [d16575c] MythUI: fix a typo in MythUIText::DrawSelf that could
  result in an incorrect canvas size.
* [64383c5] Fix a compiler warning.
* [ecea05d] Added ENO to an error log in avformatdecoder
* [03e2387] Services API: Fix cut and paste error.
* [99abdfe] Update xml schema declaration for 0.25
* [6e2f231] Fix typo
* [05e5cf7] Updated Spanish/Spain MythFrontend, MythArchive,
  MythBrowser, MythGallery, MythGame, MythMusic, MythNetvision,
  MythNews, MythWeather transation from the Spanish Language
  Translation Team
* [2f895cb] Fix mythzoneminder on mac part #3
* [e34c8d7] Fix universal architecture compilation of myth on mac.
* [a513779] Fix MythZoneMinder part #2
* [700a58d] Remove stray include, same as <Qt>
* [d84d5c9] Add basic dead key support to mythuitextedit. Implemented
  from scratch because I couldn't see a way of getting QT to handle
  it. 
* [c3544ed] Fix mac compilation
* [6bfda0c] Fix mythoneminder compilation when using mysql universal
  libraries.
* [21ad34b] Add --firewire-sdk configuration switch to configure
* [3196c2c] Fix FireWire compilation on mac when compiling in 64 bits
  mode.
* [5dccbd5] Fix mac compilation when Qt Frameworks are in use.
* [20d6852] Fix libcec configure to work with v1.5
* [f16048b] Finish the db upgrade to 1299 (perl bindings)
* [d486b8a] Make artwork edit UI elements optional on video metadata
  edit screen.
* [38dfa89] Updated British English MythFrontend, MythArchive,
  MythGame and MythMusic translation from Nick Morrott
* [7e4740e] Refs #8941. Make sure we set the channum when switching to
  a new card with either a specific chanid or inputid.
* [05bc5e1] plugins configure: Remove some debugging left by mistake
* [ff593fa] Clean up the mappings for network control jump points.
* [146ee76] Fixes #8744. Fixes crash in DVB-x channel scanning.
* [6f24f3b] Subtitles: Rename the OSDSubFont setting to
  DefaultSubtitleFont.
* [6202c0d] Revert "Subtitles: Remove the OSDSubFont setting."
* [4a2420e] MythZoneMinder: Add support for the deep filesystem
  hierarchy for events.
* [a6b1e3a] Program editor: don't seek too far when stepping to the
  next keyframe.
* [97da8c8] Fix a doxygen comment
* [144c8bb] MythMusic: Do a full reload of the tracks and playlists
  after doing a scan
* [f78f999] Change delete behaviour so that we always use the deleted
  recording group allowing all recordings to be undeleted. By default
  we will only keep recordings for a minimum of 5 minutes (max ~20m)
  after their deletion, enough time to recover from a mistake but
  still free up space quickly. As before the user can specify to keep
  deleted recordings for a fixed number of days or until the space is
  needed for a new recording instead. Post 0.25 this change will allow
  us to strip out the old deletion code and simplify configuration
  process, the functional change is being made now to fix a couple of
  bugs caused by external processes such as MythPreviewGen blocking
  deletes from the UI. Fixes #9536
* [cfd3fc0] MythMusic: Fix the sending of the MUSIC_SETTINGS_CHANGED
  event
* [5932419] Merge branch 'compartist'
* [5206271] Subtitles: Apply OSDCC708TextZoom to CEA-608 captions as
  well.
* [99512fb] Refs #10386.  Don't sent EXIT_TO_MAIN event to Live TV
  jump point.
* [dfd909f] Fix crash on mac when no audio device exists.
* [bd68156] MythMusic: Fix the BLANKSCR keybinding not working
* [9016890] MythMusic: Check for some additional cdio headers
* [3570a99] MythMusic: Fix a memory leak in the playlist editor
* [7e6f5fa] Fixes #10386. Segfault fix. Check for null.
* [510da69] As noted in SHA1:9551bce2, MainServer doesn't know the
  actual recording status because it defaults to rsRecorded when the
  recordinginfo is initialized from the recorded table.  MainServer
  doesn't account for this and tries to make any needed state change
  which always ends up staying rsRecorded.  MainServer then passes
  this bad status to the scheduler.  If the recording had already
  failed, the rsFailed status gets overwritten.
* [3740d7d] Spelling consistency fixes
* [47d7c77] Fixes #9233. Refs #7408. Re-enables WindowResized().
* [a5447f1] MythMusic: Add a Compilations branch to the playlist
  editor
* [1824969] Fixes #10153. Guess at DVB-S vs DVB-S2 when not explicitly
  set.
* [21784ce] Fixes #10377. Prevent getting "stuck on a mux".
* [593d24b] Refs #10377. Some logging fixes. (VB_PLAYBACK-
  >VB_CHANNEL).
* [14ec737] Change the rsTuning UI state equivalent from 'tuning' to
  'running'. The UI states for the 'status' statetype are limited to 5
  generic values (normal, running, warning, error, disabled) to allow
  some portability to scenarios other than recording. (This was
  supposed to save themers some time and effort although it also binds
  their hands and doesn't allow as much creativity with how various
  recording states are represented. For this reason it may be re-
  visited post-0.25)
* [4d68d5e] Updated Russian MythFrontend, MythArchive, MythBrowser,
  MythGallery, MythGame, MythMusic, MythNews, MythWeather and
  MythZoneminder.
* [34c8767] Subtitles: fix an incorrect CEA-708 font mapping.
* [b967448] Fix the faulty exit code 139 issue in Ubuntu systems
* [723d798] Subtitles: improve vertical alignment for CEA-608
  captions.
* [1af1aec] Fixes display of position in the Program Lister.
  MythUIButtonList is zero indexed, to get a position for display we
  must add one.
* [967208b] Fix the last, hopefully, remaining places where
  livetvorder isn't honored.
* [0a301c0] Fix the scheduler to not write incorrect oldrecorded
  entries.
* [5d5aef3] Subtitles: improve the layout.
* [878d5eb] String consistency updated
* [456bb42] Updated Estonian MythFrontend and all plugins translation
  from Marko Punnar
* [e719d54] Replace tabs with spaces in Terra's schedule filter editor
  window xml
* [a3d9891] Use proper capitalization for some common words and
  prefixes.
* [5b19c4d] Populate the infomap from both RecordingRule and
  RecordingInfo if available. This fixes recording rule specific
  information not being available in the sub screens of the schedule
  editor.
* [f77d001] Fix minor problems editing in-progress recordings.
* [006ded1] Fix recording status strings being set to 'Not scheduled'
  when the reason for that is they were in the past and should have
  been marked as Recorded/Aborted/Failed/Cancelled/etc instead
* [6bedf81] Correct handling of unrelated argument after arg-less
  keyword.
* [7adbd54] Delay String processing until after QApplication has been
  initialized.
* [f613a43] Fix LiveTV switching by videosource to honor livetvorder.
* [9b5b7b5] Exit cutlist edit mode cleanly when executing a jump
  point.
* [c2a0b85] Updated British English translation MythFrontend
  translation from Nick Morrott.
* [307dac8] Make jump points work during playback when the OSD is
  present.
* [d59f4f4] Change dynamic cast to static. This is troubling because
  we rely on dynamic casts in so many places but for at least one
  person this cast was failing and causing popup menus in MythMusic to
  no longer have any effect. Maybe a buggy version of gcc?
* [3de87c3] Subtitles: Fix a logic error.
* [23d5167] Make host checks in Video Library scanner case
  insensitive.
* [5d7c01d] Cutlist editor: Update the edit bar for in-progress
  recordings.
* [1ce3d21] Cutlist editor: Adjust "Cut to End" behavior for an in-
  progress recording.
* [4a8546d] Merge branch 'master' of github.com:MythTV/mythtv
* [1d6485d] MythArchive consistency fixes.
* [89c34ef] Fix seeking backwards into a cut region.
* [6c3b564] Updated British English translation MythFrontend
  translation from Nick Morrott.
* [5501fff] Fix long-standing bug that always cleared
  record.next_record instead of updating it.
* [0c5de8e] Add missing menu closed event when closing the menu via
  the mouse. Fixes the menu dialog not working in some screens after
  being dismissed using a right click.
* [93c228d] Prevent crash when invoking the menu dialog via the right
  mouse button in Watch Recordings. ShowMenu() is a virtual method in
  MythScreenType, it's intended purpose is to load/display the context
  menu but here it is displaying a menu loaded elsewhere with no
  guards against duplicate popups being created. Move the menu display
  code to DisplayPopupMenu(), restore ShowMenu() to behave the same as
  the MENU key binding and re-instate the guards against multiple menu
  dialogs being created. Also fixes #10248 - 'Cannot delete recording
  if file is missing'
* [b755eca] Attempt to prevent a QString segfault if MythMenu changes
  while a dialog is open.
* [f3efafe] Fix segfault in MythUIButtonTree when list is empty and we
  attempt to navigate it. Refs #9101
* [b3e44a2] Rule type was missed from the RecordingRule text map.
  Added so that it appears twice in the map, once under the correct
  title of ruletype but also as rectype to be consistent with the
  ProgramInfo map until after 0.25 when we can rename that instance.
* [2075458] Remove deprecated attribute from dispatchNow(), we know
  it's deprecated but it's not going anywhere soon.
* [82fc1af] Add Collection support to developmental tmdb3 grabber.
* [0f0b0a7] Better backend metaclass, and people search support.
* [c47940a] Clean up and document background machinery
* [850fbc2] Replacement PagedList to temporarily work around bug in
  search API
* [d13addf] Add caching to tmdbv3 requests.
* [fe97f23] In progress TMDB v3 grabber script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
231
231
            connect(m_visualModeTimer, SIGNAL(timeout()), this, SLOT(visEnable()));
232
232
        }
233
233
 
234
 
        m_mainvisual->setVisual(m_visualModes[m_currentVisual]);
235
 
 
236
 
        if (m_visualText)
237
 
            m_visualText->SetText(m_visualModes[m_currentVisual]);
 
234
        switchVisualizer(m_currentVisual);
238
235
 
239
236
        if (gPlayer->isPlaying())
240
237
            startVisualizer();
616
613
        }
617
614
        else if (action == "CYCLEVIS")
618
615
            cycleVisualizer();
 
616
        else if (action == "BLANKSCR")
 
617
        {
 
618
            // change to the blank visualizer
 
619
            if (m_mainvisual)
 
620
                switchVisualizer("Blank");
 
621
 
 
622
            // switch to the full screen visualiser view
 
623
            if (m_currentView != MV_VISUALIZER)
 
624
                switchView(MV_VISUALIZER);
 
625
        }
619
626
        else if (action == "VOLUMEDOWN")
620
627
            changeVolume(false);
621
628
        else if (action == "VOLUMEUP")
816
823
        m_visualModeTimer->start(m_visualModeDelay * 1000);
817
824
}
818
825
 
 
826
void MusicCommon::switchVisualizer(const QString &visual)
 
827
{
 
828
    switchVisualizer(m_visualModes.indexOf(visual));
 
829
}
 
830
 
 
831
void MusicCommon::switchVisualizer(int visual)
 
832
{
 
833
    if (!m_mainvisual)
 
834
        return;
 
835
 
 
836
    if (visual < 0 || visual > m_visualModes.count() - 1)
 
837
        visual = 0;
 
838
 
 
839
    m_currentVisual = visual;
 
840
 
 
841
    resetVisualiserTimer();
 
842
 
 
843
    m_mainvisual->setVisual(m_visualModes[m_currentVisual]);
 
844
 
 
845
    if (m_visualText)
 
846
        m_visualText->SetText(m_visualModes[m_currentVisual]);
 
847
}
 
848
 
819
849
void MusicCommon::cycleVisualizer(void)
820
850
{
821
851
    if (!m_mainvisual)
842
872
        }
843
873
 
844
874
        //Change to the new visualizer
845
 
        resetVisualiserTimer();
846
 
        m_mainvisual->setVisual("Blank");
847
 
        m_mainvisual->setVisual(m_visualModes[m_currentVisual]);
848
 
    }
849
 
    else if (m_visualModes.count() == 1 && m_visualModes[m_currentVisual] == "AlbumArt")
850
 
    {
851
 
        // If only the AlbumArt visualization is selected, then go ahead and
852
 
        // restart the visualization.  This will give AlbumArt the opportunity
853
 
        // to change images if there are multiple images available.
854
 
        resetVisualiserTimer();
855
 
        m_mainvisual->setVisual("Blank");
856
 
        m_mainvisual->setVisual(m_visualModes[m_currentVisual]);
857
 
    }
858
 
 
859
 
    if (m_visualText)
860
 
        m_visualText->SetText(m_visualModes[m_currentVisual]);
 
875
        switchVisualizer(m_currentVisual);
 
876
    }
861
877
}
862
878
 
863
879
void MusicCommon::startVisualizer(void)
1204
1220
    }
1205
1221
    else if (event->type() == DialogCompletionEvent::kEventType)
1206
1222
    {
1207
 
        DialogCompletionEvent *dce = dynamic_cast<DialogCompletionEvent*>(event);
1208
 
 
1209
 
        if (!dce)
1210
 
            return;
 
1223
        DialogCompletionEvent *dce = static_cast<DialogCompletionEvent*>(event);
1211
1224
 
1212
1225
        // make sure the user didn't ESCAPE out of the menu
1213
1226
        if (dce->GetResult() < 0)
1309
1322
        }
1310
1323
        else if (resultid == "repeatmenu")
1311
1324
        {
1312
 
            if (resulttext != tr("Cancel"))
1313
 
            {
1314
 
                int mode = dce->GetData().toInt();
1315
 
                gPlayer->setRepeatMode((MusicPlayer::RepeatMode) mode);
1316
 
                updateRepeatMode();
1317
 
            }
 
1325
            int mode = dce->GetData().toInt();
 
1326
            gPlayer->setRepeatMode((MusicPlayer::RepeatMode) mode);
 
1327
            updateRepeatMode();
1318
1328
        }
1319
1329
        else if (resultid == "shufflemenu")
1320
1330
        {
1321
 
            if (resulttext != tr("Cancel"))
1322
 
            {
1323
 
                int mode = dce->GetData().toInt();
1324
 
                gPlayer->setShuffleMode((MusicPlayer::ShuffleMode) mode);
1325
 
                updateShuffleMode();
1326
 
 
1327
 
                //TODO maybe this should be done using an event from the player?
1328
 
                // store id of current track
1329
 
                int curTrackID = -1;
1330
 
                if (gPlayer->getCurrentMetadata())
1331
 
                    curTrackID = gPlayer->getCurrentMetadata()->ID();
1332
 
 
1333
 
                updateUIPlaylist();
1334
 
 
1335
 
                if (!restorePosition(curTrackID))
1336
 
                    playFirstTrack();
1337
 
 
1338
 
                // need this to update the next track info
1339
 
                Metadata *curMeta = gPlayer->getCurrentMetadata();
1340
 
                if (curMeta)
1341
 
                    updateTrackInfo(curMeta);
1342
 
            }
 
1331
            int mode = dce->GetData().toInt();
 
1332
            gPlayer->setShuffleMode((MusicPlayer::ShuffleMode) mode);
 
1333
            updateShuffleMode();
 
1334
 
 
1335
            // store id of current track
 
1336
            int curTrackID = -1;
 
1337
            if (gPlayer->getCurrentMetadata())
 
1338
                curTrackID = gPlayer->getCurrentMetadata()->ID();
 
1339
 
 
1340
            updateUIPlaylist();
 
1341
 
 
1342
            if (!restorePosition(curTrackID))
 
1343
                playFirstTrack();
 
1344
 
 
1345
            // need this to update the next track info
 
1346
            Metadata *curMeta = gPlayer->getCurrentMetadata();
 
1347
            if (curMeta)
 
1348
                updateTrackInfo(curMeta);
1343
1349
        }
1344
1350
        else if (resultid == "exitmenu")
1345
1351
        {
1381
1387
                allTracks();
1382
1388
            else if (resulttext == tr("From CD"))
1383
1389
                fromCD();
1384
 
            else if (resulttext ==  tr("Tracks by current Artist"))
 
1390
            else if (resulttext ==  tr("Tracks By Current Artist"))
1385
1391
                byArtist();
1386
 
            else if (resulttext == tr("Tracks from current Genre"))
 
1392
            else if (resulttext == tr("Tracks From Current Genre"))
1387
1393
                byGenre();
1388
 
            else if (resulttext == tr("Tracks from current Album"))
 
1394
            else if (resulttext == tr("Tracks From Current Album"))
1389
1395
                byAlbum();
1390
 
            else if (resulttext == tr("Track from current Year"))
 
1396
            else if (resulttext == tr("Track From Current Year"))
1391
1397
                byYear();
1392
 
            else if (resulttext == tr("Tracks with same Title"))
 
1398
            else if (resulttext == tr("Tracks With Same Title"))
1393
1399
                byTitle();
1394
1400
        }
1395
1401
        else if (resultid == "playlistoptionsmenu")
1396
1402
        {
1397
 
            if (resulttext == tr("Replace"))
 
1403
            if (resulttext == tr("Replace Tracks"))
1398
1404
            {
1399
1405
                m_playlistOptions.insertPLOption = PL_REPLACE;
1400
 
                m_playlistOptions.removeDups = false;
1401
 
                doUpdatePlaylist();
1402
 
            }
1403
 
            else if (resulttext ==  tr("Insert after current track"))
1404
 
            {
1405
 
                m_playlistOptions.insertPLOption = PL_INSERTAFTERCURRENT;
1406
 
                doUpdatePlaylist();
1407
 
            }
1408
 
            else if (resulttext == tr("Append to end"))
1409
 
            {
1410
 
                m_playlistOptions.insertPLOption = PL_INSERTATEND;
1411
 
                doUpdatePlaylist();
1412
 
            }
1413
 
            else if (resulttext == tr("Add"))
 
1406
                doUpdatePlaylist();
 
1407
            }
 
1408
            else if (resulttext == tr("Add Tracks"))
1414
1409
            {
1415
1410
                m_playlistOptions.insertPLOption = PL_INSERTATEND;
1416
1411
                doUpdatePlaylist();
1423
1418
                m_currentVisual = dce->GetData().toInt();
1424
1419
 
1425
1420
                //Change to the new visualizer
1426
 
                resetVisualiserTimer();
1427
 
                m_mainvisual->setVisual(m_visualModes[m_currentVisual]);
1428
 
 
1429
 
                if (m_visualText)
1430
 
                    m_visualText->SetText(m_visualModes[m_currentVisual]);
 
1421
                switchVisualizer(m_currentVisual);
1431
1422
            }
1432
1423
        }
1433
1424
        else if (resultid == "addplaylist")
1524
1515
        m_currentTrack = gPlayer->getCurrentTrackPos();
1525
1516
 
1526
1517
        // if we have just removed the playing track from the playlist
1527
 
        // move to the next trackCount
 
1518
        // move to the next track
1528
1519
        if (gPlayer->getCurrentMetadata())
1529
1520
        {
1530
1521
            if (gPlayer->getCurrentMetadata()->ID() == (Metadata::IdType) trackID)
1620
1611
            }
1621
1612
        }
1622
1613
 
1623
 
        if (trackID == gPlayer->getCurrentMetadata()->ID())
 
1614
        if (gPlayer->getCurrentMetadata() && trackID == gPlayer->getCurrentMetadata()->ID())
1624
1615
            updateTrackInfo(gPlayer->getCurrentMetadata());
1625
1616
 
1626
1617
        // this will ensure the next track info gets updated
1627
 
        if (trackID == gPlayer->getNextMetadata()->ID())
 
1618
        if (gPlayer->getNextMetadata() && trackID == gPlayer->getNextMetadata()->ID())
1628
1619
            updateTrackInfo(gPlayer->getCurrentMetadata());
1629
1620
    }
1630
1621
    else if (event->type() == MusicPlayerEvent::AlbumArtChangedEvent)
2016
2007
    if (m_visualizerVideo)
2017
2008
        menu->AddItem(tr("Change Visualizer"), NULL, createVisualizerMenu());
2018
2009
 
2019
 
    menu->AddItem(tr("Cancel"));
2020
 
 
2021
2010
    return menu;
2022
2011
}
2023
2012
 
2037
2026
        menu->AddItem(tr("Search for Music"), qVariantFromValue((int)MV_SEARCH));
2038
2027
    if (m_currentView != MV_VISUALIZER)
2039
2028
        menu->AddItem(tr("Fullscreen Visualizer"), qVariantFromValue((int)MV_VISUALIZER));
2040
 
#if 0
2041
 
    menu->AddItem(tr("Lyrics"), qVariantFromValue((int)MV_LYRICS));
2042
 
    menu->AddItem(tr("Artist Information"), qVariantFromValue((int)MV_ARTISTINFO));
2043
 
#endif
2044
 
    menu->AddItem(tr("Cancel"));
2045
2029
 
2046
2030
    return menu;
2047
2031
}
2071
2055
            menu->AddItem(tr("Switch To Move Mode"));
2072
2056
    }
2073
2057
 
2074
 
    menu->AddItem(tr("Cancel"));
2075
 
 
2076
2058
    return menu;
2077
2059
}
2078
2060
 
2116
2098
    menu->AddItem(tr("Stop"));
2117
2099
    menu->AddItem(tr("Pause"));
2118
2100
 
2119
 
    menu->AddItem(tr("Cancel"));
2120
 
 
2121
2101
    return menu;
2122
2102
}
2123
2103
 
2131
2111
    menu->AddItem(tr("Track"), qVariantFromValue((int)MusicPlayer::REPEAT_TRACK));
2132
2112
    menu->AddItem(tr("All"),   qVariantFromValue((int)MusicPlayer::REPEAT_ALL));
2133
2113
 
2134
 
    menu->AddItem(tr("Cancel"));
2135
 
 
2136
2114
    return menu;
2137
2115
}
2138
2116
 
2148
2126
    menu->AddItem(tr("Album"),  qVariantFromValue((int)MusicPlayer::SHUFFLE_ALBUM));
2149
2127
    menu->AddItem(tr("Artist"), qVariantFromValue((int)MusicPlayer::SHUFFLE_ARTIST));
2150
2128
 
2151
 
    menu->AddItem(tr("Cancel"));
2152
 
 
2153
2129
    return menu;
2154
2130
}
2155
2131
 
2166
2142
 
2167
2143
    if (gPlayer->getCurrentMetadata())
2168
2144
    {
2169
 
        menu->AddItem(tr("Tracks by current Artist"));
2170
 
        menu->AddItem(tr("Tracks from current Album"));
2171
 
        menu->AddItem(tr("Tracks from current Genre"));
2172
 
        menu->AddItem(tr("Track from current Year"));
2173
 
        menu->AddItem(tr("Tracks with same Title"));
 
2145
        menu->AddItem(tr("Tracks By Current Artist"));
 
2146
        menu->AddItem(tr("Tracks From Current Album"));
 
2147
        menu->AddItem(tr("Tracks From Current Genre"));
 
2148
        menu->AddItem(tr("Track From Current Year"));
 
2149
        menu->AddItem(tr("Tracks With Same Title"));
2174
2150
    }
2175
2151
 
2176
 
    menu->AddItem(tr("Cancel"));
2177
 
 
2178
2152
    return menu;
2179
2153
}
2180
2154
 
2187
2161
    for (int x = 0; x < m_visualModes.count(); x++)
2188
2162
        menu->AddItem(m_visualModes.at(x), qVariantFromValue(x));
2189
2163
 
2190
 
    menu->AddItem(tr("Cancel"));
 
2164
    return menu;
 
2165
}
 
2166
 
 
2167
MythMenu* MusicCommon::createPlaylistOptionsMenu(void)
 
2168
{
 
2169
    QString label = tr("Add to Playlist Options");
 
2170
 
 
2171
    MythMenu *menu = new MythMenu(label, this, "playlistoptionsmenu");
 
2172
 
 
2173
    menu->AddItem(tr("Replace Tracks"));
 
2174
    menu->AddItem(tr("Add Tracks"));
2191
2175
 
2192
2176
    return menu;
2193
2177
}
2281
2265
    showPlaylistOptionsMenu();
2282
2266
}
2283
2267
 
2284
 
void MusicCommon::showPlaylistOptionsMenu(void)
 
2268
void MusicCommon::showPlaylistOptionsMenu(bool addMainMenu)
2285
2269
{
2286
 
    //FIXME: hard code these for the moment - remove later?
2287
2270
    m_playlistOptions.playPLOption = PL_CURRENT;
2288
 
    m_playlistOptions.removeDups = true;
2289
2271
 
2290
2272
    // Don't bother showing the dialog if the current playlist is empty
2291
2273
    if (gPlayer->getPlaylist()->getSongs().count() == 0)
2295
2277
        return;
2296
2278
    }
2297
2279
 
2298
 
    QString label = tr("Add to Playlist Options");
 
2280
    MythMenu *menu = createPlaylistOptionsMenu();
 
2281
 
 
2282
    if (addMainMenu)
 
2283
        menu->AddItem(tr("More Options"), NULL, createMainMenu());
2299
2284
 
2300
2285
    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
2301
2286
 
2302
 
    MythDialogBox *menu = new MythDialogBox(label, popupStack, "playlistoptionsmenu");
 
2287
    MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "playlistoptionsmenu");
2303
2288
 
2304
 
    if (!menu->Create())
2305
 
    {
 
2289
    if (menuPopup->Create())
 
2290
        popupStack->AddScreen(menuPopup);
 
2291
    else
2306
2292
        delete menu;
2307
 
        return;
2308
 
    }
2309
 
 
2310
 
    menu->SetReturnEvent(this, "playlistoptionsmenu");
2311
 
 
2312
 
    menu->AddButton(tr("Replace"));
2313
 
 
2314
 
    if (gPlayer->getShuffleMode() == MusicPlayer::SHUFFLE_OFF)
2315
 
    {
2316
 
        menu->AddButton(tr("Insert after current track"));
2317
 
        menu->AddButton(tr("Append to end"));
2318
 
    }
2319
 
    else
2320
 
        menu->AddButton(tr("Add"));
2321
 
 
2322
 
    menu->AddButton(tr("Cancel"));
2323
 
 
2324
 
    popupStack->AddScreen(menu);
2325
2293
}
2326
2294
 
2327
2295
void MusicCommon::doUpdatePlaylist(void)
2341
2309
    {
2342
2310
        // update playlist from quick playlist
2343
2311
        gMusicData->all_playlists->getActive()->fillSonglistFromQuery(
2344
 
                    m_whereClause, m_playlistOptions.removeDups,
 
2312
                    m_whereClause, true,
2345
2313
                    m_playlistOptions.insertPLOption, curTrackID);
2346
2314
        m_whereClause.clear();
2347
2315
    }
2349
2317
    {
2350
2318
        // update playlist from song list (from the playlist editor)
2351
2319
        gMusicData->all_playlists->getActive()->fillSonglistFromList(
2352
 
                    m_songList, m_playlistOptions.removeDups,
 
2320
                    m_songList, true,
2353
2321
                    m_playlistOptions.insertPLOption, curTrackID);
2354
2322
 
2355
2323
        m_songList.clear();
2356
2324
    }
2357
 
    else
2358
 
    {
2359
 
        // update playlist from smart playlist
2360
 
//        gMusicData->all_playlists->getActive()->fillSonglistFromSmartPlaylist(
2361
 
//                    curSmartPlaylistCategory, curSmartPlaylistName,
2362
 
//                    bRemoveDups, insertOption, curTrackID);
2363
 
    }
2364
2325
 
2365
2326
    updateUIPlaylist();
2366
2327
 
2380
2341
 
2381
2342
        case PL_FIRSTNEW:
2382
2343
        {
2383
 
            //TODO need to test these
2384
2344
            switch (m_playlistOptions.insertPLOption)
2385
2345
            {
2386
2346
                case PL_REPLACE: