Changed setting version name

This commit is contained in:
Tomas Groth 2014-10-14 09:52:59 +02:00
parent f36c8660ab
commit cbd1b7c223
3 changed files with 8 additions and 8 deletions

View File

@ -201,11 +201,11 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
:param has_run_wizard: OpenLP has been run before
"""
data_version = Settings().value('core/data version')
data_version = Settings().value('core/application version')
openlp_version = get_application_version()['version']
# New installation, no need to create backup
if not has_run_wizard:
Settings().setValue('core/data version', openlp_version)
Settings().setValue('core/application version', openlp_version)
# If data_version is different from the current version ask if we should backup the data folder
elif data_version != openlp_version:
if QtGui.QMessageBox.question(None, translate('OpenLP', 'Backup'),
@ -227,7 +227,7 @@ class OpenLP(OpenLPMixin, QtGui.QApplication):
translate('OpenLP', 'A backup of the data folder has been created at %s')
% data_folder_backup_path)
# Update the version in the settings
Settings().setValue('core/data version', openlp_version)
Settings().setValue('core/application version', openlp_version)
def process_events(self):
"""

View File

@ -137,7 +137,7 @@ class Settings(QtCore.QSettings):
# circular dependency.
'core/display on monitor': True,
'core/override position': False,
'core/data version': '0.0',
'core/application version': '0.0',
'images/background color': '#000000',
'media/players': 'webkit',
'media/override player': QtCore.Qt.Unchecked,

View File

@ -83,7 +83,7 @@ class TestInit(TestCase, TestMixin):
'version': '2.2.0',
'build': 'bzr000'
}
Settings().setValue('core/data version', '2.2.0')
Settings().setValue('core/application version', '2.2.0')
with patch('openlp.core.get_application_version') as mocked_get_application_version,\
patch('openlp.core.QtGui.QMessageBox.question') as mocked_question:
mocked_get_application_version.return_value = MOCKED_VERSION
@ -93,7 +93,7 @@ class TestInit(TestCase, TestMixin):
self.openlp.backup_on_upgrade(old_install)
# THEN: It should not ask if we want to create a backup
self.assertEqual(Settings().value('core/data version'), '2.2.0', 'Version should be the same!')
self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be the same!')
self.assertEqual(mocked_question.call_count, 0, 'No question should have been asked!')
def backup_on_upgrade_test(self):
@ -107,7 +107,7 @@ class TestInit(TestCase, TestMixin):
'version': '2.2.0',
'build': 'bzr000'
}
Settings().setValue('core/data version', '2.0.5')
Settings().setValue('core/application version', '2.0.5')
with patch('openlp.core.get_application_version') as mocked_get_application_version,\
patch('openlp.core.QtGui.QMessageBox.question') as mocked_question:
mocked_get_application_version.return_value = MOCKED_VERSION
@ -117,5 +117,5 @@ class TestInit(TestCase, TestMixin):
self.openlp.backup_on_upgrade(old_install)
# THEN: It should ask if we want to create a backup
self.assertEqual(Settings().value('core/data version'), '2.2.0', 'Version should be upgraded!')
self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be upgraded!')
self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!')