Add settings migration for phonon to system change

This commit is contained in:
Jonathan Springer 2015-12-07 16:41:15 -05:00
parent baa59f9321
commit 50c0a173eb
1 changed files with 18 additions and 2 deletions

View File

@ -59,6 +59,20 @@ def recent_files_conv(value):
return []
def media_players_conv(string):
"""
If phonon is in the setting string replace it with system
:param string: String to convert
:return: Converted string
"""
values = string.split(',')
for index, value in enumerate(values):
if value == 'phonon':
values[index] = 'system'
string = ','.join(values)
return string
class Settings(QtCore.QSettings):
"""
Class to wrap QSettings.
@ -146,7 +160,7 @@ class Settings(QtCore.QSettings):
'core/override position': False,
'core/application version': '0.0',
'images/background color': '#000000',
'media/players': 'webkit',
'media/players': 'system,webkit',
'media/override player': QtCore.Qt.Unchecked,
'players/background color': '#000000',
'servicemanager/last directory': '',
@ -325,7 +339,9 @@ class Settings(QtCore.QSettings):
# Changed during 2.2.x development.
# ('advanced/stylesheet fix', '', []),
# ('general/recent files', 'core/recent files', [(recent_files_conv, None)]),
('songs/search as type', 'advanced/search as type', [])
('songs/search as type', 'advanced/search as type', []),
('media/players', 'media/players_temp', [(media_players_conv, None)]), # Convert phonon to system
('media/players_temp', 'media/players', []) # Move temp setting from above to correct setting
]
@staticmethod