Ticket #8787: statusbox.patch

File statusbox.patch, 3.0 KB (added by Marc Alban <marcalban@…>, 15 years ago)

Patch to correct selection jumping on AutoExpire? List screen.

  • mythtv/programs/mythfrontend/statusbox.cpp

     
    5151    m_timeFormat = gCoreContext->GetSetting("TimeFormat", "h:mm AP");
    5252    m_timeDateFormat = QString("%1 %2").arg(m_timeFormat).arg(m_dateFormat);
    5353
     54    m_currentExpIndex = -1;
     55
    5456    m_minLevel = gCoreContext->GetNumSetting("LogDefaultView",5);
    5557
    5658    m_iconState = NULL;
     
    438440            ProgramInfo* rec = qVariantValue<ProgramInfo*>(dce->GetData());
    439441            if (!rec)
    440442                return;
     443               
     444            m_currentExpIndex = m_logList->GetCurrentPos();
     445            m_currentExpItem = *rec;
    441446
    442447            if ((buttonnum == 0) && rec->QueryIsDeleteCandidate())
    443448            {
     
    12831288    int                   liveTVCount(0);
    12841289    long long             deletedGroupSize(0);
    12851290    int                   deletedGroupCount(0);
     1291   
     1292    bool                  matchedCurrentItem = false;
     1293    bool                  itemSelected = false;
     1294    int                   selectionOffset = -1;
    12861295
    12871296    vector<ProgramInfo *>::iterator it;
    12881297    for (it = m_expList.begin(); it != m_expList.end(); ++it)
     
    13431352        detailInfo += "\n" + pginfo->toString(ProgramInfo::kTitleSubtitle, " - ");
    13441353
    13451354        AddLogLine(contentLine, detailInfo);
     1355       
     1356        // If the previously selected item still exists in the list and its recording group hasn't
     1357        // changed, then leave it selected.
     1358        if (!matchedCurrentItem && m_currentExpItem.IsSameRecording(*pginfo))
     1359        {
     1360            int index = m_logList->GetCount() - 1;
     1361            if (m_currentExpItem.GetRecordingGroup() == pginfo->GetRecordingGroup())
     1362            {
     1363                m_logList->SetItemCurrent(index);
     1364                itemSelected = true;
     1365            }
     1366            else if (index <= m_currentExpIndex)
     1367            {
     1368                selectionOffset = 0;
     1369            }
     1370            matchedCurrentItem = true;
     1371        }
    13461372    }
    1347 
     1373   
     1374    // If the previously selected item has been removed or moved to a different section of the list
     1375    // select the item that preceded it.
     1376    if (!itemSelected && m_currentExpIndex > 0)
     1377    {
     1378        m_logList->SetItemCurrent(m_currentExpIndex + selectionOffset);
     1379    }
     1380   
     1381    m_currentExpIndex = -1;
    13481382}
    13491383
    13501384/* vim: set expandtab tabstop=4 shiftwidth=4: */
  • mythtv/programs/mythfrontend/statusbox.h

     
    66using namespace std;
    77
    88#include "mythscreentype.h"
     9#include "programinfo.h"
    910
    1011class ProgramInfo;
    1112class MythUIText;
     
    6263    recprof2bps_t      recordingProfilesBPS;
    6364
    6465    vector<ProgramInfo *> m_expList;
     66    ProgramInfo m_currentExpItem;
     67    int m_currentExpIndex;
    6568
    6669    MythScreenStack *m_popupStack;
    6770