Ticket #4885: osd.rtl.v5.patch

File osd.rtl.v5.patch, 4.7 KB (added by Tony Arie Kolev <kolevtony@…>, 15 years ago)

Tested and reccommended

  • mythtv/libs/libmythtv/osdlistbtntype.cpp

     
    6565    m_hmult        = (hmult == 0.0f) ? 1.0f : hmult;
    6666    m_unbiasedarea = unbias(area,      wmult, hmult);
    6767    m_unbiasedsize = unbias(levelsize, wmult, hmult);
     68
     69    if (gContext->GetLanguage()=="he")
     70        m_isRtl = true;
     71    else
     72        m_isRtl = false;
    6873}
    6974
    7075OSDListTreeType::~OSDListTreeType()
     
    140145    {
    141146        QString levelname = QString("level%1").arg(i + 1);
    142147        QRect curlevelarea = m_levelsize;
    143         curlevelarea.moveBy(m_totalarea.x(), m_totalarea.y());
    144         curlevelarea.moveBy((m_levelsize.width() + m_levelspacing) * i, 0);
     148       
     149// if we are left to right
     150        if (false == m_isRtl)
     151        {
     152                curlevelarea.moveBy(m_totalarea.x(), m_totalarea.y()); 
     153                curlevelarea.moveBy((m_levelsize.width() + m_levelspacing) * i, 0);
     154        }
     155       
     156// if we are right to left
     157        else
     158        {
     159                curlevelarea.moveBy(m_totalarea.width(), m_totalarea.y());
     160                curlevelarea.moveBy( ((-1 - i) * m_levelsize.width()) - m_levelspacing,0);
     161        }
    145162
    146163        OSDListBtnType *newlevel = new OSDListBtnType(
    147164            levelname, curlevelarea, m_wmult, m_hmult, true);
     
    214231        GetLevel(m_levelnum)->MovePageDown();
    215232        EnterItem();
    216233    }
    217     else if (has_action("LEFT", actions) && (m_levelnum > 0))
     234    else if (!m_isRtl && has_action("LEFT", actions) && (m_levelnum > 0))
    218235    {
    219236        GetLevel(m_levelnum)->Reset();
    220237        GetLevel(m_levelnum)->SetVisible(false);
     
    222239        m_levelnum--;
    223240        EnterItem();
    224241    }
    225     else if ((has_action("LEFT", actions) && m_arrowAccel) ||
     242    else if (m_isRtl && has_action("LEFT",actions))
     243        {
     244                // Right to left - left acts as select / advance one stage
     245                if ((m_levelnum + 1 < m_depth) &&
     246                    (currentpos->childCount() > 0))     
     247                {
     248                        GetLevel(m_levelnum)->SetActive(false);
     249                        m_levelnum++;
     250               
     251                        FillLevelFromTree(currentpos, m_levelnum);
     252                        GetLevel(m_levelnum)->SetVisible(true);
     253                        EnterItem();
     254                }
     255                else
     256                {
     257                        SelectItem();
     258                }
     259        }       
     260    else if ((!m_isRtl &&  has_action("LEFT", actions) && m_arrowAccel) ||
    226261             has_action("ESCAPE",   actions) ||
    227262             has_action("CLEAROSD", actions) ||
    228263             has_action("MENU",     actions))
    229264    {
    230265        m_visible = false;
    231266    }
    232     else if (has_action("RIGHT", actions) &&
     267    else if (!m_isRtl && has_action("RIGHT", actions) &&
    233268             (m_levelnum + 1 < m_depth) &&
    234269             (currentpos->childCount() > 0))
    235270    {
     
    240275        GetLevel(m_levelnum)->SetVisible(true);
    241276        EnterItem();
    242277    }
    243     else if ((has_action("RIGHT", actions) && m_arrowAccel) ||
     278    else if ((!m_isRtl && has_action("RIGHT", actions) && m_arrowAccel) ||
    244279             has_action("SELECT", actions))
    245280    {
    246281        SelectItem();
    247282    }
     283    else if ((true ==m_isRtl) && has_action("RIGHT",actions) && (m_levelnum > 0))
     284        {
     285                GetLevel(m_levelnum)->Reset();
     286                GetLevel(m_levelnum)->SetVisible(false);
     287       
     288                m_levelnum--;
     289                EnterItem();
     290        }
     291
    248292    else
    249293    {
    250294        return false;
     
    662706    LoadPixmap(m_checkNonePix, "check-empty");
    663707    LoadPixmap(m_checkHalfPix, "check-half");
    664708    LoadPixmap(m_checkFullPix, "check-full");
    665     LoadPixmap(m_arrowPix, "arrow");
     709    if (gContext->GetLanguage()=="he")
     710       LoadPixmap(m_arrowPix, "ltarrow");
     711    else
     712       LoadPixmap(m_arrowPix, "arrow");
    666713
    667714    uint itemWidth = (m_rect.width() + 1) & (~1);
    668715
     
    751798    if (m_checkable)
    752799        m_checkRect  = QRect(margin, (height - ch)/2, cw, ch);
    753800
    754     if (m_showArrow)
    755         m_arrowRect  = QRect(width - aw - margin, (height - ah)/2, aw, ah);
     801    if (m_showArrow)
     802        if (gContext->GetLanguage() == "he")
     803                m_arrowRect  = QRect(m_parent->m_contentsRect.x() + margin, (height - ah)/2, aw, ah);
     804        else
     805                m_arrowRect  = QRect(width - aw - margin, (height - ah)/2, aw, ah);
     806       
    756807
    757808    if (m_pixmap)
    758809    {
     
    765816    tx += (m_pixmap)    ? m_pixmapRect.width() + margin : 0;
    766817    tw -= (m_checkable) ? m_checkRect.width()  + margin : 0;
    767818    tw -= (m_showArrow) ? m_arrowRect.width()  + margin : 0;
     819   
     820    if (gContext->GetLanguage()=="he")
     821        tx += (m_showArrow) ? m_arrowRect.width()  + margin : 0;
     822
    768823    tw -= (m_pixmap)    ? m_pixmapRect.width() + margin : 0;
    769824    m_textRect = QRect(tx, 0, tw, height);
    770825    rtl=new RTL();
  • mythtv/libs/libmythtv/osdlistbtntype.h

     
    152152    int       m_levelnum;
    153153    bool      m_visible;
    154154    bool      m_arrowAccel;
     155    bool      m_isRtl;
    155156};
    156157 
    157158class OSDListBtnType : public OSDType