• 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
cdinfoencodingwidget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005 Richard Lärkäng <nouseforaname@home.se>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "cdinfoencodingwidget.h"
21 
22 #include <qtextcodec.h>
23 #include <klocale.h>
24 #include <kglobal.h>
25 #include <kcharsets.h>
26 
27 namespace KCDDB
28 {
29  CDInfoEncodingWidget::CDInfoEncodingWidget(QWidget* parent, const QString& artist,
30  const QString& title, const QStringList& songTitles)
31  : QWidget(parent), CDInfoEncodingWidgetBase(), m_artist(artist), m_title(title),
32  m_songTitles(songTitles)
33  {
34  setupUi(this);
35 
36  encodingCombo->addItems(KGlobal::charsets()->descriptiveEncodingNames());
37 
38  slotEncodingChanged(encodingCombo->currentText());
39 
40  connect(encodingCombo,SIGNAL(activated(QString)),
41  this,SLOT(slotEncodingChanged(QString)));
42  }
43 
44  QString CDInfoEncodingWidget::selectedEncoding()
45  {
46  return encodingCombo->currentText();
47  }
48 
49  void CDInfoEncodingWidget::slotEncodingChanged(const QString& encoding)
50  {
51  KCharsets* charsets = KGlobal::charsets();
52 
53  QTextCodec* codec = charsets->codecForName(charsets->encodingForName(encoding));
54 
55  songsBox->clear();
56  QStringList newTitles;
57 
58  for (QStringList::const_iterator it = m_songTitles.constBegin();
59  it != m_songTitles.constEnd(); ++it)
60  newTitles << codec->toUnicode((*it).toLatin1().constData());
61 
62  songsBox->clear();
63  songsBox->addItems(newTitles);
64 
65  titleLabel->setText(i18nc("artist - cdtitle", "%1 - %2",
66  codec->toUnicode(m_artist.toLatin1()), codec->toUnicode(m_title.toLatin1().constData())));
67  }
68 }
69 
70 #include "cdinfoencodingwidget.moc"
QWidget
QWidget::setupUi
void setupUi(QWidget *widget)
cdinfoencodingwidget.h
QList::const_iterator
KCDDB::CDInfoEncodingWidget::selectedEncoding
QString selectedEncoding()
Definition: cdinfoencodingwidget.cpp:44
QString::clear
void clear()
QByteArray::constData
const char * constData() const
QString
QTextCodec
QStringList
QString::toLatin1
QByteArray toLatin1() const
QTextCodec::codecForName
QTextCodec * codecForName(const QByteArray &name)
QList::constEnd
const_iterator constEnd() const
QList::constBegin
const_iterator constBegin() const
KCDDB::CDInfoEncodingWidget::CDInfoEncodingWidget
CDInfoEncodingWidget(QWidget *parent, const QString &artist, const QString &title, const QStringList &songTitles)
Definition: cdinfoencodingwidget.cpp:29
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QTextCodec::toUnicode
QString toUnicode(const QByteArray &a) const
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