forked from openlp/openlp
cleanup, correct settings tab
This commit is contained in:
parent
d39ecb8e8e
commit
82a14745e3
@ -405,7 +405,6 @@ class MainDisplay(QtGui.QGraphicsView):
|
||||
"""
|
||||
log.debug(u'showDisplay')
|
||||
self.frame.evaluateJavaScript('show_blank("show");')
|
||||
print "showDisplay", self.isHidden()
|
||||
if self.isHidden():
|
||||
self.setVisible(True)
|
||||
self.hideMode = None
|
||||
|
@ -849,7 +849,6 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Tell the plugin to hide the display screen.
|
||||
"""
|
||||
print "hidePlugin", hide
|
||||
log.debug(u'hidePlugin %s ', hide)
|
||||
if self.serviceItem is not None:
|
||||
if hide:
|
||||
|
@ -63,7 +63,7 @@ class MediaController(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
def load(self, display, path, volume):
|
||||
def load(self, display, path, volume, isBackground):
|
||||
"""
|
||||
Load a new media file and check if it is valid
|
||||
"""
|
||||
|
@ -152,30 +152,26 @@ class MediaManager(object):
|
||||
#stop running videos
|
||||
self.video_reset(controller)
|
||||
if controller.isLive:
|
||||
# if isBackground:
|
||||
# We are running a background theme
|
||||
controller.display.override[u'theme'] = u''
|
||||
controller.display.override[u'video'] = True
|
||||
if self.withLivePreview:
|
||||
display = controller.previewDisplay
|
||||
if self.check_file_type(display, videoPath, False):
|
||||
#check size of all media_widgets
|
||||
self.resize(controller)
|
||||
self.curDisplayMediaController[display] \
|
||||
.load(display, videoPath, volume)
|
||||
.load(display, videoPath, volume, isBackground)
|
||||
display = controller.display
|
||||
if self.check_file_type(display, videoPath, isBackground):
|
||||
#check size of all media_widgets
|
||||
self.resize(controller)
|
||||
isValid = self.curDisplayMediaController[display] \
|
||||
.load(display, videoPath, volume)
|
||||
.load(display, videoPath, volume, isBackground)
|
||||
else:
|
||||
display = controller.previewDisplay
|
||||
if self.check_file_type(display, videoPath, isBackground):
|
||||
#check size of all media_widgets
|
||||
self.resize(controller)
|
||||
isValid = self.curDisplayMediaController[display] \
|
||||
.load(display, videoPath, volume)
|
||||
.load(display, videoPath, volume, isBackground)
|
||||
if not isValid:
|
||||
#Media could not be loaded correctly
|
||||
critical_error_message_box(
|
||||
|
@ -131,28 +131,13 @@ class MediaMediaItem(MediaManagerItem):
|
||||
unicode(translate('MediaPlugin.MediaItem',
|
||||
'The file %s no longer exists.')) % filename)
|
||||
return False
|
||||
# File too big for processing
|
||||
if os.path.getsize(filename) <= 52428800: # 50MiB
|
||||
# self.mediaObject.play()
|
||||
# if not self.mediaStateWait(Phonon.Playing) \
|
||||
# or self.mediaObject.currentSource().type() \
|
||||
# == Phonon.MediaSource.Invalid:
|
||||
# # Due to string freeze, borrow a message from presentations
|
||||
# # This will be corrected in 1.9.6
|
||||
# self.mediaObject.stop()
|
||||
# critical_error_message_box(
|
||||
# translate('PresentationPlugin.MediaItem',
|
||||
# 'Unsupported File'),
|
||||
# unicode(translate('PresentationPlugin.MediaItem',
|
||||
# 'Unsupported File')))
|
||||
# #return False
|
||||
# self.mediaLength = self.mediaObject.totalTime() / 1000
|
||||
# self.mediaObject.stop()
|
||||
# service_item.media_length = self.mediaLength
|
||||
service_item.add_capability(
|
||||
self.mediaLength = 0
|
||||
service_item.media_length = self.mediaLength
|
||||
service_item.add_capability(
|
||||
ItemCapabilities.AllowsVariableStartTime)
|
||||
service_item.title = unicode(self.plugin.nameStrings[u'singular'])
|
||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||
#Receiver.send_message(u'media_video', [self.parent.liveController, filename, 0, False])
|
||||
# force a non-existent theme
|
||||
service_item.theme = -1
|
||||
frame = u':/media/image_clapperboard.png'
|
||||
|
@ -38,26 +38,32 @@ class MediaTab(SettingsTab):
|
||||
def setupUi(self):
|
||||
self.setObjectName(u'MediaTab')
|
||||
SettingsTab.setupUi(self)
|
||||
self.mediaLayoutWidget = QtGui.QWidget(self.leftColumn)
|
||||
self.mediaBackendLayout = QtGui.QVBoxLayout(self.mediaLayoutWidget)
|
||||
self.mediaBackendLayout.setObjectName(u'mediaBackendLayout')
|
||||
self.mediaBackendsGroupBox = QtGui.QGroupBox(self.mediaLayoutWidget)
|
||||
self.mediaBackendsGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||
self.mediaBackendsGroupBox.setObjectName(u'mediaBackendsGroupBox')
|
||||
self.mediaBackendsGroupLayout = QtGui.QVBoxLayout( \
|
||||
self.mediaBackendsGroupBox)
|
||||
self.mediaBackendsGroupLayout.setObjectName( \
|
||||
u'mediaBackendsGroupLayout')
|
||||
self.mediaBackendLayout = QtGui.QVBoxLayout(self.mediaBackendsGroupBox)
|
||||
self.mediaBackendLayout.setObjectName(u'mediaBackendLayout')
|
||||
self.usePhononCheckBox = QtGui.QCheckBox(self.mediaBackendsGroupBox)
|
||||
self.usePhononCheckBox.setObjectName(u'usePhononCheckBox')
|
||||
self.mediaBackendsGroupLayout.addWidget(self.usePhononCheckBox)
|
||||
self.mediaBackendLayout.addWidget(self.usePhononCheckBox)
|
||||
self.useVlcCheckBox = QtGui.QCheckBox(self.mediaBackendsGroupBox)
|
||||
self.useVlcCheckBox.setObjectName(u'useVlcCheckBox')
|
||||
self.mediaBackendsGroupLayout.addWidget(self.useVlcCheckBox)
|
||||
self.mediaBackendLayout.addWidget(self.mediaBackendsGroupBox)
|
||||
self.backendOrderLabel = QtGui.QLabel(self.mediaLayoutWidget)
|
||||
self.backendOrderLabel.setObjectName(u'backendOrderLabel')
|
||||
self.mediaBackendLayout.addWidget(self.backendOrderLabel)
|
||||
self.backendOrderlistWidget = QtGui.QListWidget(self.mediaLayoutWidget)
|
||||
self.mediaBackendLayout.addWidget(self.useVlcCheckBox)
|
||||
self.leftLayout.addWidget(self.mediaBackendsGroupBox)
|
||||
|
||||
self.backendOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||
self.backendOrderGroupBox.setObjectName(u'backendOrderGroupBox')
|
||||
self.backendOrderLayout = QtGui.QVBoxLayout(self.backendOrderGroupBox)
|
||||
self.backendOrderLayout.setObjectName(u'backendOrderLayout')
|
||||
self.backendOrderlistWidget = QtGui.QListWidget( \
|
||||
self.backendOrderGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.backendOrderlistWidget. \
|
||||
sizePolicy().hasHeightForWidth())
|
||||
self.backendOrderlistWidget.setSizePolicy(sizePolicy)
|
||||
|
||||
self.backendOrderlistWidget.setVerticalScrollBarPolicy( \
|
||||
QtCore.Qt.ScrollBarAsNeeded)
|
||||
self.backendOrderlistWidget.setHorizontalScrollBarPolicy( \
|
||||
@ -65,18 +71,19 @@ class MediaTab(SettingsTab):
|
||||
self.backendOrderlistWidget.setEditTriggers( \
|
||||
QtGui.QAbstractItemView.NoEditTriggers)
|
||||
self.backendOrderlistWidget.setObjectName(u'backendOrderlistWidget')
|
||||
self.mediaBackendLayout.addWidget(self.backendOrderlistWidget)
|
||||
self.orderingButtonLayout = QtGui.QHBoxLayout()
|
||||
self.backendOrderLayout.addWidget(self.backendOrderlistWidget)
|
||||
self.orderingButtonsWidget = QtGui.QWidget(self.backendOrderGroupBox)
|
||||
self.orderingButtonsWidget.setObjectName(u'orderingButtonsWidget')
|
||||
self.orderingButtonLayout = QtGui.QHBoxLayout(self.orderingButtonsWidget)
|
||||
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout')
|
||||
self.orderingDownButton = QtGui.QPushButton(self.mediaLayoutWidget)
|
||||
self.orderingDownButton = QtGui.QPushButton(self.orderingButtonsWidget)
|
||||
self.orderingDownButton.setObjectName(u'orderingDownButton')
|
||||
self.orderingButtonLayout.addWidget(self.orderingDownButton)
|
||||
self.orderingUpButton = QtGui.QPushButton(self.mediaLayoutWidget)
|
||||
self.orderingUpButton = QtGui.QPushButton(self.backendOrderGroupBox)
|
||||
self.orderingUpButton.setObjectName(u'orderingUpButton')
|
||||
self.orderingButtonLayout.addWidget(self.orderingUpButton)
|
||||
self.mediaBackendLayout.addLayout(self.orderingButtonLayout)
|
||||
|
||||
self.leftLayout.addWidget(self.mediaLayoutWidget)
|
||||
self.backendOrderLayout.addWidget(self.orderingButtonsWidget)
|
||||
self.leftLayout.addWidget(self.backendOrderGroupBox)
|
||||
self.leftLayout.addStretch()
|
||||
self.rightLayout.addStretch()
|
||||
QtCore.QObject.connect(self.usePhononCheckBox,
|
||||
@ -91,12 +98,14 @@ class MediaTab(SettingsTab):
|
||||
QtCore.SIGNAL(u'pressed()'), self.onOrderingDownButtonPressed)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.mediaBackendsGroupBox.setTitle(
|
||||
translate('MediaPlugin.MediaTab', 'Media Backends'))
|
||||
self.usePhononCheckBox.setText(
|
||||
translate('MediaPlugin.MediaTab', 'use Phonon'))
|
||||
self.useVlcCheckBox.setText(
|
||||
translate('MediaPlugin.MediaTab', 'use Vlc'))
|
||||
self.backendOrderLabel.setText(
|
||||
translate('MediaPlugin.MediaTab', 'Backend Order'))
|
||||
self.backendOrderGroupBox.setTitle(
|
||||
translate('MediaPlugin.MediaTab', 'Backends Order'))
|
||||
self.orderingDownButton.setText(
|
||||
translate('MediaPlugin.MediaTab', 'Down'))
|
||||
self.orderingUpButton.setText(
|
||||
@ -157,7 +166,7 @@ class MediaTab(SettingsTab):
|
||||
def save(self):
|
||||
oldBackendString = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/backends',
|
||||
QtCore.QVariant(True)).toString()
|
||||
QtCore.QVariant(u'Webkit')).toString()
|
||||
newBackendString = self.usedBackends.join(u',')
|
||||
if oldBackendString != newBackendString:
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/backends',
|
||||
|
@ -126,7 +126,7 @@ class PhononController(MediaController):
|
||||
u'video/x-wmv': [u'.wmv'],
|
||||
u'video/x-ms-wmv': [u'.wmv']}
|
||||
|
||||
def load(self, display, path, volume):
|
||||
def load(self, display, path, volume, isBackground):
|
||||
log.debug(u'load vid in Phonon Controller')
|
||||
display.mediaObject.setCurrentSource(Phonon.MediaSource(path))
|
||||
if not self.mediaStateWait(display, Phonon.StoppedState):
|
||||
@ -185,14 +185,17 @@ class PhononController(MediaController):
|
||||
|
||||
def update_ui(self, controller, display):
|
||||
controller.seekSlider.setMaximum(display.mediaObject.totalTime())
|
||||
if display.serviceItem.end_time > 0:
|
||||
if display.mediaObject.currentTime() > \
|
||||
display.serviceItem.end_time:
|
||||
self.stop(display)
|
||||
if display.serviceItem.start_time > 0:
|
||||
if display.mediaObject.currentTime() < \
|
||||
display.serviceItem.start_time:
|
||||
self.seek(display, self.serviceItem.start_time * 1000)
|
||||
if not controller.seekSlider.isSliderDown():
|
||||
controller.seekSlider.setSliderPosition( \
|
||||
display.mediaObject.currentTime())
|
||||
# if newState == Phonon.Playing \
|
||||
# and oldState != Phonon.Paused \
|
||||
# and self.serviceItem.start_time > 0:
|
||||
# # set start time in milliseconds
|
||||
# self.mediaObject.seek(self.serviceItem.start_time * 1000)
|
||||
|
||||
def get_supported_file_types(self):
|
||||
pass
|
||||
|
@ -121,7 +121,7 @@ class VlcController(MediaController):
|
||||
u'video/x-wmv': [u'.wmv'],
|
||||
u'video/x-ms-wmv': [u'.wmv']}
|
||||
|
||||
def load(self, display, path, volume):
|
||||
def load(self, display, path, volume, isBackground):
|
||||
log.debug(u'load vid in Vlc Controller')
|
||||
vol = float(volume) / float(10)
|
||||
# create the media
|
||||
|
@ -65,7 +65,7 @@ class WebkitController(MediaController):
|
||||
, u'*.ogg'
|
||||
, u'*.ogv'
|
||||
, u'*.webm'
|
||||
, u'*.swf', u'*.mpg', u'*.wmv'
|
||||
, u'*.swf', u'*.mpg', u'*.wmv', u'*.mpeg', u'*.avi'
|
||||
]
|
||||
|
||||
def setup(self, display, hasAudio):
|
||||
@ -79,17 +79,21 @@ class WebkitController(MediaController):
|
||||
def get_supported_file_types(self):
|
||||
pass
|
||||
|
||||
def load(self, display, path, volume):
|
||||
def load(self, display, path, volume, isBackground):
|
||||
log.debug(u'load vid in Webkit Controller')
|
||||
vol = float(volume) / float(10)
|
||||
if isBackground:
|
||||
loop = u'true'
|
||||
else:
|
||||
loop = u'false'
|
||||
display.webView.setVisible(True)
|
||||
if path.endswith(u'.swf'):
|
||||
js = u'show_flash("load","%s");' % \
|
||||
(path.replace(u'\\', u'\\\\'))
|
||||
self.isFlash = True
|
||||
else:
|
||||
js = u'show_video("init", "%s", %s, false);' % \
|
||||
(path.replace(u'\\', u'\\\\'), str(vol))
|
||||
js = u'show_video("init", "%s", %s, %s);' % \
|
||||
(path.replace(u'\\', u'\\\\'), str(vol), loop)
|
||||
self.isFlash = False
|
||||
display.frame.evaluateJavaScript(js)
|
||||
return True
|
||||
@ -99,6 +103,9 @@ class WebkitController(MediaController):
|
||||
display.webView.resize(display.size())
|
||||
|
||||
def play(self, display):
|
||||
display.override[u'theme'] = u''
|
||||
display.override[u'video'] = True
|
||||
display.webLoaded = True
|
||||
self.set_visible(display, True)
|
||||
if self.isFlash:
|
||||
display.frame.evaluateJavaScript(u'show_flash("play","");')
|
||||
|
Loading…
Reference in New Issue
Block a user