Merge branch 'add-slide-numbers-in-song-footer' into 'master'

Add slide numbers in footers

Closes #847

See merge request openlp/openlp!339
This commit is contained in:
Tim Bentley 2021-07-22 20:48:16 +00:00
commit e048348890
6 changed files with 36 additions and 3 deletions

View File

@ -168,6 +168,7 @@ class Settings(QtCore.QSettings):
'advanced/save current plugin': False,
'advanced/slide limits': SlideLimits.End,
'advanced/slide max height': -4,
'advanced/slide numbers in footer': False,
'advanced/single click preview': False,
'advanced/single click service preview': False,
'advanced/x11 bypass wm': X11_BYPASS_DEFAULT,

View File

@ -281,6 +281,10 @@ var Display = {
let isDisplay = options.isDisplay || false;
let doItemTransitions = options.doItemTransitions || false;
let hideMouse = options.hideMouse || false;
if (options.slideNumbersInFooter) {
Display._revealConfig.slideNumber = "c/t";
}
// Now continue to initialisation
if (!isDisplay) {
document.body.classList.add('checkerboard');
@ -565,9 +569,7 @@ var Display = {
* Display the next alert in the queue
*/
showNextAlert: function () {
console.log("showNextAlert");
if (Display._alerts.length > 0) {
console.log("Showing next alert");
var alertObject = Display._alerts.shift();
Display._alertState = AlertState.DisplayingFromQueue;
Display.showAlert(alertObject.text, alertObject.settings);

View File

@ -212,13 +212,15 @@ class DisplayWindow(QtWidgets.QWidget, RegistryProperties, LogMixin):
js_is_display = str(self.is_display).lower()
item_transitions = str(self.settings.value('themes/item transitions')).lower()
hide_mouse = str(self.settings.value('advanced/hide mouse') and self.is_display).lower()
slide_numbers_in_footer = str(self.settings.value('advanced/slide numbers in footer')).lower()
self.run_javascript('Display.init({{'
'isDisplay: {is_display},'
'doItemTransitions: {do_item_transitions},'
'slideNumbersInFooter: {slide_numbers_in_footer},'
'hideMouse: {hide_mouse}'
'}});'
.format(is_display=js_is_display, do_item_transitions=item_transitions,
hide_mouse=hide_mouse))
slide_numbers_in_footer=slide_numbers_in_footer, hide_mouse=hide_mouse))
wait_for(lambda: self._is_initialised)
if self.scale != 1:
self.set_scale(self.scale)

View File

@ -157,6 +157,9 @@ class GeneralTab(SettingsTab):
self.autoscroll_combo_box.setObjectName('autoscroll_combo_box')
self.ui_layout.addRow(self.autoscroll_label)
self.ui_layout.addRow(self.autoscroll_combo_box)
self.slide_no_in_footer_checkbox = QtWidgets.QCheckBox(self.ui_group_box)
self.slide_no_in_footer_checkbox.setObjectName('SlideNumbersInFooter_check_box')
self.ui_layout.addRow(self.slide_no_in_footer_checkbox)
self.search_as_type_check_box = QtWidgets.QCheckBox(self.ui_group_box)
self.search_as_type_check_box.setObjectName('SearchAsType_check_box')
self.ui_layout.addRow(self.search_as_type_check_box)
@ -241,6 +244,7 @@ class GeneralTab(SettingsTab):
'Auto-scroll the next slide to bottom'))
self.enable_auto_close_check_box.setText(translate('OpenLP.AdvancedTab',
'Enable application exit confirmation'))
self.slide_no_in_footer_checkbox.setText(translate('SongsPlugin.GeneralTab', 'Include slide number in footer'))
self.search_as_type_check_box.setText(translate('SongsPlugin.GeneralTab', 'Enable search as you type'))
if not is_win() and HAS_DARK_STYLE:
self.use_dark_style_checkbox.setText(translate('OpenLP.AdvancedTab', 'Use dark style (needs restart)'))
@ -280,6 +284,7 @@ class GeneralTab(SettingsTab):
if self.autoscroll_map[i] == autoscroll_value and i < self.autoscroll_combo_box.count():
self.autoscroll_combo_box.setCurrentIndex(i)
self.enable_auto_close_check_box.setChecked(self.settings.value('advanced/enable exit confirmation'))
self.slide_no_in_footer_checkbox.setChecked(self.settings.value('advanced/slide numbers in footer'))
if not is_win() and HAS_DARK_STYLE:
self.use_dark_style_checkbox.setChecked(self.settings.value('advanced/use_dark_style'))
self.hide_mouse_check_box.setChecked(self.settings.value('advanced/hide mouse'))
@ -310,6 +315,7 @@ class GeneralTab(SettingsTab):
slide_max_height_value = self.slide_max_height_combo_box.itemData(slide_max_height_index)
self.settings.setValue('advanced/slide max height', slide_max_height_value)
self.settings.setValue('advanced/autoscrolling', self.autoscroll_map[self.autoscroll_combo_box.currentIndex()])
self.settings.setValue('advanced/slide numbers in footer', self.slide_no_in_footer_checkbox.isChecked())
self.settings.setValue('advanced/enable exit confirmation', self.enable_auto_close_check_box.isChecked())
self.settings.setValue('advanced/hide mouse', self.hide_mouse_check_box.isChecked())
self.settings.setValue('advanced/search as type', self.is_search_as_you_type_enabled)

View File

@ -255,6 +255,7 @@ def test_after_loaded(display_window_env, mock_settings):
display_window.run_javascript.assert_called_once_with('Display.init({'
'isDisplay: true,'
'doItemTransitions: true,'
'slideNumbersInFooter: true,'
'hideMouse: true'
'});')
display_window.set_scale.assert_called_once_with(2)
@ -282,6 +283,7 @@ def test_after_loaded_hide_mouse_not_display(display_window_env, mock_settings):
display_window.run_javascript.assert_called_once_with('Display.init({'
'isDisplay: false,'
'doItemTransitions: true,'
'slideNumbersInFooter: true,'
'hideMouse: false'
'});')

View File

@ -24,6 +24,8 @@ Package to test the openlp.core.ui.generaltab package.
from openlp.core.ui.generaltab import GeneralTab
from openlp.core.ui.settingsform import SettingsForm
from PyQt5 import QtCore, QtTest
def test_creation(settings):
"""
@ -54,3 +56,21 @@ def test_change_search_as_type(settings):
assert 2 == len(settings_form.processes), 'Two post save processes should be created'
assert "songs_config_updated" in settings_form.processes, 'The songs plugin should be called'
assert "custom_config_updated" in settings_form.processes, 'The custom plugin should be called'
def test_slide_numbers_in_footer(settings):
"""
Test that when the slide number in footers option is changed then the settings are updated
"""
# GIVEN: Settings, a settings form and a general tab
settings.setValue('advanced/slide numbers in footer', False)
settings_form = SettingsForm(None)
general_tab = GeneralTab(settings_form)
settings_form.insert_tab(general_tab, is_visible=True)
# WHEN: I click the checkbox and then save
QtTest.QTest.mouseClick(general_tab.slide_no_in_footer_checkbox, QtCore.Qt.LeftButton)
settings_form.accept()
# THEN: the settings should be updated
assert settings.value('advanced/slide numbers in footer') is True