From patchwork Sat Aug 6 22:25:21 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWFya28gTcOka2Vsw6Q=?= X-Patchwork-Id: 11966 Received: from gw02.mail.saunalahti.fi ([195.197.172.116]) by www.linuxtv.org with esmtp (Exim 4.34) id 1E1XHK-0006Ns-2m for vdr@linuxtv.org; Sun, 07 Aug 2005 00:36:30 +0200 Received: from localhost.localdomain (YZKXXXIII.dsl.saunalahti.fi [85.76.50.134]) by gw02.mail.saunalahti.fi (Postfix) with SMTP id E0BD9D0D00 for ; Sun, 7 Aug 2005 01:36:25 +0300 (EEST) Received: (nullmailer pid 4125 invoked by uid 1000); Sat, 06 Aug 2005 22:25:21 -0000 Date: Sun, 7 Aug 2005 01:25:21 +0300 From: Marko =?iso-8859-1?B?TeRrZWzk?= To: Klaus Schmidinger's VDR Subject: Re: [vdr] [PATCH] obey Power key while replaying a recording Message-ID: <20050806222521.GA4097@localhost.localdomain> References: <20050731200208.GC102185@kosh.hut.fi> <42F49469.100@cadsoft.de> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <42F49469.100@cadsoft.de> Organization: Helsinki University of Technology User-Agent: Mutt/1.5.9i X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2005 22:36:30 -0000 Status: O X-Status: X-Keywords: X-UID: 3966 On Sat, Aug 06, 2005 at 12:43:53PM +0200, Klaus Schmidinger wrote: > The way you have done this there will _always_ be a cControl::Shutdown(). > Could it be that you wanted was to have _no_ cControl::Shutdown() in case > there is a recording going on, but the user didn't confirm the > "Recording - shut down anyway?" prompt? In that case you should have added > braces around the 'if' block, as in > > if (Interface->Confirm(tr("Recording - shut down anyway?"))) { > ForceShutdown = true; > cControl::Shutdown(); > } > > Please try it that way and let me know. My bad, I was confused by the indentation of the closing brace. I am used to indenting the closing brace by one fewer level. The attached patch avoids the cControl::Shutdown() if the prompt is not confirmed. It would be even better to add a "confirm shutdown" prompt in the case that no recording is active, but a recorded stream is being played back when hitting the Power key. It can be confusing that the Power key stops recorded playback but not live playback. I'd rather display the "press any key to cancel shutdown" prompt and keep playing back the recorded stream. Alas, I do not know how to achieve that; maybe it would require some more inter-thread communication. Marko --- vdr.c.orig 2005-06-18 14:19:07.000000000 +0300 +++ vdr.c 2005-08-07 01:08:04.000000000 +0300 @@ -739,9 +739,13 @@ break; } if (cRecordControls::Active()) { - if (Interface->Confirm(tr("Recording - shut down anyway?"))) + if (Interface->Confirm(tr("Recording - shut down anyway?"))) { ForceShutdown = true; + cControl::Shutdown(); + } } + else + cControl::Shutdown(); LastActivity = 1; // not 0, see below! UserShutdown = true; break;