Changeset View
Changeset View
Standalone View
Standalone View
src/doctor/doctor.cpp
Show First 20 Lines • Show All 194 Lines • ▼ Show 20 Line(s) | 194 | if (ops[0] == QStringLiteral("output")) { | |||
---|---|---|---|---|---|
195 | Q_FOREACH (const auto &output, m_config->outputs()) { | 195 | Q_FOREACH (const auto &output, m_config->outputs()) { | ||
196 | if (output->name() == ops[1]) { | 196 | if (output->name() == ops[1]) { | ||
197 | output_id = output->id(); | 197 | output_id = output->id(); | ||
198 | } | 198 | } | ||
199 | } | 199 | } | ||
200 | if (output_id == -1) { | 200 | if (output_id == -1) { | ||
201 | output_id = ops[1].toInt(&ok); | 201 | output_id = ops[1].toInt(&ok); | ||
202 | if (!ok) { | 202 | if (!ok) { | ||
203 | cerr << "Unable to parse output id" << ops[1] << endl; | 203 | cerr << "Unable to parse output id: " << ops[1] << endl; | ||
204 | qApp->exit(3); | 204 | qApp->exit(3); | ||
205 | return; | 205 | return; | ||
206 | } | 206 | } | ||
207 | } | 207 | } | ||
208 | if (ops.count() == 3 && ops[2] == QStringLiteral("enable")) { | 208 | if (ops.count() == 3 && ops[2] == QStringLiteral("enable")) { | ||
209 | if (!setEnabled(output_id, true)) { | 209 | if (!setEnabled(output_id, true)) { | ||
210 | qApp->exit(1); | 210 | qApp->exit(1); | ||
211 | return; | 211 | return; | ||
Show All 17 Lines | 227 | } else if (ops.count() == 4 && ops[2] == QStringLiteral("position")) { | |||
229 | if (_pos.count() != 2) { | 229 | if (_pos.count() != 2) { | ||
230 | qCWarning(KSCREEN_DOCTOR) << "Invalid position:" << ops[3]; | 230 | qCWarning(KSCREEN_DOCTOR) << "Invalid position:" << ops[3]; | ||
231 | qApp->exit(5); | 231 | qApp->exit(5); | ||
232 | return; | 232 | return; | ||
233 | } | 233 | } | ||
234 | int x = _pos[0].toInt(&ok); | 234 | int x = _pos[0].toInt(&ok); | ||
235 | int y = _pos[1].toInt(&ok); | 235 | int y = _pos[1].toInt(&ok); | ||
236 | if (!ok) { | 236 | if (!ok) { | ||
237 | cerr << "Unable to parse position" << ops[3] << endl; | 237 | cerr << "Unable to parse position: " << ops[3] << endl; | ||
238 | qApp->exit(5); | 238 | qApp->exit(5); | ||
239 | return; | 239 | return; | ||
240 | } | 240 | } | ||
241 | 241 | | |||
242 | QPoint p(x, y); | 242 | QPoint p(x, y); | ||
243 | qCDebug(KSCREEN_DOCTOR) << "Output position" << p; | 243 | qCDebug(KSCREEN_DOCTOR) << "Output position" << p; | ||
244 | if (!setPosition(output_id, p)) { | 244 | if (!setPosition(output_id, p)) { | ||
245 | qApp->exit(1); | 245 | qApp->exit(1); | ||
Show All 29 Lines | 273 | if (rotationMap.contains(_rotation)) { | |||
275 | rot = rotationMap[_rotation]; | 275 | rot = rotationMap[_rotation]; | ||
276 | } | 276 | } | ||
277 | if (!ok || !setRotation(output_id, rot)) { | 277 | if (!ok || !setRotation(output_id, rot)) { | ||
278 | qCDebug(KSCREEN_DOCTOR) << "Could not set orientation " << _rotation << " to output " << output_id; | 278 | qCDebug(KSCREEN_DOCTOR) << "Could not set orientation " << _rotation << " to output " << output_id; | ||
279 | qApp->exit(9); | 279 | qApp->exit(9); | ||
280 | return; | 280 | return; | ||
281 | } | 281 | } | ||
282 | } else { | 282 | } else { | ||
283 | cerr << "Unable to parse arguments" << op << endl; | 283 | cerr << "Unable to parse arguments: " << op << endl; | ||
284 | qApp->exit(2); | 284 | qApp->exit(2); | ||
285 | return; | 285 | return; | ||
286 | } | 286 | } | ||
287 | } | 287 | } | ||
288 | } | 288 | } | ||
289 | } | 289 | } | ||
290 | } | 290 | } | ||
291 | 291 | | |||
▲ Show 20 Lines • Show All 203 Lines • Show Last 20 Lines |