Merged in changes from the songmaintenance branch
bzr-revno: 497
@ -53,7 +53,10 @@ class RenderManager(object):
|
||||
self.screen_list = screen_list
|
||||
self.theme_manager = theme_manager
|
||||
self.displays = len(screen_list)
|
||||
self.current_display = screen_number
|
||||
if (screen_number + 1) > len(screen_list):
|
||||
self.current_display = 0
|
||||
else:
|
||||
self.current_display = screen_number
|
||||
self.renderer = Renderer()
|
||||
self.calculate_default(self.screen_list[self.current_display][u'size'])
|
||||
self.theme = u''
|
||||
|
@ -23,6 +23,7 @@ from topicsform import TopicsForm
|
||||
from songbookform import SongBookForm
|
||||
from editverseform import EditVerseForm
|
||||
from editsongform import EditSongForm
|
||||
from songmaintenanceform import SongMaintenanceForm
|
||||
|
||||
from openlpexportform import OpenLPExportForm
|
||||
from openlpimportform import OpenLPImportForm
|
||||
|
@ -23,99 +23,56 @@ from openlp.core.lib import translate
|
||||
class Ui_AuthorsDialog(object):
|
||||
def setupUi(self, AuthorsDialog):
|
||||
AuthorsDialog.setObjectName(u'AuthorsDialog')
|
||||
AuthorsDialog.resize(410, 505)
|
||||
self.DialogLayout = QtGui.QVBoxLayout(AuthorsDialog)
|
||||
self.DialogLayout.setSpacing(8)
|
||||
self.DialogLayout.setMargin(8)
|
||||
self.DialogLayout.setObjectName(u'DialogLayout')
|
||||
self.AuthorListWidget = QtGui.QListWidget()
|
||||
self.AuthorListWidget.setAlternatingRowColors(True)
|
||||
self.DialogLayout.addWidget(self.AuthorListWidget)
|
||||
self.AuthorDetails = QtGui.QGroupBox(AuthorsDialog)
|
||||
self.AuthorDetails.setMinimumSize(QtCore.QSize(0, 0))
|
||||
self.AuthorDetails.setObjectName(u'AuthorDetails')
|
||||
self.AuthorLayout = QtGui.QVBoxLayout(self.AuthorDetails)
|
||||
self.AuthorLayout.setSpacing(8)
|
||||
self.AuthorLayout.setMargin(8)
|
||||
self.AuthorLayout.setObjectName(u'AuthorLayout')
|
||||
self.DetailsWidget = QtGui.QWidget(self.AuthorDetails)
|
||||
self.DetailsWidget.setObjectName(u'DetailsWidget')
|
||||
self.DetailsLayout = QtGui.QFormLayout(self.DetailsWidget)
|
||||
self.DetailsLayout.setMargin(0)
|
||||
self.DetailsLayout.setSpacing(8)
|
||||
self.DetailsLayout.setObjectName(u'DetailsLayout')
|
||||
self.DisplayLabel = QtGui.QLabel(self.DetailsWidget)
|
||||
self.DisplayLabel.setObjectName(u'DisplayLabel')
|
||||
self.DetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.DisplayLabel)
|
||||
self.DisplayEdit = QtGui.QLineEdit(self.DetailsWidget)
|
||||
self.DisplayEdit.setObjectName(u'DisplayEdit')
|
||||
self.DetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.DisplayEdit)
|
||||
self.FirstNameLabel = QtGui.QLabel(self.DetailsWidget)
|
||||
AuthorsDialog.resize(393, 147)
|
||||
self.AuthorsLayout = QtGui.QFormLayout(AuthorsDialog)
|
||||
self.AuthorsLayout.setMargin(8)
|
||||
self.AuthorsLayout.setSpacing(8)
|
||||
self.AuthorsLayout.setObjectName(u'AuthorsLayout')
|
||||
self.FirstNameLabel = QtGui.QLabel(AuthorsDialog)
|
||||
self.FirstNameLabel.setObjectName(u'FirstNameLabel')
|
||||
self.DetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FirstNameLabel)
|
||||
self.FirstNameEdit = QtGui.QLineEdit(self.DetailsWidget)
|
||||
self.AuthorsLayout.setWidget(0,
|
||||
QtGui.QFormLayout.LabelRole, self.FirstNameLabel)
|
||||
self.FirstNameEdit = QtGui.QLineEdit(AuthorsDialog)
|
||||
self.FirstNameEdit.setObjectName(u'FirstNameEdit')
|
||||
self.DetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FirstNameEdit)
|
||||
self.LastNameLabel = QtGui.QLabel(self.DetailsWidget)
|
||||
self.AuthorsLayout.setWidget(0,
|
||||
QtGui.QFormLayout.FieldRole, self.FirstNameEdit)
|
||||
self.LastNameLabel = QtGui.QLabel(AuthorsDialog)
|
||||
self.LastNameLabel.setObjectName(u'LastNameLabel')
|
||||
self.DetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.LastNameLabel)
|
||||
self.LastNameEdit = QtGui.QLineEdit(self.DetailsWidget)
|
||||
self.AuthorsLayout.setWidget(1,
|
||||
QtGui.QFormLayout.LabelRole, self.LastNameLabel)
|
||||
self.LastNameEdit = QtGui.QLineEdit(AuthorsDialog)
|
||||
self.LastNameEdit.setObjectName(u'LastNameEdit')
|
||||
self.DetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.LastNameEdit)
|
||||
self.AuthorLayout.addWidget(self.DetailsWidget)
|
||||
self.MessageLabel = QtGui.QLabel(self.AuthorDetails)
|
||||
self.MessageLabel.setObjectName(u'MessageLabel')
|
||||
self.AuthorLayout.addWidget(self.MessageLabel)
|
||||
self.ButtonWidget = QtGui.QWidget(self.AuthorDetails)
|
||||
self.ButtonWidget.setMinimumSize(QtCore.QSize(0, 0))
|
||||
self.ButtonWidget.setObjectName(u'ButtonWidget')
|
||||
self.ButtonLayout = QtGui.QHBoxLayout(self.ButtonWidget)
|
||||
self.ButtonLayout.setSpacing(8)
|
||||
self.ButtonLayout.setMargin(0)
|
||||
self.ButtonLayout.setObjectName(u'ButtonLayout')
|
||||
spacerItem = QtGui.QSpacerItem(198, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.ButtonLayout.addItem(spacerItem)
|
||||
self.ClearButton = QtGui.QPushButton(self.ButtonWidget)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/services/service_new.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.ClearButton.setIcon(icon)
|
||||
self.ClearButton.setObjectName(u'ClearButton')
|
||||
self.ButtonLayout.addWidget(self.ClearButton)
|
||||
self.AddUpdateButton = QtGui.QPushButton(self.ButtonWidget)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/services/service_save.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.AddUpdateButton.setIcon(icon1)
|
||||
self.AddUpdateButton.setObjectName(u'AddUpdateButton')
|
||||
self.ButtonLayout.addWidget(self.AddUpdateButton)
|
||||
self.DeleteButton = QtGui.QPushButton(self.ButtonWidget)
|
||||
icon2 = QtGui.QIcon()
|
||||
icon2.addPixmap(QtGui.QPixmap(u':/services/service_delete.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.DeleteButton.setIcon(icon2)
|
||||
self.DeleteButton.setObjectName(u'DeleteButton')
|
||||
self.ButtonLayout.addWidget(self.DeleteButton)
|
||||
self.AuthorLayout.addWidget(self.ButtonWidget)
|
||||
self.DialogLayout.addWidget(self.AuthorDetails)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(AuthorsDialog)
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.DialogLayout.addWidget(self.buttonBox)
|
||||
self.AuthorsLayout.setWidget(1,
|
||||
QtGui.QFormLayout.FieldRole, self.LastNameEdit)
|
||||
self.DisplayLabel = QtGui.QLabel(AuthorsDialog)
|
||||
self.DisplayLabel.setObjectName(u'DisplayLabel')
|
||||
self.AuthorsLayout.setWidget(2,
|
||||
QtGui.QFormLayout.LabelRole, self.DisplayLabel)
|
||||
self.DisplayEdit = QtGui.QLineEdit(AuthorsDialog)
|
||||
self.DisplayEdit.setObjectName(u'DisplayEdit')
|
||||
self.AuthorsLayout.setWidget(2,
|
||||
QtGui.QFormLayout.FieldRole, self.DisplayEdit)
|
||||
self.AuthorButtonBox = QtGui.QDialogButtonBox(AuthorsDialog)
|
||||
self.AuthorButtonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.AuthorButtonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
|
||||
self.AuthorButtonBox.setObjectName(u'AuthorButtonBox')
|
||||
self.AuthorsLayout.setWidget(3,
|
||||
QtGui.QFormLayout.FieldRole, self.AuthorButtonBox)
|
||||
|
||||
self.retranslateUi(AuthorsDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), AuthorsDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), AuthorsDialog.reject)
|
||||
QtCore.QObject.connect(self.AuthorButtonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), AuthorsDialog.accept)
|
||||
QtCore.QObject.connect(self.AuthorButtonBox,
|
||||
QtCore.SIGNAL(u'rejected()'), AuthorsDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(AuthorsDialog)
|
||||
|
||||
def retranslateUi(self, AuthorsDialog):
|
||||
AuthorsDialog.setWindowTitle(translate(u'AuthorsDialog', u'Author Maintenance'))
|
||||
self.AuthorDetails.setTitle(translate(u'AuthorsDialog', u'Author Details'))
|
||||
self.DisplayLabel.setText(translate(u'AuthorsDialog', u'Display Name:'))
|
||||
self.FirstNameLabel.setText(translate(u'AuthorsDialog', u'First Name:'))
|
||||
self.LastNameLabel.setText(translate(u'AuthorsDialog', u'Last Name:'))
|
||||
self.ClearButton.setToolTip(translate(u'AuthorsDialog', u'Clear Selection'))
|
||||
self.ClearButton.setText(translate(u'AuthorsDialog', u'Clear'))
|
||||
self.AddUpdateButton.setToolTip(translate(u'AuthorsDialog', u'Add Update Author'))
|
||||
self.AddUpdateButton.setText(translate(u'AuthorsDialog', u'Save'))
|
||||
self.DeleteButton.setToolTip(translate(u'AuthorsDialog', u'Delete Author'))
|
||||
self.DeleteButton.setText(translate(u'AuthorsDialog', u'Delete'))
|
||||
self.buttonBox.setToolTip(translate(u'AuthorsDialog', u'Exit Screen'))
|
||||
AuthorsDialog.setWindowTitle(
|
||||
translate(u'AuthorsDialog', u'Author Maintenance'))
|
||||
self.DisplayLabel.setText(
|
||||
translate(u'AuthorsDialog', u'Display name:'))
|
||||
self.FirstNameLabel.setText(
|
||||
translate(u'AuthorsDialog', u'First name:'))
|
||||
self.LastNameLabel.setText(
|
||||
translate(u'AuthorsDialog', u'Last name:'))
|
||||
|
@ -18,123 +18,82 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from openlp.core.lib import translate
|
||||
from openlp.plugins.songs.forms.authorsdialog import Ui_AuthorsDialog
|
||||
from openlp.plugins.songs.lib.classes import Author
|
||||
from authorsdialog import Ui_AuthorsDialog
|
||||
|
||||
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
||||
"""
|
||||
Class to control the Maintenance of Authors Dialog
|
||||
"""
|
||||
def __init__(self, songmanager, parent = None):
|
||||
def __init__(self, parent=None):
|
||||
"""
|
||||
Set up the screen and common data
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.songmanager = songmanager
|
||||
self.currentRow = 0
|
||||
self.author = None
|
||||
self.autoDisplayName = False
|
||||
QtCore.QObject.connect(self.FirstNameEdit,
|
||||
QtCore.SIGNAL(u'textEdited(QString)'), self.onFirstNameEditTextEdited)
|
||||
QtCore.QObject.connect(self.LastNameEdit,
|
||||
QtCore.SIGNAL(u'textEdited(QString)'), self.onLastNameEditTextEdited)
|
||||
|
||||
QtCore.QObject.connect(self.DeleteButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonClick)
|
||||
QtCore.QObject.connect(self.ClearButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onClearButtonClick)
|
||||
QtCore.QObject.connect(self.AddUpdateButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onAddUpdateButtonClick)
|
||||
QtCore.QObject.connect(self.DisplayEdit,
|
||||
QtCore.SIGNAL(u'lostFocus()'), self.onDisplayEditLostFocus)
|
||||
QtCore.QObject.connect(self.AuthorListWidget,
|
||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onAuthorListWidgetItemClicked)
|
||||
def exec_(self, clear=True):
|
||||
if clear:
|
||||
self.FirstNameEdit.clear()
|
||||
self.LastNameEdit.clear()
|
||||
self.DisplayEdit.clear()
|
||||
self.FirstNameEdit.setFocus()
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def load_form(self):
|
||||
"""
|
||||
Refresh the screen and rest fields
|
||||
"""
|
||||
self.AuthorListWidget.clear()
|
||||
# tidy up screen
|
||||
self.onClearButtonClick()
|
||||
authors = self.songmanager.get_authors()
|
||||
for author in authors:
|
||||
author_name = QtGui.QListWidgetItem(author.display_name)
|
||||
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
|
||||
self.AuthorListWidget.addItem(author_name)
|
||||
if self.currentRow >= self.AuthorListWidget.count() :
|
||||
self.AuthorListWidget.setCurrentRow(self.AuthorListWidget.count() - 1)
|
||||
def onFirstNameEditTextEdited(self, text):
|
||||
if not self.autoDisplayName:
|
||||
return
|
||||
display_name = text
|
||||
if self.LastNameEdit.text() != u'':
|
||||
display_name = display_name + u' ' + self.LastNameEdit.text()
|
||||
self.DisplayEdit.setText(display_name)
|
||||
|
||||
def onLastNameEditTextEdited(self, text):
|
||||
if not self.autoDisplayName:
|
||||
return
|
||||
display_name = text
|
||||
if self.FirstNameEdit.text() != u'':
|
||||
display_name = self.FirstNameEdit.text() + u' ' + display_name
|
||||
self.DisplayEdit.setText(display_name)
|
||||
|
||||
def autoDisplayName(self):
|
||||
return self.autoDisplayName
|
||||
|
||||
def setAutoDisplayName(self, on):
|
||||
self.autoDisplayName = on
|
||||
|
||||
def accept(self):
|
||||
if self.FirstNameEdit.text() == u'':
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'AuthorsDialog', u'Error'),
|
||||
translate(u'AuthorsDialog', u'You need to type in the first name of the author.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
self.FirstNameEdit.setFocus()
|
||||
return False
|
||||
elif self.LastNameEdit.text() == u'':
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'AuthorsDialog', u'Error'),
|
||||
translate(u'AuthorsDialog', u'You need to type in the last name of the author.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
self.LastNameEdit.setFocus()
|
||||
return False
|
||||
elif self.DisplayEdit.text() == u'':
|
||||
if QtGui.QMessageBox.critical(self,
|
||||
translate(u'AuthorsDialog', u'Error'),
|
||||
translate(u'AuthorsDialog', u'You haven\'t set a display name for the author, would you like me to combine the first and last names for you?'),
|
||||
QtGui.QMessageBox.StandardButtons(
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
|
||||
) == QtGui.QMessageBox.Yes:
|
||||
self.DisplayEdit.setText(self.FirstNameEdit.text() + \
|
||||
u' ' + self.LastNameEdit.text())
|
||||
return QtGui.QDialog.accept(self)
|
||||
else:
|
||||
self.DisplayEdit.setFocus()
|
||||
return False
|
||||
else:
|
||||
self.AuthorListWidget.setCurrentRow(self.currentRow)
|
||||
self._validate_form()
|
||||
self.onAuthorListWidgetItemClicked()
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def onDeleteButtonClick(self):
|
||||
"""
|
||||
Delete the author is the Author is not attached to any songs
|
||||
"""
|
||||
self.songmanager.delete_author(self.author.id)
|
||||
self.load_form()
|
||||
|
||||
def onDisplayEditLostFocus(self):
|
||||
self._validate_form()
|
||||
|
||||
def onAddUpdateButtonClick(self):
|
||||
"""
|
||||
Sent New or update details to the database
|
||||
"""
|
||||
if self.author == None:
|
||||
self.author = Author()
|
||||
self.author.display_name = unicode(self.DisplayEdit.displayText())
|
||||
self.author.first_name = unicode(self.FirstNameEdit.displayText())
|
||||
self.author.last_name = unicode(self.LastNameEdit.displayText())
|
||||
self.songmanager.save_author(self.author)
|
||||
self.onClearButtonClick()
|
||||
self.load_form()
|
||||
|
||||
def onClearButtonClick(self):
|
||||
"""
|
||||
Tidy up screen if clear button pressed
|
||||
"""
|
||||
self.DisplayEdit.setText(u'')
|
||||
self.FirstNameEdit.setText(u'')
|
||||
self.LastNameEdit.setText(u'')
|
||||
self.MessageLabel.setText(u'')
|
||||
self.DeleteButton.setEnabled(False)
|
||||
self.author = None
|
||||
self._validate_form()
|
||||
self.DisplayEdit.setFocus()
|
||||
|
||||
def onAuthorListWidgetItemClicked(self):
|
||||
"""
|
||||
An Author has been selected display it
|
||||
If the author is attached to a Song prevent delete
|
||||
"""
|
||||
self.currentRow = self.AuthorListWidget.currentRow()
|
||||
item = self.AuthorListWidget.currentItem()
|
||||
if item is not None:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
self.author = self.songmanager.get_author(item_id)
|
||||
self.DisplayEdit.setText(self.author.display_name)
|
||||
if self.author.first_name is None:
|
||||
self.FirstNameEdit.setText(u'')
|
||||
else:
|
||||
self.FirstNameEdit.setText(self.author.first_name)
|
||||
if self.author.last_name is None:
|
||||
self.LastNameEdit.setText(u'')
|
||||
else:
|
||||
self.LastNameEdit.setText(self.author.last_name)
|
||||
if len(self.author.songs) > 0:
|
||||
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled'))
|
||||
self.DeleteButton.setEnabled(False)
|
||||
else:
|
||||
self.MessageLabel.setText(translate(u'AuthorForm', u'Author in not used'))
|
||||
self.DeleteButton.setEnabled(True)
|
||||
self._validate_form()
|
||||
self.DisplayEdit.setFocus()
|
||||
|
||||
def _validate_form(self):
|
||||
"""
|
||||
Validate the form and set if Add button if valid.
|
||||
"""
|
||||
# We need at lease a display name
|
||||
if len(self.DisplayEdit.displayText()) == 0:
|
||||
self.AddUpdateButton.setEnabled(False)
|
||||
else:
|
||||
self.AddUpdateButton.setEnabled(True)
|
||||
|
@ -23,97 +23,46 @@ from openlp.core.lib import translate
|
||||
class Ui_SongBookDialog(object):
|
||||
def setupUi(self, SongBookDialog):
|
||||
SongBookDialog.setObjectName(u'SongBookDialog')
|
||||
SongBookDialog.resize(387, 531)
|
||||
self.DialogLayout = QtGui.QVBoxLayout(SongBookDialog)
|
||||
self.DialogLayout.setSpacing(8)
|
||||
self.DialogLayout.setMargin(8)
|
||||
self.DialogLayout.setObjectName(u'DialogLayout')
|
||||
self.BookSongListWidget = QtGui.QListWidget()
|
||||
self.BookSongListWidget.setAlternatingRowColors(True)
|
||||
self.DialogLayout.addWidget(self.BookSongListWidget)
|
||||
self.DialogLayout.addWidget(self.BookSongListWidget)
|
||||
self.SongBookGroup = QtGui.QGroupBox(SongBookDialog)
|
||||
self.SongBookGroup.setMinimumSize(QtCore.QSize(0, 200))
|
||||
self.SongBookGroup.setObjectName(u'SongBookGroup')
|
||||
self.SongBookLayout = QtGui.QVBoxLayout(self.SongBookGroup)
|
||||
self.SongBookLayout.setSpacing(8)
|
||||
SongBookDialog.resize(367, 120)
|
||||
self.SongBookLayout = QtGui.QFormLayout(SongBookDialog)
|
||||
self.SongBookLayout.setMargin(8)
|
||||
self.SongBookLayout.setSpacing(8)
|
||||
self.SongBookLayout.setObjectName(u'SongBookLayout')
|
||||
self.DetailsWidget = QtGui.QWidget(self.SongBookGroup)
|
||||
self.DetailsWidget.setMinimumSize(QtCore.QSize(0, 0))
|
||||
self.DetailsWidget.setObjectName(u'DetailsWidget')
|
||||
self.DetailsLayout = QtGui.QFormLayout(self.DetailsWidget)
|
||||
self.DetailsLayout.setMargin(0)
|
||||
self.DetailsLayout.setSpacing(8)
|
||||
self.DetailsLayout.setObjectName(u'DetailsLayout')
|
||||
self.NameLabel = QtGui.QLabel(self.DetailsWidget)
|
||||
self.NameLabel = QtGui.QLabel(SongBookDialog)
|
||||
self.NameLabel.setObjectName(u'NameLabel')
|
||||
self.DetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.NameLabel)
|
||||
self.NameEdit = QtGui.QLineEdit(self.DetailsWidget)
|
||||
self.SongBookLayout.setWidget(0,
|
||||
QtGui.QFormLayout.LabelRole, self.NameLabel)
|
||||
self.NameEdit = QtGui.QLineEdit(SongBookDialog)
|
||||
self.NameEdit.setObjectName(u'NameEdit')
|
||||
self.DetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.NameEdit)
|
||||
self.PublisherLabel = QtGui.QLabel(self.DetailsWidget)
|
||||
self.SongBookLayout.setWidget(0,
|
||||
QtGui.QFormLayout.FieldRole, self.NameEdit)
|
||||
self.PublisherLabel = QtGui.QLabel(SongBookDialog)
|
||||
self.PublisherLabel.setObjectName(u'PublisherLabel')
|
||||
self.DetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.PublisherLabel)
|
||||
self.PublisherEdit = QtGui.QLineEdit(self.DetailsWidget)
|
||||
self.SongBookLayout.setWidget(1,
|
||||
QtGui.QFormLayout.LabelRole, self.PublisherLabel)
|
||||
self.PublisherEdit = QtGui.QLineEdit(SongBookDialog)
|
||||
self.PublisherEdit.setObjectName(u'PublisherEdit')
|
||||
self.DetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.PublisherEdit)
|
||||
self.SongBookLayout.addWidget(self.DetailsWidget)
|
||||
self.MessageLabel = QtGui.QLabel(self.SongBookGroup)
|
||||
self.MessageLabel.setObjectName(u'MessageLabel')
|
||||
self.SongBookLayout.addWidget(self.MessageLabel)
|
||||
self.ButtonWidget = QtGui.QWidget(self.SongBookGroup)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.ButtonWidget.sizePolicy().hasHeightForWidth())
|
||||
self.ButtonWidget.setSizePolicy(sizePolicy)
|
||||
self.ButtonWidget.setMinimumSize(QtCore.QSize(0, 0))
|
||||
self.ButtonWidget.setObjectName(u'ButtonWidget')
|
||||
self.ButtonLayout = QtGui.QHBoxLayout(self.ButtonWidget)
|
||||
self.ButtonLayout.setSpacing(8)
|
||||
self.ButtonLayout.setMargin(0)
|
||||
self.ButtonLayout.setObjectName(u'ButtonLayout')
|
||||
spacerItem = QtGui.QSpacerItem(61, 24, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.ButtonLayout.addItem(spacerItem)
|
||||
self.ClearButton = QtGui.QPushButton(self.ButtonWidget)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/services/service_new.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.ClearButton.setIcon(icon)
|
||||
self.ClearButton.setObjectName(u'ClearButton')
|
||||
self.ButtonLayout.addWidget(self.ClearButton)
|
||||
self.AddUpdateButton = QtGui.QPushButton(self.ButtonWidget)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/services/service_save.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.AddUpdateButton.setIcon(icon1)
|
||||
self.AddUpdateButton.setObjectName(u'AddUpdateButton')
|
||||
self.ButtonLayout.addWidget(self.AddUpdateButton)
|
||||
self.DeleteButton = QtGui.QPushButton(self.ButtonWidget)
|
||||
icon2 = QtGui.QIcon()
|
||||
icon2.addPixmap(QtGui.QPixmap(u':/services/service_delete.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.DeleteButton.setIcon(icon2)
|
||||
self.DeleteButton.setObjectName(u'DeleteButton')
|
||||
self.ButtonLayout.addWidget(self.DeleteButton)
|
||||
self.SongBookLayout.addWidget(self.ButtonWidget)
|
||||
self.DialogLayout.addWidget(self.SongBookGroup)
|
||||
self.SongBookLayout.setWidget(1,
|
||||
QtGui.QFormLayout.FieldRole, self.PublisherEdit)
|
||||
self.ButtonBox = QtGui.QDialogButtonBox(SongBookDialog)
|
||||
self.ButtonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
|
||||
self.ButtonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
|
||||
self.ButtonBox.setObjectName(u'ButtonBox')
|
||||
self.DialogLayout.addWidget(self.ButtonBox)
|
||||
self.SongBookLayout.setWidget(2,
|
||||
QtGui.QFormLayout.FieldRole, self.ButtonBox)
|
||||
|
||||
self.retranslateUi(SongBookDialog)
|
||||
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), SongBookDialog.accept)
|
||||
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'rejected()'), SongBookDialog.reject)
|
||||
QtCore.QObject.connect(self.ButtonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), SongBookDialog.accept)
|
||||
QtCore.QObject.connect(self.ButtonBox,
|
||||
QtCore.SIGNAL(u'rejected()'), SongBookDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(SongBookDialog)
|
||||
|
||||
def retranslateUi(self, SongBookDialog):
|
||||
SongBookDialog.setWindowTitle(translate(u'SongBookDialog', u'Book Song Maintenance'))
|
||||
self.SongBookGroup.setTitle(translate(u'SongBookDialog', u'Song Book'))
|
||||
self.NameLabel.setText(translate(u'SongBookDialog', u'Name:'))
|
||||
self.PublisherLabel.setText(translate(u'SongBookDialog', u'Publisher:'))
|
||||
self.ClearButton.setToolTip(translate(u'SongBookDialog', u'Clear Selection'))
|
||||
self.ClearButton.setText(translate(u'SongBookDialog', u'Clear'))
|
||||
self.AddUpdateButton.setToolTip(translate(u'SongBookDialog', u'Add Update Author'))
|
||||
self.AddUpdateButton.setText(translate(u'SongBookDialog', u'Save'))
|
||||
self.DeleteButton.setToolTip(translate(u'SongBookDialog', u'Delete Author'))
|
||||
self.DeleteButton.setText(translate(u'SongBookDialog', u'Delete'))
|
||||
SongBookDialog.setWindowTitle(
|
||||
translate(u'SongBookDialog', u'Edit Book'))
|
||||
self.NameLabel.setText(
|
||||
translate(u'SongBookDialog', u'Name:'))
|
||||
self.PublisherLabel.setText(
|
||||
translate(u'SongBookDialog', u'Publisher:'))
|
||||
|
@ -20,109 +20,33 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from openlp.core.lib import translate
|
||||
from songbookdialog import Ui_SongBookDialog
|
||||
from openlp.plugins.songs.lib.classes import Book
|
||||
|
||||
class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
|
||||
"""
|
||||
Class documentation goes here.
|
||||
"""
|
||||
def __init__(self, songmanager, parent = None):
|
||||
def __init__(self, parent=None):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.songmanager = songmanager
|
||||
self.currentRow = 0
|
||||
self.songbook = None
|
||||
|
||||
QtCore.QObject.connect(self.DeleteButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonClick)
|
||||
QtCore.QObject.connect(self.ClearButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onClearButtonClick)
|
||||
QtCore.QObject.connect(self.AddUpdateButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onAddUpdateButtonClick)
|
||||
QtCore.QObject.connect(self.NameEdit,
|
||||
QtCore.SIGNAL(u'lostFocus()'), self.onBookNameEditLostFocus)
|
||||
QtCore.QObject.connect(self.BookSongListWidget,
|
||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onBooksListViewItemClicked)
|
||||
|
||||
def load_form(self):
|
||||
"""
|
||||
Refresh the screen and rest fields
|
||||
"""
|
||||
self.BookSongListWidget.clear()
|
||||
self.onClearButtonClick() # tidy up screen
|
||||
books = self.songmanager.get_books()
|
||||
for book in books:
|
||||
book_name = QtGui.QListWidgetItem(book.name)
|
||||
book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id))
|
||||
self.BookSongListWidget.addItem(book_name)
|
||||
if self.currentRow >= self.BookSongListWidget.count() :
|
||||
self.BookSongListWidget.setCurrentRow(self.BookSongListWidget.count() - 1)
|
||||
else:
|
||||
self.BookSongListWidget.setCurrentRow(self.currentRow)
|
||||
self.onBooksListViewItemClicked()
|
||||
|
||||
def onDeleteButtonClick(self):
|
||||
"""
|
||||
Delete the Book is the Book is not attached to any songs
|
||||
"""
|
||||
self.songmanager.delete_book(self.Book.id)
|
||||
self.load_form()
|
||||
|
||||
def onBookNameEditLostFocus(self):
|
||||
self._validate_form()
|
||||
|
||||
def onAddUpdateButtonClick(self):
|
||||
"""
|
||||
Sent New or update details to the database
|
||||
"""
|
||||
if self.Book == None:
|
||||
self.Book = Book()
|
||||
self.Book.name = unicode(self.NameEdit.displayText())
|
||||
self.Book.publisher = unicode(self.PublisherEdit.displayText())
|
||||
self.songmanager.save_book(self.Book)
|
||||
self.onClearButtonClick()
|
||||
self.load_form()
|
||||
|
||||
def onClearButtonClick(self):
|
||||
"""
|
||||
Tidy up screen if clear button pressed
|
||||
"""
|
||||
self.NameEdit.setText(u'')
|
||||
self.PublisherEdit.setText(u'')
|
||||
self.MessageLabel.setText(u'')
|
||||
self.DeleteButton.setEnabled(False)
|
||||
self.AddUpdateButton.setEnabled(True)
|
||||
self.Book = None
|
||||
self._validate_form()
|
||||
def exec_(self, clear=True):
|
||||
if clear:
|
||||
self.NameEdit.clear()
|
||||
self.PublisherEdit.clear()
|
||||
self.NameEdit.setFocus()
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def onBooksListViewItemClicked(self):
|
||||
"""
|
||||
An Book has been selected display it
|
||||
If the Book is attached to a Song prevent delete
|
||||
"""
|
||||
self.currentRow = self.BookSongListWidget.currentRow()
|
||||
item = self.BookSongListWidget.currentItem()
|
||||
if item is not None:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
self.Book = self.songmanager.get_book(item_id)
|
||||
self.NameEdit.setText(self.Book.name)
|
||||
self.PublisherEdit.setText(self.Book.publisher)
|
||||
if len(self.Book.songs) > 0:
|
||||
self.MessageLabel.setText(translate(u'BookForm', u'Book in use "Delete" is disabled'))
|
||||
self.DeleteButton.setEnabled(False)
|
||||
else:
|
||||
self.MessageLabel.setText(translate(u'BookForm', u'Book in not used'))
|
||||
self.DeleteButton.setEnabled(True)
|
||||
self._validate_form()
|
||||
self.NameEdit.setFocus()
|
||||
|
||||
def _validate_form(self):
|
||||
# We need at lease a display name
|
||||
if len(self.NameEdit.displayText()) == 0:
|
||||
self.AddUpdateButton.setEnabled(False)
|
||||
def accept(self):
|
||||
if self.NameEdit.text() == u'':
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'SongBookDialog', u'Error'),
|
||||
translate(u'SongBookDialog', u'You need to type in a book name!'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
self.NameEdit.setFocus()
|
||||
return False
|
||||
else:
|
||||
self.AddUpdateButton.setEnabled(True)
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
|
254
openlp/plugins/songs/forms/songmaintenancedialog.py
Normal file
@ -0,0 +1,254 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
"""
|
||||
OpenLP - Open Source Lyrics Projection
|
||||
Copyright (c) 2008 Raoul Snyman
|
||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
|
||||
|
||||
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
|
||||
"""
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import translate
|
||||
|
||||
class Ui_SongMaintenanceDialog(object):
|
||||
def setupUi(self, SongMaintenanceDialog):
|
||||
SongMaintenanceDialog.setObjectName(u'SongMaintenanceDialog')
|
||||
SongMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal)
|
||||
SongMaintenanceDialog.resize(486, 361)
|
||||
self.DialogLayout = QtGui.QVBoxLayout(SongMaintenanceDialog)
|
||||
self.DialogLayout.setSpacing(8)
|
||||
self.DialogLayout.setMargin(8)
|
||||
self.DialogLayout.setObjectName(u'DialogLayout')
|
||||
self.ContentWidget = QtGui.QWidget(SongMaintenanceDialog)
|
||||
self.ContentWidget.setObjectName(u'ContentWidget')
|
||||
self.ContentLayout = QtGui.QHBoxLayout(self.ContentWidget)
|
||||
self.ContentLayout.setSpacing(8)
|
||||
self.ContentLayout.setMargin(0)
|
||||
self.ContentLayout.setObjectName(u'ContentLayout')
|
||||
self.TypeListWidget = QtGui.QListWidget(self.ContentWidget)
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(
|
||||
self.TypeListWidget.sizePolicy().hasHeightForWidth())
|
||||
self.TypeListWidget.setSizePolicy(sizePolicy)
|
||||
self.TypeListWidget.setViewMode(QtGui.QListView.IconMode)
|
||||
self.TypeListWidget.setIconSize(QtCore.QSize(112, 100));
|
||||
self.TypeListWidget.setMovement(QtGui.QListView.Static);
|
||||
self.TypeListWidget.setMaximumWidth(118);
|
||||
self.TypeListWidget.setSpacing(3);
|
||||
self.TypeListWidget.setSortingEnabled(False)
|
||||
self.TypeListWidget.setUniformItemSizes(True)
|
||||
self.TypeListWidget.setObjectName(u'TypeListWidget')
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/songs/author_maintenance.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
item = QtGui.QListWidgetItem(self.TypeListWidget)
|
||||
item.setIcon(icon)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/songs/topic_maintenance.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
item = QtGui.QListWidgetItem(self.TypeListWidget)
|
||||
item.setIcon(icon1)
|
||||
icon2 = QtGui.QIcon()
|
||||
icon2.addPixmap(QtGui.QPixmap(u':/songs/book_maintenance.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
item = QtGui.QListWidgetItem(self.TypeListWidget)
|
||||
item.setIcon(icon2)
|
||||
self.ContentLayout.addWidget(self.TypeListWidget)
|
||||
self.TypeStackedWidget = QtGui.QStackedWidget(self.ContentWidget)
|
||||
self.TypeStackedWidget.setObjectName(u'TypeStackedWidget')
|
||||
self.AuthorsPage = QtGui.QWidget()
|
||||
self.AuthorsPage.setObjectName(u'AuthorsPage')
|
||||
self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsPage)
|
||||
self.AuthorsLayout.setSpacing(4)
|
||||
self.AuthorsLayout.setMargin(0)
|
||||
self.AuthorsLayout.setObjectName(u'AuthorsLayout')
|
||||
self.AuthorsListWidget = QtGui.QListWidget(self.AuthorsPage)
|
||||
self.AuthorsListWidget.setObjectName(u'AuthorsListWidget')
|
||||
self.AuthorsLayout.addWidget(self.AuthorsListWidget)
|
||||
self.AuthorButtonWidget = QtGui.QWidget(self.AuthorsPage)
|
||||
self.AuthorButtonWidget.setObjectName(u'AuthorButtonWidget')
|
||||
self.AuthorButtonsLayout = QtGui.QHBoxLayout(self.AuthorButtonWidget)
|
||||
self.AuthorButtonsLayout.setSpacing(8)
|
||||
self.AuthorButtonsLayout.setMargin(0)
|
||||
self.AuthorButtonsLayout.setObjectName(u'AuthorButtonsLayout')
|
||||
spacerItem = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.AuthorButtonsLayout.addItem(spacerItem)
|
||||
self.AuthorAddButton = QtGui.QPushButton(self.AuthorButtonWidget)
|
||||
icon3 = QtGui.QIcon()
|
||||
icon3.addPixmap(QtGui.QPixmap(u':/songs/author_add.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.AuthorAddButton.setIcon(icon3)
|
||||
self.AuthorAddButton.setObjectName(u'AuthorAddButton')
|
||||
self.AuthorButtonsLayout.addWidget(self.AuthorAddButton)
|
||||
self.AuthorEditButton = QtGui.QPushButton(self.AuthorButtonWidget)
|
||||
icon4 = QtGui.QIcon()
|
||||
icon4.addPixmap(QtGui.QPixmap(u':/songs/author_edit.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.AuthorEditButton.setIcon(icon4)
|
||||
self.AuthorEditButton.setObjectName(u'AuthorEditButton')
|
||||
self.AuthorButtonsLayout.addWidget(self.AuthorEditButton)
|
||||
self.AuthorDeleteButton = QtGui.QPushButton(self.AuthorButtonWidget)
|
||||
icon5 = QtGui.QIcon()
|
||||
icon5.addPixmap(QtGui.QPixmap(u':/songs/author_delete.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.AuthorDeleteButton.setIcon(icon5)
|
||||
self.AuthorDeleteButton.setObjectName(u'AuthorDeleteButton')
|
||||
self.AuthorButtonsLayout.addWidget(self.AuthorDeleteButton)
|
||||
self.AuthorsLayout.addWidget(self.AuthorButtonWidget)
|
||||
self.AuthorsLine = QtGui.QFrame(self.AuthorsPage)
|
||||
self.AuthorsLine.setFrameShape(QtGui.QFrame.HLine)
|
||||
self.AuthorsLine.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
self.AuthorsLine.setObjectName(u'AuthorsLine')
|
||||
self.AuthorsLayout.addWidget(self.AuthorsLine)
|
||||
self.TypeStackedWidget.addWidget(self.AuthorsPage)
|
||||
self.TopicsPage = QtGui.QWidget()
|
||||
self.TopicsPage.setObjectName(u'TopicsPage')
|
||||
self.TopicLayout = QtGui.QVBoxLayout(self.TopicsPage)
|
||||
self.TopicLayout.setSpacing(4)
|
||||
self.TopicLayout.setMargin(0)
|
||||
self.TopicLayout.setObjectName(u'TopicLayout')
|
||||
self.TopicsListWidget = QtGui.QListWidget(self.TopicsPage)
|
||||
self.TopicsListWidget.setObjectName(u'TopicsListWidget')
|
||||
self.TopicLayout.addWidget(self.TopicsListWidget)
|
||||
self.TopicButtonWidget = QtGui.QWidget(self.TopicsPage)
|
||||
self.TopicButtonWidget.setObjectName(u'TopicButtonWidget')
|
||||
self.TopicButtonLayout = QtGui.QHBoxLayout(self.TopicButtonWidget)
|
||||
self.TopicButtonLayout.setSpacing(8)
|
||||
self.TopicButtonLayout.setMargin(0)
|
||||
self.TopicButtonLayout.setObjectName(u'TopicButtonLayout')
|
||||
TopicSpacerItem = QtGui.QSpacerItem(54, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.TopicButtonLayout.addItem(TopicSpacerItem)
|
||||
self.TopicAddButton = QtGui.QPushButton(self.TopicButtonWidget)
|
||||
icon6 = QtGui.QIcon()
|
||||
icon6.addPixmap(QtGui.QPixmap(u':/songs/topic_add.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.TopicAddButton.setIcon(icon6)
|
||||
self.TopicAddButton.setObjectName(u'TopicAddButton')
|
||||
self.TopicButtonLayout.addWidget(self.TopicAddButton)
|
||||
self.TopicEditButton = QtGui.QPushButton(self.TopicButtonWidget)
|
||||
icon7 = QtGui.QIcon()
|
||||
icon7.addPixmap(QtGui.QPixmap(u':/songs/topic_edit.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.TopicEditButton.setIcon(icon7)
|
||||
self.TopicEditButton.setObjectName(u'TopicEditButton')
|
||||
self.TopicButtonLayout.addWidget(self.TopicEditButton)
|
||||
self.TopicDeleteButton = QtGui.QPushButton(self.TopicButtonWidget)
|
||||
icon8 = QtGui.QIcon()
|
||||
icon8.addPixmap(QtGui.QPixmap(u':/songs/topic_delete.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.TopicDeleteButton.setIcon(icon8)
|
||||
self.TopicDeleteButton.setObjectName(u'TopicDeleteButton')
|
||||
self.TopicButtonLayout.addWidget(self.TopicDeleteButton)
|
||||
self.TopicLayout.addWidget(self.TopicButtonWidget)
|
||||
self.TopicsLine = QtGui.QFrame(self.TopicsPage)
|
||||
self.TopicsLine.setFrameShape(QtGui.QFrame.HLine)
|
||||
self.TopicsLine.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
self.TopicsLine.setObjectName(u'TopicsLine')
|
||||
self.TopicLayout.addWidget(self.TopicsLine)
|
||||
self.TypeStackedWidget.addWidget(self.TopicsPage)
|
||||
self.BooksPage = QtGui.QWidget()
|
||||
self.BooksPage.setObjectName(u'BooksPage')
|
||||
self.BookLayout = QtGui.QVBoxLayout(self.BooksPage)
|
||||
self.BookLayout.setSpacing(4)
|
||||
self.BookLayout.setMargin(0)
|
||||
self.BookLayout.setObjectName(u'BookLayout')
|
||||
self.BooksListWidget = QtGui.QListWidget(self.BooksPage)
|
||||
self.BooksListWidget.setObjectName(u'BooksListWidget')
|
||||
self.BookLayout.addWidget(self.BooksListWidget)
|
||||
self.BookButtonWidget = QtGui.QWidget(self.BooksPage)
|
||||
self.BookButtonWidget.setObjectName(u'BookButtonWidget')
|
||||
self.BookButtonLayout = QtGui.QHBoxLayout(self.BookButtonWidget)
|
||||
self.BookButtonLayout.setSpacing(8)
|
||||
self.BookButtonLayout.setMargin(0)
|
||||
self.BookButtonLayout.setObjectName(u'BookButtonLayout')
|
||||
spacerItem2 = QtGui.QSpacerItem(54, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.BookButtonLayout.addItem(spacerItem2)
|
||||
self.BookAddButton = QtGui.QPushButton(self.BookButtonWidget)
|
||||
icon9 = QtGui.QIcon()
|
||||
icon9.addPixmap(QtGui.QPixmap(u':/songs/book_add.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.BookAddButton.setIcon(icon9)
|
||||
self.BookAddButton.setObjectName(u'BookAddButton')
|
||||
self.BookButtonLayout.addWidget(self.BookAddButton)
|
||||
self.BookEditButton = QtGui.QPushButton(self.BookButtonWidget)
|
||||
icon10 = QtGui.QIcon()
|
||||
icon10.addPixmap(QtGui.QPixmap(u':/songs/book_edit.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.BookEditButton.setIcon(icon10)
|
||||
self.BookEditButton.setObjectName(u'BookEditButton')
|
||||
self.BookButtonLayout.addWidget(self.BookEditButton)
|
||||
self.BookDeleteButton = QtGui.QPushButton(self.BookButtonWidget)
|
||||
icon11 = QtGui.QIcon()
|
||||
icon11.addPixmap(QtGui.QPixmap(u':/songs/book_delete.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.BookDeleteButton.setIcon(icon11)
|
||||
self.BookDeleteButton.setObjectName(u'BookDeleteButton')
|
||||
self.BookButtonLayout.addWidget(self.BookDeleteButton)
|
||||
self.BookLayout.addWidget(self.BookButtonWidget)
|
||||
self.BooksLine = QtGui.QFrame(self.BooksPage)
|
||||
self.BooksLine.setFrameShape(QtGui.QFrame.HLine)
|
||||
self.BooksLine.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
self.BooksLine.setObjectName(u'BooksLine')
|
||||
self.BookLayout.addWidget(self.BooksLine)
|
||||
self.TypeStackedWidget.addWidget(self.BooksPage)
|
||||
self.ContentLayout.addWidget(self.TypeStackedWidget)
|
||||
self.DialogLayout.addWidget(self.ContentWidget)
|
||||
self.MaintenanceButtonBox = QtGui.QDialogButtonBox(SongMaintenanceDialog)
|
||||
self.MaintenanceButtonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.MaintenanceButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
|
||||
self.MaintenanceButtonBox.setObjectName(u'MaintenanceButtonBox')
|
||||
self.DialogLayout.addWidget(self.MaintenanceButtonBox)
|
||||
|
||||
self.retranslateUi(SongMaintenanceDialog)
|
||||
self.TypeStackedWidget.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(self.MaintenanceButtonBox,
|
||||
QtCore.SIGNAL(u'rejected()'), SongMaintenanceDialog.accept)
|
||||
QtCore.QObject.connect(self.TypeListWidget,
|
||||
QtCore.SIGNAL(u'currentRowChanged(int)'),
|
||||
self.TypeStackedWidget.setCurrentIndex)
|
||||
QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog)
|
||||
|
||||
def retranslateUi(self, SongMaintenanceDialog):
|
||||
SongMaintenanceDialog.setWindowTitle(
|
||||
translate(u'SongMaintenanceDialog', u'Song Maintenance'))
|
||||
self.TypeListWidget.item(0).setText(
|
||||
translate(u'SongMaintenanceDialog', u'Authors'))
|
||||
self.TypeListWidget.item(1).setText(
|
||||
translate(u'SongMaintenanceDialog', u'Topics'))
|
||||
self.TypeListWidget.item(2).setText(
|
||||
translate(u'SongMaintenanceDialog', u'Books/Hymnals'))
|
||||
self.AuthorAddButton.setText(
|
||||
translate(u'SongMaintenanceDialog', u'Add'))
|
||||
self.AuthorEditButton.setText(
|
||||
translate(u'SongMaintenanceDialog', u'Edit'))
|
||||
self.AuthorDeleteButton.setText(
|
||||
translate(u'SongMaintenanceDialog', u'Delete'))
|
||||
self.TopicAddButton.setText(
|
||||
translate(u'SongMaintenanceDialog', u'Add'))
|
||||
self.TopicEditButton.setText(
|
||||
translate(u'SongMaintenanceDialog', u'Edit'))
|
||||
self.TopicDeleteButton.setText(
|
||||
translate(u'SongMaintenanceDialog', u'Delete'))
|
||||
self.BookAddButton.setText(
|
||||
translate(u'SongMaintenanceDialog', u'Add'))
|
||||
self.BookEditButton.setText(
|
||||
translate(u'SongMaintenanceDialog', u'Edit'))
|
||||
self.BookDeleteButton.setText(
|
||||
translate(u'SongMaintenanceDialog', u'Delete'))
|
||||
|
244
openlp/plugins/songs/forms/songmaintenanceform.py
Normal file
@ -0,0 +1,244 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
OpenLP - Open Source Lyrics Projection
|
||||
Copyright (c) 2008 Raoul Snyman
|
||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard
|
||||
|
||||
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
|
||||
"""
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from openlp.core.lib import translate
|
||||
from openlp.plugins.songs.lib.classes import Author, Book, Topic
|
||||
from songmaintenancedialog import Ui_SongMaintenanceDialog
|
||||
from authorsform import AuthorsForm
|
||||
from topicsform import TopicsForm
|
||||
from songbookform import SongBookForm
|
||||
|
||||
class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||
"""
|
||||
Class documentation goes here.
|
||||
"""
|
||||
def __init__(self, songmanager, parent=None):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.songmanager = songmanager
|
||||
self.authorform = AuthorsForm(self)
|
||||
self.topicform = TopicsForm(self)
|
||||
self.bookform = SongBookForm(self)
|
||||
QtCore.QObject.connect(self.AuthorAddButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onAuthorAddButtonClick)
|
||||
QtCore.QObject.connect(self.TopicAddButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onTopicAddButtonClick)
|
||||
QtCore.QObject.connect(self.BookAddButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onBookAddButtonClick)
|
||||
QtCore.QObject.connect(self.AuthorEditButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onAuthorEditButtonClick)
|
||||
QtCore.QObject.connect(self.TopicEditButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onTopicEditButtonClick)
|
||||
QtCore.QObject.connect(self.BookEditButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onBookEditButtonClick)
|
||||
QtCore.QObject.connect(self.AuthorDeleteButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick)
|
||||
QtCore.QObject.connect(self.TopicDeleteButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onTopicDeleteButtonClick)
|
||||
QtCore.QObject.connect(self.BookDeleteButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick)
|
||||
|
||||
def exec_(self):
|
||||
self.TypeListWidget.setCurrentRow(0)
|
||||
self.resetAuthors()
|
||||
self.resetTopics()
|
||||
self.resetBooks()
|
||||
self.TypeListWidget.setFocus()
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def _getCurrentItemId(self, ListWidget):
|
||||
item = ListWidget.currentItem()
|
||||
if item is not None:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
return item_id
|
||||
else:
|
||||
return -1
|
||||
|
||||
def _deleteItem(self, list_widget, get_func, del_func, reset_func,
|
||||
dlg_title, del_text, err_text, sel_text):
|
||||
item_id = self._getCurrentItemId(list_widget)
|
||||
if item_id != -1:
|
||||
item = get_func(item_id)
|
||||
if QtGui.QMessageBox.warning(self, dlg_title, del_text,
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)
|
||||
) == QtGui.QMessageBox.Yes:
|
||||
if item is not None and len(item.songs) == 0:
|
||||
del_func(item.id)
|
||||
reset_func()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self, dlg_title, err_text,
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self, dlg_title, sel_text,
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
|
||||
def resetAuthors(self):
|
||||
self.AuthorsListWidget.clear()
|
||||
authors = self.songmanager.get_authors()
|
||||
for author in authors:
|
||||
if author.display_name is not None and author.display_name != u'':
|
||||
author_name = QtGui.QListWidgetItem(author.display_name)
|
||||
else:
|
||||
author_name = QtGui.QListWidgetItem(
|
||||
u'%s %s' % (author.first_name, author.last_name))
|
||||
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
|
||||
self.AuthorsListWidget.addItem(author_name)
|
||||
|
||||
def resetTopics(self):
|
||||
self.TopicsListWidget.clear()
|
||||
topics = self.songmanager.get_topics()
|
||||
for topic in topics:
|
||||
topic_name = QtGui.QListWidgetItem(topic.name)
|
||||
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
||||
self.TopicsListWidget.addItem(topic_name)
|
||||
|
||||
def resetBooks(self):
|
||||
self.BooksListWidget.clear()
|
||||
books = self.songmanager.get_books()
|
||||
for book in books:
|
||||
book_name = QtGui.QListWidgetItem(book.name)
|
||||
book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id))
|
||||
self.BooksListWidget.addItem(book_name)
|
||||
|
||||
def onAuthorAddButtonClick(self):
|
||||
self.authorform.setAutoDisplayName(True)
|
||||
if self.authorform.exec_():
|
||||
author = Author.populate(
|
||||
first_name=unicode(self.authorform.FirstNameEdit.text(), u'utf-8'),
|
||||
last_name=unicode(self.authorform.LastNameEdit.text(), u'utf-8'),
|
||||
display_name=unicode(self.authorform.DisplayEdit.text(), u'utf-8'))
|
||||
if self.songmanager.save_author(author):
|
||||
self.resetAuthors()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'SongMaintenanceForm', u'Error'),
|
||||
translate(u'SongMaintenanceForm', u'Couldn\'t add your author!'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
|
||||
def onTopicAddButtonClick(self):
|
||||
if self.topicform.exec_():
|
||||
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text(), u'utf-8'))
|
||||
if self.songmanager.save_topic(topic):
|
||||
self.resetTopics()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'SongMaintenanceForm', u'Error'),
|
||||
translate(u'SongMaintenanceForm', u'Couldn\'t add your topic!'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
|
||||
def onBookAddButtonClick(self):
|
||||
if self.bookform.exec_():
|
||||
book = Book.populate(name=unicode(self.bookform.NameEdit.text(), u'utf-8'),
|
||||
publisher=unicode(self.bookform.PublisherEdit.text(), u'utf-8'))
|
||||
if self.songmanager.save_book(book):
|
||||
self.resetBooks()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'SongMaintenanceForm', u'Error'),
|
||||
translate(u'SongMaintenanceForm', u'Couldn\'t add your book!'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
|
||||
def onAuthorEditButtonClick(self):
|
||||
author_id = self._getCurrentItemId(self.AuthorsListWidget)
|
||||
if author_id != -1:
|
||||
author = self.songmanager.get_author(author_id)
|
||||
self.authorform.setAutoDisplayName(False)
|
||||
self.authorform.FirstNameEdit.setText(author.first_name)
|
||||
self.authorform.LastNameEdit.setText(author.last_name)
|
||||
self.authorform.DisplayEdit.setText(author.display_name)
|
||||
if self.authorform.exec_(False):
|
||||
author.first_name = unicode(self.authorform.FirstNameEdit.text(), u'utf-8')
|
||||
author.last_name = unicode(self.authorform.LastNameEdit.text(), u'utf-8')
|
||||
author.display_name = unicode(self.authorform.DisplayEdit.text(), u'utf-8')
|
||||
if self.songmanager.save_author(author):
|
||||
self.resetAuthors()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'SongMaintenanceForm', u'Error'),
|
||||
translate(u'SongMaintenanceForm', u'Couldn\'t save your author!'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
|
||||
def onTopicEditButtonClick(self):
|
||||
topic_id = self._getCurrentItemId(self.TopicsListWidget)
|
||||
if topic_id != -1:
|
||||
topic = self.songmanager.get_topic(topic_id)
|
||||
self.topicform.NameEdit.setText(topic.name)
|
||||
if self.topicform.exec_(False):
|
||||
topic.name = unicode(self.topicform.NameEdit.text(), u'utf-8')
|
||||
if self.songmanager.save_topic(topic):
|
||||
self.resetTopics()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'SongMaintenanceForm', u'Error'),
|
||||
translate(u'SongMaintenanceForm', u'Couldn\'t save your topic!'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
|
||||
def onBookEditButtonClick(self):
|
||||
book_id = self._getCurrentItemId(self.BooksListWidget)
|
||||
if book_id != -1:
|
||||
book = self.songmanager.get_book(book_id)
|
||||
self.bookform.NameEdit.setText(book.name)
|
||||
self.bookform.PublisherEdit.setText(book.publisher)
|
||||
if self.bookform.exec_(False):
|
||||
book.name = unicode(self.bookform.NameEdit.text(), u'utf-8')
|
||||
book.publisher = unicode(self.bookform.PublisherEdit.text(), u'utf-8')
|
||||
if self.songmanager.save_book(book):
|
||||
self.resetBooks()
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'SongMaintenanceForm', u'Error'),
|
||||
translate(u'SongMaintenanceForm', u'Couldn\'t save your book!'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
|
||||
def onAuthorDeleteButtonClick(self):
|
||||
"""
|
||||
Delete the author if the author is not attached to any songs
|
||||
"""
|
||||
self._deleteItem(self.AuthorsListWidget, self.songmanager.get_author,
|
||||
self.songmanager.delete_author, self.resetAuthors,
|
||||
translate(u'SongMaintenanceForm', u'Delete Author'),
|
||||
translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected author?'),
|
||||
translate(u'SongMaintenanceForm', u'This author can\'t be deleted, they are currently assigned to at least one song!'),
|
||||
translate(u'SongMaintenanceForm', u'No author selected!'))
|
||||
|
||||
def onTopicDeleteButtonClick(self):
|
||||
"""
|
||||
Delete the Book is the Book is not attached to any songs
|
||||
"""
|
||||
self._deleteItem(self.TopicsListWidget, self.songmanager.get_topic,
|
||||
self.songmanager.delete_topic, self.resetTopics,
|
||||
translate(u'SongMaintenanceForm', u'Delete Topic'),
|
||||
translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected topic?'),
|
||||
translate(u'SongMaintenanceForm', u'This topic can\'t be deleted, it is currently assigned to at least one song!'),
|
||||
translate(u'SongMaintenanceForm', u'No topic selected!'))
|
||||
|
||||
def onBookDeleteButtonClick(self):
|
||||
"""
|
||||
Delete the Book is the Book is not attached to any songs
|
||||
"""
|
||||
self._deleteItem(self.BooksListWidget, self.songmanager.get_book,
|
||||
self.songmanager.delete_book, self.resetBooks,
|
||||
translate(u'SongMaintenanceForm', u'Delete Book'),
|
||||
translate(u'SongMaintenanceForm', u'Are you sure you want to delete the selected book?'),
|
||||
translate(u'SongMaintenanceForm', u'This book can\'t be deleted, it is currently assigned to at least one song!'),
|
||||
translate(u'SongMaintenanceForm', u'No book selected!'))
|
@ -23,66 +23,39 @@ from openlp.core.lib import translate
|
||||
class Ui_TopicsDialog(object):
|
||||
def setupUi(self, TopicsDialog):
|
||||
TopicsDialog.setObjectName(u'TopicsDialog')
|
||||
TopicsDialog.resize(387, 463)
|
||||
self.gridLayout_2 = QtGui.QGridLayout(TopicsDialog)
|
||||
self.gridLayout_2.setObjectName(u'gridLayout_2')
|
||||
self.TopicGroupBox = QtGui.QGroupBox(TopicsDialog)
|
||||
self.TopicGroupBox.setObjectName(u'TopicGroupBox')
|
||||
self.gridLayout = QtGui.QGridLayout(self.TopicGroupBox)
|
||||
self.gridLayout.setObjectName(u'gridLayout')
|
||||
self.TopicNameLabel = QtGui.QLabel(self.TopicGroupBox)
|
||||
self.TopicNameLabel.setObjectName(u'TopicNameLabel')
|
||||
self.gridLayout.addWidget(self.TopicNameLabel, 0, 0, 1, 1)
|
||||
self.TopicNameEdit = QtGui.QLineEdit(self.TopicGroupBox)
|
||||
self.TopicNameEdit.setObjectName(u'TopicNameEdit')
|
||||
self.gridLayout.addWidget(self.TopicNameEdit, 0, 1, 1, 4)
|
||||
spacerItem = QtGui.QSpacerItem(198, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.gridLayout.addItem(spacerItem, 1, 0, 1, 2)
|
||||
self.DeleteButton = QtGui.QPushButton(self.TopicGroupBox)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/services/service_delete.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.DeleteButton.setIcon(icon)
|
||||
self.DeleteButton.setObjectName(u'DeleteButton')
|
||||
self.gridLayout.addWidget(self.DeleteButton, 1, 3, 1, 1)
|
||||
self.AddUpdateButton = QtGui.QPushButton(self.TopicGroupBox)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(u':/services/service_save.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.AddUpdateButton.setIcon(icon1)
|
||||
self.AddUpdateButton.setObjectName(u'AddUpdateButton')
|
||||
self.gridLayout.addWidget(self.AddUpdateButton, 1, 4, 1, 1)
|
||||
self.ClearButton = QtGui.QPushButton(self.TopicGroupBox)
|
||||
icon2 = QtGui.QIcon()
|
||||
icon2.addPixmap(QtGui.QPixmap(u':/services/service_new.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.ClearButton.setIcon(icon2)
|
||||
self.ClearButton.setObjectName(u'ClearButton')
|
||||
self.gridLayout.addWidget(self.ClearButton, 1, 2, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.TopicGroupBox, 1, 0, 1, 1)
|
||||
self.MessageLabel = QtGui.QLabel(TopicsDialog)
|
||||
self.MessageLabel.setObjectName(u'MessageLabel')
|
||||
self.gridLayout_2.addWidget(self.MessageLabel, 3, 0, 1, 1)
|
||||
self.TopicsListWidget = QtGui.QListWidget()
|
||||
self.TopicsListWidget.setAlternatingRowColors(True)
|
||||
self.gridLayout_2.addWidget(self.TopicsListWidget, 0, 0, 1, 1)
|
||||
self.ButtonBox = QtGui.QDialogButtonBox(TopicsDialog)
|
||||
self.ButtonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
|
||||
self.ButtonBox.setObjectName(u'ButtonBox')
|
||||
self.gridLayout_2.addWidget(self.ButtonBox, 2, 0, 1, 1)
|
||||
TopicsDialog.resize(365, 77)
|
||||
self.TopicLayout = QtGui.QFormLayout(TopicsDialog)
|
||||
self.TopicLayout.setFieldGrowthPolicy(
|
||||
QtGui.QFormLayout.ExpandingFieldsGrow)
|
||||
self.TopicLayout.setMargin(8)
|
||||
self.TopicLayout.setSpacing(8)
|
||||
self.TopicLayout.setObjectName(u'TopicLayout')
|
||||
self.NameLabel = QtGui.QLabel(TopicsDialog)
|
||||
self.NameLabel.setObjectName(u'NameLabel')
|
||||
self.TopicLayout.setWidget(0,
|
||||
QtGui.QFormLayout.LabelRole, self.NameLabel)
|
||||
self.NameEdit = QtGui.QLineEdit(TopicsDialog)
|
||||
self.NameEdit.setObjectName(u'NameEdit')
|
||||
self.TopicLayout.setWidget(0,
|
||||
QtGui.QFormLayout.FieldRole, self.NameEdit)
|
||||
self.TopicButtonBox = QtGui.QDialogButtonBox(TopicsDialog)
|
||||
self.TopicButtonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.TopicButtonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
|
||||
self.TopicButtonBox.setObjectName(u'TopicButtonBox')
|
||||
self.TopicLayout.setWidget(1,
|
||||
QtGui.QFormLayout.FieldRole, self.TopicButtonBox)
|
||||
|
||||
self.retranslateUi(TopicsDialog)
|
||||
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), TopicsDialog.accept)
|
||||
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'rejected()'), TopicsDialog.reject)
|
||||
QtCore.QObject.connect(self.TopicButtonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), TopicsDialog.accept)
|
||||
QtCore.QObject.connect(self.TopicButtonBox,
|
||||
QtCore.SIGNAL(u'rejected()'), TopicsDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(TopicsDialog)
|
||||
|
||||
def retranslateUi(self, TopicsDialog):
|
||||
TopicsDialog.setWindowTitle(translate(u'TopicsDialog', u'Topic Maintenance'))
|
||||
self.TopicGroupBox.setTitle(translate(u'TopicsDialog', u'Topic'))
|
||||
self.TopicNameLabel.setText(translate(u'TopicsDialog', u'Topic Name:'))
|
||||
|
||||
self.DeleteButton.setToolTip(translate(u'TopicsDialog', u'Delete Author'))
|
||||
self.DeleteButton.setText(translate(u'AuthorsDialog', u'Delete'))
|
||||
self.AddUpdateButton.setToolTip(translate(u'TopicsDialog', u'Add Update Author'))
|
||||
self.AddUpdateButton.setText(translate(u'AuthorsDialog', u'Save'))
|
||||
self.ClearButton.setToolTip(translate(u'TopicsDialog', u'Clear Selection'))
|
||||
self.ClearButton.setText(translate(u'TopicsDialog', u'Clear'))
|
||||
TopicsDialog.setWindowTitle(
|
||||
translate(u'TopicsDialog', u'Topic Maintenance'))
|
||||
self.NameLabel.setText(
|
||||
translate(u'TopicsDialog', u'Topic name:'))
|
||||
|
||||
|
@ -18,112 +18,33 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from openlp.core.lib import translate
|
||||
from openlp.plugins.songs.forms.topicsdialog import Ui_TopicsDialog
|
||||
from openlp.plugins.songs.lib.classes import Topic
|
||||
from topicsdialog import Ui_TopicsDialog
|
||||
|
||||
class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
|
||||
"""
|
||||
Class documentation goes here.
|
||||
"""
|
||||
def __init__(self, songmanager, parent = None):
|
||||
def __init__(self, parent=None):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.songmanager = songmanager
|
||||
self.currentRow = 0
|
||||
self.topic = None
|
||||
|
||||
QtCore.QObject.connect(self.DeleteButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonClick)
|
||||
QtCore.QObject.connect(self.ClearButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onClearButtonClick)
|
||||
QtCore.QObject.connect(self.AddUpdateButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onAddUpdateButtonClick)
|
||||
QtCore.QObject.connect(self.TopicNameEdit,
|
||||
QtCore.SIGNAL(u'lostFocus()'), self.onTopicNameEditLostFocus)
|
||||
QtCore.QObject.connect(self.TopicsListWidget,
|
||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onTopicsListWidgetItemClicked)
|
||||
def exec_(self, clear=True):
|
||||
if clear:
|
||||
self.NameEdit.clear()
|
||||
self.NameEdit.setFocus()
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def load_form(self):
|
||||
"""
|
||||
Refresh the screen and rest fields
|
||||
"""
|
||||
self.TopicsListWidget.clear()
|
||||
# tidy up screen
|
||||
self.onClearButtonClick()
|
||||
topics = self.songmanager.get_topics()
|
||||
for topic in topics:
|
||||
topic_name = QtGui.QListWidgetItem(topic.name)
|
||||
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
||||
self.TopicsListWidget.addItem(topic_name)
|
||||
if self.currentRow >= self.TopicsListWidget.count() :
|
||||
self.TopicsListWidget.setCurrentRow(self.TopicsListWidget.count() - 1)
|
||||
def accept(self):
|
||||
if self.NameEdit.text() == u'':
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate(u'SongBookDialog', u'Error'),
|
||||
translate(u'SongBookDialog', u'You need to type in a topic name!'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
self.NameEdit.setFocus()
|
||||
return False
|
||||
else:
|
||||
self.TopicsListWidget.setCurrentRow(self.currentRow)
|
||||
self._validate_form()
|
||||
self.onTopicsListWidgetItemClicked()
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def onDeleteButtonClick(self):
|
||||
"""
|
||||
Delete the Topic is the Topic is not attached to any songs
|
||||
"""
|
||||
self.songmanager.delete_topic(self.topic.id)
|
||||
self.load_form()
|
||||
|
||||
def onTopicNameEditLostFocus(self):
|
||||
self._validate_form()
|
||||
|
||||
def onAddUpdateButtonClick(self):
|
||||
"""
|
||||
Sent New or update details to the database
|
||||
"""
|
||||
if self._validate_form():
|
||||
if self.topic == None:
|
||||
self.topic = Topic()
|
||||
self.topic.name = unicode(self.TopicNameEdit.displayText())
|
||||
self.songmanager.save_topic(self.topic)
|
||||
self.onClearButtonClick()
|
||||
self.load_form()
|
||||
|
||||
def onClearButtonClick(self):
|
||||
"""
|
||||
Tidy up screen if clear button pressed
|
||||
"""
|
||||
self.TopicNameEdit.setText(u'')
|
||||
self.MessageLabel.setText(u'')
|
||||
self.DeleteButton.setEnabled(False)
|
||||
self.topic = None
|
||||
self._validate_form()
|
||||
self.TopicNameEdit.setFocus()
|
||||
|
||||
def onTopicsListWidgetItemClicked(self):
|
||||
"""
|
||||
An Topic has been selected display it
|
||||
If the Topic is attached to a Song prevent delete
|
||||
"""
|
||||
self.currentRow = self.TopicsListWidget.currentRow()
|
||||
item = self.TopicsListWidget.currentItem()
|
||||
if item is not None:
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
self.topic = self.songmanager.get_topic(item_id)
|
||||
self.TopicNameEdit.setText(self.topic.name)
|
||||
if len(self.topic.songs) > 0:
|
||||
self.MessageLabel.setText(translate(u'TopicForm', u'Topic in use "Delete" is disabled'))
|
||||
self.DeleteButton.setEnabled(False)
|
||||
else:
|
||||
self.MessageLabel.setText(translate(u'TopicForm', u'Topic in not used'))
|
||||
self.DeleteButton.setEnabled(True)
|
||||
self._validate_form()
|
||||
self.TopicNameEdit.setFocus()
|
||||
|
||||
def _validate_form(self):
|
||||
# We need at lease a display name
|
||||
valid = True
|
||||
if len(self.TopicNameEdit.displayText()) == 0:
|
||||
valid = False
|
||||
self.TopicNameEdit.setStyleSheet(u'background-color: red; color: white')
|
||||
else:
|
||||
self.TopicNameEdit.setStyleSheet(u'')
|
||||
return valid
|
||||
|
@ -43,7 +43,8 @@ class Book(BaseModel):
|
||||
"""
|
||||
Book model
|
||||
"""
|
||||
pass
|
||||
def __repr__(self):
|
||||
return u'<Book id="%s" name="%s" publisher="%s" />' % (str(self.id), self.name, self.publisher)
|
||||
|
||||
class Song(BaseModel):
|
||||
"""
|
||||
|
@ -218,9 +218,9 @@ class SongManager():
|
||||
self.session.add(book)
|
||||
self.session.commit()
|
||||
return True
|
||||
except:
|
||||
except Exception, e:
|
||||
self.session.rollback()
|
||||
log.error(u'Errow thrown %s', sys.exc_info()[1])
|
||||
log.error(u'Errow thrown %s', e.args[0])
|
||||
return False
|
||||
|
||||
def delete_book(self, bookid):
|
||||
|
@ -20,9 +20,10 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import MediaManagerItem, translate, ServiceItem, SongXMLParser , contextMenuAction, contextMenuSeparator
|
||||
|
||||
from openlp.plugins.songs.forms import EditSongForm, AuthorsForm, TopicsForm, SongBookForm
|
||||
from openlp.core.lib import MediaManagerItem, translate, ServiceItem, \
|
||||
SongXMLParser, contextMenuAction, contextMenuSeparator
|
||||
from openlp.plugins.songs.forms import EditSongForm, AuthorsForm, \
|
||||
TopicsForm, SongBookForm, SongMaintenanceForm
|
||||
|
||||
class SongList(QtGui.QListWidget):
|
||||
|
||||
@ -59,9 +60,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.ConfigSection = u'song'
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager)
|
||||
self.authors_form = AuthorsForm(self.parent.songmanager)
|
||||
self.topics_form = TopicsForm(self.parent.songmanager)
|
||||
self.song_book_form = SongBookForm(self.parent.songmanager)
|
||||
self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager, self)
|
||||
|
||||
def setupUi(self):
|
||||
# Add a toolbar
|
||||
@ -94,18 +93,10 @@ class SongMediaItem(MediaManagerItem):
|
||||
translate(u'SongMediaItem', u'Add the selected song(s) to the service'),
|
||||
':/system/system_add.png', self.onSongAddClick, 'SongAddItem')
|
||||
self.addToolbarSeparator()
|
||||
## Author Edit Button ##
|
||||
self.addToolbarButton(translate(u'SongMediaItem', u'Edit Authors'),
|
||||
translate(u'SongMediaItem', u'Maintain the list of Song Authors'),
|
||||
':/songs/song_author_edit.png', self.onEditAuthorClick, 'SongAuthorEditItem')
|
||||
## Author Edit Button ##
|
||||
self.addToolbarButton(translate(u'SongMediaItem', u'Edit Books'),
|
||||
translate(u'SongMediaItem', u'Maintain the list of Song Books'),
|
||||
':/songs/song_book_edit.png', self.onEditBookClick, 'SongAuthorEditItem')
|
||||
## Author Edit Button ##
|
||||
self.addToolbarButton(translate(u'SongMediaItem', u'Edit Topics'),
|
||||
translate(u'SongMediaItem', u'Maintain the list of Song Topics'),
|
||||
':/songs/song_topic_edit.png', self.onEditTopicClick, 'SongAuthorEditItem')
|
||||
## Song Maintenance Button ##
|
||||
self.addToolbarButton(translate(u'SongMediaItem', u'Song Maintenance'),
|
||||
translate(u'SongMediaItem', u'Maintain the lists of authors, topics and books'),
|
||||
':/songs/song_maintenance.png', self.onSongMaintenanceClick, 'SongMaintenanceItem')
|
||||
## Add the songlist widget ##
|
||||
# Create the tab widget
|
||||
self.SongWidget = QtGui.QWidget(self)
|
||||
@ -250,6 +241,9 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.song_book_form.load_form()
|
||||
self.song_book_form.exec_()
|
||||
|
||||
def onSongMaintenanceClick(self):
|
||||
self.song_maintenance_form.exec_()
|
||||
|
||||
def onSongEditClick(self):
|
||||
item = self.ListView.currentItem()
|
||||
if item is not None:
|
||||
|
@ -27,8 +27,8 @@ from openlp.plugins.songs.lib.classes import *
|
||||
def init_models(url):
|
||||
engine = create_engine(url)
|
||||
metadata.bind = engine
|
||||
session = scoped_session(sessionmaker(autoflush=True, autocommit=False,
|
||||
bind=engine))
|
||||
session = scoped_session(sessionmaker(autoflush=True,
|
||||
autocommit=False, bind=engine))
|
||||
mapper(Author, authors_table)
|
||||
mapper(Book, song_books_table)
|
||||
mapper(Song, songs_table,
|
||||
|
@ -31,7 +31,7 @@ authors_table = Table(u'authors', metadata,
|
||||
|
||||
# Definition of the "song_books" table
|
||||
song_books_table = Table(u'song_books', metadata,
|
||||
Column(u'id', types.Integer, primary_key=True),
|
||||
Column(u'id', types.Integer, primary_key=True),
|
||||
Column(u'name', types.Unicode(128), nullable=False),
|
||||
Column(u'publisher', types.Unicode(128))
|
||||
)
|
||||
|
@ -1,229 +1,104 @@
|
||||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AuthorsDialog</class>
|
||||
<widget class="QDialog" name="AuthorsDialog" >
|
||||
<property name="geometry" >
|
||||
<widget class="QDialog" name="AuthorsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>410</width>
|
||||
<height>505</height>
|
||||
<width>393</width>
|
||||
<height>147</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Author Maintenance</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="DialogLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QFormLayout" name="AuthorsLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="AuthorListView" >
|
||||
<property name="dragEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount" >
|
||||
<number>0</number>
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="FirstNameEdit"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="DisplayEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="DisplayLabel">
|
||||
<property name="text">
|
||||
<string>Display Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="AuthorDetails" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="FirstNameLabel">
|
||||
<property name="text">
|
||||
<string>First Name:</string>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Author Details</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="AuthorLayout" >
|
||||
<property name="spacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" native="1" name="DetailsWidget" >
|
||||
<layout class="QFormLayout" name="DetailsLayout" >
|
||||
<property name="horizontalSpacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="DisplayLabel" >
|
||||
<property name="text" >
|
||||
<string>Display Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="DisplayEdit" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="FirstNameLabel" >
|
||||
<property name="text" >
|
||||
<string>First Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="FirstNameEdit" />
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="LastNameLabel" >
|
||||
<property name="text" >
|
||||
<string>Last Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLineEdit" name="LastNameEdit" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="MessageLabel" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" native="1" name="ButtonWidget" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="ButtonLayout" >
|
||||
<property name="spacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="ButtonSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>198</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ClearButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Clear Selection</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images/openlp-2.qrc" >
|
||||
<normaloff>:/services/service_new.png</normaloff>:/services/service_new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="AddUpdateButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Add Update Author</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images/openlp-2.qrc" >
|
||||
<normaloff>:/services/service_save.png</normaloff>:/services/service_save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="DeleteButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Delete Author</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images/openlp-2.qrc" >
|
||||
<normaloff>:/services/service_delete.png</normaloff>:/services/service_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="toolTip" >
|
||||
<item row="3" column="1">
|
||||
<widget class="QDialogButtonBox" name="AuthorButtonBox">
|
||||
<property name="toolTip">
|
||||
<string>Exit Screen</string>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="LastNameEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="LastNameLabel">
|
||||
<property name="text">
|
||||
<string>Last Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images/openlp-2.qrc" />
|
||||
<include location="../images/openlp-2.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<sender>AuthorButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AuthorsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<sender>AuthorButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AuthorsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
|
@ -1,195 +1,62 @@
|
||||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SongBookDialog</class>
|
||||
<widget class="QDialog" name="SongBookDialog" >
|
||||
<property name="geometry" >
|
||||
<widget class="QDialog" name="SongBookDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>387</width>
|
||||
<height>531</height>
|
||||
<width>367</width>
|
||||
<height>120</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Book Song Maintenance</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="DialogLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QFormLayout" name="SongBookLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="BookSongListView" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="SongBookGroup" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="NameLabel">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Song Book</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="SongBookLayout" >
|
||||
<property name="spacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" native="1" name="DetailsWidget" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="DetailsLayout" >
|
||||
<property name="horizontalSpacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="NameLabel" >
|
||||
<property name="text" >
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="NameEdit" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="PublisherLabel" >
|
||||
<property name="text" >
|
||||
<string>Publisher:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="PublisherEdit" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="MessageLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" native="1" name="ButtonWidget" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="ButtonLayout" >
|
||||
<property name="spacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>61</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ClearButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Clear Selection</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images/openlp-2.qrc" >
|
||||
<normaloff>:/services/service_new.png</normaloff>:/services/service_new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="AddUpdateButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Add Update Author</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images/openlp-2.qrc" >
|
||||
<normaloff>:/services/service_save.png</normaloff>:/services/service_save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="DeleteButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Delete Author</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images/openlp-2.qrc" >
|
||||
<normaloff>:/services/service_delete.png</normaloff>:/services/service_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="ButtonBox" >
|
||||
<property name="orientation" >
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="NameEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="PublisherLabel">
|
||||
<property name="text">
|
||||
<string>Publisher:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="PublisherEdit"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDialogButtonBox" name="ButtonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images/openlp-2.qrc" />
|
||||
<include location="../images/openlp-2.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
@ -198,11 +65,11 @@
|
||||
<receiver>SongBookDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
@ -214,11 +81,11 @@
|
||||
<receiver>SongBookDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
|
442
resources/forms/songmaintenance.ui
Normal file
@ -0,0 +1,442 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SongMaintenanceDialog</class>
|
||||
<widget class="QDialog" name="SongMaintenanceDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>486</width>
|
||||
<height>361</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Song Maintenance</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="DialogLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="ContentWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="ContentLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="TypeTableWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragDropOverwriteMode">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="cornerButtonEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<row>
|
||||
<property name="text">
|
||||
<string>New Row</string>
|
||||
</property>
|
||||
</row>
|
||||
<row>
|
||||
<property name="text">
|
||||
<string>New Row</string>
|
||||
</property>
|
||||
</row>
|
||||
<row>
|
||||
<property name="text">
|
||||
<string>New Row</string>
|
||||
</property>
|
||||
</row>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Types</string>
|
||||
</property>
|
||||
</column>
|
||||
<item row="0" column="0">
|
||||
<property name="text">
|
||||
<string>
|
||||
Authors</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/author_maintenance.png</normaloff>:/songs/author_maintenance.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<property name="text">
|
||||
<string>
|
||||
Topics</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/topic_maintenance.png</normaloff>:/songs/topic_maintenance.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<property name="text">
|
||||
<string>
|
||||
Books/Hymnals</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/book_maintenance.png</normaloff>:/songs/book_maintenance.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="TypeStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="AuthorsPage">
|
||||
<layout class="QVBoxLayout" name="AuthorsLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="AuthorsListWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="AuthorButtonWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="AuthorButtonsLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="AuthorButtonSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="AuthorAddButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/author_add.png</normaloff>:/songs/author_add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="AuthorEditButton">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/author_edit.png</normaloff>:/songs/author_edit.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="AuthorDeleteButton">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/author_delete.png</normaloff>:/songs/author_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="AuthorsLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="TopicsPage">
|
||||
<layout class="QVBoxLayout" name="TopicLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="TopicsListWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="TopicButtonWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="TopicButtonLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="TopicButtonSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>54</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="TopicAddButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/topic_add.png</normaloff>:/songs/topic_add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="TopicEditButton">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/topic_edit.png</normaloff>:/songs/topic_edit.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="TopicDeleteButton">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/topic_delete.png</normaloff>:/songs/topic_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="TopicsLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="BooksPage">
|
||||
<layout class="QVBoxLayout" name="BookLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="BooksListWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="BookButtonWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="BookButtonLayout">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="BookButtonSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>54</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BookAddButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/book_add.png</normaloff>:/songs/book_add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BookEditButton">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/book_edit.png</normaloff>:/songs/book_edit.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BookDeleteButton">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images/openlp-2.qrc">
|
||||
<normaloff>:/songs/book_delete.png</normaloff>:/songs/book_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="BooksLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="MaintenanceButtonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images/openlp-2.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>MaintenanceButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SongMaintenanceDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>242</x>
|
||||
<y>340</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>242</x>
|
||||
<y>180</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>TypeTableWidget</sender>
|
||||
<signal>cellClicked(int,int)</signal>
|
||||
<receiver>TypeStackedWidget</receiver>
|
||||
<slot>setCurrentIndex(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>72</x>
|
||||
<y>163</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>311</x>
|
||||
<y>163</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,158 +1,52 @@
|
||||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TopicsDialog</class>
|
||||
<widget class="QDialog" name="TopicsDialog" >
|
||||
<property name="geometry" >
|
||||
<widget class="QDialog" name="TopicsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>471</width>
|
||||
<height>470</height>
|
||||
<width>365</width>
|
||||
<height>77</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Topic Maintenance</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="TopicsLayout" >
|
||||
<property name="margin" >
|
||||
<layout class="QFormLayout" name="TopicLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QGroupBox" name="TopicGroupBox" >
|
||||
<property name="title" >
|
||||
<string>Topic Details</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="DetailsLayout" >
|
||||
<property name="margin" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="TopicNameLabel" >
|
||||
<property name="text" >
|
||||
<string>Topic Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="6" >
|
||||
<widget class="QLineEdit" name="TopicNameEdit" />
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3" >
|
||||
<spacer name="ButtonsSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>198</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="5" >
|
||||
<widget class="QPushButton" name="DeleteButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Delete Author</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images/openlp-2.qrc" >
|
||||
<normaloff>:/services/service_delete.png</normaloff>:/services/service_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4" >
|
||||
<widget class="QPushButton" name="AddUpdateButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Add Update Author</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images/openlp-2.qrc" >
|
||||
<normaloff>:/services/service_save.png</normaloff>:/services/service_save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" >
|
||||
<widget class="QPushButton" name="ClearButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Clear Selection</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images/openlp-2.qrc" >
|
||||
<normaloff>:/services/service_new.png</normaloff>:/services/service_new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QTableWidget" name="TopicsListView" >
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="TopicNameLabel">
|
||||
<property name="text">
|
||||
<string>Topic Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QDialogButtonBox" name="ButtonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="TopicNameEdit"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDialogButtonBox" name="TopicButtonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images/openlp-2.qrc" />
|
||||
<include location="../images/openlp-2.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>ButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>TopicsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>ButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>TopicsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
BIN
resources/images/author_add.png
Normal file
After Width: | Height: | Size: 836 B |
BIN
resources/images/author_delete.png
Normal file
After Width: | Height: | Size: 858 B |
BIN
resources/images/author_edit.png
Normal file
After Width: | Height: | Size: 885 B |
BIN
resources/images/author_maintenance.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/images/book_add.png
Normal file
After Width: | Height: | Size: 670 B |
BIN
resources/images/book_delete.png
Normal file
After Width: | Height: | Size: 744 B |
BIN
resources/images/book_edit.png
Normal file
After Width: | Height: | Size: 776 B |
BIN
resources/images/book_maintenance.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
@ -1,5 +1,18 @@
|
||||
<RCC>
|
||||
<qresource prefix="songs" >
|
||||
<file>topic_edit.png</file>
|
||||
<file>author_add.png</file>
|
||||
<file>author_delete.png</file>
|
||||
<file>book_add.png</file>
|
||||
<file>song_maintenance.png</file>
|
||||
<file>topic_add.png</file>
|
||||
<file>book_delete.png</file>
|
||||
<file>book_edit.png</file>
|
||||
<file>author_edit.png</file>
|
||||
<file>topic_delete.png</file>
|
||||
<file>book_maintenance.png</file>
|
||||
<file>author_maintenance.png</file>
|
||||
<file>topic_maintenance.png</file>
|
||||
<file>song_delete.png</file>
|
||||
<file>song_edit.png</file>
|
||||
<file>song_export.png</file>
|
||||
|
BIN
resources/images/song_maintenance.png
Normal file
After Width: | Height: | Size: 719 B |
BIN
resources/images/topic_add.png
Normal file
After Width: | Height: | Size: 1007 B |
BIN
resources/images/topic_delete.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
resources/images/topic_edit.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
resources/images/topic_maintenance.png
Normal file
After Width: | Height: | Size: 2.4 KiB |