aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--AUTHORS1
-rw-r--r--TODO2
-rw-r--r--configure.ac9
-rw-r--r--doc/ncmpc.13
-rw-r--r--src/conf.c21
-rw-r--r--src/options.c5
-rw-r--r--src/options.h1
-rw-r--r--src/screen.c22
-rw-r--r--src/screen_file.c6
9 files changed, 62 insertions, 8 deletions
diff --git a/AUTHORS b/AUTHORS
index 06557c0df..f788d322c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1 +1,2 @@
Kalle Wallin <kaw@linux.se>
+Jonathan Fors <etnoy@broach.se>
diff --git a/TODO b/TODO
index 5f705c5e9..cdcdd2f9b 100644
--- a/TODO
+++ b/TODO
@@ -13,3 +13,5 @@
* LIRC support (without irpty) ?
+ * In-program option editor
+
diff --git a/configure.ac b/configure.ac
index 72043d467..836fecd4c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -240,6 +240,15 @@ AC_MSG_RESULT([$DEFAULT_PORT])
AC_DEFINE_UNQUOTED([DEFAULT_PORT], [$DEFAULT_PORT], [Default MPD port])
AC_DEFINE_UNQUOTED([DEFAULT_PORT_STR], ["$DEFAULT_PORT"], [Default MPD port])
+dnl Default host
+AC_MSG_CHECKING([for default timedisplay type])
+AC_ARG_WITH([default-timedisplay_type],
+ AC_HELP_STRING([--with-default-timedisplay_type=ARG],
+ [default_timedisplay]),
+ [DEFAULT_TIMEDISPLAY_TYPE="$withval"],
+ [DEFAULT_TIMEDISPLAY_TYPE="elapsed"])
+AC_MSG_RESULT([$DEFAULT_TIMEDISPLAY_TYPE])
+AC_DEFINE_UNQUOTED([DEFAULT_TIMEDISPLAY_TYPE], ["$DEFAULT_TIMEDISPLAY_TYPE"], [Default way to display time, either 'elapsed' or 'remaining'])
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile.in])
AC_OUTPUT
diff --git a/doc/ncmpc.1 b/doc/ncmpc.1
index 796ca4a2b..f87caa4a4 100644
--- a/doc/ncmpc.1
+++ b/doc/ncmpc.1
@@ -111,6 +111,9 @@ Set the background color. If the background color is assigned to the keyword \fB
.B color title = TEXTCOLOR
Set the text color for the title row.
.TP
+.B timedisplay-type = elapsed/remaining
+Sets whether to display remaining or elapsed time in the status window. Default is elapsed.
+.TP
.B color title\-bold = TEXTCOLOR
Set the text color for the title row (the bold part).
.TP
diff --git a/src/conf.c b/src/conf.c
index 4b5e49230..f2c21ea05 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -64,6 +64,7 @@
#define CONF_HIDE_CURSOR "hide-cursor"
#define CONF_SEEK_TIME "seek-time"
#define CONF_SCREEN_LIST "screen-list"
+#define CONF_TIMEDISPLAY_TYPE "timedisplay-type"
typedef enum {
KEY_PARSER_UNKNOWN,
@@ -217,6 +218,17 @@ parse_key_definition(char *str)
return assign_keys(cmd, keys);
}
+static char *
+parse_timedisplay_type(char *str)
+{
+ if((!strcmp(str,"elapsed")) || (!strcmp(str,"remaining"))){
+ return str;
+ } else {
+ fprintf(stderr,_("Error: Bad time display type - %s\n"), str);
+ return DEFAULT_TIMEDISPLAY_TYPE;
+ }
+}
+
static int
parse_color(char *str)
{
@@ -243,7 +255,6 @@ parse_color(char *str)
return colors_assign(name, value);
}
-
static int
parse_color_definition(char *str)
{
@@ -460,6 +471,14 @@ read_rc_file(char *filename, options_t *options)
{
options->wide_cursor = str2bool(value);
}
+ /* timer display type */
+ else if( !strcasecmp(CONF_TIMEDISPLAY_TYPE, name) )
+ {
+ g_free(options->timedisplay_type);
+ options->timedisplay_type=g_strdup(parse_timedisplay_type(value));
+ D("deb");
+ D(options->timedisplay_type);
+ }
/* color definition */
else if( !strcasecmp(CONF_COLOR_DEFINITION, name) )
{
diff --git a/src/options.c b/src/options.c
index dd31203b6..0f281bc16 100644
--- a/src/options.c
+++ b/src/options.c
@@ -183,7 +183,7 @@ handle_option(int c, char *arg)
case 'C': /* --no-colors */
options.enable_colors = FALSE;
break;
- case 'm': /* --mouse */
+ case 'm': /* --mouse */
options.enable_mouse = TRUE;
break;
case 'M': /* --no-mouse */
@@ -368,7 +368,8 @@ options_init( void )
options.crossfade_time = DEFAULT_CROSSFADE_TIME;
options.seek_time = 1;
options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0);
-
+ options.timedisplay_type = DEFAULT_TIMEDISPLAY_TYPE;
+
return &options;
}
diff --git a/src/options.h b/src/options.h
index 10aba1441..df6ac6146 100644
--- a/src/options.h
+++ b/src/options.h
@@ -13,6 +13,7 @@ typedef struct
char *status_format;
char *xterm_title_format;
char **screen_list;
+ char *timedisplay_type;
int port;
int crossfade_time;
int search_mode;
diff --git a/src/screen.c b/src/screen.c
index b94719001..72bdaff36 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -306,8 +306,9 @@ paint_status_window(mpdclient_t *c)
WINDOW *w = screen->status_window.w;
mpd_Status *status = c->status;
mpd_Song *song = c->song;
- int elapsedTime = c->status->elapsedTime;
+ int elapsedTime = 0;
char *str = NULL;
+ char *timestr = NULL;
int x = 0;
if( time(NULL) - screen->status_timestamp <= SCREEN_STATUS_MESSAGE_TIME )
@@ -341,11 +342,24 @@ paint_status_window(mpdclient_t *c)
if( IS_PLAYING(status->state) || IS_PAUSED(status->state) )
{
if( status->totalTime > 0 )
- {
- if( c->song && seek_id == c->song->id )
+ {
+
+ /*checks the conf to see whether to display elapsed or remaining time */
+ if(!strcmp(options.timedisplay_type,"elapsed"))
+ {
+ timestr= " [%i:%02i/%i:%02i]";
+ elapsedTime = c->status->elapsedTime;
+ }
+ else if(!strcmp(options.timedisplay_type,"remaining"))
+ {
+ timestr= " [-%i:%02i/%i:%02i]";
+ elapsedTime = (c->status->totalTime - c->status->elapsedTime);
+ }
+ if( c->song && seek_id == c->song->id )
elapsedTime = seek_target_time;
+ /*write out the time*/
g_snprintf(screen->buf, screen->buf_size,
- " [%i:%02i/%i:%02i]",
+ timestr,
elapsedTime/60, elapsedTime%60,
status->totalTime/60, status->totalTime%60 );
}
diff --git a/src/screen_file.c b/src/screen_file.c
index b2ca1b6cd..f868e2167 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -648,8 +648,12 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
{
if( mpdclient_cmd_db_update_utf8(c,filelist->path)==0 )
{
- screen_status_printf(_("Database update of %s started!"),
+ if(strcmp(filelist->path,"")) {
+ screen_status_printf(_("Database update of %s started!"),
filelist->path);
+ } else {
+ screen_status_printf(_("Database update started!"));
+ }
/* set updatingDb to make shure the browse callback gets called
* even if the updated has finished before status is updated */
c->status->updatingDb = 1;