Ticket #1327: spuriouscontexts.diff

File spuriouscontexts.diff, 3.6 KB (added by mfgalizi@…, 14 years ago)

Fix for incorrectly assumed contexts

  • .19/mythcontrols/mythcontrols/actionset.cpp

    diff -urN -x Makefile mythplugins-0.19/mythcontrols/mythcontrols/actionset.cpp fixmythplugins-0.19/mythcontrols/mythcontrols/actionset.cpp
    old new  
    139139/* method description in header */
    140140QStringList * ActionSet::actionStrings(const QString &context_name) const
    141141{
    142     QStringList *action_strings = new QStringList();
    143     QDictIterator<Action> it(*(_contexts[context_name]));
     142    Context *c = _contexts[context_name];
    144143
    145     for (; it.current(); ++it)
    146         action_strings->append(it.currentKey());
     144    if (c == NULL) return NULL;
     145    else
     146    {
     147        QStringList *action_strings = new QStringList();
     148        QDictIterator<Action> it(*(_contexts[context_name]));
     149
     150        for (; it.current(); ++it)
     151            action_strings->append(it.currentKey());
    147152   
    148     return action_strings;
     153        return action_strings;
     154    }
    149155}
    150156
    151157
  • .19/mythcontrols/mythcontrols/keybindings.h

    diff -urN -x Makefile mythplugins-0.19/mythcontrols/mythcontrols/keybindings.h fixmythplugins-0.19/mythcontrols/mythcontrols/keybindings.h
    old new  
    6565    /**
    6666     * @brief Get a list of the context names.
    6767     * @return A list of the context names.
     68     * @note The returned list is a copy and can be modified without
     69     * side-effects.
    6870     */
    6971    inline QStringList * getContexts() const
    7072    {
  • .19/mythcontrols/mythcontrols/mythcontrols.cpp

    diff -urN -x Makefile mythplugins-0.19/mythcontrols/mythcontrols/mythcontrols.cpp fixmythplugins-0.19/mythcontrols/mythcontrols/mythcontrols.cpp
    old new  
    4646#include "keygrabber.h"
    4747
    4848
    49 static QMap<int,QString> FindContexts(const QString &context)
    50 {
    51     QMap<int,QString> retval;
    52     retval.clear();
    53     if (context != JUMP_CONTEXT) retval[-1] = JUMP_CONTEXT;
    54     retval[0] = context;
    55     if (context != JUMP_CONTEXT && context != GLOBAL_CONTEXT)
    56     {
    57         if (context == "TV Editting")
    58             retval[1] = "TV Playback";
    59         retval[2] = GLOBAL_CONTEXT;
    60         if (context != "qt")
    61             retval[3] = "qt";
    62     }
    63     return retval;
    64 }
    6549
    6650static const QString KeyToDisplay(const QString key)
    6751{
     
    838822    refreshKeyInformation();
    839823}
    840824
    841 void MythControls::addBindings(QDict<binding_t> &bindings, const QString &context, const QString &contextParent, int bindlevel)
     825
     826
     827void MythControls::addBindings(QDict<binding_t> &bindings,
     828                               const QString &context,
     829                               const QString &contextParent, int bindlevel)
    842830{
    843831    QStringList *actions = key_bindings->getActions(context);
    844832
     
    872860
    873861BindingList *MythControls::getKeyBindings(const QString &context)
    874862{
     863    QStringList keys;
    875864    QDict<binding_t> bindings;
    876865    bindings.clear();
    877866
    878     QMap<int,QString> contextList = FindContexts(context);
    879     for (QMap<int,QString>::iterator it = contextList.begin(); it != contextList.end(); ++it)
    880     {
    881         int level = it.key();
    882         QString curcontext = it.data();
    883         addBindings(bindings, curcontext, context, level);
    884     }
     867    for (size_t i = 0; i < contexts.size(); i++)
     868        addBindings(bindings, contexts[i], context, i);
    885869
    886     QStringList keys;
    887870
    888871    for (QDictIterator<binding_t> it(bindings); it.current(); ++it)
    889872    {