KeyBindingsPage::KeyBindingsPage(FBReader &fbreader, ZLDialogContent &dialogTab) { if (ZLBooleanOption(ZLCategoryKey::EMPTY, ZLOption::PLATFORM_GROUP, ZLOption::FULL_KEYBOARD_CONTROL, false).value()) { dialogTab.addOption(ZLResourceKey("grabSystemKeys"), new KeyboardControlEntry(fbreader)); } ZLResourceKey actionKey("action"); MultiKeyOptionEntry *keyEntry = new MultiKeyOptionEntry(dialogTab.resource(actionKey), fbreader); OrientationEntry *orientationEntry = new OrientationEntry(*keyEntry); ZLBooleanOptionEntry *useSeparateBindingsEntry = new UseSeparateOptionsEntry(fbreader, *keyEntry, *orientationEntry); dialogTab.addOption(ZLResourceKey("separate"), useSeparateBindingsEntry); dialogTab.addOption(ZLResourceKey("orientation"), orientationEntry); dialogTab.addOption("", "", keyEntry); ZLOptionEntry *exitOnCancelEntry = new ZLSimpleBooleanOptionEntry(fbreader.QuitOnCancelOption); keyEntry->setExitOnCancelEntry(exitOnCancelEntry); dialogTab.addOption(ZLResourceKey("quitOnCancel"), exitOnCancelEntry); exitOnCancelEntry->setVisible(false); useSeparateBindingsEntry->onStateChanged(useSeparateBindingsEntry->initialState()); dialogTab.addOption(ZLResourceKey("keyDelay"), new ZLSimpleSpinOptionEntry(fbreader.KeyDelayOption, 50)); }
void MultiKeyOptionEntry::onKeySelected(const std::string &key) { if (myExitOnCancelEntry != 0) { myExitOnCancelEntry->setVisible(myBimap.codeByIndex(myCurrentEntry->actionIndex(key)) == ActionCode::CANCEL); } }
void MultiKeyOptionEntry::onValueChanged(const std::string &key, int index) { myCurrentEntry->onValueChanged(key, index); if (myExitOnCancelEntry != 0) { myExitOnCancelEntry->setVisible(myBimap.codeByIndex(index) == ActionCode::CANCEL); } }