11using namespace Solid::Backends::Fake;
13FakeCdrom::FakeCdrom(FakeDevice *device)
18FakeCdrom::~FakeCdrom()
26 const QMap<QString, Solid::OpticalDrive::MediumType>
map = {
27 {QStringLiteral(
"cdr"), Solid::OpticalDrive::Cdr},
28 {QStringLiteral(
"cdrw"), Solid::OpticalDrive::Cdrw},
29 {QStringLiteral(
"dvd"), Solid::OpticalDrive::Dvd},
30 {QStringLiteral(
"dvdr"), Solid::OpticalDrive::Dvdr},
31 {QStringLiteral(
"dvdrw"), Solid::OpticalDrive::Dvdrw},
32 {QStringLiteral(
"dvdram"), Solid::OpticalDrive::Dvdram},
33 {QStringLiteral(
"dvdplusr"), Solid::OpticalDrive::Dvdplusr},
34 {QStringLiteral(
"dvdplusrw"), Solid::OpticalDrive::Dvdplusrw},
35 {QStringLiteral(
"dvdplusrdl"), Solid::OpticalDrive::Dvdplusdl},
36 {QStringLiteral(
"dvdplusrwdl"), Solid::OpticalDrive::Dvdplusdlrw},
37 {QStringLiteral(
"bd"), Solid::OpticalDrive::Bd},
38 {QStringLiteral(
"bdr"), Solid::OpticalDrive::Bdr},
39 {QStringLiteral(
"bdre"), Solid::OpticalDrive::Bdre},
40 {QStringLiteral(
"hddvd"), Solid::OpticalDrive::HdDvd},
41 {QStringLiteral(
"hddvdr"), Solid::OpticalDrive::HdDvdr},
42 {QStringLiteral(
"hddvdrw"), Solid::OpticalDrive::HdDvdrw},
45 const QStringList supported_medialist = fakeDevice()->property(QStringLiteral(
"supportedMedia")).toString().simplified().split(QLatin1Char(
','));
47 for (
const QString &media : supported_medialist) {
48 supported |=
map.value(media, Solid::OpticalDrive::UnknownMediumType);
54int FakeCdrom::readSpeed()
const
56 return fakeDevice()->property(QStringLiteral(
"readSpeed")).
toInt();
59int FakeCdrom::writeSpeed()
const
61 return fakeDevice()->property(QStringLiteral(
"writeSpeed")).toInt();
64QList<int> FakeCdrom::writeSpeeds()
const
67 const QStringList speed_strlist = fakeDevice()->property(QStringLiteral(
"writeSpeeds")).toString().simplified().split(QLatin1Char(
','));
69 for (
const QString &speed_str : speed_strlist) {
70 speeds << speed_str.toInt();
76bool FakeCdrom::eject()
81#include "moc_fakecdrom.cpp"
QFlags< MediumType > MediumTypes
Stores a combination of MediumType values.
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)