Qmmp
playlisttrack.h
1 /***************************************************************************
2  * Copyright (C) 2013-2017 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program 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. *
9  * *
10  * This program 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. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef PLAYLISTTRACK_H
21 #define PLAYLISTTRACK_H
22 
23 #include <QMap>
24 #include <QStringList>
25 #include <qmmp/fileinfo.h>
26 #include <qmmp/qmmp.h>
27 #include "playlistitem.h"
28 
29 class QmmpUiSettings;
31 class MetaDataHelper;
32 
36 class PlayListTrack : public QMap <Qmmp::MetaData, QString>, public PlayListItem
37 {
38 public:
42  PlayListTrack();
46  PlayListTrack(const PlayListTrack &other);
51  PlayListTrack(FileInfo *info);
55  virtual ~PlayListTrack();
59  PlayListTrack &operator=(const PlayListTrack &other);
64  const QString formattedTitle(int column);
68  const QStringList formattedTitles();
72  const QString formattedLength();
76  qint64 length() const;
80  void setLength(qint64 length);
84  const QString url() const;
89  void updateMetaData(const QMap <Qmmp::MetaData, QString> &metaData);
94  void updateMetaData(FileInfo *info);
98  void updateMetaData();
102  const QString groupName();
106  bool isGroup() const;
110  void setTrackIndex(int track_index);
115  int trackIndex() const;
120  void beginUsage();
125  void endUsage();
129  void deleteLater();
133  bool isSheduledForDeletion() const;
138  bool isUsed() const;
139 
140 private:
141  void formatTitle(int column);
142  void formatGroup();
143  QStringList m_formattedTitles;
144  QString m_formattedLength;
145  QString m_group;
146  QStringList m_titleFormats;
147  QString m_groupFormat;
148  QmmpUiSettings *m_settings;
149  qint64 m_length;
150  int m_refCount;
151  int m_track_index;
152  bool m_sheduledForDeletion;
153  MetaDataHelper *m_helper;
154 };
155 
156 #endif
Helper class that provides access to playlist column configuration.
Definition: playlistheadermodel.h:37
The FileInfo class stores metadata and audio information about media file or stream.
Definition: fileinfo.h:32
bool isSheduledForDeletion() const
The PlayListItem class provides an item for use with the PlayListModel class.
Definition: playlistitem.h:31
bool isUsed() const
int trackIndex() const
const QString formattedLength()
const QStringList formattedTitles()
void beginUsage()
void updateMetaData()
const QString groupName()
const QString formattedTitle(int column)
void setLength(qint64 length)
PlayListTrack & operator=(const PlayListTrack &other)
void setTrackIndex(int track_index)
void deleteLater()
virtual ~PlayListTrack()
bool isGroup() const
qint64 length() const
The QmmpUiSettings class provides access to global libqmmpui library settings.
Definition: qmmpuisettings.h:35
The PlayListTrack class provides a track for use with the PlayListModel class.
Definition: playlisttrack.h:36
const QString url() const