| 1 | /* |
| 2 | Copyright (C) 2005-2014 Mario Stephan <[email protected]> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as published |
| 6 | by the Free Software Foundation; either version 2.1 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #ifndef PLAYLISTITEM_H |
| 19 | #define PLAYLISTITEM_H |
| 20 | |
| 21 | #include <QTreeWidgetItem> |
| 22 | #include <Qt> |
| 23 | #include <qurl.h> |
| 24 | #include "track.h" |
| 25 | #include "playlistitem.h" |
| 26 | #include "playlist.h" |
| 27 | #include "ratingwidget.h" |
| 28 | |
| 29 | class PlaylistItem : public QTreeWidgetItem |
| 30 | { |
| 31 | |
| 32 | public: |
| 33 | PlaylistItem( Playlist *pl, QTreeWidgetItem *lvi ); |
| 34 | ~PlaylistItem(); |
| 35 | QString urlString() const { return text(Column_Url ); } |
| 36 | QString title() const { return text( Column_Title ); } |
| 37 | QString artist() const { return text( Column_Artist ); } |
| 38 | int rate(); |
| 39 | Playlist *listView() const { return (Playlist*)treeWidget(); } |
| 40 | PlaylistItem *nextSibling() const { return (PlaylistItem*)treeWidget()->itemBelow(this); } |
| 41 | //ratingWidget() |
| 42 | |
| 43 | Track *track() { return m_track ; } |
| 44 | void setTrack( Track*); |
| 45 | |
| 46 | QColor foreColor() { return m_foreColor ; } |
| 47 | void setForeColor( QColor c ) {m_foreColor=c; update();} |
| 48 | |
| 49 | void update(); |
| 50 | |
| 51 | |
| 52 | void setTexts( Track* ); |
| 53 | void setText( int c, QString Text); |
| 54 | QString exactText( int col ) const { return text( col ); } |
| 55 | QString seconds() const; |
| 56 | enum Column { Column_Url = 0, |
| 57 | Column_No = 1, |
| 58 | Column_Played = 2, |
| 59 | Column_Artist = 3, |
| 60 | Column_Title = 4, |
| 61 | Column_Album = 5, |
| 62 | Column_Year = 6, |
| 63 | Column_Genre = 7, |
| 64 | Column_Tracknumber = 8, |
| 65 | Column_Length = 9, |
| 66 | Column_Rate = 10}; |
| 67 | signals: |
| 68 | |
| 69 | private: |
| 70 | Track *m_track; |
| 71 | QColor m_foreColor; |
| 72 | RatingWidget *rating; |
| 73 | Playlist* m_parent; |
| 74 | bool operator< (const QTreeWidgetItem &other) const; |
| 75 | }; |
| 76 | |
| 77 | #endif |