Add the option to start background audio paused (default is on).

This commit is contained in:
Raoul Snyman 2011-09-12 22:04:46 +02:00
parent 807aac95ee
commit 2b6e254b91
2 changed files with 25 additions and 1 deletions

View File

@ -170,6 +170,15 @@ class GeneralTab(SettingsTab):
self.customHeightValueEdit.setMaximum(9999)
self.displayLayout.addWidget(self.customHeightValueEdit, 4, 3)
self.rightLayout.addWidget(self.displayGroupBox)
# Background audio
self.audioGroupBox = QtGui.QGroupBox(self.rightColumn)
self.audioGroupBox.setObjectName(u'audioGroupBox')
self.audioLayout = QtGui.QVBoxLayout(self.audioGroupBox)
self.audioLayout.setObjectName(u'audioLayout')
self.startPausedCheckBox = QtGui.QCheckBox(self.audioGroupBox)
self.startPausedCheckBox.setObjectName(u'startPausedCheckBox')
self.audioLayout.addWidget(self.startPausedCheckBox)
self.rightLayout.addWidget(self.audioGroupBox)
self.rightLayout.addStretch()
# Signals and slots
QtCore.QObject.connect(self.overrideCheckBox,
@ -243,6 +252,10 @@ class GeneralTab(SettingsTab):
self.customYLabel.setText(translate('OpenLP.GeneralTab', 'Y'))
self.customHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height'))
self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width'))
self.audioGroupBox.setTitle(
translate('OpenLP.GeneralTab', 'Background Audio'))
self.startPausedCheckBox.setText(
translate('OpenLP.GeneralTab', 'Start background audio paused'))
def load(self):
"""
@ -290,6 +303,8 @@ class GeneralTab(SettingsTab):
QtCore.QVariant(self.screens.current[u'size'].height())).toInt()[0])
self.customWidthValueEdit.setValue(settings.value(u'width',
QtCore.QVariant(self.screens.current[u'size'].width())).toInt()[0])
self.startPausedCheckBox.setChecked(settings.value(
u'audio start paused', QtCore.QVariant(True)).toBool())
settings.endGroup()
self.customXValueEdit.setEnabled(self.overrideCheckBox.isChecked())
self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked())
@ -341,6 +356,8 @@ class GeneralTab(SettingsTab):
QtCore.QVariant(self.customWidthValueEdit.value()))
settings.setValue(u'override position',
QtCore.QVariant(self.overrideCheckBox.isChecked()))
settings.setValue(u'audio start paused',
QtCore.QVariant(self.startPausedCheckBox.isChecked()))
settings.endGroup()
# On save update the screens as well
self.postSetUp(True)

View File

@ -633,7 +633,14 @@ class SlideController(QtGui.QWidget):
log.debug(u'Starting to play...')
self.display.audioPlayer.addToPlaylist(
self.serviceItem.background_audio)
self.display.audioPlayer.play()
if QtCore.QSettings().value(
self.parent().generalSettingsSection + \
u'/audio start paused',
QtCore.QVariant(True)).toBool():
self.audioPauseItem.setChecked(True)
self.display.audioPlayer.pause()
else:
self.display.audioPlayer.play()
self.setAudioItemsVisibility(True)
row = 0
text = []