Ticket #10434: titlewindow.diff

File titlewindow.diff, 5.4 KB (added by Xavier Hervy <xavier.hervy@…>, 9 years ago)
  • mythtv/libs/libmythui/mythscreentype.cpp

    diff --git a/mythtv/libs/libmythui/mythscreentype.cpp b/mythtv/libs/libmythui/mythscreentype.cpp
    index 8dd78ec..062bddb 100644
    a b MythScreenType::MythScreenType(MythUIType *parent, const QString &name, 
    6868    m_IsLoading = false;
    6969    m_IsLoaded = false;
    7070    m_IsInitialized = false;
     71    m_textAreaTitle = NULL;
     72    m_windowTitle   = "";
     73    m_altTextAreaName   = "";
    7174
    7275    m_Area = GetMythMainWindow()->GetUIScreenRect();
    7376
    void MythScreenType::SetDeleting(bool deleting) 
    271274
    272275bool MythScreenType::Create(void)
    273276{
     277    // Load the standard text area for the title of the window
     278    UIUtilW::Assign(this, m_textAreaTitle, "windowtitle");
     279    if (!m_textAreaTitle && !m_altTextAreaName.isEmpty())
     280    {
     281        // Load the Alternative text area for the title of the window
     282        UIUtilW::Assign(this, m_textAreaTitle, m_altTextAreaName);
     283        // display a warning if the theme is still using the alternative title name
     284        if (m_textAreaTitle)
     285            LOG(VB_GUI, LOG_WARNING, "Warning, this theme is not implementing the normalise windowTitle text area");       
     286    }
     287    if (m_textAreaTitle) m_textAreaTitle->SetText(m_windowTitle);
    274288    return true;
    275289}
    276290
    void MythScreenType::SetTextFromMap(QHash<QString, QString> &infoMap) 
    420434    DoSetTextFromMap((MythUIType*) this, infoMap);
    421435}
    422436
     437/**
     438 * \brief set the name of the window
     439 * The title will be display in the "windowtitle" textarea.
     440 * The only purpose of the method is to standardize the name of the text area
     441 * so themer can take advantage of groups to define once for all the look and
     442 * feel of the window title bar.
     443 */
     444void MythScreenType::SetWindowTitle(const QString & title)
     445{
     446    m_windowTitle = title;
     447    if (m_textAreaTitle)m_textAreaTitle->SetText(m_windowTitle);
     448}
     449
     450const QString &MythScreenType::GetWindowTitle()const
     451{
     452    return m_windowTitle;
     453}
     454
     455
     456/*
     457 * set the ame of the alternative textarea to be used instead of "windowtitle"
     458 * The only purpose of the method is to provide compatibility and gibe time to
     459 * the themer to update there theme
     460 * Should be remove in a couple of release, let's say 0.27
     461 */
     462void MythScreenType::SetAlternateTitleTextAreaName(const QString & altTextArea)
     463{
     464    m_altTextAreaName=altTextArea;
     465}
     466
    423467static void DoResetMap(MythUIType *UItype, QHash<QString, QString> &infoMap)
    424468{
    425469    if (infoMap.isEmpty())
  • mythtv/libs/libmythui/mythscreentype.h

    diff --git a/mythtv/libs/libmythui/mythscreentype.h b/mythtv/libs/libmythui/mythscreentype.h
    index b83b39b..b3d6aca 100644
    a b class MUI_PUBLIC MythScreenType : public MythUIType 
    7777    void SetTextFromMap(InfoMap &infoMap);
    7878    void ResetMap(InfoMap &infoMap);
    7979
     80    void SetWindowTitle(const QString &);
     81    const QString &GetWindowTitle() const;
     82
     83    void SetAlternateTitleTextAreaName(const QString &);
     84
    8085    virtual MythPainter *GetPainter(void);
    8186
    8287  public slots:
    class MUI_PUBLIC MythScreenType : public MythUIType 
    111116    bool m_IsLoading;
    112117    bool m_IsLoaded;
    113118    bool m_IsInitialized;
     119    MythUIText *m_textAreaTitle;
     120    QString m_windowTitle;
     121    QString m_altTextAreaName;
    114122
    115123    MythUIType *m_CurrentFocusWidget;
    116124    //TODO We are currently dependant on the internal sorting of QMap for
  • mythtv/programs/mythfrontend/proglist.cpp

    diff --git a/mythtv/programs/mythfrontend/proglist.cpp b/mythtv/programs/mythfrontend/proglist.cpp
    index ddda2af..cc19d63 100644
    a b ProgLister::ProgLister(MythScreenStack *parent, ProgListType pltype, 
    5555    m_reverseSort(false),
    5656    m_useGenres(false),
    5757
    58     m_schedText(NULL),
    5958    m_curviewText(NULL),
    6059    m_positionText(NULL),
    6160    m_progList(NULL),
    ProgLister::ProgLister( 
    104103    m_reverseSort(true),
    105104    m_useGenres(false),
    106105
    107     m_schedText(NULL),
    108106    m_curviewText(NULL),
    109107    m_positionText(NULL),
    110108    m_progList(NULL),
    bool ProgLister::Create() 
    123121    if (!LoadWindowFromXML("schedule-ui.xml", "programlist", this))
    124122        return false;
    125123
     124    //insure that non converted theme still work
     125    SetAlternateTitleTextAreaName("sched");
     126
     127    if (!ScheduleCommon::Create())
     128        return false;
     129
    126130    bool err = false;
    127131    UIUtilW::Assign(this, m_curviewText, "curview", &err);
    128132    UIUtilE::Assign(this, m_progList, "proglist", &err);
    129     UIUtilW::Assign(this, m_schedText, "sched", &err);
    130133    UIUtilW::Assign(this, m_messageText, "msg", &err);
    131134    UIUtilW::Assign(this, m_positionText, "position", &err);
    132135
    bool ProgLister::Create() 
    167170        default:                   value = tr("Unknown Search");   break;
    168171    }
    169172
    170     if (m_schedText)
    171         m_schedText->SetText(value);
     173    SetWindowTitle(value);
    172174
    173175    gCoreContext->addListener(this);
    174176
  • mythtv/programs/mythfrontend/proglist.h

    diff --git a/mythtv/programs/mythfrontend/proglist.h b/mythtv/programs/mythfrontend/proglist.h
    index 1fc9020..e0be3b9 100644
    a b class ProgLister : public ScheduleCommon 
    126126    bool              m_reverseSort;
    127127    bool              m_useGenres;
    128128
    129     MythUIText       *m_schedText;
    130129    MythUIText       *m_curviewText;
    131130    MythUIText       *m_positionText;
    132131    MythUIButtonList *m_progList;