Skip to content

Commit

Permalink
Add rsOtherTuning and rsOtherRecording recording statuses.
Browse files Browse the repository at this point in the history
rsOtherShowing is a display only recording status used by mythfrontend
to indicate a program will record or is recording on another related
channel.  There are two long-standing problems with it.  One, it
doesn't distinguish between will record and is recording.  Two, it is
treated as a non-recording type.  Both problems force the user to find
the "other" channel in the EPG or elsewhere in order to see the
complete status and/or maniuplate the recording.  This change
addresses both problems.

Add new rsOtherTuning and rsOtherRecording recording statuses.  These
statuses are analogous to the existing rsTuning and rsRecording
statuses and indicates that a recording is active.  rsOtherShowing is
now analogous to rsWillRecord and indicates future activity.

Treat all of the rsOther* status like their analogs.  This makes it
possible for actions like stoping an active recording or adding an
override without having to navigate to the other channel.

This change also removes oneChanid parameter from the ProgramInfo
constructor and from LoadFromProgram since it is no longer needed.
  • Loading branch information
gigem committed Apr 17, 2012
1 parent 45f24b0 commit 090f847
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 46 deletions.
36 changes: 20 additions & 16 deletions mythtv/libs/libmyth/programinfo.cpp
Expand Up @@ -518,7 +518,7 @@ ProgramInfo::ProgramInfo(
uint _audioproperties,
uint _subtitleType,

const ProgramList &schedList, bool oneChanid) :
const ProgramList &schedList) :
title(_title),
subtitle(_subtitle),
description(_description),
Expand Down Expand Up @@ -618,21 +618,25 @@ ProgramInfo::ProgramInfo(
dupmethod = s.dupmethod;
findid = s.findid;

if (s.recstatus == rsWillRecord ||
s.recstatus == rsRecording ||
s.recstatus == rsTuning)
if (chanstr != s.chanstr)
{
if (oneChanid)
{
chanid = s.chanid;
chanstr = s.chanstr;
chansign = s.chansign;
channame = s.channame;
}
else if ((chanid != s.chanid) && (chanstr != s.chanstr))
{
if (s.recstatus == rsWillRecord)
recstatus = rsOtherShowing;
}
else if (s.recstatus == rsRecording)
recstatus = rsOtherRecording;
else if (s.recstatus == rsTuning)
recstatus = rsOtherTuning;
}

// Stop recording keys on chanid (and recstarts). If the
// recording is running, override the chanid, so we can stop
// it from any matching program. Remove this hack when we
// replace chanid/recstartts as the primary key for the
// recorded and related tables with something better.
if (s.recstatus == rsRecording ||
s.recstatus == rsTuning)
{
chanid = s.chanid;
}
}
}
Expand Down Expand Up @@ -4576,7 +4580,7 @@ static bool FromProgramQuery(
bool LoadFromProgram(
ProgramList &destination,
const QString &sql, const MSqlBindings &bindings,
const ProgramList &schedList, bool oneChanid)
const ProgramList &schedList)
{
destination.clear();

Expand Down Expand Up @@ -4622,7 +4626,7 @@ bool LoadFromProgram(
query.value(24).toInt(), // audioprop
query.value(25).toInt(), // subtitletypes

schedList, oneChanid));
schedList));
}

return true;
Expand Down
6 changes: 2 additions & 4 deletions mythtv/libs/libmyth/programinfo.h
Expand Up @@ -198,8 +198,7 @@ class MPUBLIC ProgramInfo
uint audioprops,
uint subtitletype,

const ProgramList &schedList,
bool oneChanid);
const ProgramList &schedList);
/// Constructs a basic ProgramInfo (used by RecordingInfo)
ProgramInfo(const QString &title,
const QString &subtitle,
Expand Down Expand Up @@ -727,8 +726,7 @@ MPUBLIC bool LoadFromProgram(
ProgramList &destination,
const QString &sql,
const MSqlBindings &bindings,
const ProgramList &schedList,
bool oneChanid);
const ProgramList &schedList);

MPUBLIC bool LoadFromOldRecorded(
ProgramList &destination,
Expand Down
32 changes: 26 additions & 6 deletions mythtv/libs/libmyth/programtypes.cpp
Expand Up @@ -44,10 +44,12 @@ QString toString(MarkTypes type)

QString toUIState(RecStatusType recstatus)
{
if (recstatus == rsRecorded || recstatus == rsWillRecord)
if (recstatus == rsRecorded || recstatus == rsWillRecord ||
recstatus == rsOtherShowing)
return "normal";

if (recstatus == rsRecording || recstatus == rsTuning)
if (recstatus == rsRecording || recstatus == rsTuning ||
recstatus == rsOtherRecording || recstatus == rsOtherTuning)
return "running";

if (recstatus == rsConflict || recstatus == rsOffLine ||
Expand All @@ -57,7 +59,7 @@ QString toUIState(RecStatusType recstatus)
return "error";
}

if (recstatus == rsRepeat || recstatus == rsOtherShowing ||
if (recstatus == rsRepeat ||
recstatus == rsNeverRecord || recstatus == rsDontRecord ||
(recstatus != rsDontRecord && recstatus <= rsEarlierShowing))
{
Expand All @@ -83,7 +85,7 @@ QString toString(RecStatusType recstatus, uint id)
ret = QString::number(id);
break;
case rsTuning:
ret = QObject::tr("t", "RecStatusChar rsTuning");
ret = QString::number(id);
break;
case rsWillRecord:
ret = QString::number(id);
Expand Down Expand Up @@ -143,7 +145,13 @@ QString toString(RecStatusType recstatus, uint id)
ret = QObject::tr("F", "RecStatusChar rsOffLine");
break;
case rsOtherShowing:
ret = QObject::tr("O", "RecStatusChar rsOtherShowing");
ret = QString::number(id);
break;
case rsOtherRecording:
ret = QString::number(id);
break;
case rsOtherTuning:
ret = QString::number(id);
break;
}

Expand Down Expand Up @@ -206,6 +214,10 @@ QString toString(RecStatusType recstatus, RecordingType rectype)
return QObject::tr("Recorder Off-Line");
case rsOtherShowing:
return QObject::tr("Other Showing");
case rsOtherRecording:
return QObject::tr("Other Recording");
case rsOtherTuning:
return QObject::tr("Other Tuning");
}

return QObject::tr("Unknown");
Expand All @@ -232,7 +244,15 @@ QString toDescription(RecStatusType recstatus, RecordingType rectype,
message = QObject::tr("This showing is being recorded.");
break;
case rsTuning:
message = QObject::tr("The channel is being tuned.");
message = QObject::tr("The showing is being tuned.");
break;
case rsOtherRecording:
message = QObject::tr("This showing is being recorded on "
"a different channel.");
break;
case rsOtherTuning:
message = QObject::tr("The showing is being tuned on a "
"different channel.");
break;
case rsRecorded:
message = QObject::tr("This showing was recorded.");
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmyth/programtypes.h
Expand Up @@ -198,6 +198,8 @@ typedef enum SubtitleTypes {
#define kSubtitlePropertyMask (0x0f<<kSubtitlePropertyOffset)

typedef enum RecStatusTypes {
rsOtherRecording = -13,
rsOtherTuning = -12,
rsMissedFuture = -11,
rsTuning = -10,
rsFailed = -9,
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
#define MYTH_BINARY_VERSION "0.26.20120414-1"
#define MYTH_BINARY_VERSION "0.26.20120417-1"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/recordinginfo.cpp
Expand Up @@ -248,7 +248,7 @@ RecordingInfo::RecordingInfo(
bindings[":STARTTS2"] = query_startts;

::LoadFromScheduler(schedList);
LoadFromProgram(progList, querystr, bindings, schedList, false);
LoadFromProgram(progList, querystr, bindings, schedList);

if (!progList.empty())
{
Expand Down Expand Up @@ -341,7 +341,7 @@ RecordingInfo::RecordingInfo(
bindings[":CHANID"] = QString::number(_chanid);
bindings[":STARTTS"] = desiredts.addSecs(50 - desiredts.time().second());

LoadFromProgram(progList, querystr, bindings, schedList, false);
LoadFromProgram(progList, querystr, bindings, schedList);

if (!progList.empty())
nextstart = (*progList.begin())->GetScheduledStartTime();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tvbrowsehelper.cpp
Expand Up @@ -393,7 +393,7 @@ void TVBrowseHelper::GetNextProgramDB(

ProgramList progList;
ProgramList dummySched;
LoadFromProgram(progList, querystr, bindings, dummySched, false);
LoadFromProgram(progList, querystr, bindings, dummySched);

if (progList.empty())
{
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythbackend/services/guide.cpp
Expand Up @@ -106,7 +106,7 @@ DTC::ProgramGuide *Guide::GetProgramGuide( const QDateTime &dtStartTime ,

// ----------------------------------------------------------------------

LoadFromProgram( progList, sSQL, bindings, schedList, false );
LoadFromProgram( progList, sSQL, bindings, schedList );

// ----------------------------------------------------------------------
// Build Response
Expand Down Expand Up @@ -191,7 +191,7 @@ DTC::Program* Guide::GetProgramDetails( int nChanId,

ProgramList progList;

LoadFromProgram( progList, sSQL, bindings, schedList, false );
LoadFromProgram( progList, sSQL, bindings, schedList );

if ( progList.size() == 0)
throw( "Error Reading Program Info" );
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythfrontend/guidegrid.cpp
Expand Up @@ -706,7 +706,7 @@ ProgramList GuideGrid::GetProgramList(uint chanid) const
bindings[":CHANID"] = chanid;

ProgramList dummy;
LoadFromProgram(proglist, querystr, bindings, dummy, false);
LoadFromProgram(proglist, querystr, bindings, dummy);

return proglist;
}
Expand Down Expand Up @@ -1082,7 +1082,7 @@ ProgramList *GuideGrid::getProgramListFromProgram(int chanNum)
bindings[":ENDTS"] =
m_currentEndTime.addSecs(0 - m_currentEndTime.time().second());

LoadFromProgram(*proglist, querystr, bindings, m_recList, false);
LoadFromProgram(*proglist, querystr, bindings, m_recList);
}

return proglist;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/progfind.cpp
Expand Up @@ -577,7 +577,7 @@ void ProgFinder::selectShowData(QString progTitle, int newCurShow)
bindings[":ENDTIME"] = progStart.addSecs(50 - progStart.time().second());

LoadFromScheduler(m_schedList);
LoadFromProgram(m_showData, querystr, bindings, m_schedList, false);
LoadFromProgram(m_showData, querystr, bindings, m_schedList);

updateTimesList();

Expand Down
4 changes: 1 addition & 3 deletions mythtv/programs/mythfrontend/proglist.cpp
Expand Up @@ -1111,7 +1111,6 @@ void ProgLister::FillItemList(bool restorePosition, bool updateDisp)
if (m_curView < 0)
return;

bool oneChanid = false;
QString where;
QString qphrase = m_viewList[m_curView];

Expand Down Expand Up @@ -1228,7 +1227,6 @@ void ProgLister::FillItemList(bool restorePosition, bool updateDisp)
}
else if (m_type == plChannel) // list by channel
{
oneChanid = true;
where = "WHERE channel.visible = 1 "
" AND program.endtime > :PGILSTART "
" AND channel.chanid = :PGILPHRASE2 ";
Expand Down Expand Up @@ -1355,7 +1353,7 @@ void ProgLister::FillItemList(bool restorePosition, bool updateDisp)
else
{
LoadFromScheduler(m_schedList);
LoadFromProgram(m_itemList, where, bindings, m_schedList, oneChanid);
LoadFromProgram(m_itemList, where, bindings, m_schedList);
}

const QRegExp prefixes(
Expand Down
18 changes: 13 additions & 5 deletions mythtv/programs/mythfrontend/schedulecommon.cpp
Expand Up @@ -111,7 +111,8 @@ void ScheduleCommon::EditRecording(ProgramInfo *pginfo)

if (!ri.GetRecordingRuleID())
EditScheduled(&ri);
else if (ri.GetRecordingStatus() <= rsWillRecord)
else if (ri.GetRecordingStatus() <= rsWillRecord ||
ri.GetRecordingStatus() == rsOtherShowing)
ShowRecordingDialog(ri);
else
ShowNotRecordingDialog(ri);
Expand Down Expand Up @@ -215,7 +216,9 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo)
recinfo.GetRecordingEndTime() > now)
{
if (recinfo.GetRecordingStatus() != rsRecording &&
recinfo.GetRecordingStatus() != rsTuning)
recinfo.GetRecordingStatus() != rsTuning &&
recinfo.GetRecordingStatus() != rsOtherRecording &&
recinfo.GetRecordingStatus() != rsOtherTuning)
menuPopup->AddButton(tr("Reactivate"),
qVariantFromValue(recinfo));
else
Expand All @@ -239,6 +242,8 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo)

if (recinfo.GetRecordingStatus() != rsRecording &&
recinfo.GetRecordingStatus() != rsTuning &&
recinfo.GetRecordingStatus() != rsOtherRecording &&
recinfo.GetRecordingStatus() != rsOtherTuning &&
recinfo.GetRecordingRuleType() != kFindOneRecord &&
!((recinfo.GetFindID() == 0 ||
!IsFindApplicable(recinfo)) &&
Expand All @@ -265,7 +270,9 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo)
recinfo.GetRecordingRuleType() != kDontRecord)
{
if (recinfo.GetRecordingStatus() == rsRecording ||
recinfo.GetRecordingStatus() == rsTuning)
recinfo.GetRecordingStatus() == rsTuning ||
recinfo.GetRecordingStatus() == rsOtherRecording ||
recinfo.GetRecordingStatus() == rsOtherTuning)
{
menuPopup->AddButton(tr("Modify Recording Options"),
qVariantFromValue(recinfo));
Expand All @@ -288,7 +295,9 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo)
recinfo.GetRecordingRuleType() == kDontRecord)
{
if (recinfo.GetRecordingStatus() == rsRecording ||
recinfo.GetRecordingStatus() == rsTuning)
recinfo.GetRecordingStatus() == rsTuning ||
recinfo.GetRecordingStatus() == rsOtherRecording ||
recinfo.GetRecordingStatus() == rsOtherTuning)
{
menuPopup->AddButton(tr("Modify Recording Options"),
qVariantFromValue(recinfo));
Expand Down Expand Up @@ -383,7 +392,6 @@ void ScheduleCommon::ShowNotRecordingDialog(const RecordingInfo& recinfo)
recinfo.GetRecordingStatus() == rsPreviousRecording ||
recinfo.GetRecordingStatus() == rsCurrentRecording ||
recinfo.GetRecordingStatus() == rsEarlierShowing ||
recinfo.GetRecordingStatus() == rsOtherShowing ||
recinfo.GetRecordingStatus() == rsNeverRecord ||
recinfo.GetRecordingStatus() == rsRepeat ||
recinfo.GetRecordingStatus() == rsInactive ||
Expand Down
9 changes: 6 additions & 3 deletions mythtv/programs/mythfrontend/viewscheduled.cpp
Expand Up @@ -405,7 +405,10 @@ void ViewScheduled::FillList()
QString state;

const RecStatusType recstatus = pginfo->GetRecordingStatus();
if (recstatus == rsRecording)
if (recstatus == rsRecording ||
recstatus == rsTuning ||
recstatus == rsOtherRecording ||
recstatus == rsOtherTuning)
state = "running";
else if (recstatus == rsConflict ||
recstatus == rsOffLine ||
Expand All @@ -414,7 +417,8 @@ void ViewScheduled::FillList()
recstatus == rsAborted ||
recstatus == rsMissed)
state = "error";
else if (recstatus == rsWillRecord)
else if (recstatus == rsWillRecord ||
recstatus == rsOtherShowing)
{
if ((m_curcard == 0 && m_curinput == 0) ||
pginfo->GetCardID() == m_curcard ||
Expand All @@ -427,7 +431,6 @@ void ViewScheduled::FillList()
}
}
else if (recstatus == rsRepeat ||
recstatus == rsOtherShowing ||
recstatus == rsNeverRecord ||
recstatus == rsDontRecord ||
(recstatus != rsDontRecord &&
Expand Down

0 comments on commit 090f847

Please sign in to comment.