| 320 | } |
| 321 | |
| 322 | void updateButtons(UILocker::Reasons reason) |
| 323 | { |
| 324 | MOBase::deleteChildWidgets(m_buttons); |
| 325 | auto* ly = m_buttons->layout(); |
| 326 | |
| 327 | switch (reason) { |
| 328 | case UILocker::LockUI: // fall-through |
| 329 | case UILocker::OutputRequired: { |
| 330 | auto* unlock = new QPushButton(QObject::tr("Unlock")); |
| 331 | |
| 332 | QObject::connect(unlock, &QPushButton::clicked, [&] { |
| 333 | UILocker::instance().onForceUnlock(); |
| 334 | }); |
| 335 | |
| 336 | ly->addWidget(unlock); |
| 337 | |
| 338 | break; |
| 339 | } |
| 340 | |
| 341 | case UILocker::PreventExit: { |
| 342 | auto* exit = new QPushButton(QObject::tr("Exit Now")); |
| 343 | QObject::connect(exit, &QPushButton::clicked, [&] { |
| 344 | UILocker::instance().onForceUnlock(); |
| 345 | }); |
| 346 | |
| 347 | ly->addWidget(exit); |
| 348 | |
| 349 | auto* cancel = new QPushButton(QObject::tr("Cancel")); |
| 350 | QObject::connect(cancel, &QPushButton::clicked, [&] { |
| 351 | UILocker::instance().onCancel(); |
| 352 | }); |
| 353 | |
| 354 | ly->addWidget(cancel); |
| 355 | |
| 356 | break; |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | }; |
| 361 | |
| 362 | UILocker::Session::~Session() |
nothing calls this directly
no test coverage detected