Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -40,6 +40,7 @@ include(ECMSetupVersion) include(CMakePushCheckState) include(CheckStructHasMember) +include(ECMQtDeclareLoggingCategory) ecm_setup_version("5.0.0" VARIABLE_PREFIX AUDIOCDPLUGINS @@ -80,6 +81,7 @@ ########### next target ############### set(kio_audiocd_PART_SRCS audiocd.cpp ) +ecm_qt_declare_logging_category(kio_audiocd_PART_SRCS HEADER logging.h IDENTIFIER AUDIOCD CATEGORY_NAME kf5.kio.audiocd) add_library(kio_audiocd ${kio_audiocd_PART_SRCS}) Index: audiocd.cpp =================================================================== --- audiocd.cpp +++ audiocd.cpp @@ -23,6 +23,7 @@ */ #include +#include "logging.h" #include extern "C" @@ -55,6 +56,7 @@ #include #include #include +#include #include // CDDB #include @@ -83,14 +85,14 @@ KCmdLineArgs::addCmdLineOptions(options); KApplication app(true); - kDebug(7117) << "Starting " << getpid(); + qCDebug(AUDIOCD) << "Starting " << getpid(); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); AudioCDProtocol slave(args->arg(0).toLocal8Bit(), args->arg(1).toLocal8Bit(), args->arg(2).toLocal8Bit()); args->clear(); slave.dispatchLoop(); - kDebug(7117) << "Done"; + qCDebug(AUDIOCD) << "Done"; return 0; } @@ -235,12 +237,12 @@ // For ATAPI devices, we have no real choice. Use the // user selected value, even if there is none. // - kWarning(7117) << "Found an ATAPI device, assuming it is the one specified by the user."; + qCWarning(AUDIOCD) << "Found an ATAPI device, assuming it is the one specified by the user."; cd->setDevice( drive->cdda_device_name ); } else { - kDebug(7117) << "Found a SCSI or ATAPICAM device."; + qCDebug(AUDIOCD) << "Found a SCSI or ATAPICAM device."; if ( strlen(drive->dev->device_path) > 0 ) { cd->setDevice( drive->dev->device_path ); @@ -254,15 +256,13 @@ QString devname = QString::fromLatin1( "/dev/%1%2" ) .arg( drive->dev->given_dev_name ) .arg( drive->dev->given_unit_number ) ; - kDebug(7117) << " Using derived name " << devname; + qCDebug(AUDIOCD) << " Using derived name " << devname; cd->setDevice( devname ); } } #else -#ifdef __GNUC__ #warning audiocd ioslave is not going to work for you #endif -#endif } struct cdrom_drive * AudioCDProtocol::initRequest(const QUrl & url) @@ -422,7 +422,7 @@ if (d->req_track >= (int)d->tracks) d->req_track = -1; - kDebug(7117) << "path=" << path << " file=" << d->fname + qCDebug(AUDIOCD) << "path=" << path << " file=" << d->fname << " req_track=" << d->req_track << " which_dir=" << d->which_dir << " full CD?=" << d->req_allTracks << endl; return drive; } @@ -814,7 +814,7 @@ drive = cdda_identify(device, CDDA_MESSAGE_FORGETIT, 0); if (0 == drive) { - kDebug(7117) << "Can't find an audio CD on: \"" << d->device << "\""; + qCDebug(AUDIOCD) << "Can't find an audio CD on: \"" << d->device << "\""; const QFileInfo fi(d->device); if(!fi.isReadable()) @@ -830,7 +830,7 @@ if (0 != cdda_open(drive)) { - kDebug(7117) << "cdda_open failed"; + qCDebug(AUDIOCD) << "cdda_open failed"; error(KIO::ERR_CANNOT_OPEN_FOR_READING, d->device); cdda_close(drive); return 0; @@ -853,7 +853,7 @@ cdrom_paranoia * paranoia = paranoia_init(drive); if (0 == paranoia) { - kDebug(7117) << "paranoia_init failed"; + qWarning(AUDIOCD) << "paranoia_init failed"; return; } @@ -902,7 +902,7 @@ warned = 1; } if (0 == buf) { - kDebug(7117) << "Unrecoverable error in paranoia_read"; + qCDebug(AUDIOCD) << "Unrecoverable error in paranoia_read"; ok = false; error( ERR_SLAVE_DEFINED, i18n( "Error reading audio data for %1 from the CD", fileName ) ); break; @@ -912,7 +912,7 @@ int encoderProcessed = encoder->read(buf, CD_FRAMESAMPLES); if(encoderProcessed == -1){ - kDebug(7117) << "Encoder processing error, stopping."; + qCDebug(AUDIOCD) << "Encoder processing error, stopping."; ok = false; QString errMsg = i18n( "Could not read %1: encoding failed", fileName ); QString details = encoder->lastErrorMessage(); @@ -1039,7 +1039,7 @@ else if (attribute == QLatin1String("niceLevel")){ int niceLevel = value.toInt(); if(setpriority(PRIO_PROCESS, getpid(), niceLevel) != 0) - kDebug(7117) << "Setting nice level to (" << niceLevel << ") failed."; + qCDebug(AUDIOCD) << "Setting nice level to (" << niceLevel << ") failed."; } } } @@ -1070,7 +1070,7 @@ if(groupCDDA.hasKey("niceLevel")) { int niceLevel = groupCDDA.readEntry("niceLevel", 0); if(setpriority(PRIO_PROCESS, getpid(), niceLevel) != 0) - kDebug(7117) << "Setting nice level to (" << niceLevel << ") failed."; + qCDebug(AUDIOCD) << "Setting nice level to (" << niceLevel << ") failed."; } // The default track filename template @@ -1169,54 +1169,54 @@ { switch(function){ case PARANOIA_CB_VERIFY: - //kDebug(7117) << "PARANOIA_CB_VERIFY"; + //qCDebug(AUDIOCD) << "PARANOIA_CB_VERIFY"; break; case PARANOIA_CB_READ: - //kDebug(7117) << "PARANOIA_CB_READ"; + //qCDebug(AUDIOCD) << "PARANOIA_CB_READ"; break; case PARANOIA_CB_FIXUP_EDGE: - //kDebug(7117) << "PARANOIA_CB_FIXUP_EDGE"; + //qCDebug(AUDIOCD) << "PARANOIA_CB_FIXUP_EDGE"; paranoia_read_limited_error = 2; break; case PARANOIA_CB_FIXUP_ATOM: - //kDebug(7117) << "PARANOIA_CB_FIXUP_ATOM"; + //qCDebug(AUDIOCD) << "PARANOIA_CB_FIXUP_ATOM"; paranoia_read_limited_error = 6; break; case PARANOIA_CB_READERR: - kDebug(7117) << "PARANOIA_CB_READERR"; + qCDebug(AUDIOCD) << "PARANOIA_CB_READERR"; paranoia_read_limited_error = 6; break; case PARANOIA_CB_SKIP: - kDebug(7117) << "PARANOIA_CB_SKIP"; + qCDebug(AUDIOCD) << "PARANOIA_CB_SKIP"; paranoia_read_limited_error = 8; break; case PARANOIA_CB_OVERLAP: - //kDebug(7117) << "PARANOIA_CB_OVERLAP"; + //qCDebug(AUDIOCD) << "PARANOIA_CB_OVERLAP"; break; case PARANOIA_CB_SCRATCH: - kDebug(7117) << "PARANOIA_CB_SCRATCH"; + qCDebug(AUDIOCD) << "PARANOIA_CB_SCRATCH"; paranoia_read_limited_error = 7; break; case PARANOIA_CB_DRIFT: - //kDebug(7117) << "PARANOIA_CB_DRIFT"; + //qCDebug(AUDIOCD) << "PARANOIA_CB_DRIFT"; paranoia_read_limited_error = 4; break; case PARANOIA_CB_FIXUP_DROPPED: - kDebug(7117) << "PARANOIA_CB_FIXUP_DROPPED"; + qCDebug(AUDIOCD) << "PARANOIA_CB_FIXUP_DROPPED"; paranoia_read_limited_error = 5; break; case PARANOIA_CB_FIXUP_DUPED: - kDebug(7117) << "PARANOIA_CB_FIXUP_DUPED"; + qCDebug(AUDIOCD) << "PARANOIA_CB_FIXUP_DUPED"; paranoia_read_limited_error = 5; break; }