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 ***************************************************************************/
20 #ifndef _KwSongdbVersion_h_
21 #define _KwSongdbVersion_h_
24 * @file KwSongdbVersion.h
25 * @brief A song version from the database.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwSongdbLyrics.h"
31 #include <kdemacros.h>
37 class KwSongdbSongBookSong
;
39 /// A song version from the database.
40 class KDE_EXPORT KwSongdbVersion
48 /// Version data fields.
56 Q_DECLARE_FLAGS(Fields
, Field
)
59 * Constructors + destructor
62 /** Construct a new version for database insertion.
63 * This constructs a blank song version which will be inserted into the
64 * database when it is saved.
65 * @param song The song for the version to belong to.
67 KwSongdbVersion(KwSongdbSong
* song
);
69 /** Construct from the database.
70 * Loads the version information from the database.
71 * @param id Database id of version.
73 KwSongdbVersion(int id
);
76 virtual ~KwSongdbVersion();
82 /// Get the version id.
85 /// Get the song this is a version of.
88 /// Get the name of this version.
91 /** Get a non-empty name of this version.
92 * @return The name or i18n("Default version").
94 QString
niceName() const;
96 /// Get the name of the writer.
97 QString
writer() const;
99 /// Get the copyright notice.
100 QString
copyright() const;
103 const KwSongdbLyrics
& lyrics() const;
105 /// Get song book numbers.
106 QList
<KwSongdbSongBookSong
*> songBookNumbers();
113 void setName(const QString
& name
);
116 void setWriter(const QString
& writer
);
118 /// Set the copyright notice.
119 void setCopyright(const QString
& copyright
);
121 /// Set the lyrics markup.
122 void setLyricsMarkup(const QString
& markup
);
124 /// Set the lyrics plain text verses.
125 void setLyricsPlainVerses(const QStringList
& plainVerses
);
128 void setLyrics(const KwSongdbLyrics
& lyrics
);
130 /// Save changes to the version data.
143 KwSongdbSong
* m_song
;
145 /// Which fields have been modified.
146 Fields m_modifiedFields
;
148 /// Name of this version.
151 /// Name of the writer.
154 /// Copyright notice.
158 KwSongdbLyrics m_lyrics
;
160 /// Whether song book numbers have been loaded.
161 bool m_songBookNumbersLoaded
;
163 /// Song book numbers.
164 QList
<KwSongdbSongBookSong
*> m_songBookNumbers
;
167 Q_DECLARE_OPERATORS_FOR_FLAGS(KwSongdbVersion::Fields
)
169 #endif // _KwSongdbVersion_h_