Skip to content
Browse files

Fix deleting expired recordings in the status screen.

There was a bug introduced by 48fb249
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...
1 parent bedc054 commit 9649c3ca78580a47643ba349b1038d190bedffad Paul Harrison committed
Showing with 30 additions and 12 deletions.
  1. +29 −11 mythtv/programs/mythfrontend/statusbox.cpp
  2. +1 −1 mythtv/programs/mythfrontend/statusbox.h
View
40 mythtv/programs/mythfrontend/statusbox.cpp
@@ -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")
@@ -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);
}
}
@@ -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");
@@ -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)
{
@@ -1424,7 +1443,6 @@ void StatusBox::doAutoExpireList()
AddLogLine(contentLine, staticInfo, detailInfo,
staticInfo + detailInfo);
}
-
}
/* vim: set expandtab tabstop=4 shiftwidth=4: */
View
2 mythtv/programs/mythfrontend/statusbox.h
@@ -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,

0 comments on commit 9649c3c

Please sign in to comment.
Something went wrong with that request. Please try again.