[mythtv] PATCH - Prompt on playback exit.....

John mythtv-dev@snowman.net
Fri, 20 Dec 2002 00:18:30 -0500 (EST)


------=_20021220001830_51550
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

> On Thursday 19 December 2002 09:46 pm, John wrote:
>> This patch prompts you before exiting playback of a recording.  It
>> gives the following options:
>> 1) Save this poision and exit the recording
>> 2) Don't save the posisiton just exit
>> 3) Keep playing
>> 4) Delete the recording
>>
>> Isaac, let me know if I should have taken a different approach..
>
> Looks good -- would you mind making it configurable, though?
>
> Isaac
> _______________________________________________

I new that was comming. I added 'PlaybackExitPrompt' as a configuration
option.  It works fine from settings.txt (int PlaybackExitPrompt=1),
however I cannot seem to get it working with the GUI setup.   I did add it
to the GUI under Playback, General playback, Prompt on playback exit.  I
just could not get the value there to be used. Matt can you comment on
what I am doing wrong? I also noticed that the Sticky Keys value I set in
the GUI is not being used.
I also fixed a typo on the PIP settings 'Buffer name' was 'Buffer size'
(copy and paste...).
John Steele


---------------------------------------------------

diff -ur cvs/MC/libs/libmythtv/tv_play.cpp
cvs.jrs/MC/libs/libmythtv/tv_play.cpp--- cvs/MC/libs/libmythtv/tv_play.cpp	Thu Dec 19 15:11:13 2002
+++ cvs.jrs/MC/libs/libmythtv/tv_play.cpp	Thu Dec 19 23:24:11 2002
@@ -46,6 +46,7 @@
     editmode = false;
     prbuffer = NULL;
     nvp = NULL;
+    requestDelete = false;
 }

 void TV::Init(void)
@@ -686,7 +687,33 @@
             case wsUp: osd->DialogUp(dialogname); break;
             case wsDown: osd->DialogDown(dialogname); break;
             case ' ': case wsEnter: case wsReturn:
-                          osd->TurnDialogOff(dialogname); break;
+                        osd->TurnDialogOff(dialogname);
+			if ( dialogname == "exitplayoptions" ) {
+
+			     int result = osd->GetDialogResponse(dialogname);
+			     dialogname = "";
+
+			     if (result == 3)
+			     {
+			             nvp->Unpause();
+			     }
+			     else if (result == 1)
+			     {
+			             nvp->SetBookmark();
+			             exitPlayer = true;
+			     }
+			     else if (result == 4)

+			     {
+			             exitPlayer = true;
+ 			            requestDelete = true;
+			     }
+			     else
+			     {
+			             exitPlayer = true;
+			     }
+			     break;
+			}
+
             default: break;
         }

@@ -722,7 +749,27 @@
             DoRew();
             break;
         }
-        case wsEscape: exitPlayer = true; break;
+        case wsEscape: {
+                if (StateIsPlaying(internalState) &&
m_context->GetNumSetting("PlaybackExitPrompt")) {+                 nvp->Pause();
+
+                   QString message = QString("You are exiting this
recording");+
+                    QString option1 = "Save this position and go to the
menu";+                     QString option2 = "Do not save, just exit to the menu";
+                     QString option3 = "Keep watching";
+                     QString option4 = "Delete this recording";
+
+                     dialogname = "exitplayoptions";
+                     osd->NewDialogBox(dialogname, message, option1,
option2, option3,+                                       option4, 0);
+
+                } else {
+                        exitPlayer = true;
+                        break;
+                }
+
+        }

         default:
         {
diff -ur cvs/MC/libs/libmythtv/tv_play.h cvs.jrs/MC/libs/libmythtv/tv_play.h
--- cvs/MC/libs/libmythtv/tv_play.h	Sun Dec 15 17:06:49 2002
+++ cvs.jrs/MC/libs/libmythtv/tv_play.h	Thu Dec 19 20:38:35 2002
@@ -43,6 +43,8 @@
     void EmbedOutput(unsigned long wid, int x, int y, int w, int h);
     void StopEmbeddingOutput(void);

+    bool getRequestDelete(void) {return requestDelete; }
+
  protected:
     void doLoadMenu(void);
     static void *MenuHandler(void *param);
@@ -151,6 +153,8 @@

     QString dialogname;
     bool editmode;
+
+    bool requestDelete;  // if set to true the user has requested that
the current recording be deleted. };

 #endif
diff -ur cvs/MC/programs/mythfrontend/globalsettings.h
cvs.jrs/MC/programs/mythfrontend/globalsettings.h--- cvs/MC/programs/mythfrontend/globalsettings.h	Thu Dec 19 15:01:20 2002
+++ cvs.jrs/MC/programs/mythfrontend/globalsettings.h	Thu Dec 19 23:17:04
2002@@ -274,6 +274,15 @@
     };
 };

+class PlaybackExitPrompt: public CheckBoxSetting, public GlobalSetting {
+public:
+    PlaybackExitPrompt():
+        GlobalSetting("PlaybackExitPrompt") {
+        setLabel("Prompt on playback exit");
+        setValue(true);
+    };
+};
+
 class ExternalChannelCommand: public LineEditSetting, public GlobalSetting {
 public:
     ExternalChannelCommand():
@@ -530,7 +539,7 @@
 public:
     PIPBufferName():
         GlobalSetting("PIPBufferName") {
-        setLabel("Buffer size");
+        setLabel("Buffer name");
         setValue("/mnt/store/ringbuf2.nuv");
     };
 };
@@ -551,6 +560,7 @@
         general->addChild(new HorizScanPercentage());
         general->addChild(new XScanDisplacement());
         general->addChild(new YScanDisplacement());
+        general->addChild(new PlaybackExitPrompt());
         addChild(general);

         VerticalConfigurationGroup* osd = new VerticalConfigurationGroup();
diff -ur cvs/MC/programs/mythfrontend/playbackbox.cpp
cvs.jrs/MC/programs/mythfrontend/playbackbox.cpp--- cvs/MC/programs/mythfrontend/playbackbox.cpp	Tue Dec 17 01:09:26 2002
+++ cvs.jrs/MC/programs/mythfrontend/playbackbox.cpp	Thu Dec 19 20:29:30 2002
@@ -375,6 +375,10 @@
         qApp->processEvents();
         qApp->lock();
     }
+    if (tv->getRequestDelete()) {  // the user requested the current
recording be deleted.+        remove(lvitem);
+    }
+
     listview->SetAllowKeypress(true);

     delete tv;


------=_20021220001830_51550
Content-Type: application/octet-stream; name="playbackprompt.diff"
Content-Disposition: attachment; filename="playbackprompt.diff"
Content-Transfer-Encoding: base64

ZGlmZiAtdXIgY3ZzL01DL2xpYnMvbGlibXl0aHR2L3R2X3BsYXkuY3BwIGN2cy5qcnMvTUMvbGli
cy9saWJteXRodHYvdHZfcGxheS5jcHAKLS0tIGN2cy9NQy9saWJzL2xpYm15dGh0di90dl9wbGF5
LmNwcAlUaHUgRGVjIDE5IDE1OjExOjEzIDIwMDIKKysrIGN2cy5qcnMvTUMvbGlicy9saWJteXRo
dHYvdHZfcGxheS5jcHAJVGh1IERlYyAxOSAyMzoyNDoxMSAyMDAyCkBAIC00Niw2ICs0Niw3IEBA
CiAgICAgZWRpdG1vZGUgPSBmYWxzZTsKICAgICBwcmJ1ZmZlciA9IE5VTEw7CiAgICAgbnZwID0g
TlVMTDsKKyAgICByZXF1ZXN0RGVsZXRlID0gZmFsc2U7CiB9CiAKIHZvaWQgVFY6OkluaXQodm9p
ZCkKQEAgLTY4Niw3ICs2ODcsMzMgQEAKICAgICAgICAgICAgIGNhc2Ugd3NVcDogb3NkLT5EaWFs
b2dVcChkaWFsb2duYW1lKTsgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIHdzRG93bjogb3NkLT5E
aWFsb2dEb3duKGRpYWxvZ25hbWUpOyBicmVhazsKICAgICAgICAgICAgIGNhc2UgJyAnOiBjYXNl
IHdzRW50ZXI6IGNhc2Ugd3NSZXR1cm46IAotICAgICAgICAgICAgICAgICAgICAgICAgICBvc2Qt
PlR1cm5EaWFsb2dPZmYoZGlhbG9nbmFtZSk7IGJyZWFrOworICAgICAgICAgICAgICAgICAgICAg
ICAgb3NkLT5UdXJuRGlhbG9nT2ZmKGRpYWxvZ25hbWUpOworCQkJaWYgKCBkaWFsb2duYW1lID09
ICJleGl0cGxheW9wdGlvbnMiICkgeworCisJCQkgICAgIGludCByZXN1bHQgPSBvc2QtPkdldERp
YWxvZ1Jlc3BvbnNlKGRpYWxvZ25hbWUpOworCQkJICAgICBkaWFsb2duYW1lID0gIiI7CisKKwkJ
CSAgICAgaWYgKHJlc3VsdCA9PSAzKQorCQkJICAgICB7CisJCQkgICAgICAgICAgICAgbnZwLT5V
bnBhdXNlKCk7CisJCQkgICAgIH0KKwkJCSAgICAgZWxzZSBpZiAocmVzdWx0ID09IDEpCisJCQkg
ICAgIHsKKwkJCSAgICAgICAgICAgICBudnAtPlNldEJvb2ttYXJrKCk7CisJCQkgICAgICAgICAg
ICAgZXhpdFBsYXllciA9IHRydWU7CisJCQkgICAgIH0KKwkJCSAgICAgZWxzZSBpZiAocmVzdWx0
ID09IDQpCisJCQkgICAgIHsKKwkJCSAgICAgICAgICAgICBleGl0UGxheWVyID0gdHJ1ZTsKKyAJ
CQkgICAgICAgICAgICByZXF1ZXN0RGVsZXRlID0gdHJ1ZTsKKwkJCSAgICAgfQorCQkJICAgICBl
bHNlCisJCQkgICAgIHsKKwkJCSAgICAgICAgICAgICBleGl0UGxheWVyID0gdHJ1ZTsKKwkJCSAg
ICAgfQorCQkJICAgICBicmVhazsKKwkJCX0KKwogICAgICAgICAgICAgZGVmYXVsdDogYnJlYWs7
CiAgICAgICAgIH0KICAgICAgICAgCkBAIC03MjIsNyArNzQ5LDI3IEBACiAgICAgICAgICAgICBE
b1JldygpOyAKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9Ci0gICAgICAgIGNhc2Ugd3NF
c2NhcGU6IGV4aXRQbGF5ZXIgPSB0cnVlOyBicmVhazsKKyAgICAgICAgY2FzZSB3c0VzY2FwZTog
eworICAgICAgICAgICAgICAgIGlmIChTdGF0ZUlzUGxheWluZyhpbnRlcm5hbFN0YXRlKSAmJiBt
X2NvbnRleHQtPkdldE51bVNldHRpbmcoIlBsYXliYWNrRXhpdFByb21wdCIpKSB7CisgICAgICAg
ICAgICAgICAgIG52cC0+UGF1c2UoKTsKKworICAgICAgICAgICAgICAgICAgIFFTdHJpbmcgbWVz
c2FnZSA9IFFTdHJpbmcoIllvdSBhcmUgZXhpdGluZyB0aGlzIHJlY29yZGluZyIpOworCisgICAg
ICAgICAgICAgICAgICAgIFFTdHJpbmcgb3B0aW9uMSA9ICJTYXZlIHRoaXMgcG9zaXRpb24gYW5k
IGdvIHRvIHRoZSBtZW51IjsKKyAgICAgICAgICAgICAgICAgICAgIFFTdHJpbmcgb3B0aW9uMiA9
ICJEbyBub3Qgc2F2ZSwganVzdCBleGl0IHRvIHRoZSBtZW51IjsKKyAgICAgICAgICAgICAgICAg
ICAgIFFTdHJpbmcgb3B0aW9uMyA9ICJLZWVwIHdhdGNoaW5nIjsKKyAgICAgICAgICAgICAgICAg
ICAgIFFTdHJpbmcgb3B0aW9uNCA9ICJEZWxldGUgdGhpcyByZWNvcmRpbmciOworCisgICAgICAg
ICAgICAgICAgICAgICBkaWFsb2duYW1lID0gImV4aXRwbGF5b3B0aW9ucyI7CisgICAgICAgICAg
ICAgICAgICAgICBvc2QtPk5ld0RpYWxvZ0JveChkaWFsb2duYW1lLCBtZXNzYWdlLCBvcHRpb24x
LCBvcHRpb24yLCBvcHRpb24zLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgb3B0aW9uNCwgMCk7CisKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAg
ICAgICAgICAgICAgZXhpdFBsYXllciA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICBi
cmVhazsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgfQogCiAgICAgICAgIGRlZmF1bHQ6
IAogICAgICAgICB7CmRpZmYgLXVyIGN2cy9NQy9saWJzL2xpYm15dGh0di90dl9wbGF5LmggY3Zz
Lmpycy9NQy9saWJzL2xpYm15dGh0di90dl9wbGF5LmgKLS0tIGN2cy9NQy9saWJzL2xpYm15dGh0
di90dl9wbGF5LmgJU3VuIERlYyAxNSAxNzowNjo0OSAyMDAyCisrKyBjdnMuanJzL01DL2xpYnMv
bGlibXl0aHR2L3R2X3BsYXkuaAlUaHUgRGVjIDE5IDIwOjM4OjM1IDIwMDIKQEAgLTQzLDYgKzQz
LDggQEAKICAgICB2b2lkIEVtYmVkT3V0cHV0KHVuc2lnbmVkIGxvbmcgd2lkLCBpbnQgeCwgaW50
IHksIGludCB3LCBpbnQgaCk7CiAgICAgdm9pZCBTdG9wRW1iZWRkaW5nT3V0cHV0KHZvaWQpOwog
CisgICAgYm9vbCBnZXRSZXF1ZXN0RGVsZXRlKHZvaWQpIHtyZXR1cm4gcmVxdWVzdERlbGV0ZTsg
fQorCiAgcHJvdGVjdGVkOgogICAgIHZvaWQgZG9Mb2FkTWVudSh2b2lkKTsKICAgICBzdGF0aWMg
dm9pZCAqTWVudUhhbmRsZXIodm9pZCAqcGFyYW0pOwpAQCAtMTUxLDYgKzE1Myw4IEBACi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