← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/bug-903683 into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/bug-903683 into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
  Raoul Snyman (raoul-snyman)
Related bugs:
  Bug #903683 in OpenLP: "Capitalize webkit and phonon in config media"
  https://bugs.launchpad.net/openlp/+bug/903683

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/bug-903683/+merge/96216

WebKit, Phonon and VLC now have proper case under Media Tab in Settings.
-- 
https://code.launchpad.net/~mahfiaz/openlp/bug-903683/+merge/96216
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/media/phononplayer.py'
--- openlp/core/ui/media/phononplayer.py	2012-02-05 14:39:46 +0000
+++ openlp/core/ui/media/phononplayer.py	2012-03-06 18:45:47 +0000
@@ -31,7 +31,7 @@
 
 from PyQt4.phonon import Phonon
 
-from openlp.core.lib import Receiver
+from openlp.core.lib import Receiver, Translate
 from openlp.core.lib.mediaplayer import MediaPlayer
 from openlp.core.ui.media import MediaState
 
@@ -63,6 +63,7 @@
 
     def __init__(self, parent):
         MediaPlayer.__init__(self, parent, u'phonon')
+        self.display_name = translate('MediaPlugin.MediaTab', 'Phonon')
         self.parent = parent
         self.additional_extensions = ADDITIONAL_EXT
         mimetypes.init()

=== modified file 'openlp/core/ui/media/vlcplayer.py'
--- openlp/core/ui/media/vlcplayer.py	2012-01-19 19:13:19 +0000
+++ openlp/core/ui/media/vlcplayer.py	2012-03-06 18:45:47 +0000
@@ -43,7 +43,7 @@
         raise
 
 from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver
+from openlp.core.lib import Receiver, translate
 from openlp.core.lib.mediaplayer import MediaPlayer
 from openlp.core.ui.media import MediaState
 
@@ -89,6 +89,7 @@
 
     def __init__(self, parent):
         MediaPlayer.__init__(self, parent, u'vlc')
+        self.display_name = translate('MediaPlugin.MediaTab', 'VLC')
         self.parent = parent
         self.canFolder = True
         self.audio_extensions_list = AUDIO_EXT

=== modified file 'openlp/core/ui/media/webkitplayer.py'
--- openlp/core/ui/media/webkitplayer.py	2011-12-07 20:20:23 +0000
+++ openlp/core/ui/media/webkitplayer.py	2012-03-06 18:45:47 +0000
@@ -27,6 +27,7 @@
 
 import logging
 
+from openlp.core.lib import translate
 from openlp.core.lib.mediaplayer import MediaPlayer
 from openlp.core.ui.media import MediaState
 
@@ -260,6 +261,7 @@
 
     def __init__(self, parent):
         MediaPlayer.__init__(self, parent, u'webkit')
+        self.display_name = translate('MediaPlugin.MediaTab', 'WebKit')
         self.parent = parent
         self.canBackground = True
         self.audio_extensions_list = AUDIO_EXT

=== modified file 'openlp/plugins/media/lib/mediatab.py'
--- openlp/plugins/media/lib/mediatab.py	2011-12-31 17:37:56 +0000
+++ openlp/plugins/media/lib/mediatab.py	2012-03-06 18:45:47 +0000
@@ -30,6 +30,14 @@
 from openlp.core.lib import SettingsTab, translate, Receiver
 from openlp.core.lib.ui import UiStrings
 
+class MediaQCheckBox(QtGui.QCheckBox):
+    """
+    MediaQCheckBox adds an extra property, playerName to the QCheckBox class.
+    """
+    def setPlayerName(self, name):
+        self.playerName = name
+
+
 class MediaTab(SettingsTab):
     """
     MediaTab is the Media settings tab in the settings dialog.
@@ -49,7 +57,7 @@
         self.playerCheckBoxes = {}
         for key, player in self.mediaPlayers.iteritems():
             player = self.mediaPlayers[key]
-            checkbox = QtGui.QCheckBox(self.mediaPlayerGroupBox)
+            checkbox = MediaQCheckBox(self.mediaPlayerGroupBox)
             checkbox.setEnabled(player.available)
             checkbox.setObjectName(player.name + u'CheckBox')
             self.playerCheckBoxes[player.name] = checkbox
@@ -116,12 +124,13 @@
         for key in self.mediaPlayers:
             player = self.mediaPlayers[key]
             checkbox = self.playerCheckBoxes[player.name]
+            checkbox.setPlayerName(key)
             if player.available:
-                checkbox.setText(player.name)
+                checkbox.setText(player.display_name)
             else:
                 checkbox.setText(
                     unicode(translate('MediaPlugin.MediaTab',
-                    '%s (unavailable)')) % player.name)
+                    '%s (unavailable)')) % player.display_name)
         self.playerOrderGroupBox.setTitle(
             translate('MediaPlugin.MediaTab', 'Player Order'))
         self.orderingDownButton.setText(
@@ -134,7 +143,7 @@
             'Allow media player to be overriden'))
 
     def onPlayerCheckBoxChanged(self, check_state):
-        player = self.sender().text()
+        player = self.sender().playerName
         if check_state == QtCore.Qt.Checked:
             if player not in self.usedPlayers:
                 self.usedPlayers.append(player)
@@ -152,7 +161,8 @@
                     self.playerCheckBoxes[u'%s' % player].setEnabled(False)
                 else:
                     self.playerCheckBoxes[u'%s' % player].setEnabled(True)
-                self.playerOrderlistWidget.addItem(player)
+                self.playerOrderlistWidget.addItem(
+                    self.mediaPlayers[unicode(player)].display_name)
 
     def onOrderingUpButtonPressed(self):
         currentRow = self.playerOrderlistWidget.currentRow()
@@ -171,9 +181,6 @@
             self.usedPlayers.move(currentRow, currentRow + 1)
 
     def load(self):
-        if self.savedUsedPlayers:
-            self.usedPlayers = self.savedUsedPlayers
-            self.savedUsedPlayers = None
         self.usedPlayers = QtCore.QSettings().value(
             self.settingsSection + u'/players',
             QtCore.QVariant(u'webkit')).toString().split(u',')