1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 * @file KwSongdbVersion.cpp
22 * @brief A song version from the database.
23 * @author James Hogan <james@albanarts.com>
27 #include "KwSongdbVersion.h"
37 * Constructors + destructor
40 /// Primary constructor.
41 KwSongdbVersion::KwSongdbVersion(int id
)
49 // Get the song version data
50 QSqlQuery
query(KwSongdb::self()->database());
51 query
.prepare("SELECT song_id, name, writer, copyright, lyrics, css_style_sheet_id "
54 query
.addBindValue(QVariant(id
));
55 bool worked
= query
.exec();
59 assert(query
.first());
60 m_song
= KwSongdb::self()->songById(query
.value(0).toInt());
61 m_name
= query
.value(1).toString();
62 m_writer
= query
.value(2).toString();
63 m_copyright
= query
.value(3).toString();
64 m_lyrics
.setMarkup(query
.value(4).toString());
68 KwSongdbVersion::~KwSongdbVersion()
76 /// Get the song this is a version of.
77 KwSongdbSong
* KwSongdbVersion::song()
82 /// Get the name of this version.
83 QString
KwSongdbVersion::name() const
88 /// Get a non-empty name of this version.
89 QString
KwSongdbVersion::niceName() const
93 return i18n("Default version");
101 /// Get the name of the writer.
102 QString
KwSongdbVersion::writer() const
107 /// Get the copyright notice.
108 QString
KwSongdbVersion::copyright() const
113 /// Get the copyright notice.
114 const KwSongdbLyrics
& KwSongdbVersion::lyrics() const