← 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:
  OpenLP Core (openlp-core)
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/59501

Delay the creation of Phonon objects until they are needed. 
-- 
https://code.launchpad.net/~trb143/openlp/beta1/+merge/59501
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/beta1 into lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2011-04-28 06:44:48 +0000
+++ openlp/core/lib/renderer.py	2011-04-29 12:25:40 +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 12:25:40 +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)
@@ -102,19 +105,11 @@
         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.needsPhonon:
+            if self.firstTime:
+                self.firstTime = False
+            else:
+                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 +170,21 @@
         log.debug(
             u'Finished setup for monitor %s' % self.screens.monitor_number)
 
+    def createMediaObject(self):
+        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)
+
     def text(self, slide):
         """
         Add the slide text from slideController
@@ -348,6 +358,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/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 12:25:40 +0000
@@ -50,7 +50,7 @@
             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)
@@ -117,6 +117,8 @@
                     'the media file "%s" no longer exists.')) % filename)
 
     def generateSlideData(self, service_item, item=None, xmlVersion=False):
+        if not self.mediaObject:
+            self.mediaObject = Phonon.MediaObject(self)
         if item is None:
             item = self.listView.currentItem()
             if item is None:
@@ -209,4 +211,4 @@
             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)

=== 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 12:25:40 +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