KCDDB

genres.cpp
1/*
2 SPDX-FileCopyrightText: 2005 Shaheed Haque <srhaque@iee.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "genres.h"
8
9#include "kcddbi18n.h"
10
11class KCDDB::Genres::Private
12{
13public:
14 QStringList cddb;
15 QStringList i18n;
16};
17
18KCDDB::Genres::Genres()
19 : d(new Private)
20{
21 // The Genre is completely arbitrary. But we follow kaudiocreator's cue
22 // and make life easy for people.
23 //
24 // To cope with preexisting records which don't match an entry, we will
25 // add one later if needed.
26 d->cddb << QLatin1String( "Unknown" ) << QLatin1String( "A Cappella" ) << QLatin1String( "Acid Jazz" ) <<
27 QLatin1String( "Acid Punk" ) << QLatin1String( "Acid" ) << QLatin1String( "Acoustic" ) << QLatin1String( "Alternative" ) <<
28 QLatin1String( "Alt. Rock" ) << QLatin1String( "Ambient" ) << QLatin1String( "Anime" ) << QLatin1String( "Avantgarde" ) <<
29 QLatin1String( "Ballad" ) << QLatin1String( "Bass" ) << QLatin1String( "Beat" ) << QLatin1String( "Bebop" ) <<
30 QLatin1String( "Big Band" ) << QLatin1String( "Black Metal" ) << QLatin1String( "Bluegrass" ) << QLatin1String( "Blues" ) <<
31 QLatin1String( "Booty Bass" ) << QLatin1String( "BritPop" ) << QLatin1String( "Cabaret" ) << QLatin1String( "Celtic" ) <<
32 QLatin1String( "Chamber Music" ) << QLatin1String( "Chanson" ) << QLatin1String( "Chorus" ) << QLatin1String( "Christian Gangsta Rap" ) <<
33 QLatin1String( "Christian Rap" ) << QLatin1String( "Christian Rock" ) << QLatin1String( "Classical" ) << QLatin1String( "Classic Rock" ) <<
34 QLatin1String( "Club-house" ) << QLatin1String( "Club" ) << QLatin1String( "Comedy" ) << QLatin1String( "Contemporary Christian" ) <<
35 QLatin1String( "Country" ) << QLatin1String( "Crossover" ) << QLatin1String( "Cult" ) << QLatin1String( "Dance Hall" ) <<
36 QLatin1String( "Dance" ) << QLatin1String( "Darkwave" ) << QLatin1String( "Death Metal" ) << QLatin1String( "Disco" ) <<
37 QLatin1String( "Dream" ) << QLatin1String( "Drum & Bass" ) << QLatin1String( "Drum Solo" ) << QLatin1String( "Duet" ) <<
38 QLatin1String( "Easy Listening" ) << QLatin1String( "Electronic" ) << QLatin1String( "Ethnic" ) << QLatin1String( "Eurodance" ) <<
39 QLatin1String( "Euro-House" ) << QLatin1String( "Euro-Techno" ) << QLatin1String( "Fast-Fusion" ) << QLatin1String( "Folklore" ) <<
40 QLatin1String( "Folk/Rock" ) << QLatin1String( "Folk" ) << QLatin1String( "Freestyle" ) << QLatin1String( "Funk" ) <<
41 QLatin1String( "Fusion" ) << QLatin1String( "Game" ) << QLatin1String( "Gangsta Rap" ) << QLatin1String( "Goa" ) <<
42 QLatin1String( "Gospel" ) << QLatin1String( "Gothic Rock" ) << QLatin1String( "Gothic" ) << QLatin1String( "Grunge" ) <<
43 QLatin1String( "Hardcore" ) << QLatin1String( "Hard Rock" ) << QLatin1String( "Heavy Metal" ) << QLatin1String( "Hip-Hop" ) <<
44 QLatin1String( "House" ) << QLatin1String( "Humor" ) << QLatin1String( "Indie" ) << QLatin1String( "Industrial" ) <<
45 QLatin1String( "Instrumental Pop" ) << QLatin1String( "Instrumental Rock" ) << QLatin1String( "Instrumental" ) << QLatin1String( "Jazz+Funk" ) <<
46 QLatin1String( "Jazz" ) << QLatin1String( "JPop" ) << QLatin1String( "Jungle" ) << QLatin1String( "Latin" ) << QLatin1String( "Lo-Fi" ) <<
47 QLatin1String( "Meditative" ) << QLatin1String( "Merengue" ) << QLatin1String( "Metal" ) << QLatin1String( "Musical" ) <<
48 QLatin1String( "National Folk" ) << QLatin1String( "Native American" ) << QLatin1String( "Negerpunk" ) << QLatin1String( "New Age" ) <<
49 QLatin1String( "New Wave" ) << QLatin1String( "Noise" ) << QLatin1String( "Oldies" ) << QLatin1String( "Opera" ) <<
50 QLatin1String( "Other" ) << QLatin1String( "Polka" ) << QLatin1String( "Polsk Punk" ) << QLatin1String( "Pop-Funk" ) <<
51 QLatin1String( "Pop/Funk" ) << QLatin1String( "Pop" ) << QLatin1String( "Porn Groove" ) << QLatin1String( "Power Ballad" ) <<
52 QLatin1String( "Pranks" ) << QLatin1String( "Primus" ) << QLatin1String( "Progressive Rock" ) << QLatin1String( "Psychedelic Rock" ) <<
53 QLatin1String( "Psychedelic" )<< QLatin1String( "Punk Rock" ) << QLatin1String( "Punk" ) << QLatin1String( "R&B" ) <<
54 QLatin1String( "Rap" ) << QLatin1String( "Rave" ) << QLatin1String( "Reggae" ) << QLatin1String( "Retro" ) <<
55 QLatin1String( "Revival" ) << QLatin1String( "Rhythmic Soul" ) << QLatin1String( "Rock & Roll" ) << QLatin1String( "Rock" ) <<
56 QLatin1String( "Salsa" ) << QLatin1String( "Samba" ) << QLatin1String( "Satire" ) << QLatin1String( "Showtunes" ) <<
57 QLatin1String( "Ska" ) << QLatin1String( "Slow Jam" ) << QLatin1String( "Slow Rock" ) << QLatin1String( "Sonata" ) <<
58 QLatin1String( "Soul" ) << QLatin1String( "Sound Clip" ) << QLatin1String( "Soundtrack" ) << QLatin1String( "Southern Rock" ) <<
59 QLatin1String( "Space" ) << QLatin1String( "Speech" ) << QLatin1String( "Swing" ) << QLatin1String( "Symphonic Rock" ) <<
60 QLatin1String( "Symphony" ) << QLatin1String( "Synthpop" ) << QLatin1String( "Tango" ) << QLatin1String( "Techno-Industrial" ) <<
61 QLatin1String( "Techno" ) << QLatin1String( "Terror" ) << QLatin1String( "Thrash Metal" ) << QLatin1String( "Top 40" ) <<
62 QLatin1String( "Trailer" ) << QLatin1String( "Trance" ) << QLatin1String( "Tribal" ) << QLatin1String( "Trip-Hop" ) <<
63 QLatin1String( "Vocal" );
64 d->i18n << i18n("Unknown") << i18n("A Cappella") << i18n("Acid Jazz") <<
65 i18n("Acid Punk") << i18n("Acid") << i18n("Acoustic") << i18n("Alternative") <<
66 i18n("Alt. Rock") << i18n("Ambient") << i18n("Anime") << i18n("Avantgarde") <<
67 i18n("Ballad") << i18n("Bass") << i18n("Beat") << i18n("Bebop") <<
68 i18n("Big Band") << i18n("Black Metal") << i18n("Bluegrass") << i18n("Blues") <<
69 i18n("Booty Bass") << i18n("BritPop") << i18n("Cabaret") << i18n("Celtic") <<
70 i18n("Chamber Music") << i18n("Chanson") << i18n("Chorus") << i18n("Christian Gangsta Rap") <<
71 i18n("Christian Rap") << i18n("Christian Rock") << i18n("Classical") << i18n("Classic Rock") <<
72 i18n("Club-house") << i18n("Club") << i18n("Comedy") << i18n("Contemporary Christian") <<
73 i18nc("music genre", "Country") << i18n("Crossover") << i18n("Cult") << i18n("Dance Hall") <<
74 i18n("Dance") << i18n("Darkwave") << i18n("Death Metal") << i18n("Disco") <<
75 i18n("Dream") << i18n("Drum & Bass") << i18n("Drum Solo") << i18n("Duet") <<
76 i18n("Easy Listening") << i18n("Electronic") << i18n("Ethnic") << i18n("Eurodance") <<
77 i18n("Euro-House") << i18n("Euro-Techno") << i18n("Fast-Fusion") << i18n("Folklore") <<
78 i18n("Folk/Rock") << i18n("Folk") << i18n("Freestyle") << i18n("Funk") <<
79 i18n("Fusion") << i18n("Game") << i18n("Gangsta Rap") << i18n("Goa") <<
80 i18n("Gospel") << i18n("Gothic Rock") << i18n("Gothic") << i18n("Grunge") <<
81 i18n("Hardcore") << i18n("Hard Rock") << i18n("Heavy Metal") << i18n("Hip-Hop") <<
82 i18n("House") << i18n("Humor") << i18n("Indie") << i18n("Industrial") <<
83 i18n("Instrumental Pop") << i18n("Instrumental Rock") << i18n("Instrumental") << i18n("Jazz+Funk") <<
84 i18n("Jazz") << i18n("JPop") << i18n("Jungle") << i18n("Latin") << i18n("Lo-Fi") <<
85 i18n("Meditative") << i18n("Merengue") << i18n("Metal") << i18n("Musical") <<
86 i18n("National Folk") << i18n("Native American") << i18n("Negerpunk") << i18n("New Age") <<
87 i18n("New Wave") << i18n("Noise") << i18n("Oldies") << i18n("Opera") <<
88 i18n("Other") << i18n("Polka") << i18n("Polsk Punk") << i18n("Pop-Funk") <<
89 i18n("Pop/Funk") << i18n("Pop") << i18n("Porn Groove") << i18n("Power Ballad") <<
90 i18n("Pranks") << i18n("Primus") << i18n("Progressive Rock") << i18n("Psychedelic Rock") <<
91 i18n("Psychedelic") << i18n("Punk Rock") << i18n("Punk") << i18n("R&B") <<
92 i18n("Rap") << i18n("Rave") << i18n("Reggae") << i18n("Retro") <<
93 i18n("Revival") << i18n("Rhythmic Soul") << i18n("Rock & Roll") << i18n("Rock") <<
94 i18n("Salsa") << i18n("Samba") << i18n("Satire") << i18n("Showtunes") <<
95 i18n("Ska") << i18n("Slow Jam") << i18n("Slow Rock") << i18n("Sonata") <<
96 i18n("Soul") << i18n("Sound Clip") << i18n("Soundtrack") << i18n("Southern Rock") <<
97 i18n("Space") << i18n("Speech") << i18n("Swing") << i18n("Symphonic Rock") <<
98 i18n("Symphony") << i18n("Synthpop") << i18n("Tango") << i18n("Techno-Industrial") <<
99 i18n("Techno") << i18n("Terror") << i18n("Thrash Metal") << i18n("Top 40") <<
100 i18n("Trailer") << i18n("Trance") << i18n("Tribal") << i18n("Trip-Hop") <<
101 i18n("Vocal");
102}
103
104KCDDB::Genres::~Genres()
105{
106 delete d;
107}
108
109KCDDB::Genres::Genres(const Genres& other)
110 :d(new Private)
111{
112 *d = *other.d;
113}
114
115KCDDB::Genres& KCDDB::Genres::operator=(const Genres& other)
116{
117 *d = *other.d;
118 return *this;
119}
120
121const QStringList &KCDDB::Genres::cddbList() const
122{
123 return d->cddb;
124}
125
126const QStringList &KCDDB::Genres::i18nList() const
127{
128 return d->i18n;
129}
130
131const QString KCDDB::Genres::cddb2i18n(const QString &genre) const
132{
133 QString userDefinedGenre = genre.trimmed();
134 int index = d->cddb.indexOf(userDefinedGenre);
135 if (index != -1)
136 {
137 return d->i18n[index];
138 }
139 else
140 {
141 return userDefinedGenre;
142 }
143}
144
145const QString KCDDB::Genres::i18n2cddb(const QString &genre) const
146{
147 QString userDefinedGenre = genre.trimmed();
148 int index = d->i18n.indexOf(userDefinedGenre);
149 if (index != -1)
150 {
151 return d->cddb[index];
152 }
153 else
154 {
155 return userDefinedGenre;
156 }
157}
The Genre is completely arbitrary.
Definition genres.h:20
const QString cddb2i18n(const QString &genre) const
Lookup the CDDB genre, and return the i18n'd version.
Definition genres.cpp:131
const QString i18n2cddb(const QString &genre) const
Lookup the i18n genre, and return the CDDB version if we can.
Definition genres.cpp:145
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
qsizetype indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const const
QString trimmed() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:56:20 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.