Add a setting to hide the mouse cursor on the display.

This commit is contained in:
Garrett 2011-01-16 14:32:39 -08:00
parent 149f0bd31e
commit 4414d7e421
2 changed files with 36 additions and 0 deletions

View File

@ -213,6 +213,14 @@ class GeneralTab(SettingsTab):
self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
self.displayLayout.addWidget(self.customHeightValueEdit, 4, 3)
self.rightLayout.addWidget(self.displayGroupBox)
self.hideMouseGroupBox = QtGui.QGroupBox(self.rightColumn)
self.hideMouseGroupBox.setObjectName(u'hideMouseGroupBox')
self.hideMouseLayout = QtGui.QVBoxLayout(self.hideMouseGroupBox)
self.hideMouseLayout.setObjectName(u'hideMouseLayout')
self.hideMouseCheckBox = QtGui.QCheckBox(self.hideMouseGroupBox)
self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox')
self.hideMouseLayout.addWidget(self.hideMouseCheckBox)
self.rightLayout.addWidget(self.hideMouseGroupBox)
self.rightLayout.addStretch()
# Signals and slots
QtCore.QObject.connect(self.overrideCheckBox,
@ -287,6 +295,10 @@ class GeneralTab(SettingsTab):
self.customHeightLabel.setText(
translate('OpenLP.GeneralTab', 'Height'))
self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width'))
self.hideMouseGroupBox.setTitle(translate('OpenLP.GeneralTab',
'Mouse Cursor'))
self.hideMouseCheckBox.setText(translate('OpenLP.GeneralTab',
'Hide the Mouse Cursor'))
def load(self):
"""
@ -341,6 +353,8 @@ class GeneralTab(SettingsTab):
self.customWidthValueEdit.setText(
settings.value(u'width', QtCore.QVariant(
self.screens.current[u'size'].width())).toString())
self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse',
QtCore.QVariant(False)).toBool())
settings.endGroup()
self.customXValueEdit.setEnabled(self.overrideCheckBox.isChecked())
self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked())
@ -385,6 +399,8 @@ class GeneralTab(SettingsTab):
QtCore.QVariant(self.customWidthValueEdit.text()))
settings.setValue(u'override position',
QtCore.QVariant(self.overrideCheckBox.isChecked()))
settings.setValue(u'hide mouse',
QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
settings.endGroup()
self.screens.display = self.displayOnMonitorCheck.isChecked()
# Monitor Number has changed.

View File

@ -117,6 +117,8 @@ class MainDisplay(DisplayWidget):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay)
self.generalSettingsSection = u'general'
def retranslateUi(self):
"""
Setup the interface translation strings.
@ -205,6 +207,8 @@ class MainDisplay(DisplayWidget):
Receiver.send_message(u'openlp_process_events')
self.frame.evaluateJavaScript(u'show_text("%s")' % \
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
self.hideMouseCursor()
return self.preview()
def alert(self, text):
@ -270,6 +274,7 @@ class MainDisplay(DisplayWidget):
else:
js = u'show_image("");'
self.frame.evaluateJavaScript(js)
self.hideMouseCursor()
def resetImage(self):
"""
@ -359,6 +364,8 @@ class MainDisplay(DisplayWidget):
self.webView.setVisible(False)
self.videoWidget.setVisible(True)
self.audio.setVolume(vol)
self.hideMouseCursor()
return self.preview()
def isLoaded(self):
@ -475,6 +482,19 @@ class MainDisplay(DisplayWidget):
# Trigger actions when display is active again
Receiver.send_message(u'maindisplay_active')
def hideMouseCursor(self):
"""
Hide the mouse cursor if enabled in settings
"""
settings = QtCore.QSettings()
if settings.value(u'%s/hide mouse' % self.generalSettingsSection,
QtCore.QVariant(False)).toBool():
self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
else:
self.setCursor(QtCore.Qt.ArrowCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "auto"')
class AudioPlayer(QtCore.QObject):
"""
This Class will play audio only allowing components to work with a