forked from openlp/openlp
Fix bug when hit service live button, but nothing to go live. Add option to preview immediately in media manager. Add keyboard shortcuts to media manager
This commit is contained in:
parent
d220669e9b
commit
db68c0419f
@ -166,7 +166,7 @@ def build_icon(icon):
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
return button_icon
|
||||
|
||||
def context_menu_action(base, icon, text, slot):
|
||||
def context_menu_action(base, icon, text, slot, shortcuts=None):
|
||||
"""
|
||||
Utility method to help build context menus for plugins
|
||||
|
||||
@ -186,6 +186,8 @@ def context_menu_action(base, icon, text, slot):
|
||||
if icon:
|
||||
action.setIcon(build_icon(icon))
|
||||
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
|
||||
if shortcuts:
|
||||
action.setShortcuts(shortcuts)
|
||||
return action
|
||||
|
||||
def context_menu(base, icon, text):
|
||||
|
@ -101,6 +101,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.toolbar = None
|
||||
self.remoteTriggered = None
|
||||
self.singleServiceItem = True
|
||||
self.quickPreviewAllowed = False
|
||||
self.pageLayout = QtGui.QVBoxLayout(self)
|
||||
self.pageLayout.setSpacing(0)
|
||||
self.pageLayout.setMargin(0)
|
||||
@ -266,23 +267,25 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
context_menu_action(
|
||||
self.listView, u':/general/general_delete.png',
|
||||
self.plugin.getString(StringContent.Delete)[u'title'],
|
||||
self.onDeleteClick))
|
||||
self.onDeleteClick, [QtCore.Qt.Key_Delete]))
|
||||
self.listView.addAction(context_menu_separator(self.listView))
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.listView, u':/general/general_preview.png',
|
||||
self.plugin.getString(StringContent.Preview)[u'title'],
|
||||
self.onPreviewClick))
|
||||
self.onPreviewClick, [QtCore.Qt.Key_Enter]))
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.listView, u':/general/general_live.png',
|
||||
self.plugin.getString(StringContent.Live)[u'title'],
|
||||
self.onLiveClick))
|
||||
self.onLiveClick, [QtCore.Qt.ShiftModifier + \
|
||||
QtCore.Qt.Key_Enter, QtCore.Qt.ShiftModifier + \
|
||||
QtCore.Qt.Key_Return]))
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
self.listView, u':/general/general_add.png',
|
||||
self.plugin.getString(StringContent.Service)[u'title'],
|
||||
self.onAddClick))
|
||||
self.onAddClick, [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal]))
|
||||
if self.addToServiceItem:
|
||||
self.listView.addAction(
|
||||
context_menu_action(
|
||||
@ -293,6 +296,9 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||
self.onClickPressed)
|
||||
QtCore.QObject.connect(self.listView,
|
||||
QtCore.SIGNAL(u'itemSelectionChanged()'),
|
||||
self.onSelectionChange)
|
||||
|
||||
def initialise(self):
|
||||
"""
|
||||
@ -411,7 +417,16 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
else:
|
||||
self.onPreviewClick()
|
||||
|
||||
def onPreviewClick(self):
|
||||
def onSelectionChange(self):
|
||||
"""
|
||||
Allows the change of current item in the list to be actioned
|
||||
"""
|
||||
if QtCore.QSettings().value(u'advanced/single click preview',
|
||||
QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \
|
||||
and self.listView.selectedIndexes():
|
||||
self.onPreviewClick(True)
|
||||
|
||||
def onPreviewClick(self, keepFocus=False):
|
||||
"""
|
||||
Preview an item by building a service item then adding that service
|
||||
item to the preview slide controller.
|
||||
@ -426,6 +441,8 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
if serviceItem:
|
||||
serviceItem.from_plugin = True
|
||||
self.parent.previewController.addServiceItem(serviceItem)
|
||||
if keepFocus:
|
||||
self.listView.setFocus()
|
||||
|
||||
def onLiveClick(self):
|
||||
"""
|
||||
|
@ -67,6 +67,10 @@ class AdvancedTab(SettingsTab):
|
||||
self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
|
||||
self.uiLayout.addRow(self.doubleClickLiveCheckBox)
|
||||
self.singleClickPreviewCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.singleClickPreviewCheckBox.setObjectName(
|
||||
u'singleClickPreviewCheckBox')
|
||||
self.uiLayout.addRow(self.singleClickPreviewCheckBox)
|
||||
self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||
self.expandServiceItemCheckBox.setObjectName(
|
||||
u'expandServiceItemCheckBox')
|
||||
@ -130,6 +134,8 @@ class AdvancedTab(SettingsTab):
|
||||
'Remember active media manager tab on startup'))
|
||||
self.doubleClickLiveCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Double-click to send items straight to live'))
|
||||
self.singleClickPreviewCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Preview items when clicked in Media Manager'))
|
||||
self.expandServiceItemCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
'Expand new service items on creation'))
|
||||
self.enableAutoCloseCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||
@ -164,6 +170,9 @@ class AdvancedTab(SettingsTab):
|
||||
self.doubleClickLiveCheckBox.setChecked(
|
||||
settings.value(u'double click live',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.singleClickPreviewCheckBox.setChecked(
|
||||
settings.value(u'single click preview',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
self.expandServiceItemCheckBox.setChecked(
|
||||
settings.value(u'expand service item',
|
||||
QtCore.QVariant(False)).toBool())
|
||||
@ -193,6 +202,8 @@ class AdvancedTab(SettingsTab):
|
||||
QtCore.QVariant(self.mediaPluginCheckBox.isChecked()))
|
||||
settings.setValue(u'double click live',
|
||||
QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
|
||||
settings.setValue(u'single click preview',
|
||||
QtCore.QVariant(self.singleClickPreviewCheckBox.isChecked()))
|
||||
settings.setValue(u'expand service item',
|
||||
QtCore.QVariant(self.expandServiceItemCheckBox.isChecked()))
|
||||
settings.setValue(u'enable exit confirmation',
|
||||
|
@ -1110,6 +1110,9 @@ class ServiceManager(QtGui.QWidget):
|
||||
-1 is passed if the value is not set
|
||||
"""
|
||||
item, child = self.findServiceItem()
|
||||
# No items in service
|
||||
if item == -1:
|
||||
return
|
||||
if row != -1:
|
||||
child = row
|
||||
if self.serviceItems[item][u'service_item'].is_valid:
|
||||
|
@ -46,6 +46,7 @@ class CustomMediaItem(MediaManagerItem):
|
||||
self.IconPath = u'custom/custom'
|
||||
MediaManagerItem.__init__(self, parent, self, icon)
|
||||
self.singleServiceItem = False
|
||||
self.quickPreviewAllowed = True
|
||||
# Holds information about whether the edit is remotly triggered and
|
||||
# which Custom is required.
|
||||
self.remoteCustom = -1
|
||||
|
@ -46,6 +46,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||
def __init__(self, parent, plugin, icon):
|
||||
self.IconPath = u'images/image'
|
||||
MediaManagerItem.__init__(self, parent, self, icon)
|
||||
self.quickPreviewAllowed = True
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
|
||||
|
||||
|
@ -73,6 +73,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.remoteSong = -1
|
||||
self.editItem = None
|
||||
self.whitespace = re.compile(r'\W+', re.UNICODE)
|
||||
self.quickPreviewAllowed = True
|
||||
|
||||
def addEndHeaderBar(self):
|
||||
self.addToolbarSeparator()
|
||||
|
Loading…
Reference in New Issue
Block a user