[multimedia/audiocd-kio] /: Port to KIO::WorkerBase
Friedrich W. H. Kossebau
null at kde.org
Tue Jul 5 14:57:56 BST 2022
Git commit 4edb67edad4f9efdef29ff690eed41003674adbf by Friedrich W. H. Kossebau.
Committed on 03/07/2022 at 16:06.
Pushed by kossebau into branch 'master'.
Port to KIO::WorkerBase
M +4 -4 CMakeLists.txt
M +2 -2 HACKING
M +115 -153 audiocd.cpp
M +13 -12 audiocd.h
M +1 -1 data/org.kde.kio_audiocd.metainfo.xml
M +4 -4 doc/index.docbook
M +1 -1 kcmaudiocd/audiocd.desktop
M +1 -1 kcmaudiocd/audiocdconfig.ui
M +5 -5 kcmaudiocd/doc/index.docbook
M +3 -3 kcmaudiocd/kcmaudiocd.cpp
M +5 -5 plugins/audiocdencoder.cpp
M +11 -11 plugins/audiocdencoder.h
M +9 -7 plugins/flac/encoderflac.cpp
M +6 -6 plugins/flac/encoderflac.h
M +6 -6 plugins/lame/encoderlame.cpp
M +1 -1 plugins/lame/encoderlame.h
M +6 -6 plugins/opus/encoderopus.cpp
M +1 -1 plugins/opus/encoderopus.h
M +10 -8 plugins/vorbis/encodervorbis.cpp
M +6 -6 plugins/vorbis/encodervorbis.h
M +1 -1 plugins/wav/encodercda.cpp
M +4 -1 plugins/wav/encodercda.h
M +4 -4 plugins/wav/encoderwav.cpp
M +4 -1 plugins/wav/encoderwav.h
https://invent.kde.org/multimedia/audiocd-kio/commit/4edb67edad4f9efdef29ff690eed41003674adbf
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4ce7ce..d73972b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16)
project(audiocd VERSION "5.0.0")
set(QT_MIN_VERSION "5.15.0")
-set(KF_MIN_VERSION "5.90.0")
+set(KF_MIN_VERSION "5.96.0")
find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@@ -100,10 +100,10 @@ target_sources(kio_audiocd PRIVATE
ecm_qt_declare_logging_category(kio_audiocd
HEADER audiocd_kio_debug.h
IDENTIFIER AUDIOCD_KIO_LOG
- CATEGORY_NAME kf.kio.slaves.audiocd
- OLD_CATEGORY_NAMES kf5.kio.audiocd
+ CATEGORY_NAME kf.kio.workers.audiocd
+ OLD_CATEGORY_NAMES kf5.kio.audiocd kf.kio.slaves.audiocd
DEFAULT_SEVERITY Warning
- DESCRIPTION "audiocd KIO slave"
+ DESCRIPTION "audiocd KIO worker"
EXPORT AUDIOCD
)
diff --git a/HACKING b/HACKING
index 99725cc..14f40f1 100644
--- a/HACKING
+++ b/HACKING
@@ -1,6 +1,6 @@
// CODE LAYOUT
-audiocd.[h,cpp] - The main ioslave code. It contains the logic to rip audio from cd's. It loads all of the plugins that it can find. When it needs to encode, generate directories (and names of directories) it goes through it's list. audiocd uses libkcddb to retrieve its cddb entries and cdparinoia to retrieve the audio from the CD.
+audiocd.[h,cpp] - The main KIO worker code. It contains the logic to rip audio from cd's. It loads all of the plugins that it can find. When it needs to encode, generate directories (and names of directories) it goes through it's list. audiocd uses libkcddb to retrieve its cddb entries and cdparinoia to retrieve the audio from the CD.
plugins/audiocdencoder.[h,cpp] - The base class for all of the encoder plugins
@@ -10,7 +10,7 @@ plugins/opus/* - The opus encoder
plugins/vorbis/* - The ogg encoder
plugins/wav/* - The cda and wav "encoders"
-kcmaudiocd/ - kcm configure dialog for the audiocd ioslave. It also loads the plugins and gets their configure dialogs and puts them into the tab dialog.
+kcmaudiocd/ - kcm configure dialog for the audiocd KIO worker. It also loads the plugins and gets their configure dialogs and puts them into the tab dialog.
// USERS
diff --git a/audiocd.cpp b/audiocd.cpp
index c15bb6a..b4d1aa7 100644
--- a/audiocd.cpp
+++ b/audiocd.cpp
@@ -59,7 +59,6 @@ int Q_DECL_EXPORT kdemain(int argc, char **argv);
#include <KLocalizedString>
#include <KMacroExpander>
#include <QRegularExpression>
-#include <kio_version.h>
// CDDB
#include <KCDDB/Client>
@@ -69,7 +68,7 @@ int Q_DECL_EXPORT kdemain(int argc, char **argv);
class KIOPluginForMetaData : public QObject
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.kde.kio.slave.audiocd" FILE "audiocd.json")
+ Q_PLUGIN_METADATA(IID "org.kde.kio.worker.audiocd" FILE "audiocd.json")
};
using namespace KIO;
@@ -93,8 +92,8 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
qCDebug(AUDIOCD_KIO_LOG) << "Starting " << getpid();
- AudioCDProtocol slave(argv[1], argv[2], argv[3]);
- slave.dispatchLoop();
+ AudioCDProtocol worker(argv[1], argv[2], argv[3]);
+ worker.dispatchLoop();
qCDebug(AUDIOCD_KIO_LOG) << "Done";
@@ -104,7 +103,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
enum Which_dir {
Unknown = 0, // Error
Info, // CDDB info
- Base, // The ioslave base directory showing all drives
+ Base, // The KIO worker base directory showing all drives
Root, // The root directory, shows all these :)
FullCD, // Show a single file containing all of the data
EncoderDir, // The root directory created by an encoder
@@ -193,7 +192,7 @@ public:
int paranoia_read_limited_error;
AudioCDProtocol::AudioCDProtocol(const QByteArray &protocol, const QByteArray &pool, const QByteArray &app)
- : SlaveBase(protocol, pool, app)
+ : WorkerBase(protocol, pool, app)
{
d = new Private;
// Add encoders
@@ -266,7 +265,7 @@ static void setDeviceToCd(KCompactDisc *cd, struct cdrom_drive *drive)
}
#else
#ifdef __GNUC__
-#warning audiocd ioslave is not going to work for you
+#warning audiocd KIO worker is not going to work for you
#endif
#endif
}
@@ -274,23 +273,23 @@ static void setDeviceToCd(KCompactDisc *cd, struct cdrom_drive *drive)
// Initiate a request to access the CD drive. If there is no valid drive
// specified or there is a problem, then error() must be (or have been)
// called before returning a null pointer.
-struct cdrom_drive *AudioCDProtocol::initRequest(const QUrl &url)
+KIO::WorkerResult AudioCDProtocol::initRequest(const QUrl &url, struct cdrom_drive **drive)
{
// Load our Settings.
loadSettings();
// Then URL parameters can overrule our settings.
parseURLArgs(url);
- struct cdrom_drive *drive = getDrive();
- if (drive == nullptr) {
- return nullptr;
+ const KIO::WorkerResult result = getDrive(drive);
+ if (!result.success()) {
+ return result;
}
- if (d->tocsAreDifferent(drive)) {
+ if (d->tocsAreDifferent(*drive)) {
// Update our knowledge of the disc
KCompactDisc cd(KCompactDisc::Asynchronous);
- setDeviceToCd(&cd, drive);
- d->setToc(drive);
+ setDeviceToCd(&cd, *drive);
+ d->setToc(*drive);
d->tracks = cd.tracks();
for (uint i = 0; i < cd.tracks(); i++)
d->trackIsAudio[i] = cd.isAudio(i + 1);
@@ -426,7 +425,7 @@ struct cdrom_drive *AudioCDProtocol::initRequest(const QUrl &url)
qCDebug(AUDIOCD_KIO_LOG) << "path=" << path << " file=" << d->fname << " req_track=" << d->req_track << " which_dir=" << d->which_dir
<< " full CD?=" << d->req_allTracks;
- return drive;
+ return KIO::WorkerResult::pass();
}
bool AudioCDProtocol::getSectorsForRequest(struct cdrom_drive *drive, long &firstSector, long &lastSector) const
@@ -458,14 +457,13 @@ static uint findInformationFileNumber(const QString &filename, uint max) {
return max + 1;
}
-// See whether this is the root of the ioslave (listing of all
+// See whether this is the root of the io worker (listing of all
// available CD drives) or the root of a drive (listing of encoder
// subdirectories and track WAV files).
//
// This needs to be deduced from the URL without calling initRequest()
-// or getDrive(), either of which may call error(). It is not an
-// error if there is no drive to be accessed and none needs to be, but
-// subsequently calling finished() will assert.
+// or getDrive(), either of which may return KIO::WorkerResult::fail(). It is not an
+// error if there is no drive to be accessed and none needs to be.
//
// So parse the URL only. Either Base, Root or Unknown (meaning "anywhere
// else") will be returned.
@@ -473,7 +471,7 @@ static Which_dir whichFromUrl(const QUrl &url)
{
QUrlQuery query(url);
if (!query.hasQueryItem(QStringLiteral("device"))) { // see if "device" query present
- return Base; // if not, must be slave base
+ return Base; // if not, must be KIO worker base
}
if (url.path() == QLatin1String("/")) { // see if the device root
@@ -486,16 +484,15 @@ static Which_dir whichFromUrl(const QUrl &url)
// Check that the URL does not have a host specified, and return an error
// if it does. Moved here because not all operations need to or should
// call initRequest().
-bool AudioCDProtocol::checkNoHost(const QUrl &url)
+KIO::WorkerResult AudioCDProtocol::checkNoHost(const QUrl &url)
{
if (!url.host().isEmpty()) {
- error(KIO::ERR_UNSUPPORTED_ACTION,
- i18n("You cannot specify a host with this protocol. "
- "Please use the audiocd:/ format instead."));
- return false;
+ return KIO::WorkerResult::fail(KIO::ERR_UNSUPPORTED_ACTION,
+ i18n("You cannot specify a host with this protocol. "
+ "Please use the audiocd:/ format instead."));
}
- return true;
+ return KIO::WorkerResult::pass();
}
// Escape any '/'es in what should be a file name.
@@ -507,16 +504,17 @@ static QString escapePath(const QString &in)
return result;
}
-void AudioCDProtocol::get(const QUrl &url)
+KIO::WorkerResult AudioCDProtocol::get(const QUrl &url)
{
- if (!checkNoHost(url)) {
- return;
+ const KIO::WorkerResult noHostResult = checkNoHost(url);
+ if (!noHostResult.success()) {
+ return noHostResult;
}
- struct cdrom_drive *drive = initRequest(url);
- if (drive == nullptr) {
- // Do not call error(), getDrive() will already have done that.
- return;
+ struct cdrom_drive *drive;
+ const KIO::WorkerResult initResult = initRequest(url, &drive);
+ if (!initResult.success()) {
+ return initResult;
}
if (d->fname.contains(i18n("CDDB Information"))) {
@@ -531,7 +529,6 @@ void AudioCDProtocol::get(const QUrl &url)
data((*it).toString().toUtf8());
// send an empty QByteArray to signal end of data.
data(QByteArray());
- finished();
found = true;
break;
}
@@ -543,27 +540,24 @@ void AudioCDProtocol::get(const QUrl &url)
// data(QCString( d->fname.latin1() ));
// send an empty QByteArray to signal end of data.
data(QByteArray());
- finished();
found = true;
}
- if (!found)
- error(KIO::ERR_DOES_NOT_EXIST, url.path());
cdda_close(drive);
- return;
+ if (!found)
+ return KIO::WorkerResult::fail(KIO::ERR_DOES_NOT_EXIST, url.path());
+ return KIO::WorkerResult::pass();
}
long firstSector, lastSector;
if (!getSectorsForRequest(drive, firstSector, lastSector)) {
- error(KIO::ERR_DOES_NOT_EXIST, url.path());
cdda_close(drive);
- return;
+ return KIO::WorkerResult::fail(KIO::ERR_DOES_NOT_EXIST, url.path());
}
AudioCDEncoder *encoder = determineEncoder(d->fname);
if (!encoder) {
- error(KIO::ERR_DOES_NOT_EXIST, url.path());
cdda_close(drive);
- return;
+ return KIO::WorkerResult::fail(KIO::ERR_DOES_NOT_EXIST, url.path());
}
KCDDB::CDInfo info;
@@ -589,14 +583,14 @@ void AudioCDProtocol::get(const QUrl &url)
mimeType(QLatin1String(encoder->mimeType()));
// Read data (track/disk) from the cd
- paranoiaRead(drive, firstSector, lastSector, encoder, url.fileName(), size);
+ const KIO::WorkerResult readResult = paranoiaRead(drive, firstSector, lastSector, encoder, url.fileName(), size);
// send an empty QByteArray to signal end of data.
data(QByteArray());
cdda_close(drive);
- finished();
+ return readResult;
}
static void app_dir(UDSEntry &e, const QString &n, size_t s)
@@ -631,10 +625,11 @@ static void app_file(UDSEntry &e, const QString &n, size_t s, const QString &mim
e.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, mimetype);
}
-void AudioCDProtocol::stat(const QUrl &url)
+KIO::WorkerResult AudioCDProtocol::stat(const QUrl &url)
{
- if (!checkNoHost(url)) {
- return;
+ const KIO::WorkerResult result = checkNoHost(url);
+ if (!result.success()) {
+ return result;
}
if (whichFromUrl(url) == Base) {
@@ -646,14 +641,13 @@ void AudioCDProtocol::stat(const QUrl &url)
const QStringList &deviceNames = KCompactDisc::cdromDeviceNames();
app_dir(entry, escapePath(QStringLiteral("/")), deviceNames.count());
statEntry(entry);
- finished();
- return;
+ return KIO::WorkerResult::pass();
}
- struct cdrom_drive *drive = initRequest(url);
- if (drive == nullptr) {
- // Do not call error(), getDrive() will already have done that.
- return;
+ struct cdrom_drive *drive;
+ const KIO::WorkerResult initResult = initRequest(url, &drive);
+ if (!initResult.success()) {
+ return initResult;
}
if (d->which_dir == Info) {
@@ -663,9 +657,9 @@ void AudioCDProtocol::stat(const QUrl &url)
UDSEntry entry;
app_dir(entry, escapePath(url.fileName()), d->cddbList.count());
statEntry(entry);
- finished();
- return;
- } else if (d->fname.contains(i18n("CDDB Information"))) {
+ return KIO::WorkerResult::pass();
+ }
+ if (d->fname.contains(i18n("CDDB Information"))) {
// choice is 1-indexed so we need <= and -1 when accessing d->cddbList
const uint choice = findInformationFileNumber(d->fname, d->cddbList.count());
if (choice <= (uint)d->cddbList.count()) {
@@ -673,8 +667,7 @@ void AudioCDProtocol::stat(const QUrl &url)
UDSEntry entry;
app_file(entry, escapePath(url.fileName()), d->cddbList.at(choice - 1).toString().toLatin1().size(), QStringLiteral("text/plain"));
statEntry(entry);
- finished();
- return;
+ return KIO::WorkerResult::pass();
}
}
}
@@ -688,9 +681,8 @@ void AudioCDProtocol::stat(const QUrl &url)
if (!d->req_allTracks) { // we only want to rip one track.
// does this track exist?
if (isFile && (trackNumber < 1 || trackNumber > d->tracks)) {
- error(KIO::ERR_DOES_NOT_EXIST, url.path());
cdda_close(drive);
- return;
+ return KIO::WorkerResult::fail(KIO::ERR_DOES_NOT_EXIST, url.path());
}
}
@@ -706,13 +698,14 @@ void AudioCDProtocol::stat(const QUrl &url)
statEntry(entry);
cdda_close(drive);
- finished();
+ return KIO::WorkerResult::pass();
}
-void AudioCDProtocol::listDir(const QUrl &url)
+KIO::WorkerResult AudioCDProtocol::listDir(const QUrl &url)
{
- if (!checkNoHost(url)) {
- return;
+ const KIO::WorkerResult result = checkNoHost(url);
+ if (!result.success()) {
+ return result;
}
UDSEntry entry;
@@ -736,28 +729,23 @@ void AudioCDProtocol::listDir(const QUrl &url)
listEntry(entry);
}
totalSize(entry.count());
- finished();
- return;
+ return KIO::WorkerResult::pass();
}
- struct cdrom_drive *drive = initRequest(url);
-
- // Some error checking before proceeding
- if (drive == nullptr) {
- // Do not call error(), getDrive() will already have done that.
- return;
+ struct cdrom_drive *drive;
+ const KIO::WorkerResult initResult = initRequest(url, &drive);
+ if (!initResult.success()) {
+ return initResult;
}
if (d->which_dir == Unknown) {
- error(KIO::ERR_DOES_NOT_EXIST, url.path());
cdda_close(drive);
- return;
+ return KIO::WorkerResult::fail(KIO::ERR_DOES_NOT_EXIST, url.path());
}
if (!d->fname.isEmpty()) {
- error(KIO::ERR_IS_FILE, url.path());
cdda_close(drive);
- return;
+ return KIO::WorkerResult::fail(KIO::ERR_IS_FILE, url.path());
}
// Generate templated names every time
@@ -835,9 +823,8 @@ void AudioCDProtocol::listDir(const QUrl &url)
case Info:
case Unknown:
default:
- error(KIO::ERR_INTERNAL, url.path());
cdda_close(drive);
- return;
+ return KIO::WorkerResult::fail(KIO::ERR_INTERNAL, url.path());
}
}
} else {
@@ -848,7 +835,7 @@ void AudioCDProtocol::listDir(const QUrl &url)
totalSize(entry.count());
cdda_close(drive);
- finished();
+ return KIO::WorkerResult::pass();
}
void AudioCDProtocol::addEntry(const QString &trackTitle, AudioCDEncoder *encoder, struct cdrom_drive *drive, int trackNo)
@@ -880,82 +867,66 @@ long AudioCDProtocol::fileSize(long firstSector, long lastSector, AudioCDEncoder
return encoder->size(length_seconds);
}
-// If a null pointer (meaning no or an invalid drive) is to be returned,
-// this must call error() first and the caller must not subsequently
-// call error() or finished().
-struct cdrom_drive *AudioCDProtocol::getDrive()
+KIO::WorkerResult AudioCDProtocol::getDrive(struct cdrom_drive **drive)
{
const QByteArray device(QFile::encodeName(d->device));
if (device.isEmpty()) {
- error(KIO::ERR_MALFORMED_URL, i18nc("The URL does not include a device name", "Missing device specification"));
- return nullptr;
+ *drive = nullptr;
+ return KIO::WorkerResult::fail(KIO::ERR_MALFORMED_URL, i18nc("The URL does not include a device name", "Missing device specification"));
}
- struct cdrom_drive *drive = cdda_identify(device.data(), CDDA_MESSAGE_FORGETIT, nullptr);
- if (drive == nullptr) {
+ *drive = cdda_identify(device.data(), CDDA_MESSAGE_FORGETIT, nullptr);
+ if (*drive == nullptr) {
qCDebug(AUDIOCD_KIO_LOG) << "Can't find an audio CD on: \"" << d->device << "\"";
const QFileInfo fi(d->device);
if (!fi.isReadable())
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 96, 0)
- error(KIO::ERR_WORKER_DEFINED,
-#else
- error(KIO::ERR_SLAVE_DEFINED,
-#endif
- i18n("Device does not have read permissions for this account. "
- "Check the read permissions on the device."));
- else if (!fi.isWritable())
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 96, 0)
- error(KIO::ERR_WORKER_DEFINED,
-#else
- error(KIO::ERR_SLAVE_DEFINED,
-#endif
- i18n("Device does not have write permissions for this account. "
- "Check the write permissions on the device."));
- else if (!fi.exists())
- error(KIO::ERR_DOES_NOT_EXIST, d->device);
- else
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 96, 0)
- error(KIO::ERR_WORKER_DEFINED,
-#else
- error(KIO::ERR_SLAVE_DEFINED,
-#endif
- i18n("Unknown error. If you have a cd in the drive try running "
- "cdparanoia -vsQ as yourself (not root). Do you see a track "
- "list? If not, make sure you have permission to access the CD "
- "device. If you are using SCSI emulation (possible if you "
- "have an IDE CD writer) then make sure you check that you "
- "have read and write permissions on the generic SCSI device, "
- "which is probably /dev/sg0, /dev/sg1, etc.. If it still does "
- "not work, try typing audiocd:/?device=/dev/sg0 (or similar) "
- "to tell kio_audiocd which device your CD-ROM is."));
- return nullptr;
+ return KIO::WorkerResult::fail(KIO::ERR_WORKER_DEFINED,
+ i18n("Device does not have read permissions for this account. "
+ "Check the read permissions on the device."));
+ if (!fi.isWritable())
+ return KIO::WorkerResult::fail(KIO::ERR_WORKER_DEFINED,
+ i18n("Device does not have write permissions for this account. "
+ "Check the write permissions on the device."));
+ if (!fi.exists())
+ return KIO::WorkerResult::fail(KIO::ERR_DOES_NOT_EXIST, d->device);
+
+ return KIO::WorkerResult::fail(KIO::ERR_WORKER_DEFINED,
+ i18n("Unknown error. If you have a cd in the drive try running "
+ "cdparanoia -vsQ as yourself (not root). Do you see a track "
+ "list? If not, make sure you have permission to access the CD "
+ "device. If you are using SCSI emulation (possible if you "
+ "have an IDE CD writer) then make sure you check that you "
+ "have read and write permissions on the generic SCSI device, "
+ "which is probably /dev/sg0, /dev/sg1, etc.. If it still does "
+ "not work, try typing audiocd:/?device=/dev/sg0 (or similar) "
+ "to tell kio_audiocd which device your CD-ROM is."));
}
- if (cdda_open(drive) != 0) {
+ if (cdda_open(*drive) != 0) {
qCDebug(AUDIOCD_KIO_LOG) << "cdda_open failed";
- error(KIO::ERR_CANNOT_OPEN_FOR_READING, d->device);
- cdda_close(drive);
- return nullptr;
+ cdda_close(*drive);
+ *drive = nullptr;
+ return KIO::WorkerResult::fail(KIO::ERR_CANNOT_OPEN_FOR_READING, d->device);
}
- return drive;
+ return KIO::WorkerResult::pass();
}
-void AudioCDProtocol::paranoiaRead(struct cdrom_drive *drive,
- long firstSector,
- long lastSector,
- AudioCDEncoder *encoder,
- const QString &fileName,
- unsigned long size)
+KIO::WorkerResult AudioCDProtocol::paranoiaRead(struct cdrom_drive *drive,
+ long firstSector,
+ long lastSector,
+ AudioCDEncoder *encoder,
+ const QString &fileName,
+ unsigned long size)
{
if (!encoder || !drive)
- return;
+ return KIO::WorkerResult::fail();
cdrom_paranoia *paranoia = paranoia_init(drive);
if (nullptr == paranoia) {
qCDebug(AUDIOCD_KIO_LOG) << "paranoia_init failed";
- return;
+ return KIO::WorkerResult::fail();
}
int paranoiaLevel = PARANOIA_MODE_FULL ^ PARANOIA_MODE_NEVERSKIP;
@@ -987,6 +958,7 @@ void AudioCDProtocol::paranoiaRead(struct cdrom_drive *drive,
// TODO test for errors (processed<0)?
processedSize(processed);
bool ok = true;
+ QString errorString;
unsigned long lastSize = size;
unsigned long diff = 0;
@@ -1005,12 +977,7 @@ void AudioCDProtocol::paranoiaRead(struct cdrom_drive *drive,
if (nullptr == buf) {
qCDebug(AUDIOCD_KIO_LOG) << "Unrecoverable error in paranoia_read";
ok = false;
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 96, 0)
- error(KIO::ERR_WORKER_DEFINED,
-#else
- error(KIO::ERR_SLAVE_DEFINED,
-#endif
- i18n("Error reading audio data for %1 from the CD", fileName));
+ errorString = i18n("Error reading audio data for %1 from the CD", fileName);
break;
}
@@ -1020,16 +987,10 @@ void AudioCDProtocol::paranoiaRead(struct cdrom_drive *drive,
if (encoderProcessed == -1) {
qCDebug(AUDIOCD_KIO_LOG) << "Encoder processing error, stopping.";
ok = false;
- QString errMsg = i18n("Could not read %1: encoding failed", fileName);
+ errorString = i18n("Could not read %1: encoding failed", fileName);
const QString details = encoder->lastErrorMessage();
if (!details.isEmpty())
- errMsg += QLatin1Char('\n') + details;
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 96, 0)
- error(KIO::ERR_WORKER_DEFINED,
-#else
- error(KIO::ERR_SLAVE_DEFINED,
-#endif
- errMsg);
+ errorString += QLatin1Char('\n') + details;
break;
}
processed += encoderProcessed;
@@ -1104,15 +1065,16 @@ void AudioCDProtocol::paranoiaRead(struct cdrom_drive *drive,
totalSize(processed);
processedSize(processed);
} else if (ok) // i.e. no error message already emitted
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 96, 0)
- error(KIO::ERR_WORKER_DEFINED,
-#else
- error(KIO::ERR_SLAVE_DEFINED,
-#endif
- i18n("Could not read %1: encoding failed", fileName));
+ errorString = i18n("Could not read %1: encoding failed", fileName);
paranoia_free(paranoia);
paranoia = nullptr;
+
+ if (!errorString.isEmpty()) {
+ return KIO::WorkerResult::fail(ERR_WORKER_DEFINED, errorString);
+ }
+
+ return KIO::WorkerResult::pass();
}
/**
diff --git a/audiocd.h b/audiocd.h
index 2bf9df5..f318ce7 100644
--- a/audiocd.h
+++ b/audiocd.h
@@ -26,7 +26,7 @@
#ifndef AUDIO_CD_H
#define AUDIO_CD_H
-#include <KIO/SlaveBase>
+#include <KIO/WorkerBase>
class AudioCDEncoder;
@@ -35,19 +35,19 @@ struct cdrom_drive;
namespace AudioCD {
/**
- * The core class of the audiocd:// ioslave.
- * It has the ioslave login and the ripping logic. The actual encoding
+ * The core class of the audiocd:// KIO worker.
+ * It has the KIO worker login and the ripping logic. The actual encoding
* is done by encoders that are separate objects.
*/
-class AudioCDProtocol : public KIO::SlaveBase
+class AudioCDProtocol : public KIO::WorkerBase
{
public:
AudioCDProtocol(const QByteArray &protocol, const QByteArray &pool, const QByteArray &app);
~AudioCDProtocol() override;
- void get(const QUrl &) override;
- void stat(const QUrl &) override;
- void listDir(const QUrl &) override;
+ KIO::WorkerResult get(const QUrl &) override;
+ KIO::WorkerResult stat(const QUrl &) override;
+ KIO::WorkerResult listDir(const QUrl &) override;
protected:
AudioCDEncoder *encoderFromExtension(const QString &extension);
@@ -73,12 +73,13 @@ protected:
long fileSize(long firstSector, long lastSector, AudioCDEncoder *encoder);
/**
- * The heart of this ioslave.
+ * The heart of this KIO worker.
* Reads data off the cd and then passes it to an encoder to encode
*/
- void paranoiaRead(struct cdrom_drive *drive, long firstSector, long lastSector, AudioCDEncoder *encoder, const QString &fileName, unsigned long size);
+ KIO::WorkerResult
+ paranoiaRead(struct cdrom_drive *drive, long firstSector, long lastSector, AudioCDEncoder *encoder, const QString &fileName, unsigned long size);
- struct cdrom_drive *initRequest(const QUrl &);
+ KIO::WorkerResult initRequest(const QUrl &url, struct cdrom_drive **drive);
/**
* Add an entry in the KIO directory, using the title you give,
@@ -100,10 +101,10 @@ protected:
private:
void generateTemplateTitles();
- bool checkNoHost(const QUrl &url);
+ KIO::WorkerResult checkNoHost(const QUrl &url);
QList<AudioCDEncoder *> encoders;
- cdrom_drive *getDrive();
+ KIO::WorkerResult getDrive(struct cdrom_drive **drive);
// These are the only guaranteed encoders to be built, the rest
// are dynamic depending on other libraries on the system
diff --git a/data/org.kde.kio_audiocd.metainfo.xml b/data/org.kde.kio_audiocd.metainfo.xml
index 9627aba..afdc500 100644
--- a/data/org.kde.kio_audiocd.metainfo.xml
+++ b/data/org.kde.kio_audiocd.metainfo.xml
@@ -77,7 +77,7 @@
<summary xml:lang="zh-CN">KDE Plasma 和 KDE 应用程序的音频 CD 透明集成从属程序,具有数据转换功能</summary>
<summary xml:lang="zh-TW">透明整合 Audio CD 到 KDE Plasma 和包含資料轉換功能的 KDE 應用程式</summary>
<description>
- <p>KIO AudioCD is a KIO slave that enables KIO-aware applications (such as Dolphin or k3b) to access audio and CD text data on the audio compact disks. It allows transparent drag and drop conversion of audio data into the popular formats and has a configuration System Settings module available in the "Multimedia" section.</p>
+ <p>KIO AudioCD is a KIO worker that enables KIO-aware applications (such as Dolphin or k3b) to access audio and CD text data on the audio compact disks. It allows transparent drag and drop conversion of audio data into the popular formats and has a configuration System Settings module available in the "Multimedia" section.</p>
<p xml:lang="az">KIO AudioCD modulu, Dolphin fayl meneceri və ya K3b disk yazma tətbiqi kimi, KİO modulunda işləmək üçün istifadə olunan tətbiqlərin köməyi ilə kompakt-diskə yazılan səs və CD mətni məlumatlarına giriş əldə etməyə imkan verir. Bu modul, kompakt-diskdən audio məlumatlarını sadəcə köçürməklə onları tanınmış audio formatlara çevirməyə icazə verir. Modulun parametrlərini "Multimedia" bölməsindəki Sistem Ayarlarında tənzimləyə bilərsiniz.</p>
<p xml:lang="ca">El KIO AudioCD és un esclau KIO que habilita les aplicacions que admeten el KIO (com el Dolphin o el K3b) per a accedir a l'àudio CD i a les dades de text dels discs compactes d'àudio. Permet la conversió transparent de dades d'àudio en arrossegar i deixar anar cap als formats usuals i té un mòdul de configuració a l'Arranjament del sistema a la secció «Multimèdia».</p>
<p xml:lang="ca-valencia">KIO AudioCD és un esclau KIO que habilita les aplicacions que admeten KIO (com Dolphin o K3b) per a accedir a l'àudio CD i a les dades de text dels discs compactes d'àudio. Permet la conversió transparent de dades d'àudio en arrossegar i deixar anar cap als formats usuals i té un mòdul de configuració a Configuració del sistema a la secció «Multimèdia».</p>
diff --git a/doc/index.docbook b/doc/index.docbook
index 5cf66cd..c636b53 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -25,13 +25,13 @@ and, when copied from the folder, are digitally extracted from the
<acronym>CD</acronym>. This ensures a perfect copy of the audio
data.</para>
-<para>To see how this slave works, insert an audio <acronym>CD</acronym>
+<para>To see how this KIO worker works, insert an audio <acronym>CD</acronym>
in your &CD-ROM; drive and type <userinput>audiocd:/</userinput> into
&konqueror;. Within a few seconds you should see a list of tracks and
some folders.</para>
<para>Audio <acronym>CD</acronym>s don't really have folders, but
-the audiocd slave provides them as a convenience. If you look inside
+the audiocd KIO worker provides them as a convenience. If you look inside
these folders you will see that they all contain the same number of
tracks. If you are connected to the Internet, some folders will have
the actual track titles shown as the filenames.</para>
@@ -48,7 +48,7 @@ saved to a file. Note that Ogg Vorbis is a compressed format, so the
file in your home folder will appear a great deal smaller than it
would have been if you had copied the raw data.</para>
-<para>The mechanism behind this is quite simple. When the audiocd slave
+<para>The mechanism behind this is quite simple. When the audiocd KIO worker
is asked to retrieve a track from the <filename class="directory">Ogg
Vorbis</filename> folder, it starts extracting the digital audio data
from the <acronym>CD</acronym>. As it sends the data over to the file in
@@ -78,7 +78,7 @@ below.</para>
<listitem>
<para>Set the path to the audio <acronym>CD</acronym> device, ⪚
<userinput>audiocd:/<option>?device</option>=<parameter>/dev/sdc</parameter></userinput>.
-Normally, the slave will try to find a <acronym>CD</acronym> drive with
+Normally, the KIO worker will try to find a <acronym>CD</acronym> drive with
an audio <acronym>CD</acronym> inserted, but if it fails or you have
more than one <acronym>CD</acronym> drive, you may want to try this
option. Note that the configuration dialog allows you to set a default
diff --git a/kcmaudiocd/audiocd.desktop b/kcmaudiocd/audiocd.desktop
index 5e3ec94..ed2b0a0 100644
--- a/kcmaudiocd/audiocd.desktop
+++ b/kcmaudiocd/audiocd.desktop
@@ -64,7 +64,7 @@ Name[uk]=Аудіо-КД
Name[x-test]=xxAudio CDsxx
Name[zh_CN]=音频 CD
Name[zh_TW]=音樂光碟
-Comment=Audiocd IO Slave Configuration
+Comment=Audiocd IO Worker Configuration
Comment[ar]=ضبط دخل وخرج الأقراص الصوتية
Comment[ast]=Configuración del esclavu d'E/S d'audiocd
Comment[az]=Audiocd IO Slave tənzimləməsi
diff --git a/kcmaudiocd/audiocdconfig.ui b/kcmaudiocd/audiocdconfig.ui
index c09939b..1087dc3 100644
--- a/kcmaudiocd/audiocdconfig.ui
+++ b/kcmaudiocd/audiocdconfig.ui
@@ -46,7 +46,7 @@
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="ec_enable_check">
<property name="whatsThis">
- <string>If you uncheck this option, the slave will not try to use error correction which can be useful for reading damaged CDs. However, this feature can be problematic in some cases, so you can switch it off here.</string>
+ <string>If you uncheck this option, the KIO worker will not try to use error correction which can be useful for reading damaged CDs. However, this feature can be problematic in some cases, so you can switch it off here.</string>
</property>
<property name="text">
<string>Use &error correction when reading the CD</string>
diff --git a/kcmaudiocd/doc/index.docbook b/kcmaudiocd/doc/index.docbook
index deb4031..6a54758 100644
--- a/kcmaudiocd/doc/index.docbook
+++ b/kcmaudiocd/doc/index.docbook
@@ -36,8 +36,8 @@
</articleinfo>
<sect1 id="audiocd-page">
-<title>Audiocd IO Slave Configuration</title>
-<para>The module <guilabel>Audiocd IO Slave Configuration</guilabel> page is divided in the <guilabel>General</guilabel> tab, the <guilabel>Names</guilabel> tab, and the encoder parameter tabs.</para>
+<title>Audiocd KIO Worker Configuration</title>
+<para>The module <guilabel>Audiocd KIO Worker Configuration</guilabel> page is divided in the <guilabel>General</guilabel> tab, the <guilabel>Names</guilabel> tab, and the encoder parameter tabs.</para>
<sect2 id="general-tab">
<title>The General Tab</title>
@@ -103,7 +103,7 @@
</screenshot>
<note>
-<para>The FLAC encoder tab is only available if Audiocd IO slave was compiled with libFLAC.</para>
+<para>The FLAC encoder tab is only available if Audiocd KIO worker was compiled with libFLAC.</para>
</note>
<para>FLAC is a lossless compressed audio format free of any patents or license fees. It maintains perfect CD audio quality while reducing file size by
@@ -140,7 +140,7 @@ about 50%. When using this codec the filesize is much larger than Opus, Ogg Vorb
<para>MP3 (or MPEG-1 Audio Layer III) is a patented digital audio codec using a form of lossy data compression. In spite of its shortcomings, it is a common format for consumer audio storage, and is widely supported on portable music players.</para>
-<para>Audiocd IO slave uses the LAME encoder to produce <filename class="extension">mp3</filename> files. LAME is considered the best MP3 encoder, mostly thanks to the dedicated work of its developers and the open source licensing model that allowed the project to tap into engineering resources from all around the world.</para>
+<para>Audiocd KIO worker uses the LAME encoder to produce <filename class="extension">mp3</filename> files. LAME is considered the best MP3 encoder, mostly thanks to the dedicated work of its developers and the open source licensing model that allowed the project to tap into engineering resources from all around the world.</para>
<variablelist>
<varlistentry><term><guilabel>Encoding Method</guilabel></term>
@@ -233,7 +233,7 @@ this information automatically via the Internet. Look at the &systemsettings; CD
</screenshot>
<note>
-<para>The Ogg Vorbis encoder tab is only available if Audiocd IO slave was compiled with <ulink url="https://xiph.org/vorbis/">libvorbis</ulink>.</para>
+<para>The Ogg Vorbis encoder tab is only available if Audiocd KIO worker was compiled with <ulink url="https://xiph.org/vorbis/">libvorbis</ulink>.</para>
</note>
<para>Ogg Vorbis is an open and royalty-free audio codec for lossy audio compression. It produces smaller files than MP3 at equivalent or higher quality.</para>
diff --git a/kcmaudiocd/kcmaudiocd.cpp b/kcmaudiocd/kcmaudiocd.cpp
index 24c45f2..563dbe8 100644
--- a/kcmaudiocd/kcmaudiocd.cpp
+++ b/kcmaudiocd/kcmaudiocd.cpp
@@ -91,7 +91,7 @@ KAudiocdModule::KAudiocdModule(QWidget *parent, const QVariantList &lst)
connect(audioConfig->kcfg_replaceOutput, &QLineEdit::textChanged, this, &KAudiocdModule::slotConfigChanged);
connect(audioConfig->example, &QLineEdit::textChanged, this, &KAudiocdModule::slotConfigChanged);
- auto about = new KAboutData(QStringLiteral("kcmaudiocd"), i18n("KDE Audio CD IO Slave"), QStringLiteral(AUDIOCDPLUGINS_VERSION_STRING));
+ auto about = new KAboutData(QStringLiteral("kcmaudiocd"), i18n("KDE Audio CD KIO Worker"), QStringLiteral(AUDIOCDPLUGINS_VERSION_STRING));
about->addAuthor(i18n("Benjamin C. Meyer"), i18n("Former Maintainer"), QStringLiteral("ben at meyerhome.net"));
about->addAuthor(i18n("Carsten Duvenhorst"), i18n("Original Author"), QStringLiteral("duvenhorst at duvnet.de"));
@@ -250,10 +250,10 @@ void KAudiocdModule::slotEcEnable() {
QString KAudiocdModule::quickHelp() const
{
return i18n(
- "<h1>Audio CDs</h1> The Audio CD IO-Slave enables you to easily"
+ "<h1>Audio CDs</h1> The Audio CD KIO Worker enables you to easily"
" create wav, FLAC, MP3, Ogg Vorbis or Opus files from your "
"audio CD-ROMs or DVDs."
- " The slave is invoked by typing <i>\"audiocd:/\"</i> in "
+ " The KIO worker is invoked by typing <i>\"audiocd:/\"</i> in "
"Dolphin's location"
" bar. In this module, you can configure"
" encoding, and device settings. Note that FLAC, MP3, Ogg Vorbis,"
diff --git a/plugins/audiocdencoder.cpp b/plugins/audiocdencoder.cpp
index 46cb334..0fff0da 100644
--- a/plugins/audiocdencoder.cpp
+++ b/plugins/audiocdencoder.cpp
@@ -26,7 +26,7 @@
#include <QLibraryInfo>
#include <QRegularExpression>
-Q_LOGGING_CATEGORY(AUDIOCD_KIO_LOG, "kf.kio.slaves.audiocd")
+Q_LOGGING_CATEGORY(AUDIOCD_KIO_LOG, "kf.kio.workers.audiocd")
/**
* Attempt to load a plugin and see if it has the symbol
@@ -49,7 +49,7 @@ static QFunctionPointer loadPlugin(const QString &libFileName)
* and I do know that this does work. :) Feel free to improve the loading
* system, there isn't much code anyway.
*/
-void AudioCDEncoder::findAllPlugins(KIO::SlaveBase *slave, QList<AudioCDEncoder *> &encoders)
+void AudioCDEncoder::findAllPlugins(KIO::WorkerBase *worker, QList<AudioCDEncoder *> &encoders)
{
QString foundEncoders;
@@ -76,9 +76,9 @@ void AudioCDEncoder::findAllPlugins(KIO::SlaveBase *slave, QList<AudioCDEncoder
QFunctionPointer function = loadPlugin(fi.absoluteFilePath());
if (function) {
- void (*functionPointer)(KIO::SlaveBase *, QList<AudioCDEncoder *> &) =
- (void (*)(KIO::SlaveBase * slave, QList<AudioCDEncoder *> & encoders)) function;
- functionPointer(slave, encoders);
+ void (*functionPointer)(KIO::WorkerBase *, QList<AudioCDEncoder *> &) =
+ (void (*)(KIO::WorkerBase * worker, QList<AudioCDEncoder *> & encoders)) function;
+ functionPointer(worker, encoders);
}
}
}
diff --git a/plugins/audiocdencoder.h b/plugins/audiocdencoder.h
index 4cf4f51..dbb047d 100644
--- a/plugins/audiocdencoder.h
+++ b/plugins/audiocdencoder.h
@@ -22,7 +22,7 @@
#include "audiocdplugins_export.h"
-#include <KIO/SlaveBase>
+#include <KIO/WorkerBase>
#include <QList>
#include <QLoggingCategory>
#include <sys/types.h>
@@ -39,11 +39,11 @@ class AUDIOCDPLUGINS_EXPORT AudioCDEncoder {
public:
/**
* Constructor.
- * @param slave parent that this classes can use to call data() with
+ * @param worker parent that this classes can use to call data() with
* when finished encoding bits.
*/
- explicit AudioCDEncoder(KIO::SlaveBase *slave)
- : ioslave(slave)
+ explicit AudioCDEncoder(KIO::WorkerBase *worker)
+ : ioWorker(worker)
{
}
@@ -143,18 +143,18 @@ public:
* Uses QLibraryInfo to find where libraries could be, opens all of the ones
* that we might own audiocd_encoder_* and then uses the symbol
* create_audiocd_encoders to obtain the encoders from that library.
- * @param slave ioslave needed if the plugin is going to be used to encode
+ * @param worker Worker needed if the plugin is going to be used to encode
* something.
* @param encoders container for new encoders.
*/
- static void findAllPlugins(KIO::SlaveBase *slave, QList<AudioCDEncoder *> &encoders);
+ static void findAllPlugins(KIO::WorkerBase *worker, QList<AudioCDEncoder *> &encoders);
protected:
- /**
- * Pointer to the ioslave that is running this encoder.
- * Used (only?) for the data() function to pass back encoded data.
- */
- KIO::SlaveBase *ioslave;
+ /**
+ * Pointer to the ioWorker that is running this encoder.
+ * Used (only?) for the data() function to pass back encoded data.
+ */
+ KIO::WorkerBase *ioWorker;
};
#endif // AUDIOCD_ENCODER_H
diff --git a/plugins/flac/encoderflac.cpp b/plugins/flac/encoderflac.cpp
index 9698453..d5fb465 100644
--- a/plugins/flac/encoderflac.cpp
+++ b/plugins/flac/encoderflac.cpp
@@ -34,12 +34,12 @@
#include <QDateTime>
#include <QPair>
-Q_LOGGING_CATEGORY(AUDIOCD_KIO_LOG, "kf.kio.slaves.audiocd")
+Q_LOGGING_CATEGORY(AUDIOCD_KIO_LOG, "kf.kio.workers.audiocd")
extern "C" {
-AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::SlaveBase *slave, QList<AudioCDEncoder *> &encoders)
+AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::WorkerBase *worker, QList<AudioCDEncoder *> &encoders)
{
- encoders.append(new EncoderFLAC(slave));
+ encoders.append(new EncoderFLAC(worker));
}
}
@@ -48,7 +48,7 @@ class EncoderFLAC::Private {
public:
FLAC__StreamEncoder *encoder;
FLAC__StreamMetadata **metadata;
- KIO::SlaveBase *ioslave;
+ KIO::WorkerBase *ioWorker;
unsigned long data;
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
unsigned compression_level;
@@ -78,7 +78,7 @@ static FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder *e
if (bytes) {
output = QByteArray::fromRawData((const char *)buffer, bytes);
- d->ioslave->data(output);
+ d->ioWorker->data(output);
output.clear();
}
@@ -99,9 +99,11 @@ FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void
*client_data)
{} ; */
-EncoderFLAC::EncoderFLAC(KIO::SlaveBase *slave) : AudioCDEncoder(slave) {
+EncoderFLAC::EncoderFLAC(KIO::WorkerBase *worker)
+ : AudioCDEncoder(worker)
+{
d = new Private();
- d->ioslave = slave;
+ d->ioWorker = worker;
d->encoder = nullptr;
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
d->compression_level = 5;
diff --git a/plugins/flac/encoderflac.h b/plugins/flac/encoderflac.h
index 78b7e63..e5902cd 100644
--- a/plugins/flac/encoderflac.h
+++ b/plugins/flac/encoderflac.h
@@ -43,13 +43,13 @@ public:
class EncoderFLAC : public AudioCDEncoder {
public:
- explicit EncoderFLAC(KIO::SlaveBase *slave);
- ~EncoderFLAC() override;
+ explicit EncoderFLAC(KIO::WorkerBase *worker);
+ ~EncoderFLAC() override;
- QString type() const override
- {
- return QLatin1String("FLAC");
- }
+ QString type() const override
+ {
+ return QLatin1String("FLAC");
+ }
bool init() override;
void loadSettings() override;
unsigned long size(long time_secs) const override;
diff --git a/plugins/lame/encoderlame.cpp b/plugins/lame/encoderlame.cpp
index ab1d74b..373e6fd 100644
--- a/plugins/lame/encoderlame.cpp
+++ b/plugins/lame/encoderlame.cpp
@@ -29,12 +29,12 @@
#include <QStringList>
#include <QTemporaryFile>
-Q_LOGGING_CATEGORY(AUDIOCD_KIO_LOG, "kf.kio.slaves.audiocd")
+Q_LOGGING_CATEGORY(AUDIOCD_KIO_LOG, "kf.kio.workers.audiocd")
extern "C" {
-AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::SlaveBase *slave, QList<AudioCDEncoder *> &encoders)
+AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::WorkerBase *worker, QList<AudioCDEncoder *> &encoders)
{
- encoders.append(new EncoderLame(slave));
+ encoders.append(new EncoderLame(worker));
}
}
@@ -53,9 +53,9 @@ public:
QTemporaryFile *tempFile;
};
-EncoderLame::EncoderLame(KIO::SlaveBase *slave)
+EncoderLame::EncoderLame(KIO::WorkerBase *worker)
: QObject()
- , AudioCDEncoder(slave)
+ , AudioCDEncoder(worker)
{
d = new Private();
d->waitingForWrite = false;
@@ -329,7 +329,7 @@ long EncoderLame::readCleanup()
while (!file.atEnd()) {
uint read = file.read(data, 1024);
QByteArray output(data, read);
- ioslave->data(output);
+ ioWorker->data(output);
}
file.close();
}
diff --git a/plugins/lame/encoderlame.h b/plugins/lame/encoderlame.h
index 25c88ab..26a4de2 100644
--- a/plugins/lame/encoderlame.h
+++ b/plugins/lame/encoderlame.h
@@ -43,7 +43,7 @@ class EncoderLame : public QObject, public AudioCDEncoder {
Q_OBJECT
public:
- explicit EncoderLame(KIO::SlaveBase *slave);
+ explicit EncoderLame(KIO::WorkerBase *worker);
~EncoderLame() override;
QString type() const override
diff --git a/plugins/opus/encoderopus.cpp b/plugins/opus/encoderopus.cpp
index b5a2ff1..afdced9 100644
--- a/plugins/opus/encoderopus.cpp
+++ b/plugins/opus/encoderopus.cpp
@@ -30,12 +30,12 @@
#include <QStringList>
#include <QTemporaryFile>
-Q_LOGGING_CATEGORY(AUDIOCD_KIO_LOG, "kf.kio.slaves.audiocd")
+Q_LOGGING_CATEGORY(AUDIOCD_KIO_LOG, "kf.kio.workers.audiocd")
extern "C" {
-AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::SlaveBase *slave, QList<AudioCDEncoder *> &encoders)
+AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::WorkerBase *worker, QList<AudioCDEncoder *> &encoders)
{
- encoders.append(new EncoderOpus(slave));
+ encoders.append(new EncoderOpus(worker));
}
}
@@ -54,9 +54,9 @@ public:
QTemporaryFile *tempFile = nullptr;
};
-EncoderOpus::EncoderOpus(KIO::SlaveBase *slave)
+EncoderOpus::EncoderOpus(KIO::WorkerBase *worker)
: QObject()
- , AudioCDEncoder(slave)
+ , AudioCDEncoder(worker)
{
d = new Private();
d->waitingForWrite = false;
@@ -217,7 +217,7 @@ long EncoderOpus::readCleanup()
while (!file.atEnd()) {
uint read = file.read(data, 1024);
QByteArray output(data, read);
- ioslave->data(output);
+ ioWorker->data(output);
}
file.close();
}
diff --git a/plugins/opus/encoderopus.h b/plugins/opus/encoderopus.h
index 8e6f4f4..16de6aa 100644
--- a/plugins/opus/encoderopus.h
+++ b/plugins/opus/encoderopus.h
@@ -44,7 +44,7 @@ class EncoderOpus : public QObject, public AudioCDEncoder {
Q_OBJECT
public:
- explicit EncoderOpus(KIO::SlaveBase *slave);
+ explicit EncoderOpus(KIO::WorkerBase *worker);
~EncoderOpus() override;
QString type() const override
diff --git a/plugins/vorbis/encodervorbis.cpp b/plugins/vorbis/encodervorbis.cpp
index 2d5e661..3a73a6a 100644
--- a/plugins/vorbis/encodervorbis.cpp
+++ b/plugins/vorbis/encodervorbis.cpp
@@ -35,9 +35,9 @@
#include <vorbis/vorbisenc.h>
extern "C" {
-AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::SlaveBase *slave, QList<AudioCDEncoder *> &encoders)
+AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::WorkerBase *worker, QList<AudioCDEncoder *> &encoders)
{
- encoders.append(new EncoderVorbis(slave));
+ encoders.append(new EncoderVorbis(worker));
}
}
@@ -66,8 +66,10 @@ public:
int vorbis_bitrate;
};
-EncoderVorbis::EncoderVorbis(KIO::SlaveBase *slave) : AudioCDEncoder(slave) {
- d = new Private();
+EncoderVorbis::EncoderVorbis(KIO::WorkerBase *worker)
+ : AudioCDEncoder(worker)
+{
+ d = new Private();
}
EncoderVorbis::~EncoderVorbis()
@@ -161,11 +163,11 @@ long EncoderVorbis::flush_vorbis()
char *oggbody = reinterpret_cast<char *>(d->og.body);
if (d->og.header_len) {
- ioslave->data(QByteArray::fromRawData(oggheader, d->og.header_len));
+ ioWorker->data(QByteArray::fromRawData(oggheader, d->og.header_len));
}
if (d->og.body_len) {
- ioslave->data(QByteArray::fromRawData(oggbody, d->og.body_len));
+ ioWorker->data(QByteArray::fromRawData(oggbody, d->og.body_len));
}
processed += d->og.header_len + d->og.body_len;
}
@@ -228,11 +230,11 @@ long EncoderVorbis::readInit(long /*size*/)
char *oggbody = reinterpret_cast<char *>(d->og.body);
if (d->og.header_len) {
- ioslave->data(QByteArray::fromRawData(oggheader, d->og.header_len));
+ ioWorker->data(QByteArray::fromRawData(oggheader, d->og.header_len));
}
if (d->og.body_len) {
- ioslave->data(QByteArray::fromRawData(oggbody, d->og.body_len));
+ ioWorker->data(QByteArray::fromRawData(oggbody, d->og.body_len));
}
}
return 0;
diff --git a/plugins/vorbis/encodervorbis.h b/plugins/vorbis/encodervorbis.h
index 8809b3b..756cd4d 100644
--- a/plugins/vorbis/encodervorbis.h
+++ b/plugins/vorbis/encodervorbis.h
@@ -47,13 +47,13 @@ public:
class EncoderVorbis : public AudioCDEncoder {
public:
- explicit EncoderVorbis(KIO::SlaveBase *slave);
- ~EncoderVorbis() override;
+ explicit EncoderVorbis(KIO::WorkerBase *worker);
+ ~EncoderVorbis() override;
- QString type() const override
- {
- return QLatin1String("Ogg Vorbis");
- }
+ QString type() const override
+ {
+ return QLatin1String("Ogg Vorbis");
+ }
bool init() override;
void loadSettings() override;
unsigned long size(long time_secs) const override;
diff --git a/plugins/wav/encodercda.cpp b/plugins/wav/encodercda.cpp
index e58b4f2..c8020ab 100644
--- a/plugins/wav/encodercda.cpp
+++ b/plugins/wav/encodercda.cpp
@@ -59,7 +59,7 @@ long EncoderCda::read(qint16 *buf, int frames)
buf[i] = swap16(buf[i]);
char *cbuf = reinterpret_cast<char *>(buf);
output = QByteArray::fromRawData(cbuf, CD_FRAMESIZE_RAW);
- ioslave->data(output);
+ ioWorker->data(output);
output.clear();
return CD_FRAMESIZE_RAW;
}
diff --git a/plugins/wav/encodercda.h b/plugins/wav/encodercda.h
index 77b78e8..771ef7d 100644
--- a/plugins/wav/encodercda.h
+++ b/plugins/wav/encodercda.h
@@ -39,7 +39,10 @@
class EncoderCda : public AudioCDEncoder {
public:
- explicit EncoderCda(KIO::SlaveBase *slave) : AudioCDEncoder(slave) {}
+ explicit EncoderCda(KIO::WorkerBase *worker)
+ : AudioCDEncoder(worker)
+ {
+ }
~EncoderCda() override
{
}
diff --git a/plugins/wav/encoderwav.cpp b/plugins/wav/encoderwav.cpp
index 23fd21e..bf2b1f4 100644
--- a/plugins/wav/encoderwav.cpp
+++ b/plugins/wav/encoderwav.cpp
@@ -27,10 +27,10 @@
#include <QList>
extern "C" {
-AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::SlaveBase *slave, QList<AudioCDEncoder *> &encoders)
+AUDIOCDPLUGINS_EXPORT void create_audiocd_encoders(KIO::WorkerBase *worker, QList<AudioCDEncoder *> &encoders)
{
- encoders.append(new EncoderWav(slave));
- encoders.append(new EncoderCda(slave));
+ encoders.append(new EncoderWav(worker));
+ encoders.append(new EncoderCda(worker));
}
}
@@ -73,7 +73,7 @@ long EncoderWav::readInit(long byteCount)
QByteArray output;
output = QByteArray::fromRawData((char *)riffHeader, 44);
- ioslave->data(output);
+ ioWorker->data(output);
output.clear();
return 44;
}
diff --git a/plugins/wav/encoderwav.h b/plugins/wav/encoderwav.h
index 30d8c24..b91237f 100644
--- a/plugins/wav/encoderwav.h
+++ b/plugins/wav/encoderwav.h
@@ -38,7 +38,10 @@
class EncoderWav : public EncoderCda {
public:
- explicit EncoderWav(KIO::SlaveBase *slave) : EncoderCda(slave) {}
+ explicit EncoderWav(KIO::WorkerBase *worker)
+ : EncoderCda(worker)
+ {
+ }
~EncoderWav() override
{
}
More information about the kde-doc-english
mailing list