Qmmp
playlisttrack.h
1 /***************************************************************************
2  * Copyright (C) 2013-2022 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 <QStringList>
24 #include <qmmp/qmmp.h>
25 #include <qmmp/trackinfo.h>
26 #include "playlistitem.h"
27 #include "qmmpui_export.h"
28 
29 class QmmpUiSettings;
31 class MetaDataHelper;
32 
36 class QMMPUI_EXPORT PlayListTrack : public TrackInfo, public PlayListItem
37 {
38 public:
46  explicit PlayListTrack(const PlayListTrack &other);
51  PlayListTrack(const TrackInfo *info);
55  virtual ~PlayListTrack();
64  QString formattedTitle(int column) override;
68  QStringList formattedTitles() override;
72  QString formattedLength() override;
77  void updateMetaData(const TrackInfo *info);
85  const QString &groupName();
89  bool isGroup() const override;
94  int trackIndex() const override;
98  int queuedIndex() const;
102  bool isQueued() const;
107  void beginUsage();
112  void endUsage();
116  void deleteLater();
120  bool isSheduledForDeletion() const;
125  bool isUsed() const;
126 
127 private:
128  void formatTitle(int column);
129  void formatGroup();
130  QStringList m_formattedTitles;
131  QString m_formattedLength;
132  QString m_group;
133  QStringList m_titleFormats;
134  QString m_groupFormat;
135  QmmpUiSettings *m_settings;
136  int m_refCount = 0;
137  bool m_sheduledForDeletion = false;
138  MetaDataHelper *m_helper;
139  friend class PlayListContainer;
140  friend class NormalContainer;
141  friend class GroupedContainer;
142  int m_queued_index = -1;
143  int m_track_index = -1;
144 
145 };
146 
147 #endif
Helper class that provides access to playlist column configuration.
Definition: playlistheadermodel.h:39
The PlayListItem class provides an item for use with the PlayListModel class.
Definition: playlistitem.h:32
The PlayListTrack class provides a track for use with the PlayListModel class.
Definition: playlisttrack.h:37
PlayListTrack(const TrackInfo *info)
PlayListTrack(const PlayListTrack &other)
bool isQueued() const
QString formattedLength() override
QStringList formattedTitles() override
int queuedIndex() const
void updateMetaData()
void beginUsage()
bool isUsed() const
bool isGroup() const override
PlayListTrack & operator=(const PlayListTrack &other)
virtual ~PlayListTrack()
int trackIndex() const override
bool isSheduledForDeletion() const
QString formattedTitle(int column) override
const QString & groupName()
void updateMetaData(const TrackInfo *info)
void deleteLater()
The QmmpUiSettings class provides access to global libqmmpui library settings.
Definition: qmmpuisettings.h:37
The TrackInfo class stores metadata and other information about track.
Definition: trackinfo.h:32