| 1677 | | QStringList route = |
| 1678 | | gCoreContext->GetSetting("mythvideo.VideoTreeLastActive", |
| 1679 | | "").split("\n"); |
| 1680 | | m_videoButtonTree->SetNodeByString(route); |
| | 1679 | // get the last saved path from the database |
| | 1680 | m_d->m_lastTreeNodePath = gCoreContext->GetSetting("mythvideo.VideoTreeLastActive", ""); |
| | 1681 | |
| | 1682 | // remove first element of the route since |
| | 1683 | // it is the name of the root 'Video Home' element |
| | 1684 | QStringList route = m_d->m_lastTreeNodePath.split("\n"); |
| | 1685 | route.removeFirst(); |
| | 1686 | |
| | 1687 | if (m_videoButtonTree->SetNodeByString(route)) |
| | 1688 | m_videoButtonTree->SetCurrentDepth(route.length()); |
| | 1709 | // restore the last saved position in the video tree if this is the first |
| | 1710 | // time this method is called and the option is set in the database |
| | 1711 | if (m_d->m_firstLoadPass && m_d->m_rememberPosition) |
| | 1712 | { |
| | 1713 | QStringList lastTreeNodePath = gCoreContext->GetSetting("mythvideo.VideoTreeLastActive", "").split("\n"); |
| | 1714 | |
| | 1715 | if (m_d->m_type == DLG_GALLERY) |
| | 1716 | { |
| | 1717 | if (lastTreeNodePath.size() > 0) |
| | 1718 | { |
| | 1719 | MythGenericTree *node; |
| | 1720 | |
| | 1721 | // go through the path list and set the current node |
| | 1722 | for (int i = 0; i < lastTreeNodePath.size(); i++) |
| | 1723 | { |
| | 1724 | node = m_d->m_currentNode->getChildByName(lastTreeNodePath.at(i)); |
| | 1725 | if (node != NULL) |
| | 1726 | { |
| | 1727 | // check if the node name is the same as the currently selected |
| | 1728 | // one in the saved tree list. if yes then we are on the right |
| | 1729 | // way down the video tree to find the last saved position |
| | 1730 | if (node->getString().compare(lastTreeNodePath.at(i)) == 0) |
| | 1731 | { |
| | 1732 | // set the folder as the new node so we can travel further down |
| | 1733 | // dont do this if its the last part of the saved video path tree |
| | 1734 | if (node->getInt() == kSubFolder && |
| | 1735 | node->childCount() > 1 && |
| | 1736 | i < lastTreeNodePath.size()-1) |
| | 1737 | { |
| | 1738 | SetCurrentNode(node); |
| | 1739 | } |
| | 1740 | // in the last run the selectedNode will be the last |
| | 1741 | // entry of the saved tree node. |
| | 1742 | if (lastTreeNodePath.at(i) == lastTreeNodePath.last()) |
| | 1743 | selectedNode = node; |
| | 1744 | } |
| | 1745 | } |
| | 1746 | } |
| | 1747 | |
| | 1748 | m_d->m_firstLoadPass = false; |
| | 1749 | } |
| | 1750 | } |
| | 1751 | } |
| | 1752 | |