forked from openlp/openlp
Added repeating of the background audio track list.
Migrated the songs plugin configuration tab to use the proper camelCase names.
This commit is contained in:
parent
5cf9a83657
commit
d14a316309
@ -175,6 +175,9 @@ class GeneralTab(SettingsTab):
|
||||
self.startPausedCheckBox = QtGui.QCheckBox(self.audioGroupBox)
|
||||
self.startPausedCheckBox.setObjectName(u'startPausedCheckBox')
|
||||
self.audioLayout.addWidget(self.startPausedCheckBox)
|
||||
self.repeatListCheckBox = QtGui.QCheckBox(self.audioGroupBox)
|
||||
self.repeatListCheckBox.setObjectName(u'repeatListCheckBox')
|
||||
self.audioLayout.addWidget(self.repeatListCheckBox)
|
||||
self.rightLayout.addWidget(self.audioGroupBox)
|
||||
self.rightLayout.addStretch()
|
||||
# Signals and slots
|
||||
@ -251,6 +254,8 @@ class GeneralTab(SettingsTab):
|
||||
translate('OpenLP.GeneralTab', 'Background Audio'))
|
||||
self.startPausedCheckBox.setText(
|
||||
translate('OpenLP.GeneralTab', 'Start background audio paused'))
|
||||
self.repeatListCheckBox.setText(
|
||||
translate('OpenLP.GeneralTab', 'Repeat track list'))
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
@ -298,6 +303,8 @@ class GeneralTab(SettingsTab):
|
||||
QtCore.QVariant(self.screens.current[u'size'].width())).toInt()[0])
|
||||
self.startPausedCheckBox.setChecked(settings.value(
|
||||
u'audio start paused', QtCore.QVariant(True)).toBool())
|
||||
self.repeatListCheckBox.setChecked(settings.value(
|
||||
u'audio repeat list', QtCore.QVariant(False)).toBool())
|
||||
settings.endGroup()
|
||||
self.customXValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||
self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||
@ -350,6 +357,8 @@ class GeneralTab(SettingsTab):
|
||||
QtCore.QVariant(self.overrideCheckBox.isChecked()))
|
||||
settings.setValue(u'audio start paused',
|
||||
QtCore.QVariant(self.startPausedCheckBox.isChecked()))
|
||||
settings.setValue(u'audio repeat list',
|
||||
QtCore.QVariant(self.repeatListCheckBox.isChecked()))
|
||||
settings.endGroup()
|
||||
# On save update the screens as well
|
||||
self.postSetUp(True)
|
||||
|
@ -493,11 +493,14 @@ class AudioPlayer(QtCore.QObject):
|
||||
QtCore.QObject.__init__(self, parent)
|
||||
self.currentIndex = -1
|
||||
self.playlist = []
|
||||
self.repeat = False
|
||||
self.mediaObject = Phonon.MediaObject()
|
||||
self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory)
|
||||
Phonon.createPath(self.mediaObject, self.audioObject)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'aboutToFinish()'), self.onAboutToFinish)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'finished()'), self.onFinished)
|
||||
|
||||
def __del__(self):
|
||||
"""
|
||||
@ -516,6 +519,14 @@ class AudioPlayer(QtCore.QObject):
|
||||
if len(self.playlist) > self.currentIndex:
|
||||
self.mediaObject.enqueue(self.playlist[self.currentIndex])
|
||||
|
||||
def onFinished(self):
|
||||
if self.repeat:
|
||||
log.debug(u'Repeat is enabled... here we go again!')
|
||||
self.mediaObject.clearQueue()
|
||||
self.mediaObject.clear()
|
||||
self.currentIndex = -1
|
||||
self.play()
|
||||
|
||||
def connectVolumeSlider(self, slider):
|
||||
slider.setAudioOutput(self.audioObject)
|
||||
|
||||
@ -562,4 +573,3 @@ class AudioPlayer(QtCore.QObject):
|
||||
filenames = [filenames]
|
||||
for filename in filenames:
|
||||
self.playlist.append(Phonon.MediaSource(filename))
|
||||
|
||||
|
@ -279,11 +279,26 @@ class SlideController(Controller):
|
||||
translate('OpenLP.SlideController', 'Go To'), self.toolbar))
|
||||
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
|
||||
# Stuff for items with background audio.
|
||||
self.audioPauseItem = self.toolbar.addToolbarButton(
|
||||
u'Pause Audio', u':/slides/media_playback_pause.png',
|
||||
translate('OpenLP.SlideController', 'Pause audio.'),
|
||||
self.onAudioPauseClicked, True)
|
||||
self.audioPauseItem = QtGui.QToolButton(self.toolbar)
|
||||
self.audioPauseItem.setIcon(QtGui.QIcon(u':/slides/media_playback_pause.png'))
|
||||
#u'Pause Audio', ,
|
||||
self.audioPauseItem.setText(translate('OpenLP.SlideController',
|
||||
'Pause audio.'))
|
||||
self.audioPauseItem.setCheckable(True)
|
||||
self.toolbar.addToolbarWidget(u'Pause Audio', self.audioPauseItem)
|
||||
QtCore.QObject.connect(self.audioPauseItem,
|
||||
QtCore.SIGNAL(u'clicked(bool)'), self.onAudioPauseClicked)
|
||||
self.audioPauseItem.setVisible(False)
|
||||
audioMenu = QtGui.QMenu(
|
||||
translate('OpenLP.SlideController', 'Background Audio'),
|
||||
self.toolbar)
|
||||
trackMenu = audioMenu.addMenu(
|
||||
translate('OpenLP.SlideController', 'Tracks'))
|
||||
trackMenu.addAction('first song')
|
||||
trackMenu.addAction('second song')
|
||||
trackMenu.addAction('third song')
|
||||
self.audioPauseItem.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
|
||||
self.audioPauseItem.setMenu(audioMenu)
|
||||
# Screen preview area
|
||||
self.previewFrame = QtGui.QFrame(self.splitter)
|
||||
self.previewFrame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
|
||||
@ -860,10 +875,15 @@ class SlideController(Controller):
|
||||
self.display.audioPlayer.reset()
|
||||
self.setAudioItemsVisibility(False)
|
||||
self.audioPauseItem.setChecked(False)
|
||||
# If the current item has background audio
|
||||
if self.serviceItem.is_capable(ItemCapabilities.HasBackgroundAudio):
|
||||
log.debug(u'Starting to play...')
|
||||
self.display.audioPlayer.addToPlaylist(
|
||||
self.serviceItem.background_audio)
|
||||
self.display.audioPlayer.repeat = QtCore.QSettings().value(
|
||||
self.parent().generalSettingsSection + \
|
||||
u'/audio repeat list',
|
||||
QtCore.QVariant(False)).toBool()
|
||||
if QtCore.QSettings().value(
|
||||
self.parent().generalSettingsSection + \
|
||||
u'/audio start paused',
|
||||
|
@ -33,56 +33,56 @@ class SongsTab(SettingsTab):
|
||||
"""
|
||||
SongsTab is the Songs settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self, parent, title, visible_title, icon_path):
|
||||
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
|
||||
|
||||
def setupUi(self):
|
||||
"""
|
||||
Set up the configuration tab UI.
|
||||
"""
|
||||
self.setObjectName(u'SongsTab')
|
||||
SettingsTab.setupUi(self)
|
||||
self.SongsModeGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||
self.SongsModeGroupBox.setObjectName(u'SongsModeGroupBox')
|
||||
self.SongsModeLayout = QtGui.QVBoxLayout(self.SongsModeGroupBox)
|
||||
self.SongsModeLayout.setObjectName(u'SongsModeLayout')
|
||||
self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
|
||||
self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox')
|
||||
self.SongsModeLayout.addWidget(self.SearchAsTypeCheckBox)
|
||||
self.SongBarActiveCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
|
||||
self.SongBarActiveCheckBox.setObjectName(u'SongBarActiveCheckBox')
|
||||
self.SongsModeLayout.addWidget(self.SongBarActiveCheckBox)
|
||||
self.SongUpdateOnEditCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
|
||||
self.SongUpdateOnEditCheckBox.setObjectName(u'SongUpdateOnEditCheckBox')
|
||||
self.SongsModeLayout.addWidget(self.SongUpdateOnEditCheckBox)
|
||||
self.SongAddFromServiceCheckBox = QtGui.QCheckBox(
|
||||
self.SongsModeGroupBox)
|
||||
self.SongAddFromServiceCheckBox.setObjectName(
|
||||
u'SongAddFromServiceCheckBox')
|
||||
self.SongsModeLayout.addWidget(self.SongAddFromServiceCheckBox)
|
||||
self.leftLayout.addWidget(self.SongsModeGroupBox)
|
||||
self.modeGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||
self.modeGroupBox.setObjectName(u'modeGroupBox')
|
||||
self.modeLayout = QtGui.QVBoxLayout(self.modeGroupBox)
|
||||
self.modeLayout.setObjectName(u'modeLayout')
|
||||
self.searchAsTypeCheckBox = QtGui.QCheckBox(self.modeGroupBox)
|
||||
self.searchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox')
|
||||
self.modeLayout.addWidget(self.searchAsTypeCheckBox)
|
||||
self.toolBarActiveCheckBox = QtGui.QCheckBox(self.modeGroupBox)
|
||||
self.toolBarActiveCheckBox.setObjectName(u'toolBarActiveCheckBox')
|
||||
self.modeLayout.addWidget(self.toolBarActiveCheckBox)
|
||||
self.updateOnEditCheckBox = QtGui.QCheckBox(self.modeGroupBox)
|
||||
self.updateOnEditCheckBox.setObjectName(u'updateOnEditCheckBox')
|
||||
self.modeLayout.addWidget(self.updateOnEditCheckBox)
|
||||
self.addFromServiceCheckBox = QtGui.QCheckBox(
|
||||
self.modeGroupBox)
|
||||
self.addFromServiceCheckBox.setObjectName(
|
||||
u'addFromServiceCheckBox')
|
||||
self.modeLayout.addWidget(self.addFromServiceCheckBox)
|
||||
self.leftLayout.addWidget(self.modeGroupBox)
|
||||
self.leftLayout.addStretch()
|
||||
self.rightLayout.addStretch()
|
||||
QtCore.QObject.connect(self.SearchAsTypeCheckBox,
|
||||
QtCore.QObject.connect(self.searchAsTypeCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onSearchAsTypeCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.SongBarActiveCheckBox,
|
||||
QtCore.QObject.connect(self.toolBarActiveCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onSongBarActiveCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.SongUpdateOnEditCheckBox,
|
||||
self.onToolBarActiveCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.updateOnEditCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onSongUpdateOnEditCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.SongAddFromServiceCheckBox,
|
||||
self.onUpdateOnEditCheckBoxChanged)
|
||||
QtCore.QObject.connect(self.addFromServiceCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onSongAddFromServiceCheckBoxChanged)
|
||||
self.onAddFromServiceCheckBoxChanged)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.SongsModeGroupBox.setTitle(
|
||||
self.modeGroupBox.setTitle(
|
||||
translate('SongsPlugin.SongsTab', 'Songs Mode'))
|
||||
self.SearchAsTypeCheckBox.setText(
|
||||
self.searchAsTypeCheckBox.setText(
|
||||
translate('SongsPlugin.SongsTab', 'Enable search as you type'))
|
||||
self.SongBarActiveCheckBox.setText(translate('SongsPlugin.SongsTab',
|
||||
self.toolBarActiveCheckBox.setText(translate('SongsPlugin.SongsTab',
|
||||
'Display verses on live tool bar'))
|
||||
self.SongUpdateOnEditCheckBox.setText(
|
||||
self.updateOnEditCheckBox.setText(
|
||||
translate('SongsPlugin.SongsTab', 'Update service from song edit'))
|
||||
self.SongAddFromServiceCheckBox.setText(
|
||||
self.addFromServiceCheckBox.setText(
|
||||
translate('SongsPlugin.SongsTab',
|
||||
'Add missing songs when opening service'))
|
||||
|
||||
@ -92,19 +92,19 @@ class SongsTab(SettingsTab):
|
||||
if check_state == QtCore.Qt.Checked:
|
||||
self.song_search = True
|
||||
|
||||
def onSongBarActiveCheckBoxChanged(self, check_state):
|
||||
self.song_bar = False
|
||||
def onToolBarActiveCheckBoxChanged(self, check_state):
|
||||
self.tool_bar = False
|
||||
# we have a set value convert to True/False
|
||||
if check_state == QtCore.Qt.Checked:
|
||||
self.song_bar = True
|
||||
self.tool_bar = True
|
||||
|
||||
def onSongUpdateOnEditCheckBoxChanged(self, check_state):
|
||||
def onUpdateOnEditCheckBoxChanged(self, check_state):
|
||||
self.update_edit = False
|
||||
# we have a set value convert to True/False
|
||||
if check_state == QtCore.Qt.Checked:
|
||||
self.update_edit = True
|
||||
|
||||
def onSongAddFromServiceCheckBoxChanged(self, check_state):
|
||||
def onAddFromServiceCheckBoxChanged(self, check_state):
|
||||
self.update_load = False
|
||||
# we have a set value convert to True/False
|
||||
if check_state == QtCore.Qt.Checked:
|
||||
@ -115,23 +115,23 @@ class SongsTab(SettingsTab):
|
||||
settings.beginGroup(self.settingsSection)
|
||||
self.song_search = settings.value(
|
||||
u'search as type', QtCore.QVariant(False)).toBool()
|
||||
self.song_bar = settings.value(
|
||||
self.tool_bar = settings.value(
|
||||
u'display songbar', QtCore.QVariant(True)).toBool()
|
||||
self.update_edit = settings.value(
|
||||
u'update service on edit', QtCore.QVariant(False)).toBool()
|
||||
self.update_load = settings.value(
|
||||
u'add song from service', QtCore.QVariant(True)).toBool()
|
||||
self.SearchAsTypeCheckBox.setChecked(self.song_search)
|
||||
self.SongBarActiveCheckBox.setChecked(self.song_bar)
|
||||
self.SongUpdateOnEditCheckBox.setChecked(self.update_edit)
|
||||
self.SongAddFromServiceCheckBox.setChecked(self.update_load)
|
||||
self.searchAsTypeCheckBox.setChecked(self.song_search)
|
||||
self.toolBarActiveCheckBox.setChecked(self.tool_bar)
|
||||
self.updateOnEditCheckBox.setChecked(self.update_edit)
|
||||
self.addFromServiceCheckBox.setChecked(self.update_load)
|
||||
settings.endGroup()
|
||||
|
||||
def save(self):
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.settingsSection)
|
||||
settings.setValue(u'search as type', QtCore.QVariant(self.song_search))
|
||||
settings.setValue(u'display songbar', QtCore.QVariant(self.song_bar))
|
||||
settings.setValue(u'display songbar', QtCore.QVariant(self.tool_bar))
|
||||
settings.setValue(u'update service on edit',
|
||||
QtCore.QVariant(self.update_edit))
|
||||
settings.setValue(u'add song from service',
|
||||
|
Loading…
Reference in New Issue
Block a user