diff --git a/src/lay/lay/CustomizeMenuConfigPage.ui b/src/lay/lay/CustomizeMenuConfigPage.ui index 67995fb53..78ee4529d 100644 --- a/src/lay/lay/CustomizeMenuConfigPage.ui +++ b/src/lay/lay/CustomizeMenuConfigPage.ui @@ -82,26 +82,13 @@ - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - Examples: + Delete text for +"no key bound". + +Key examples: - "Ctrl+A" - "Shift+F2" - "M" diff --git a/src/lay/lay/layMainConfigPages.cc b/src/lay/lay/layMainConfigPages.cc index 25e2bbd4a..67a85bacd 100644 --- a/src/lay/lay/layMainConfigPages.cc +++ b/src/lay/lay/layMainConfigPages.cc @@ -326,76 +326,6 @@ MainConfigPage5::commit (lay::PluginRoot *root) // ------------------------------------------------------------ // The "key bindings" config page -std::vector > -unpack_key_binding (const std::string &packed) -{ - tl::Extractor ex (packed.c_str ()); - - std::vector > key_bindings; - - while (! ex.at_end ()) { - ex.test(";"); - key_bindings.push_back (std::make_pair (std::string (), std::string ())); - ex.read_word_or_quoted (key_bindings.back ().first); - ex.test(":"); - ex.read_word_or_quoted (key_bindings.back ().second); - } - - return key_bindings; -} - -std::string -pack_key_binding (const std::vector > &unpacked) -{ - std::string packed; - - for (std::vector >::const_iterator p = unpacked.begin (); p != unpacked.end (); ++p) { - if (! packed.empty ()) { - packed += ";"; - } - packed += tl::to_word_or_quoted_string (p->first); - packed += ":"; - packed += tl::to_word_or_quoted_string (p->second); - } - - return packed; -} - -std::vector > -unpack_menu_items_hidden (const std::string &packed) -{ - tl::Extractor ex (packed.c_str ()); - - std::vector > hidden; - - while (! ex.at_end ()) { - ex.test(";"); - hidden.push_back (std::make_pair (std::string (), false)); - ex.read_word_or_quoted (hidden.back ().first); - ex.test(":"); - ex.read (hidden.back ().second); - } - - return hidden; -} - -std::string -pack_menu_items_hidden (const std::vector > &unpacked) -{ - std::string packed; - - for (std::vector >::const_iterator p = unpacked.begin (); p != unpacked.end (); ++p) { - if (! packed.empty ()) { - packed += ";"; - } - packed += tl::to_word_or_quoted_string (p->first); - packed += ":"; - packed += tl::to_string (p->second); - } - - return packed; -} - CustomizeMenuConfigPage::CustomizeMenuConfigPage (QWidget *parent) : lay::ConfigPage (parent), m_enable_event (true) { @@ -407,6 +337,7 @@ CustomizeMenuConfigPage::CustomizeMenuConfigPage (QWidget *parent) mp_ui->binding_le->setEnabled (false); mp_ui->binding_le->set_clear_button_enabled (true); + connect (mp_ui->binding_le, SIGNAL (clear_pressed ()), this, SLOT (text_cleared ())); connect (mp_ui->binding_le, SIGNAL (textChanged (QString)), this, SLOT (text_changed ())); mp_ui->filter->set_clear_button_enabled (true); @@ -433,7 +364,7 @@ static void get_shortcuts (const lay::AbstractMenu &menu, const std::string &roo } get_shortcuts (menu, *i, bindings, with_defaults); } else if (! menu.is_separator (*i)) { - bindings.insert (std::make_pair (*i, with_defaults ? menu.action (*i).get_default_shortcut () : menu.action (*i).get_shortcut ())); + bindings.insert (std::make_pair (*i, with_defaults ? menu.action (*i).get_default_shortcut () : menu.action (*i).get_effective_shortcut ())); } } } @@ -483,7 +414,8 @@ CustomizeMenuConfigPage::apply (const std::vector::iterator kb = m_current_bindings.begin (); kb != m_current_bindings.end (); ++kb) { std::map::iterator bb = b.find (kb->first); if (bb != b.end ()) { - kb->second = bb->second; + lay::Action a = lay::MainWindow::instance ()->menu ()->action (kb->first); + kb->second = a.get_effective_shortcut_for (bb->second); } else { kb->second.clear (); } @@ -517,13 +449,9 @@ CustomizeMenuConfigPage::apply (const std::vector