Solid

fakeopticaldisc.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 "fakeopticaldisc.h"
8
9#include <QStringList>
10#include <QVariant>
11
12using namespace Solid::Backends::Fake;
13
14FakeOpticalDisc::FakeOpticalDisc(FakeDevice *device)
15 : FakeVolume(device)
16{
17}
18
19FakeOpticalDisc::~FakeOpticalDisc()
20{
21}
22
23Solid::OpticalDisc::ContentTypes FakeOpticalDisc::availableContent() const
24{
26
28 {QStringLiteral("audio"), Solid::OpticalDisc::Audio},
29 {QStringLiteral("data"), Solid::OpticalDisc::Data},
30 {QStringLiteral("vcd"), Solid::OpticalDisc::VideoCd},
31 {QStringLiteral("svcd"), Solid::OpticalDisc::SuperVideoCd},
32 {QStringLiteral("videodvd"), Solid::OpticalDisc::VideoDvd},
33 };
34
35 const QStringList content_typelist = fakeDevice()->property(QStringLiteral("availableContent")).toString().split(QLatin1Char(','));
36
37 for (const QString &type : content_typelist) {
38 content |= map.value(type, Solid::OpticalDisc::NoContent);
39 }
40
41 return content;
42}
43
44Solid::OpticalDisc::DiscType FakeOpticalDisc::discType() const
45{
46 QString type = fakeDevice()->property(QStringLiteral("discType")).toString();
47
48 if (type == QLatin1String("cd_rom")) {
49 return Solid::OpticalDisc::CdRom;
50 } else if (type == QLatin1String("cd_r")) {
51 return Solid::OpticalDisc::CdRecordable;
52 } else if (type == QLatin1String("cd_rw")) {
53 return Solid::OpticalDisc::CdRewritable;
54 } else if (type == QLatin1String("dvd_rom")) {
55 return Solid::OpticalDisc::DvdRom;
56 } else if (type == QLatin1String("dvd_ram")) {
57 return Solid::OpticalDisc::DvdRam;
58 } else if (type == QLatin1String("dvd_r")) {
59 return Solid::OpticalDisc::DvdRecordable;
60 } else if (type == QLatin1String("dvd_rw")) {
61 return Solid::OpticalDisc::DvdRewritable;
62 } else if (type == QLatin1String("dvd_plus_r")) {
63 return Solid::OpticalDisc::DvdPlusRecordable;
64 } else if (type == QLatin1String("dvd_plus_rw")) {
65 return Solid::OpticalDisc::DvdPlusRewritable;
66 } else if (type == QLatin1String("dvd_plus_r_dl")) {
67 return Solid::OpticalDisc::DvdPlusRecordableDuallayer;
68 } else if (type == QLatin1String("dvd_plus_rw_dl")) {
69 return Solid::OpticalDisc::DvdPlusRewritableDuallayer;
70 } else if (type == QLatin1String("bd_rom")) {
71 return Solid::OpticalDisc::BluRayRom;
72 } else if (type == QLatin1String("bd_r")) {
73 return Solid::OpticalDisc::BluRayRecordable;
74 } else if (type == QLatin1String("bd_re")) {
75 return Solid::OpticalDisc::BluRayRewritable;
76 } else if (type == QLatin1String("hddvd_rom")) {
77 return Solid::OpticalDisc::HdDvdRom;
78 } else if (type == QLatin1String("hddvd_r")) {
79 return Solid::OpticalDisc::HdDvdRecordable;
80 } else if (type == QLatin1String("hddvd_rw")) {
81 return Solid::OpticalDisc::HdDvdRewritable;
82 } else {
83 return Solid::OpticalDisc::UnknownDiscType;
84 }
85}
86
87bool FakeOpticalDisc::isAppendable() const
88{
89 return fakeDevice()->property(QStringLiteral("isAppendable")).toBool();
90}
91
92bool FakeOpticalDisc::isBlank() const
93{
94 return fakeDevice()->property(QStringLiteral("isBlank")).toBool();
95}
96
97bool FakeOpticalDisc::isRewritable() const
98{
99 return fakeDevice()->property(QStringLiteral("isRewritable")).toBool();
100}
101
102qulonglong FakeOpticalDisc::capacity() const
103{
104 return fakeDevice()->property(QStringLiteral("capacity")).toULongLong();
105}
106
107#include "moc_fakeopticaldisc.cpp"
DiscType
This enum type defines the type of optical disc it can be.
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
bool toBool() const const
QString toString() const const
qulonglong toULongLong(bool *ok) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:08:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.