Changeset View
Changeset View
Standalone View
Standalone View
kded/config.cpp
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Line(s) | 96 | { | |||
---|---|---|---|---|---|
109 | } | 109 | } | ||
110 | if (!file.open(QIODevice::ReadOnly)) { | 110 | if (!file.open(QIODevice::ReadOnly)) { | ||
111 | qCDebug(KSCREEN_KDED) << "failed to open file" << file.fileName(); | 111 | qCDebug(KSCREEN_KDED) << "failed to open file" << file.fileName(); | ||
112 | return nullptr; | 112 | return nullptr; | ||
113 | } | 113 | } | ||
114 | 114 | | |||
115 | QJsonDocument parser; | 115 | QJsonDocument parser; | ||
116 | QVariantList outputs = parser.fromJson(file.readAll()).toVariant().toList(); | 116 | QVariantList outputs = parser.fromJson(file.readAll()).toVariant().toList(); | ||
117 | Output::readInOutputs(config->data()->outputs(), outputs, ControlConfig(config->data()).readInOutputRetentionValues()); | 117 | Output::readInOutputs(config->data(), outputs); | ||
118 | 118 | | |||
119 | QSize screenSize; | 119 | QSize screenSize; | ||
120 | for (const auto &output : config->data()->outputs()) { | 120 | for (const auto &output : config->data()->outputs()) { | ||
121 | if (!output->isConnected() || !output->isEnabled()) { | 121 | if (!output->isConnected() || !output->isEnabled()) { | ||
122 | continue; | 122 | continue; | ||
123 | } | 123 | } | ||
124 | 124 | | |||
125 | const QRect geom = output->geometry(); | 125 | const QRect geom = output->geometry(); | ||
Show All 39 Lines | |||||
165 | 165 | | |||
166 | bool Config::writeFile(const QString &filePath) | 166 | bool Config::writeFile(const QString &filePath) | ||
167 | { | 167 | { | ||
168 | if (id().isEmpty()) { | 168 | if (id().isEmpty()) { | ||
169 | return false; | 169 | return false; | ||
170 | } | 170 | } | ||
171 | const KScreen::OutputList outputs = m_data->outputs(); | 171 | const KScreen::OutputList outputs = m_data->outputs(); | ||
172 | 172 | | |||
173 | const auto retentions = ControlConfig(m_data).readInOutputRetentionValues(); | 173 | const auto control = ControlConfig(m_data); | ||
174 | 174 | | |||
175 | QVariantList outputList; | 175 | QVariantList outputList; | ||
176 | Q_FOREACH(const KScreen::OutputPtr &output, outputs) { | 176 | Q_FOREACH(const KScreen::OutputPtr &output, outputs) { | ||
177 | QVariantMap info; | 177 | QVariantMap info; | ||
178 | 178 | | |||
179 | if (!output->isConnected()) { | 179 | if (!output->isConnected()) { | ||
180 | continue; | 180 | continue; | ||
181 | } | 181 | } | ||
182 | if (!Output::writeGlobalPart(output, info)) { | 182 | if (!Output::writeGlobalPart(output, info)) { | ||
183 | continue; | 183 | continue; | ||
184 | } | 184 | } | ||
185 | 185 | | |||
186 | info[QStringLiteral("primary")] = output->isPrimary(); | 186 | info[QStringLiteral("primary")] = output->isPrimary(); | ||
187 | info[QStringLiteral("enabled")] = output->isEnabled(); | 187 | info[QStringLiteral("enabled")] = output->isEnabled(); | ||
188 | 188 | | |||
189 | QVariantMap pos; | 189 | QVariantMap pos; | ||
190 | pos[QStringLiteral("x")] = output->pos().x(); | 190 | pos[QStringLiteral("x")] = output->pos().x(); | ||
191 | pos[QStringLiteral("y")] = output->pos().y(); | 191 | pos[QStringLiteral("y")] = output->pos().y(); | ||
192 | info[QStringLiteral("pos")] = pos; | 192 | info[QStringLiteral("pos")] = pos; | ||
193 | 193 | | |||
194 | if (Control::getOutputRetention(output->hash(), retentions) != Control::OutputRetention::Individual) { | 194 | if (control.getOutputRetention(output->hash(), output->name()) != Control::OutputRetention::Individual) { | ||
195 | // try to update global output data | 195 | // try to update global output data | ||
196 | Output::writeGlobal(output); | 196 | Output::writeGlobal(output); | ||
197 | } | 197 | } | ||
198 | 198 | | |||
199 | outputList.append(info); | 199 | outputList.append(info); | ||
200 | } | 200 | } | ||
201 | 201 | | |||
202 | QFile file(filePath); | 202 | QFile file(filePath); | ||
Show All 22 Lines |