forked from openlp/openlp
Now with pausing too!
This commit is contained in:
parent
c41e7c49df
commit
0d16b05779
@ -617,6 +617,9 @@ class AudioPlayer(QtCore.QObject):
|
||||
if len(self.playlist) > self.currentIndex:
|
||||
self.mediaObject.enqueue(self.playlist[self.currentIndex])
|
||||
|
||||
def connectVolumeSlider(self, slider):
|
||||
slider.setAudioOutput(self.audioObject)
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Reset the audio player, clearing the playlist and the queue.
|
||||
@ -632,8 +635,7 @@ class AudioPlayer(QtCore.QObject):
|
||||
"""
|
||||
log.debug(u'AudioPlayer.play() called')
|
||||
if self.currentIndex == -1:
|
||||
self.currentIndex += 1
|
||||
self.mediaObject.enqueue(self.playlist[self.currentIndex])
|
||||
self.onAboutToFinish()
|
||||
self.mediaObject.play()
|
||||
|
||||
def pause(self):
|
||||
|
@ -256,6 +256,13 @@ class SlideController(QtGui.QWidget):
|
||||
self.songMenu.setMenu(QtGui.QMenu(
|
||||
translate('OpenLP.SlideController', 'Go To'), self.toolbar))
|
||||
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
|
||||
# Stuff for items with background audio.
|
||||
#self.toolbar.addToolbarSeparator(u'Audio Separator')
|
||||
self.audioPauseItem = self.toolbar.addToolbarButton(
|
||||
u'Pause Audio', u':/slides/media_playback_pause.png',
|
||||
translate('OpenLP.SlideController', 'Pause audio.'),
|
||||
self.onAudioPauseClicked, True)
|
||||
self.audioPauseItem.setVisible(False)
|
||||
# Build the volumeSlider.
|
||||
self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
||||
self.volumeSlider.setTickInterval(1)
|
||||
@ -619,11 +626,14 @@ class SlideController(QtGui.QWidget):
|
||||
if self.isLive:
|
||||
self.songMenu.menu().clear()
|
||||
self.display.audioPlayer.reset()
|
||||
self.setAudioItemsVisibility(False)
|
||||
self.audioPauseItem.setChecked(False)
|
||||
if self.serviceItem.is_capable(ItemCapabilities.HasBackgroundAudio):
|
||||
log.debug(u'Starting to play...')
|
||||
self.display.audioPlayer.addToPlaylist(
|
||||
self.serviceItem.background_audio)
|
||||
self.display.audioPlayer.play()
|
||||
self.setAudioItemsVisibility(True)
|
||||
row = 0
|
||||
text = []
|
||||
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
|
||||
@ -1103,6 +1113,17 @@ class SlideController(QtGui.QWidget):
|
||||
self.playSlidesLoop.setChecked(False)
|
||||
self.onToggleLoop()
|
||||
|
||||
def setAudioItemsVisibility(self, visible):
|
||||
self.audioPauseItem.setVisible(visible)
|
||||
|
||||
def onAudioPauseClicked(self, checked):
|
||||
if not self.audioPauseItem.isVisible():
|
||||
return
|
||||
if checked:
|
||||
self.display.audioPlayer.pause()
|
||||
else:
|
||||
self.display.audioPlayer.play()
|
||||
|
||||
def timerEvent(self, event):
|
||||
"""
|
||||
If the timer event is for this window select next slide
|
||||
|
Loading…
Reference in New Issue
Block a user