forked from openlp/openlp
Make 'continuous loop' button into a selection ('loop' or 'play to end')
bzr-revno: 1589
This commit is contained in:
commit
7c3f7a2358
@ -66,7 +66,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
float(self.screens.current[u'size'].height())
|
float(self.screens.current[u'size'].height())
|
||||||
self.image_manager = self.parent.image_manager
|
self.image_manager = self.parent.image_manager
|
||||||
self.loopList = [
|
self.loopList = [
|
||||||
u'Start Loop',
|
u'Play Slides Menu',
|
||||||
u'Loop Separator',
|
u'Loop Separator',
|
||||||
u'Image SpinBox'
|
u'Image SpinBox'
|
||||||
]
|
]
|
||||||
@ -153,6 +153,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
context=QtCore.Qt.WidgetWithChildrenShortcut)
|
context=QtCore.Qt.WidgetWithChildrenShortcut)
|
||||||
self.toolbar.addToolbarSeparator(u'Close Separator')
|
self.toolbar.addToolbarSeparator(u'Close Separator')
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
|
# Hide Menu
|
||||||
self.hideMenu = QtGui.QToolButton(self.toolbar)
|
self.hideMenu = QtGui.QToolButton(self.toolbar)
|
||||||
self.hideMenu.setText(translate('OpenLP.SlideController', 'Hide'))
|
self.hideMenu.setText(translate('OpenLP.SlideController', 'Hide'))
|
||||||
self.hideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
|
self.hideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
|
||||||
@ -180,27 +181,34 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.hideMenu.menu().addAction(self.themeScreen)
|
self.hideMenu.menu().addAction(self.themeScreen)
|
||||||
self.hideMenu.menu().addAction(self.desktopScreen)
|
self.hideMenu.menu().addAction(self.desktopScreen)
|
||||||
self.toolbar.addToolbarSeparator(u'Loop Separator')
|
self.toolbar.addToolbarSeparator(u'Loop Separator')
|
||||||
startLoop = self.toolbar.addToolbarButton(
|
# Play Slides Menu
|
||||||
# Does not need translating - control string.
|
self.playSlidesMenu = QtGui.QToolButton(self.toolbar)
|
||||||
u'Start Loop', u':/media/media_time.png',
|
self.playSlidesMenu.setText(translate('OpenLP.SlideController',
|
||||||
translate('OpenLP.SlideController', 'Enable timed slides.'),
|
'Play Slides'))
|
||||||
self.onStartLoop)
|
self.playSlidesMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
|
||||||
startLoop.setObjectName(u'startLoop')
|
self.toolbar.addToolbarWidget(u'Play Slides Menu',
|
||||||
action_list = ActionList.get_instance()
|
self.playSlidesMenu)
|
||||||
action_list.add_action(startLoop, UiStrings().LiveToolbar)
|
self.playSlidesMenu.setMenu(QtGui.QMenu(
|
||||||
stopLoop = self.toolbar.addToolbarButton(
|
translate('OpenLP.SlideController', 'Play Slides'),
|
||||||
# Does not need translating - control string.
|
self.toolbar))
|
||||||
u'Stop Loop', u':/media/media_stop.png',
|
self.playSlidesLoop = shortcut_action(self.playSlidesMenu,
|
||||||
translate('OpenLP.SlideController', 'Stop timed slides.'),
|
u'playSlidesLoop', [], self.onPlaySlidesLoop,
|
||||||
self.onStopLoop)
|
u':/media/media_time.png', False, UiStrings().LiveToolbar)
|
||||||
stopLoop.setObjectName(u'stopLoop')
|
self.playSlidesLoop.setText(
|
||||||
action_list.add_action(stopLoop, UiStrings().LiveToolbar)
|
translate('OpenLP.SlideController', 'Play Slides in Loop'))
|
||||||
self.toogleLoop = shortcut_action(self, u'toogleLoop',
|
self.playSlidesOnce = shortcut_action(self.playSlidesMenu,
|
||||||
[QtGui.QKeySequence(u'L')], self.onToggleLoop,
|
u'playSlidesOnce', [], self.onPlaySlidesOnce,
|
||||||
category=UiStrings().LiveToolbar)
|
u':/media/media_time.png', False, UiStrings().LiveToolbar)
|
||||||
self.toogleLoop.setText(translate('OpenLP.SlideController',
|
self.playSlidesOnce.setText(
|
||||||
'Start/Stop continuous loop'))
|
translate('OpenLP.SlideController', 'Play Slides to End'))
|
||||||
self.addAction(self.toogleLoop)
|
if QtCore.QSettings().value(self.parent.generalSettingsSection +
|
||||||
|
u'/enable slide loop', QtCore.QVariant(True)).toBool():
|
||||||
|
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
|
||||||
|
else:
|
||||||
|
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
|
||||||
|
self.playSlidesMenu.menu().addAction(self.playSlidesLoop)
|
||||||
|
self.playSlidesMenu.menu().addAction(self.playSlidesOnce)
|
||||||
|
# Loop Delay Spinbox
|
||||||
self.delaySpinBox = QtGui.QSpinBox()
|
self.delaySpinBox = QtGui.QSpinBox()
|
||||||
self.delaySpinBox.setRange(1, 180)
|
self.delaySpinBox.setRange(1, 180)
|
||||||
self.toolbar.addToolbarWidget(u'Image SpinBox', self.delaySpinBox)
|
self.toolbar.addToolbarWidget(u'Image SpinBox', self.delaySpinBox)
|
||||||
@ -321,7 +329,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
|
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
|
||||||
self.receiveSpinDelay)
|
self.receiveSpinDelay)
|
||||||
self.toolbar.makeWidgetsInvisible(self.loopList)
|
self.toolbar.makeWidgetsInvisible(self.loopList)
|
||||||
self.toolbar.actions[u'Stop Loop'].setVisible(False)
|
|
||||||
else:
|
else:
|
||||||
QtCore.QObject.connect(self.previewListWidget,
|
QtCore.QObject.connect(self.previewListWidget,
|
||||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||||
@ -496,10 +503,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.mediabar.setVisible(False)
|
self.mediabar.setVisible(False)
|
||||||
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
|
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
|
||||||
self.toolbar.makeWidgetsInvisible(self.loopList)
|
self.toolbar.makeWidgetsInvisible(self.loopList)
|
||||||
self.toogleLoop.setEnabled(False)
|
|
||||||
self.toolbar.actions[u'Start Loop'].setEnabled(False)
|
|
||||||
self.toolbar.actions[u'Stop Loop'].setEnabled(False)
|
|
||||||
self.toolbar.actions[u'Stop Loop'].setVisible(False)
|
|
||||||
if item.is_text():
|
if item.is_text():
|
||||||
if QtCore.QSettings().value(
|
if QtCore.QSettings().value(
|
||||||
self.parent.songsSettingsSection + u'/display songbar',
|
self.parent.songsSettingsSection + u'/display songbar',
|
||||||
@ -508,9 +511,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
if item.is_capable(ItemCapabilities.AllowsLoop) and \
|
if item.is_capable(ItemCapabilities.AllowsLoop) and \
|
||||||
len(item.get_frames()) > 1:
|
len(item.get_frames()) > 1:
|
||||||
self.toolbar.makeWidgetsVisible(self.loopList)
|
self.toolbar.makeWidgetsVisible(self.loopList)
|
||||||
self.toogleLoop.setEnabled(True)
|
|
||||||
self.toolbar.actions[u'Start Loop'].setEnabled(True)
|
|
||||||
self.toolbar.actions[u'Stop Loop'].setEnabled(True)
|
|
||||||
if item.is_media():
|
if item.is_media():
|
||||||
self.toolbar.setVisible(False)
|
self.toolbar.setVisible(False)
|
||||||
self.mediabar.setVisible(True)
|
self.mediabar.setVisible(True)
|
||||||
@ -943,7 +943,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
rect.y(), rect.width(), rect.height())
|
rect.y(), rect.width(), rect.height())
|
||||||
self.slidePreview.setPixmap(winimg)
|
self.slidePreview.setPixmap(winimg)
|
||||||
|
|
||||||
def onSlideSelectedNext(self):
|
def onSlideSelectedNext(self, wrap=None):
|
||||||
"""
|
"""
|
||||||
Go to the next slide.
|
Go to the next slide.
|
||||||
"""
|
"""
|
||||||
@ -956,8 +956,11 @@ class SlideController(QtGui.QWidget):
|
|||||||
else:
|
else:
|
||||||
row = self.previewListWidget.currentRow() + 1
|
row = self.previewListWidget.currentRow() + 1
|
||||||
if row == self.previewListWidget.rowCount():
|
if row == self.previewListWidget.rowCount():
|
||||||
if QtCore.QSettings().value(self.parent.generalSettingsSection +
|
if wrap is None:
|
||||||
u'/enable slide loop', QtCore.QVariant(True)).toBool():
|
wrap = QtCore.QSettings().value(
|
||||||
|
self.parent.generalSettingsSection +
|
||||||
|
u'/enable slide loop', QtCore.QVariant(True)).toBool()
|
||||||
|
if wrap:
|
||||||
row = 0
|
row = 0
|
||||||
else:
|
else:
|
||||||
row = self.previewListWidget.rowCount() - 1
|
row = self.previewListWidget.rowCount() - 1
|
||||||
@ -1006,11 +1009,11 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.previewListWidget.rowCount() - 1)
|
self.previewListWidget.rowCount() - 1)
|
||||||
self.slideSelected()
|
self.slideSelected()
|
||||||
|
|
||||||
def onToggleLoop(self, toggled):
|
def onToggleLoop(self):
|
||||||
"""
|
"""
|
||||||
Toggles the loop state.
|
Toggles the loop state.
|
||||||
"""
|
"""
|
||||||
if self.toolbar.actions[u'Start Loop'].isVisible():
|
if self.playSlidesLoop.isChecked() or self.playSlidesOnce.isChecked():
|
||||||
self.onStartLoop()
|
self.onStartLoop()
|
||||||
else:
|
else:
|
||||||
self.onStopLoop()
|
self.onStopLoop()
|
||||||
@ -1022,8 +1025,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
if self.previewListWidget.rowCount() > 1:
|
if self.previewListWidget.rowCount() > 1:
|
||||||
self.timer_id = self.startTimer(
|
self.timer_id = self.startTimer(
|
||||||
int(self.delaySpinBox.value()) * 1000)
|
int(self.delaySpinBox.value()) * 1000)
|
||||||
self.toolbar.actions[u'Stop Loop'].setVisible(True)
|
|
||||||
self.toolbar.actions[u'Start Loop'].setVisible(False)
|
|
||||||
|
|
||||||
def onStopLoop(self):
|
def onStopLoop(self):
|
||||||
"""
|
"""
|
||||||
@ -1032,15 +1033,39 @@ class SlideController(QtGui.QWidget):
|
|||||||
if self.timer_id != 0:
|
if self.timer_id != 0:
|
||||||
self.killTimer(self.timer_id)
|
self.killTimer(self.timer_id)
|
||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
self.toolbar.actions[u'Start Loop'].setVisible(True)
|
|
||||||
self.toolbar.actions[u'Stop Loop'].setVisible(False)
|
def onPlaySlidesLoop(self, checked=None):
|
||||||
|
"""
|
||||||
|
Start or stop 'Play Slides in Loop'
|
||||||
|
"""
|
||||||
|
if checked is None:
|
||||||
|
checked = self.playSlidesLoop.isChecked()
|
||||||
|
else:
|
||||||
|
self.playSlidesLoop.setChecked(checked)
|
||||||
|
log.debug(u'onPlaySlidesLoop %s' % checked)
|
||||||
|
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
|
||||||
|
self.playSlidesOnce.setChecked(False)
|
||||||
|
self.onToggleLoop()
|
||||||
|
|
||||||
|
def onPlaySlidesOnce(self, checked=None):
|
||||||
|
"""
|
||||||
|
Start or stop 'Play Slides to End'
|
||||||
|
"""
|
||||||
|
if checked is None:
|
||||||
|
checked = self.playSlidesOnce.isChecked()
|
||||||
|
else:
|
||||||
|
self.playSlidesOnce.setChecked(checked)
|
||||||
|
log.debug(u'onPlaySlidesOnce %s' % checked)
|
||||||
|
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
|
||||||
|
self.playSlidesLoop.setChecked(False)
|
||||||
|
self.onToggleLoop()
|
||||||
|
|
||||||
def timerEvent(self, event):
|
def timerEvent(self, event):
|
||||||
"""
|
"""
|
||||||
If the timer event is for this window select next slide
|
If the timer event is for this window select next slide
|
||||||
"""
|
"""
|
||||||
if event.timerId() == self.timer_id:
|
if event.timerId() == self.timer_id:
|
||||||
self.onSlideSelectedNext()
|
self.onSlideSelectedNext(self.playSlidesLoop.isChecked())
|
||||||
|
|
||||||
def onEditSong(self):
|
def onEditSong(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user