Ticket #5596: 5596-v19.patch
File 5596-v19.patch, 18.4 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/progdetails.h
26 26 private: 27 27 void wireUpTheme(void); 28 28 29 UI RichTextType*m_richText;29 UITextType *m_richText; 30 30 UITextButtonType *m_okButton; 31 31 32 32 QString m_details; -
libs/libmythtv/progdetails.cpp
13 13 14 14 ProgDetails::ProgDetails(MythMainWindow *parent, 15 15 QString windowName, 16 QString details) 17 :MythThemedDialog(parent, windowName)16 QString details) : 17 MythThemedDialog(parent, windowName) 18 18 { 19 19 m_details = details; 20 20 … … 24 24 if (m_richText) 25 25 { 26 26 m_richText->SetText(m_details); 27 m_richText->SetBackground(&my_background);27 // m_richText->SetBackground(&my_background); 28 28 } 29 29 } 30 30 … … 98 98 reject(); 99 99 else if (action == "UP") 100 100 { 101 /* 101 102 if (getCurrentFocusWidget() == m_richText) 102 103 m_richText->ScrollUp(); 103 104 else 105 */ 104 106 nextPrevWidgetFocus(false); 105 107 } 106 108 else if (action == "DOWN") 107 109 { 110 /* 108 111 if (getCurrentFocusWidget() == m_richText) 109 112 m_richText->ScrollDown(); 110 113 else 114 */ 111 115 nextPrevWidgetFocus(true); 112 116 } 113 117 else if (action == "LEFT") … … 120 124 } 121 125 else if (action == "PAGEUP") 122 126 { 127 /* 123 128 if (getCurrentFocusWidget() == m_richText) 124 129 m_richText->ScrollPageUp(); 125 130 else 131 */ 126 132 nextPrevWidgetFocus(false); 127 133 } 128 134 else if (action == "PAGEDOWN") 129 135 { 136 /* 130 137 if (getCurrentFocusWidget() == m_richText) 131 138 m_richText->ScrollPageDown(); 132 139 else 140 */ 133 141 nextPrevWidgetFocus(true); 134 142 } 135 143 … … 148 156 connect(m_okButton, SIGNAL(pushed()), this, SLOT(accept())); 149 157 } 150 158 151 m_richText = getUI RichTextType("richtext");159 m_richText = getUITextType("richtext"); 152 160 153 161 buildFocusList(); 154 162 } -
libs/libmyth/settings.cpp
13 13 #include <QButtonGroup> 14 14 #include <QRadioButton> 15 15 #include <QProgressBar> 16 #include <Q3ButtonGroup>17 16 18 17 // Qt utils 19 18 #include <QFile> … … 550 549 } 551 550 552 551 QWidget* SelectLabelSetting::configWidget(ConfigurationGroup *cg, 553 QWidget *parent,554 const char *widgetName)552 QWidget* parent, 553 const char* widgetName) 555 554 { 556 555 (void)cg; 557 556 … … 831 830 Setting::setValue(newValue.toString(Qt::ISODate)); 832 831 } 833 832 834 QWidget* RadioSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 835 const char* widgetName) { 836 Q3ButtonGroup* widget = new Q3ButtonGroup(parent, widgetName); 833 QWidget *RadioSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 834 const char* widgetName) 835 { 836 QGroupBox* widget = new QGroupBox(parent, widgetName); 837 837 widget->setTitle(getLabel()); 838 838 839 839 for( unsigned i = 0 ; i < labels.size() ; ++i ) { -
libs/libmyth/uitypes.h
745 745 746 746 }; 747 747 748 class MPUBLIC UIRichTextType : public UIType749 {750 Q_OBJECT751 752 public:753 UIRichTextType(const QString &, fontProp *, const QString &, int,754 QRect displayrect, QRect textrect);755 ~UIRichTextType();756 757 QString Name() { return m_name; }758 759 void SetText(const QString &text);760 QString GetText() { return m_message; }761 762 QRect DisplayArea() { return m_displayArea; }763 void SetDisplayArea(const QRect &rect) { m_displayArea = rect; }764 void SetShowScrollArrows(bool bShowArrows)765 { m_showScrollArrows = bShowArrows; }766 767 QRect TextArea() { return m_textArea; }768 void SetTextArea(const QRect &rect) { m_textArea = rect; }769 770 void SetImageUpArrowReg(QPixmap img, QPoint loc)771 { m_upArrowReg = img; m_upArrowRegPos = loc; }772 void SetImageDnArrowReg(QPixmap img, QPoint loc)773 { m_dnArrowReg = img; m_dnArrowRegPos = loc; }774 void SetImageUpArrowSel(QPixmap img, QPoint loc)775 { m_upArrowSel = img; m_upArrowSelPos = loc; }776 void SetImageDnArrowSel(QPixmap img, QPoint loc)777 { m_dnArrowSel = img; m_dnArrowSelPos = loc; }778 779 void SetBackground(QPixmap *background);780 void SetBackgroundImages(QString bgImageReg, QString bgImageSel);781 782 virtual void calculateScreenArea();783 784 virtual void Draw(QPainter *, int, int);785 public slots:786 void ScrollDown(void);787 void ScrollUp(void);788 void ScrollPageDown(void);789 void ScrollPageUp(void);790 791 virtual bool takeFocus();792 virtual void looseFocus();793 794 protected:795 void refreshImage();796 void updateBackground();797 void loadBackgroundImg(bool &changed);798 799 QRect m_displayArea;800 QRect m_textArea;801 802 int m_yPos; // current scroll position803 int m_textHeight; // total height of rendered text804 805 QString m_message;806 QString m_bgImageReg;807 QString m_bgImageSel;808 809 fontProp *m_font;810 811 QPixmap *m_background; // clipped image of the window background812 QPixmap *m_compBackground;// composite of the window background + the813 // widget background image814 QPixmap *m_image; // the completed image including the rich text815 816 QString m_backgroundFile; //< current source of background image817 QImage *m_backgroundImage; //< current widget background image)818 819 bool m_showScrollArrows;820 bool m_showUpArrow;821 bool m_showDnArrow;822 823 QPoint m_upArrowRegPos;824 QPoint m_dnArrowRegPos;825 QPoint m_upArrowSelPos;826 QPoint m_dnArrowSelPos;827 828 QPixmap m_upArrowReg;829 QPixmap m_dnArrowReg;830 QPixmap m_upArrowSel;831 QPixmap m_dnArrowSel;832 };833 834 748 class MPUBLIC UIRemoteEditType : public UIType 835 749 { 836 750 Q_OBJECT -
libs/libmyth/mythdialogs.cpp
1613 1613 return GetUIType<UITextType>(this, name); 1614 1614 } 1615 1615 1616 UIRichTextType* MythThemedDialog::getUIRichTextType(const QString &name)1617 {1618 return GetUIType<UIRichTextType>(this, name);1619 }1620 1621 1616 UIRemoteEditType* MythThemedDialog::getUIRemoteEditType(const QString &name) 1622 1617 { 1623 1618 return GetUIType<UIRemoteEditType>(this, name); -
libs/libmyth/dialogbox.cpp
9 9 #undef DialogBox 10 10 #endif 11 11 12 #include <Q 3ButtonGroup>12 #include <QButtonGroup> 13 13 #include <QBoxLayout> 14 14 15 15 DialogBox::DialogBox(MythMainWindow *parent, const QString &text, … … 35 35 box->addWidget(checkbox, 0); 36 36 } 37 37 38 buttongroup = new Q 3ButtonGroup(0);38 buttongroup = new QButtonGroup(); 39 39 40 40 if (checkbox) 41 buttongroup->insert(checkbox); 42 connect(buttongroup, SIGNAL(clicked(int)), this, SLOT(buttonPressed(int))); 41 buttongroup->addButton(checkbox); 42 connect(buttongroup, SIGNAL(buttonClicked(int)), 43 this, SLOT( buttonPressed(int))); 43 44 } 44 45 45 46 void DialogBox::AddButton(const QString &title) 46 47 { 47 48 MythPushButton *button = new MythPushButton(title, this); 48 49 49 if (buttongroup-> count() == 0||50 (checkbox && buttongroup-> count() == 1))50 if (buttongroup->buttons().empty() || 51 (checkbox && buttongroup->buttons().size() == 1)) 51 52 { 52 53 button->setFocus(); 53 54 } 54 55 55 buttongroup-> insert(button);56 buttongroup->addButton(button); 56 57 57 58 box->addWidget(button, 0); 58 59 } 59 60 60 61 void DialogBox::buttonPressed(int which) 61 62 { 62 if (buttongroup-> find(which) != checkbox)63 if (buttongroup->button(which) != checkbox) 63 64 AcceptItem(which); 64 65 } -
libs/libmyth/mythdialogs.h
18 18 class UIType; 19 19 class UIManagedTreeListType; 20 20 class UITextType; 21 class UIRichTextType;22 21 class UIPushButtonType; 23 22 class UITextButtonType; 24 23 class UIRemoteEditType; … … 366 365 367 366 UIManagedTreeListType *getUIManagedTreeListType(const QString &name); 368 367 UITextType *getUITextType(const QString &name); 369 UIRichTextType *getUIRichTextType(const QString &name);370 368 UIPushButtonType *getUIPushButtonType(const QString &name); 371 369 UITextButtonType *getUITextButtonType(const QString &name); 372 370 UIRemoteEditType *getUIRemoteEditType(const QString &name); -
libs/libmyth/xmlparse.cpp
1730 1730 return; 1731 1731 } 1732 1732 1733 UI RichTextType *text = new UIRichTextType(name, testfont, value, draworder,1734 1733 UITextType *text = new UITextType(name, testfont, value, draworder, 1734 area, textArea); 1735 1735 text->SetScreen(wmult, hmult); 1736 1736 if (context != -1) 1737 1737 { … … 1742 1742 1743 1743 if (upArrowReg) 1744 1744 { 1745 text->SetImageUpArrowReg(*upArrowReg, upArrowRegPos);1745 //text->SetImageUpArrowReg(*upArrowReg, upArrowRegPos); 1746 1746 delete upArrowReg; 1747 1747 } 1748 1748 if (upArrowSel) 1749 1749 { 1750 text->SetImageUpArrowSel(*upArrowSel, upArrowSelPos);1750 //text->SetImageUpArrowSel(*upArrowSel, upArrowSelPos); 1751 1751 delete upArrowSel; 1752 1752 } 1753 1753 if (dnArrowReg) 1754 1754 { 1755 text->SetImageDnArrowReg(*dnArrowReg, dnArrowRegPos);1755 //text->SetImageDnArrowReg(*dnArrowReg, dnArrowRegPos); 1756 1756 delete dnArrowReg; 1757 1757 } 1758 1758 if (dnArrowSel) 1759 1759 { 1760 text->SetImageDnArrowSel(*dnArrowSel, dnArrowSelPos);1760 //text->SetImageDnArrowSel(*dnArrowSel, dnArrowSelPos); 1761 1761 delete dnArrowSel; 1762 1762 } 1763 1763 1764 text->SetShowScrollArrows(bShowArrows);1765 text->SetBackgroundImages(bgImageReg, bgImageSel);1764 //text->SetShowScrollArrows(bShowArrows); 1765 //text->SetBackgroundImages(bgImageReg, bgImageSel); 1766 1766 text->SetParent(container); 1767 1767 text->calculateScreenArea(); 1768 1768 container->AddType(text); -
libs/libmyth/uitypes.cpp
2403 2403 2404 2404 // ****************************************************************** 2405 2405 2406 UIRichTextType::UIRichTextType(const QString &name, fontProp *font,2407 const QString &text, int dorder, QRect displayrect,2408 QRect textrect)2409 : UIType(name)2410 {2411 2412 m_name = name;2413 takes_focus = true;2414 2415 if (Q3StyleSheet::mightBeRichText(text))2416 m_message = text;2417 else2418 m_message = Q3StyleSheet::convertFromPlainText(text, Q3StyleSheetItem::WhiteSpaceNormal);2419 2420 m_font = font;2421 m_displayArea = displayrect;2422 m_yPos = 0;2423 m_textArea = textrect;2424 m_order = dorder;2425 m_image = new QPixmap(m_displayArea.width(), m_displayArea.height());2426 m_background = new QPixmap(m_displayArea.width(), m_displayArea.height() );2427 m_compBackground = new QPixmap(m_displayArea.width(), m_displayArea.height() );2428 m_backgroundImage = NULL;2429 m_backgroundFile = "";2430 2431 m_bgImageReg = m_bgImageSel = "";2432 m_showScrollArrows = true;2433 }2434 2435 UIRichTextType::~UIRichTextType()2436 {2437 if (m_image)2438 delete m_image;2439 2440 if (m_background)2441 delete m_background;2442 2443 if (m_backgroundImage)2444 delete m_backgroundImage;2445 2446 if (m_compBackground)2447 delete m_compBackground;2448 }2449 2450 void UIRichTextType::SetText(const QString &text)2451 {2452 if (Q3StyleSheet::mightBeRichText(text))2453 m_message = text;2454 else2455 m_message = Q3StyleSheet::convertFromPlainText(text, Q3StyleSheetItem::WhiteSpaceNormal);2456 2457 m_yPos = 0;2458 m_showUpArrow = false;2459 refreshImage();2460 }2461 2462 void UIRichTextType::SetBackgroundImages(QString bgImageReg, QString bgImageSel)2463 {2464 m_bgImageReg = bgImageReg;2465 m_bgImageSel = bgImageSel;2466 2467 bool needreload = false;2468 loadBackgroundImg(needreload);2469 if (needreload) updateBackground();2470 }2471 2472 void UIRichTextType::SetBackground(QPixmap *background)2473 {2474 copyBlt(m_background, 0, 0, background, m_displayArea.x(), m_displayArea.y(),2475 m_displayArea.width(), m_displayArea.height());2476 2477 updateBackground();2478 }2479 2480 void UIRichTextType::loadBackgroundImg(bool &changed)2481 {2482 QString file = "";2483 changed = false;2484 2485 file = isFocused() ? m_bgImageSel : m_bgImageReg;2486 2487 // paint our background image over the window background2488 if (file != "")2489 {2490 if (file != m_backgroundFile)2491 {2492 if (m_backgroundImage)2493 delete m_backgroundImage;2494 2495 m_backgroundImage = GetMythUI()->LoadScaleImage(file, true);2496 m_backgroundFile = file;2497 changed = true;2498 }2499 }2500 }2501 2502 void UIRichTextType::updateBackground(void)2503 {2504 // paint our background image over the window background2505 QPainter p(m_compBackground);2506 if (m_background) p.drawPixmap(QPoint(0, 0), *m_background);2507 if (m_backgroundImage)2508 p.drawImage(QPoint(0, 0), *m_backgroundImage);2509 refreshImage();2510 }2511 2512 void UIRichTextType::refreshImage()2513 {2514 if (!m_background)2515 return;2516 2517 QRect clipRect(0, 0, m_textArea.width(), m_textArea.height());2518 2519 QPainter p(m_image);2520 QBrush brush;2521 2522 brush.setPixmap(*m_compBackground);2523 p.fillRect(0, 0, m_displayArea.width(), m_displayArea.height() , brush);2524 p.translate(m_textArea.x() - m_displayArea.x() , m_textArea.y() - m_displayArea.y());2525 Q3SimpleRichText richText(m_message, m_font->face);2526 richText.setWidth(m_textArea.width());2527 richText.draw(&p, 0, -m_yPos, clipRect, gContext->GetMainWindow()->colorGroup(), 0);2528 m_textHeight = richText.height();2529 2530 // do we need to show scroll arrows2531 if (m_showScrollArrows)2532 {2533 if (m_textHeight <= m_textArea.height())2534 {2535 m_showUpArrow = false;2536 m_showDnArrow = false;2537 }2538 else2539 {2540 m_showUpArrow = (m_yPos > 0);2541 m_showDnArrow = (m_yPos != m_textHeight - m_textArea.height());2542 }2543 }2544 2545 refresh();2546 }2547 2548 void UIRichTextType::Draw(QPainter *dr, int drawlayer, int context)2549 {2550 if (hidden)2551 return;2552 2553 if ((m_context == context || m_context == -1) && drawlayer == m_order)2554 {2555 // draw text image2556 dr->drawPixmap(m_displayArea, *m_image);2557 2558 // draw scroll arrows2559 if (m_showScrollArrows)2560 {2561 if (m_showUpArrow)2562 dr->drawPixmap(m_upArrowSelPos, m_upArrowSel);2563 else2564 dr->drawPixmap(m_upArrowRegPos, m_upArrowReg);2565 2566 if (m_showDnArrow)2567 dr->drawPixmap(m_dnArrowSelPos, m_dnArrowSel);2568 else2569 dr->drawPixmap(m_dnArrowRegPos, m_dnArrowReg);2570 }2571 }2572 }2573 2574 void UIRichTextType::calculateScreenArea()2575 {2576 QRect r = m_displayArea;2577 r.moveBy(m_parent->GetAreaRect().left(),2578 m_parent->GetAreaRect().top());2579 screen_area = r;2580 }2581 2582 void UIRichTextType::ScrollUp()2583 {2584 if (m_textHeight <= m_textArea.height())2585 return;2586 2587 m_yPos -= m_textArea.height() / 10;2588 if (m_yPos < 0)2589 m_yPos = 0;2590 2591 refreshImage();2592 }2593 2594 void UIRichTextType::ScrollDown()2595 {2596 if (m_textHeight <= m_textArea.height())2597 return;2598 2599 m_yPos += m_textArea.height() / 10;2600 2601 if (m_yPos > m_textHeight - m_textArea.height())2602 m_yPos = m_textHeight - m_textArea.height();2603 2604 refreshImage();2605 }2606 2607 void UIRichTextType::ScrollPageUp()2608 {2609 if (m_textHeight <= m_textArea.height())2610 return;2611 2612 m_yPos -= m_textArea.height();2613 if (m_yPos < 0)2614 m_yPos = 0;2615 2616 refreshImage();2617 }2618 2619 void UIRichTextType::ScrollPageDown()2620 {2621 if (m_textHeight <= m_textArea.height())2622 return;2623 2624 m_yPos += m_textArea.height();2625 if (m_yPos > m_textHeight - m_textArea.height())2626 m_yPos = m_textHeight - m_textArea.height();2627 2628 refreshImage();2629 }2630 2631 bool UIRichTextType::takeFocus()2632 {2633 bool res = UIType::takeFocus();2634 bool needreload = false;2635 loadBackgroundImg(needreload);2636 if (needreload) updateBackground();2637 2638 return res;2639 }2640 2641 void UIRichTextType::looseFocus()2642 {2643 UIType::looseFocus();2644 bool needreload = false;2645 loadBackgroundImg(needreload);2646 if (needreload) updateBackground();2647 }2648 2649 // ******************************************************************2650 2651 2406 UIRemoteEditType::UIRemoteEditType(const QString &name, fontProp *font, 2652 2407 const QString &text, int dorder, QRect displayrect) 2653 2408 : UIType(name) -
libs/libmyth/dialogbox.h
3 3 4 4 #include <QObject> 5 5 #include <QCheckBox> 6 #include <Q3ButtonGroup>7 6 8 7 #include "mythdialogs.h" 9 8 #include "compat.h" // to undef DialogBox 10 9 class QVBoxLayout; 10 class QButtonGroup; 11 11 12 12 class MPUBLIC DialogBox : public MythDialog 13 13 { … … 29 29 30 30 private: 31 31 QVBoxLayout *box; 32 Q 3ButtonGroup *buttongroup;32 QButtonGroup *buttongroup; 33 33 34 34 QCheckBox *checkbox; 35 35 };