From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libkcddb/categories.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 libkcddb/categories.cpp (limited to 'libkcddb/categories.cpp') diff --git a/libkcddb/categories.cpp b/libkcddb/categories.cpp new file mode 100644 index 00000000..522da81b --- /dev/null +++ b/libkcddb/categories.cpp @@ -0,0 +1,50 @@ +// Copyright (C) 2005 by Shaheed Haque (srhaque@iee.org). All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// + +#include +#include + +KCDDB::Categories::Categories() +{ + // These are only 11 Category values defined by CDDB. See + // + // http://www.freedb.org/modules.php?name=Sections&sop=viewarticle&artid=26 + // + m_cddb << "blues" << "classical" << "country" << + "data" << "folk" << "jazz" << "misc" << + "newage" << "reggae" << "rock" << "soundtrack"; + m_i18n << i18n("Blues") << i18n("Classical") << i18n("music genre", "Country") << + i18n("Data") << i18n("Folk") << i18n("Jazz") << i18n("Miscellaneous") << + i18n("New Age") << i18n("Reggae") << i18n("Rock") << i18n("Soundtrack"); +} + +const QString KCDDB::Categories::cddb2i18n(const QString &category) const +{ + int index = m_cddb.findIndex(category.stripWhiteSpace()); + if (index != -1) + { + return m_i18n[index]; + } + else + { + return cddb2i18n("misc"); + } +} + +const QString KCDDB::Categories::i18n2cddb(const QString &category) const +{ + int index = m_i18n.findIndex(category.stripWhiteSpace()); + if (index != -1) + { + return m_cddb[index]; + } + else + { + return "misc"; + } +} -- cgit v1.2.3