Ticket #7425: 0001-Fixes-7425 - updated.patch

File 0001-Fixes-7425 - updated.patch, 5.0 KB (added by mythtv@…, 10 years ago)
  • mythplugins/mythvideo/mythvideo/videodlg.cpp

    From a924c93f846d86782a3a0ed9cc634f385c2551ae Mon Sep 17 00:00:00 2001
    From: Pasha Golovko <mythtv@golovko.org>
    Date: Wed, 20 Jan 2010 14:31:11 -0800
    Subject: [PATCH] Fixes #7425. Update tree position remmeber functionality for post-MythUI changes.
    
    ---
     mythplugins/mythvideo/mythvideo/videodlg.cpp |   17 +++++++++++++----
     mythtv/libs/libmythui/mythuibuttontree.cpp   |   24 +++++++++++++++++++++---
     mythtv/libs/libmythui/mythuibuttontree.h     |    3 ++-
     3 files changed, 36 insertions(+), 8 deletions(-)
    
    diff --git a/mythplugins/mythvideo/mythvideo/videodlg.cpp b/mythplugins/mythvideo/mythvideo/videodlg.cpp
    index 24a6c1a..bcff8de 100644
    a b class VideoDialogPrivate 
    14321432
    14331433        if (m_rememberPosition && m_lastTreeNodePath.length())
    14341434        {
     1435            VERBOSE(VB_GENERAL, QString("Saving tree position: %1").arg(m_lastTreeNodePath));
    14351436            gContext->SaveSetting("mythvideo.VideoTreeLastActive",
    14361437                    m_lastTreeNodePath);
    14371438        }
    void VideoDialog::loadData() 
    17971798
    17981799            if (m_d->m_rememberPosition)
    17991800            {
    1800                 QStringList route =
    1801                         gContext->GetSetting("mythvideo.VideoTreeLastActive",
    1802                                 "").split("\n");
    1803                 m_videoButtonTree->SetNodeByString(route);
     1801                /*
     1802                 * We need to remove first element of the route since it is the name of the
     1803                 * root 'Video Home' element
     1804                 */
     1805                m_d->m_lastTreeNodePath = gContext->GetSetting("mythvideo.VideoTreeLastActive", "");
     1806                QStringList route = m_d->m_lastTreeNodePath.split("\n");
     1807                route.removeFirst();
     1808                VERBOSE(VB_GENERAL, QString("Setting tree position: %1").arg(route.join("->")));
     1809                if (m_videoButtonTree->SetNodeByString(route))
     1810                    m_videoButtonTree->SetCurrentDepth(route.length());
     1811               
    18041812            }
    18051813        }
    18061814    }
    void VideoDialog::UpdateText(MythUIButtonListItem *item) 
    29162924
    29172925    if (m_d->m_currentNode)
    29182926        CheckedSet(m_crumbText, m_d->m_currentNode->getRouteByString().join(" > "));
     2927    m_d->m_lastTreeNodePath = m_d->m_currentNode->getRouteByString().join("\n");
    29192928
    29202929    if (node && node->getInt() == kSubFolder)
    29212930        CheckedSet(this, "childcount",
  • mythtv/libs/libmythui/mythuibuttontree.cpp

    diff --git a/mythtv/libs/libmythui/mythuibuttontree.cpp b/mythtv/libs/libmythui/mythuibuttontree.cpp
    index f53bf60..a53d3bd 100644
    a b bool MythUIButtonTree::SetCurrentNode(MythGenericTree *node) 
    347347}
    348348
    349349/*!
     350 * \brief Set depth of the currently selected list
     351 *
     352 * \param depth Depth of the tree for currently selected node
     353 *
     354 * \return True if successful
     355 */
     356bool MythUIButtonTree::SetCurrentDepth(int depth) {
     357    bool listadvance = true;
     358    for(int position=0; position < depth - 1 && listadvance; position++)
     359        listadvance = SwitchList(true);
     360 
     361    return listadvance;
     362}
     363
     364/*!
    350365 * \brief Remove the item from the tree
    351366 *
    352367 * \param item Item to be removed
    void MythUIButtonTree::SetActive(bool active) 
    413428 *
    414429 * \param right If true move to the right or away from the root, if false move to
    415430 *              the left or towards the root
     431 *
     432 * \return True if successful
    416433 */
    417 void MythUIButtonTree::SwitchList(bool right)
     434bool MythUIButtonTree::SwitchList(bool right)
    418435{
    419436    bool doUpdate = false;
    420437    if (right)
    void MythUIButtonTree::SwitchList(bool right) 
    427444            doUpdate = true;
    428445        }
    429446        else
    430             return;
     447            return false;
    431448    }
    432449    else if (!right)
    433450    {
    void MythUIButtonTree::SwitchList(bool right) 
    439456            doUpdate = true;
    440457        }
    441458        else
    442             return;
     459            return false;
    443460    }
    444461
    445462    if (doUpdate)
    void MythUIButtonTree::SwitchList(bool right) 
    451468        m_activeList = m_buttonlists[m_activeListID];
    452469        m_activeList->Select();
    453470    }
     471    return true;
    454472}
    455473
    456474/*!
  • mythtv/libs/libmythui/mythuibuttontree.h

    diff --git a/mythtv/libs/libmythui/mythuibuttontree.h b/mythtv/libs/libmythui/mythuibuttontree.h
    index 7bf5835..7567d3d 100644
    a b class MPUBLIC MythUIButtonTree : public MythUIType 
    2727    bool SetNodeByString(QStringList route);
    2828    bool SetNodeById(QList<int> route);
    2929    bool SetCurrentNode(MythGenericTree *node);
     30    bool SetCurrentDepth(int depth);
    3031    MythGenericTree* GetCurrentNode(void) const { return m_currentNode; }
    3132
    3233    void SetActive(bool active);
    class MPUBLIC MythUIButtonTree : public MythUIType 
    5455    void SetTreeState(bool refreshAll = false);
    5556    bool UpdateList(MythUIButtonList *list, MythGenericTree *node);
    5657
    57     void SwitchList(bool right);
     58    bool SwitchList(bool right);
    5859
    5960    bool m_active;
    6061    bool m_initialized;