Ticket #2239: mythcontrols-20060910.diff

File mythcontrols-20060910.diff, 3.9 KB (added by navahogunleg@…, 18 years ago)

Updated, bugfixed version: I noticed today MythControls? wasn't accepting regular keys now due to a wrongly placed 'else'. :]

  • mythcontrols/mythcontrols/action.h

     
    2626
    2727#include <qstring.h>
    2828#include <qstringlist.h>
     29#include <mythtv/mythkeysequence.h>
    2930
    3031/**
    3132 * @class Action
  • mythcontrols/mythcontrols/mythcontrols.cpp

     
    389389    if (key.left(6) == "remote") {
    390390        key = KeyToDisplay(key);
    391391    } else {
    392         key = QString(QKeySequence(e->key()));
    393         if (key.isEmpty()) return false;
    394         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+";
    399         key = modifiers + key;
     392#ifdef USE_LIRC
     393        if (key.left( 2 ) != "ir")
     394        {
     395#endif // USE_LIRC
     396            key = QString(QKeySequence(e->key()));
     397            if (key.isEmpty()) return false;
     398            QString modifiers = "";
     399            if (e->state()&Qt::ShiftButton) modifiers+="Shift+";
     400            if (e->state()&Qt::ControlButton) modifiers+="Ctrl+";
     401            if (e->state()&Qt::AltButton) modifiers+="Alt+";
     402            if (e->state()&Qt::MetaButton) modifiers+="Meta+";
     403            key = modifiers + key;
     404#ifdef USE_LIRC
     405        }
     406#endif // USE_LIRC
    400407    }
    401408
    402409    UIListBtnTypeItem *b;
     
    926933        QString key = *it;
    927934
    928935        QString keydesc = "3 ";
    929         if (key.left(6) == "remote")
     936        if ((key.left(6) == "remote") || (key.left(2) == "ir"))
    930937        {
    931938            keydesc = "0 ";
    932939        }
  • mythcontrols/mythcontrols/mythcontrols.h

     
    2626
    2727#include <mythtv/mythdialogs.h>
    2828#include <mythtv/uilistbtntype.h>
     29#include <mythtv/mythkeysequence.h>
    2930
    3031#include "keybindings.h"
    3132
  • mythcontrols/mythcontrols/action.cpp

     
    3535Action::Action(const QString & description, const QString & keys)
    3636{
    3737    this->description() = description;
    38     this->keys() = QStringList::split(", ", QString(QKeySequence(keys)));
     38    this->keys() = QStringList::split(", ", QString(MythKeySequence(keys)));
    3939}
    4040
    4141
  • mythcontrols/mythcontrols/keygrabber.cpp

     
    2929#include "keygrabber.h"
    3030
    3131#include <mythtv/mythcontext.h>
     32#include <mythtv/mythkeysequence.h>
    3233
    3334
    3435KeyGrabPopupBox::KeyGrabPopupBox(MythMainWindow *window)
     
    5859    /* get the base name of the qkeysequence */
    5960    QString key_name = QString(QKeySequence(e->key()));
    6061
     62    if ((e->text().length( ) > 6) && (e->text().left(6) == "remote"))
     63    {
     64        captured_key_event = e->text( );
     65        key_label->setText(tr("Add button '[%1]'?").arg(e->text().mid(6)));
     66        ok_button->setFocus();
     67    }
     68    else
    6169    /* if we really have a key, then process it */
    6270    if (!key_name.isEmpty() && !key_name.isNull())
    6371    {
     
    7078        if (e->state()&Qt::MetaButton) modifiers+="Meta+";
    7179        key_name = modifiers + key_name;
    7280    }
    73 
     81   
    7482    /* keys without a name are no good to us */
    7583    if (key_name.isEmpty())
    7684    {