| 1 | /* |
|---|---|
| 2 | SPDX-FileCopyrightText: 2006 Michaƫl Larouche <michael.larouche@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 "fakeprocessor.h" |
| 8 | |
| 9 | #include <QStringList> |
| 10 | #include <QVariant> |
| 11 | |
| 12 | using namespace Solid::Backends::Fake; |
| 13 | |
| 14 | FakeProcessor::FakeProcessor(FakeDevice *device) |
| 15 | : FakeDeviceInterface(device) |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | FakeProcessor::~FakeProcessor() |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | int FakeProcessor::number() const |
| 24 | { |
| 25 | return fakeDevice()->property(QStringLiteral("number")).toInt(); |
| 26 | } |
| 27 | |
| 28 | int FakeProcessor::maxSpeed() const |
| 29 | { |
| 30 | return fakeDevice()->property(QStringLiteral("maxSpeed")).toInt(); |
| 31 | } |
| 32 | |
| 33 | bool FakeProcessor::canChangeFrequency() const |
| 34 | { |
| 35 | return fakeDevice()->property(QStringLiteral("canChangeFrequency")).toBool(); |
| 36 | } |
| 37 | |
| 38 | Solid::Processor::InstructionSets FakeProcessor::instructionSets() const |
| 39 | { |
| 40 | Solid::Processor::InstructionSets result; |
| 41 | |
| 42 | const QStringList extension_list = fakeDevice()->property(QStringLiteral("instructionSets")).toString().split(sep: QLatin1Char(',')); |
| 43 | for (const QString &extension_str : extension_list) { |
| 44 | if (extension_str == QLatin1String("mmx")) { |
| 45 | result |= Solid::Processor::IntelMmx; |
| 46 | } else if (extension_str == QLatin1String("sse")) { |
| 47 | result |= Solid::Processor::IntelSse; |
| 48 | } else if (extension_str == QLatin1String("sse2")) { |
| 49 | result |= Solid::Processor::IntelSse2; |
| 50 | } else if (extension_str == QLatin1String("sse3")) { |
| 51 | result |= Solid::Processor::IntelSse3; |
| 52 | } else if (extension_str == QLatin1String("sse4")) { |
| 53 | result |= Solid::Processor::IntelSse4; |
| 54 | } else if (extension_str == QLatin1String("3dnow")) { |
| 55 | result |= Solid::Processor::Amd3DNow; |
| 56 | } else if (extension_str == QLatin1String("altivec")) { |
| 57 | result |= Solid::Processor::AltiVec; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | return result; |
| 62 | } |
| 63 | |
| 64 | #include "moc_fakeprocessor.cpp" |
| 65 |
