2009-02-28 23:31:24 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
|
|
|
2009-09-08 19:58:05 +00:00
|
|
|
###############################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# --------------------------------------------------------------------------- #
|
2010-12-26 11:04:47 +00:00
|
|
|
# Copyright (c) 2008-2011 Raoul Snyman #
|
|
|
|
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
2011-02-24 05:47:38 +00:00
|
|
|
# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, #
|
|
|
|
# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon #
|
|
|
|
# Tibble, Carsten Tinggaard, Frode Woldsund #
|
2009-09-08 19:58:05 +00:00
|
|
|
# --------------------------------------------------------------------------- #
|
|
|
|
# This program is free software; you can redistribute it and/or modify it #
|
|
|
|
# under the terms of the GNU General Public License as published by the Free #
|
|
|
|
# Software Foundation; version 2 of the License. #
|
|
|
|
# #
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
|
|
|
# more details. #
|
|
|
|
# #
|
|
|
|
# You should have received a copy of the GNU General Public License along #
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
|
|
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
|
|
|
###############################################################################
|
2009-02-28 23:31:24 +00:00
|
|
|
|
2009-10-17 05:47:17 +00:00
|
|
|
from PyQt4 import QtCore, QtGui
|
|
|
|
|
2010-05-31 22:06:16 +00:00
|
|
|
from openlp.core.lib import SettingsTab, translate
|
2009-02-28 23:31:24 +00:00
|
|
|
|
|
|
|
class SongsTab(SettingsTab):
|
|
|
|
"""
|
2009-10-17 05:47:17 +00:00
|
|
|
SongsTab is the Songs settings tab in the settings dialog.
|
2009-02-28 23:31:24 +00:00
|
|
|
"""
|
2010-09-16 21:10:36 +00:00
|
|
|
def __init__(self, title, visible_title):
|
|
|
|
SettingsTab.__init__(self, title, visible_title)
|
2009-02-28 23:31:24 +00:00
|
|
|
|
|
|
|
def setupUi(self):
|
|
|
|
self.setObjectName(u'SongsTab')
|
2011-01-03 11:25:30 +00:00
|
|
|
SettingsTab.setupUi(self)
|
|
|
|
self.SongsModeGroupBox = QtGui.QGroupBox(self.leftColumn)
|
2009-10-17 05:47:17 +00:00
|
|
|
self.SongsModeGroupBox.setObjectName(u'SongsModeGroupBox')
|
|
|
|
self.SongsModeLayout = QtGui.QVBoxLayout(self.SongsModeGroupBox)
|
|
|
|
self.SongsModeLayout.setObjectName(u'SongsModeLayout')
|
|
|
|
self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
|
|
|
|
self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox')
|
|
|
|
self.SongsModeLayout.addWidget(self.SearchAsTypeCheckBox)
|
2009-10-26 06:30:08 +00:00
|
|
|
self.SongBarActiveCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
|
2010-10-06 19:27:30 +00:00
|
|
|
self.SongBarActiveCheckBox.setObjectName(u'SongBarActiveCheckBox')
|
2009-10-26 06:30:08 +00:00
|
|
|
self.SongsModeLayout.addWidget(self.SongBarActiveCheckBox)
|
2010-10-06 19:27:30 +00:00
|
|
|
self.SongUpdateOnEditCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
|
|
|
|
self.SongUpdateOnEditCheckBox.setObjectName(u'SongUpdateOnEditCheckBox')
|
|
|
|
self.SongsModeLayout.addWidget(self.SongUpdateOnEditCheckBox)
|
2010-11-03 18:03:28 +00:00
|
|
|
self.SongAddFromServiceCheckBox = QtGui.QCheckBox(
|
|
|
|
self.SongsModeGroupBox)
|
|
|
|
self.SongAddFromServiceCheckBox.setObjectName(
|
|
|
|
u'SongAddFromServiceCheckBox')
|
2010-10-06 19:27:30 +00:00
|
|
|
self.SongsModeLayout.addWidget(self.SongAddFromServiceCheckBox)
|
2011-01-03 11:25:30 +00:00
|
|
|
self.leftLayout.addWidget(self.SongsModeGroupBox)
|
|
|
|
self.leftLayout.addStretch()
|
|
|
|
self.rightLayout.addStretch()
|
2009-10-17 05:47:17 +00:00
|
|
|
QtCore.QObject.connect(self.SearchAsTypeCheckBox,
|
|
|
|
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
|
|
self.onSearchAsTypeCheckBoxChanged)
|
2009-10-26 06:30:08 +00:00
|
|
|
QtCore.QObject.connect(self.SongBarActiveCheckBox,
|
|
|
|
QtCore.SIGNAL(u'stateChanged(int)'),
|
2010-10-06 19:27:30 +00:00
|
|
|
self.onSongBarActiveCheckBoxChanged)
|
|
|
|
QtCore.QObject.connect(self.SongUpdateOnEditCheckBox,
|
|
|
|
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
|
|
self.onSongUpdateOnEditCheckBoxChanged)
|
2010-12-20 07:50:39 +00:00
|
|
|
QtCore.QObject.connect(self.SongAddFromServiceCheckBox,
|
2010-10-06 19:27:30 +00:00
|
|
|
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
|
|
self.onSongAddFromServiceCheckBoxChanged)
|
2009-10-17 05:47:17 +00:00
|
|
|
|
|
|
|
def retranslateUi(self):
|
2010-06-06 14:22:00 +00:00
|
|
|
self.SongsModeGroupBox.setTitle(
|
2010-06-21 16:43:59 +00:00
|
|
|
translate('SongsPlugin.SongsTab', 'Songs Mode'))
|
2009-10-30 17:44:16 +00:00
|
|
|
self.SearchAsTypeCheckBox.setText(
|
2010-06-21 16:43:59 +00:00
|
|
|
translate('SongsPlugin.SongsTab', 'Enable search as you type'))
|
2010-06-21 18:28:36 +00:00
|
|
|
self.SongBarActiveCheckBox.setText(translate('SongsPlugin.SongsTab',
|
2010-07-23 19:17:36 +00:00
|
|
|
'Display verses on live tool bar'))
|
2010-10-06 19:27:30 +00:00
|
|
|
self.SongUpdateOnEditCheckBox.setText(
|
|
|
|
translate('SongsPlugin.SongsTab', 'Update service from song edit'))
|
2010-11-03 18:03:28 +00:00
|
|
|
self.SongAddFromServiceCheckBox.setText(
|
|
|
|
translate('SongsPlugin.SongsTab',
|
2010-10-06 20:30:49 +00:00
|
|
|
'Add missing songs when opening service'))
|
2009-10-17 05:47:17 +00:00
|
|
|
|
|
|
|
def onSearchAsTypeCheckBoxChanged(self, check_state):
|
2009-10-26 06:30:08 +00:00
|
|
|
self.song_search = False
|
|
|
|
# we have a set value convert to True/False
|
|
|
|
if check_state == QtCore.Qt.Checked:
|
|
|
|
self.song_search = True
|
|
|
|
|
2010-10-06 19:27:30 +00:00
|
|
|
def onSongBarActiveCheckBoxChanged(self, check_state):
|
2009-10-26 06:30:08 +00:00
|
|
|
self.song_bar = False
|
2009-10-17 05:47:17 +00:00
|
|
|
# we have a set value convert to True/False
|
|
|
|
if check_state == QtCore.Qt.Checked:
|
2009-10-26 06:30:08 +00:00
|
|
|
self.song_bar = True
|
2009-10-17 05:47:17 +00:00
|
|
|
|
2010-10-06 19:27:30 +00:00
|
|
|
def onSongUpdateOnEditCheckBoxChanged(self, check_state):
|
|
|
|
self.update_edit = False
|
|
|
|
# we have a set value convert to True/False
|
|
|
|
if check_state == QtCore.Qt.Checked:
|
|
|
|
self.update_edit = True
|
|
|
|
|
|
|
|
def onSongAddFromServiceCheckBoxChanged(self, check_state):
|
|
|
|
self.update_load = False
|
|
|
|
# we have a set value convert to True/False
|
|
|
|
if check_state == QtCore.Qt.Checked:
|
|
|
|
self.update_load = True
|
|
|
|
|
2009-10-17 05:47:17 +00:00
|
|
|
def load(self):
|
2010-04-27 16:27:57 +00:00
|
|
|
settings = QtCore.QSettings()
|
2010-04-30 22:38:15 +00:00
|
|
|
settings.beginGroup(self.settingsSection)
|
2010-04-27 16:27:57 +00:00
|
|
|
self.song_search = settings.value(
|
2010-04-28 14:17:42 +00:00
|
|
|
u'search as type', QtCore.QVariant(False)).toBool()
|
|
|
|
self.song_bar = settings.value(
|
|
|
|
u'display songbar', QtCore.QVariant(True)).toBool()
|
2010-10-06 19:27:30 +00:00
|
|
|
self.update_edit = settings.value(
|
|
|
|
u'update service on edit', QtCore.QVariant(False)).toBool()
|
|
|
|
self.update_load = settings.value(
|
|
|
|
u'add song from service', QtCore.QVariant(True)).toBool()
|
2009-10-26 06:30:08 +00:00
|
|
|
self.SearchAsTypeCheckBox.setChecked(self.song_search)
|
|
|
|
self.SongBarActiveCheckBox.setChecked(self.song_bar)
|
2010-10-06 19:27:30 +00:00
|
|
|
self.SongUpdateOnEditCheckBox.setChecked(self.update_edit)
|
|
|
|
self.SongAddFromServiceCheckBox.setChecked(self.update_load)
|
2010-04-28 14:17:42 +00:00
|
|
|
settings.endGroup()
|
2009-10-17 05:47:17 +00:00
|
|
|
|
|
|
|
def save(self):
|
2010-04-27 16:27:57 +00:00
|
|
|
settings = QtCore.QSettings()
|
2010-04-30 22:38:15 +00:00
|
|
|
settings.beginGroup(self.settingsSection)
|
2010-04-28 14:17:42 +00:00
|
|
|
settings.setValue(u'search as type', QtCore.QVariant(self.song_search))
|
|
|
|
settings.setValue(u'display songbar', QtCore.QVariant(self.song_bar))
|
2010-11-03 18:03:28 +00:00
|
|
|
settings.setValue(u'update service on edit',
|
|
|
|
QtCore.QVariant(self.update_edit))
|
|
|
|
settings.setValue(u'add song from service',
|
|
|
|
QtCore.QVariant(self.update_load))
|
2011-01-02 22:24:14 +00:00
|
|
|
settings.endGroup()
|