File indexing completed on 2024-05-05 04:48:16

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com>            *
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_METACONSTANTS_H
0018 #define AMAROK_METACONSTANTS_H
0019 
0020 #include "core/amarokcore_export.h"
0021 #include "MetaValues.h"
0022 #include "core/meta/forward_declarations.h"
0023 
0024 #include <QString>
0025 
0026 namespace Meta
0027 {
0028     /** Returns a textual identification for the given field.
0029         This name can be used e.g. for identifying the field in a xml file.
0030      */
0031     AMAROKCORE_EXPORT QString nameForField( qint64 field );
0032 
0033     /** The inverse of nameForField
0034      */
0035     AMAROKCORE_EXPORT qint64 fieldForName( const QString &name );
0036 
0037     /** Returns a localized name for the given field.
0038      */
0039     AMAROKCORE_EXPORT QString i18nForField( qint64 field );
0040 
0041     /** Returns a short localized name for the given field.
0042         The short form is only one word and is used for the collection filter.
0043         e.g. the "added to collection" is just "added"
0044      */
0045     AMAROKCORE_EXPORT QString shortI18nForField( qint64 field );
0046 
0047     /** Returns a textual identification for the given field.
0048         This name is used in the playlist generator and is slightly different from
0049         the one in nameForField
0050      */
0051     AMAROKCORE_EXPORT QString playlistNameForField( qint64 field );
0052 
0053     /** The inverse of playlistNameForField
0054      */
0055     AMAROKCORE_EXPORT qint64 fieldForPlaylistName( const QString &name );
0056 
0057     /** Returns the name of the icon representing the field.
0058         May return an empty string if no such icon exists.
0059         Create the icon with QIcon::fromTheme(iconForField(field))
0060      */
0061     AMAROKCORE_EXPORT QString iconForField( qint64 field );
0062 
0063     /** Returns the value for the given field.
0064      */
0065     AMAROKCORE_EXPORT QVariant valueForField( qint64 field, TrackPtr track );
0066 
0067     /**
0068      * The Field variables. Please note that these constants are considered deprecated.
0069      * Use Meta::val* (e.g. Meta::valArtist, Meta::valAlbum) constants instead of these
0070      * in new code unless you have to.
0071      */
0072     namespace Field
0073     {
0074         //actual string values are not final yet
0075         static const QString ALBUM          = QStringLiteral("xesam:album");
0076         static const QString ARTIST         = QStringLiteral("xesam:author");
0077         static const QString BITRATE        = QStringLiteral("xesam:audioBitrate");
0078         static const QString BPM            = QStringLiteral("xesam:audioBPM");
0079         static const QString CODEC          = QStringLiteral("xesam:audioCodec");
0080         static const QString COMMENT        = QStringLiteral("xesam:comment");
0081         static const QString COMPOSER       = QStringLiteral("xesam:composer");
0082         static const QString DISCNUMBER     = QStringLiteral("xesam:discNumber");
0083         static const QString FILESIZE       = QStringLiteral("xesam:size");
0084         static const QString GENRE          = QStringLiteral("xesam:genre");
0085         static const QString LENGTH         = QStringLiteral("xesam:mediaDuration");
0086         static const QString RATING         = QStringLiteral("xesam:userRating");
0087         static const QString SAMPLERATE     = QStringLiteral("xesam:audioSampleRate");
0088         static const QString TITLE          = QStringLiteral("xesam:title");
0089         static const QString TRACKNUMBER    = QStringLiteral("xesam:trackNumber");
0090         static const QString URL            = QStringLiteral("xesam:url");
0091         static const QString YEAR           = QStringLiteral("xesam:contentCreated");
0092         static const QString ALBUMARTIST    = QStringLiteral("xesam:albumArtist");
0093         static const QString ALBUMGAIN      = QStringLiteral("xesam:albumGain");
0094         static const QString ALBUMPEAKGAIN  = QStringLiteral("xesam:albumPeakGain");
0095         static const QString TRACKGAIN      = QStringLiteral("xesam:trackGain");
0096         static const QString TRACKPEAKGAIN  = QStringLiteral("xesam:trackPeakGain");
0097 
0098         static const QString SCORE          = QStringLiteral("xesam:autoRating");
0099         static const QString PLAYCOUNT      = QStringLiteral("xesam:useCount");
0100         static const QString FIRST_PLAYED   = QStringLiteral("xesam:firstUsed");
0101         static const QString LAST_PLAYED    = QStringLiteral("xesam:lastUsed");
0102 
0103         static const QString UNIQUEID       = QStringLiteral("xesam:id");
0104 
0105         // new
0106         static const QString COMPILATION    = QStringLiteral("xesam:compilation");
0107     }
0108 }
0109 
0110 #endif