Changeset View
Changeset View
Standalone View
Standalone View
backends/fake/fake.cpp
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | 95 | { | |||
---|---|---|---|---|---|
98 | emit configChanged(mConfig); | 98 | emit configChanged(mConfig); | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | bool Fake::isValid() const | 101 | bool Fake::isValid() const | ||
102 | { | 102 | { | ||
103 | return true; | 103 | return true; | ||
104 | } | 104 | } | ||
105 | 105 | | |||
106 | QByteArray Fake::edid(int outputId) const | 106 | EdidPtr Fake::edid(int outputId) const | ||
107 | { | 107 | { | ||
108 | Q_UNUSED(outputId); | 108 | Q_UNUSED(outputId); | ||
109 | QFile file(mConfigFile); | 109 | QFile file(mConfigFile); | ||
110 | file.open(QIODevice::ReadOnly); | 110 | file.open(QIODevice::ReadOnly); | ||
111 | 111 | | |||
112 | const QJsonDocument jsonDoc = QJsonDocument::fromJson(file.readAll()); | 112 | const QJsonDocument jsonDoc = QJsonDocument::fromJson(file.readAll()); | ||
113 | const QJsonObject json = jsonDoc.object(); | 113 | const QJsonObject json = jsonDoc.object(); | ||
114 | 114 | | |||
115 | const QJsonArray outputs = json[QStringLiteral("outputs")].toArray(); | 115 | const QJsonArray outputs = json[QStringLiteral("outputs")].toArray(); | ||
116 | Q_FOREACH(const QJsonValue &value, outputs) { | 116 | Q_FOREACH(const QJsonValue &value, outputs) { | ||
117 | const QVariantMap output = value.toObject().toVariantMap(); | 117 | const QVariantMap output = value.toObject().toVariantMap(); | ||
118 | if (output[QStringLiteral("id")].toInt() != outputId) { | 118 | if (output[QStringLiteral("id")].toInt() != outputId) { | ||
119 | continue; | 119 | continue; | ||
120 | } | 120 | } | ||
121 | 121 | | |||
122 | return QByteArray::fromBase64(output[QStringLiteral("edid")].toByteArray()); | 122 | return EdidPtr::create(QByteArray::fromBase64(output[QStringLiteral("edid")].toByteArray())); | ||
123 | } | 123 | } | ||
124 | return QByteArray(); | 124 | return {}; | ||
125 | } | 125 | } | ||
126 | 126 | | |||
127 | void Fake::setConnected(int outputId, bool connected) | 127 | void Fake::setConnected(int outputId, bool connected) | ||
128 | { | 128 | { | ||
129 | KScreen::OutputPtr output = config()->output(outputId); | 129 | KScreen::OutputPtr output = config()->output(outputId); | ||
130 | if (output->isConnected() == connected) { | 130 | if (output->isConnected() == connected) { | ||
131 | return; | 131 | return; | ||
132 | } | 132 | } | ||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |