Ticket #4885: 4885-v2.patch

File 4885-v2.patch, 21.1 KB (added by danielk, 15 years ago)

oops, missed some files and this is actually based on #6004

  • themes/ProjectGrayhem-OSD/osd.xml

     
    284284        <position>0,320</position>
    285285      </image>
    286286    <textarea name="settings">
    287       <area>50,335,350,32</area>
     287      <area>50,335,250,32</area>
    288288      <font>settings</font>
    289289    </textarea>
    290290  </container>
     
    307307      <multiline>yes</multiline>
    308308   </textarea>
    309309   <textarea name="option1">
    310       <area>120,269,455,30</area>
     310      <area>120,269,395,30</area>
    311311      <font>notify</font>
    312312      <altfont>grayfont</altfont>
    313313   </textarea>
    314314   <textarea name="option2">
    315       <area>120,299,455,30</area>
     315      <area>120,299,395,30</area>
    316316      <font>notify</font>
    317317      <altfont>grayfont</altfont>
    318318   </textarea>
    319319   <textarea name="option3">
    320       <area>120,329,455,30</area>
     320      <area>120,329,395,30</area>
    321321      <font>notify</font>
    322322      <altfont>grayfont</altfont>
    323323   </textarea>
    324324   <textarea name="option4">
    325       <area>120,359,455,30</area>
     325      <area>120,359,395,30</area>
    326326      <font>notify</font>
    327327      <altfont>grayfont</altfont>
    328328   </textarea>
  • themes/blootube-osd/osd.xml

     
    286286        <position>30,30</position>
    287287      </image>
    288288    <textarea name="settings">
    289       <area>50,50,350,32</area>
     289      <area>50,50,250,32</area>
    290290      <font>settings</font>
    291291    </textarea>
    292292  </container>
     
    309309      <multiline>yes</multiline>
    310310   </textarea>
    311311   <textarea name="option1">
    312       <area>120,269,455,30</area>
     312      <area>120,269,395,30</area>
    313313      <font>notify</font>
    314314      <altfont>grayfont</altfont>
    315315   </textarea>
    316316   <textarea name="option2">
    317       <area>120,299,455,30</area>
     317      <area>120,299,395,30</area>
    318318      <font>notify</font>
    319319      <altfont>grayfont</altfont>
    320320   </textarea>
    321321   <textarea name="option3">
    322       <area>120,329,455,30</area>
     322      <area>120,329,395,30</area>
    323323      <font>notify</font>
    324324      <altfont>grayfont</altfont>
    325325   </textarea>
    326326   <textarea name="option4">
    327       <area>120,359,455,30</area>
     327      <area>120,359,395,30</area>
    328328      <font>notify</font>
    329329      <altfont>grayfont</altfont>
    330330   </textarea>
  • myththemes/Gray-OSD/osd.xml

     
    425425      <multiline>yes</multiline>
    426426   </textarea>
    427427   <textarea name="option1">
    428       <area>100,255,455,30</area>
     428      <area>100,255,395,30</area>
    429429      <font>infofont</font>
    430430      <altfont>infofontgray</altfont>
    431431   </textarea>
    432432   <textarea name="option2">
    433       <area>100,285,455,30</area>
     433      <area>100,285,395,30</area>
    434434      <font>infofont</font>
    435435      <altfont>infofontgray</altfont>
    436436   </textarea>
    437437   <textarea name="option3">
    438       <area>100,315,455,30</area>
     438      <area>100,315,395,30</area>
    439439      <font>infofont</font>
    440440      <altfont>infofontgray</altfont>
    441441   </textarea>
    442442   <textarea name="option4">
    443       <area>100,345,455,30</area>
     443      <area>100,345,395,30</area>
    444444      <font>infofont</font>
    445445      <altfont>infofontgray</altfont>
    446446   </textarea>
    447447   <textarea name="option5">
    448       <area>100,375,455,30</area>
     448      <area>100,375,395,30</area>
    449449      <font>infofont</font>
    450450      <altfont>infofontgray</altfont>
    451451    </textarea>
  • myththemes/Titivillus-OSD/osd.xml

     
    359359
    360360  <container name="settings">
    361361    <textarea name="settings">
    362       <area>50,50,350,32</area>
     362      <area>50,50,250,32</area>
    363363      <font>settings</font>
    364364    </textarea>
    365365  </container>
  • myththemes/isthmus/osd.xml

     
    315315
    316316  <container name="settings">
    317317    <textarea name="settings">
    318       <area>50,50,350,32</area>
     318      <area>50,50,250,32</area>
    319319      <font>settings</font>
    320320    </textarea>
    321321  </container>
     
    339339      <multiline>yes</multiline>
    340340   </textarea>
    341341   <textarea name="option1">
    342       <area>100,255,455,30</area>
     342      <area>100,255,395,30</area>
    343343      <font>infofont</font>
    344344      <altfont>infofontgray</altfont>
    345345   </textarea>
    346346   <textarea name="option2">
    347       <area>100,285,455,30</area>
     347      <area>100,285,395,30</area>
    348348      <font>infofont</font>
    349349      <altfont>infofontgray</altfont>
    350350   </textarea>
    351351   <textarea name="option3">
    352       <area>100,315,455,30</area>
     352      <area>100,315,395,30</area>
    353353      <font>infofont</font>
    354354      <altfont>infofontgray</altfont>
    355355   </textarea>
    356356   <textarea name="option4">
    357       <area>100,345,455,30</area>
     357      <area>100,345,395,30</area>
    358358      <font>infofont</font>
    359359      <altfont>infofontgray</altfont>
    360360   </textarea>
    361361   <textarea name="option5">
    362       <area>100,375,455,30</area>
     362      <area>100,375,395,30</area>
    363363      <font>infofont</font>
    364364      <altfont>infofontgray</altfont>
    365365    </textarea>
  • myththemes/Iulius-OSD/osd.xml

     
    251251
    252252  <container name="settings">
    253253    <textarea name="settings">
    254       <area>64,85,350,32</area>
     254      <area>64,85,264,32</area>
    255255      <font>settings</font>
    256256    </textarea>
    257257  </container>
  • myththemes/Retro-OSD/osd.xml

     
    297297        <position>30,30</position>
    298298      </image>
    299299    <textarea name="settings">
    300       <area>50,50,350,32</area>
     300      <area>50,50,250,32</area>
    301301      <font>settings</font>
    302302    </textarea>
    303303  </container>
     
    321321      <multiline>yes</multiline>
    322322   </textarea>
    323323   <textarea name="option1">
    324       <area>120,239,455,30</area>
     324      <area>120,239,395,30</area>
    325325      <font>notify</font>
    326326      <altfont>grayfont</altfont>
    327327   </textarea>
    328328   <textarea name="option2">
    329       <area>120,269,455,30</area>
     329      <area>120,269,395,30</area>
    330330      <font>notify</font>
    331331      <altfont>grayfont</altfont>
    332332   </textarea>
    333333   <textarea name="option3">
    334       <area>120,299,455,30</area>
     334      <area>120,299,395,30</area>
    335335      <font>notify</font>
    336336      <altfont>grayfont</altfont>
    337337   </textarea>
    338338   <textarea name="option4">
    339       <area>120,329,455,30</area>
     339      <area>120,329,395,30</area>
    340340      <font>notify</font>
    341341      <altfont>grayfont</altfont>
    342342   </textarea>
    343343   <textarea name="option5">
    344       <area>120,359,455,30</area>
     344      <area>120,359,395,30</area>
    345345      <font>notify</font>
    346346      <altfont>grayfont</altfont>
    347347    </textarea>
  • mythtv/themes/defaultosd/osd.xml

     
    239239
    240240  <container name="settings">
    241241    <textarea name="settings">
    242       <area>50,50,350,32</area>
     242      <area>50,50,250,32</area>
    243243      <font>settings</font>
    244244    </textarea>
    245245  </container>
  • mythtv/themes/blueosd/osd.xml

     
    276276
    277277  <container name="settings">
    278278    <textarea name="settings">
    279       <area>50,50,350,32</area>
     279      <area>50,50,250,32</area>
    280280      <font>settings</font>
    281281    </textarea>
    282282  </container>
  • mythtv/libs/libmythtv/osdlistbtntype.cpp

     
    760760      m_group(QString::null), m_state(state),
    761761      m_showArrow(showArrow), m_checkable(checkable),
    762762      m_checkRect(0,0,0,0),   m_arrowRect(0,0,0,0),
    763       m_pixmapRect(0,0,0,0),  m_textRect(0,0,0,0)
     763      m_pixmapRect(0,0,0,0),  m_textRect(0,0,0,0),
     764      m_rtl(new RTL())
    764765{
    765766    if (!m_parent->m_initialized)
    766767        m_parent->Init();
     
    805806{
    806807    if (m_parent)
    807808        m_parent->RemoveItem(this);
     809    if (m_rtl)
     810        delete m_rtl;
    808811}
    809812
    810813void OSDListBtnTypeItem::paint(OSDSurface *surface, TTFFont *font,
     
    858861    QRect tr(m_textRect);
    859862    tr.translate(x, y);
    860863    tr.translate(0, font->Size() / 4);
    861     font->DrawString(surface, tr.x(), tr.y(), m_text, tr.right(), tr.bottom());
     864
     865    bool isRTL = false;
     866    QString message = m_rtl->ConvertFromRtoL(m_text, isRTL);
     867    if (isRTL)
     868    {
     869        int textlength = 0;
     870        font->CalcWidth(m_text, &textlength);
     871        int xoffset = tr.width() - textlength;
     872        if (xoffset > 0)
     873            tr.translate(xoffset, 0);
     874    }
     875    font->DrawString(surface, tr.x(), tr.y(), message, tr.right(), tr.bottom());
    862876}
  • mythtv/libs/libmythtv/osdtypes.cpp

     
    1919#include "libmyth/mythdialogs.h"
    2020#include "libmythdb/mythverbose.h"
    2121
    22 #ifdef USING_FRIBIDI
    23     #include "fribidi/fribidi.h"
    24     #include <QTextCodec>
    25 #endif // USING_FRIBIDI
    26 
    2722/// Shared OSD image cache
    2823OSDImageCache OSDTypeImage::c_cache;
    2924
     
    698693    m_scrollposy(0),
    699694    m_scrollinit(false),
    700695    m_linespacing(1.5f),
    701     m_draw_info_str(QString::null), m_draw_info_len(0),
    702     codeci(NULL)
     696    m_draw_info_str(QString::null), m_rtl(new RTL())
    703697{
    704698}
    705699
     
    722716    m_scrollposy(0),
    723717    m_scrollinit(false),
    724718    m_linespacing(1.5f),
    725     m_draw_info_str(QString::null), m_draw_info_len(0),
    726     codeci(NULL)
     719    m_draw_info_str(QString::null), m_rtl(new RTL())
    727720{
    728721    QMutexLocker locker(&other.m_lock);
    729722
     
    766759
    767760OSDTypeText::~OSDTypeText()
    768761{
     762    if (m_rtl)
     763        delete m_rtl;
    769764}
    770765
    771766void OSDTypeText::SetAltFont(TTFFont *font)
     
    774769    m_altfont = font;
    775770}
    776771
    777 QString OSDTypeText::BasicConvertFromRtoL(const QString &text)
    778 {
    779     QStringList rtl_string_composer;
    780     bool handle_rtl = false;
    781     QChar prev_char;
    782 
    783     // Handling Right-to-Left languages.
    784     // Left-to-Right languages are not affected.
    785     for (int i = (int)text.length() - 1; i >= 0; i--)
    786     {
    787         QChar::Direction text_dir = text[i].direction();
    788         if (text_dir != QChar::DirR &&
    789             text_dir != QChar::DirRLE &&
    790             text_dir != QChar::DirRLO)
    791         {
    792             if (handle_rtl || rtl_string_composer.empty())
    793                 rtl_string_composer.append(QString());
    794 
    795             if (text[i].isSpace() && !prev_char.isNull()
    796                     && prev_char.isDigit() && handle_rtl)
    797                 rtl_string_composer.back().append(text[i]);
    798             else
    799                 rtl_string_composer.back().prepend(text[i]);
    800 
    801             prev_char = text[i];
    802 
    803             handle_rtl = false;
    804         }
    805         else
    806         {
    807             if (!handle_rtl)
    808             {
    809                 rtl_string_composer.append(QString());
    810                 handle_rtl = true;
    811                 prev_char = QChar();
    812             }
    813             rtl_string_composer.back().append(text[i]);
    814         }
    815     }
    816 
    817     QString output = rtl_string_composer.join("");
    818 
    819     return output;
    820 }
    821 
    822 QString OSDTypeText::ConvertFromRtoL(const QString &text) const
    823 {
    824     QString output = BasicConvertFromRtoL(text);
    825 
    826 #ifdef USING_FRIBIDI
    827     QMutexLocker locker(&fribidi_lock);
    828     if (!codeci)
    829         codeci = QTextCodec::codecForName("utf8");
    830 
    831     if (!codeci)
    832         return output;
    833 
    834     QByteArray temp = codeci->fromUnicode(output);
    835 
    836     FriBidiCharType base;
    837     size_t len;
    838 
    839     bool fribidi_flip_commas = true;
    840     base = (fribidi_flip_commas) ? FRIBIDI_TYPE_ON : FRIBIDI_TYPE_L;
    841 
    842     std::vector<FriBidiChar> logical(temp.length() + 1);
    843     std::vector<FriBidiChar> visual(temp.length() + 1);
    844 
    845     int char_set_num = fribidi_parse_charset("UTF-8");
    846 
    847     len = fribidi_charset_to_unicode((FriBidiCharSet) char_set_num,
    848                                      temp.constData(), temp.length(),
    849                                      &logical[0]);
    850 
    851     bool log2vis = fribidi_log2vis(&logical[0], len, &base, &visual[0], NULL,
    852                                    NULL, NULL); // output
    853 
    854     if (log2vis)
    855         len = fribidi_remove_bidi_marks(&visual[0], len, NULL, NULL, NULL);
    856  
    857     output = "";
    858     for (size_t i = 0; i < len ; i++)
    859         output += QChar(visual[i]);
    860 #endif // USING_FRIBIDI
    861 
    862     return output;
    863 }
    864 
    865772void OSDTypeText::SetText(const QString &text)
    866773{
    867774    QMutexLocker locker(&m_lock);
    868     m_message    = ConvertFromRtoL(text);
     775    m_message    = text; m_message.detach();
    869776    m_cursorpos  = m_message.length();
    870777    m_scrollinit = false;
    871778}
     
    873780QString OSDTypeText::GetText(void) const
    874781{
    875782    QMutexLocker locker(&m_lock);
    876     return m_message;
     783    QString tmp = m_message; tmp.detach();
     784    return tmp;
    877785}
    878786
    879787void OSDTypeText::SetDefaultText(const QString &text)
    880788{
    881789    QMutexLocker locker(&m_lock);
    882     m_message     = ConvertFromRtoL(text);
    883     m_default_msg = m_message;
     790    m_message     = text; m_message.detach();
     791    m_default_msg = text; m_default_msg.detach();
    884792    m_scrollinit  = false;
    885793}
    886794
    887795QString OSDTypeText::GetDefaultText(void) const
    888796{
    889797    QMutexLocker locker(&m_lock);
    890     return m_default_msg;
     798    QString tmp = m_default_msg; tmp.detach();
     799    return tmp;
    891800}
    892801
    893802void OSDTypeText::SetMultiLine(bool multi)
     
    10911000    if (text != m_draw_info_str)
    10921001    {
    10931002        m_draw_info_str = text;
     1003        m_draw_info_str.detach();
    10941004        m_draw_info.clear();
    10951005        m_draw_info_len = 0;
    10961006
     
    12031113{
    12041114    QMutexLocker locker(&m_lock);
    12051115
     1116    bool isRTL = false;
     1117    QString msg = m_rtl->ConvertFromRtoL(text, isRTL);
     1118    m_right |= isRTL;
     1119
    12061120    if (m_centered || m_right)
    12071121    {
    12081122        int textlength = 0;
     
    12281142    if ((m_usingalt || m_selected) && m_altfont)
    12291143        font = m_altfont;
    12301144
    1231     font->DrawString(surface, rect.left(), rect.top(), text,
     1145    font->DrawString(surface, rect.left(), rect.top(), msg,
    12321146                     rect.right(), rect.bottom(), alphamod, doubl);
    12331147
    12341148    // draw cursor
  • mythtv/libs/libmythtv/libmythtv.pro

     
    269269    HEADERS += osd.h                    osdtypes.h
    270270    HEADERS += osdsurface.h             osdlistbtntype.h
    271271    HEADERS += osdimagecache.h          osdtypeteletext.h
    272     HEADERS += udpnotify.h
     272    HEADERS += rtl.h                    udpnotify.h
    273273    SOURCES += osd.cpp                  osdtypes.cpp
    274274    SOURCES += osdsurface.cpp           osdlistbtntype.cpp
    275275    SOURCES += osdimagecache.cpp        osdtypeteletext.cpp
    276     SOURCES += udpnotify.cpp
     276    SOURCES += rtl.cpp                  udpnotify.cpp
    277277
    278278    # Video output
    279279    HEADERS += videooutbase.h           videoout_null.h
  • mythtv/libs/libmythtv/osdtypes.h

     
    1212#include <qcolor.h>
    1313#include "cc708window.h"
    1414#include "osdimagecache.h"
     15#include "rtl.h"
    1516
    1617using namespace std;
    1718
     
    238239    void SetButton(bool is_button)      { m_button = is_button;     }
    239240    void SetEntryNum(int entrynum)      { m_entrynum = entrynum;    }
    240241
    241     QString ConvertFromRtoL(const QString &text) const;
    242242
    243     static QString BasicConvertFromRtoL(const QString &text);
    244 
    245243  protected:
    246244    ~OSDTypeText();
    247245
     
    292290    mutable uint    m_draw_info_len;
    293291    mutable vector<DrawInfo> m_draw_info;
    294292
    295     mutable QMutex      fribidi_lock;
    296     mutable QTextCodec *codeci;
     293    RTL *m_rtl;
    297294};
    298295   
    299296class OSDTypeImage : public OSDType
  • mythtv/libs/libmythtv/rtl.cpp

     
     1/*
     2 * Right To Left Languages manipulation for OSD
     3 *
     4 * Copyright Ido Roseman, Daniel Kristjansson, Tony Arie Kolev 2006 - 2008
     5 *
     6 * Distributed as part of MythTV under the GPLv2, or at our option a later
     7 * version of the GPL. See COPYING which should accompany this for details.
     8 */
     9
     10#include <QStringList>
     11
     12#include "rtl.h"
     13
     14#ifdef USING_FRIBIDI
     15#   include "fribidi/fribidi.h"
     16#   include <QTextCodec>
     17#endif // USING_FRIBIDI
     18
     19static QString BasicConvertFromRtoL(const QString &text, bool &isRTL)
     20{
     21    QStringList rtl_string_composer;
     22    bool handle_rtl = false;
     23    QChar prev_char;
     24
     25    isRTL = false;
     26
     27    // Handling Right-to-Left languages.
     28    // Left-to-Right languages are not affected.
     29    for (int i = (int)text.length() - 1; i >= 0; i--)
     30    {
     31        QChar::Direction text_dir = text[i].direction();
     32        if (text_dir != QChar::DirR &&
     33            text_dir != QChar::DirRLE &&
     34            text_dir != QChar::DirRLO)
     35        {
     36            if (handle_rtl || rtl_string_composer.empty())
     37                rtl_string_composer.append(QString());
     38
     39            if (text[i].isSpace() && !prev_char.isNull()
     40                    && prev_char.isDigit() && handle_rtl)
     41                rtl_string_composer.back().append(text[i]);
     42            else
     43                rtl_string_composer.back().prepend(text[i]);
     44
     45            prev_char = text[i];
     46
     47            handle_rtl = false;
     48        }
     49        else
     50        {
     51            if (!handle_rtl)
     52            {
     53                rtl_string_composer.append(QString());
     54                handle_rtl = true;
     55                prev_char = QChar();
     56            }
     57            rtl_string_composer.back().append(text[i]);
     58            isRTL = true;
     59        }
     60    }
     61
     62    QString output = rtl_string_composer.join("");
     63    output.detach();
     64    return output;
     65}
     66
     67QString RTL::ConvertFromRtoL(const QString &text, bool &isRTL) const
     68{
     69#ifndef USING_FRIBIDI
     70    return BasicConvertFromRtoL(text, isRTL);
     71#else
     72    isRTL = false;
     73    QString output = text;
     74    QMutexLocker locker(&fribidi_lock);
     75    if (!codeci)
     76        codeci = QTextCodec::codecForName("utf8");
     77
     78    if (!codeci)
     79        return output;
     80
     81    QCString temp = codeci->fromUnicode(output);
     82
     83    FriBidiCharType base;
     84    size_t len;
     85   
     86
     87    bool fribidi_flip_commas = true;
     88    base = (fribidi_flip_commas) ? FRIBIDI_TYPE_ON : FRIBIDI_TYPE_L;
     89
     90    const char *ip = temp;
     91    FriBidiChar logical[strlen(ip) + 1], visual[strlen(ip) + 1];
     92
     93    int char_set_num = fribidi_parse_charset("UTF-8");
     94
     95    len = fribidi_charset_to_unicode(
     96        (FriBidiCharSet) char_set_num, ip, strlen(ip), logical);
     97
     98    FriBidiLevel embedding_level_list[len];
     99    FriBidiStrIndex position_L_to_V_list[len];
     100    FriBidiStrIndex position_V_to_L_list[len];
     101
     102    bool log2vis = fribidi_log2vis(
     103        logical, len, &base, visual, position_L_to_V_list, position_V_to_L_list,
     104        embedding_level_list); // output
     105
     106    if (log2vis)
     107    {
     108        len = fribidi_remove_bidi_marks(visual, len, NULL, NULL, NULL);
     109        for (uint i=0; i < len; i++)
     110        {
     111            if (embedding_level_list[i]%2==1)
     112            {
     113                isRTL = true;
     114                break;
     115            }
     116        }
     117    }
     118
     119    output = "";
     120    for (size_t i = 0; i < len ; i++)
     121        output += QChar(visual[i]);
     122
     123    return output;
     124#endif // !USING_FRIBIDI
     125}
     126
  • mythtv/libs/libmythtv/osdlistbtntype.h

     
    3535#include "osdtypes.h"
    3636#include "ttfont.h"
    3737#include "generictree.h"
     38#include "rtl.h"
    3839
    3940class OSDListBtnType;
    4041class OSDListBtnTypeItem;
     
    311312    QRect           m_arrowRect;
    312313    QRect           m_pixmapRect;
    313314    QRect           m_textRect;
     315    RTL            *m_rtl;
    314316};
    315317
    316318
  • mythtv/libs/libmythtv/rtl.h

     
     1#ifndef RTL_H_
     2#define RTL_H_
     3
     4#include <QString>
     5#include <QMutex>
     6
     7class QTextCodec;
     8
     9class RTL
     10{
     11  public:
     12    RTL(void) : codeci(NULL) { }
     13
     14    QString ConvertFromRtoL(const QString &text, bool &isRTL) const;
     15
     16  private:
     17    mutable QMutex      fribidi_lock;
     18    mutable QTextCodec *codeci;
     19};
     20
     21#endif