add Hello= config option
This commit is contained in:
@@ -6,9 +6,10 @@ Key:
|
|||||||
* Something changed / fixed
|
* Something changed / fixed
|
||||||
|
|
||||||
v.0.5dev (ongoing development)
|
v.0.5dev (ongoing development)
|
||||||
* lcdexec: notification when called program finishes
|
+ lcdexec: notification when called program finishes
|
||||||
* xosd driver: offset from top-left corner
|
+ xosd driver: offset from top-left corner
|
||||||
|
+ LCDd: Hello= config option for startup message
|
||||||
|
|
||||||
v.0.5.2 (unreleased)
|
v.0.5.2 (unreleased)
|
||||||
* fix switching on/off the Load screen in lcdproc client using the menu
|
* fix switching on/off the Load screen in lcdproc client using the menu
|
||||||
* refactor adv_bignum: support height > 4, loadable chars with offset
|
* refactor adv_bignum: support height > 4, loadable chars with offset
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ User=nobody
|
|||||||
# NOTE: Always place a slash as last character !
|
# NOTE: Always place a slash as last character !
|
||||||
DriverPath=server/drivers/
|
DriverPath=server/drivers/
|
||||||
|
|
||||||
|
# Hello message: each entry represents a display line; default: builtin
|
||||||
|
#Hello=" Welcome to"
|
||||||
|
#Hello=" LCDproc!"
|
||||||
|
|
||||||
# GoodBye message: each entry represents a display line; default: builtin
|
# GoodBye message: each entry represents a display line; default: builtin
|
||||||
#GoodBye="Thanks for using"
|
#GoodBye="Thanks for using"
|
||||||
#GoodBye=" LCDproc!"
|
#GoodBye=" LCDproc!"
|
||||||
|
|||||||
@@ -237,6 +237,38 @@ settings for the LCDproc server <application>LCDd</application>.
|
|||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>Hello=</command>
|
||||||
|
<arg choice="plain"><replaceable>HELLOMSG</replaceable></arg>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Define the startup message printed on the screen when LCDd starts.
|
||||||
|
This message will stay on the screen until a client connects.
|
||||||
|
If not given, it defaults to the builtin server screen that tells
|
||||||
|
how many clients are connected and how many screens these clients
|
||||||
|
are using in total.
|
||||||
|
If it is given, each <code>Hello=</code> directive represents
|
||||||
|
a line on the display.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The <replaceable>HELLOMSG</replaceable>s will be printed on
|
||||||
|
the display one after each other starting on the beginning of each line.
|
||||||
|
So, the definition of
|
||||||
|
<programlisting>
|
||||||
|
Hello=" Welcome to"
|
||||||
|
Hello=" LCDproc!"
|
||||||
|
</programlisting>
|
||||||
|
prints a nice 2-line welcome message to the display.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
To simply disable the default builtin message, and leave the screen blank
|
||||||
|
a single <code>Hello=""</code> suffices.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command>GoodBye=</command>
|
<command>GoodBye=</command>
|
||||||
@@ -270,7 +302,6 @@ settings for the LCDproc server <application>LCDd</application>.
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+56
-23
@@ -7,6 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1999, William Ferrell, Scott Scriven
|
* Copyright (c) 1999, William Ferrell, Scott Scriven
|
||||||
* 2002, Joris Robijn
|
* 2002, Joris Robijn
|
||||||
|
* 2007, Peter Marschall
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Implements the serverscreens
|
* Implements the serverscreens
|
||||||
@@ -24,21 +25,17 @@
|
|||||||
#include "shared/report.h"
|
#include "shared/report.h"
|
||||||
#include "shared/configfile.h"
|
#include "shared/configfile.h"
|
||||||
|
|
||||||
#include "drivers/lcd.h"
|
|
||||||
#include "drivers.h"
|
#include "drivers.h"
|
||||||
#include "clients.h"
|
#include "clients.h"
|
||||||
|
#include "render.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "screenlist.h"
|
#include "screenlist.h"
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "serverscreens.h"
|
#include "serverscreens.h"
|
||||||
|
|
||||||
#define UNSET_INT -1
|
|
||||||
|
|
||||||
#define MAX_SERVERSCREEN_WIDTH 40
|
Screen *server_screen = NULL;
|
||||||
|
|
||||||
|
|
||||||
Screen *server_screen;
|
|
||||||
int rotate_server_screen = UNSET_INT;
|
int rotate_server_screen = UNSET_INT;
|
||||||
|
|
||||||
|
|
||||||
@@ -46,7 +43,8 @@ int
|
|||||||
server_screen_init(void)
|
server_screen_init(void)
|
||||||
{
|
{
|
||||||
Widget *w;
|
Widget *w;
|
||||||
int line;
|
int i;
|
||||||
|
int has_hello_msg = config_has_key("Server", "Hello");
|
||||||
|
|
||||||
debug(RPT_DEBUG, "server_screen_init");
|
debug(RPT_DEBUG, "server_screen_init");
|
||||||
|
|
||||||
@@ -58,6 +56,7 @@ server_screen_init(void)
|
|||||||
}
|
}
|
||||||
server_screen->name = "Server screen";
|
server_screen->name = "Server screen";
|
||||||
server_screen->duration = RENDER_FREQ; /* 1 second, instead of 4...*/
|
server_screen->duration = RENDER_FREQ; /* 1 second, instead of 4...*/
|
||||||
|
server_screen->heartbeat = (has_hello_msg) ? HEARTBEAT_OFF : HEARTBEAT_OPEN;
|
||||||
|
|
||||||
if ((rotate_server_screen == UNSET_INT) || (rotate_server_screen == 1)) {
|
if ((rotate_server_screen == UNSET_INT) || (rotate_server_screen == 1)) {
|
||||||
server_screen->priority = PRI_INFO;
|
server_screen->priority = PRI_INFO;
|
||||||
@@ -66,9 +65,9 @@ server_screen_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create all the widgets...*/
|
/* Create all the widgets...*/
|
||||||
for (line = 1; line <= 4; line++) {
|
for (i = 0; i < display_props->height; i++) {
|
||||||
char id[8];
|
char id[8];
|
||||||
sprintf(id, "line%d", line);
|
sprintf(id, "line%d", i+1);
|
||||||
|
|
||||||
w = widget_create(id, WID_STRING, server_screen);
|
w = widget_create(id, WID_STRING, server_screen);
|
||||||
if (!w) {
|
if (!w) {
|
||||||
@@ -77,14 +76,24 @@ server_screen_init(void)
|
|||||||
}
|
}
|
||||||
screen_add_widget(server_screen, w);
|
screen_add_widget(server_screen, w);
|
||||||
w->x = 1;
|
w->x = 1;
|
||||||
w->y = line;
|
w->y = i+1;
|
||||||
w->text = malloc(MAX_SERVERSCREEN_WIDTH+1);
|
w->text = calloc(LCD_MAX_WIDTH+1, 1);
|
||||||
if (line == 1) {
|
|
||||||
w->type = WID_TITLE;
|
/* depending on Hello in LCDd.conf set the widgets */
|
||||||
strncpy(w->text, "LCDproc Server", MAX_SERVERSCREEN_WIDTH);
|
if (has_hello_msg) {
|
||||||
} else {
|
const char *line = config_get_string("Server", "Hello", i, "");
|
||||||
w->text[0] = '\0';
|
|
||||||
|
strncpy(w->text, line, LCD_MAX_WIDTH);
|
||||||
|
w->text[LCD_MAX_WIDTH] = '\0';
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (i == 0) {
|
||||||
|
w->type = WID_TITLE;
|
||||||
|
strncpy(w->text, "LCDproc Server", LCD_MAX_WIDTH);
|
||||||
|
} else {
|
||||||
|
w->text[0] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* And enqueue the screen*/
|
/* And enqueue the screen*/
|
||||||
@@ -113,10 +122,27 @@ update_server_screen(void)
|
|||||||
Widget *w;
|
Widget *w;
|
||||||
int num_clients;
|
int num_clients;
|
||||||
int num_screens;
|
int num_screens;
|
||||||
|
static int use_default = 0;
|
||||||
|
|
||||||
/* Now get info on the number of connected clients...*/
|
/* Now get info on the number of connected clients...*/
|
||||||
num_clients = clients_client_count();
|
num_clients = clients_client_count();
|
||||||
|
|
||||||
|
/* turn off the Hello message after the first client onnected */
|
||||||
|
if (!use_default && config_has_key("Server", "Hello")) {
|
||||||
|
if (num_clients != 0) {
|
||||||
|
if (!use_default) {
|
||||||
|
server_screen->heartbeat = HEARTBEAT_OPEN;
|
||||||
|
|
||||||
|
w = screen_find_widget(server_screen, "line1");
|
||||||
|
w->type = WID_TITLE;
|
||||||
|
strncpy(w->text, "LCDproc Server", LCD_MAX_WIDTH);
|
||||||
|
}
|
||||||
|
use_default = 1;
|
||||||
|
}
|
||||||
|
if (!use_default)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ... and screens */
|
/* ... and screens */
|
||||||
num_screens = 0;
|
num_screens = 0;
|
||||||
for (c = clients_getfirst(); c != NULL; c = clients_getnext()) {
|
for (c = clients_getfirst(); c != NULL; c = clients_getnext()) {
|
||||||
@@ -126,18 +152,25 @@ update_server_screen(void)
|
|||||||
/* Format strings for the appropriate size display... */
|
/* Format strings for the appropriate size display... */
|
||||||
if (display_props->height >= 3) {
|
if (display_props->height >= 3) {
|
||||||
w = screen_find_widget(server_screen, "line2");
|
w = screen_find_widget(server_screen, "line2");
|
||||||
snprintf(w->text, MAX_SERVERSCREEN_WIDTH,
|
if (w != NULL) {
|
||||||
|
snprintf(w->text, LCD_MAX_WIDTH,
|
||||||
"Clients: %i", num_clients);
|
"Clients: %i", num_clients);
|
||||||
|
}
|
||||||
|
|
||||||
w = screen_find_widget(server_screen, "line3");
|
w = screen_find_widget(server_screen, "line3");
|
||||||
snprintf(w->text, MAX_SERVERSCREEN_WIDTH,
|
if (w != NULL) {
|
||||||
|
snprintf(w->text, LCD_MAX_WIDTH,
|
||||||
"Screens: %i", num_screens);
|
"Screens: %i", num_screens);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
w = screen_find_widget(server_screen, "line2");
|
w = screen_find_widget(server_screen, "line2");
|
||||||
snprintf(w->text, MAX_SERVERSCREEN_WIDTH,
|
if (w != NULL) {
|
||||||
((display_props->width >= 16)
|
snprintf(w->text, LCD_MAX_WIDTH,
|
||||||
? "Cli: %i Scr: %i"
|
((display_props->width >= 16)
|
||||||
: "C: %i S: %i"),
|
? "Cli: %i Scr: %i"
|
||||||
num_clients, num_screens);
|
: "C: %i S: %i"),
|
||||||
|
num_clients, num_screens);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user