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:
Settings().setValue(u'general/has run wizard', True)
# 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)
application_stylesheet = \
alternate_rows_repair_stylesheet = \
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
if application_stylesheet:
self.setStyleSheet(application_stylesheet)
show_splash = Settings().value(u'general/show splash')
if show_splash:

View File

@ -87,6 +87,7 @@ class Settings(QtCore.QSettings):
"""
__default_settings__ = {
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/enable exit confirmation': True,
u'advanced/save current plugin': False,

View File

@ -229,14 +229,18 @@ class AdvancedTab(SettingsTab):
self.nextItemRadioButton.setObjectName(u'nextItemRadioButton')
self.slideLayout.addWidget(self.nextItemRadioButton)
self.rightLayout.addWidget(self.slideGroupBox)
self.x11GroupBox = QtGui.QGroupBox(self.leftColumn)
self.x11GroupBox.setObjectName(u'x11GroupBox')
self.x11Layout = QtGui.QVBoxLayout(self.x11GroupBox)
self.x11Layout.setObjectName(u'x11Layout')
self.x11BypassCheckBox = QtGui.QCheckBox(self.x11GroupBox)
# Display Workarounds
self.displayWorkaroundGroupBox = QtGui.QGroupBox(self.leftColumn)
self.displayWorkaroundGroupBox.setObjectName(u'displayWorkaroundGroupBox')
self.displayWorkaroundLayout = QtGui.QVBoxLayout(self.displayWorkaroundGroupBox)
self.displayWorkaroundLayout.setObjectName(u'displayWorkaroundLayout')
self.x11BypassCheckBox = QtGui.QCheckBox(self.displayWorkaroundGroupBox)
self.x11BypassCheckBox.setObjectName(u'x11BypassCheckBox')
self.x11Layout.addWidget(self.x11BypassCheckBox)
self.rightLayout.addWidget(self.x11GroupBox)
self.displayWorkaroundLayout.addWidget(self.x11BypassCheckBox)
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.shouldUpdateServiceNameExample = False
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.defaultRevertButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked)
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()'),
self.onDataDirectoryBrowseButtonClicked)
QtCore.QObject.connect(self.dataDirectoryDefaultButton, QtCore.SIGNAL(u'clicked()'),
@ -324,8 +330,9 @@ class AdvancedTab(SettingsTab):
self.newDataDirectoryHasFilesLabel.setText(
translate('OpenLP.AdvancedTab', '<strong>WARNING:</strong> New data directory location contains '
'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.alternateRowsCheckBox.setText(translate('OpenLP.AdvancedTab', 'Use alternating row colours in lists'))
# 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:'))
@ -362,6 +369,10 @@ class AdvancedTab(SettingsTab):
self.defaultColor = settings.value(u'default color')
self.defaultFileEdit.setText(settings.value(u'default image'))
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:
self.endSlideRadioButton.setChecked(True)
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'hide mouse', self.hideMouseCheckBox.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 image', self.defaultFileEdit.text())
settings.setValue(u'slide limits', self.slide_limits)
@ -649,6 +661,17 @@ class AdvancedTab(SettingsTab):
"""
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):
"""
Set the slide wrap option.

View File

@ -94,6 +94,14 @@ class SlideController(DisplayController):
u'audioPauseItem',
u'audioTimeLabel'
]
self.wideMenu = [
u'blankScreenButton',
u'themeScreenButton',
u'desktopScreenButton'
]
self.hideMenuList = [
u'hideMenu'
]
self.timer_id = 0
self.songEdit = False
self.selectedRow = 0
@ -195,6 +203,19 @@ class SlideController(DisplayController):
self.hideMenu.menu().addAction(self.blankScreen)
self.hideMenu.menu().addAction(self.themeScreen)
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)
# Play Slides Menu
self.playSlidesMenu = QtGui.QToolButton(self.toolbar)
@ -346,6 +367,7 @@ class SlideController(DisplayController):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_toggle_display'), self.toggleDisplay)
self.toolbar.setWidgetVisible(self.loopList, False)
self.toolbar.setWidgetVisible(self.wideMenu, False)
else:
QtCore.QObject.connect(self.previewListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLiveClick)
@ -573,6 +595,19 @@ class SlideController(DisplayController):
width = self.parent().controlSplitter.sizes()[self.split]
for framenumber in range(len(self.serviceItem.get_frames())):
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):
"""