![]()  | 
  
    Songbook-Client
    0.7
    
   This application is a manager of customguitar songbooks 
   | 
 
CLibrary is the base model that corresponds to the list of songs. More...
#include <library.hh>
Public Types | |
| enum | Roles {  TitleRole = Qt::UserRole + 1, ArtistRole = Qt::UserRole + 2, AlbumRole = Qt::UserRole + 3, CoverRole = Qt::UserRole + 4, LilypondRole = Qt::UserRole + 5, LanguageRole = Qt::UserRole + 6, PathRole = Qt::UserRole + 7, CoverSmallRole = Qt::UserRole + 8, CoverFullRole = Qt::UserRole + 9, RelativePathRole = Qt::UserRole + 10, MaxRole = RelativePathRole }  | 
Public Slots | |
| void | readSettings () | 
| void | update () | 
Signals | |
| void | wasModified () | 
| void | directoryChanged (const QDir &directory) | 
Public Member Functions | |
| CLibrary (CMainWindow *parent) | |
| Constructor.  | |
| ~CLibrary () | |
| Destructor.  | |
| void | writeSettings () | 
| bool | checkSongbookPath (const QString &path) | 
| QString | findSongbookPath () | 
| QDir | directory () const | 
| void | setDirectory (const QString &directory) | 
| void | setDirectory (const QDir &directory) | 
| QStringList | templates () const | 
| QAbstractListModel * | completionModel () const | 
| QAbstractListModel * | artistCompletionModel () const | 
| QAbstractListModel * | albumCompletionModel () const | 
| QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const | 
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const | 
| virtual int | rowCount (const QModelIndex &index=QModelIndex()) const | 
| virtual int | columnCount (const QModelIndex &index=QModelIndex()) const | 
| QString | pathToSong (const QString &artist, const QString &title) const | 
| QString | pathToSong (Song &song) const | 
| void | addSong (const Song &song, bool reset=false) | 
| void | addSong (const QString &path) | 
| void | addSongs (const QStringList &paths) | 
| bool | containsSong (const QString &path) | 
| void | removeSong (const QString &path) | 
| int | getSongIndex (const QString &path) const | 
| Song | getSong (const QString &path) const | 
| void | loadSong (const QString &path, Song *song) | 
| void | createArtistDirectory (Song &song) | 
| void | saveSong (Song &song) | 
| void | saveCover (Song &song, const QImage &cover) | 
| void | deleteSong (const QString &path) | 
Properties | |
| QDir | directory | 
CLibrary is the base model that corresponds to the list of songs.
A CLibrary is a list of Song objects (structure representing .sg files) that are fetched from a local directory.
This model is used to build an intermediate model (CSongSortFilterProxyModel) that allows filtering options, and is then presented in the library tab (CTabWidget) of the main window (CMainWindow) through its associated view (CLibraryView).
| enum CLibrary::Roles | 
Each Song in the CLibrary has a set of data elements associated with it, each with its own role. The roles are used by the view to indicate to the model which type of data it needs.
| void CLibrary::addSong | ( | const Song & | song, | 
| bool | reset = false  | 
        ||
| ) | 
Adds a the song song to the library. If reset is true, the whole library is parsed again.
| void CLibrary::addSong | ( | const QString & | path | ) | 
| void CLibrary::addSongs | ( | const QStringList & | paths | ) | 
| QAbstractListModel * CLibrary::albumCompletionModel | ( | ) | const | 
Returns the album completion model associated with the library. The completion model is based on the list of words from the album column.
| QAbstractListModel * CLibrary::artistCompletionModel | ( | ) | const | 
Returns the artist completion model associated with the library. The completion model is based on the list of words from the artist column.
      
  | 
  virtual | 
Reimplements QAbstractTableModel::columnCount. Returns 6 as the number of columns for a song item (title, artist, path, album, lilypond, language).
| QAbstractListModel * CLibrary::completionModel | ( | ) | const | 
Returns the completion model associated with the library. The completion model isi based on the list of words from title, artist and album columns.
| bool CLibrary::containsSong | ( | const QString & | path | ) | 
Returns true if the song path is already in the library.
| void CLibrary::createArtistDirectory | ( | Song & | song | ) | 
Creates the artist subdirectory for the song song (if required).
| QVariant CLibrary::data | ( | const QModelIndex & | index, | 
| int | role = Qt::DisplayRole  | 
        ||
| ) | const | 
Reimplements QAbstractTableModel::data. Returns the data at position index for the given role.
| void CLibrary::deleteSong | ( | const QString & | path | ) | 
Removes the file path from the library.
| QDir CLibrary::directory | ( | ) | const | 
Returns the directory of the library.
| Song CLibrary::getSong | ( | const QString & | path | ) | const | 
Returns the Song object whose path is path from the library.
| int CLibrary::getSongIndex | ( | const QString & | path | ) | const | 
Returns the index of the song path from the library.
| QVariant CLibrary::headerData | ( | int | section, | 
| Qt::Orientation | orientation, | ||
| int | role = Qt::DisplayRole  | 
        ||
| ) | const | 
Reimplements QAbstractTableModel::headerData.
| void CLibrary::loadSong | ( | const QString & | path, | 
| Song * | song | ||
| ) | 
Loads a Song object in the library from the file path.
| QString CLibrary::pathToSong | ( | const QString & | artist, | 
| const QString & | title | ||
| ) | const | 
Returns the absolute path of an .sg file from artist and title names. Following the songbook convention, the song "Hello world!" from artist "Unknown" would be located in /path/to/songbook/songs/unknown/hello_world.sg".
| QString CLibrary::pathToSong | ( | Song & | song | ) | const | 
This is a convenience method that returns the absolute path of an .sg file from a Song object.
| void CLibrary::removeSong | ( | const QString & | path | ) | 
      
  | 
  virtual | 
Reimplements QAbstractTableModel::rowCount. Returns the number of Song items in the library.
| void CLibrary::saveCover | ( | Song & | song, | 
| const QImage & | cover | ||
| ) | 
Saves the cover cover in the library directory (update the cover path if required).
| void CLibrary::saveSong | ( | Song & | song | ) | 
Saves the song song in the library (update the song path if required).
| void CLibrary::setDirectory | ( | const QString & | directory | ) | 
Sets directory as the directory for the library.
| void CLibrary::setDirectory | ( | const QDir & | directory | ) | 
Sets directory as the directory for the library.
| QStringList CLibrary::templates | ( | ) | const | 
Returns the list of available templates (*.tmpl files).
 1.8.1.1