File indexing completed on 2024-04-28 04:50:19

0001 // SPDX-FileCopyrightText: 2005 Shaheed Haque (srhaque@iee.org). All rights reserved.
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 //
0005 
0006 #include "categories.h"
0007 
0008 #include <KLocalizedString>
0009 
0010 KCDDB::Categories::Categories()
0011 {
0012     // These are only 11 Category values defined by CDDB. See
0013     //
0014     // http://www.freedb.org/en/faq.3.html#26
0015     //
0016     m_cddb << "blues" << "classical" << "country" <<
0017             "data" << "folk" << "jazz" << "misc" <<
0018             "newage" << "reggae" << "rock" << "soundtrack";
0019     m_i18n << i18n("Blues") << i18n("Classical") << i18nc("music genre", "Country") <<
0020             i18n("Data") << i18n("Folk") << i18n("Jazz") << i18n("Miscellaneous") <<
0021             i18n("New Age") << i18n("Reggae") << i18n("Rock") << i18n("Soundtrack");
0022 }
0023 
0024 const QString KCDDB::Categories::cddb2i18n(const QString &category) const
0025 {
0026     int index = m_cddb.indexOf(category.trimmed());
0027     if (index != -1)
0028     {
0029         return m_i18n[index];
0030     }
0031     else
0032     {
0033         return cddb2i18n("misc");
0034     }
0035 }
0036 
0037 const QString KCDDB::Categories::i18n2cddb(const QString &category) const
0038 {
0039     int index = m_i18n.indexOf(category.trimmed());
0040     if (index != -1)
0041     {
0042         return m_cddb[index];
0043     }
0044     else
0045     {
0046         return "misc";
0047     }
0048 }