Ticket #4885: 4885-v2.patch
File 4885-v2.patch, 21.1 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
760 760 m_group(QString::null), m_state(state), 761 761 m_showArrow(showArrow), m_checkable(checkable), 762 762 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()) 764 765 { 765 766 if (!m_parent->m_initialized) 766 767 m_parent->Init(); … … 805 806 { 806 807 if (m_parent) 807 808 m_parent->RemoveItem(this); 809 if (m_rtl) 810 delete m_rtl; 808 811 } 809 812 810 813 void OSDListBtnTypeItem::paint(OSDSurface *surface, TTFFont *font, … … 858 861 QRect tr(m_textRect); 859 862 tr.translate(x, y); 860 863 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()); 862 876 } -
mythtv/libs/libmythtv/osdtypes.cpp
19 19 #include "libmyth/mythdialogs.h" 20 20 #include "libmythdb/mythverbose.h" 21 21 22 #ifdef USING_FRIBIDI23 #include "fribidi/fribidi.h"24 #include <QTextCodec>25 #endif // USING_FRIBIDI26 27 22 /// Shared OSD image cache 28 23 OSDImageCache OSDTypeImage::c_cache; 29 24 … … 698 693 m_scrollposy(0), 699 694 m_scrollinit(false), 700 695 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()) 703 697 { 704 698 } 705 699 … … 722 716 m_scrollposy(0), 723 717 m_scrollinit(false), 724 718 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()) 727 720 { 728 721 QMutexLocker locker(&other.m_lock); 729 722 … … 766 759 767 760 OSDTypeText::~OSDTypeText() 768 761 { 762 if (m_rtl) 763 delete m_rtl; 769 764 } 770 765 771 766 void OSDTypeText::SetAltFont(TTFFont *font) … … 774 769 m_altfont = font; 775 770 } 776 771 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 else799 rtl_string_composer.back().prepend(text[i]);800 801 prev_char = text[i];802 803 handle_rtl = false;804 }805 else806 {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) const823 {824 QString output = BasicConvertFromRtoL(text);825 826 #ifdef USING_FRIBIDI827 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); // output853 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_FRIBIDI861 862 return output;863 }864 865 772 void OSDTypeText::SetText(const QString &text) 866 773 { 867 774 QMutexLocker locker(&m_lock); 868 m_message = ConvertFromRtoL(text);775 m_message = text; m_message.detach(); 869 776 m_cursorpos = m_message.length(); 870 777 m_scrollinit = false; 871 778 } … … 873 780 QString OSDTypeText::GetText(void) const 874 781 { 875 782 QMutexLocker locker(&m_lock); 876 return m_message; 783 QString tmp = m_message; tmp.detach(); 784 return tmp; 877 785 } 878 786 879 787 void OSDTypeText::SetDefaultText(const QString &text) 880 788 { 881 789 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(); 884 792 m_scrollinit = false; 885 793 } 886 794 887 795 QString OSDTypeText::GetDefaultText(void) const 888 796 { 889 797 QMutexLocker locker(&m_lock); 890 return m_default_msg; 798 QString tmp = m_default_msg; tmp.detach(); 799 return tmp; 891 800 } 892 801 893 802 void OSDTypeText::SetMultiLine(bool multi) … … 1091 1000 if (text != m_draw_info_str) 1092 1001 { 1093 1002 m_draw_info_str = text; 1003 m_draw_info_str.detach(); 1094 1004 m_draw_info.clear(); 1095 1005 m_draw_info_len = 0; 1096 1006 … … 1203 1113 { 1204 1114 QMutexLocker locker(&m_lock); 1205 1115 1116 bool isRTL = false; 1117 QString msg = m_rtl->ConvertFromRtoL(text, isRTL); 1118 m_right |= isRTL; 1119 1206 1120 if (m_centered || m_right) 1207 1121 { 1208 1122 int textlength = 0; … … 1228 1142 if ((m_usingalt || m_selected) && m_altfont) 1229 1143 font = m_altfont; 1230 1144 1231 font->DrawString(surface, rect.left(), rect.top(), text,1145 font->DrawString(surface, rect.left(), rect.top(), msg, 1232 1146 rect.right(), rect.bottom(), alphamod, doubl); 1233 1147 1234 1148 // 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> 5 #include <QMutex> 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