← 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)
  Jonathan Corwin (j-corwin)
  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/96976

WebKit, Phonon and VLC now have proper case under Media Tab in Settings.
-- 
https://code.launchpad.net/~mahfiaz/openlp/bug-903683/+merge/96976
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py	2012-03-10 23:00:14 +0000
+++ openlp/core/ui/media/mediacontroller.py	2012-03-12 08:34:18 +0000
@@ -577,12 +577,13 @@
                         video_list.append(item)
         return video_list
 
-    def override_player(self, override_player):
+    def override_player(self, override_player_index):
         playerSettings = str(QtCore.QSettings().value(u'media/players',
             QtCore.QVariant(u'webkit')).toString())
         usedPlayers = playerSettings.split(u',')
-        if override_player in usedPlayers:
-            self.overriddenPlayer = override_player
+        if override_player_index >= 0 and \
+            override_player_index < len(usedPlayers):
+            self.overridenPlayer = usedPlayers[override_player_index]
         else:
             self.overriddenPlayer = ''
 

=== 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-12 08:34:18 +0000
@@ -63,6 +63,8 @@
 
     def __init__(self, parent):
         MediaPlayer.__init__(self, parent, u'phonon')
+        self.original_name = u'Phonon'
+        self.display_name = u'&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-03-04 14:52:09 +0000
+++ openlp/core/ui/media/vlcplayer.py	2012-03-12 08:34:18 +0000
@@ -89,6 +89,8 @@
 
     def __init__(self, parent):
         MediaPlayer.__init__(self, parent, u'vlc')
+        self.original_name = u'VLC'
+        self.display_name = u'&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	2012-03-04 14:52:09 +0000
+++ openlp/core/ui/media/webkitplayer.py	2012-03-12 08:34:18 +0000
@@ -260,6 +260,8 @@
 
     def __init__(self, parent):
         MediaPlayer.__init__(self, parent, u'webkit')
+        self.original_name = u'WebKit'
+        self.display_name = u'&WebKit'
         self.parent = parent
         self.canBackground = True
         self.audio_extensions_list = AUDIO_EXT

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2012-03-04 14:52:09 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2012-03-12 08:34:18 +0000
@@ -104,7 +104,7 @@
         self.automatic = translate('MediaPlugin.MediaItem',
             'Automatic')
         self.displayTypeLabel.setText(
-            translate('MediaPlugin.MediaItem', 'Use Player:'))
+            translate('MediaPlugin.MediaItem', 'Use &Player:'))
 
     def requiredIcons(self):
         MediaManagerItem.requiredIcons(self)
@@ -142,8 +142,8 @@
             self.overridePlayerChanged)
 
     def overridePlayerChanged(self, index):
-        Receiver.send_message(u'media_override_player', \
-            u'%s' % self.displayTypeComboBox.currentText())
+        # index - 1, because the first item is "Automatic".
+        Receiver.send_message(u'media_override_player', index - 1)
 
     def onResetClick(self):
         """
@@ -249,8 +249,10 @@
         playerSettings = str(QtCore.QSettings().value(u'media/players',
             QtCore.QVariant(u'webkit')).toString())
         usedPlayers = playerSettings.split(u',')
-        for title in usedPlayers:
+        mediaPlayers = self.plugin.mediaController.mediaPlayers
+        for player in usedPlayers:
             # load the drop down selection
+            title = mediaPlayers[player].original_name
             self.displayTypeComboBox.addItem(title)
         if self.displayTypeComboBox.count() > 1:
             self.displayTypeComboBox.insertItem(0, self.automatic)

=== modified file 'openlp/plugins/media/lib/mediatab.py'
--- openlp/plugins/media/lib/mediatab.py	2012-03-10 23:00:14 +0000
+++ openlp/plugins/media/lib/mediatab.py	2012-03-12 08:34:18 +0000
@@ -30,6 +30,14 @@
 from openlp.core.lib import SettingsTab, translate, Receiver
 from openlp.core.lib.ui import UiStrings, create_up_down_push_button_set
 
+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
@@ -109,21 +117,22 @@
         for key in self.mediaPlayers:
             player = self.mediaPlayers[key]
             checkbox = self.playerCheckBoxes[player.name]
+            checkbox.setPlayerName(player.name)
             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'))
+            translate('MediaPlugin.MediaTab', 'Player O&rder'))
         self.advancedGroupBox.setTitle(UiStrings().Advanced)
         self.overridePlayerCheckBox.setText(
             translate('MediaPlugin.MediaTab',
-            'Allow media player to be overridden'))
+            '&Allow media player to be overridden'))
 
     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)
@@ -141,7 +150,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)].original_name)
 
     def onUpButtonClicked(self):
         row = self.playerOrderlistWidget.currentRow()
@@ -162,9 +172,6 @@
         self.usedPlayers.move(row, row + 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',')


Follow ups