From kde-commits Sat Apr 24 19:44:19 2010 From: Albert Astals Cid Date: Sat, 24 Apr 2010 19:44:19 +0000 To: kde-commits Subject: KDE/kdemultimedia/kioslave/audiocd Message-Id: <20100424194419.70729AC8A3 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=127213806817127 SVN commit 1118453 by aacid: add some const to make the code easier to read M +11 -12 audiocd.cpp --- trunk/KDE/kdemultimedia/kioslave/audiocd/audiocd.cpp #1118452:1118453 @@ -480,7 +480,6 @@ int track = d->req_track+1; - QString trackName; // hack // do we rip the whole CD? if (d->req_allTracks){ @@ -514,11 +513,11 @@ if (!drive) return; - bool isFile = !d->fname.isEmpty(); + const bool isFile = !d->fname.isEmpty(); // the track number. 0 if ripping // the whole CD. - uint trackNumber = d->req_track + 1; + const uint trackNumber = d->req_track + 1; if (!d->req_allTracks) { // we only want to rip one track. @@ -739,7 +738,7 @@ struct cdrom_drive *AudioCDProtocol::getDrive() { - QByteArray device(QFile::encodeName(d->device)); + const QByteArray device(QFile::encodeName(d->device)); struct cdrom_drive * drive = 0; @@ -759,7 +758,7 @@ if (0 == drive) { kDebug(7117) << "Can't find an audio CD on: \"" << d->device << "\""; - QFileInfo fi(d->device); + const QFileInfo fi(d->device); if(!fi.isReadable()) error(KIO::ERR_SLAVE_DEFINED, i18n("Device does not have read permissions for this account. Check the read permissions on the device.")); else if(!fi.isWritable()) @@ -956,18 +955,18 @@ query = query.mid(1); // Strip leading '?'. - QStringList tokens(query.split('&',QString::SkipEmptyParts)); + const QStringList tokens(query.split('&',QString::SkipEmptyParts)); for (QStringList::ConstIterator it(tokens.constBegin()); it != tokens.constEnd(); ++it) { - QString token(*it); + const QString token(*it); int equalsPos = token.indexOf('='); if (-1 == equalsPos) continue; - QString attribute(token.left(equalsPos)); - QString value(token.mid(equalsPos + 1)); + const QString attribute(token.left(equalsPos)); + const QString value(token.mid(equalsPos + 1)); if (attribute == QLatin1String("device")) d->device = value; @@ -993,8 +992,8 @@ */ void AudioCDProtocol::loadSettings() { - KConfig *config = new KConfig(QLatin1String( "kcmaudiocdrc"), KConfig::NoGlobals ); - KConfigGroup groupCDDA( config, "CDDA" ); + const KConfig *config = new KConfig(QLatin1String( "kcmaudiocdrc"), KConfig::NoGlobals ); + const KConfigGroup groupCDDA( config, "CDDA" ); if (!groupCDDA.readEntry("autosearch", true)) { d->device = groupCDDA.readEntry("device", QString(KCompactDisc::defaultCdromDeviceUrl().url())); @@ -1020,7 +1019,7 @@ } // The default track filename template - KConfigGroup groupFileName( config, "FileName" ); + const KConfigGroup groupFileName( config, "FileName" ); d->fileNameTemplate = groupFileName.readEntry("file_name_template", "%{trackartist} - %{number} - %{title}"); d->albumTemplate = groupFileName.readEntry("album_template", "%{albumartist} - %{albumtitle}"); d->rsearch = groupFileName.readEntry("regexp_search");