File indexing completed on 2025-01-05 04:25:40
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Seb Ruiz <ruiz@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef AMAROK_TRACKITEM_H 0018 #define AMAROK_TRACKITEM_H 0019 0020 #include "core/meta/Observer.h" 0021 0022 #include <QStandardItem> 0023 #include <QMutex> 0024 0025 class TrackItem : public QStandardItem, public Meta::Observer 0026 { 0027 public: 0028 TrackItem(); 0029 ~TrackItem() override; 0030 0031 /** 0032 * Sets the TrackPtr for this item to associate with 0033 * 0034 * @arg track pointer to associate with 0035 */ 0036 void setTrack( const Meta::TrackPtr &trackPtr ); 0037 0038 /** 0039 * @return the track pointer associated with this item 0040 */ 0041 Meta::TrackPtr track() const { return m_track; } 0042 0043 /** 0044 * Applies an italic style if the track is the currently 0045 * playing track 0046 */ 0047 void italicise(); 0048 0049 /** 0050 * Applies a bold style if the track is owned by the currently 0051 * playing artist 0052 */ 0053 void bold(); 0054 0055 // overloaded from Meta::Observer 0056 using Observer::metadataChanged; 0057 void metadataChanged( const Meta::TrackPtr &track ) override; 0058 0059 int type() const override; 0060 0061 bool operator<( const QStandardItem &other ) const override; 0062 0063 private: 0064 Meta::TrackPtr m_track; 0065 QMutex m_mutex; 0066 }; 0067 0068 #endif // multiple inclusion guard