← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/beta1 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/beta1 into lp:openlp.

Requested reviews:
  Jonathan Corwin (j-corwin)
  Raoul Snyman (raoul-snyman)
Related bugs:
  Bug #742636 in OpenLP: "Leading spaces in song titles are stripped"
  https://bugs.launchpad.net/openlp/+bug/742636

For more details, see:
https://code.launchpad.net/~trb143/openlp/beta1/+merge/59540

Delay the creation of Phonon objects until they are needed. 
-- 
https://code.launchpad.net/~trb143/openlp/beta1/+merge/59540
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2011-04-29 14:36:29 +0000
+++ openlp/core/lib/renderer.py	2011-04-29 18:44:55 +0000
@@ -71,7 +71,7 @@
         log.debug(u'Initilisation started')
         self.screens = screens
         self.image_manager = ImageManager()
-        self.display = MainDisplay(self, screens, False)
+        self.display = MainDisplay(self, screens, False, False)
         self.display.imageManager = self.image_manager
         self.theme_manager = theme_manager
         self.service_theme = u''

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2011-04-27 10:30:29 +0000
+++ openlp/core/ui/maindisplay.py	2011-04-29 18:44:55 +0000
@@ -60,16 +60,19 @@
     """
     This is the display screen.
     """
-    def __init__(self, parent, screens, live):
+    def __init__(self, parent, screens, live, needsPhonon=True):
         DisplayWidget.__init__(self, live, parent=None)
         self.parent = parent
         self.screens = screens
         self.isLive = live
+        self.needsPhonon = needsPhonon
         self.alertTab = None
         self.hideMode = None
         self.videoHide = False
         self.override = {}
         self.retranslateUi()
+        self.mediaObject = None
+        self.firstTime = True
         self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
         self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool |
             QtCore.Qt.WindowStaysOnTopHint)
@@ -78,6 +81,9 @@
                 QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay)
             QtCore.QObject.connect(Receiver.get_receiver(),
                 QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay)
+            QtCore.QObject.connect(Receiver.get_receiver(),
+                QtCore.SIGNAL(u'openlp_phonon_creation'),
+                self.createMediaObject)
 
     def retranslateUi(self):
         """
@@ -102,19 +108,9 @@
         self.videoWidget.setGeometry(QtCore.QRect(0, 0,
             self.screen[u'size'].width(), self.screen[u'size'].height()))
         log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number)
-        self.mediaObject = Phonon.MediaObject(self)
-        self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
-        Phonon.createPath(self.mediaObject, self.videoWidget)
-        Phonon.createPath(self.mediaObject, self.audio)
-        QtCore.QObject.connect(self.mediaObject,
-            QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
-            self.videoState)
-        QtCore.QObject.connect(self.mediaObject,
-            QtCore.SIGNAL(u'finished()'),
-            self.videoFinished)
-        QtCore.QObject.connect(self.mediaObject,
-            QtCore.SIGNAL(u'tick(qint64)'),
-            self.videoTick)
+        if self.isLive:
+            if not self.firstTime:
+                self.createMediaObject()
         log.debug(u'Setup webView for monitor %s' % self.screens.monitor_number)
         self.webView = QtWebKit.QWebView(self)
         self.webView.setGeometry(0, 0,
@@ -175,6 +171,24 @@
         log.debug(
             u'Finished setup for monitor %s' % self.screens.monitor_number)
 
+    def createMediaObject(self):
+        self.firstTime = False
+        log.debug(u'Creating Phonon objects - Start for %s', self.isLive)
+        self.mediaObject = Phonon.MediaObject(self)
+        self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
+        Phonon.createPath(self.mediaObject, self.videoWidget)
+        Phonon.createPath(self.mediaObject, self.audio)
+        QtCore.QObject.connect(self.mediaObject,
+            QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
+            self.videoState)
+        QtCore.QObject.connect(self.mediaObject,
+            QtCore.SIGNAL(u'finished()'),
+            self.videoFinished)
+        QtCore.QObject.connect(self.mediaObject,
+            QtCore.SIGNAL(u'tick(qint64)'),
+            self.videoTick)
+        log.debug(u'Creating Phonon objects - Finished for %s', self.isLive)
+
     def text(self, slide):
         """
         Add the slide text from slideController
@@ -348,6 +362,8 @@
         """
         Loads and starts a video to run with the option of sound
         """
+        if not self.mediaObject:
+            self.createMediaObject()
         log.debug(u'video')
         self.webLoaded = True
         self.setGeometry(self.screen[u'size'])

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-04-29 05:26:20 +0000
+++ openlp/core/ui/slidecontroller.py	2011-04-29 18:44:55 +0000
@@ -277,15 +277,16 @@
         self.slideLayout.setSpacing(0)
         self.slideLayout.setMargin(0)
         self.slideLayout.setObjectName(u'SlideLayout')
-        self.mediaObject = Phonon.MediaObject(self)
-        self.video = Phonon.VideoWidget()
-        self.video.setVisible(False)
-        self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
-        Phonon.createPath(self.mediaObject, self.video)
-        Phonon.createPath(self.mediaObject, self.audio)
         if not self.isLive:
+            self.mediaObject = Phonon.MediaObject(self)
+            self.video = Phonon.VideoWidget()
+            self.video.setVisible(False)
+            self.audio = Phonon.AudioOutput(Phonon.VideoCategory,
+                self.mediaObject)
+            Phonon.createPath(self.mediaObject, self.video)
+            Phonon.createPath(self.mediaObject, self.audio)
             self.video.setGeometry(QtCore.QRect(0, 0, 300, 225))
-        self.slideLayout.insertWidget(0, self.video)
+            self.slideLayout.insertWidget(0, self.video)
         # Actual preview screen
         self.slidePreview = QtGui.QLabel(self)
         sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,

=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2011-04-29 07:40:19 +0000
+++ openlp/core/utils/__init__.py	2011-04-29 18:44:55 +0000
@@ -99,6 +99,7 @@
             local_version.get(u'revision') and \
             remote_version[u'revision'] > local_version[u'revision']:
             Receiver.send_message(u'openlp_version_check', u'%s' % version)
+        Receiver.send_message(u'openlp_phonon_creation')
 
 
 class AppLocation(object):

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2011-04-15 21:43:59 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2011-04-29 18:44:55 +0000
@@ -50,10 +50,13 @@
             u':/media/media_video.png').toImage()
         MediaManagerItem.__init__(self, parent, self, icon)
         self.singleServiceItem = False
-        self.mediaObject = Phonon.MediaObject(self)
+        self.mediaObject = None
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'video_background_replaced'),
             self.videobackgroundReplaced)
+        QtCore.QObject.connect(Receiver.get_receiver(),
+            QtCore.SIGNAL(u'openlp_phonon_creation'),
+            self.createPhonon)
 
     def retranslateUi(self):
         self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
@@ -209,4 +212,9 @@
             img = QtGui.QPixmap(u':/media/media_video.png').toImage()
             item_name.setIcon(build_icon(img))
             item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
-            self.listView.addItem(item_name)
\ No newline at end of file
+            self.listView.addItem(item_name)
+
+    def createPhonon(self):
+        if not self.mediaObject:
+            self.mediaObject = Phonon.MediaObject(self)
+

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2011-04-16 11:42:35 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2011-04-29 18:44:55 +0000
@@ -473,4 +473,4 @@
         Locale aware collation of song titles
         """
         return locale.strcoll(unicode(song_1.title.lower()),
-             unicode(song_2.title.lower()))
\ No newline at end of file
+             unicode(song_2.title.lower()))


Follow ups