Browse files

o cleanup UI: no radio buttons anymore, just simple links.

  • Loading branch information...
1 parent e3e0182 commit 537e34b814ed71c69b07239a695e1be66957d69d @hzeller committed Sep 23, 2012
Showing with 21 additions and 24 deletions.
  1. +0 −1 README.md
  2. +1 −2 folve-main.cc
  3. +20 −21 status-server.cc
View
1 README.md
@@ -134,7 +134,6 @@ The files are searched from the most specific to the least specific type.
Default is 10 seconds; switch off with -1.
-g : Gapless convolving alphabetically adjacent files.
-D : Moderate volume Folve debug messages to syslog.
- Can then also be toggled in the UI.
-f : Operate in foreground; useful for debugging.
-o <mnt-opt> : other generic mount parameters passed to fuse.
-d : High volume fuse debug log. Implies -f.
View
3 folve-main.cc
@@ -195,7 +195,6 @@ static int usage(const char *prg) {
"\t Default is %d seconds; switch off with -1.\n"
"\t-g : Gapless convolving alphabetically adjacent files.\n"
"\t-D : Moderate volume Folve debug messages to syslog.\n"
- "\t Can then also be toggled in the UI.\n"
"\t-f : Operate in foreground; useful for debugging.\n"
"\t-o <mnt-opt> : other generic mount parameters passed to fuse.\n"
"\t-d : High volume fuse debug log. Implies -f.\n",
@@ -258,7 +257,7 @@ int FolveOptionHandling(void *data, const char *arg, int key,
return 0;
}
case FOLVE_OPT_DEBUG:
- rt->fs->set_debug_ui_enabled(true);
+ // rt->fs->set_debug_ui_enabled(true); // Disabled in status-server.
folve::EnableDebugLog(true);
return 0;
case FOLVE_OPT_GAPLESS:
View
41 status-server.cc
@@ -55,6 +55,15 @@ static const char kStartHtmlHeader[] = "<html><head>"
"AABSSURBVCjPrZIxDgAgDAKh8f9froOTirU1ssKFYqS7Q4mktAxFRQDJcsPORMDYsDCXhn331"
"9GPwHJVuaFl3l4D1+h0UjIdbTh9SpP2KQ2AgSfVAdEQGx23tOopAAAAAElFTkSuQmCC'/>\n";
+// TODO put all css information here.
+static const char kCSS[] =
+ "\n<style type='text/css'>"
+ " a:link {text-decoration:none;}\n"
+ " a:visited {text-decoration:none;}\n"
+ " a:hover {text-decoration:underline;}\n"
+ " a:active {text-decoration:underline;}\n"
+ "</style>";
+
// Callback function called by micro http daemon. Gets the StatusServer pointer
// in the user_argument.
int StatusServer::HandleHttp(void* user_argument,
@@ -231,44 +240,33 @@ static void CreateSelection(std::string *result,
result->append(options[0]); // no reason to make this a form :)
return;
}
- result->append("<b>");
+ result->append("<b>[ ");
for (size_t i = 0; i < options.size(); ++i) {
const std::string &c = options[i];
if (i != 0 ) result->append("&nbsp;|&nbsp;");
const bool active = (int) i == selected;
- if (active) result->append("<span style='background:#a0a0ff'>");
- Appendf(result, "<input type='radio' onchange='this.form.submit();' "
- "id='f%zd' name='f' value='%zd'%s>"
- "<label for='f%zd'>%s</label>\n",
- i, i, active ? " checked='checked'" : "",
- i, c.c_str());
- if (active) result->append("</span>");
+ if (active) {
+ Appendf(result, "<span style='background:#a0a0ff'>%s</span>\n", c.c_str());
+ } else {
+ Appendf(result, "<a href='%s?f=%zd'>%s</a>\n", kSettingsUrl, i, c.c_str());
+ }
}
- result->append("</b>");
+ result->append(" ]</b>");
}
void StatusServer::AppendSettingsForm() {
- Appendf(&content_, "<form id='settings-form' action='%s'>\n"
- "<label for='cfg_sel'>Config directory </label>", kSettingsUrl);
+ content_.append("<br/>Config directory: ");
CreateSelection(&content_, ui_config_directories_,
filesystem_->current_cfg_index());
if (filesystem_->config_dirs().size() == 1) {
content_.append(" (This is a boring configuration, add filter directories "
- "with -c &lt;dir&gt; [-c &lt;another-dir&gt; ...] :-) )");
+ "with -c &lt;dir&gt; [-c &lt;another-dir&gt; ...] :-) )");
} else if (filter_switched_) {
content_.append("&nbsp;<span style='font-size:small;background:#FFFFa0;'>"
" (Affects re- or newly opened files.) </span>");
filter_switched_ = false; // only show once.
}
- if (filesystem_->is_debug_ui_enabled()) {
- Appendf(&content_, "<span style='float:right;font-size:small;'>"
- "<label for='dbg_sel'>Folve debug to syslog</label>"
- "<input id='dbg_sel' onchange='this.form.submit();' "
- "type='checkbox' name='d' value='1'%s/></span>",
- folve::IsDebugLogEnabled() ? " checked" : "");
- }
- content_.append("</form>");
- content_.append("<script>document.forms['settings-form'].reset();</script>");
+ // TODO: re-add something for filesystem_->is_debug_ui_enabled()
content_.append("<hr/>");
}
@@ -291,6 +289,7 @@ const std::string &StatusServer::CreatePage() {
Appendf(&content_, "<meta http-equiv='refresh' content='%d'>\n",
meta_refresh_time_);
}
+ content_.append(kCSS);
content_.append("</head>\n");
content_.append("<body style='font-family:Sans-Serif;'>\n");

0 comments on commit 537e34b

Please sign in to comment.