Ticket #2078: standard_formatting.diff

File standard_formatting.diff, 102.6 KB (added by mfgalizia, 15 years ago)

Fixes mythcontrols to use MythTV coding standards

  • mythcontrols/actionset.h

     
    5555    /**
    5656     * @brief Create a new, empty set of action bindings.
    5757     */
    58     inline ActionSet() {};
     58    inline ActionSet()
     59    {
     60    }
    5961
    6062    /**
    6163     * @brief Add an action.
     
    6769     * If the action has already been added, it will not be added
    6870     * again.  There are no duplicate actions in the action set.
    6971     */
    70     bool addAction(const ActionID &id, const QString & description,
     72    bool AddAction(const ActionID &id, const QString & description,
    7173                   const QString &keys);
    7274
    7375    /**
     
    7678     * @param key The symbolic name of the key.
    7779     * @return true if the key was added otherwise, false.
    7880     */
    79     bool add(const ActionID &id, const QString &key);
     81    bool Add(const ActionID &id, const QString &key);
    8082
    8183    /**
    8284     * @brief Remove a key from an action identifier.
    8385     * @param id The action identifier to remove from.
    8486     * @param key The key to remove.
    8587     */
    86     bool remove(const ActionID &id, const QString &key);
     88    bool Remove(const ActionID &id, const QString &key);
    8789
    8890    /**
    8991     * @brief Replace a specific key in a specific action.
     
    9193     * @param newkey The new key.
    9294     * @param oldkey The key to be replaced.
    9395     */
    94     bool replace(const ActionID &id, const QString &newkey,
     96    bool Replace(const ActionID &id, const QString &newkey,
    9597                 const QString &oldkey);
    9698
    9799    /**
    98100     * @brief Get a list of all contexts in the action set.
    99101     * @return A list of all contexts.
    100102     */
    101     QStringList * contextStrings(void) const;
     103    QStringList * ContextStrings(void) const;
    102104
    103105    /**
    104106     * @brief Get a list of all action in the action set.
    105107     * @return A list of all actions in the action set.
    106108     */
    107     QStringList * actionStrings(const QString & context_name) const;
     109    QStringList * ActionStrings(const QString & context_name) const;
    108110
    109111    /**
    110112     * @brief Get a string containing all the keys in bound to an
     
    112114     * @param id The action's identifier.
    113115     * @return null if there is no such action, otherwise, the keys.
    114116     */
    115     QString keyString(const ActionID &id) const;
     117    QString KeyString(const ActionID &id) const;
    116118
    117119    /**
    118120     * @brief Get the keys bound to an action by it's identifier.
    119121     * @param id The action identifier.
    120122     * @return The keys used by the action.
    121123     */
    122     QStringList getKeys(const ActionID &id) const;
     124    QStringList GetKeys(const ActionID &id) const;
    123125
    124126    /**
    125127     * @brief Get the description of an action.
    126128     * @param id The action identifier.
    127129     * @return The action description.
    128130     */
    129     const QString & getDescription(const ActionID &id) const;
     131    const QString & GetDescription(const ActionID &id) const;
    130132
    131133    /**
    132134     * @brief Get the actions bound to the specified key.
    133135     * @param key The key.
    134136     * @return The list of actions, which are bound to the key.
    135137     */
    136     const ActionList & getActions(const QString &key) const;
     138    const ActionList & GetActions(const QString &key) const;
    137139
    138140    /**
    139141     * @brief Get the appropriate container of modified actions based on
    140142     * context.
    141143     * @return The appropriate container of modified actions.
    142144     */
    143     inline const ActionList & getModified(void) const { return _modified; }
     145    inline const ActionList & GetModified(void) const
     146    {
     147        return m_Modified;
     148    }
    144149
    145150    /**
    146151     * @brief Determine if the action set has been modified.
    147152     * @return True if changes have been made, otherwise, false.
    148153     */
    149     inline bool hasModified(void) const { return !(_modified.isEmpty()); }
     154    inline bool HasModified(void) const
     155    {
     156        return !(m_Modified.isEmpty());
     157    }
    150158
    151159    /**
    152160     * @brief Mark an action as unmodified.
    153161     * @return true if the action was modified, and is set to unmodified.
    154162     */
    155     inline bool unmodify(const ActionID & id)
     163    inline bool Unmodify(const ActionID & id)
    156164    {
    157         return (_modified.remove(id) > 0);
     165        return (m_Modified.remove(id) > 0);
    158166    }
    159167
    160168    /**
     
    162170     * @param id The action identifier.
    163171     * @return true if the action is modified, otherwise, false.
    164172     */
    165     inline bool isModified(const ActionID &id)const { return !unmodified(id); }
     173    inline bool IsModified(const ActionID &id)const { return !Unmodified(id); }
    166174
    167175    /**
    168176     * @brief Determine if an action is still unmodified.
    169177     * @param id The action identifier.
    170178     * @return true if the action has not been modified, otherwise, false.
    171179     */
    172     inline bool unmodified(const ActionID &id) const
     180    inline bool Unmodified(const ActionID &id) const
    173181    {
    174         return (getModified().contains(id) == 0);
     182        return (GetModified().contains(id) == 0);
    175183    }
    176184
    177185protected:
     
    180188     * @brief Mark an action as modified.
    181189     * @param id The actio identifier.
    182190     */
    183     inline void modify(const ActionID &id)
     191    inline void Modify(const ActionID &id)
    184192    {
    185         if (unmodified(id)) _modified.push_back(id);
     193        if (Unmodified(id))
     194            m_Modified.push_back(id);
    186195    }
    187196
    188197    /**
    189198     * @brief Get an action by its identifier.
    190199     * @return A pointer to the action.
    191200     */
    192     inline Action * action(const ActionID &id) const
     201    inline Action * GetAction(const ActionID &id) const
    193202    {
    194         return context(id.context()) ?
    195             (*context(id.context()))[id.action()] : NULL;
     203        return GetContext(id.Context()) ?
     204            (*GetContext(id.Context()))[id.Action()] : NULL;
    196205    }
    197206
    198207    /**
    199208     * @brief Get a context by its identifier.
    200209     * @return A pointer to the context.
    201210     */
    202     inline Context * context(const QString & name) const
     211    inline Context * GetContext(const QString & name) const
    203212    {
    204         return this->_contexts[name];
     213        return this->m_Contexts[name];
    205214    }
    206215
    207216private:
    208217
    209     QMap<QString, ActionList> _keymap;
    210     QDict<Context> _contexts;
    211     ActionList _modified;
     218    QMap<QString, ActionList> m_KeyMap;
     219    QDict<Context> m_Contexts;
     220    ActionList m_Modified;
    212221};
    213222
    214223#endif /* ACTIONSET_H */
  • mythcontrols/actionid.h

     
    4141    /**
    4242     * @brief Create an empty action
    4343     */
    44     inline ActionID() {}
     44    inline ActionID()
     45    {
     46    }
    4547
    4648    /**
    4749     * @brief Create a new action identifier.
     
    4951     * @param action The action's name
    5052     */
    5153    inline ActionID(const QString & context, const QString & action)
    52         : _context(context), _action(action) {};
     54        : m_Context(context), m_Action(action)
     55    {
     56    }
    5357
    5458    /**
    5559     * @brief Get the context name.
    5660     * @return The context name.
    5761     */
    58     inline QString context(void) const { return this->_context; }
     62    inline QString Context(void) const
     63    {
     64        return m_Context;
     65    }
    5966
    6067    /**
    6168     * @brief Get the action name
    6269     * @return The action name.
    6370     */
    64     inline QString action(void) const { return this->_action; }
     71    inline QString Action(void) const
     72    {
     73        return m_Action;
     74    }
    6575
    6676    /**
    6777     * @brief Determine if two actions identifiers have the same
    6878     * context.
    6979     * @return True if the actions have a common context.
    7080     */
    71     inline static bool sameContext(const ActionID &a, const ActionID &b)
     81    inline static bool SameContext(const ActionID &a, const ActionID &b)
    7282    {
    73         return (a.context() == b.context());
     83        return (a.Context() == b.Context());
    7484    }
    7585
    7686    /**
    7787     * @brief Determine if two actions have the same action name.
    7888     * @return True if the actions have the same action name.
    7989     */
    80     inline static bool sameAction(const ActionID &a, const ActionID &b)
     90    inline static bool SameAction(const ActionID &a, const ActionID &b)
    8191    {
    82         return (a.action() == b.action());
     92        return (a.Action() == b.Action());
    8393    }
    8494
    8595    /**
     
    8999     */
    90100    inline bool operator == (const ActionID &that) const
    91101    {
    92         return (sameAction(*this,that) && sameContext(*this,that));
     102        return (SameAction(*this,that) && SameContext(*this,that));
    93103    }
    94104
    95105private:
    96     QString _context;
    97     QString _action;
     106    QString m_Context;
     107    QString m_Action;
    98108};
    99109
    100110
  • mythcontrols/action.h

     
    4141public:
    4242
    4343    /**
    44      * @brief Create a new empty action.
     44     * Create a new empty action.
     45     *
    4546     * @param description The actions description.
    4647     */
    47     inline Action(const QString & description) : _description(description) {}
     48    inline Action(const QString & description) : m_Description(description)
     49    {
     50    }
    4851
    4952    /**
    50      * @brief Create a new action.
     53     * Create a new action.
     54     *
    5155     * @param description The description of the action.
    5256     * @param keys The key sequence (strings) that trigger the action.
    5357     *
     
    5862    Action(const QString & description, const QString & keys);
    5963
    6064    /**
    61      * @brief Get the action description.
     65     * Get the action description.
     66     *
    6267     * @return The action description.
    6368     */
    64     inline const QString & getDescription() const { return this->_description; }
     69    inline const QString & GetDescription() const
     70    {
     71        return this->m_Description;
     72    }
    6573
    6674    /**
    67      * @brief Get the key sequence(s) that trigger this action.
     75     * Get the key sequence(s) that trigger this action.
     76     *
    6877     * @return The key sequence(s) that trigger this action.
    6978     */
    70     inline const QStringList & getKeys() const { return this->_keys; }
     79    inline const QStringList & GetKeys() const
     80    {
     81        return this->m_Keys;
     82    }
    7183
    7284    /**
    73      * @brief Get the keys as a string.
     85     * Get the keys as a string.
     86     *
    7487     * @return QString::null or a comma delimited string of keys.
    7588     */
    76     inline QString keyString() const { return _keys.join(","); }
     89    inline QString KeyString() const
     90    {
     91        return m_Keys.join(",");
     92    }
    7793
    7894    /**
    79      * @brief Add a key sequence to this action.
     95     * Add a key sequence to this action.
     96     *
    8097     * @param key The key to add to the action.
    8198     * @return true if the key was added otherwise, false.
    8299     */
    83     bool addKey(const QString & key);
     100    bool AddKey(const QString & key);
    84101
    85102    /**
    86      * @brief Remove a key from this action.
     103     * Remove a key from this action.
     104     *
    87105     * @param key The key to remove.
    88106     * @return true if the key is removed, otherwise, false.
    89107     */
    90     inline bool removeKey(const QString & key) { return (keys().remove(key)>0); }
     108    inline bool RemoveKey(const QString & key)
     109    {
     110        return (m_Keys.remove(key)>0);
     111    }
    91112
    92113    /**
    93      * @brief Replace a key.
     114     * Replace a key.
     115     *
    94116     * @param newkey The new key.
    95117     * @param oldkey The old key, which is being replaced.
    96118     */
    97     bool replaceKey(const QString & newkey, const QString & oldkey);
     119    bool ReplaceKey(const QString & newkey, const QString & oldkey);
    98120
    99121    /**
    100      * @brief Determine if the action already has a key.
     122     * Determine if the action already has a key.
     123     *
    101124     * @param key The key to check for.
    102125     * @return true if the key is already bound in this action,
    103126     * otherwise, false is returned.
    104127     */
    105     bool hasKey(const QString & key) const;
     128    bool HasKey(const QString & key) const;
    106129
    107130    /**
    108      * @brief Get the index of a key.
    109      * @param key The string containing the key.
    110      * @return The index of the key, which will be less than zero if the
    111      * key does not exist.
    112      */
    113 
    114     /**
    115      * @brief Determine if the action has any keys at all.
     131     * Determine if the action has any keys at all.
     132     *
    116133     * @return true if the action has keys, otherwise, false.
    117134     */
    118     inline bool empty(void) const { return (_keys.size() > 0); }
     135    inline bool IsEmpty(void) const
     136    {
     137        return (m_Keys.size() > 0);
     138    }
    119139
    120     /** @brief The maximum number of keys that can be bound to an action. */
     140    /** The maximum number of keys that can be bound to an action. */
    121141    static const unsigned short MAX_KEYS = 4;
    122142
    123 protected:
     143private:
    124144
    125     /**
    126      * @brief Get a reference to the action description.
    127      * @return A reference to the action description.
    128      */
    129     inline QString & description() { return this->_description; }
     145    /** The actions description. */
     146    QString m_Description;
    130147
    131     /**
    132      * @brief Get a reference to actions the key sequences.
    133      * @return A reference to actions the key sequences.
    134      */
    135     inline QStringList & keys() { return this->_keys; }
    136 
    137 private:
    138 
    139     QString _description;
    140     QStringList _keys;
     148    /** The keys bound to the action. */
     149    QStringList m_Keys;
    141150};
    142151
    143152#endif /* ACTION_H */
  • mythcontrols/keygrabber.h

     
    4848    /**
    4949     * @brief Get the string containing the captured key event.
    5050     */
    51     inline QString getCapturedKey() { return this->captured_key_event; }
     51    inline QString GetCapturedKey()
     52    {
     53        return this->m_CapturedKeyEvent;
     54    }
    5255
    5356public slots:
    5457
     
    5861     * The QString provided in the constructor will be set to the
    5962     * captured key value.
    6063     */
    61     inline void acceptBinding(void) { done(1); }
     64    inline void AcceptBinding(void)
     65    {
     66        done(1);
     67    }
    6268
    6369    /**
    6470     * @brief Reject the captured key binding.
    6571     *
    6672     * The QString provided in the constructor will be set to NULL.
    6773     */
    68     inline void cancel(void) { done(0); }
     74    inline void Cancel(void)
     75    {
     76        done(0);
     77    }
    6978
    7079protected:
    7180
     
    8392
    8493private:
    8594
    86     bool is_capturing;
    87     bool has_captured;
    88     QString captured_key_event;
    89     QButton *ok_button;
    90     QButton *cancel_button;
    91     QLabel *key_label;
     95    bool m_IsCapturing;
     96    bool m_HasCaptured;
     97    QString m_CapturedKeyEvent;
     98    QButton *m_OkButton;
     99    QButton *m_CancelButton;
     100    QLabel *m_KeyLabel;
    92101};
    93102
    94103
     
    120129    /**
    121130     * @brief Execute the error popup
    122131     */
    123     inline int getOption(void) { return ExecPopup(this,SLOT(finish())); }
     132    inline int GetOption(void)
     133    {
     134        return ExecPopup(this, SLOT(Finish()));
     135    }
    124136
    125137protected slots:
    126138    /**
    127139     * @brief Close the popup.
    128140     */
    129     inline void finish(void) { done(0); }
     141    inline void Finish(void)
     142    {
     143        done(0);
     144    }
    130145};
    131146
    132147
     
    151166    /**
    152167     * @brief Execute the option popup.
    153168     */
    154     inline int getOption(void) { return ExecPopup(this,SLOT(cancel())); }
     169    inline int GetOption(void)
     170    {
     171        return ExecPopup(this,SLOT(Cancel()));
     172    }
    155173
    156174public slots:
    157175
    158176    /**
    159177     * @brief Slot to connect to when the save button is pressed.
    160178     */
    161     inline void save(void) { done(OptionsMenu::SAVE); }
     179    inline void Save(void)
     180    {
     181        done(OptionsMenu::SAVE);
     182    }
    162183
    163184    /**
    164185     * @brief Slot to connect to when the cancel button is pressed.
    165186     */
    166     inline void cancel(void) { done(OptionsMenu::CANCEL); }
    167 
     187    inline void Cancel(void)
     188    {
     189        done(OptionsMenu::CANCEL);
     190    }
    168191};
    169192
    170193
     
    180203
    181204public:
    182205
    183     enum actions { SET, REMOVE, CANCEL };
     206    enum actions {
     207        SET,
     208        REMOVE,
     209        CANCEL
     210    };
    184211
    185212    /**
    186213     * @brief Create a new action window.
     
    190217    /**
    191218     * @brief Execute the option popup.
    192219     */
    193     inline int getOption(void) { return ExecPopup(this,SLOT(cancel())); }
     220    inline int GetOption(void)
     221    {
     222        return ExecPopup(this, SLOT(Cancel()));
     223    }
    194224
    195225public slots:
    196226
    197227    /**
    198228     * @brief Slot to connect to when the set button is pressed.
    199229     */
    200     inline void set(void) { done(ActionMenu::SET); }
     230    inline void Set(void)
     231    {
     232        done(ActionMenu::SET);
     233    }
    201234
    202235    /**
    203236     * @brief Slot to connect to when the remove button is pressed.
    204237     */
    205     inline void remove(void) { done(ActionMenu::REMOVE); }
     238    inline void Remove(void)
     239    {
     240        done(ActionMenu::REMOVE);
     241    }
    206242
    207243    /**
    208244     * @brief Slot to connect to when the cancel button is pressed.
    209245     */
    210     inline void cancel(void) { done(ActionMenu::CANCEL); }
     246    inline void Cancel(void)
     247    {
     248        done(ActionMenu::CANCEL);
     249    }
    211250
    212251};
    213252
     
    222261
    223262public:
    224263
    225     enum actions { SAVE, EXIT };
     264    enum actions
     265    {
     266        SAVE,
     267        EXIT
     268    };
    226269
    227270    /**
    228271     * @brief Create a new action window.
     
    232275    /**
    233276     * @brief Execute the option popup.
    234277     */
    235     inline int getOption(void) { return ExecPopup(this,SLOT(cancel())); }
     278    inline int GetOption(void)
     279    {
     280        return ExecPopup(this, SLOT(Cancel()));
     281    }
    236282
    237283public slots:
    238284
    239285    /**
    240286     * @brief Slot to connect to when the save button is pressed.
    241287     */
    242     inline void save(void) { done(UnsavedMenu::SAVE); }
     288    inline void Save(void)
     289    {
     290        done(UnsavedMenu::SAVE);
     291    }
    243292
    244293    /**
    245294     * @brief Slot to connect to when the cancel button is pressed.
    246295     */
    247     inline void cancel(void) { done(UnsavedMenu::EXIT); }
    248 
     296    inline void Cancel(void)
     297    {
     298        done(UnsavedMenu::EXIT);
     299    }
    249300};
    250301
    251302/**
     
    259310
    260311public:
    261312
    262     enum actions { CONFIRM, CANCEL };
     313    enum actions
     314    {
     315        CONFIRM,
     316        CANCEL
     317    };
    263318
    264319    /**
    265320     * @brief Create a new action window.
     
    269324    /**
    270325     * @brief Execute the option popup.
    271326     */
    272     inline int getOption(void) { return ExecPopup(this,SLOT(cancel())); }
     327    inline int GetOption(void)
     328    {
     329        return ExecPopup(this,SLOT(Cancel()));
     330    }
    273331
    274332public slots:
    275333
    276334    /**
    277335     * @brief Slot to connect to when the save button is pressed.
    278336     */
    279     inline void confirm(void) { done(UnsavedMenu::SAVE); }
     337    inline void Confirm(void)
     338    {
     339        done(UnsavedMenu::SAVE);
     340    }
    280341
    281342    /**
    282343     * @brief Slot to connect to when the cancel button is pressed.
    283344     */
    284     inline void cancel(void) { done(UnsavedMenu::EXIT); }
     345    inline void Cancel(void)
     346    {
     347        done(UnsavedMenu::EXIT);
     348    }
    285349
    286350};
  • mythcontrols/main.cpp

     
    3838extern "C" int mythplugin_init(const char *libversion)
    3939{
    4040    if (!gContext->TestPopupVersion("mythcontrols", libversion,
    41                                     MYTH_BINARY_VERSION)) return -1;
    42     else return 0;
     41                                    MYTH_BINARY_VERSION))
     42        return -1;
     43    else
     44        return 0;
    4345}
    4446
    4547
     
    6870        MythPopupBox::showOkPopup(window, "Theme Error", "Could not load the "
    6971                                  "keybinding plugin's theme.  Check the "
    7072                                  "console for detailed output.");
    71 
    7273        return -1;
    7374    }
    7475}
     
    7980 * @brief Configures the plugin.
    8081 * @return zero.
    8182 */
    82 extern "C" int mythplugin_config (void) { return 0; }
     83extern "C" int mythplugin_config (void)
     84{
     85    return 0;
     86}
    8387
    8488
    8589
  • mythcontrols/mythcontrols.cpp

     
    6767    :MythThemedDialog(parent, "controls", "controls-", "controls")
    6868{
    6969    /* Nullify keybindings so the deconstructor knows not to delete it */
    70     this->key_bindings = NULL;
     70    this->m_KeyBindings = NULL;
    7171
    7272    /* delete the contents when we're done */
    73     m_contexts.setAutoDelete(true);
     73    m_Contexts.setAutoDelete(true);
    7474   
    7575    /* load up the ui components */
    76     if ((ui_ok = loadUI()))
     76    if ((ui_ok = LoadUI()))
    7777    {
    78         leftType = kContextList;
    79         rightType = kActionList;
     78        m_LeftType = kContextList;
     79        m_RightType = kActionList;
    8080
    8181        /* for starters, load this host */
    82         loadHost(gContext->GetHostName());
     82        LoadHost(gContext->GetHostName());
    8383
    8484        /* update the information */
    85         refreshKeyInformation();
     85        RefreshKeyInformation();
    8686
    8787        /* capture the signals we want */
    88         connect(LeftList, SIGNAL(itemSelected(UIListBtnTypeItem*)),
    89                 this, SLOT(leftSelected(UIListBtnTypeItem*)));
    90         connect(RightList, SIGNAL(itemSelected(UIListBtnTypeItem*)),
    91                 this, SLOT(rightSelected(UIListBtnTypeItem*)));
     88        connect(m_LeftList, SIGNAL(itemSelected(UIListBtnTypeItem*)),
     89                this, SLOT(LeftSelected(UIListBtnTypeItem*)));
     90        connect(m_RightList, SIGNAL(itemSelected(UIListBtnTypeItem*)),
     91                this, SLOT(RightSelected(UIListBtnTypeItem*)));
    9292
    9393    }
    9494}
     
    9696
    9797
    9898/* comments in header */
    99 MythControls::~MythControls() { delete this->key_bindings; }
     99MythControls::~MythControls()
     100{
     101    delete this->m_KeyBindings;
     102}
    100103
    101104
    102105
    103106/* comments in header */
    104 bool MythControls::loadUI()
     107bool MythControls::LoadUI()
    105108{
    106109    /* the return value of the method */
    107110    bool retval = true;
    108111
    109112    /* Get the UI widgets that we need to work with */
    110     if ((description = getUITextType("description")) == NULL)
     113    if ((m_Description = getUITextType("description")) == NULL)
    111114    {
    112115        VERBOSE(VB_IMPORTANT, "MythControls: Unable to load action_description");
    113116        retval = false;
    114117    }
    115118
    116     if ((container = getContainer("controls")) == NULL) {
     119    if ((m_Container = getContainer("controls")) == NULL)
     120    {
    117121        VERBOSE(VB_IMPORTANT, "MythControls:  No controls container in theme");
    118122        retval = false;
    119123    }
    120     else if ((LeftList = getUIListBtnType("leftlist")) == NULL) {
     124    else if ((m_LeftList = getUIListBtnType("leftlist")) == NULL)
     125    {
    121126        VERBOSE(VB_IMPORTANT, "MythControls:  No leftlist in theme");
    122127        retval = false;
    123128    }
    124     else if ((RightList = getUIListBtnType("rightlist")) == NULL) {
     129    else if ((m_RightList = getUIListBtnType("rightlist")) == NULL)
     130    {
    125131        VERBOSE(VB_IMPORTANT, "MythControls:  No rightList in theme");
    126132        retval = false;
    127133    }
    128     else {
    129         LeftDesc = getUITextType("leftdesc");
    130         RightDesc = getUITextType("rightdesc");
     134    else
     135    {
     136        m_LeftDesc = getUITextType("leftdesc");
     137        m_RightDesc = getUITextType("rightdesc");
    131138        /* focus the context list by default */
    132         focused = LeftList;
    133         LeftList->calculateScreenArea();
    134         LeftList->SetActive(true);
    135         RightList->calculateScreenArea();
    136         RightList->SetActive(false);
     139        m_Focused = m_LeftList;
     140        m_LeftList->calculateScreenArea();
     141        m_LeftList->SetActive(true);
     142        m_RightList->calculateScreenArea();
     143        m_RightList->SetActive(false);
    137144    }
    138145
    139146    /* Check that all the buttons are there */
    140     if ((ActionButtons[0] = getUITextButtonType("action_one")) == NULL)
     147    if ((m_ActionButtons[0] = getUITextButtonType("action_one")) == NULL)
    141148    {
    142         VERBOSE(VB_IMPORTANT, "MythControls: Unable to load first action button");
     149        VERBOSE(VB_IMPORTANT,
     150                "MythControls: Unable to load first action button");
    143151        retval = false;
    144152    }
    145     else if ((ActionButtons[1] = getUITextButtonType("action_two")) == NULL)
     153    else if ((m_ActionButtons[1] = getUITextButtonType("action_two")) == NULL)
    146154    {
    147         VERBOSE(VB_IMPORTANT, "MythControls: Unable to load second action button");
     155        VERBOSE(VB_IMPORTANT,
     156                "MythControls: Unable to load second action button");
    148157        retval = false;
    149158    }
    150     else if ((ActionButtons[2] = getUITextButtonType("action_three")) == NULL)
     159    else if ((m_ActionButtons[2] = getUITextButtonType("action_three")) == NULL)
    151160    {
    152         VERBOSE(VB_IMPORTANT, "MythControls: Unable to load thrid action button");
     161        VERBOSE(VB_IMPORTANT,
     162                "MythControls: Unable to load thrid action button");
    153163        retval = false;
    154164    }
    155     else if ((ActionButtons[3] = getUITextButtonType("action_four")) == NULL)
     165    else if ((m_ActionButtons[3] = getUITextButtonType("action_four")) == NULL)
    156166    {
    157         VERBOSE(VB_IMPORTANT, "MythControls: Unable to load fourth action button");
     167        VERBOSE(VB_IMPORTANT,
     168                "MythControls: Unable to load fourth action button");
    158169        retval = false;
    159170    }
    160171
     
    164175
    165176
    166177/* comments in header */
    167 size_t MythControls::focusedButton(void) const
     178size_t MythControls::FocusedButton(void) const
    168179{
    169180    for (size_t i = 0; i < Action::MAX_KEYS; i++)
    170         if (focused == ActionButtons[i]) return i;
     181        if (m_Focused == m_ActionButtons[i]) return i;
    171182
    172183    return Action::MAX_KEYS;
    173184}
    174185
    175186
    176 void MythControls::focusButton(int direction)
     187void MythControls::FocusButton(int direction)
    177188{
    178     if (leftType != kContextList || rightType != kActionList)
     189    if (m_LeftType != kContextList || m_RightType != kActionList)
    179190        return;
    180191    if (direction == 0)
    181192    {
    182         focused = ActionButtons[0];
    183         ActionButtons[0]->takeFocus();
    184         RightList->looseFocus();
    185         RightList->SetActive(false);
     193        m_Focused = m_ActionButtons[0];
     194        m_ActionButtons[0]->takeFocus();
     195        m_RightList->looseFocus();
     196        m_RightList->SetActive(false);
    186197    }
    187198    else
    188199    {
    189 
    190200        /* change focus by at most one in either direction */
    191         if (direction > 0) direction = 1;
    192         else direction = -1;
     201        if (direction > 0)
     202            direction = 1;
     203        else
     204            direction = -1;
    193205
    194206        /* figure out which button is focused */
    195207        int current = 0;
    196         if (focused == ActionButtons[1]) current=1;
    197         else if (focused == ActionButtons[2]) current = 2;
    198         else if (focused == ActionButtons[3]) current = 3;
     208        if (m_Focused == m_ActionButtons[1]) current=1;
     209        else if (m_Focused == m_ActionButtons[2]) current = 2;
     210        else if (m_Focused == m_ActionButtons[3]) current = 3;
    199211
    200212        /* determine the new focused button index */
    201213        int newb = current + direction;
     
    203215        /* focus an existing button */
    204216        if ((newb >= 0) && (newb < Action::MAX_KEYS))
    205217        {
    206             focused->looseFocus();
    207             focused = ActionButtons[newb];
    208             focused->takeFocus();
     218            m_Focused->looseFocus();
     219            m_Focused = m_ActionButtons[newb];
     220            m_Focused->takeFocus();
    209221        }
    210222    }
    211223}
    212224
    213225
    214226
    215 void MythControls::switchListFocus(UIListBtnType *focus, UIListBtnType *unfocus)
     227void MythControls::SwitchListFocus(UIListBtnType *focus, UIListBtnType *unfocus)
    216228{
    217229    /* unfocus a list (setactive(false)) or a button (focused->looseFocus) */
    218230    if (unfocus)
    219231        unfocus->SetActive(false);
    220232
    221     focused->looseFocus();
    222     focused = focus;
     233    m_Focused->looseFocus();
     234    m_Focused = focus;
    223235    focus->SetActive(true);
    224236    focus->takeFocus();
    225     refreshKeyInformation();
     237    RefreshKeyInformation();
    226238}
    227239
    228240void MythControls::keyPressEvent(QKeyEvent *e)
     
    239251
    240252        if (action == "MENU" || action == "INFO")
    241253        {
    242             focused->looseFocus();
     254            m_Focused->looseFocus();
    243255            OptionsMenu popup(gContext->GetMainWindow());
    244             int a = (int)popup.getOption();
    245             switch (a) {
     256            int a = (int)popup.GetOption();
     257            switch (a)
     258            {
    246259                case (int)OptionsMenu::SAVE:
    247                     save();
     260                    Save();
    248261                    break;
    249262            }
    250             focused->takeFocus();
    251 //            if (popup.getOption() == OptionsMenu::SAVE) save();
     263            m_Focused->takeFocus();
    252264        }
    253265        else if (action == "SELECT")
    254266        {
    255             if (focused == LeftList)
    256                 switchListFocus(RightList, LeftList);
    257             else if (focused == RightList)
    258                 focusButton(0);
    259             else {
    260                 QString key = getCurrentKey();
     267            if (m_Focused == m_LeftList)
     268                SwitchListFocus(m_RightList, m_LeftList);
     269            else if (m_Focused == m_RightList)
     270                FocusButton(0);
     271            else
     272            {
     273                QString key = GetCurrentKey();
    261274                if (!key.isEmpty())
    262275                {
    263276                    ActionMenu popup(gContext->GetMainWindow());
    264                     int result = popup.getOption();
    265                     if (result == ActionMenu::SET) addKeyToAction();
    266                     else if (result == ActionMenu::REMOVE) deleteKey();
    267                 } else // for blank keys, no reason to ask what to do
    268                     addKeyToAction();
     277                    int result = popup.GetOption();
     278                    if (result == ActionMenu::SET)
     279                        AddKeyToAction();
     280                    else if (result == ActionMenu::REMOVE)
     281                        DeleteKey();
     282                }
     283                else // for blank keys, no reason to ask what to do
     284                    AddKeyToAction();
    269285            }
    270286        }
    271287        else if (action == "ESCAPE")
    272288        {
    273289            escape = true;
    274             if (focused == LeftList)
     290            if (m_Focused == m_LeftList)
    275291            {
    276292                handled = false;
    277                 if (key_bindings->hasChanges())
     293                if (m_KeyBindings->HasChanges())
    278294                {
    279295                    /* prompt user to save changes */
    280296                    UnsavedMenu popup(gContext->GetMainWindow());
    281                     if (popup.getOption() == UnsavedMenu::SAVE)
    282                     {
    283                         save();
    284                     }
     297                    if (popup.GetOption() == UnsavedMenu::SAVE)
     298                        Save();
    285299                }
    286300            }
    287             else if (focused == RightList)
    288                 switchListFocus(LeftList, RightList);
     301            else if (m_Focused == m_RightList)
     302                SwitchListFocus(m_LeftList, m_RightList);
    289303            else
    290                 switchListFocus(RightList, NULL);
     304                SwitchListFocus(m_RightList, NULL);
    291305        }
    292306        else if (action == "UP")
    293307        {
    294             if (focused == LeftList)
    295                 LeftList->MoveUp();
    296             else if (focused == RightList)
    297                 RightList->MoveUp();
     308            if (m_Focused == m_LeftList)
     309                m_LeftList->MoveUp();
     310            else if (m_Focused == m_RightList)
     311                m_RightList->MoveUp();
    298312        }
    299313        else if (action == "DOWN")
    300314        {
    301             if (focused == LeftList)
    302                 LeftList->MoveDown();
    303             else if (focused == RightList)
    304                 RightList->MoveDown();
     315            if (m_Focused == m_LeftList)
     316                m_LeftList->MoveDown();
     317            else if (m_Focused == m_RightList)
     318                m_RightList->MoveDown();
    305319        }
    306320        else if (action == "LEFT")
    307321        {
    308             if (focused==RightList)
    309                 switchListFocus(LeftList, RightList);
    310             else if (focused != LeftList)
    311                 focusButton(-1);
     322            if (m_Focused==m_RightList)
     323                SwitchListFocus(m_LeftList, m_RightList);
     324            else if (m_Focused != m_LeftList)
     325                FocusButton(-1);
    312326        }
    313327        else if (action == "RIGHT")
    314328        {
    315             if (focused == LeftList)
    316                 switchListFocus(RightList, LeftList);
    317             else if (focused != RightList)
    318                 focusButton(1);
     329            if (m_Focused == m_LeftList)
     330                SwitchListFocus(m_RightList, m_LeftList);
     331            else if (m_Focused != m_RightList)
     332                FocusButton(1);
    319333        }
    320334        else if (action == "PAGEUP")
    321335        {
    322             if (focused == LeftList)
    323                 LeftList->MoveUp(UIListBtnType::MovePage);
    324             else if (focused == RightList)
    325                 RightList->MoveUp(UIListBtnType::MovePage);
     336            if (m_Focused == m_LeftList)
     337                m_LeftList->MoveUp(UIListBtnType::MovePage);
     338            else if (m_Focused == m_RightList)
     339                m_RightList->MoveUp(UIListBtnType::MovePage);
    326340        }
    327341        else if (action == "PAGEDOWN")
    328342        {
    329             if (focused == LeftList)
    330                 LeftList->MoveDown(UIListBtnType::MovePage);
    331             else if (focused == RightList)
    332                 RightList->MoveDown(UIListBtnType::MovePage);
     343            if (m_Focused == m_LeftList)
     344                m_LeftList->MoveDown(UIListBtnType::MovePage);
     345            else if (m_Focused == m_RightList)
     346                m_RightList->MoveDown(UIListBtnType::MovePage);
    333347        }
    334348        else if (action == "1")
    335349        {
    336             if (leftType != kContextList || rightType != kActionList)
     350            if (m_LeftType != kContextList || m_RightType != kActionList)
    337351            {
    338                 leftType = kContextList;
    339                 rightType = kActionList;
    340                 updateLists();
    341                 if (focused != LeftList)
    342                     switchListFocus(LeftList,
    343                                     (focused == RightList) ? RightList : NULL);
    344             } else handled = false;
     352                m_LeftType = kContextList;
     353                m_RightType = kActionList;
     354                UpdateLists();
     355                if (m_Focused != m_LeftList)
     356                    SwitchListFocus(m_LeftList, (m_Focused == m_RightList) ?
     357                                    m_RightList : NULL);
     358            }
     359            else
     360                handled = false;
    345361        }
    346362        else if (action == "2")
    347363        {
    348             if (leftType != kContextList || rightType != kKeyList)
     364            if (m_LeftType != kContextList || m_RightType != kKeyList)
    349365            {
    350                 leftType = kContextList;
    351                 rightType = kKeyList;
    352                 updateLists();
    353                 if (focused != LeftList)
    354                     switchListFocus(LeftList,
    355                                     (focused == RightList) ? RightList : NULL);
    356             } else handled = false;
     366                m_LeftType = kContextList;
     367                m_RightType = kKeyList;
     368                UpdateLists();
     369                if (m_Focused != m_LeftList)
     370                    SwitchListFocus(m_LeftList, (m_Focused == m_RightList) ?
     371                                    m_RightList : NULL);
     372            }
     373            else
     374                handled = false;
    357375        }
    358376        else if (action == "3")
    359377        {
    360             if (leftType != kKeyList || rightType != kContextList)
     378            if (m_LeftType != kKeyList || m_RightType != kContextList)
    361379            {
    362                 leftType = kKeyList;
    363                 rightType = kContextList;
    364                 updateLists();
    365                 if (focused != LeftList)
    366                     switchListFocus(LeftList,
    367                                     (focused == RightList) ? RightList : NULL);
    368             } else handled = false;
     380                m_LeftType = kKeyList;
     381                m_RightType = kContextList;
     382                UpdateLists();
     383                if (m_Focused != m_LeftList)
     384                    SwitchListFocus(m_LeftList, (m_Focused == m_RightList) ?
     385                                    m_RightList : NULL);
     386            }
     387            else
     388                handled = false;
    369389        }
    370         else handled = false;
     390        else
     391            handled = false;
    371392    }
    372393
    373     if (handled) return;
     394    if (handled)
     395        return;
    374396
    375     if (!escape && JumpTo(e)) handled = true;
     397    if (!escape && JumpTo(e))
     398        handled = true;
    376399
    377400    if (!handled)
    378401        MythThemedDialog::keyPressEvent(e);
     
    381404bool MythControls::JumpTo(QKeyEvent *e)
    382405{
    383406    UIListBtnType *list = NULL;
    384     if (focused == LeftList && leftType == kKeyList) list = LeftList;
    385     if (focused == RightList && rightType == kKeyList) list = RightList;
    386     if (!list) return false;
    387407
     408    if (m_Focused == m_LeftList && m_LeftType == kKeyList)
     409        list = m_LeftList;
     410
     411    if (m_Focused == m_RightList && m_RightType == kKeyList)
     412        list = m_RightList;
     413
     414    if (!list)
     415        return false;
     416
    388417    QString key = e->text();
    389     if (key.left(6) == "remote") {
     418    if (key.left(6) == "remote")
     419    {
    390420        key = KeyToDisplay(key);
    391     } else {
     421    }
     422    else
     423    {
    392424        key = QString(QKeySequence(e->key()));
    393         if (key.isEmpty()) return false;
     425
     426        if (key.isEmpty())
     427            return false;
     428
    394429        QString modifiers = "";
    395         if (e->state()&Qt::ShiftButton) modifiers+="Shift+";
    396         if (e->state()&Qt::ControlButton) modifiers+="Ctrl+";
    397         if (e->state()&Qt::AltButton) modifiers+="Alt+";
    398         if (e->state()&Qt::MetaButton) modifiers+="Meta+";
     430
     431        if (e->state()&Qt::ShiftButton)
     432            modifiers+="Shift+";
     433        if (e->state()&Qt::ControlButton)
     434            modifiers+="Ctrl+";
     435        if (e->state()&Qt::AltButton)
     436            modifiers+="Alt+";
     437        if (e->state()&Qt::MetaButton)
     438            modifiers+="Meta+";
     439
    399440        key = modifiers + key;
    400441    }
    401442
    402443    UIListBtnTypeItem *b;
    403444    uint len = 1024; // infinity
    404     if (list == RightList)
     445    if (list == m_RightList)
    405446    {
    406447        key = key + " ";
    407448        len = key.length();
    408449    }
    409450
    410451    for (b = list->GetItemFirst(); b; b = list->GetItemNext(b))
    411         if (b->text().left(len) == key) break;
    412     if (!b) return false;
     452        if (b->text().left(len) == key)
     453            break;
    413454
     455    if (!b)
     456        return false;
     457
    414458    int curpos = list->GetItemPos(list->GetItemCurrent());
    415459    int newpos = list->GetItemPos(b);
    416460
     
    422466}
    423467
    424468
    425 void MythControls::leftSelected(UIListBtnTypeItem*)
     469void MythControls::LeftSelected(UIListBtnTypeItem*)
    426470{
    427     LeftList->refresh();
    428     RightList->blockSignals(true);
    429     refreshRightList();
    430     RightList->blockSignals(false);
    431     RightList->refresh();
     471    m_LeftList->refresh();
     472    m_RightList->blockSignals(true);
     473    RefreshRightList();
     474    m_RightList->blockSignals(false);
     475    m_RightList->refresh();
    432476}
    433477
    434 void MythControls::rightSelected(UIListBtnTypeItem*)
     478void MythControls::RightSelected(UIListBtnTypeItem*)
    435479{
    436     RightList->refresh();
    437     refreshKeyInformation();
     480    m_RightList->refresh();
     481    RefreshKeyInformation();
    438482}
    439483
    440484
    441485
    442486/* method description in header */
    443 void MythControls::refreshRightList()
     487void MythControls::RefreshRightList()
    444488{
    445     RightList->Reset();
     489    m_RightList->Reset();
    446490
    447     if (LeftList->GetItemCurrent() == NULL)
     491    if (m_LeftList->GetItemCurrent() == NULL)
    448492        return;
    449493
    450     if (leftType == kContextList)
     494    if (m_LeftType == kContextList)
    451495    {
    452         if (rightType == kActionList)
     496        if (m_RightType == kActionList)
    453497        {
    454498            /* add all of the actions to the context list */
    455             QString context = LeftList->GetItemCurrent()->text();
    456             QStringList *actions = m_contexts[context];
     499            QString context = m_LeftList->GetItemCurrent()->text();
     500            QStringList *actions = m_Contexts[context];
    457501            if (actions == NULL)
    458502            {
    459                 VERBOSE(VB_IMPORTANT, QString("MythControls: Unable to find actions for context %1").arg(context));
     503                VERBOSE(VB_IMPORTANT,
     504                        QString("MythControls: Unable to find actions for "
     505                                "context %1").arg(context));
    460506                return;
    461507            }
    462508            UIListBtnTypeItem *item;
     509
    463510            for (size_t i = 0; i < actions->size(); i++)
    464                 item = new UIListBtnTypeItem(RightList, (*actions)[i]);
     511                item = new UIListBtnTypeItem(m_RightList, (*actions)[i]);
    465512        }
    466         else if (rightType == kKeyList)
     513        else if (m_RightType == kKeyList)
    467514        {
    468515            /* add all of the actions to the context list */
    469             QString context = LeftList->GetItemCurrent()->text();
    470             BindingList *list = contextKeys[context];
     516            QString context = m_LeftList->GetItemCurrent()->text();
     517            BindingList *list = m_ContextKeys[context];
    471518            if (list == NULL)
    472519            {
    473                 VERBOSE(VB_IMPORTANT, QString("MythControls: Unable to find keys for context %1").arg(context));
     520                VERBOSE(VB_IMPORTANT, QString("MythControls: Unable to find keys"
     521                                              " for context %1").arg(context));
    474522                return;
    475523            }
    476524            UIListBtnTypeItem *item;
    477             for (BindingList::iterator it = list->begin(); it != list->end(); ++it)
     525            for (BindingList::iterator it = list->begin(); it != list->end();
     526                 ++it)
    478527            {
    479528                binding_t *b = *it;
    480                 item = new UIListBtnTypeItem(RightList, KeyToDisplay(b->key) + " => " + b->action);
     529                item = new UIListBtnTypeItem(m_RightList, KeyToDisplay(b->key) +
     530                                             " => " + b->action);
    481531            }
    482532        }
    483     } else if (leftType == kKeyList && rightType == kContextList)
     533    }
     534    else if (m_LeftType == kKeyList && m_RightType == kContextList)
    484535    {
    485         QString key = DisplayToKey(LeftList->GetItemCurrent()->text());
    486         BindingList *list = keyActions[key];
     536        QString key = DisplayToKey(m_LeftList->GetItemCurrent()->text());
     537        BindingList *list = m_KeyActions[key];
    487538        if (list == NULL)
    488539        {
    489             VERBOSE(VB_IMPORTANT, QString("MythControls: Unable to find actions for key %1").arg(key));
     540            VERBOSE(VB_IMPORTANT, QString("MythControls: Unable to find actions "
     541                                          "for key %1").arg(key));
    490542            return;
    491543        }
    492544        UIListBtnTypeItem *item;
    493545        BindingList::iterator it = list->begin();
    494546        binding_t *b = *it;
    495         for (size_t i = 0; i < contexts.size(); i++)
     547        for (size_t i = 0; i < m_SortedContexts.size(); i++)
    496548        {
    497             QString context = contexts[i];
     549            QString context = m_SortedContexts[i];
    498550            QString action = "<none>";
    499551            if (b && b->context == context)
    500552            {
    501553                action = b->action;
    502554                ++it;
    503                 if (it != list->end()) b = *it;
    504                 else b = NULL;
     555                b = (it != list->end()) ? *it : NULL;
    505556            }
    506             item = new UIListBtnTypeItem(RightList, context + " => " + action);
     557            item = new UIListBtnTypeItem(m_RightList, context + " => " + action);
    507558        }
    508559    }
    509560}
    510561
    511562
    512563/* comments in header */
    513 void MythControls::refreshKeyInformation()
     564void MythControls::RefreshKeyInformation()
    514565{
    515566    /* get the description of the current action */
    516567    QString desc;
    517568
    518     if (focused == LeftList)
     569    if (m_Focused == m_LeftList)
    519570    {
    520571        /* blank all keys on the context */
    521572        for (size_t i = 0; i < Action::MAX_KEYS; i++)
    522             ActionButtons[i]->setText("");
     573            m_ActionButtons[i]->setText("");
    523574    }
    524     else if (leftType == kKeyList || rightType == kKeyList)
     575    else if (m_LeftType == kKeyList || m_RightType == kKeyList)
    525576    { // Should show appropriate description
    526         QString action = getCurrentAction();
    527         QString context = getCurrentContext();
     577        QString action = GetCurrentAction();
     578        QString context = GetCurrentContext();
    528579        /* blank all keys on the context */
    529580        for (size_t i = 0; i < Action::MAX_KEYS; i++)
    530             ActionButtons[i]->setText("");
     581            m_ActionButtons[i]->setText("");
    531582        if (!action.isEmpty())
    532             {
     583        {
    533584   
    534             desc = key_bindings->getActionDescription(context, action);
     585            desc = m_KeyBindings->GetActionDescription(context, action);
    535586   
    536587            BindingList *list = NULL;
    537             if (leftType == kKeyList && rightType == kContextList)
     588            if (m_LeftType == kKeyList && m_RightType == kContextList)
    538589            {
    539                 QString key = getCurrentKey();
    540                 list = keyActions[DisplayToKey(key)];
     590                QString key = GetCurrentKey();
     591                list = m_KeyActions[DisplayToKey(key)];
    541592            }
    542             else if (leftType == kContextList && rightType == kKeyList)
    543                 list = contextKeys[context];
     593            else if (m_LeftType == kContextList && m_RightType == kKeyList)
     594                list = m_ContextKeys[context];
    544595            if (list)
    545596            {
    546597                QString searchKey;
    547                 if (rightType == kContextList)
     598                if (m_RightType == kContextList)
    548599                    searchKey = context;
    549                 else if (rightType == kActionList)
     600                else if (m_RightType == kActionList)
    550601                    searchKey = action;
    551                 else if (rightType == kKeyList)
    552                     searchKey = DisplayToKey(getCurrentKey());
     602                else if (m_RightType == kKeyList)
     603                    searchKey = DisplayToKey(GetCurrentKey());
    553604                binding_t *binding = NULL;
    554                 for (BindingList::iterator it = list->begin(); it != list->end(); ++it)
     605                for (BindingList::iterator it = list->begin();
     606                     it != list->end(); ++it)
    555607                {
    556608                    binding_t *b = *it;
    557                     switch (rightType)
     609                    switch (m_RightType)
    558610                    {
    559611                        case kContextList:
    560                             if (b->context == searchKey) binding = b;
     612                            if (b->context == searchKey)
     613                                binding = b;
    561614                            break;
    562615                        case kActionList:
    563                             if (b->action == searchKey) binding = b;
     616                            if (b->action == searchKey)
     617                                binding = b;
    564618                            break;
    565619                        case kKeyList:
    566                             if (b->key == searchKey) binding = b;
     620                            if (b->key == searchKey)
     621                                binding = b;
    567622                            break;
    568623                    }
    569                     if (binding) break;
     624                    if (binding)
     625                        break;
    570626                }
    571627   
    572628                if (binding)
    573629                {
    574630                    if (desc.isEmpty() && context != binding->contextFrom)
    575                         desc = key_bindings->getActionDescription(binding->contextFrom, action);
     631                        desc = m_KeyBindings->GetActionDescription(
     632                            binding->contextFrom, action);
     633
    576634                    desc += "\n" + tr("Binding comes from %1 context")
    577                             .arg(binding->contextFrom);
     635                        .arg(binding->contextFrom);
    578636                }
    579637            }
    580638        }
    581     } else {
    582         QString context = getCurrentContext();
    583         QString action = getCurrentAction();
     639    }
     640    else
     641    {
     642        QString context = GetCurrentContext();
     643        QString action = GetCurrentAction();
    584644        /* set the description */
    585         desc = key_bindings->getActionDescription(getCurrentContext(),
    586                                                   getCurrentAction());
     645        desc = m_KeyBindings->GetActionDescription(GetCurrentContext(),
     646                                                   GetCurrentAction());
    587647
    588648        /* get the bindings of the current action */
    589         QStringList keys = key_bindings->getActionKeys(getCurrentContext(),
    590                                                        getCurrentAction());
     649        QStringList keys = m_KeyBindings->GetActionKeys(GetCurrentContext(),
     650                                                        GetCurrentAction());
    591651
    592652        size_t i;
    593653
    594654        /* fill existing keys */
    595655        for (i = 0; i < keys.count(); i++)
    596             ActionButtons[i]->setText(KeyToDisplay(keys[i]));
     656            m_ActionButtons[i]->setText(KeyToDisplay(keys[i]));
    597657
    598658        /* blank the other ones */
    599659        for (; i < Action::MAX_KEYS; i++)
    600             ActionButtons[i]->setText("");
     660            m_ActionButtons[i]->setText("");
    601661    }
    602662
    603663    /* set the information */
    604     description->SetText(desc);
     664    m_Description->SetText(desc);
    605665}
    606666
    607667
    608668
    609669/* comments in header */
    610 QString MythControls::getCurrentContext(void) const
     670QString MythControls::GetCurrentContext(void) const
    611671{
    612     if (leftType == kContextList)
    613         return LeftList->GetItemCurrent()->text();
    614     if (focused == LeftList) return "";
     672    if (m_LeftType == kContextList)
     673        return m_LeftList->GetItemCurrent()->text();
     674    if (m_Focused == m_LeftList)
     675        return "";
    615676
    616     QString desc = RightList->GetItemCurrent()->text();
     677    QString desc = m_RightList->GetItemCurrent()->text();
    617678    int loc = desc.find(" => ");
    618     if (loc == -1) return ""; // Should not happen
    619     if (rightType == kContextList) return desc.left(loc);
    620     else return desc.mid(loc+4);
     679    if (loc == -1)
     680        return ""; // Should not happen
     681
     682    if (m_RightType == kContextList)
     683        return desc.left(loc);
     684    else
     685        return desc.mid(loc+4);
    621686}
    622687
    623688/* comments in header */
    624 QString MythControls::getCurrentAction(void) const
     689QString MythControls::GetCurrentAction(void) const
    625690{
    626     if (leftType == kActionList)
    627         return LeftList->GetItemCurrent()->text();
    628     if (focused == LeftList) return "";
     691    if (m_LeftType == kActionList)
     692        return m_LeftList->GetItemCurrent()->text();
     693    if (m_Focused == m_LeftList)
     694        return "";
    629695
    630     QString desc = RightList->GetItemCurrent()->text();
    631     if (leftType == kContextList && rightType == kActionList)
     696    QString desc = m_RightList->GetItemCurrent()->text();
     697    if (m_LeftType == kContextList && m_RightType == kActionList)
    632698        return desc;
    633699    int loc = desc.find(" => ");
    634     if (loc == -1) return ""; // Should not happen
    635     if (rightType == kActionList) return desc.left(loc);
     700    if (loc == -1)
     701        return ""; // Should not happen
     702    if (m_RightType == kActionList)
     703        return desc.left(loc);
    636704    else
    637705    {
    638706        QString rv = desc.mid(loc+4);
    639         if (rv == "<none>") return "";
    640         else return rv;
     707        if (rv == "<none>")
     708            return "";
     709        else
     710            return rv;
    641711    }
    642712}
    643713
    644714/* comments in header */
    645 QString MythControls::getCurrentKey(void) const
     715QString MythControls::GetCurrentKey(void) const
    646716{
    647     if (leftType == kKeyList)
    648         return LeftList->GetItemCurrent()->text();
    649     if (focused == LeftList) return "";
     717    if (m_LeftType == kKeyList)
     718        return m_LeftList->GetItemCurrent()->text();
     719    if (m_Focused == m_LeftList)
     720        return "";
    650721
    651     if (leftType == kContextList && rightType == kActionList)
     722    if (m_LeftType == kContextList && m_RightType == kActionList)
    652723    {
    653         QString context = getCurrentContext();
    654         QString action = getCurrentAction();
    655         size_t b = focusedButton();
    656         QStringList keys = key_bindings->getActionKeys(context, action);
    657         if (b < keys.count()) return keys[b];
    658         else return "";
     724        QString context = GetCurrentContext();
     725        QString action = GetCurrentAction();
     726        size_t b = FocusedButton();
     727        QStringList keys = m_KeyBindings->GetActionKeys(context, action);
     728
     729        if (b < keys.count())
     730            return keys[b];
     731        else
     732            return "";
    659733    }
    660734
    661     QString desc = RightList->GetItemCurrent()->text();
     735    QString desc = m_RightList->GetItemCurrent()->text();
    662736    int loc = desc.find(" => ");
    663     if (loc == -1) return ""; // Should not happen
    664     if (rightType == kKeyList) return desc.left(loc);
    665     else return desc.mid(loc+4);
     737    if (loc == -1)
     738        return ""; // Should not happen
     739    if (m_RightType == kKeyList)
     740        return desc.left(loc);
     741    else
     742        return desc.mid(loc+4);
    666743}
    667744
    668745
    669746/* comments in header */
    670 void MythControls::loadHost(const QString & hostname) {
    671 
     747void MythControls::LoadHost(const QString & hostname)
     748{
    672749    /* create the key bindings and the tree */
    673     key_bindings = new KeyBindings(hostname);
    674     contexts = *key_bindings->getContexts();
     750    m_KeyBindings = new KeyBindings(hostname);
     751    m_SortedContexts = *m_KeyBindings->GetContexts();
    675752
    676753    keys.clear();
    677754
    678755    /* Alphabetic order, but jump and global at the top  */
    679     contexts.sort();
    680     contexts.remove(JUMP_CONTEXT);
    681     contexts.remove(GLOBAL_CONTEXT);
    682     contexts.insert(contexts.begin(), 1, GLOBAL_CONTEXT);
    683     contexts.insert(contexts.begin(), 1, JUMP_CONTEXT);
     756    m_SortedContexts.sort();
     757    m_SortedContexts.remove(JUMP_CONTEXT);
     758    m_SortedContexts.remove(GLOBAL_CONTEXT);
     759    m_SortedContexts.insert(m_SortedContexts.begin(), 1, GLOBAL_CONTEXT);
     760    m_SortedContexts.insert(m_SortedContexts.begin(), 1, JUMP_CONTEXT);
    684761
    685762    QStringList *actions;
    686     for (size_t i = 0; i < contexts.size(); i++)
     763    for (size_t i = 0; i < m_SortedContexts.size(); i++)
    687764    {
    688         actions = key_bindings->getActions(contexts[i]);
     765        actions = m_KeyBindings->GetActions(m_SortedContexts[i]);
    689766        actions->sort();
    690         m_contexts.insert(contexts[i], actions);
     767        m_Contexts.insert(m_SortedContexts[i], actions);
    691768    }
    692769
    693     refreshKeyBindings();
    694     updateLists();
     770    RefreshKeyBindings();
     771    UpdateLists();
    695772}
    696773
    697774
    698775
    699776/* comments in header */
    700 void MythControls::deleteKey()
     777void MythControls::DeleteKey()
    701778{
    702779    // This code needs work to support deleteKey in any mode exc. Context/Action
    703     QString context = getCurrentContext();
    704     QString key = getCurrentKey();
    705     QString action = getCurrentAction();
     780    QString context = GetCurrentContext();
     781    QString key = GetCurrentKey();
     782    QString action = GetCurrentAction();
    706783    if (context.isEmpty() || key.isEmpty() || action.isEmpty())
    707784    {
    708785        InvalidBindingPopup popup(gContext->GetMainWindow());
    709         popup.getOption();
     786        popup.GetOption();
    710787        return;
    711788    }
    712789
    713     BindingList *list = keyActions[key];
     790    BindingList *list = m_KeyActions[key];
    714791    binding_t *binding = NULL;
     792
    715793    for (BindingList::iterator it = list->begin(); it != list->end(); ++it)
    716794    {
    717795        binding_t *b = *it;
    718         if (b->context == context) binding = b;
     796        if (b->context == context)
     797            binding = b;
    719798    }
     799
    720800    if (!binding)
    721801    {
    722802        InvalidBindingPopup popup(gContext->GetMainWindow());
    723         popup.getOption();
     803        popup.GetOption();
    724804        return;
    725805    }
    726806
    727807    if (binding->contextFrom != context)
    728808    {
    729         ConfirmMenu popup(gContext->GetMainWindow(), tr("Delete this key binding from context %1?").arg(binding->contextFrom));
    730         if (popup.getOption() != ConfirmMenu::CONFIRM) return;
    731     } else {
     809        ConfirmMenu popup(gContext->GetMainWindow(),
     810                          tr("Delete this key binding from context %1?")
     811                          .arg(binding->contextFrom));
     812        if (popup.GetOption() != ConfirmMenu::CONFIRM)
     813            return;
     814    }
     815    else
     816    {
    732817        ConfirmMenu popup(gContext->GetMainWindow(), tr("Delete this binding?"));
    733         if (popup.getOption() != ConfirmMenu::CONFIRM) return;
     818        if (popup.GetOption() != ConfirmMenu::CONFIRM)
     819            return;
    734820    }
    735821
    736     if (!key_bindings->removeActionKey(binding->contextFrom, action, key))
     822    if (!m_KeyBindings->RemoveActionKey(binding->contextFrom, action, key))
    737823    {
    738824        InvalidBindingPopup popup(gContext->GetMainWindow());
    739         popup.getOption();
     825        popup.GetOption();
    740826        return;
    741827    }
    742828
    743829    // refreshing everything is overkill.  I tried incrementally updating, but the
    744830    // code was ugly.  Since this is quick in my experience, overkill away!
    745     refreshKeyBindings();
    746     refreshKeyInformation();
     831    RefreshKeyBindings();
     832    RefreshKeyInformation();
    747833}
    748834
    749835/* method description in header */
    750 bool MythControls::resolveConflict(ActionID *conflict, int level)
     836bool MythControls::ResolveConflict(ActionID *conflict, int level)
    751837{
    752838    MythMainWindow *window = gContext->GetMainWindow();
    753839
    754840    /* prevent a fatal binding */
    755841    if (level == KeyBindings::Error)
    756842    {
    757         InvalidBindingPopup popup(gContext->GetMainWindow(),
    758                                   conflict->action(),
    759                                   conflict->context());
    760         popup.getOption();
     843        InvalidBindingPopup popup(gContext->GetMainWindow(), conflict->Action(),
     844                                  conflict->Context());
     845        popup.GetOption();
    761846        return false;
    762847    }
    763848    else
    764849    {
    765850        /* warn the user that this could conflict */
    766851        QString message = "This kebinding may conflict with ";
    767         message += conflict->action() + " in the " + conflict->context();
     852        message += conflict->Action() + " in the " + conflict->Context();
    768853        message += " context.  Do you want to bind it anyways?";
    769854
    770855        if (MythPopupBox::show2ButtonPopup(window, "Conflict Warning",
     
    778863
    779864
    780865/* method description in header */
    781 void MythControls::addKeyToAction(void)
     866void MythControls::AddKeyToAction(void)
    782867{
    783868    // This code needs work to support deleteKey in any mode exc. Context/Action
    784869    /* grab a key from the user */
    785870    KeyGrabPopupBox *kg = new KeyGrabPopupBox(gContext->GetMainWindow());
    786     int result = kg->ExecPopup(kg,SLOT(cancel()));
    787     QString key = kg->getCapturedKey();
     871    int result = kg->ExecPopup(kg,SLOT(Cancel()));
     872    QString key = kg->GetCapturedKey();
    788873    delete kg;
    789874
    790875    /* go no further if canceled */
    791     if (result == 0) return;
     876    if (result == 0)
     877        return;
    792878
    793879    /* get the keys for the selected action */
    794     size_t b = focusedButton();
    795     QString action = getCurrentAction(), context = getCurrentContext();
    796     QStringList keys = key_bindings->getActionKeys(context, action);
     880    size_t b = FocusedButton();
     881    QString action = GetCurrentAction(), context = GetCurrentContext();
     882    QStringList keys = m_KeyBindings->GetActionKeys(context, action);
    797883
    798884    /* dont bother rebinding the same key */
    799     if (keys[b] == key) return;
     885    if (keys[b] == key)
     886        return;
    800887
    801888    bool bind = true;
    802889    int level;
    803890
    804891    /* get the potential conflict */
    805892    ActionID *conflict = NULL;
    806     if ((conflict = key_bindings->conflicts(context, key, level)))
    807         bind = resolveConflict(conflict, level);
     893    if ((conflict = m_KeyBindings->Conflicts(context, key, level)))
     894        bind = ResolveConflict(conflict, level);
    808895
    809896    delete conflict;
    810897
    811898    /* dont bind if we shouldn't bind */
    812     if (!bind) return;
     899    if (!bind)
     900        return;
    813901
    814902    /* finally bind or rebind a key to the action */
    815903    if (b < keys.count())
    816         key_bindings->replaceActionKey(context,action, key, keys[b]);
     904        m_KeyBindings->ReplaceActionKey(context,action, key, keys[b]);
    817905    else
    818         key_bindings->addActionKey(context, action, key);
     906        m_KeyBindings->AddActionKey(context, action, key);
    819907
    820     refreshKeyBindings();
    821     refreshKeyInformation();
     908    RefreshKeyBindings();
     909    RefreshKeyInformation();
    822910}
    823911
    824912
    825913
    826 void MythControls::addBindings(QDict<binding_t> &bindings,
     914void MythControls::AddBindings(QDict<binding_t> &bindings,
    827915                               const QString &context,
    828916                               const QString &contextParent, int bindlevel)
    829917{
    830     QStringList *actions = key_bindings->getActions(context);
     918    QStringList *actions = m_KeyBindings->GetActions(context);
    831919
    832920    for (size_t i = 0; i < actions->size(); i++)
    833921    {
    834922        QString action = (*actions)[i];
    835         QStringList keys = key_bindings->getActionKeys(context, action);
     923        QStringList keys = m_KeyBindings->GetActionKeys(context, action);
    836924
    837925        for (size_t j = 0; j < keys.size(); j++)
    838926        {
     
    857945    }
    858946}
    859947
    860 BindingList *MythControls::getKeyBindings(const QString &context)
     948BindingList *MythControls::GetKeyBindings(const QString &context)
    861949{
    862950    QStringList keys;
    863951    QDict<binding_t> bindings;
    864952    bindings.clear();
    865953
    866     for (size_t i = 0; i < contexts.size(); i++)
    867         addBindings(bindings, contexts[i], context, i);
     954    for (size_t i = 0; i < m_SortedContexts.size(); i++)
     955        AddBindings(bindings, m_SortedContexts[i], context, i);
    868956
    869957
    870958    for (QDictIterator<binding_t> it(bindings); it.current(); ++it)
     
    873961        keys.append(key);
    874962    }
    875963
    876     sortKeyList(keys);
     964    SortKeyList(keys);
    877965
    878966    BindingList *retval = new BindingList;
    879967    retval->clear();
     
    887975    return retval;
    888976}
    889977
    890 void MythControls::refreshKeyBindings()
     978void MythControls::RefreshKeyBindings()
    891979{
    892     contextKeys.clear();
    893     keyActions.clear();
    894     for (size_t i = 0; i < contexts.size(); i++)
     980    m_ContextKeys.clear();
     981    m_KeyActions.clear();
     982    for (size_t i = 0; i < m_SortedContexts.size(); i++)
    895983    {
    896         QString context = contexts[i];
    897         BindingList *list = getKeyBindings(context);
    898         contextKeys.insert(context, list);
     984        QString context = m_SortedContexts[i];
     985        BindingList *list = GetKeyBindings(context);
     986        m_ContextKeys.insert(context, list);
    899987        for (BindingList::iterator it = list->begin(); it != list->end(); ++it)
    900988        {
    901989            binding_t *b = *it;
    902             BindingList *list = keyActions.find(b->key);
     990            BindingList *list = m_KeyActions.find(b->key);
    903991            if (!list)
    904992            {
    905993                list = new BindingList;
    906994                list->clear();
    907                 keyActions.insert(b->key, list);
     995                m_KeyActions.insert(b->key, list);
    908996            }
    909997            keys.append(b->key);
    910998            list->append(b);
    911999        }
    9121000    }
    913     contextKeys.setAutoDelete(true);
    914     keyActions.setAutoDelete(true);
     1001    m_ContextKeys.setAutoDelete(true);
     1002    m_KeyActions.setAutoDelete(true);
    9151003
    916     sortKeyList(keys);
     1004    SortKeyList(keys);
    9171005}
    9181006
    919 void MythControls::sortKeyList(QStringList &keys)
     1007void MythControls::SortKeyList(QStringList &keys)
    9201008{
    9211009    QStringList t;
    9221010    t.clear();
    9231011
    9241012    for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it )
    9251013    {
    926         QString key = *it;
    927 
    928         QString keydesc = "3 ";
     1014        QString key = *it, keydesc = "3 ";
    9291015        if (key.left(6) == "remote")
    930         {
    9311016            keydesc = "0 ";
    932         }
    9331017        else if (key.length() == 1)
    9341018        {
    9351019            switch (key[0].category())
     
    9661050    }
    9671051}
    9681052
    969 QString MythControls::getTypeDesc(ListType type)
     1053QString MythControls::GetTypeDesc(ListType type)
    9701054{
    9711055    switch (type)
    9721056    {
     
    9841068    }
    9851069}
    9861070
    987 void MythControls::updateLists()
     1071void MythControls::UpdateLists()
    9881072{
    989     RightList->blockSignals(true);
    990     LeftList->blockSignals(true);
    991     LeftList->Reset();
    992     if (leftType == kContextList)
     1073    m_RightList->blockSignals(true);
     1074    m_LeftList->blockSignals(true);
     1075    m_LeftList->Reset();
     1076    if (m_LeftType == kContextList)
    9931077    {
    9941078        UIListBtnTypeItem *item;
    995         for (size_t i = 0; i < contexts.size(); i++)
     1079        for (size_t i = 0; i < m_SortedContexts.size(); i++)
    9961080        {
    997             item = new UIListBtnTypeItem(LeftList, contexts[i]);
     1081            item = new UIListBtnTypeItem(m_LeftList, m_SortedContexts[i]);
    9981082            item->setDrawArrow(true);
    9991083        }
    1000     } else if (leftType == kKeyList)
     1084    }
     1085    else if (m_LeftType == kKeyList)
    10011086    {
    10021087        UIListBtnTypeItem *item;
    10031088        for (size_t i = 0; i < keys.size(); i++)
    10041089        {
    10051090            QString key = KeyToDisplay(keys[i]);
    1006             item = new UIListBtnTypeItem(LeftList, key);
     1091            item = new UIListBtnTypeItem(m_LeftList, key);
    10071092            item->setDrawArrow(true);
    10081093        }
    10091094    }
    1010     refreshRightList();
    1011     RightList->blockSignals(false);
    1012     LeftList->blockSignals(false);
    1013     LeftList->refresh();
    1014     RightList->refresh();
     1095    RefreshRightList();
     1096    m_RightList->blockSignals(false);
     1097    m_LeftList->blockSignals(false);
     1098    m_LeftList->refresh();
     1099    m_RightList->refresh();
    10151100
    1016     if (LeftDesc != NULL)
    1017         LeftDesc->SetText(getTypeDesc(leftType));
    1018     if (RightDesc != NULL)
    1019         RightDesc->SetText(getTypeDesc(rightType));
     1101    if (m_LeftDesc != NULL)
     1102        m_LeftDesc->SetText(GetTypeDesc(m_LeftType));
     1103    if (m_RightDesc != NULL)
     1104        m_RightDesc->SetText(GetTypeDesc(m_RightType));
    10201105}
    10211106
    10221107
  • mythcontrols/keybindings.cpp

     
    4141
    4242KeyBindings::KeyBindings(const QString & hostname)
    4343{
    44     this->hostname() = hostname;
    45     loadManditoryBindings();
     44    m_Hostname = hostname;
     45    LoadMandatoryBindings();
    4646
    47     retrieveContexts();
    48     retrieveJumppoints();
     47    RetrieveContexts();
     48    RetrieveJumppoints();
    4949}
    5050
    5151
    5252
    53 ActionID * KeyBindings::conflicts(const QString & context_name,
     53ActionID * KeyBindings::Conflicts(const QString & context_name,
    5454                                  const QString & key, int &level) const
    5555{
    56     const ActionList &ids = actionset.getActions(key);
     56    const ActionList &ids = m_ActionSet.GetActions(key);
    5757
    5858    /* trying to bind a jumppoint to an already bound key */
    5959    if ((context_name == JUMP_CONTEXT) && (ids.count() > 0))
     
    6363    for (size_t i = 0; i < ids.count(); i++)
    6464    {
    6565        /* jump points, then global, then the same context */
    66         if (ids[i].context() == JUMP_CONTEXT) {
     66        if (ids[i].Context() == JUMP_CONTEXT)
     67        {
    6768            level = KeyBindings::Error;
    6869            return new ActionID(ids[i]);
    6970        }
    70         else if (ids[i].context() == context_name) {
     71        else if (ids[i].Context() == context_name)
     72        {
    7173            level = KeyBindings::Error;
    7274            return new ActionID(ids[i]);
    7375        }
    74         else if (ids[i].context()==GLOBAL_CONTEXT) {
     76        else if (ids[i].Context()==GLOBAL_CONTEXT)
     77        {
    7578            level = KeyBindings::Warning;
    7679            return new ActionID(ids[i]);
    7780        }
     
    8487
    8588
    8689/* method description in header */
    87 bool KeyBindings::removeActionKey(const QString & context_name,
     90bool KeyBindings::RemoveActionKey(const QString & context_name,
    8891                                  const QString & action_name,
    8992                                  const QString & key)
    9093{
     
    9295    ActionID id(context_name, action_name);
    9396
    9497    /* dont remove the last manditory binding */
    95     if (getManditoryBindings().contains(id)&&(actionset.getKeys(id).count()<2))
     98    if (GetMandatoryBindings().contains(id) &&
     99        (m_ActionSet.GetKeys(id).count()<2))
    96100        return false;
    97101    else
    98         return this->actionset.remove(id,key);
     102        return this->m_ActionSet.Remove(id,key);
    99103}
    100104
    101105
    102106
    103107/* method description in header */
    104 void KeyBindings::commitAction(const ActionID & id)
     108void KeyBindings::CommitAction(const ActionID & id)
    105109{
    106110
    107111    MSqlQuery query(MSqlQuery::InitCon());
     
    112116
    113117    if (query.isConnected())
    114118    {
    115         QString keys = actionset.keyString(id);
    116         query.bindValue(":HOSTNAME", this->getHostname());
    117         query.bindValue(":CONTEXT", id.context());
    118         query.bindValue(":ACTION", id.action());
     119        QString keys = m_ActionSet.KeyString(id);
     120        query.bindValue(":HOSTNAME", this->GetHostname());
     121        query.bindValue(":CONTEXT", id.Context());
     122        query.bindValue(":ACTION", id.Action());
    119123        query.bindValue(":KEYLIST", keys);
    120124
    121125        if (query.exec() && query.isActive())
    122126        {
    123127            /* remove the current bindings */
    124             gContext->GetMainWindow()->ClearKey(id.context(),id.action());
     128            gContext->GetMainWindow()->ClearKey(id.Context(),id.Action());
    125129
    126130            /* make the settings take effect */
    127             gContext->GetMainWindow()->BindKey(id.context(), id.action(),keys);
     131            gContext->GetMainWindow()->BindKey(id.Context(),
     132                                               id.Action(), keys);
    128133        }
    129134    }
    130135}
    131136
    132137
    133138
    134 void KeyBindings::commitJumppoint(const ActionID &id)
     139void KeyBindings::CommitJumppoint(const ActionID &id)
    135140{
    136141
    137142    MSqlQuery query(MSqlQuery::InitCon());
     
    142147
    143148    if (query.isConnected())
    144149    {
    145         QString keys = actionset.keyString(id);
    146         query.bindValue(":HOSTNAME", this->getHostname());
    147         query.bindValue(":DESTINATION", id.action());
     150        QString keys = m_ActionSet.KeyString(id);
     151        query.bindValue(":HOSTNAME", this->m_Hostname);
     152        query.bindValue(":DESTINATION", id.Action());
    148153        query.bindValue(":KEYLIST", keys);
    149154
    150155        /* tell the user to restart for settings to take effect */
    151         if (query.exec() && query.isActive()) {
    152 
     156        if (query.exec() && query.isActive())
     157        {
    153158            /* clear bindings to the jumppoint */
    154             gContext->GetMainWindow()->ClearJump(id.action());
     159            gContext->GetMainWindow()->ClearJump(id.Action());
    155160
    156161            /* make the bindings take effect */
    157             gContext->GetMainWindow()->BindJump(id.action(),keys);
     162            gContext->GetMainWindow()->BindJump(id.Action(), keys);
    158163        }
    159164    }
    160165}
    161166
    162167
    163168
    164 void KeyBindings::commitChanges(void)
     169void KeyBindings::CommitChanges(void)
    165170{
    166     ActionList modified = actionset.getModified();
     171    ActionList modified = m_ActionSet.GetModified();
    167172
    168173    while (modified.size() > 0)
    169174    {
    170175        ActionID id = modified.front();
    171176
    172177        /* commit either a jumppoint or an action */
    173         if (id.context() == JUMP_CONTEXT) commitJumppoint(id);
    174         else commitAction(id);
     178        if (id.Context() == JUMP_CONTEXT)
     179            CommitJumppoint(id);
     180        else
     181            CommitAction(id);
    175182
    176183        /* tell the action set that the action is no longer modified */
    177         actionset.unmodify(id);
     184        m_ActionSet.Unmodify(id);
    178185
    179186        modified.pop_front();
    180187    }
     
    182189
    183190
    184191
    185 void KeyBindings::retrieveJumppoints()
     192void KeyBindings::RetrieveJumppoints()
    186193{
    187194    MSqlQuery query(MSqlQuery::InitCon());
    188195
     
    192199                      "FROM jumppoints "
    193200                      "WHERE hostname = :HOSTNAME "
    194201                      "ORDER BY destination ;");
    195         query.bindValue(":HOSTNAME", this->getHostname());
     202        query.bindValue(":HOSTNAME", m_Hostname);
    196203    }
    197204
    198205    query.exec();
     
    202209        ActionID id(JUMP_CONTEXT, query.value(0).toString());
    203210
    204211        if (query.value(1).toString().isEmpty())
    205         {
    206             actionset.addAction(id, query.value(0).toString(),
    207                                 query.value(2).toString());
    208         }
    209         else actionset.addAction(id,query.value(1).toString(),
    210                                  query.value(2).toString());
     212            m_ActionSet.AddAction(id, query.value(0).toString(),
     213                                  query.value(2).toString());
     214        else
     215            m_ActionSet.AddAction(id,query.value(1).toString(),
     216                                  query.value(2).toString());
    211217    }
    212218}
    213219
    214220
    215221
    216 void KeyBindings::retrieveContexts()
     222void KeyBindings::RetrieveContexts()
    217223{
    218224
    219225    MSqlQuery query(MSqlQuery::InitCon());
     
    225231                      "WHERE hostname = :HOSTNAME "
    226232                      "ORDER BY context,action ;");
    227233
    228         query.bindValue(":HOSTNAME", this->getHostname());
     234        query.bindValue(":HOSTNAME", m_Hostname);
    229235    }
    230236
    231237    query.exec();
     
    233239    for (query.next(); query.isValid(); query.next())
    234240    {
    235241        ActionID id(query.value(0).toString(), query.value(1).toString());
    236         this->actionset.addAction(id, query.value(2).toString(),
    237                                   query.value(3).toString());
     242        m_ActionSet.AddAction(id, query.value(2).toString(),
     243                              query.value(3).toString());
    238244    }
    239245}
    240246
    241247
    242248
    243 void KeyBindings::loadManditoryBindings(void)
     249void KeyBindings::LoadMandatoryBindings(void)
    244250{
    245     if (getManditoryBindings().empty())
     251    if (GetMandatoryBindings().empty())
    246252    {
    247         manditoryBindings().append(ActionID(GLOBAL_CONTEXT, "DOWN"));
    248         defaultKeys().append("Down");
     253        MandatoryBindings().append(ActionID(GLOBAL_CONTEXT, "DOWN"));
     254        DefaultKeys().append("Down");
    249255
    250         manditoryBindings().append(ActionID(GLOBAL_CONTEXT, "UP"));
    251         defaultKeys().append("Up");
     256        MandatoryBindings().append(ActionID(GLOBAL_CONTEXT, "UP"));
     257        DefaultKeys().append("Up");
    252258
    253         manditoryBindings().append(ActionID(GLOBAL_CONTEXT, "LEFT"));
    254         defaultKeys().append("Left");
     259        MandatoryBindings().append(ActionID(GLOBAL_CONTEXT, "LEFT"));
     260        DefaultKeys().append("Left");
    255261
    256         manditoryBindings().append(ActionID(GLOBAL_CONTEXT, "RIGHT"));
    257         defaultKeys().append("Right");
     262        MandatoryBindings().append(ActionID(GLOBAL_CONTEXT, "RIGHT"));
     263        DefaultKeys().append("Right");
    258264
    259         manditoryBindings().append(ActionID(GLOBAL_CONTEXT, "ESCAPE"));
    260         defaultKeys().append("Esc");
     265        MandatoryBindings().append(ActionID(GLOBAL_CONTEXT, "ESCAPE"));
     266        DefaultKeys().append("Esc");
    261267
    262         manditoryBindings().append(ActionID(GLOBAL_CONTEXT, "SELECT"));
    263         defaultKeys().append("Return,Enter,Space");
     268        MandatoryBindings().append(ActionID(GLOBAL_CONTEXT, "SELECT"));
     269        DefaultKeys().append("Return,Enter,Space");
    264270    }
    265271}
    266272
    267273
    268274
    269 bool KeyBindings::hasManditoryBindings(void) const
     275bool KeyBindings::HasMandatoryBindings(void) const
    270276{
    271     ActionList manlist = getManditoryBindings();
     277    ActionList manlist = GetMandatoryBindings();
    272278    for (size_t i = 0; i < manlist.count(); i++)
    273279    {
    274         if (actionset.getKeys(manlist[i]).isEmpty())
     280        if (m_ActionSet.GetKeys(manlist[i]).isEmpty())
    275281            return false;
    276282    }
    277283
  • mythcontrols/actionset.cpp

     
    3636
    3737
    3838/* method description in header */
    39 bool ActionSet::add(const ActionID &id, const QString &key)
     39bool ActionSet::Add(const ActionID &id, const QString &key)
    4040{
    4141    Action *a;
    4242
    4343    /* get the action; make sure it exists before doing anything */
    44     if ((a = this->action(id)))
     44    if ((a = this->GetAction(id)))
    4545    {
    4646
    4747        /* if the key was added, mark this action as modified, and
    4848           update the key map */
    49         if (a->addKey(key))
     49        if (a->AddKey(key))
    5050        {
    51             ActionList &ids = _keymap[key];
     51            ActionList &ids = m_KeyMap[key];
    5252            ids.push_back(id);
    53             this->modify(id);   
     53            this->Modify(id);   
    5454            return true;
    5555        }
    5656    }
     
    6161
    6262
    6363/* method description in header */
    64 bool ActionSet::remove(const ActionID &id, const QString & key)
     64bool ActionSet::Remove(const ActionID &id, const QString & key)
    6565{
    6666
    6767    Action *a;
    6868
    6969    /* make sure an action exists before removing */
    70     if ((a = this->action(id)))
     70    if ((a = this->GetAction(id)))
    7171    {
    7272        /* if the key was removed from the action, then remove it from
    7373         * the key list, and mark the action id as modified */
    74         if (a->removeKey(key))
     74        if (a->RemoveKey(key))
    7575        {
    7676            /* remove the action from the key map */
    77             this->_keymap[key].remove(id);
     77            this->m_KeyMap[key].remove(id);
    7878
    7979            /* mark the action as modified */
    80             this->modify(id);
     80            this->Modify(id);
    8181
    8282            return true;           
    8383        }
     
    9090
    9191
    9292/* method description in header */
    93 bool ActionSet::replace(const ActionID &id, const QString &newkey,
     93bool ActionSet::Replace(const ActionID &id, const QString &newkey,
    9494                        const QString &oldkey)
    9595{
    9696    Action *a;
    9797
    9898    /* make sure an action exists before replacing */
    99     if ((a = this->action(id)))
     99    if ((a = this->GetAction(id)))
    100100    {
    101101
    102102        /* make sure the key was actually replaced before modifying */
    103         if (a->replaceKey(newkey, oldkey))
     103        if (a->ReplaceKey(newkey, oldkey))
    104104        {
    105105            /* remove the action from the old key */
    106             this->_keymap[oldkey].remove(id);
     106            this->m_KeyMap[oldkey].remove(id);
    107107
    108108            /* add the action to the new key */
    109             this->_keymap[newkey].push_back(id);
     109            this->m_KeyMap[newkey].push_back(id);
    110110
    111111            /* mark the action as modified */
    112             this->modify(id);
     112            this->Modify(id);
    113113
    114114            /* the job is done, return true */
    115115            return true;           
     
    123123
    124124
    125125/* method description in header */
    126 QStringList * ActionSet::contextStrings(void) const
     126QStringList * ActionSet::ContextStrings(void) const
    127127{
    128128    QStringList *context_strings = new QStringList();
    129     QDictIterator<Context> it(_contexts);
     129    QDictIterator<Context> it(m_Contexts);
    130130
    131131    for (; it.current(); ++it)
    132132        context_strings->append(it.currentKey());
     
    137137
    138138
    139139/* method description in header */
    140 QStringList * ActionSet::actionStrings(const QString &context_name) const
     140QStringList * ActionSet::ActionStrings(const QString &context_name) const
    141141{
    142     Context *c = _contexts[context_name];
     142    Context *c = m_Contexts[context_name];
    143143
    144     if (c == NULL) return NULL;
     144    if (c == NULL)
     145        return NULL;
    145146    else
    146147    {
    147148        QStringList *action_strings = new QStringList();
    148         QDictIterator<Action> it(*(_contexts[context_name]));
     149        QDictIterator<Action> it(*(m_Contexts[context_name]));
    149150
    150151        for (; it.current(); ++it)
    151152            action_strings->append(it.currentKey());
     
    157158
    158159
    159160/* method description in header */
    160 bool ActionSet::addAction(const ActionID &id, const QString &description,
     161bool ActionSet::AddAction(const ActionID &id, const QString &description,
    161162                          const QString &keys)
    162163{
    163     if (!_contexts[id.context()]) _contexts.insert(id.context(),
    164                                                    new Context());
     164    if (!m_Contexts[id.Context()]) m_Contexts.insert(id.Context(),
     165                                                     new Context());
    165166
    166167    /* return false if the action already exists */
    167     if ((*_contexts[id.context()])[id.action()]) return false;
     168    if ((*m_Contexts[id.Context()])[id.Action()])
     169        return false;
    168170    else
    169171    {
    170172        /* create the action */
    171173        Action *a = new Action(description, keys);
    172174
    173175        /* add the action into the dict */
    174         _contexts[id.context()]->insert(id.action(), a);
     176        m_Contexts[id.Context()]->insert(id.Action(), a);
    175177
    176178        /* get the actions keys */
    177         const QStringList &keys = a->getKeys();
     179        const QStringList &keys = a->GetKeys();
    178180        for (size_t i = 0; i < keys.count(); i++)
    179181        {
    180182            /* get the action list (of actions bound to keys[i])
    181                if there is no key, keys[i], in the map, it will be added now */
    182             ActionList &ids = _keymap[keys[i]];
     183               if there is no key, keys[i], in the map, it will be added now*/
     184            ActionList &ids = m_KeyMap[keys[i]];
    183185
    184186            /* add this action id to the list of actions bound to this key */
    185187            ids.push_back(id);
     
    193195
    194196
    195197
    196 QString ActionSet::keyString(const ActionID &id) const
     198QString ActionSet::KeyString(const ActionID &id) const
    197199{
    198200    Context *c;
    199     if ((c = _contexts[id.context()]))
     201    if ((c = m_Contexts[id.Context()]))
    200202    {
    201203        Action *a;
    202         if ((a = (*c)[id.action()]))
     204        if ((a = (*c)[id.Action()]))
    203205        {
    204             return a->keyString();
     206            return a->KeyString();
    205207        }
    206208    }
    207209    return QString::null;
     
    209211
    210212
    211213
    212 QStringList ActionSet::getKeys(const ActionID &id) const
     214QStringList ActionSet::GetKeys(const ActionID &id) const
    213215{
    214216    Context *c;
    215     if ((c = _contexts[id.context()]))
     217    if ((c = m_Contexts[id.Context()]))
    216218    {
    217219        Action *a;
    218         if ((a = (*c)[id.action()]))
     220        if ((a = (*c)[id.Action()]))
    219221        {
    220             return a->getKeys();
     222            return a->GetKeys();
    221223        }
    222224    }
    223225
     
    226228
    227229
    228230
    229 const QString & ActionSet::getDescription(const ActionID &id) const
     231const QString & ActionSet::GetDescription(const ActionID &id) const
    230232{
    231233    Context *c;
    232     if ((c = _contexts[id.context()]))
     234    if ((c = m_Contexts[id.Context()]))
    233235    {
    234236        Action *a;
    235         if ((a = (*c)[id.action()]))
     237        if ((a = (*c)[id.Action()]))
    236238        {
    237             return a->getDescription();
     239            return a->GetDescription();
    238240        }
    239241    }
    240242
     
    243245
    244246
    245247
    246 const ActionList & ActionSet::getActions(const QString &key) const
     248const ActionList & ActionSet::GetActions(const QString &key) const
    247249{
    248     return _keymap[key];
     250    return m_KeyMap[key];
    249251}
    250252
    251253
  • mythcontrols/mythcontrols.h

     
    7171     *
    7272     * If no context is selected, an empty string is returned.
    7373     */
    74     QString getCurrentContext(void) const;
     74    QString GetCurrentContext(void) const;
    7575
    7676    /**
    7777     * @brief Get the currently selected action string.
     
    7979     *
    8080     * If no action is selected, an empty string is returned.
    8181     */
    82     QString getCurrentAction(void) const;
     82    QString GetCurrentAction(void) const;
    8383
    8484    /**
    8585     * @brief Get the currently selected key string
     
    8787     *
    8888     * If no context is selected, an empty string is returned.
    8989     */
    90     QString getCurrentKey(void) const;
    91 
     90    QString GetCurrentKey(void) const;
    9291   
    93    
    9492protected:
    9593
    9694    /**
     
    102100     * mythcontrols.  If this method returns false, the plugin should
    103101     * exit since it will probably just core dump.
    104102     */
    105     bool loadUI();
     103    bool LoadUI();
    106104
    107105    /**
    108106     * @brief The key press handler.
     
    116114     * Updates the list of keys that are shown and the description of
    117115     * the action.
    118116     */
    119     void refreshKeyInformation();
     117    void RefreshKeyInformation();
    120118
    121119    /**
    122120     * @brief Load the appropriate actions into the action list.
    123121     * @param context The context, from which actions will be
    124122     * displayed.
    125123     */
    126     void refreshRightList(void);
     124    void RefreshRightList(void);
    127125
    128126    /**
    129127     * @brief Redisplay both the left and right lists and fix focus
    130128     */
    131     void updateLists(void);
     129    void UpdateLists(void);
    132130
    133131    /**
    134132     * @brief Load the settings for a particular host.
    135133     * @param hostname The host to load settings for.
    136134     */
    137     void loadHost(const QString & hostname);
     135    void LoadHost(const QString & hostname);
    138136
    139137    /**
    140138     * @brief Focus a button in a particular direction.
    141139     * @param direction Positave values focus to the right, negatives
    142140     * to the left.  A value of zero focuses the first button.
    143141     */
    144     void focusButton(int direction);
     142    void FocusButton(int direction);
    145143
    146144    /**
    147145     * @brief Determine which button is focused.
     
    150148     *
    151149     * @sa Action::MAX_KEYS
    152150     */
    153     size_t focusedButton(void) const;
     151    size_t FocusedButton(void) const;
    154152
    155153    /**
    156154     * @brief Resolve a potential conflict.
    157155     * @return true if the conflict should be bound, otherwise, false
    158156     * is returned.
    159157     */
    160     bool resolveConflict(ActionID *conflict, int level);
     158    bool ResolveConflict(ActionID *conflict, int level);
    161159
    162160    /**
    163161     * @brief Focus a new list and take focus away from the old.
    164162     * @param focus The list to gain focus
    165163     * @param unfocus The list to loose focus
    166164     */
    167     void switchListFocus(UIListBtnType *focus, UIListBtnType *unfocus);
     165    void SwitchListFocus(UIListBtnType *focus, UIListBtnType *unfocus);
    168166
    169167    /**
    170168     * @brief Add bindings to QDict<binding_t> for specified context
     
    173171     * @param contextParent the context whose keybindings are being calculated
    174172     * @param bindlevel the bind level associated with this context
    175173     */
    176     void addBindings(QDict<binding_t> &bindings, const QString &context, const QString &contextParent, int bindlevel);
     174    void AddBindings(QDict<binding_t> &bindings, const QString &context,
     175                     const QString &contextParent, int bindlevel);
    177176
    178177    /**
    179178     * @brief Create a BindingList for the specified context
    180179     * @param context the context for which a BindingList should be created
    181180     */
    182     BindingList *getKeyBindings(const QString &context);
     181    BindingList *GetKeyBindings(const QString &context);
    183182
    184183private slots:
    185184
    186 /**
    187  * @brief Add a key to the currently selected action.
    188  */
    189 void addKeyToAction(void);
     185    /**
     186     * @brief Add a key to the currently selected action.
     187     */
     188    void AddKeyToAction(void);
    190189
    191190    /**
    192191     * @brief Delete the currently active key.
    193192     */
    194     void deleteKey();
     193    void DeleteKey();
    195194
    196195    /**
    197196     * @brief Save the settings.
    198197     */
    199     inline void save(void) { key_bindings->commitChanges(); }
     198    inline void Save(void)
     199    {
     200        m_KeyBindings->CommitChanges();
     201    }
    200202
    201203    /**
    202204     * @brief Recieves a signal when an item in the left list is
    203205     * selected.
    204206     * @param item The selected item.
    205207     */
    206     void leftSelected(UIListBtnTypeItem *item);
     208    void LeftSelected(UIListBtnTypeItem *item);
    207209
    208210    /**
    209211     * @brief Recieves a signal when an item in the right list is
    210212     * selected.
    211213     * @param item The selected item.
    212214     */
    213     void rightSelected(UIListBtnTypeItem *item);
     215    void RightSelected(UIListBtnTypeItem *item);
    214216
    215217    /**
    216218     * @brief Sort a list of keys, removing duplicates
    217219     * @param keys the list of keys to sort
    218220     */
    219     void sortKeyList(QStringList &keys);
     221    void SortKeyList(QStringList &keys);
    220222
    221223    /**
    222224     * @brief Refresh binding information
    223225     */
    224     void refreshKeyBindings();
     226    void RefreshKeyBindings();
    225227
    226228    /**
    227229     * @brief Jump to a particular key binding
     
    231233
    232234private:
    233235
    234     UIType *focused;
    235     UIListBtnType *LeftList;
    236     UIListBtnType *RightList;
    237     UITextType *description, *LeftDesc, *RightDesc;
    238     UITextButtonType * ActionButtons[Action::MAX_KEYS];
    239     KeyBindings *key_bindings;
    240     LayerSet *container;
     236    UIType *m_Focused;
     237    UIListBtnType *m_LeftList;
     238    UIListBtnType *m_RightList;
     239    UITextType *m_Description, *m_LeftDesc, *m_RightDesc;
     240    UITextButtonType * m_ActionButtons[Action::MAX_KEYS];
     241    KeyBindings *m_KeyBindings;
     242    LayerSet *m_Container;
    241243
    242     QStringList contexts; ///< sorted list of contexts
     244    QStringList m_SortedContexts; ///< sorted list of contexts
    243245    QStringList keys; ///< sorted list of keys
    244246
    245     QDict<QStringList> m_contexts; ///< actions for a given context
    246     QDict<BindingList> contextKeys; ///< key bindings for a given context
    247     QDict<BindingList> keyActions; ///< actions in each context for a given key
     247    QDict<QStringList> m_Contexts; ///< actions for a given context
     248    QDict<BindingList> m_ContextKeys; ///< key bindings for a given context
     249    QDict<BindingList> m_KeyActions; ///< actions in each context for a given key
    248250
    249     typedef enum { kContextList, kKeyList, kActionList } ListType;
    250     ListType leftType, rightType;
     251    typedef enum {
     252        kContextList,
     253        kKeyList,
     254        kActionList
     255    } ListType;
    251256
    252     QString getTypeDesc(ListType type);
     257    ListType m_LeftType, m_RightType;
    253258
     259    QString GetTypeDesc(ListType type);
     260
    254261};
    255262
    256263
  • mythcontrols/keybindings.h

     
    6060     * @brief Get the hostname these keybindings are from.
    6161     * @return The hostname these keybindings are from.
    6262     */
    63     inline const QString & getHostname() const { return this->_hostname; }
     63    inline const QString & GetHostname() const
     64    {
     65        return this->m_Hostname;
     66    }
    6467
    6568    /**
    6669     * @brief Get a list of the context names.
     
    6871     * @note The returned list is a copy and can be modified without
    6972     * side-effects.
    7073     */
    71     inline QStringList * getContexts() const
     74    inline QStringList * GetContexts() const
    7275    {
    73         return actionset.contextStrings();
     76        return m_ActionSet.ContextStrings();
    7477    }
    7578
    7679    /**
     
    8083     * @note Store this instead of calling repeatedly.  Every time you
    8184     * do, ActionSet has to iterate over all contexts and actions.
    8285     */
    83     inline QStringList * getActions(const QString & context) const
     86    inline QStringList * GetActions(const QString & context) const
    8487    {
    85         return actionset.actionStrings(context);
     88        return m_ActionSet.ActionStrings(context);
    8689    }
    8790
    8891    /**
     
    9295     * @note Store this instead of calling repeatedly.  Every time you
    9396     * do, ActionSet has to iterate over all contexts and actions.
    9497     */
    95     inline void getKeyActions(const QString &key, ActionList &list) const
     98    inline void GetKeyActions(const QString &key, ActionList &list) const
    9699    {
    97         list = actionset.getActions(key);
     100        list = m_ActionSet.GetActions(key);
    98101    }
    99102
    100103    /**
     
    103106     * @param action_name The name of the action.
    104107     * @return The keys bound to the specified context's action
    105108     */
    106     inline QStringList getActionKeys(const QString & context_name,
     109    inline QStringList GetActionKeys(const QString & context_name,
    107110                                     const QString & action_name) const
    108111    {
    109         return actionset.getKeys(ActionID(context_name, action_name));
     112        return m_ActionSet.GetKeys(ActionID(context_name, action_name));
    110113    }
    111114
    112115    /**
     
    115118     * @param action_name The name of the action.
    116119     * @return The description of the specified context's action
    117120     */
    118     inline QString getActionDescription(const QString & context_name,
     121    inline QString GetActionDescription(const QString & context_name,
    119122                                        const QString & action_name) const
    120123    {
    121         return actionset.getDescription(ActionID(context_name, action_name));
     124        return m_ActionSet.GetDescription(ActionID(context_name,
     125                                                   action_name));
    122126    }
    123127
    124128    /**
     
    131135     * This does not take effect until the commitChanges function is
    132136     * called.
    133137     */
    134     inline void addActionKey(const QString & context_name,
     138    inline void AddActionKey(const QString & context_name,
    135139                             const QString & action_name,
    136140                             const QString & key)
    137141    {
    138         this->actionset.add(ActionID(context_name, action_name), key);
     142        this->m_ActionSet.Add(ActionID(context_name, action_name), key);
    139143    }
    140144
    141145    /**
     
    157161     * errors should be prevented no matter what.  If they dont like it,
    158162     * they can learn SQL.
    159163     */
    160     ActionID * conflicts(const QString & context_name,
     164    ActionID * Conflicts(const QString & context_name,
    161165                         const QString & key, int &level) const;
    162166
    163167    /**
     
    171175     * This does not take effect until the commitChanges function is
    172176     * called.
    173177     */
    174     inline void replaceActionKey(const QString & context_name,
     178    inline void ReplaceActionKey(const QString & context_name,
    175179                                 const QString & action_name,
    176180                                 const QString & newkey,
    177181                                 const QString & oldkey)
    178182    {
    179         this->actionset.replace(ActionID(context_name, action_name),
     183        this->m_ActionSet.Replace(ActionID(context_name, action_name),
    180184                                newkey, oldkey);
    181185    }
    182186
     
    187191     * @param key The key to remove.
    188192     * @return true if the key was removed, or false if it was not.
    189193     *
    190      * Unless the action is manditory there is only one key in the
     194     * Unless the action is Mandatory there is only one key in the
    191195     * action, this method should return true.
    192196     */
    193     bool removeActionKey(const QString & context_name,
     197    bool RemoveActionKey(const QString & context_name,
    194198                         const QString & action_name,
    195199                         const QString & key);
    196200
    197201    /**
    198      * @brief Set the manditory bindings to their defaults.
     202     * @brief Set the Mandatory bindings to their defaults.
    199203     */
    200     void defaultManditoryBindings(void);
     204    void DefaultMandatoryBindings(void);
    201205
    202206    /**
    203207     * @brief Determine if there are changes to the keybindings.
    204208     * @return True if keys have been changed, otherwise, false.
    205209     */
    206     inline bool hasChanges(void) const { return actionset.hasModified(); }
     210    inline bool HasChanges(void) const
     211    {
     212        return m_ActionSet.HasModified();
     213    }
    207214
    208215    /**
    209216     * @brief Commit all changes made to the keybindings.
     
    212219     * current bindings for those actions that changed, and setup the
    213220     * new bindings.
    214221     */
    215     void commitChanges(void);
     222    void CommitChanges(void);
    216223
    217224    /**
    218      * @brief Get a list of the manditory key bindings.
    219      * @return A list of the manditory bindings.
     225     * @brief Get a list of the Mandatory key bindings.
     226     * @return A list of the Mandatory bindings.
    220227     */
    221     inline const ActionList& getManditoryBindings(void) const
     228    inline const ActionList& GetMandatoryBindings(void) const
    222229    {
    223         return this->_manditory_bindings;
     230        return this->m_MandatoryBindings;
    224231    }
    225232
    226233    /**
    227      * @brief Determine if all manditory bindings are satisfied.
    228      * @return true if all manditory bindings are satisfied, otherwise, false.
     234     * @brief Determine if all Mandatory bindings are satisfied.
     235     * @return true if all mandatory bindings are satisfied, otherwise, false.
    229236     */
    230     bool hasManditoryBindings(void) const;
     237    bool HasMandatoryBindings(void) const;
    231238
    232239protected:
    233240
    234241    /**
    235      * @brief Get a reference to the hostname.
    236      * @return A reference to the hostname.
    237      */
    238     inline QString & hostname() { return this->_hostname; }
    239 
    240     /**
    241242     * @brief Commit a jumppoint to the database.
    242243     *
    243244     * This (currently) does not reload the jumppoint.
    244245     */
    245     void commitJumppoint(const ActionID &id);
     246    void CommitJumppoint(const ActionID &id);
    246247
    247248    /**
    248249     * @brief Commit an action to the database, and reload its keybindings.
    249250     */
    250     void commitAction(const ActionID & id);
     251    void CommitAction(const ActionID & id);
    251252
    252253    /**
    253254     * @brief Load the jumppoints from the database.
    254255     *
    255256     * This method will load the keybindings for jump points.
    256257     */
    257     void retrieveJumppoints(void);
     258    void RetrieveJumppoints(void);
    258259
    259260    /**
    260261     * @brief Load the keybindings from the database.
     
    262263     * This will load the keybindings which apply to the hostname
    263264     * specified to the constructor.
    264265     */
    265     void retrieveContexts(void);
     266    void RetrieveContexts(void);
    266267
    267268    /**
    268      * @brief Load the manditory bindings.
     269     * @brief Load the mandatory bindings.
    269270     */
    270     void loadManditoryBindings(void);
     271    void LoadMandatoryBindings(void);
    271272
    272273    /**
    273      * @brief Get a reference to the list of the manditory key bindings.
    274      * @return A reference to the list of the manditory bindings.
     274     * @brief Get a reference to the list of the mandatory key bindings.
     275     * @return A reference to the list of the mandatory bindings.
    275276     */
    276     inline ActionList & manditoryBindings(void) { return _manditory_bindings; }
     277    inline ActionList & MandatoryBindings(void)
     278    {
     279        return m_MandatoryBindings;
     280    }
    277281
    278282    /**
    279283     * @brief Get the default keys.
    280284     * @return A list of the default keys.
    281285     */
    282     inline QStringList & defaultKeys() { return _default_keys; }
     286    inline QStringList & DefaultKeys()
     287    {
     288        return m_DefaultKeys;
     289    }
    283290
    284291private:
    285292
    286     QString _hostname;
    287     ActionList _manditory_bindings;
    288     QStringList _default_keys;
    289     ActionSet actionset;
     293    QString m_Hostname;
     294    ActionList m_MandatoryBindings;
     295    QStringList m_DefaultKeys;
     296    ActionSet m_ActionSet;
    290297};
    291298
    292299#endif /* KEYBINDINGS_H */
  • mythcontrols/action.cpp

     
    3434
    3535Action::Action(const QString & description, const QString & keys)
    3636{
    37     this->description() = description;
    38     this->keys() = QStringList::split(", ", QString(QKeySequence(keys)));
     37    m_Description = description;
     38    m_Keys = QStringList::split(", ", QString(QKeySequence(keys)));
    3939}
    4040
    4141
    4242
    43 bool Action::hasKey(const QString & key) const
     43bool Action::HasKey(const QString & key) const
    4444{
    4545    /* check the keys */
    46     for (size_t i = 0; i < getKeys().count(); i++)
     46    for (size_t i = 0; i < GetKeys().count(); i++)
    4747    {
    48         if (getKeys()[i] == key) return true;
     48        if (GetKeys()[i] == key)
     49            return true;
    4950    }
    5051
    5152    /* the key was not found, so return false */
     
    5455
    5556
    5657
    57 bool Action::addKey(const QString & key)
     58bool Action::AddKey(const QString & key)
    5859{
    5960
    6061    /* dont add empty keys and dont add too many, or duplicates  */
    6162    if ((key.length() == 0) ||
    62         (getKeys().size() >= MAX_KEYS) ||
    63         (getKeys().contains(key)))
     63        (GetKeys().size() >= MAX_KEYS) ||
     64        (GetKeys().contains(key)))
    6465        return false;
    6566
    6667    /* add the key */
    67     this->keys().push_back(key);
     68    m_Keys.push_back(key);
    6869    return true;
    6970}
    7071
    7172
    7273
    7374/* comments in header */
    74 bool Action::replaceKey(const QString & newkey, const QString &oldkey)
     75bool Action::ReplaceKey(const QString & newkey, const QString &oldkey)
    7576{
    7677    /* make sure that the key list doesn't already have the new key */
    77     if (getKeys().contains(newkey) == 0)
     78    if (GetKeys().contains(newkey) == 0)
    7879    {
    79         for (size_t i = 0; i < getKeys().size(); i++)
     80        for (size_t i = 0; i < GetKeys().size(); i++)
    8081        {
    81             if (getKeys()[i] == oldkey)
     82            if (GetKeys()[i] == oldkey)
    8283            {
    83                 keys()[i] = newkey;
     84                m_Keys[i] = newkey;
    8485                return true;
    8586            }
    8687        }
  • mythcontrols/keygrabber.cpp

     
    2222 * 02111-1307, USA
    2323 */
    2424
    25 #include <iostream>
    26 
    2725using namespace std;
    2826
    2927#include "keygrabber.h"
     
    3432KeyGrabPopupBox::KeyGrabPopupBox(MythMainWindow *window)
    3533    : MythPopupBox(window, "keygrabber")
    3634{
    37     this->is_capturing = false;
    38     this->has_captured = false;
     35    m_IsCapturing = false;
     36    m_HasCaptured = false;
    3937    addLabel("Press A Key", Large, false);
    40     key_label = addLabel("Waiting for key press", Small, false);
     38    m_KeyLabel = addLabel("Waiting for key press", Small, false);
    4139
    42     ok_button = this->addButton(tr("OK"), this, SLOT(acceptBinding()));
    43     cancel_button = this->addButton(tr("Cancel"), this, SLOT(cancel()));
     40    m_OkButton = this->addButton(tr("OK"), this, SLOT(AcceptBinding()));
     41    m_CancelButton = this->addButton(tr("Cancel"), this, SLOT(Cancel()));
    4442
    4543    this->grabKeyboard();
    4644}
     
    4947
    5048void KeyGrabPopupBox::keyReleaseEvent(QKeyEvent *e)
    5149{
    52     if (!this->is_capturing) return;
     50    if (!this->m_IsCapturing)
     51        return;
    5352
    5453    /* now we have an event, so we are not capturing */
    55     this->has_captured = true;
    56     this->is_capturing = false;
     54    this->m_HasCaptured = true;
     55    this->m_IsCapturing = false;
    5756
    5857    /* get the base name of the qkeysequence */
    5958    QString key_name = QString(QKeySequence(e->key()));
     
    6463        QString modifiers;
    6564
    6665        /* key modifier strings as defined by the QT docs */
    67         if (e->state()&Qt::ShiftButton) modifiers+="Shift+";
    68         if (e->state()&Qt::ControlButton) modifiers+="Ctrl+";
    69         if (e->state()&Qt::AltButton) modifiers+="Alt+";
    70         if (e->state()&Qt::MetaButton) modifiers+="Meta+";
     66        if (e->state()&Qt::ShiftButton)
     67            modifiers+="Shift+";
     68        if (e->state()&Qt::ControlButton)
     69            modifiers+="Ctrl+";
     70        if (e->state()&Qt::AltButton)
     71            modifiers+="Alt+";
     72        if (e->state()&Qt::MetaButton)
     73            modifiers+="Meta+";
    7174        key_name = modifiers + key_name;
    7275    }
    7376
    7477    /* keys without a name are no good to us */
    7578    if (key_name.isEmpty())
    7679    {
    77         key_label->setText(tr("Pressed key not recognized"));
    78         ok_button->setDisabled(true);
    79         cancel_button->setFocus();
     80        m_KeyLabel->setText(tr("Pressed key not recognized"));
     81        m_OkButton->setDisabled(true);
     82        m_CancelButton->setFocus();
    8083    }
    8184    else
    8285    {
    83         captured_key_event = key_name;
    84         key_label->setText(tr("Add key '%1'?").arg(key_name));
    85         ok_button->setFocus();
     86        m_CapturedKeyEvent = key_name;
     87        m_KeyLabel->setText(tr("Add key '%1'?").arg(key_name));
     88        m_OkButton->setFocus();
    8689    }
    8790
    8891    releaseKeyboard();
     
    9295
    9396void KeyGrabPopupBox::keyPressEvent(QKeyEvent *e)
    9497{
    95 
    9698    /* if no capturing has occured yet, then start */
    97     if (!has_captured) this->is_capturing = true;
     99    if (!m_HasCaptured)
     100        this->m_IsCapturing = true;
    98101
    99102    /* accept events while we are capturing */
    100     if (this->is_capturing) e->accept();
    101     else MythPopupBox::keyPressEvent(e);
     103    if (this->m_IsCapturing)
     104        e->accept();
     105    else
     106        MythPopupBox::keyPressEvent(e);
    102107}
    103108
    104109InvalidBindingPopup::InvalidBindingPopup(MythMainWindow *window)
     
    131136    : MythPopupBox(window, "optionmenu")
    132137{
    133138    addLabel(tr("Options"), Large, false);
    134     addButton(tr("Save"), this, SLOT(save()));
    135     addButton(tr("Cancel"), this, SLOT(cancel()))->setFocus();
     139    addButton(tr("Save"), this, SLOT(Save()));
     140    addButton(tr("Cancel"), this, SLOT(Cancel()))->setFocus();
    136141}
    137142   
    138143
     
    140145    : MythPopupBox(window, "actionmenu")
    141146{
    142147    addLabel(tr("Modify Action"), Large, false);
    143     addButton(tr("Set Binding"), this, SLOT(set()));
    144     addButton(tr("Remove Binding"), this, SLOT(remove()));
    145     addButton(tr("Cancel"), this, SLOT(cancel()))->setFocus();
     148    addButton(tr("Set Binding"), this, SLOT(Set()));
     149    addButton(tr("Remove Binding"), this, SLOT(Remove()));
     150    addButton(tr("Cancel"), this, SLOT(Cancel()))->setFocus();
    146151}
    147152
    148153UnsavedMenu::UnsavedMenu(MythMainWindow *window)
     
    150155{
    151156    addLabel(tr("Unsaved Changes"), Large, false);
    152157    addLabel(tr("Exiting...") + "\n\n" + tr("Save Changes?"));
    153     addButton(tr("Yes"), this, SLOT(save()))->setFocus();
    154     addButton(tr("No"), this, SLOT(cancel()));
     158    addButton(tr("Yes"), this, SLOT(Save()))->setFocus();
     159    addButton(tr("No"), this, SLOT(Cancel()));
    155160}
    156161
    157162ConfirmMenu::ConfirmMenu(MythMainWindow *window, QString msg)
     
    159164{
    160165    addLabel(tr("Confirm"), Large, false);
    161166    addLabel(msg);
    162     addButton(tr("Confirm"), this, SLOT(confirm()))->setFocus();
    163     addButton(tr("Cancel"), this, SLOT(cancel()));
     167    addButton(tr("Confirm"), this, SLOT(Confirm()))->setFocus();
     168    addButton(tr("Cancel"), this, SLOT(Cancel()));
    164169}