MCPcopy Create free account
hub / github.com/ckaiser/Lightscreen / showHotkeyError

Method showHotkeyError

lightscreenwindow.cpp:573–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573void LightscreenWindow::showHotkeyError(const QStringList &hotkeys)
574{
575 static bool dontShow = false;
576
577 if (dontShow) {
578 return;
579 }
580
581 QString messageText;
582
583 messageText = tr("Some hotkeys could not be registered, they might already be in use");
584
585 if (hotkeys.count() > 1) {
586 messageText += tr("<br>The failed hotkeys are the following:") + "<ul>";
587
588 for (auto hotkey : hotkeys) {
589 messageText += QString("%1%2%3").arg("<li><b>").arg(hotkey).arg("</b></li>");
590 }
591
592 messageText += "</ul>";
593 } else {
594 messageText += tr("<br>The failed hotkey is <b>%1</b>").arg(hotkeys[0]);
595 }
596
597 messageText += tr("<br><i>What do you want to do?</i>");
598
599 QMessageBox msgBox(this);
600 msgBox.setWindowTitle(tr("Lightscreen"));
601 msgBox.setText(messageText);
602
603 QPushButton *changeButton = msgBox.addButton(tr("Change") , QMessageBox::ActionRole);
604 QPushButton *disableButton = msgBox.addButton(tr("Disable"), QMessageBox::ActionRole);
605 QPushButton *exitButton = msgBox.addButton(tr("Quit") , QMessageBox::ActionRole);
606
607 msgBox.exec();
608
609 if (msgBox.clickedButton() == exitButton) {
610 dontShow = true;
611 QTimer::singleShot(10, this, &LightscreenWindow::quit);
612 } else if (msgBox.clickedButton() == changeButton) {
613 showOptions();
614 } else if (msgBox.clickedButton() == disableButton) {
615 for (auto hotkey : hotkeys) {
616 settings()->setValue(QString("actions/%1/enabled").arg(hotkey), false);
617 }
618 }
619}
620
621void LightscreenWindow::showHistoryDialog()
622{

Callers

nothing calls this directly

Calls 2

QStringClass · 0.85
countMethod · 0.80

Tested by

no test coverage detected