forked from openlp/openlp
bugfixing
This commit is contained in:
parent
870a70ab3a
commit
d7f38caccd
@ -387,7 +387,7 @@ class MainDisplay(Display):
|
||||
if serviceItem.foot_text:
|
||||
self.footer(serviceItem.foot_text)
|
||||
# if was hidden keep it hidden
|
||||
if self.hideMode and self.isLive:
|
||||
if self.hideMode and self.isLive and not serviceItem.is_media():
|
||||
if QtCore.QSettings().value(u'general/auto unblank',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
Receiver.send_message(u'slidecontroller_live_unblank')
|
||||
|
@ -81,19 +81,28 @@ class MediaController(object):
|
||||
QtCore.SIGNAL(u'songs_hide'), self.video_hide)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'songs_unblank'), self.video_unblank)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'mediaitem_media_rebuild'), self.set_active_players)
|
||||
|
||||
def set_active_players(self):
|
||||
playerSettings = str(QtCore.QSettings().value(u'media/players',
|
||||
QtCore.QVariant(u'webkit')).toString())
|
||||
savedPlayers = playerSettings.split(u',')
|
||||
for player in savedPlayers:
|
||||
self.mediaPlayers[player].isActive = True
|
||||
|
||||
def register_controllers(self, controller):
|
||||
"""
|
||||
Register each media Player controller (Webkit, Phonon, etc) and store for
|
||||
later use
|
||||
Register each media Player controller (Webkit, Phonon, etc) and store
|
||||
for later use
|
||||
"""
|
||||
if controller.check_available():
|
||||
self.mediaPlayers[controller.name] = controller
|
||||
|
||||
def check_available_media_players(self):
|
||||
"""
|
||||
Check to see if we have any media Player's available. If Not do not install
|
||||
the plugin.
|
||||
Check to see if we have any media Player's available. If Not do not
|
||||
install the plugin.
|
||||
"""
|
||||
log.debug(u'check_available_media_players')
|
||||
controller_dir = os.path.join(
|
||||
@ -127,6 +136,7 @@ class MediaController(object):
|
||||
newPlayerSetting = u','.join(savedPlayers)
|
||||
QtCore.QSettings().setValue(u'media/players',
|
||||
QtCore.QVariant(newPlayerSetting))
|
||||
self.set_active_players()
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
@ -153,7 +163,8 @@ class MediaController(object):
|
||||
"""
|
||||
css = u''
|
||||
for player in self.mediaPlayers.values():
|
||||
css += player.get_media_display_css()
|
||||
if player.isActive:
|
||||
css += player.get_media_display_css()
|
||||
return css
|
||||
|
||||
def get_media_display_javascript(self):
|
||||
@ -162,7 +173,8 @@ class MediaController(object):
|
||||
"""
|
||||
js = u''
|
||||
for player in self.mediaPlayers.values():
|
||||
js += player.get_media_display_javascript()
|
||||
if player.isActive:
|
||||
js += player.get_media_display_javascript()
|
||||
return js
|
||||
|
||||
def get_media_display_html(self):
|
||||
@ -171,7 +183,8 @@ class MediaController(object):
|
||||
"""
|
||||
html = u''
|
||||
for player in self.mediaPlayers.values():
|
||||
html += player.get_media_display_html()
|
||||
if player.isActive:
|
||||
html += player.get_media_display_html()
|
||||
return html
|
||||
|
||||
def add_controller_items(self, controller, control_panel):
|
||||
@ -250,7 +263,8 @@ class MediaController(object):
|
||||
display == self.parent.liveController.previewDisplay:
|
||||
display.hasAudio = False
|
||||
for player in self.mediaPlayers.values():
|
||||
player.setup(display)
|
||||
if player.isActive:
|
||||
player.setup(display)
|
||||
|
||||
def set_controls_visible(self, controller, value):
|
||||
# Generic controls
|
||||
@ -302,6 +316,11 @@ class MediaController(object):
|
||||
unicode(translate('MediaPlugin.MediaItem',
|
||||
'Unsupported File')))
|
||||
return False
|
||||
# dont care about actual theme, set a black background
|
||||
if controller.isLive and ( \
|
||||
controller.media_info.is_background == False):
|
||||
display.frame.evaluateJavaScript(u'show_video( \
|
||||
"setBackBoard", null, null, null,"visible");')
|
||||
# now start playing
|
||||
if self.video_play([controller], False):
|
||||
self.video_pause([controller])
|
||||
@ -312,10 +331,6 @@ class MediaController(object):
|
||||
controller.media_info.is_background == True) or \
|
||||
controller.isLive == False:
|
||||
self.video_play([controller])
|
||||
if controller.isLive and ( \
|
||||
controller.media_info.is_background == False):
|
||||
display.frame.evaluateJavaScript(u'show_video( \
|
||||
"setBackBoard", null, null, null,"visible");')
|
||||
self.set_controls_visible(controller, True)
|
||||
log.debug(u'use %s controller' % self.curDisplayMediaPlayer[display])
|
||||
return True
|
||||
@ -369,19 +384,22 @@ class MediaController(object):
|
||||
def video_play(self, msg, status=True):
|
||||
"""
|
||||
Responds to the request to play a loaded video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
"""
|
||||
log.debug(u'video_play')
|
||||
controller = msg[0]
|
||||
for display in self.curDisplayMediaPlayer.keys():
|
||||
if display.controller == controller:
|
||||
if controller.isLive:
|
||||
if controller.hideMenu.defaultAction().isChecked():
|
||||
controller.hideMenu.defaultAction().trigger()
|
||||
if not self.curDisplayMediaPlayer[display].play(display):
|
||||
return False
|
||||
if status:
|
||||
display.frame.evaluateJavaScript(u'show_blank("desktop");')
|
||||
if controller.isLive:
|
||||
if controller.hideMenu.defaultAction().isChecked():
|
||||
controller.hideMenu.defaultAction().trigger()
|
||||
self.curDisplayMediaPlayer[display].set_visible(display, True)
|
||||
display.frame.evaluateJavaScript(u'show_blank("desktop");')
|
||||
# Start Timer for ui updates
|
||||
if not self.timer.isActive():
|
||||
self.timer.start()
|
||||
@ -390,6 +408,9 @@ class MediaController(object):
|
||||
def video_pause(self, msg):
|
||||
"""
|
||||
Responds to the request to pause a loaded video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
"""
|
||||
log.debug(u'video_pause')
|
||||
controller = msg[0]
|
||||
@ -400,6 +421,9 @@ class MediaController(object):
|
||||
def video_stop(self, msg):
|
||||
"""
|
||||
Responds to the request to stop a loaded video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
"""
|
||||
log.debug(u'video_stop')
|
||||
controller = msg[0]
|
||||
@ -412,6 +436,9 @@ class MediaController(object):
|
||||
def video_volume(self, msg):
|
||||
"""
|
||||
Changes the volume of a running video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
"""
|
||||
controller = msg[0]
|
||||
vol = msg[1][0]
|
||||
@ -423,6 +450,10 @@ class MediaController(object):
|
||||
def video_seek(self, msg):
|
||||
"""
|
||||
Responds to the request to change the seek Slider of a loaded video
|
||||
|
||||
``msg``
|
||||
First element is the controller which should be used
|
||||
Second element is a list with the seek Value as first element
|
||||
"""
|
||||
log.debug(u'video_seek')
|
||||
controller = msg[0]
|
||||
@ -449,6 +480,9 @@ class MediaController(object):
|
||||
def video_hide(self, msg):
|
||||
"""
|
||||
Hide the related video Widget
|
||||
|
||||
``msg``
|
||||
First element is the boolean for Live indication
|
||||
"""
|
||||
isLive = msg[1]
|
||||
if isLive:
|
||||
@ -464,6 +498,10 @@ class MediaController(object):
|
||||
def video_blank(self, msg):
|
||||
"""
|
||||
Blank the related video Widget
|
||||
|
||||
``msg``
|
||||
First element is the boolean for Live indication
|
||||
Second element is the hide mode
|
||||
"""
|
||||
isLive = msg[1]
|
||||
hide_mode = msg[2]
|
||||
@ -481,6 +519,10 @@ class MediaController(object):
|
||||
def video_unblank(self, msg):
|
||||
"""
|
||||
Unblank the related video Widget
|
||||
|
||||
``msg``
|
||||
First element is not relevant in this context
|
||||
Second element is the boolean for Live indication
|
||||
"""
|
||||
Receiver.send_message(u'live_display_show')
|
||||
isLive = msg[1]
|
||||
@ -501,17 +543,19 @@ class MediaController(object):
|
||||
def get_audio_extensions_list(self):
|
||||
audio_list = []
|
||||
for player in self.mediaPlayers.values():
|
||||
for item in player.audio_extensions_list:
|
||||
if not item in audio_list:
|
||||
audio_list.append(item)
|
||||
if player.isActive:
|
||||
for item in player.audio_extensions_list:
|
||||
if not item in audio_list:
|
||||
audio_list.append(item)
|
||||
return audio_list
|
||||
|
||||
def get_video_extensions_list(self):
|
||||
video_list = []
|
||||
for player in self.mediaPlayers.values():
|
||||
for item in player.video_extensions_list:
|
||||
if not item in video_list:
|
||||
video_list.append(item)
|
||||
if player.isActive:
|
||||
for item in player.video_extensions_list:
|
||||
if not item in video_list:
|
||||
video_list.append(item)
|
||||
return video_list
|
||||
|
||||
def override_player(self, override_player):
|
||||
|
@ -109,23 +109,6 @@ class PhononPlayer(MediaPlayer):
|
||||
def check_available(self):
|
||||
return True
|
||||
|
||||
def get_supported_file_types(self):
|
||||
self.supported_file_types = ['avi']
|
||||
self.additional_extensions = {
|
||||
u'audio/ac3': [u'.ac3'],
|
||||
u'audio/flac': [u'.flac'],
|
||||
u'audio/x-m4a': [u'.m4a'],
|
||||
u'audio/midi': [u'.mid', u'.midi'],
|
||||
u'audio/x-mp3': [u'.mp3'],
|
||||
u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'],
|
||||
u'audio/qcelp': [u'.qcp'],
|
||||
u'audio/x-wma': [u'.wma'],
|
||||
u'audio/x-ms-wma': [u'.wma'],
|
||||
u'video/x-flv': [u'.flv'],
|
||||
u'video/x-matroska': [u'.mpv', u'.mkv'],
|
||||
u'video/x-wmv': [u'.wmv'],
|
||||
u'video/x-ms-wmv': [u'.wmv']}
|
||||
|
||||
def load(self, display):
|
||||
log.debug(u'load vid in Phonon Controller')
|
||||
controller = display.controller
|
||||
@ -171,6 +154,7 @@ class PhononPlayer(MediaPlayer):
|
||||
int(display.mediaObject.totalTime()/1000)
|
||||
controller.seekSlider.setMaximum(controller.media_info.length*1000)
|
||||
self.state = MediaState.Playing
|
||||
display.phononWidget.raise_()
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -162,7 +162,7 @@ class VlcPlayer(MediaPlayer):
|
||||
int(display.vlcMediaPlayer.get_media().get_duration()/1000)
|
||||
controller.seekSlider.setMaximum(controller.media_info.length*1000)
|
||||
self.state = MediaState.Playing
|
||||
#self.set_visible(display, True)
|
||||
display.vlcWidget.raise_()
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -135,7 +135,7 @@ VIDEO_JS = u"""
|
||||
return vid.currentTime;
|
||||
case 'seek':
|
||||
// doesnt work currently
|
||||
//vid.currentTime = varVal;
|
||||
vid.currentTime = varVal;
|
||||
break;
|
||||
case 'setVisible':
|
||||
vid.style.visibility = varVal;
|
||||
@ -313,7 +313,7 @@ class WebkitPlayer(MediaPlayer):
|
||||
js = u'show_flash("load","%s");' % \
|
||||
(path.replace(u'\\', u'\\\\'))
|
||||
else:
|
||||
js = u'show_video("init", "%s", %s, %s);' % \
|
||||
js = u'show_video("init", "file:///%s", %s, %s);' % \
|
||||
(path.replace(u'\\', u'\\\\'), str(vol), loop)
|
||||
display.frame.evaluateJavaScript(js)
|
||||
return True
|
||||
@ -334,6 +334,7 @@ class WebkitPlayer(MediaPlayer):
|
||||
# TODO add playing check and get the correct media length
|
||||
controller.media_info.length = length
|
||||
self.state = MediaState.Playing
|
||||
display.webView.raise_()
|
||||
return True
|
||||
|
||||
def pause(self, display):
|
||||
|
@ -289,10 +289,6 @@ class SlideController(Controller):
|
||||
self.previewDisplay.setGeometry(QtCore.QRect(0, 0, 300, 300))
|
||||
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
|
||||
self.previewDisplay.setup()
|
||||
serviceItem = ServiceItem()
|
||||
self.previewDisplay.webView.setHtml(build_html(serviceItem,
|
||||
self.previewDisplay.screen, None, self.isLive, None, PluginManager.get_instance().plugins))
|
||||
# self.previewDisplay.webView.hide()
|
||||
self.slideLayout.insertWidget(0, self.previewDisplay)
|
||||
self.previewDisplay.hide()
|
||||
# Actual preview screen
|
||||
@ -619,6 +615,7 @@ class SlideController(Controller):
|
||||
max_height))
|
||||
self.previewDisplay.setFixedSize(QtCore.QSize(max_height * self.ratio,
|
||||
max_height))
|
||||
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
|
||||
else:
|
||||
# We have to take the width as limit.
|
||||
max_width = self.previewFrame.width() - self.grid.margin() * 2
|
||||
@ -626,6 +623,7 @@ class SlideController(Controller):
|
||||
max_width / self.ratio))
|
||||
self.previewDisplay.setFixedSize(QtCore.QSize(max_width,
|
||||
max_width / self.ratio))
|
||||
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
|
||||
# Make sure that the frames have the correct size.
|
||||
self.previewListWidget.setColumnWidth(0,
|
||||
self.previewListWidget.viewport().size().width())
|
||||
|
@ -228,6 +228,11 @@ class MediaMediaItem(MediaManagerItem):
|
||||
the settings
|
||||
"""
|
||||
self.populateDisplayTypes()
|
||||
self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
|
||||
'Videos (%s);;Audio (%s);;%s (*)')) % (
|
||||
u' '.join(self.plugin.video_extensions_list),
|
||||
u' '.join(self.plugin.audio_extensions_list), UiStrings().AllFiles)
|
||||
|
||||
|
||||
def populateDisplayTypes(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user