43 QVBoxLayout *mainLayout =
new QVBoxLayout(
this);
45 QHBoxLayout* layoutForWindowTypeChooser =
new QHBoxLayout();
46 mainLayout->addLayout(layoutForWindowTypeChooser);
62 auto const initShortcutEditor =
65 char const *
const groupName)
76 [
this, &windowType](QString
const & actionName,
77 QKeySequence
const & keys)
85 QList<WindowType *> list;
86 list.append(&m_application);
87 list.append(&m_general);
88 if ((&windowType == &m_application)
89 || (&windowType == &m_general))
91 list.append(&m_bible);
92 list.append(&m_commentary);
93 list.append(&m_lexicon);
96 list.append(&windowType);
98 QStringList conflicts;
99 auto const conflictTr = tr(
"\"%1\" in the \"%2\" group");
100 for (
auto const *
const windowType2 : list)
102 windowType2->keyChooser->findConflictWithKeys(
105 conflicts.append(conflictTr
106 .arg(std::move(conflict))
107 .arg(windowType2->title));
109 if (!conflicts.isEmpty()) {
112 tr(
"Shortcut conflict detected"),
113 QStringLiteral(
"%1<ul><li>%2</li></ul>%3")
115 tr(
"The shortcut \"%1\" you want to "
116 "assign to \"%2\" in the \"%3\" "
117 "group conflicts with the following "
121 .arg(keys.toString())
123 .arg(windowType.
title),
124 conflicts.join(QStringLiteral(
"</li><li>")),
125 tr(
"Do you want to clear these conflicting "
126 "shortcuts and continue?")),
127 QMessageBox::Yes | QMessageBox::No,
128 QMessageBox::Yes) == QMessageBox::Yes)
131 for (
auto const *
const windowType2 : list)
132 windowType2->keyChooser->clearConflictWithKeys(
135 windowType.
keyChooser->changeShortcutInDialog(keys);
138 windowType.
keyChooser->changeShortcutInDialog(keys);
142 initShortcutEditor(m_application,
148 "Application shortcuts");
149 initShortcutEditor(m_general,
151 "Displaywindow shortcuts");
152 initShortcutEditor(m_bible,
155 initShortcutEditor(m_commentary,
157 "Commentary shortcuts");
158 initShortcutEditor(m_lexicon,
160 "Lexicon shortcuts");
161 initShortcutEditor(m_book,
165 mainLayout->addWidget(m_keyChooserStack);
166 m_keyChooserStack->setCurrentIndex(m_typeChooser->currentIndex());
168 m_typeChooser->setFocus(Qt::MouseFocusReason);
void setHeaderText(QString const &headerText)
QStackedWidget * m_keyChooserStack
QComboBox * m_typeChooser
QLabel * m_actionGroupLabel
void save() const final override
CAcceleratorSettingsPage(CConfigurationDialog *parent=nullptr)
QMessageBox::StandardButton showQuestion(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QPointer< BtShortcutsEditor > keyChooser
BtActionCollection * actionCollection