KCDDB

categories.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 "categories.h"
8
9#include "kcddbi18n.h"
10
11class KCDDB::Categories::Private
12{
13public:
14 QStringList cddb;
15 QStringList i18n;
16};
17
18KCDDB::Categories::Categories()
19 : d(new Private)
20{
21 // These are only 11 Category values defined by CDDB. See
22 //
23 // http://www.freedb.org/en/faq.3.html#26
24 //
25 d->cddb << QLatin1String( "blues" ) << QLatin1String( "classical" ) << QLatin1String( "country" ) <<
26 QLatin1String( "data" ) << QLatin1String( "folk" ) << QLatin1String( "jazz" ) << QLatin1String( "misc" ) <<
27 QLatin1String( "newage" ) << QLatin1String( "reggae" ) << QLatin1String( "rock" ) << QLatin1String( "soundtrack" );
28 d->i18n << i18n("Blues") << i18n("Classical") << i18nc("music genre", "Country") <<
29 i18n("Data") << i18n("Folk") << i18n("Jazz") << i18n("Miscellaneous") <<
30 i18n("New Age") << i18n("Reggae") << i18n("Rock") << i18n("Soundtrack");
31}
32
33KCDDB::Categories::~Categories()
34{
35 delete d;
36}
37
38KCDDB::Categories::Categories(const Categories& other)
39 :d(new Private)
40{
41 *d = *other.d;
42}
43
44KCDDB::Categories& KCDDB::Categories::operator=(const Categories& other)
45{
46 *d = *other.d;
47 return *this;
48}
49
50const QStringList &KCDDB::Categories::cddbList() const
51{
52 return d->cddb;
53}
54
55const QStringList &KCDDB::Categories::i18nList() const
56{
57 return d->i18n;
58}
59
60const QString KCDDB::Categories::cddb2i18n(const QString &category) const
61{
62 int index = d->cddb.indexOf(category.trimmed());
63 if (index != -1)
64 {
65 return d->i18n[index];
66 }
67 else
68 {
69 return cddb2i18n(QLatin1String( "misc" ));
70 }
71}
72
73const QString KCDDB::Categories::i18n2cddb(const QString &category) const
74{
75 int index = d->i18n.indexOf(category.trimmed());
76 if (index != -1)
77 {
78 return d->cddb[index];
79 }
80 else
81 {
82 return QLatin1String( "misc" );
83 }
84}
Category values defined by CDDB.
Definition categories.h:20
const QString i18n2cddb(const QString &category) const
Lookup the i18n category, and return the CDDB version.
const QString cddb2i18n(const QString &category) const
Lookup the CDDB category, and return the i18n'd version.
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
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:11:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.