Solid

fakecdrom.cpp
1/*
2 SPDX-FileCopyrightText: 2006 Davide Bettio <davide.bettio@kdemail.net>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "fakecdrom.h"
8
9#include <QStringList>
10
11using namespace Solid::Backends::Fake;
12
13FakeCdrom::FakeCdrom(FakeDevice *device)
14 : FakeStorage(device)
15{
16}
17
18FakeCdrom::~FakeCdrom()
19{
20}
21
22Solid::OpticalDrive::MediumTypes FakeCdrom::supportedMedia() const
23{
25
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},
43 };
44
45 const QStringList supported_medialist = fakeDevice()->property(QStringLiteral("supportedMedia")).toString().simplified().split(QLatin1Char(','));
46
47 for (const QString &media : supported_medialist) {
48 supported |= map.value(media, Solid::OpticalDrive::UnknownMediumType);
49 }
50
51 return supported;
52}
53
54int FakeCdrom::readSpeed() const
55{
56 return fakeDevice()->property(QStringLiteral("readSpeed")).toInt();
57}
58
59int FakeCdrom::writeSpeed() const
60{
61 return fakeDevice()->property(QStringLiteral("writeSpeed")).toInt();
62}
63
64QList<int> FakeCdrom::writeSpeeds() const
65{
66 QList<int> speeds;
67 const QStringList speed_strlist = fakeDevice()->property(QStringLiteral("writeSpeeds")).toString().simplified().split(QLatin1Char(','));
68
69 for (const QString &speed_str : speed_strlist) {
70 speeds << speed_str.toInt();
71 }
72
73 return speeds;
74}
75
76bool FakeCdrom::eject()
77{
78 return false;
79}
80
81#include "moc_fakecdrom.cpp"
QString simplified() const const
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
int toInt(bool *ok) const const
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.