[mythtv] [PATCH] Clear bookmarks from Watch Recordings

Kevin Kuphal kuphal at dls.net
Fri Jun 11 23:33:04 EDT 2004


This patch is includes my previous patch labeled "Play from 
Beginning..." as I did not know how to separate these two since they 
both modified the same files. 

This patch adds an additional button to the Action menu of the Watch 
Recordings screen that, if bookmarks are set on a recording, will allow 
the clearing of the bookmarks permanently.  If no bookmarks are set, no 
button is visible.  I find this most useful when I have automatic 
bookmarking enabled and have situations where I do not want to save the 
bookmark.

Thank you,
Kevin
-------------- next part --------------
Index: mythtv/libs/libmythtv/programinfo.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/programinfo.cpp,v
retrieving revision 1.139
diff -n -u -r1.139 programinfo.cpp
--- mythtv/libs/libmythtv/programinfo.cpp	6 Jun 2004 19:17:53 -0000	1.139
+++ mythtv/libs/libmythtv/programinfo.cpp	12 Jun 2004 03:26:06 -0000
@@ -57,6 +57,8 @@
     repeat = false;
 
     record = NULL;
+
+    ignoreBookmark = false;
 }   
         
 ProgramInfo::ProgramInfo(const ProgramInfo &other)
@@ -108,6 +110,8 @@
     programid = other.programid;
 
     record = NULL;
+
+    ignoreBookmark = other.ignoreBookmark;
 }
 
 ProgramInfo &ProgramInfo::operator=(const ProgramInfo &other)
@@ -162,6 +166,8 @@
     programid = other.programid;
 
     record = NULL;
+   
+    ignoreBookmark = other.ignoreBookmark;
 
     return *this;
 }
@@ -995,6 +1001,8 @@
 
     long long pos = 0;
 
+    if (ignoreBookmark) return pos;
+
     QString starts = recstartts.toString("yyyyMMddhhmm");
     starts += "00";
 
Index: mythtv/libs/libmythtv/programinfo.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/programinfo.h,v
retrieving revision 1.80
diff -n -u -r1.80 programinfo.h
--- mythtv/libs/libmythtv/programinfo.h	6 Jun 2004 19:17:53 -0000	1.80
+++ mythtv/libs/libmythtv/programinfo.h	12 Jun 2004 03:26:06 -0000
@@ -271,6 +271,7 @@
     QString seriesid;
     QString programid;
 
+    bool ignoreBookmark;
 
 private:
     void handleRecording(QSqlDatabase *db);
Index: mythtv/programs/mythfrontend/playbackbox.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.cpp,v
retrieving revision 1.157
diff -n -u -r1.157 playbackbox.cpp
--- mythtv/programs/mythfrontend/playbackbox.cpp	5 Jun 2004 01:20:32 -0000	1.157
+++ mythtv/programs/mythfrontend/playbackbox.cpp	12 Jun 2004 03:26:07 -0000
@@ -1743,8 +1743,11 @@
     expectingPopup = true;
 }
 
-void PlaybackBox::showActionPopup(ProgramInfo *program)
+void PlaybackBox::showAdvActionPopup()
 {
+    if (expectingPopup)
+        cancelPopup();
+
     backup.begin(this);
     grayOut(&backup);
     backup.end();
@@ -1753,22 +1756,11 @@
                              popupForeground, popupBackground,
                              popupHighlight, "action popup");
 
-    initPopup(popup, program, "", tr("Select action:"));
+    initPopup(popup, delitem, "", tr("Select advanced action:"));
 
     QSqlDatabase *db = QSqlDatabase::database();
 
-    QButton *playButton = popup->addButton(tr("Play"), this, SLOT(doPlay()));
-
-
-    if (RemoteGetRecordingStatus(program, overrectime, underrectime) > 0)
-        popup->addButton(tr("Stop Recording"), this, SLOT(askStop()));
-
-    if (delitem && delitem->GetAutoExpireFromRecorded(db))
-        popup->addButton(tr("Don't Auto Expire"), this, SLOT(noAutoExpire()));
-    else
-        popup->addButton(tr("Auto Expire"), this, SLOT(doAutoExpire()));
-
-    popup->addButton(tr("Change Recording Group"), this,
+    QButton *recButton = popup->addButton(tr("Change Recording Group"), this,
                      SLOT(showRecGroupChanger()));
 
     popup->addButton(tr("Edit Recording Schedule"), this,
@@ -1796,9 +1788,50 @@
         popup->addButton(tr("Begin Commercial Flagging"), this,
                          SLOT(doBeginFlagging()));
 
+    popup->addButton(tr("Cancel"), this, SLOT(doCancel()));
+
+    popup->ShowPopup(this, SLOT(doCancel()));
+
+    recButton->setFocus();
+
+    expectingPopup = true;
+}
+
+void PlaybackBox::showActionPopup(ProgramInfo *program)
+{
+    backup.begin(this);
+    grayOut(&backup);
+    backup.end();
+
+    popup = new MythPopupBox(gContext->GetMainWindow(), graphicPopup,
+                             popupForeground, popupBackground,
+                             popupHighlight, "action popup");
+
+    initPopup(popup, program, "", tr("Select action:"));
+
+    QSqlDatabase *db = QSqlDatabase::database();
+
+    QButton *playButton = popup->addButton(tr("Play"), this, SLOT(doPlay()));
+
+    popup->addButton(tr("Play from Beginning"), this, SLOT(doPlayFromBeg()));
+
+    if (RemoteGetRecordingStatus(program, overrectime, underrectime) > 0)
+        popup->addButton(tr("Stop Recording"), this, SLOT(askStop()));
+
+    if (delitem && delitem->GetAutoExpireFromRecorded(db))
+        popup->addButton(tr("Don't Auto Expire"), this, SLOT(noAutoExpire()));
+    else
+        popup->addButton(tr("Auto Expire"), this, SLOT(doAutoExpire()));
+
+    if (curitem->programflags & FL_BOOKMARK)
+        popup->addButton(tr("Clear Bookmarks"), this, SLOT(doClearBookmarks()));
+
     popup->addButton(tr("Delete"), this, SLOT(askDelete()));
+
     popup->addButton(tr("Cancel"), this, SLOT(doCancel()));
 
+    popup->addButton(tr("Show Advanced Actions"), this, SLOT(showAdvActionPopup()));
+
     popup->ShowPopup(this, SLOT(doCancel()));
 
     playButton->setFocus();
@@ -1866,6 +1899,12 @@
     play(delitem);
 }
 
+void PlaybackBox::doPlayFromBeg(void)
+{
+    delitem->ignoreBookmark = true;
+    doPlay();
+}
+
 void PlaybackBox::askStop(void)
 {
     if (!expectingPopup)
@@ -2118,6 +2157,24 @@
     state = kChanging;
 }
 
+void PlaybackBox::doClearBookmarks(void)
+{
+    if (!expectingPopup)
+        return;
+
+    cancelPopup();
+
+    QSqlDatabase *db = QSqlDatabase::database();
+    delitem->SetBookmark(0, db);
+
+    ProgramInfo *tmpItem = findMatchingProgInShowDateData(curitem);
+    if (tmpItem)
+         tmpItem->programflags &= ~FL_BOOKMARK;
+
+    update(infoRect);
+}
+
+
 void PlaybackBox::promptEndOfRecording(ProgramInfo *rec)
 {
     if (!rec)
Index: mythtv/programs/mythfrontend/playbackbox.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.h,v
retrieving revision 1.54
diff -n -u -r1.54 playbackbox.h
--- mythtv/programs/mythfrontend/playbackbox.h	5 Jun 2004 01:20:32 -0000	1.54
+++ mythtv/programs/mythfrontend/playbackbox.h	12 Jun 2004 03:26:07 -0000
@@ -50,8 +50,10 @@
     void showRecGroupChanger();
     void showRecGroupChooser();
     void showRecGroupPasswordChanger();
+    void showAdvActionPopup();
 
     void doPlay();
+    void doPlayFromBeg();
 
     void askStop();
     void doStop();
@@ -81,6 +83,7 @@
     void changeOldPasswordChanged(const QString &newText);
     void doBeginTranscoding();
     void doBeginFlagging();
+    void doClearBookmarks();
   protected:
     void paintEvent(QPaintEvent *);
     void keyPressEvent(QKeyEvent *e);


More information about the mythtv-dev mailing list