Only enable the 'Always' hotkey context when medusa mode is on

Originally committed to SVN as r5505.
This commit is contained in:
Thomas Goyne 2011-07-26 19:52:25 +00:00
parent 7deebf759b
commit ffe8c7a5d6
3 changed files with 5 additions and 4 deletions

View file

@ -127,14 +127,14 @@ void Hotkey::BuildHotkey(std::string const& context, const json::Object& object)
} // for index
}
bool Hotkey::Scan(const std::string &context, const std::string &str, std::string &cmd) const {
bool Hotkey::Scan(const std::string &context, const std::string &str, bool always, std::string &cmd) const {
std::string local, dfault;
HotkeyMap::const_iterator index, end;
for (std::tr1::tie(index, end) = str_map.equal_range(str); index != end; ++index) {
std::string const& ctext = index->second.Context();
if (ctext == "Always") {
if (always && ctext == "Always") {
cmd = index->second.CmdName();
LOG_D("agi/hotkey/found") << "Found: " << str << " Context (req/found): " << context << "/Always Command: " << cmd;
return 0;

View file

@ -97,8 +97,9 @@ public:
/// Scan for a matching key.
/// @param context Context requested.
/// @param str Hyphen separated key sequence.
/// @param always Enable the "Always" override context
/// @param[out] cmd Command found.
bool Scan(const std::string &context, const std::string &str, std::string &cmd) const;
bool Scan(const std::string &context, const std::string &str, bool always, std::string &cmd) const;
/// Get the string representation of the hotkeys for the given command
/// @param context Context requested

View file

@ -69,7 +69,7 @@ bool check(std::string const& context, int key_code, wchar_t key_char, int modif
if (combo.empty()) return false;
std::string command;
if (agi::hotkey::hotkey->Scan(context, combo, command) == 0) {
if (agi::hotkey::hotkey->Scan(context, combo, OPT_GET("Audio/Medusa Timing Hotkeys")->GetBool(), command) == 0) {
/// The bottom line should be removed after all the hotkey commands are fixed.
/// This is to avoid pointless exceptions.
if (command.find("/") != std::string::npos) {