Ticket #4885: 4885-v3.patch
File 4885-v3.patch, 21.0 KB (added by , 15 years ago) |
---|
-
themes/ProjectGrayhem-OSD/osd.xml
284 284 <position>0,320</position> 285 285 </image> 286 286 <textarea name="settings"> 287 <area>50,335, 350,32</area>287 <area>50,335,250,32</area> 288 288 <font>settings</font> 289 289 </textarea> 290 290 </container> … … 307 307 <multiline>yes</multiline> 308 308 </textarea> 309 309 <textarea name="option1"> 310 <area>120,269, 455,30</area>310 <area>120,269,395,30</area> 311 311 <font>notify</font> 312 312 <altfont>grayfont</altfont> 313 313 </textarea> 314 314 <textarea name="option2"> 315 <area>120,299, 455,30</area>315 <area>120,299,395,30</area> 316 316 <font>notify</font> 317 317 <altfont>grayfont</altfont> 318 318 </textarea> 319 319 <textarea name="option3"> 320 <area>120,329, 455,30</area>320 <area>120,329,395,30</area> 321 321 <font>notify</font> 322 322 <altfont>grayfont</altfont> 323 323 </textarea> 324 324 <textarea name="option4"> 325 <area>120,359, 455,30</area>325 <area>120,359,395,30</area> 326 326 <font>notify</font> 327 327 <altfont>grayfont</altfont> 328 328 </textarea> -
themes/blootube-osd/osd.xml
286 286 <position>30,30</position> 287 287 </image> 288 288 <textarea name="settings"> 289 <area>50,50, 350,32</area>289 <area>50,50,250,32</area> 290 290 <font>settings</font> 291 291 </textarea> 292 292 </container> … … 309 309 <multiline>yes</multiline> 310 310 </textarea> 311 311 <textarea name="option1"> 312 <area>120,269, 455,30</area>312 <area>120,269,395,30</area> 313 313 <font>notify</font> 314 314 <altfont>grayfont</altfont> 315 315 </textarea> 316 316 <textarea name="option2"> 317 <area>120,299, 455,30</area>317 <area>120,299,395,30</area> 318 318 <font>notify</font> 319 319 <altfont>grayfont</altfont> 320 320 </textarea> 321 321 <textarea name="option3"> 322 <area>120,329, 455,30</area>322 <area>120,329,395,30</area> 323 323 <font>notify</font> 324 324 <altfont>grayfont</altfont> 325 325 </textarea> 326 326 <textarea name="option4"> 327 <area>120,359, 455,30</area>327 <area>120,359,395,30</area> 328 328 <font>notify</font> 329 329 <altfont>grayfont</altfont> 330 330 </textarea> -
myththemes/Gray-OSD/osd.xml
425 425 <multiline>yes</multiline> 426 426 </textarea> 427 427 <textarea name="option1"> 428 <area>100,255, 455,30</area>428 <area>100,255,395,30</area> 429 429 <font>infofont</font> 430 430 <altfont>infofontgray</altfont> 431 431 </textarea> 432 432 <textarea name="option2"> 433 <area>100,285, 455,30</area>433 <area>100,285,395,30</area> 434 434 <font>infofont</font> 435 435 <altfont>infofontgray</altfont> 436 436 </textarea> 437 437 <textarea name="option3"> 438 <area>100,315, 455,30</area>438 <area>100,315,395,30</area> 439 439 <font>infofont</font> 440 440 <altfont>infofontgray</altfont> 441 441 </textarea> 442 442 <textarea name="option4"> 443 <area>100,345, 455,30</area>443 <area>100,345,395,30</area> 444 444 <font>infofont</font> 445 445 <altfont>infofontgray</altfont> 446 446 </textarea> 447 447 <textarea name="option5"> 448 <area>100,375, 455,30</area>448 <area>100,375,395,30</area> 449 449 <font>infofont</font> 450 450 <altfont>infofontgray</altfont> 451 451 </textarea> -
myththemes/Titivillus-OSD/osd.xml
359 359 360 360 <container name="settings"> 361 361 <textarea name="settings"> 362 <area>50,50, 350,32</area>362 <area>50,50,250,32</area> 363 363 <font>settings</font> 364 364 </textarea> 365 365 </container> -
myththemes/isthmus/osd.xml
315 315 316 316 <container name="settings"> 317 317 <textarea name="settings"> 318 <area>50,50, 350,32</area>318 <area>50,50,250,32</area> 319 319 <font>settings</font> 320 320 </textarea> 321 321 </container> … … 339 339 <multiline>yes</multiline> 340 340 </textarea> 341 341 <textarea name="option1"> 342 <area>100,255, 455,30</area>342 <area>100,255,395,30</area> 343 343 <font>infofont</font> 344 344 <altfont>infofontgray</altfont> 345 345 </textarea> 346 346 <textarea name="option2"> 347 <area>100,285, 455,30</area>347 <area>100,285,395,30</area> 348 348 <font>infofont</font> 349 349 <altfont>infofontgray</altfont> 350 350 </textarea> 351 351 <textarea name="option3"> 352 <area>100,315, 455,30</area>352 <area>100,315,395,30</area> 353 353 <font>infofont</font> 354 354 <altfont>infofontgray</altfont> 355 355 </textarea> 356 356 <textarea name="option4"> 357 <area>100,345, 455,30</area>357 <area>100,345,395,30</area> 358 358 <font>infofont</font> 359 359 <altfont>infofontgray</altfont> 360 360 </textarea> 361 361 <textarea name="option5"> 362 <area>100,375, 455,30</area>362 <area>100,375,395,30</area> 363 363 <font>infofont</font> 364 364 <altfont>infofontgray</altfont> 365 365 </textarea> -
myththemes/Iulius-OSD/osd.xml
251 251 252 252 <container name="settings"> 253 253 <textarea name="settings"> 254 <area>64,85, 350,32</area>254 <area>64,85,264,32</area> 255 255 <font>settings</font> 256 256 </textarea> 257 257 </container> -
myththemes/Retro-OSD/osd.xml
297 297 <position>30,30</position> 298 298 </image> 299 299 <textarea name="settings"> 300 <area>50,50, 350,32</area>300 <area>50,50,250,32</area> 301 301 <font>settings</font> 302 302 </textarea> 303 303 </container> … … 321 321 <multiline>yes</multiline> 322 322 </textarea> 323 323 <textarea name="option1"> 324 <area>120,239, 455,30</area>324 <area>120,239,395,30</area> 325 325 <font>notify</font> 326 326 <altfont>grayfont</altfont> 327 327 </textarea> 328 328 <textarea name="option2"> 329 <area>120,269, 455,30</area>329 <area>120,269,395,30</area> 330 330 <font>notify</font> 331 331 <altfont>grayfont</altfont> 332 332 </textarea> 333 333 <textarea name="option3"> 334 <area>120,299, 455,30</area>334 <area>120,299,395,30</area> 335 335 <font>notify</font> 336 336 <altfont>grayfont</altfont> 337 337 </textarea> 338 338 <textarea name="option4"> 339 <area>120,329, 455,30</area>339 <area>120,329,395,30</area> 340 340 <font>notify</font> 341 341 <altfont>grayfont</altfont> 342 342 </textarea> 343 343 <textarea name="option5"> 344 <area>120,359, 455,30</area>344 <area>120,359,395,30</area> 345 345 <font>notify</font> 346 346 <altfont>grayfont</altfont> 347 347 </textarea> -
mythtv/themes/defaultosd/osd.xml
239 239 240 240 <container name="settings"> 241 241 <textarea name="settings"> 242 <area>50,50, 350,32</area>242 <area>50,50,250,32</area> 243 243 <font>settings</font> 244 244 </textarea> 245 245 </container> -
mythtv/themes/blueosd/osd.xml
276 276 277 277 <container name="settings"> 278 278 <textarea name="settings"> 279 <area>50,50, 350,32</area>279 <area>50,50,250,32</area> 280 280 <font>settings</font> 281 281 </textarea> 282 282 </container> -
mythtv/libs/libmythtv/osdlistbtntype.cpp
730 730 m_group(QString::null), m_state(state), 731 731 m_showArrow(showArrow), m_checkable(checkable), 732 732 m_checkRect(0,0,0,0), m_arrowRect(0,0,0,0), 733 m_pixmapRect(0,0,0,0), m_textRect(0,0,0,0) 733 m_pixmapRect(0,0,0,0), m_textRect(0,0,0,0), 734 m_rtl(new RTL()) 734 735 { 735 736 if (!m_parent->m_initialized) 736 737 m_parent->Init(); … … 775 776 { 776 777 if (m_parent) 777 778 m_parent->RemoveItem(this); 779 if (m_rtl) 780 delete m_rtl; 778 781 } 779 782 780 783 void OSDListBtnTypeItem::paint(OSDSurface *surface, TTFFont *font, … … 828 841 QRect tr(m_textRect); 829 842 tr.moveBy(x, y); 830 843 tr.moveBy(0, font->Size() / 4); 831 font->DrawString(surface, tr.x(), tr.y(), m_text, tr.right(), tr.bottom()); 844 845 bool isRTL = false; 846 QString message = m_rtl->ConvertFromRtoL(m_text, isRTL); 847 if (isRTL) 848 { 849 int textlength = 0; 850 font->CalcWidth(m_text, &textlength); 851 int xoffset = tr.width() - textlength; 852 if (xoffset > 0) 853 tr.translate(xoffset, 0); 854 } 855 font->DrawString(surface, tr.x(), tr.y(), message, tr.right(), tr.bottom()); 832 856 } -
mythtv/libs/libmythtv/osdtypes.cpp
17 17 #include "mythcontext.h" 18 18 #include "mythdialogs.h" 19 19 20 #ifdef USING_FRIBIDI21 #include "fribidi/fribidi.h"22 #include <qtextcodec.h>23 #endif // USING_FRIBIDI24 25 20 /// Shared OSD image cache 26 21 OSDImageCache OSDTypeImage::c_cache; 27 22 … … 706 701 707 702 m_linespacing(1.5f), 708 703 709 m_draw_info_str(""), 710 m_draw_info_len(0), 711 712 codeci(NULL) 704 m_draw_info_str(QString::null), m_rtl(new RTL()) 713 705 { 714 706 } 715 707 … … 744 736 745 737 m_linespacing(1.5f), 746 738 747 m_draw_info_str(""), 748 m_draw_info_len(0), 749 750 codeci(NULL) 739 m_draw_info_str(QString::null), m_rtl(new RTL()) 751 740 { 752 741 QMutexLocker locker(&other.m_lock); 753 742 … … 783 772 784 773 OSDTypeText::~OSDTypeText() 785 774 { 775 if (m_rtl) 776 delete m_rtl; 786 777 } 787 778 788 779 void OSDTypeText::SetAltFont(TTFFont *font) … … 791 782 m_altfont = font; 792 783 } 793 784 794 QString OSDTypeText::BasicConvertFromRtoL(const QString &text)795 {796 QStringList rtl_string_composer;797 bool handle_rtl = false;798 QChar prev_char;799 800 // Handling Right-to-Left languages.801 // Left-to-Right languages are not affected.802 for (int i = (int)text.length() - 1; i >= 0; i--)803 {804 QChar::Direction text_dir = text[i].direction();805 if (text_dir != QChar::DirR &&806 text_dir != QChar::DirRLE &&807 text_dir != QChar::DirRLO)808 {809 if (handle_rtl || rtl_string_composer.empty())810 rtl_string_composer.append(QString());811 812 if (text[i].isSpace() && !prev_char.isNull()813 && prev_char.isDigit() && handle_rtl)814 rtl_string_composer.back().append(text[i]);815 else816 rtl_string_composer.back().prepend(text[i]);817 818 prev_char = text[i];819 820 handle_rtl = false;821 }822 else823 {824 if (!handle_rtl)825 {826 rtl_string_composer.append(QString());827 handle_rtl = true;828 prev_char = QChar();829 }830 rtl_string_composer.back().append(text[i]);831 }832 }833 834 QString output = rtl_string_composer.join("");835 836 return QDeepCopy<QString>(output);837 }838 839 QString OSDTypeText::ConvertFromRtoL(const QString &text) const840 {841 QString output = BasicConvertFromRtoL(text);842 843 #ifdef USING_FRIBIDI844 QMutexLocker locker(&fribidi_lock);845 if (!codeci)846 codeci = QTextCodec::codecForName("utf8");847 848 if (!codeci)849 return output;850 851 QCString temp = codeci->fromUnicode(output);852 853 FriBidiCharType base;854 size_t len;855 856 bool fribidi_flip_commas = true;857 base = (fribidi_flip_commas) ? FRIBIDI_TYPE_ON : FRIBIDI_TYPE_L;858 859 const char *ip = temp;860 FriBidiChar logical[strlen(ip) + 1], visual[strlen(ip) + 1];861 862 int char_set_num = fribidi_parse_charset("UTF-8");863 864 len = fribidi_charset_to_unicode(865 (FriBidiCharSet) char_set_num, ip, strlen(ip), logical);866 867 bool log2vis = fribidi_log2vis(868 logical, len, &base, visual, NULL, NULL, NULL); // output869 870 if (log2vis)871 len = fribidi_remove_bidi_marks(visual, len, NULL, NULL, NULL);872 873 output = "";874 for (size_t i = 0; i < len ; i++)875 output += QChar(visual[i]);876 #endif // USING_FRIBIDI877 878 return output;879 }880 881 785 void OSDTypeText::SetText(const QString &text) 882 786 { 883 787 QMutexLocker locker(&m_lock); 884 m_message = ConvertFromRtoL(text);788 m_message = text; m_message.detach(); 885 789 m_cursorpos = m_message.length(); 886 790 m_scrollinit = false; 887 791 } … … 889 793 QString OSDTypeText::GetText(void) const 890 794 { 891 795 QMutexLocker locker(&m_lock); 892 return QDeepCopy<QString>(m_message); 796 QString tmp = m_message; tmp.detach(); 797 return tmp; 893 798 } 894 799 895 800 void OSDTypeText::SetDefaultText(const QString &text) 896 801 { 897 802 QMutexLocker locker(&m_lock); 898 m_message = ConvertFromRtoL(text);899 m_default_msg = QDeepCopy<QString>(m_message);803 m_message = text; m_message.detach(); 804 m_default_msg = text; m_default_msg.detach(); 900 805 m_scrollinit = false; 901 806 } 902 807 903 808 QString OSDTypeText::GetDefaultText(void) const 904 809 { 905 810 QMutexLocker locker(&m_lock); 906 return QDeepCopy<QString>(m_default_msg); 811 QString tmp = m_default_msg; tmp.detach(); 812 return tmp; 907 813 } 908 814 909 815 void OSDTypeText::SetMultiLine(bool multi) … … 1107 1013 if (m_draw_info_str != text) 1108 1014 { 1109 1015 m_draw_info_str = QDeepCopy<QString>(text); 1016 m_draw_info_str.detach(); 1110 1017 m_draw_info.clear(); 1111 1018 m_draw_info_len = 0; 1112 1019 … … 1219 1126 { 1220 1127 QMutexLocker locker(&m_lock); 1221 1128 1129 bool isRTL = false; 1130 QString msg = m_rtl->ConvertFromRtoL(text, isRTL); 1131 m_right = isRTL; 1132 1222 1133 if (m_centered || m_right) 1223 1134 { 1224 1135 int textlength = 0; … … 1244 1155 if ((m_usingalt || m_selected) && m_altfont) 1245 1156 font = m_altfont; 1246 1157 1247 font->DrawString(surface, rect.left(), rect.top(), text,1158 font->DrawString(surface, rect.left(), rect.top(), msg, 1248 1159 rect.right(), rect.bottom(), alphamod, doubl); 1249 1160 1250 1161 // draw cursor -
mythtv/libs/libmythtv/libmythtv.pro
269 269 HEADERS += osd.h osdtypes.h 270 270 HEADERS += osdsurface.h osdlistbtntype.h 271 271 HEADERS += osdimagecache.h osdtypeteletext.h 272 HEADERS += udpnotify.h272 HEADERS += rtl.h udpnotify.h 273 273 SOURCES += osd.cpp osdtypes.cpp 274 274 SOURCES += osdsurface.cpp osdlistbtntype.cpp 275 275 SOURCES += osdimagecache.cpp osdtypeteletext.cpp 276 SOURCES += udpnotify.cpp276 SOURCES += rtl.cpp udpnotify.cpp 277 277 278 278 # Video output 279 279 HEADERS += videooutbase.h videoout_null.h -
mythtv/libs/libmythtv/osdtypes.h
12 12 #include <qcolor.h> 13 13 #include "cc708window.h" 14 14 #include "osdimagecache.h" 15 #include "rtl.h" 15 16 16 17 using namespace std; 17 18 … … 238 239 void SetButton(bool is_button) { m_button = is_button; } 239 240 void SetEntryNum(int entrynum) { m_entrynum = entrynum; } 240 241 241 QString ConvertFromRtoL(const QString &text) const;242 242 243 static QString BasicConvertFromRtoL(const QString &text);244 245 243 protected: 246 244 ~OSDTypeText(); 247 245 … … 292 290 mutable uint m_draw_info_len; 293 291 mutable vector<DrawInfo> m_draw_info; 294 292 295 mutable QMutex fribidi_lock; 296 mutable QTextCodec *codeci; 293 RTL *m_rtl; 297 294 }; 298 295 299 296 class 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 19 static 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 67 QString 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
35 35 #include "osdtypes.h" 36 36 #include "ttfont.h" 37 37 #include "generictree.h" 38 #include "rtl.h" 38 39 39 40 class OSDListBtnType; 40 41 class OSDListBtnTypeItem; … … 311 312 QRect m_arrowRect; 312 313 QRect m_pixmapRect; 313 314 QRect m_textRect; 315 RTL *m_rtl; 314 316 }; 315 317 316 318 -
mythtv/libs/libmythtv/rtl.h
1 #ifndef RTL_H_ 2 #define RTL_H_ 3 4 #include <qstring.h> 5 #include <qmutex.h> 6 7 class QTextCodec; 8 9 class 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