Skip to content

Commit

Permalink
Fix deleting expired recordings in the status screen.
Browse files Browse the repository at this point in the history
There was a bug introduced by 48fb2493
which was preventing recordings from being deleted or their recording group
being changed.

This changes the expire button list back to reloading after something is
changed, each item in the list needs to be updated to reflect the new stats
anyway so there is little advantage to not reloading the list completely. To
speed things up we only grab the expire list once from the BE. We also restore
the position after refreshing the button list which was the original complaint
being fixed by 48fb249.

Refs #9286, #8787.
  • Loading branch information
Paul Harrison committed Jul 27, 2011
1 parent bedc054 commit 9649c3c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
40 changes: 29 additions & 11 deletions mythtv/programs/mythfrontend/statusbox.cpp
Expand Up @@ -463,16 +463,23 @@ void StatusBox::customEvent(QEvent *event)
else if (resultid == "AutoExpireManage")
{
ProgramInfo* rec = qVariantValue<ProgramInfo*>(dce->GetData());
if (!rec)

// button 2 is "No Change"
if (!rec || buttonnum == 2)
return;

// button 1 is "Delete Now"
if ((buttonnum == 0) && rec->QueryIsDeleteCandidate())
{
RemoteDeleteRecording(
if (!RemoteDeleteRecording(
rec->GetChanID(), rec->GetRecordingStartTime(),
false, false);
m_logList->RemoveItem(m_logList->GetItemCurrent());
false, false))
{
LOG(VB_GENERAL, LOG_ERR, QString("Failed to delete recording: %1").arg(rec->GetTitle()));
return;
}
}
// button 1 is "Move To Default Group" or "UnDelete" or "Disable AutoExpire"
else if (buttonnum == 1)
{
if ((rec)->GetRecordingGroup() == "Deleted")
Expand All @@ -491,8 +498,16 @@ void StatusBox::customEvent(QEvent *event)
*rec = ri;
}
}
doAutoExpireList();
}

// remove the changed recording from the expire list
delete m_expList[m_logList->GetCurrentPos()];
m_expList.erase(m_expList.begin() + m_logList->GetCurrentPos());

int pos = m_logList->GetCurrentPos();
int topPos = m_logList->GetTopItemPos();
doAutoExpireList(false);
m_logList->SetItemCurrent(pos, topPos);
}

}
Expand Down Expand Up @@ -1336,7 +1351,7 @@ void StatusBox::doMachineStatus()
/** \fn StatusBox::doAutoExpireList()
* \brief Show list of recordings which may AutoExpire
*/
void StatusBox::doAutoExpireList()
void StatusBox::doAutoExpireList(bool updateExpList)
{
if (m_iconState)
m_iconState->DisplayState("autoexpire");
Expand All @@ -1362,11 +1377,15 @@ void StatusBox::doAutoExpireList()
int deletedGroupCount(0);

vector<ProgramInfo *>::iterator it;
for (it = m_expList.begin(); it != m_expList.end(); ++it)
delete *it;
m_expList.clear();

RemoteGetAllExpiringRecordings(m_expList);
if (updateExpList)
{
for (it = m_expList.begin(); it != m_expList.end(); ++it)
delete *it;
m_expList.clear();

RemoteGetAllExpiringRecordings(m_expList);
}

for (it = m_expList.begin(); it != m_expList.end(); ++it)
{
Expand Down Expand Up @@ -1424,7 +1443,6 @@ void StatusBox::doAutoExpireList()
AddLogLine(contentLine, staticInfo, detailInfo,
staticInfo + detailInfo);
}

}

/* vim: set expandtab tabstop=4 shiftwidth=4: */
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/statusbox.h
Expand Up @@ -43,7 +43,7 @@ class StatusBox : public MythScreenType
void doLogEntries();
void doJobQueueStatus();
void doMachineStatus();
void doAutoExpireList();
void doAutoExpireList(bool updateExpList = true);

private:
MythUIButtonListItem* AddLogLine(const QString & line,
Expand Down

0 comments on commit 9649c3c

Please sign in to comment.