Skip to content

Commit

Permalink
Allow editing description in Watch Recordings.
Browse files Browse the repository at this point in the history
Add the description to the editmetadata window in Watch Recordings.
This allows users to edit title, subtitle, and description.  This is
somewhat ugly, because we're lacking true support for a multiline
textedit, but it's usable.  Since it's ugly, I've made description and
optional element for the window.

Also changes the menu entry to "Change Recording Metadata" rather than
"Change Recording Title"--since it actually allows you to edit subtitle
and, possibly, description.  Also updates default, MythCenter,
MythCenter-wide, and Terra themes to include description.  If any of
their theme maintainers want it removed from their theme, please let me
know.
  • Loading branch information
sphery committed Mar 3, 2011
1 parent f64c52f commit e8ca189
Show file tree
Hide file tree
Showing 12 changed files with 200 additions and 37 deletions.
23 changes: 15 additions & 8 deletions mythtv/libs/libmythtv/recordinginfo.cpp
Expand Up @@ -608,22 +608,27 @@ void RecordingInfo::ApplyStorageGroupChange(const QString &newstoragegroup)
SendUpdateEvent();
}

/** \fn RecordingInfo::ApplyRecordRecTitleChange(const QString &newTitle, const QString &newSubtitle)
* \brief Sets the recording title and subtitle, both in this RecordingInfo
* and in the database.
/** \fn RecordingInfo::ApplyRecordRecTitleChange(const QString &newTitle, const QString &newSubtitle, const QString &newDescription)
* \brief Sets the recording title, subtitle, and description both in this
* RecordingInfo and in the database.
* \param newTitle New recording title.
* \param newSubtitle New recording subtitle
* \param newDescription New recording description
*/
void RecordingInfo::ApplyRecordRecTitleChange(const QString &newTitle, const QString &newSubtitle)
void RecordingInfo::ApplyRecordRecTitleChange(const QString &newTitle,
const QString &newSubtitle, const QString &newDescription)
{
MSqlQuery query(MSqlQuery::InitCon());
QString sql = "UPDATE recorded SET title = :TITLE, subtitle = :SUBTITLE ";
if (newDescription != NULL)
sql += ", description = :DESCRIPTION ";
sql += " WHERE chanid = :CHANID AND starttime = :START ;";

query.prepare("UPDATE recorded"
" SET title = :TITLE, subtitle = :SUBTITLE"
" WHERE chanid = :CHANID"
" AND starttime = :START ;");
query.prepare(sql);
query.bindValue(":TITLE", newTitle);
query.bindValue(":SUBTITLE", newSubtitle);
if (newDescription != NULL)
query.bindValue(":DESCRIPTION", newDescription);
query.bindValue(":CHANID", chanid);
query.bindValue(":START", recstartts);

Expand All @@ -632,6 +637,8 @@ void RecordingInfo::ApplyRecordRecTitleChange(const QString &newTitle, const QSt

title = newTitle;
subtitle = newSubtitle;
if (newDescription != NULL)
description = newDescription;

SendUpdateEvent();
}
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/recordinginfo.h
Expand Up @@ -207,7 +207,8 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
void ApplyRecordPlayGroupChange(const QString &newrecgroup);
void ApplyStorageGroupChange(const QString &newstoragegroup);
void ApplyRecordRecTitleChange(const QString &newTitle,
const QString &newSubtitle);
const QString &newSubtitle,
const QString &newDescription);
void ApplyTranscoderProfileChange(const QString &profile) const;//pi
void ApplyTranscoderProfileChangeById(int);

Expand Down
27 changes: 20 additions & 7 deletions mythtv/programs/mythfrontend/playbackbox.cpp
Expand Up @@ -2839,7 +2839,7 @@ void PlaybackBox::showRecordingPopup()
m_popupMenu->AddButton(tr("Show Program Details"),
SLOT(showProgramDetails()));

m_popupMenu->AddButton(tr("Change Recording Title"),
m_popupMenu->AddButton(tr("Change Recording Metadata"),
SLOT(showMetadataEditor()));

m_popupMenu->AddButton(tr("Custom Edit"),
Expand Down Expand Up @@ -4583,16 +4583,18 @@ void PlaybackBox::showMetadataEditor()

if (editMetadata->Create())
{
connect(editMetadata, SIGNAL(result(const QString &, const QString &)),
SLOT(saveRecMetadata(const QString &, const QString &)));
connect(editMetadata, SIGNAL(result(const QString &, const QString &,
const QString &)), SLOT(saveRecMetadata(const QString &,
const QString &, const QString &)));
mainStack->AddScreen(editMetadata);
}
else
delete editMetadata;
}

void PlaybackBox::saveRecMetadata(const QString &newTitle,
const QString &newSubtitle)
const QString &newSubtitle,
const QString &newDescription)
{
MythUIButtonListItem *item = m_recordingList->GetItemCurrent();

Expand Down Expand Up @@ -4621,10 +4623,12 @@ void PlaybackBox::saveRecMetadata(const QString &newTitle,
item->SetText(tempSubTitle, "titlesubtitle");
item->SetText(newTitle, "title");
item->SetText(newSubtitle, "subtitle");
if (newDescription != NULL)
item->SetText(newDescription, "description");
}

RecordingInfo ri(*pginfo);
ri.ApplyRecordRecTitleChange(newTitle, newSubtitle);
ri.ApplyRecordRecTitleChange(newTitle, newSubtitle, newDescription);
*pginfo = ri;
}

Expand Down Expand Up @@ -5000,7 +5004,7 @@ RecMetadataEdit::RecMetadataEdit(MythScreenStack *lparent, ProgramInfo *pginfo)
: MythScreenType(lparent, "recmetadataedit"),
m_progInfo(pginfo)
{
m_titleEdit = m_subtitleEdit = NULL;
m_titleEdit = m_subtitleEdit = m_descriptionEdit = NULL;
}

bool RecMetadataEdit::Create()
Expand All @@ -5010,6 +5014,7 @@ bool RecMetadataEdit::Create()

m_titleEdit = dynamic_cast<MythUITextEdit*>(GetChild("title"));
m_subtitleEdit = dynamic_cast<MythUITextEdit*>(GetChild("subtitle"));
m_descriptionEdit = dynamic_cast<MythUITextEdit*>(GetChild("description"));
MythUIButton *okButton = dynamic_cast<MythUIButton*>(GetChild("ok"));

if (!m_titleEdit || !m_subtitleEdit || !okButton)
Expand All @@ -5023,6 +5028,11 @@ bool RecMetadataEdit::Create()
m_titleEdit->SetMaxLength(128);
m_subtitleEdit->SetText(m_progInfo->GetSubtitle());
m_subtitleEdit->SetMaxLength(128);
if (m_descriptionEdit)
{
m_descriptionEdit->SetText(m_progInfo->GetDescription());
m_descriptionEdit->SetMaxLength(255);
}

connect(okButton, SIGNAL(Clicked()), SLOT(SaveChanges()));

Expand All @@ -5035,11 +5045,14 @@ void RecMetadataEdit::SaveChanges()
{
QString newRecTitle = m_titleEdit->GetText();
QString newRecSubtitle = m_subtitleEdit->GetText();
QString newRecDescription = NULL;
if (m_descriptionEdit)
newRecDescription = m_descriptionEdit->GetText();

if (newRecTitle.isEmpty())
return;

emit result(newRecTitle, newRecSubtitle);
emit result(newRecTitle, newRecSubtitle, newRecDescription);
Close();
}

Expand Down
6 changes: 4 additions & 2 deletions mythtv/programs/mythfrontend/playbackbox.h
Expand Up @@ -210,7 +210,8 @@ class PlaybackBox : public ScheduleCommon
void setRecGroup(QString newRecGroup);
void setPlayGroup(QString newPlayGroup);

void saveRecMetadata(const QString &newTitle, const QString &newSubtitle);
void saveRecMetadata(const QString &newTitle, const QString &newSubtitle,
const QString &newDescription);

void SetRecGroupPassword(const QString &newPasswd);

Expand Down Expand Up @@ -521,14 +522,15 @@ class RecMetadataEdit : public MythScreenType
bool Create(void);

signals:
void result(const QString &, const QString &);
void result(const QString &, const QString &, const QString &);

protected slots:
void SaveChanges(void);

private:
MythUITextEdit *m_titleEdit;
MythUITextEdit *m_subtitleEdit;
MythUITextEdit *m_descriptionEdit;

ProgramInfo *m_progInfo;
};
Expand Down
32 changes: 32 additions & 0 deletions mythtv/themes/MythCenter-wide/base.xml
Expand Up @@ -753,6 +753,38 @@
</textarea>
</textedit>

<!-- Base definition of a multi-line textedit -->
<textedit name="basemultilinetextedit">
<area>0,0,376,110</area>
<statetype name="background">
<state name="active">
<area>0,0,376,110</area>
<shape name="background" from="basewidgetshape" />
<shape name="textbackground">
<area>10,10,356,90</area>
<type>roundbox</type>
<cornerradius>4</cornerradius>
<fill color="#FFFFFF" alpha="200" />
</shape>
</state>
<state name="selected" from="active">
<shape name="background" from="baseselectedwidgetshape" />
<shape name="textbackground">
<fill color="#FFFFFF" alpha="255" />
</shape>
</state>
<state name="inactive" from="active" />
</statetype>
<imagetype name="cursor">
<filename>cursor.png</filename>
</imagetype>
<textarea name="text">
<area>12,12,352,103</area>
<font>basesmall_textedit</font>
<multiline>yes</multiline>
</textarea>
</textedit>

<!-- Base definition of a progressbar -->
<progressbar name="baseprogressbar">
<area>0,0,536,38</area>
Expand Down
21 changes: 15 additions & 6 deletions mythtv/themes/MythCenter-wide/recordings-ui.xml
Expand Up @@ -822,32 +822,41 @@
</imagetype>

<textarea name="label" from="basetextarea">
<area>12,14,470,160</area>
<area>12,15,470,60</area>
<multiline>yes</multiline>
<align>allcenter</align>
<value>Edit Recording Metadata</value>
</textarea>

<textarea name="titlelabel" from="basetextarea">
<area>58,180,300,30</area>
<area>58,80,300,30</area>
<value>Title:</value>
</textarea>

<textedit name="title" from="basetextedit">
<position>58,210</position>
<position>58,110</position>
</textedit>

<textarea name="subtitlelabel" from="basetextarea">
<area>58,310,300,30</area>
<area>58,170,300,30</area>
<value>Subtitle:</value>
</textarea>

<textedit name="subtitle" from="basetextedit">
<position>58,340</position>
<position>58,200</position>
</textedit>

<textarea name="descriptionlabel" from="basetextarea">
<area>58,260,300,30</area>
<value>Description:</value>
</textarea>

<textedit name="description" from="basemultilinetextedit">
<position>58,290</position>
</textedit>

<button name="ok" from="basebutton">
<position>174,434</position>
<position>175,434</position>
<value>OK</value>
</button>
</window>
Expand Down
32 changes: 32 additions & 0 deletions mythtv/themes/MythCenter/base.xml
Expand Up @@ -639,6 +639,38 @@
</textarea>
</textedit>

<!-- Base definition of a multi-line textedit -->
<textedit name="basemultilinetextedit">
<area>0,0,375,110</area>
<statetype name="background">
<state name="active">
<area>0,0,375,110</area>
<shape name="background" from="basewidgetshape" />
<shape name="textbackground">
<area>10,10,355,90</area>
<type>roundbox</type>
<cornerradius>4</cornerradius>
<fill color="#FFFFFF" alpha="200" />
</shape>
</state>
<state name="selected" from="active">
<shape name="background" from="baseselectedwidgetshape" />
<shape name="textbackground">
<fill color="#FFFFFF" alpha="255" />
</shape>
</state>
<state name="inactive" from="active" />
</statetype>
<imagetype name="cursor">
<filename>cursor.png</filename>
</imagetype>
<textarea name="text">
<area>13,13,351,103</area>
<font>basesmallblack</font>
<multiline>true</multiline>
</textarea>
</textedit>

<!-- Base definition of a progressbar -->
<progressbar name="baseprogressbar">
<area>0,0,536,38</area>
Expand Down
19 changes: 14 additions & 5 deletions mythtv/themes/MythCenter/recordings-ui.xml
Expand Up @@ -438,28 +438,37 @@
</imagetype>

<textarea name="label" from="basetextarea">
<area>12,15,470,160</area>
<area>12,15,470,60</area>
<multiline>yes</multiline>
<align>allcenter</align>
<value>Edit Recording Metadata</value>
</textarea>

<textarea name="titlelabel" from="basetextarea">
<area>58,180,300,30</area>
<area>58,80,300,30</area>
<value>Title:</value>
</textarea>

<textedit name="title" from="basetextedit">
<position>58,210</position>
<position>58,110</position>
</textedit>

<textarea name="subtitlelabel" from="basetextarea">
<area>58,310,300,30</area>
<area>58,170,300,30</area>
<value>Subtitle:</value>
</textarea>

<textedit name="subtitle" from="basetextedit">
<position>58,340</position>
<position>58,200</position>
</textedit>

<textarea name="descriptionlabel" from="basetextarea">
<area>58,260,300,30</area>
<value>Description:</value>
</textarea>

<textedit name="description" from="basemultilinetextedit">
<position>58,290</position>
</textedit>

<button name="ok" from="basebutton">
Expand Down
8 changes: 8 additions & 0 deletions mythtv/themes/Terra/base.xml
Expand Up @@ -134,6 +134,14 @@
</textarea>
</textedit>

<!-- Base definition of a short multi-line textedit -->
<textedit name="baseshortmultilinetextedit" from="baseshorttextedit">
<area>0,0,318,90</area>
<textarea name="text">
<multiline>true</multiline>
</textarea>
</textedit>

<!-- Base definition of a button -->
<button name="basebutton">
<area>0,0,223,53</area>
Expand Down
15 changes: 12 additions & 3 deletions mythtv/themes/Terra/recordings-ui.xml
Expand Up @@ -635,22 +635,31 @@
</textarea>

<textarea name="titlelabel" from="basetextarea">
<area>889,250,378,30</area>
<area>889,225,378,30</area>
<value>Title</value>
<align>hcenter</align>
<font>basemedium</font>
</textarea>

<textedit name="title" from="baseshorttextedit">
<position>919,285</position>
<position>919,250</position>
</textedit>

<textarea name="subtitlelabel" from="titlelabel">
<position>889,380</position>
<position>889,305</position>
<value>Subtitle</value>
</textarea>

<textedit name="subtitle" from="baseshorttextedit">
<position>919,330</position>
</textedit>

<textarea name="descriptionlabel" from="titlelabel">
<position>889,385</position>
<value>Description</value>
</textarea>

<textedit name="description" from="baseshortmultilinetextedit">
<position>919,415</position>
</textedit>

Expand Down

0 comments on commit e8ca189

Please sign in to comment.