1 /**************************************************************************************** 2 * Copyright (c) 2009 Maximilian Kossick <maximilian.kossick@googlemail.com> * 3 * * 4 * This program is free software; you can redistribute it and/or modify it under * 5 * the terms of the GNU General Public License as published by the Free Software * 6 * Foundation; either version 2 of the License, or (at your option) any later * 7 * version. * 8 * * 9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 11 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 12 * * 13 * You should have received a copy of the GNU General Public License along with * 14 * this program. If not, see <http://www.gnu.org/licenses/>. * 15 ****************************************************************************************/ 16 17 #ifndef MEMORYCUSTOMVALUE_H 18 #define MEMORYCUSTOMVALUE_H 19 20 #include "amarok_export.h" 21 #include "core/meta/forward_declarations.h" 22 #include "core/collections/QueryMaker.h" 23 24 #include <QList> 25 #include <QString> 26 27 class CustomReturnFunction; 28 class CustomReturnValue; 29 30 namespace CustomValueFactory 31 { 32 CustomReturnFunction* returnFunction( Collections::QueryMaker::ReturnFunction function, qint64 value ); 33 CustomReturnValue* returnValue( qint64 value ); 34 } 35 36 class AMAROK_EXPORT CustomReturnFunction 37 { 38 public: 39 CustomReturnFunction(); 40 virtual ~CustomReturnFunction(); 41 42 virtual QString value( const Meta::TrackList &tracks ) const = 0; 43 }; 44 45 class AMAROK_EXPORT TrackCounter : public CustomReturnFunction 46 { 47 public: 48 TrackCounter(); 49 ~TrackCounter() override; 50 51 QString value( const Meta::TrackList &tracks ) const override; 52 }; 53 54 class AMAROK_EXPORT ArtistCounter : public CustomReturnFunction 55 { 56 public: 57 ArtistCounter(); 58 ~ArtistCounter() override; 59 60 QString value( const Meta::TrackList &tracks ) const override; 61 }; 62 63 class AMAROK_EXPORT GenreCounter : public CustomReturnFunction 64 { 65 public: 66 GenreCounter(); 67 ~GenreCounter() override; 68 69 QString value( const Meta::TrackList &tracks ) const override; 70 }; 71 72 class AMAROK_EXPORT ComposerCounter : public CustomReturnFunction 73 { 74 public: 75 ComposerCounter(); 76 ~ComposerCounter() override; 77 78 QString value( const Meta::TrackList &tracks ) const override; 79 }; 80 81 class AMAROK_EXPORT AlbumCounter : public CustomReturnFunction 82 { 83 public: 84 AlbumCounter(); 85 ~AlbumCounter() override; 86 87 QString value( const Meta::TrackList &tracks ) const override; 88 }; 89 90 class AMAROK_EXPORT YearCounter : public CustomReturnFunction 91 { 92 public: 93 YearCounter(); 94 ~YearCounter() override; 95 96 QString value( const Meta::TrackList &tracks ) const override; 97 }; 98 99 class AMAROK_EXPORT CustomReturnValue 100 { 101 public: 102 CustomReturnValue(); 103 virtual ~CustomReturnValue(); 104 105 virtual QString value( const Meta::TrackPtr &track ) const = 0; 106 }; 107 108 class AMAROK_EXPORT TitleReturnValue : public CustomReturnValue 109 { 110 public: 111 TitleReturnValue(); 112 ~TitleReturnValue() override; 113 QString value( const Meta::TrackPtr &track ) const override; 114 }; 115 116 class AMAROK_EXPORT UrlReturnValue : public CustomReturnValue 117 { 118 public: 119 UrlReturnValue(); 120 ~UrlReturnValue() override; 121 QString value( const Meta::TrackPtr &track ) const override; 122 }; 123 124 125 #endif 126