Commit 162b9c8e authored by Michał Małek's avatar Michał Małek
Browse files

Export also catogires.h header

parent af905c92
......@@ -71,6 +71,7 @@ set_target_properties(kcddb PROPERTIES VERSION ${KCDDB_VERSION} SOVERSION ${KCDD
install(TARGETS kcddb EXPORT LibkcddbTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES
categories.h
cdinfo.h
cdinfodialog.h
client.h
......
......@@ -10,26 +10,61 @@
#include <KI18n/KLocalizedString>
class KCDDB::Categories::Private
{
public:
QStringList cddb;
QStringList i18n;
};
KCDDB::Categories::Categories()
: d(new Private)
{
// These are only 11 Category values defined by CDDB. See
//
// http://www.freedb.org/modules.php?name=Sections&sop=viewarticle&artid=26
//
m_cddb << QLatin1String( "blues" ) << QLatin1String( "classical" ) << QLatin1String( "country" ) <<
d->cddb << QLatin1String( "blues" ) << QLatin1String( "classical" ) << QLatin1String( "country" ) <<
QLatin1String( "data" ) << QLatin1String( "folk" ) << QLatin1String( "jazz" ) << QLatin1String( "misc" ) <<
QLatin1String( "newage" ) << QLatin1String( "reggae" ) << QLatin1String( "rock" ) << QLatin1String( "soundtrack" );
m_i18n << i18n("Blues") << i18n("Classical") << i18nc("music genre", "Country") <<
d->i18n << i18n("Blues") << i18n("Classical") << i18nc("music genre", "Country") <<
i18n("Data") << i18n("Folk") << i18n("Jazz") << i18n("Miscellaneous") <<
i18n("New Age") << i18n("Reggae") << i18n("Rock") << i18n("Soundtrack");
}
KCDDB::Categories::~Categories()
{
delete d;
}
KCDDB::Categories::Categories(const Categories& other)
:d(new Private)
{
*d = *other.d;
}
KCDDB::Categories& KCDDB::Categories::operator=(const Categories& other)
{
*d = *other.d;
return *this;
}
const QStringList &KCDDB::Categories::cddbList() const
{
return d->cddb;
}
const QStringList &KCDDB::Categories::i18nList() const
{
return d->i18n;
}
const QString KCDDB::Categories::cddb2i18n(const QString &category) const
{
int index = m_cddb.indexOf(category.trimmed());
int index = d->cddb.indexOf(category.trimmed());
if (index != -1)
{
return m_i18n[index];
return d->i18n[index];
}
else
{
......@@ -39,10 +74,10 @@ const QString KCDDB::Categories::cddb2i18n(const QString &category) const
const QString KCDDB::Categories::i18n2cddb(const QString &category) const
{
int index = m_i18n.indexOf(category.trimmed());
int index = d->i18n.indexOf(category.trimmed());
if (index != -1)
{
return m_cddb[index];
return d->cddb[index];
}
else
{
......
......@@ -8,6 +8,7 @@
#ifndef KCDDB_CATEGORIES_H
#define KCDDB_CATEGORIES_H
#include <libkcddb/kcddb_export.h>
#include <QtCore/QString>
#include <QtCore/QStringList>
......@@ -16,13 +17,17 @@ namespace KCDDB
/**
* Category values defined by CDDB.
*/
class Categories
class KCDDB_EXPORT Categories
{
public:
Categories();
Categories(const Categories&);
~Categories();
const QStringList &cddbList() const { return m_cddb; }
const QStringList &i18nList() const { return m_i18n; }
Categories& operator=(const Categories&);
const QStringList &cddbList() const;
const QStringList &i18nList() const;
/**
* Lookup the CDDB category, and return the i18n'd version.
......@@ -34,8 +39,8 @@ namespace KCDDB
*/
const QString i18n2cddb(const QString &category) const;
private:
QStringList m_cddb;
QStringList m_i18n;
class Private;
Private * const d;
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment