On Fri, Aug 14, 2009 at 07:49:29AM +0200, Max Kellermann wrote:
> On 2009/08/14 02:24, Fredrik Lanker <fredrik.lan...@gmail.com> wrote:
> > This patch for ncmpc makes it possible to adjust the seek time, in steps
> > of 5 seconds, in runtime with 'F' and 'B'. The current seek time is
> > displayed top right, next to the volume.
> 
> Do you think this information is important enough to justify reserving
> permanent screen space?  I'd suggest using screen_status_printf() for
> displaying it shortly on the status line.
> ...
> Max

Well, yes and no. I agree it's not important enough to justify
cluttering the ui with it. On the other hand, you probably want to see
beforehand what the time is set to so that you know how far it will jump
when you seek. But I guess you could rely on your memory for that... ;)

Anyway, here is a modifed patch that uses screen_status_printf(), have
no leading whitespace and makes the string translatable. I leave it to
you to decide which version you want to use.

---

diff --git a/src/command.c b/src/command.c
index 3fe825c..e311254 100644
--- a/src/command.c
+++ b/src/command.c
@@ -130,6 +130,10 @@ static command_definition_t cmds[] = {
          N_("Seek forward") },
        { { 'b', 0, 0 }, 0, CMD_SEEK_BACKWARD, "seek-backward",
          N_("Seek backward") },
+       { { 'F', 0, 0 }, 0, CMD_SEEK_TIME_INC, "seek-time-increase",
+         N_("Increase seek time") },
+       { { 'B', 0, 0 }, 0, CMD_SEEK_TIME_DEC, "seek-time-decrease",
+         N_("Decrease seek time") },
        { { '+', RGHT, 0 }, 0, CMD_VOLUME_UP, "volume-up",
          N_("Increase volume") },
        { { '-', LEFT, 0 }, 0, CMD_VOLUME_DOWN, "volume-down",
diff --git a/src/command.h b/src/command.h
index b3222c5..94ba37e 100644
--- a/src/command.h
+++ b/src/command.h
@@ -43,6 +43,8 @@ typedef enum {
        CMD_TRACK_PREVIOUS,
        CMD_SEEK_FORWARD,
        CMD_SEEK_BACKWARD,
+       CMD_SEEK_TIME_INC,
+       CMD_SEEK_TIME_DEC,
        CMD_SHUFFLE,
        CMD_RANDOM,
        CMD_CLEAR,
diff --git a/src/screen.c b/src/screen.c
index e540fec..1e1ec4b 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -796,7 +796,14 @@ screen_client_cmd(mpdclient_t *c, command_t cmd)
                        /* seek_target_time=0; */
                }
                break;
-               /* fall through... */
+       case CMD_SEEK_TIME_INC:
+               options.seek_time += (options.seek_time == 1) ? 4 : 5;
+               screen_status_printf(_("Seek time: %d s"), options.seek_time);
+               break;
+       case CMD_SEEK_TIME_DEC:
+               options.seek_time = (options.seek_time < 6) ? 1 : 
options.seek_time - 5;
+               screen_status_printf(_("Seek time: %d s"), options.seek_time);
+               break;
        case CMD_TRACK_NEXT:
                if (!IS_STOPPED(c->status->state))
                        mpdclient_cmd_next(c);
diff --git a/src/screen_help.c b/src/screen_help.c
index 81b479f..567e396 100644
--- a/src/screen_help.c
+++ b/src/screen_help.c
@@ -86,6 +86,8 @@ static help_text_row_t help_text[] = {
        { 0, CMD_TRACK_PREVIOUS, NULL },
        { 0, CMD_SEEK_FORWARD, NULL },
        { 0, CMD_SEEK_BACKWARD, NULL },
+       { 0, CMD_SEEK_TIME_INC, NULL },
+       { 0, CMD_SEEK_TIME_DEC, NULL },
        { 0, CMD_VOLUME_DOWN, NULL },
        { 0, CMD_VOLUME_UP, NULL },
        { 0, CMD_NONE, NULL },

---

Fredrik

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to