Commit a0e66cb4 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Add colored border around buttons

Track button off j2000 tracker also enabled tracking
Log to configurable location (dt_host ini file)
parent b21607f6
......@@ -24,6 +24,7 @@
static char *controller_host = "localhost";
static char *console_host = "localhost";
static char *log_path = "/var/log/dt/";
static bool init_done = false;
static int load_config(void)
......@@ -64,6 +65,12 @@ static int load_config(void)
g_key_file_get_string(keyfile, groups[i], "host", NULL);
}
}
if (!strcmp(groups[i], "log")) {
if (g_key_file_has_key(keyfile, groups[i], "path", NULL)) {
log_path =
g_key_file_get_string(keyfile, groups[i], "path", NULL);
}
}
}
init_done = true;
......@@ -91,3 +98,12 @@ char *dt_host_controller(void)
return controller_host;
}
char *dt_host_log_path(void)
{
if (!init_done)
load_config();
return log_path;
}
......@@ -22,5 +22,6 @@
char *dt_host_console(void);
char *dt_host_controller(void);
char *dt_host_log_path(void);
#endif /* _INCLUDE_DT_HOST_H_ */
......@@ -17,6 +17,8 @@
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -29,6 +31,7 @@
#include <sys/param.h>
#include <fcntl.h>
#include <stdbool.h>
#include <time.h>
#include "tcp_listen.h"
#include "tcp_connect.h"
......@@ -38,7 +41,7 @@
#include "command_server.h"
#include "log.h"
char *logfile = "controller.log";
char *logfile = NULL;
#define LOG_RING_SIZE 1000
#define LOG_ENTRY_SIZE 1000
......@@ -122,7 +125,14 @@ int main (int argc, char **argv)
}
if (argc == 2) {
logfile = argv[1];
} else {
char timestamp[100];
time_t now = time(NULL);
strftime(timestamp, 100, "%FT%TZ", gmtime(&now));
asprintf(&logfile, "%s/%s.log", dt_host_log_path(), timestamp);
}
printf("Log file location: %s\n", logfile);
fd_listen = tcp_listen(CONSOLE_LOG_PORT, 0, 100);
if (fd_listen < 0) {
......
......@@ -47,6 +47,8 @@ function dt_button(element)
}
}
var dt_button_border = "2px solid ";
function dt_button_indicator(element)
{
this.div = document.getElementById(element);
......@@ -55,11 +57,17 @@ function dt_button_indicator(element)
this.button_ind_element = 'dt_button_ind_' + element;
this.button_div_element = 'dt_button_div_' + element;
this.div.style.borderColor = "lightgrey";
this.div.style.borderStyle = "solid";
this.div.style.borderTopWidth = "2px";
this.div.style.borderBottomWidth = "4px";
this.div.style.borderLeftWidth = "1px";
this.div.style.borderRightWidth = "1px";
this.div.innerHTML =
"<button type='button' id='" + this.button_element + "'>" +
"<div style='" +
"display:inline-block; margin: 0px 4px 0px 0px; " +
"border:1px inset lightgrey; border-radius: 6px; width:10px; height:10px" +
"display:inline-block; margin: 0px 4px -2px 0px; " +
"border:1px inset lightgrey; border-radius: 7px; width:12px; height:12px" +
"' id='" + this.button_ind_element + "'></div>" +
"<div style='display:inline-block' id='" + this.button_div_element + "'></div>" +
"</button>";
......@@ -76,6 +84,7 @@ function dt_button_indicator(element)
this.background = function dt_button_background(color)
{
this.button_ind.style.background = color;
this.div.style.borderColor = color;
}
this.indicator = this.background;
......
......@@ -1537,7 +1537,7 @@ j2000_dt_model_enabled.click(function() { j2000_toggle_switch('dt_model'); } );
var j2000_track = new dt_button("j2000_track");
j2000_track.value("Track");
j2000_track.click(function() { j2000_do_track(); } );
j2000_track.click(function() { j2000_do_track("enabled=1"); } );
var j2000_copy_position = new dt_button("j2000_copy_position");
j2000_copy_position.value("Copy current position");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment