summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0e1ba21)
raw | patch | inline | side by side (parent: 0e1ba21)
author | Kalle Wallin <kaw@linux.se> | |
Mon, 16 Jan 2006 10:01:35 +0000 (10:01 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Mon, 16 Jan 2006 10:01:35 +0000 (10:01 +0000) |
AUTHORS | patch | blob | history | |
TODO | patch | blob | history | |
configure.ac | patch | blob | history | |
doc/ncmpc.1 | patch | blob | history | |
src/conf.c | patch | blob | history | |
src/options.c | patch | blob | history | |
src/options.h | patch | blob | history | |
src/screen.c | patch | blob | history | |
src/screen_file.c | patch | blob | history |
index 06557c0df44e808fc3bf68e6cb239cac0dafa441..f788d322cea60e9f37f25c73eceff856e68c260b 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
Kalle Wallin <kaw@linux.se>
+Jonathan Fors <etnoy@broach.se>
index 5f705c5e95c12897b0fdb9e797b62f78006963f8..cdcdd2f9bf3f13cb675a3d7fc62289c3042e4a9c 100644 (file)
--- a/TODO
+++ b/TODO
* LIRC support (without irpty) ?
+ * In-program option editor
+
diff --git a/configure.ac b/configure.ac
index 72043d467b9b0c904eed3f503ff5646b195c81ba..836fecd4c4521cea593785a68aabfbf1696f88d3 100644 (file)
--- a/configure.ac
+++ b/configure.ac
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 796ca4a2ba9bef3aebc47c6fd1c6f732d9ce19f8..f87caa4a4294712159f89624689f7103727247bd 100644 (file)
--- 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 4b5e49230e1b8820527d33fd05776c925c528edf..f2c21ea05fb3aaf49dbefffbd5d112046c177e57 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
#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,
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)
{
return colors_assign(name, value);
}
-
static int
parse_color_definition(char *str)
{
{
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 dd31203b63bb1210ee77436a4e3d66545f3a45e4..0f281bc163c934ee176c7894adb8f3adc75b3053 100644 (file)
--- a/src/options.c
+++ b/src/options.c
case 'C': /* --no-colors */
options.enable_colors = FALSE;
break;
- case 'm': /* --mouse */
+ case 'm': /* --mouse */
options.enable_mouse = TRUE;
break;
case 'M': /* --no-mouse */
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 10aba1441b43313c096be706a866066c2e23c463..df6ac6146fad48cee8ef08e1ae8bbb2080242af2 100644 (file)
--- a/src/options.h
+++ b/src/options.h
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 b947190011aac6beaf6c1dd71f0390dca3ef5214..72bdaff36247abf03e1d211db075b38d2fbace58 100644 (file)
--- a/src/screen.c
+++ b/src/screen.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 )
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 b2ca1b6cd9c6c5acd0bf72f9935f116ce9e55a82..f868e2167b36ec74b4cf471406a11f20d7944b1d 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
{
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;