make LCDd's exit message configurable

This commit is contained in:
marschap
2007-04-02 15:32:14 +00:00
parent 4839321569
commit a63ae89eb7
6 changed files with 67 additions and 60 deletions
+1
View File
@@ -37,6 +37,7 @@ v.0.5dev (ongoing development)
+ picolcd - driver for Mini-box.com USB LCD picoLCD (Gatewood Green)
+ new ConnectionType pertelian in hd44780 driver (Matteo Pillon)
+ new ConnectionType lcd2usb in hd44780 driver
+ make LCDd's GoodBye message configurable
v.0.5.1
+ config file support in lcdproc client (Andrew Foss)
+4
View File
@@ -78,6 +78,10 @@ User=nobody
# NOTE: Always place a slash as last character !
DriverPath=server/drivers/
# GoodBye message: each entry represents a display line; default: builtin
#GoodBye="Thanks for using"
#GoodBye=" LCDproc!"
# The "...Key=" lines define what the server does with keypresses that
# don't go to any client.
# These are the defaults:
-2
View File
@@ -27,8 +27,6 @@ one there, so I'll keep thinking on it for now.
just to not display a useless menu.
Let the server menu name be configurable in the config file with the
[menu]menuentryname="Menu Name" option in LCDd.conf.
* setting the goodbye msg - which we set to "shutting down", instead of
"Thanks for using lcdproc+linux"
3. SEG - adds the ability to get a stack trace for the LCDd daemon. I
didn't actually catch a useful trace w/ it, but might be a nice
-19
View File
@@ -241,22 +241,3 @@ diff -ruNp lcdproc-0.5.1-orig/server/serverscreens.c lcdproc-0.5.1-working/serve
} else {
w->text[0] = 0;
}
@@ -157,6 +173,18 @@ goodbye_screen ()
char *l16 = " LCDproc! ";
#endif
+#ifndef OPT // disable config goobye
+ char * goodbye_string;
+
+ if ( (goodbye_string = strdup(config_get_string("server", "goodbye", 0, "")))) {
+ t20=t16=goodbye_string;
+ if (strlen(goodbye_string) > 16 )
+ l16 = goodbye_string + 16;
+ if (strlen(goodbye_string) > 20 )
+ l20 = goodbye_string + 20;
+ }
+#endif //OPT
+
if( !display_props )
return 0;
+33
View File
@@ -221,6 +221,39 @@ settings for the LCDproc server <application>LCDd</application>.
to syslog. Defaults to <literal>no</literal>.
</para></listitem>
</varlistentry>
<varlistentry>
<term>
<command>GoodBye=</command>
<arg choice="plain"><replaceable>GOODBYEMSG</replaceable></arg>
</term>
<listitem>
<para>
Define the message left on the screen when LCDd exits.
If not given, it defaults to the builtin
<literal>Thanks for using LCDproc!</literal>.
If it is given, each <code>GoodBye=</code> directive represents
a line on the display.
</para>
<para>
The <replaceable>GOODBYEMSG</replaceable>s will be printed on
the display one after each other starting on the beginning of each line.
So, the definition of
<programlisting>
GoodBye=" So Long,"
GoodBye=" and"
GoodBye="Thanks for All the Fish!"
</programlisting>
prints the well known dolphin's message on the first 3 lines
of the display (which obviously needs to be 24 columns wide
to show the full last line).
</para>
<para>
To simply disable the default builtin message, and leave the screen blank
a single <code>GoodBye=""</code> suffices.
</para>
</listitem>
</varlistentry>
</variablelist>
+29 -39
View File
@@ -22,6 +22,7 @@
#endif
#include "shared/report.h"
#include "shared/configfile.h"
#include "drivers/lcd.h"
#include "drivers.h"
@@ -139,53 +140,42 @@ update_server_screen ()
}
int
goodbye_screen ()
goodbye_screen()
{
char *b20 = " ";
char *t20 = " Thanks for using ";
#ifdef LINUX
char *l20 = " LCDproc and Linux! ";
#else
char *l20 = " LCDproc! ";
#endif
char *b16 = " ";
char *t16 = "Thanks for using";
#ifdef LINUX
char *l16 = " LCDproc+Linux! ";
#else
char *l16 = " LCDproc! ";
#endif
if( !display_props )
if(!display_props)
return 0;
drivers_clear ();
drivers_clear();
if (display_props->height >= 4) {
if (display_props->width >= 20) {
drivers_string (1, 1, b20);
drivers_string (1, 2, t20);
drivers_string (1, 3, l20);
drivers_string (1, 4, b20);
} else {
drivers_string (1, 1, b16);
drivers_string (1, 2, t16);
drivers_string (1, 3, l16);
drivers_string (1, 4, b16);
if (config_has_key("Server", "GoodBye")) { /* custom GoodBye */
int i;
/* loop over all display lines to read config & display message */
for (i = 0; i < display_props->height; i++) {
const char *line = config_get_string("Server", "GoodBye", i, "");
drivers_string(1, 1+i, line);
}
} else {
if (display_props->width >= 20) {
drivers_string (1, 1, t20);
drivers_string (1, 2, l20);
} else {
drivers_string (1, 1, t16);
drivers_string (1, 2, l16);
}
else { /* default GoodBye */
if ((display_props->height >= 2) && (display_props->width >= 16)) {
int xoffs = (display_props->width - 16) / 2;
int yoffs = (display_props->height - 2) / 2;
char *top = "Thanks for using";
#ifdef LINUX
char *low = "LCDproc & Linux!";
#else
char *low = " LCDproc! ";
#endif
drivers_string(1+xoffs, 1+yoffs, top);
drivers_string(1+xoffs, 2+yoffs, low);
}
}
drivers_cursor (1, 1, CURSOR_OFF);
drivers_flush ();
drivers_cursor(1, 1, CURSOR_OFF);
drivers_flush();
return 0;
}