~ubuntu-branches/ubuntu/maverick/kdemultimedia/maverick

« back to all changes in this revision

Viewing changes to kioslave/audiocd/audiocd.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-05-19 13:16:54 UTC
  • mfrom: (1.2.42 upstream)
  • Revision ID: james.westby@ubuntu.com-20100519131654-xfn7gesg3qu6ay87
Tags: 4:4.4.3-2ubuntu1
* Merge with Debian Unstable, remaining changes:
  - Keep Kubuntu docs path
  - Build-Depend on libtag-extras-dev to make juk read MP4 tags
  - Don't recommend mplayerthumbs in kdemultimedia, it's in multiverse
  - The mplayerthumbs package depends on mplayer or mplayer-nogui
* Bump kde-config-cddb's replace version on libkcddb4 to 4.4.60
* Update KUBUNTU-DEBIAN-DIFFERENCEs

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
 
63
63
using namespace KIO;
64
64
 
65
 
#define CDDB_INFORMATION "CDDB Information"
 
65
#define CDDB_INFORMATION I18N_NOOP("CDDB Information")
66
66
 
67
67
using namespace AudioCD;
68
68
 
103
103
 
104
104
class AudioCDProtocol::Private {
105
105
public:
106
 
        Private() {
 
106
        Private() : s_info(i18n("Information")), s_fullCD(i18n("Full CD"))
 
107
        {
107
108
                clearURLargs();
108
 
                s_info = i18n("Information");
109
 
                s_fullCD = i18n("Full CD");
110
109
        }
111
110
 
112
111
        void clearURLargs() {
151
150
        bool reportErrors;
152
151
 
153
152
        // Directory strings, never change after init
154
 
        QString s_info;
155
 
        QString s_fullCD;
 
153
        const QString s_info;
 
154
        const QString s_fullCD;
156
155
 
157
156
        // Current CD
158
157
        TOC disc_toc[MAXTRK];
481
480
 
482
481
                int track = d->req_track+1;
483
482
 
484
 
                QString trackName;
485
483
                // hack
486
484
                // do we rip the whole CD?
487
485
                if (d->req_allTracks){
515
513
        if (!drive)
516
514
                return;
517
515
 
518
 
        bool isFile = !d->fname.isEmpty();
 
516
        const bool isFile = !d->fname.isEmpty();
519
517
 
520
518
        // the track number. 0 if ripping
521
519
        // the whole CD.
522
 
        uint trackNumber = d->req_track + 1;
 
520
        const uint trackNumber = d->req_track + 1;
523
521
 
524
522
        if (!d->req_allTracks)
525
523
        { // we only want to rip one track.
626
624
                }
627
625
                // Error
628
626
                if( count == 1 ) {
629
 
                        app_file(entry, QString("%1: %2.txt").arg(i18n(CDDB_INFORMATION)).arg(KCDDB::resultToString(d->cddbResult)), ((*it).toString().length())+1);
 
627
                        app_file(entry, QString("%1: %2.txt").arg(i18n(CDDB_INFORMATION)).arg(KCDDB::resultToString(d->cddbResult)), 0);
630
628
                        count++;
631
629
                        listEntry(entry, false);
632
630
                }
740
738
 
741
739
struct cdrom_drive *AudioCDProtocol::getDrive()
742
740
{
743
 
        QByteArray device(QFile::encodeName(d->device));
 
741
        const QByteArray device(QFile::encodeName(d->device));
744
742
 
745
743
        struct cdrom_drive * drive = 0;
746
744
 
760
758
        if (0 == drive) {
761
759
                kDebug(7117) << "Can't find an audio CD on: \"" << d->device << "\"";
762
760
 
763
 
                QFileInfo fi(d->device);
 
761
                const QFileInfo fi(d->device);
764
762
                if(!fi.isReadable())
765
763
                        error(KIO::ERR_SLAVE_DEFINED, i18n("Device does not have read permissions for this account.  Check the read permissions on the device."));
766
764
                else if(!fi.isWritable())
957
955
 
958
956
        query = query.mid(1); // Strip leading '?'.
959
957
 
960
 
        QStringList tokens(query.split('&',QString::SkipEmptyParts));
 
958
        const QStringList tokens(query.split('&',QString::SkipEmptyParts));
961
959
 
962
960
        for (QStringList::ConstIterator it(tokens.constBegin()); it != tokens.constEnd(); ++it)
963
961
        {
964
 
                QString token(*it);
 
962
                const QString token(*it);
965
963
 
966
964
                int equalsPos = token.indexOf('=');
967
965
                if (-1 == equalsPos)
968
966
                        continue;
969
967
 
970
 
                QString attribute(token.left(equalsPos));
971
 
                QString value(token.mid(equalsPos + 1));
 
968
                const QString attribute(token.left(equalsPos));
 
969
                const QString value(token.mid(equalsPos + 1));
972
970
 
973
971
                if (attribute == QLatin1String("device"))
974
972
                        d->device = value;
994
992
 */
995
993
void AudioCDProtocol::loadSettings()
996
994
{
997
 
        KConfig *config = new KConfig(QLatin1String( "kcmaudiocdrc"), KConfig::NoGlobals );
998
 
        KConfigGroup groupCDDA( config, "CDDA" );
 
995
        const KConfig *config = new KConfig(QLatin1String( "kcmaudiocdrc"), KConfig::NoGlobals );
 
996
        const KConfigGroup groupCDDA( config, "CDDA" );
999
997
 
1000
998
        if (!groupCDDA.readEntry("autosearch", true)) {
1001
999
                d->device = groupCDDA.readEntry("device", QString(KCompactDisc::defaultCdromDeviceUrl().url()));
1021
1019
        }
1022
1020
 
1023
1021
        // The default track filename template
1024
 
        KConfigGroup groupFileName( config, "FileName" );
 
1022
        const KConfigGroup groupFileName( config, "FileName" );
1025
1023
        d->fileNameTemplate = groupFileName.readEntry("file_name_template", "%{trackartist} - %{number} - %{title}");
1026
1024
        d->albumTemplate = groupFileName.readEntry("album_template", "%{albumartist} - %{albumtitle}");
1027
1025
        d->rsearch = groupFileName.readEntry("regexp_search");