Ticket #10672: mythtv-video-metadata-editor-return-behavior-update.patch

File mythtv-video-metadata-editor-return-behavior-update.patch, 8.1 KB (added by adiemus <mythtv@…>, 12 months ago)

Updated patch for the current state of 0.25-fixes

  • mythtv/programs/mythfrontend/videodlg.cpp

    diff --git a/mythtv/programs/mythfrontend/videodlg.cpp b/mythtv/programs/mythfrontend/videodlg.cpp
    index 0a60b60..36ef274 100644
    a b void VideoDialog::SavePosition(void) 
    893893    gCoreContext->SaveSetting("mythvideo.VideoTreeLastActive", m_d->m_lastTreeNodePath); 
    894894} 
    895895 
     896void VideoDialog::LoadPosition(bool force) 
     897{ 
     898        if(!force && !m_d->m_rememberPosition) { 
     899                //Don't restore position 
     900                return; 
     901        } 
     902 
     903        if (m_d->m_type == DLG_TREE) 
     904    { 
     905        QStringList route = 
     906            gCoreContext->GetSetting("mythvideo.VideoTreeLastActive", 
     907                "").split("\n"); 
     908            m_videoButtonTree->SetNodeByString(route); 
     909    } else if (m_d->m_type == DLG_GALLERY || m_d->m_type == DLG_BROWSER) { 
     910        MythGenericTree *selectedNode = m_d->m_currentNode->getSelectedChild(); 
     911        QStringList lastTreeNodePath = gCoreContext->GetSetting("mythvideo.VideoTreeLastActive", "").split("\n"); 
     912        if (lastTreeNodePath.size() > 0) 
     913        { 
     914            MythGenericTree *node; 
     915 
     916            // go through the path list and set the current node 
     917            for (int i = 0; i < lastTreeNodePath.size(); i++) 
     918            { 
     919                node = m_d->m_currentNode->getChildByName(lastTreeNodePath.at(i)); 
     920                if (node != NULL) 
     921                { 
     922                    // check if the node name is the same as the currently selected 
     923                    // one in the saved tree list. if yes then we are on the right 
     924                    // way down the video tree to find the last saved position 
     925                    if (node->getString().compare(lastTreeNodePath.at(i)) == 0) 
     926                    { 
     927                        // set the folder as the new node so we can travel further down 
     928                        // dont do this if its the last part of the saved video path tree 
     929                        if (node->getInt() == kSubFolder && 
     930                            node->childCount() > 1 && 
     931                            i < lastTreeNodePath.size()-1) 
     932                        { 
     933                            SetCurrentNode(node); 
     934                        } 
     935                        // in the last run the selectedNode will be the last 
     936                        // entry of the saved tree node. 
     937                        if (lastTreeNodePath.at(i) == lastTreeNodePath.last()) 
     938                            selectedNode = node; 
     939                    } 
     940                } 
     941            } 
     942        } 
     943 
     944        typedef QList<MythGenericTree *> MGTreeChildList; 
     945        MGTreeChildList *lchildren = m_d->m_currentNode->getAllChildren(); 
     946 
     947        for (MGTreeChildList::const_iterator p = lchildren->begin(); 
     948                p != lchildren->end(); ++p) 
     949        { 
     950            if (*p != NULL) 
     951            { 
     952                MythUIButtonListItem *item = 
     953                        new MythUIButtonListItem(m_videoButtonList, QString(), 0, 
     954                                true, MythUIButtonListItem::NotChecked); 
     955 
     956                item->SetData(qVariantFromValue(*p)); 
     957 
     958                UpdateItem(item); 
     959 
     960                if (*p == selectedNode) 
     961                    m_videoButtonList->SetItemCurrent(item); 
     962            } 
     963        } 
     964    } 
     965} 
     966 
    896967bool VideoDialog::Create() 
    897968{ 
    898969    if (m_d->m_type == DLG_DEFAULT) 
    void VideoDialog::refreshData() 
    10661137 
    10671138    if (m_novideoText) 
    10681139        m_novideoText->SetVisible(noFiles); 
     1140 
     1141        LoadPosition(true); 
    10691142} 
    10701143 
    10711144void VideoDialog::scanFinished(bool dbChanged) 
    void VideoDialog::loadData() 
    11101183    if (m_d->m_type == DLG_TREE) 
    11111184    { 
    11121185        m_videoButtonTree->AssignTree(m_d->m_rootNode); 
    1113  
    1114         if (m_d->m_firstLoadPass) 
    1115         { 
    1116             m_d->m_firstLoadPass = false; 
    1117  
    1118             if (m_d->m_rememberPosition) 
    1119             { 
    1120                 QStringList route = 
    1121                         gCoreContext->GetSetting("mythvideo.VideoTreeLastActive", 
    1122                                 "").split("\n"); 
    1123                 m_videoButtonTree->SetNodeByString(route); 
    1124             } 
    1125         } 
    11261186    } 
    11271187    else 
    11281188    { 
    void VideoDialog::loadData() 
    11371197        if (!m_d->m_currentNode) 
    11381198            return; 
    11391199 
    1140         MythGenericTree *selectedNode = m_d->m_currentNode->getSelectedChild(); 
    1141  
    1142         // restore the last saved position in the video tree if this is the first 
    1143         // time this method is called and the option is set in the database 
    1144         if (m_d->m_firstLoadPass) 
    1145         { 
    1146             if (m_d->m_rememberPosition) 
    1147             { 
    1148                 QStringList lastTreeNodePath = gCoreContext->GetSetting("mythvideo.VideoTreeLastActive", "").split("\n"); 
    1149  
    1150                 if (m_d->m_type == DLG_GALLERY || m_d->m_type == DLG_BROWSER) 
    1151                 { 
    1152                     if (lastTreeNodePath.size() > 0) 
    1153                     { 
    1154                         MythGenericTree *node; 
    1155  
    1156                         // go through the path list and set the current node 
    1157                         for (int i = 0; i < lastTreeNodePath.size(); i++) 
    1158                         { 
    1159                             node = m_d->m_currentNode->getChildByName(lastTreeNodePath.at(i)); 
    1160                             if (node != NULL) 
    1161                             { 
    1162                                 // check if the node name is the same as the currently selected 
    1163                                 // one in the saved tree list. if yes then we are on the right 
    1164                                 // way down the video tree to find the last saved position 
    1165                                 if (node->getString().compare(lastTreeNodePath.at(i)) == 0) 
    1166                                 { 
    1167                                     // set the folder as the new node so we can travel further down 
    1168                                     // dont do this if its the last part of the saved video path tree 
    1169                                     if (node->getInt() == kSubFolder && 
    1170                                         node->childCount() > 1 && 
    1171                                         i < lastTreeNodePath.size()-1) 
    1172                                     { 
    1173                                         SetCurrentNode(node); 
    1174                                     } 
    1175                                     // in the last run the selectedNode will be the last 
    1176                                     // entry of the saved tree node. 
    1177                                     if (lastTreeNodePath.at(i) == lastTreeNodePath.last()) 
    1178                                         selectedNode = node; 
    1179                                 } 
    1180                             } 
    1181                         } 
    1182                         m_d->m_firstLoadPass = false; 
    1183                     } 
    1184                 } 
    1185             } 
    1186         } 
    1187  
    1188         typedef QList<MythGenericTree *> MGTreeChildList; 
    1189         MGTreeChildList *lchildren = m_d->m_currentNode->getAllChildren(); 
    1190  
    1191         for (MGTreeChildList::const_iterator p = lchildren->begin(); 
    1192                 p != lchildren->end(); ++p) 
    1193         { 
    1194             if (*p != NULL) 
    1195             { 
    1196                 MythUIButtonListItem *item = 
    1197                         new MythUIButtonListItem(m_videoButtonList, QString(), 0, 
    1198                                 true, MythUIButtonListItem::NotChecked); 
    1199  
    1200                 item->SetData(qVariantFromValue(*p)); 
    1201  
    1202                 UpdateItem(item); 
    1203  
    1204                 if (*p == selectedNode) 
    1205                     m_videoButtonList->SetItemCurrent(item); 
    1206             } 
    1207         } 
    12081200    } 
     1201                 
     1202        if (m_d->m_firstLoadPass) 
     1203    { 
     1204        m_d->m_firstLoadPass = false; 
     1205                LoadPosition(false); 
     1206        } 
    12091207 
    12101208    UpdatePosition(); 
    12111209} 
    void VideoDialog::EditMetadata() 
    34413439    if (!metadata) 
    34423440        return; 
    34433441 
     3442        SavePosition(); 
     3443 
    34443444    MythScreenStack *screenStack = GetScreenStack(); 
    34453445 
    34463446    EditMetadataDialog *md_editor = new EditMetadataDialog(screenStack, 
  • mythtv/programs/mythfrontend/videodlg.h

    diff --git a/mythtv/programs/mythfrontend/videodlg.h b/mythtv/programs/mythfrontend/videodlg.h
    index b82fa87..be18fe5 100644
    a b class VideoDialog : public MythScreenType 
    173173    void StartVideoImageSet(VideoMetadata *metadata); 
    174174 
    175175    void SavePosition(void); 
     176        void LoadPosition(bool force); 
    176177 
    177178  private slots: 
    178179