This commit is contained in:
Raoul Snyman 2013-02-02 20:43:34 +02:00
commit b0d96aa932
7 changed files with 74 additions and 11 deletions

View File

@ -121,11 +121,15 @@ class OpenLP(QtGui.QApplication):
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted: if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
Settings().setValue(u'general/has run wizard', True) Settings().setValue(u'general/has run wizard', True)
# Correct stylesheet bugs # Correct stylesheet bugs
if os.name == u'nt': application_stylesheet = u''
if not Settings().value(u'advanced/alternate rows'):
base_color = self.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Base) base_color = self.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Base)
application_stylesheet = \ alternate_rows_repair_stylesheet = \
u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n' u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n'
application_stylesheet += alternate_rows_repair_stylesheet
if os.name == u'nt':
application_stylesheet += nt_repair_stylesheet application_stylesheet += nt_repair_stylesheet
if application_stylesheet:
self.setStyleSheet(application_stylesheet) self.setStyleSheet(application_stylesheet)
show_splash = Settings().value(u'general/show splash') show_splash = Settings().value(u'general/show splash')
if show_splash: if show_splash:

View File

@ -87,6 +87,7 @@ class Settings(QtCore.QSettings):
""" """
__default_settings__ = { __default_settings__ = {
u'advanced/x11 bypass wm': X11_BYPASS_DEFAULT, u'advanced/x11 bypass wm': X11_BYPASS_DEFAULT,
u'advanced/alternate rows': not sys.platform.startswith(u'win'),
u'advanced/default service enabled': True, u'advanced/default service enabled': True,
u'advanced/enable exit confirmation': True, u'advanced/enable exit confirmation': True,
u'advanced/save current plugin': False, u'advanced/save current plugin': False,

View File

@ -229,14 +229,18 @@ class AdvancedTab(SettingsTab):
self.nextItemRadioButton.setObjectName(u'nextItemRadioButton') self.nextItemRadioButton.setObjectName(u'nextItemRadioButton')
self.slideLayout.addWidget(self.nextItemRadioButton) self.slideLayout.addWidget(self.nextItemRadioButton)
self.rightLayout.addWidget(self.slideGroupBox) self.rightLayout.addWidget(self.slideGroupBox)
self.x11GroupBox = QtGui.QGroupBox(self.leftColumn) # Display Workarounds
self.x11GroupBox.setObjectName(u'x11GroupBox') self.displayWorkaroundGroupBox = QtGui.QGroupBox(self.leftColumn)
self.x11Layout = QtGui.QVBoxLayout(self.x11GroupBox) self.displayWorkaroundGroupBox.setObjectName(u'displayWorkaroundGroupBox')
self.x11Layout.setObjectName(u'x11Layout') self.displayWorkaroundLayout = QtGui.QVBoxLayout(self.displayWorkaroundGroupBox)
self.x11BypassCheckBox = QtGui.QCheckBox(self.x11GroupBox) self.displayWorkaroundLayout.setObjectName(u'displayWorkaroundLayout')
self.x11BypassCheckBox = QtGui.QCheckBox(self.displayWorkaroundGroupBox)
self.x11BypassCheckBox.setObjectName(u'x11BypassCheckBox') self.x11BypassCheckBox.setObjectName(u'x11BypassCheckBox')
self.x11Layout.addWidget(self.x11BypassCheckBox) self.displayWorkaroundLayout.addWidget(self.x11BypassCheckBox)
self.rightLayout.addWidget(self.x11GroupBox) self.alternateRowsCheckBox = QtGui.QCheckBox(self.displayWorkaroundGroupBox)
self.alternateRowsCheckBox.setObjectName(u'alternateRowsCheckBox')
self.displayWorkaroundLayout.addWidget(self.alternateRowsCheckBox)
self.rightLayout.addWidget(self.displayWorkaroundGroupBox)
self.rightLayout.addStretch() self.rightLayout.addStretch()
self.shouldUpdateServiceNameExample = False self.shouldUpdateServiceNameExample = False
QtCore.QObject.connect(self.serviceNameCheckBox, QtCore.SIGNAL(u'toggled(bool)'), QtCore.QObject.connect(self.serviceNameCheckBox, QtCore.SIGNAL(u'toggled(bool)'),
@ -253,6 +257,8 @@ class AdvancedTab(SettingsTab):
QtCore.QObject.connect(self.defaultBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultBrowseButtonClicked) QtCore.QObject.connect(self.defaultBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultBrowseButtonClicked)
QtCore.QObject.connect(self.defaultRevertButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked) QtCore.QObject.connect(self.defaultRevertButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked)
QtCore.QObject.connect(self.x11BypassCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled) QtCore.QObject.connect(self.x11BypassCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled)
QtCore.QObject.connect(self.alternateRowsCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.onAlternateRowsCheckBoxToggled)
QtCore.QObject.connect(self.dataDirectoryBrowseButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.dataDirectoryBrowseButton, QtCore.SIGNAL(u'clicked()'),
self.onDataDirectoryBrowseButtonClicked) self.onDataDirectoryBrowseButtonClicked)
QtCore.QObject.connect(self.dataDirectoryDefaultButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.dataDirectoryDefaultButton, QtCore.SIGNAL(u'clicked()'),
@ -260,7 +266,7 @@ class AdvancedTab(SettingsTab):
QtCore.QObject.connect(self.dataDirectoryCancelButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.dataDirectoryCancelButton, QtCore.SIGNAL(u'clicked()'),
self.onDataDirectoryCancelButtonClicked) self.onDataDirectoryCancelButtonClicked)
QtCore.QObject.connect(self.dataDirectoryCopyCheckBox, QtCore.SIGNAL(u'toggled(bool)'), QtCore.QObject.connect(self.dataDirectoryCopyCheckBox, QtCore.SIGNAL(u'toggled(bool)'),
self.onDataDirectoryCopyCheckBoxToggled) self.onDataDirectoryCopyCheckBoxToggled)
QtCore.QObject.connect(self.endSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onEndSlideButtonClicked) QtCore.QObject.connect(self.endSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onEndSlideButtonClicked)
QtCore.QObject.connect(self.wrapSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onWrapSlideButtonClicked) QtCore.QObject.connect(self.wrapSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onWrapSlideButtonClicked)
QtCore.QObject.connect(self.nextItemRadioButton, QtCore.SIGNAL(u'clicked()'), self.onnextItemButtonClicked) QtCore.QObject.connect(self.nextItemRadioButton, QtCore.SIGNAL(u'clicked()'), self.onnextItemButtonClicked)
@ -324,8 +330,9 @@ class AdvancedTab(SettingsTab):
self.newDataDirectoryHasFilesLabel.setText( self.newDataDirectoryHasFilesLabel.setText(
translate('OpenLP.AdvancedTab', '<strong>WARNING:</strong> New data directory location contains ' translate('OpenLP.AdvancedTab', '<strong>WARNING:</strong> New data directory location contains '
'OpenLP data files. These files WILL be replaced during a copy.')) 'OpenLP data files. These files WILL be replaced during a copy.'))
self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', 'X11')) self.displayWorkaroundGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Display Workarounds'))
self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab', 'Bypass X11 Window Manager')) self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab', 'Bypass X11 Window Manager'))
self.alternateRowsCheckBox.setText(translate('OpenLP.AdvancedTab', 'Use alternating row colours in lists'))
# Slide Limits # Slide Limits
self.slideGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits')) self.slideGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
self.slideLabel.setText(translate('OpenLP.GeneralTab', 'Behavior of next/previous on the last/first slide:')) self.slideLabel.setText(translate('OpenLP.GeneralTab', 'Behavior of next/previous on the last/first slide:'))
@ -362,6 +369,10 @@ class AdvancedTab(SettingsTab):
self.defaultColor = settings.value(u'default color') self.defaultColor = settings.value(u'default color')
self.defaultFileEdit.setText(settings.value(u'default image')) self.defaultFileEdit.setText(settings.value(u'default image'))
self.slide_limits = settings.value(u'slide limits') self.slide_limits = settings.value(u'slide limits')
# Prevent the dialog displayed by the alternateRowsCheckBox to display.
self.alternateRowsCheckBox.blockSignals(True)
self.alternateRowsCheckBox.setChecked(settings.value(u'alternate rows'))
self.alternateRowsCheckBox.blockSignals(False)
if self.slide_limits == SlideLimits.End: if self.slide_limits == SlideLimits.End:
self.endSlideRadioButton.setChecked(True) self.endSlideRadioButton.setChecked(True)
elif self.slide_limits == SlideLimits.Wrap: elif self.slide_limits == SlideLimits.Wrap:
@ -431,6 +442,7 @@ class AdvancedTab(SettingsTab):
settings.setValue(u'enable exit confirmation', self.enableAutoCloseCheckBox.isChecked()) settings.setValue(u'enable exit confirmation', self.enableAutoCloseCheckBox.isChecked())
settings.setValue(u'hide mouse', self.hideMouseCheckBox.isChecked()) settings.setValue(u'hide mouse', self.hideMouseCheckBox.isChecked())
settings.setValue(u'x11 bypass wm', self.x11BypassCheckBox.isChecked()) settings.setValue(u'x11 bypass wm', self.x11BypassCheckBox.isChecked())
settings.setValue(u'alternate rows', self.alternateRowsCheckBox.isChecked())
settings.setValue(u'default color', self.defaultColor) settings.setValue(u'default color', self.defaultColor)
settings.setValue(u'default image', self.defaultFileEdit.text()) settings.setValue(u'default image', self.defaultFileEdit.text())
settings.setValue(u'slide limits', self.slide_limits) settings.setValue(u'slide limits', self.slide_limits)
@ -648,6 +660,17 @@ class AdvancedTab(SettingsTab):
The state of the check box (boolean). The state of the check box (boolean).
""" """
self.displayChanged = True self.displayChanged = True
def onAlternateRowsCheckBoxToggled(self, checked):
"""
Notify user about required restart.
``checked``
The state of the check box (boolean).
"""
QtGui.QMessageBox.information(self,
translate('OpenLP.AdvancedTab', 'Restart Required'),
translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP has been restarted.'))
def onEndSlideButtonClicked(self): def onEndSlideButtonClicked(self):
""" """

View File

@ -94,6 +94,14 @@ class SlideController(DisplayController):
u'audioPauseItem', u'audioPauseItem',
u'audioTimeLabel' u'audioTimeLabel'
] ]
self.wideMenu = [
u'blankScreenButton',
u'themeScreenButton',
u'desktopScreenButton'
]
self.hideMenuList = [
u'hideMenu'
]
self.timer_id = 0 self.timer_id = 0
self.songEdit = False self.songEdit = False
self.selectedRow = 0 self.selectedRow = 0
@ -195,6 +203,19 @@ class SlideController(DisplayController):
self.hideMenu.menu().addAction(self.blankScreen) self.hideMenu.menu().addAction(self.blankScreen)
self.hideMenu.menu().addAction(self.themeScreen) self.hideMenu.menu().addAction(self.themeScreen)
self.hideMenu.menu().addAction(self.desktopScreen) self.hideMenu.menu().addAction(self.desktopScreen)
# Wide menu of display control buttons.
self.blankScreenButton = QtGui.QToolButton(self.toolbar)
self.blankScreenButton.setObjectName(u'blankScreenButton')
self.toolbar.addToolbarWidget(self.blankScreenButton)
self.blankScreenButton.setDefaultAction(self.blankScreen)
self.themeScreenButton = QtGui.QToolButton(self.toolbar)
self.themeScreenButton.setObjectName(u'themeScreenButton')
self.toolbar.addToolbarWidget(self.themeScreenButton)
self.themeScreenButton.setDefaultAction(self.themeScreen)
self.desktopScreenButton = QtGui.QToolButton(self.toolbar)
self.desktopScreenButton.setObjectName(u'desktopScreenButton')
self.toolbar.addToolbarWidget(self.desktopScreenButton)
self.desktopScreenButton.setDefaultAction(self.desktopScreen)
self.toolbar.addToolbarAction(u'loopSeparator', separator=True) self.toolbar.addToolbarAction(u'loopSeparator', separator=True)
# Play Slides Menu # Play Slides Menu
self.playSlidesMenu = QtGui.QToolButton(self.toolbar) self.playSlidesMenu = QtGui.QToolButton(self.toolbar)
@ -346,6 +367,7 @@ class SlideController(DisplayController):
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_toggle_display'), self.toggleDisplay) QtCore.SIGNAL(u'slidecontroller_toggle_display'), self.toggleDisplay)
self.toolbar.setWidgetVisible(self.loopList, False) self.toolbar.setWidgetVisible(self.loopList, False)
self.toolbar.setWidgetVisible(self.wideMenu, False)
else: else:
QtCore.QObject.connect(self.previewListWidget, QtCore.QObject.connect(self.previewListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLiveClick) QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLiveClick)
@ -573,7 +595,20 @@ class SlideController(DisplayController):
width = self.parent().controlSplitter.sizes()[self.split] width = self.parent().controlSplitter.sizes()[self.split]
for framenumber in range(len(self.serviceItem.get_frames())): for framenumber in range(len(self.serviceItem.get_frames())):
self.previewListWidget.setRowHeight(framenumber, width / self.ratio) self.previewListWidget.setRowHeight(framenumber, width / self.ratio)
self.onControllerSizeChanged(self.controller.width(), self.controller.height())
def onControllerSizeChanged(self, width, height):
"""
Change layout of display control buttons on controller size change
"""
if self.isLive:
if width > 300 and self.hideMenu.isVisible():
self.toolbar.setWidgetVisible(self.hideMenuList, False)
self.toolbar.setWidgetVisible(self.wideMenu)
elif width < 300 and not self.hideMenu.isVisible():
self.toolbar.setWidgetVisible(self.wideMenu, False)
self.toolbar.setWidgetVisible(self.hideMenuList)
def onSongBarHandler(self): def onSongBarHandler(self):
""" """
Some song handler Some song handler