• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdemultimedia API Reference
  • KDE Home
  • Contact Us
 

libkcddb

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

KDE's Doxygen guidelines are available online.

libkcddb

Skip menu "libkcddb"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdemultimedia API Reference

Skip menu "kdemultimedia API Reference"
  • libkcddb
  • libkcompactdisc

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal