Ticket #5596: 5596-v19.patch

File 5596-v19.patch, 18.4 KB (added by danielk, 16 years ago)

Updated patch

  • libs/libmythtv/progdetails.h

     
    2626  private:
    2727    void wireUpTheme(void);
    2828
    29     UIRichTextType   *m_richText;
     29    UITextType       *m_richText;
    3030    UITextButtonType *m_okButton;
    3131
    3232    QString           m_details;
  • libs/libmythtv/progdetails.cpp

     
    1313
    1414ProgDetails::ProgDetails(MythMainWindow *parent,
    1515                         QString windowName,
    16                          QString details)
    17     : MythThemedDialog(parent, windowName)
     16                         QString details) :
     17    MythThemedDialog(parent, windowName)
    1818{
    1919    m_details = details;
    2020
     
    2424    if (m_richText)
    2525    {
    2626        m_richText->SetText(m_details);
    27         m_richText->SetBackground(&my_background);
     27//        m_richText->SetBackground(&my_background);
    2828    }
    2929}
    3030
     
    9898                reject();
    9999            else if (action == "UP")
    100100            {
     101/*
    101102                if (getCurrentFocusWidget() == m_richText)
    102103                    m_richText->ScrollUp();
    103104                else
     105*/
    104106                    nextPrevWidgetFocus(false);
    105107            }
    106108            else if (action == "DOWN")
    107109            {
     110/*
    108111                if (getCurrentFocusWidget() == m_richText)
    109112                    m_richText->ScrollDown();
    110113                else
     114*/
    111115                    nextPrevWidgetFocus(true);
    112116            }
    113117            else if (action == "LEFT")
     
    120124            }
    121125            else if (action == "PAGEUP")
    122126            {
     127/*
    123128                if (getCurrentFocusWidget() == m_richText)
    124129                    m_richText->ScrollPageUp();
    125130                else
     131*/
    126132                    nextPrevWidgetFocus(false);
    127133            }
    128134            else if (action == "PAGEDOWN")
    129135            {
     136/*
    130137                if (getCurrentFocusWidget() == m_richText)
    131138                    m_richText->ScrollPageDown();
    132139                else
     140*/
    133141                    nextPrevWidgetFocus(true);
    134142            }
    135143
     
    148156        connect(m_okButton, SIGNAL(pushed()), this, SLOT(accept()));
    149157    }
    150158
    151     m_richText = getUIRichTextType("richtext");
     159    m_richText = getUITextType("richtext");
    152160
    153161    buildFocusList();
    154162}
  • libs/libmyth/settings.cpp

     
    1313#include <QButtonGroup>
    1414#include <QRadioButton>
    1515#include <QProgressBar>
    16 #include <Q3ButtonGroup>
    1716
    1817// Qt utils
    1918#include <QFile>
     
    550549}
    551550
    552551QWidget* SelectLabelSetting::configWidget(ConfigurationGroup *cg,
    553                                           QWidget    *parent,
    554                                           const char *widgetName)
     552                                          QWidget* parent,
     553                                          const char* widgetName)
    555554{
    556555    (void)cg;
    557556
     
    831830    Setting::setValue(newValue.toString(Qt::ISODate));
    832831}
    833832
    834 QWidget* RadioSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,
    835                                     const char* widgetName) {
    836     Q3ButtonGroup* widget = new Q3ButtonGroup(parent, widgetName);
     833QWidget *RadioSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,
     834                                    const char* widgetName)
     835{
     836    QGroupBox* widget = new QGroupBox(parent, widgetName);
    837837    widget->setTitle(getLabel());
    838838
    839839    for( unsigned i = 0 ; i < labels.size() ; ++i ) {
  • libs/libmyth/uitypes.h

     
    745745
    746746};
    747747
    748 class MPUBLIC UIRichTextType : public UIType
    749 {
    750     Q_OBJECT
    751 
    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 position
    803         int   m_textHeight;  // total height of rendered text
    804 
    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 background
    812         QPixmap *m_compBackground;// composite of the window background + the
    813                                   // widget background image
    814         QPixmap *m_image;         // the completed image including the rich text
    815 
    816         QString m_backgroundFile;   //< current source of background image
    817         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 
    834748class MPUBLIC UIRemoteEditType : public UIType
    835749{
    836750    Q_OBJECT
  • libs/libmyth/mythdialogs.cpp

     
    16131613    return GetUIType<UITextType>(this, name);
    16141614}
    16151615
    1616 UIRichTextType* MythThemedDialog::getUIRichTextType(const QString &name)
    1617 {
    1618     return GetUIType<UIRichTextType>(this, name);
    1619 }
    1620 
    16211616UIRemoteEditType* MythThemedDialog::getUIRemoteEditType(const QString &name)
    16221617{
    16231618    return GetUIType<UIRemoteEditType>(this, name);
  • libs/libmyth/dialogbox.cpp

     
    99#undef DialogBox
    1010#endif
    1111
    12 #include <Q3ButtonGroup>
     12#include <QButtonGroup>
    1313#include <QBoxLayout>
    1414
    1515DialogBox::DialogBox(MythMainWindow *parent, const QString &text,
     
    3535        box->addWidget(checkbox, 0);
    3636    }
    3737
    38     buttongroup = new Q3ButtonGroup(0);
     38    buttongroup = new QButtonGroup();
    3939 
    4040    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)));
    4344}
    4445
    4546void DialogBox::AddButton(const QString &title)
    4647{
    4748    MythPushButton *button = new MythPushButton(title, this);
    4849
    49     if (buttongroup->count() == 0 ||
    50         (checkbox && buttongroup->count() == 1))
     50    if (buttongroup->buttons().empty() ||
     51        (checkbox && buttongroup->buttons().size() == 1))
    5152    {
    5253        button->setFocus();
    5354    }
    5455
    55     buttongroup->insert(button);
     56    buttongroup->addButton(button);
    5657
    5758    box->addWidget(button, 0);
    5859}
    5960
    6061void DialogBox::buttonPressed(int which)
    6162{
    62     if (buttongroup->find(which) != checkbox)
     63    if (buttongroup->button(which) != checkbox)
    6364        AcceptItem(which);
    6465}
  • libs/libmyth/mythdialogs.h

     
    1818class UIType;
    1919class UIManagedTreeListType;
    2020class UITextType;
    21 class UIRichTextType;
    2221class UIPushButtonType;
    2322class UITextButtonType;
    2423class UIRemoteEditType;
     
    366365
    367366    UIManagedTreeListType *getUIManagedTreeListType(const QString &name);
    368367    UITextType *getUITextType(const QString &name);
    369     UIRichTextType *getUIRichTextType(const QString &name);
    370368    UIPushButtonType *getUIPushButtonType(const QString &name);
    371369    UITextButtonType *getUITextButtonType(const QString &name);
    372370    UIRemoteEditType *getUIRemoteEditType(const QString &name);
  • libs/libmyth/xmlparse.cpp

     
    17301730        return;
    17311731    }
    17321732
    1733     UIRichTextType *text = new UIRichTextType(name, testfont, value, draworder,
    1734                                               area, textArea);
     1733    UITextType *text = new UITextType(name, testfont, value, draworder,
     1734                                      area, textArea);
    17351735    text->SetScreen(wmult, hmult);
    17361736    if (context != -1)
    17371737    {
     
    17421742
    17431743    if (upArrowReg)
    17441744    {
    1745         text->SetImageUpArrowReg(*upArrowReg, upArrowRegPos);
     1745        //text->SetImageUpArrowReg(*upArrowReg, upArrowRegPos);
    17461746        delete upArrowReg;
    17471747    }
    17481748    if (upArrowSel)
    17491749    {
    1750         text->SetImageUpArrowSel(*upArrowSel, upArrowSelPos);
     1750        //text->SetImageUpArrowSel(*upArrowSel, upArrowSelPos);
    17511751        delete upArrowSel;
    17521752    }
    17531753    if (dnArrowReg)
    17541754    {
    1755         text->SetImageDnArrowReg(*dnArrowReg, dnArrowRegPos);
     1755        //text->SetImageDnArrowReg(*dnArrowReg, dnArrowRegPos);
    17561756        delete dnArrowReg;
    17571757    }
    17581758    if (dnArrowSel)
    17591759    {
    1760         text->SetImageDnArrowSel(*dnArrowSel, dnArrowSelPos);
     1760        //text->SetImageDnArrowSel(*dnArrowSel, dnArrowSelPos);
    17611761        delete dnArrowSel;
    17621762    }
    17631763
    1764     text->SetShowScrollArrows(bShowArrows);
    1765     text->SetBackgroundImages(bgImageReg, bgImageSel);
     1764    //text->SetShowScrollArrows(bShowArrows);
     1765    //text->SetBackgroundImages(bgImageReg, bgImageSel);
    17661766    text->SetParent(container);
    17671767    text->calculateScreenArea();
    17681768    container->AddType(text);
  • libs/libmyth/uitypes.cpp

     
    24032403
    24042404// ******************************************************************
    24052405
    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     else
    2418         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     else
    2455         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 background
    2488     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 background
    2505     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 arrows
    2531     if (m_showScrollArrows)
    2532     {
    2533         if (m_textHeight <= m_textArea.height())
    2534         {
    2535             m_showUpArrow = false;
    2536             m_showDnArrow = false;
    2537         }
    2538         else
    2539         {
    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 image
    2556         dr->drawPixmap(m_displayArea, *m_image);
    2557 
    2558         // draw scroll arrows
    2559         if (m_showScrollArrows)
    2560         {
    2561             if (m_showUpArrow)
    2562                 dr->drawPixmap(m_upArrowSelPos, m_upArrowSel);
    2563             else
    2564                 dr->drawPixmap(m_upArrowRegPos, m_upArrowReg);
    2565 
    2566             if (m_showDnArrow)
    2567                 dr->drawPixmap(m_dnArrowSelPos, m_dnArrowSel);
    2568             else
    2569                 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 
    26512406UIRemoteEditType::UIRemoteEditType(const QString &name, fontProp *font,
    26522407                       const QString &text, int dorder, QRect displayrect)
    26532408           : UIType(name)
  • libs/libmyth/dialogbox.h

     
    33
    44#include <QObject>
    55#include <QCheckBox>
    6 #include <Q3ButtonGroup>
    76
    87#include "mythdialogs.h"
    98#include "compat.h" // to undef DialogBox
    109class QVBoxLayout;
     10class QButtonGroup;
    1111
    1212class MPUBLIC DialogBox : public MythDialog
    1313{
     
    2929
    3030  private:
    3131    QVBoxLayout *box;
    32     Q3ButtonGroup *buttongroup;
     32    QButtonGroup *buttongroup;
    3333
    3434    QCheckBox *checkbox;
    3535};