← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/view-mode into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/view-mode into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  #640697 View Mode not displayed corretcly after restarting OpenLP
  https://bugs.launchpad.net/bugs/640697


Fix for bug #640697
-- 
https://code.launchpad.net/~raoul-snyman/openlp/view-mode/+merge/35931
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/view-mode into lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2010-09-16 20:40:12 +0000
+++ openlp/core/ui/mainwindow.py	2010-09-18 18:24:52 +0000
@@ -575,7 +575,7 @@
             QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
         self.LanguageGroup.triggered.connect(LanguageManager.set_language)
         QtCore.QObject.connect(self.ModeDefaultItem,
-            QtCore.SIGNAL(u'triggered()'), self.setViewMode)
+            QtCore.SIGNAL(u'triggered()'), self.onModeDefaultItemClicked)
         QtCore.QObject.connect(self.ModeSetupItem,
             QtCore.SIGNAL(u'triggered()'), self.onModeSetupItemClicked)
         QtCore.QObject.connect(self.ModeLiveItem,
@@ -670,6 +670,16 @@
             self.generalSettingsSection + u'/auto open',
             QtCore.QVariant(False)).toBool():
             self.ServiceManagerContents.onLoadService(True)
+        view_mode = QtCore.QSettings().value(u'%s/view mode' % \
+            self.generalSettingsSection, u'default')
+        if view_mode == u'default':
+            self.ModeDefaultItem.setChecked(True)
+        elif view_mode == u'setup':
+            self.setViewMode(True, True, False, True, False)
+            self.ModeSetupItem.setChecked(True)
+        elif view_mode == u'live':
+            self.setViewMode(False, True, False, False, True)
+            self.ModeLiveItem.setChecked(True)
 
     def blankCheck(self):
         """
@@ -677,8 +687,8 @@
         Triggered by delay thread.
         """
         settings = QtCore.QSettings()
-        settings.beginGroup(self.generalSettingsSection)
-        if settings.value(u'screen blank', QtCore.QVariant(False)).toBool():
+        if settings.value(u'%s/screen blank' % self.generalSettingsSection,
+            QtCore.QVariant(False)).toBool():
             self.LiveController.mainDisplaySetBackground()
             if settings.value(u'blank warning',
                 QtCore.QVariant(False)).toBool():
@@ -687,7 +697,6 @@
                         'OpenLP Main Display Blanked'),
                     translate('OpenLP.MainWindow',
                          'The Main Display has been blanked out'))
-        settings.endGroup()
 
     def onHelpWebSiteClicked(self):
         """
@@ -716,16 +725,31 @@
         """
         self.settingsForm.exec_()
 
+    def onModeDefaultItemClicked(self):
+        """
+        Put OpenLP into "Default" view mode.
+        """
+        settings = QtCore.QSettings()
+        settings.setValue(u'%s/view mode' % self.generalSettingsSection,
+            u'default')
+        self.setViewMode(True, True, True, True, True)
+
     def onModeSetupItemClicked(self):
         """
         Put OpenLP into "Setup" view mode.
         """
+        settings = QtCore.QSettings()
+        settings.setValue(u'%s/view mode' % self.generalSettingsSection,
+            u'setup')
         self.setViewMode(True, True, False, True, False)
 
     def onModeLiveItemClicked(self):
         """
         Put OpenLP into "Live" view mode.
         """
+        settings = QtCore.QSettings()
+        settings.setValue(u'%s/view mode' % self.generalSettingsSection,
+            u'live')
         self.setViewMode(False, True, False, False, True)
 
     def setViewMode(self, media=True, service=True, theme=True, preview=True,


Follow ups