mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-06 17:37:21 +02:00
Portability: Updated to make main re-entrant()
- New INSTALL instructions to emscripten, and AUTHORS for contribution.
This commit is contained in:
parent
cae3f06b7d
commit
7af6db4c17
112 changed files with 960 additions and 1147 deletions
|
@ -36,8 +36,6 @@
|
|||
|
||||
#define STRING_COLUMN_LABEL_DEP "Depends"
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnDepends::ColumnDepends ()
|
||||
{
|
||||
|
@ -49,7 +47,7 @@ ColumnDepends::ColumnDepends ()
|
|||
"indicator"};
|
||||
_examples = {"1 2 10",
|
||||
"[3]",
|
||||
context.config.get ("dependency.indicator")};
|
||||
Context::getContext ().config.get ("dependency.indicator")};
|
||||
|
||||
_hyphenate = false;
|
||||
}
|
||||
|
@ -61,7 +59,7 @@ void ColumnDepends::setStyle (const std::string& value)
|
|||
{
|
||||
Column::setStyle (value);
|
||||
|
||||
if (_style == "indicator" && _label == STRING_COLUMN_LABEL_DEP) _label = _label.substr (0, context.config.get ("dependency.indicator").length ());
|
||||
if (_style == "indicator" && _label == STRING_COLUMN_LABEL_DEP) _label = _label.substr (0, Context::getContext ().config.get ("dependency.indicator").length ());
|
||||
else if (_style == "count" && _label == STRING_COLUMN_LABEL_DEP) _label = "Dep";
|
||||
}
|
||||
|
||||
|
@ -74,7 +72,7 @@ void ColumnDepends::measure (Task& task, unsigned int& minimum, unsigned int& ma
|
|||
{
|
||||
if (_style == "indicator")
|
||||
{
|
||||
minimum = maximum = utf8_width (context.config.get ("dependency.indicator"));
|
||||
minimum = maximum = utf8_width (Context::getContext ().config.get ("dependency.indicator"));
|
||||
}
|
||||
|
||||
else if (_style == "count")
|
||||
|
@ -117,7 +115,7 @@ void ColumnDepends::render (
|
|||
{
|
||||
if (_style == "indicator")
|
||||
{
|
||||
renderStringRight (lines, width, color, context.config.get ("dependency.indicator"));
|
||||
renderStringRight (lines, width, color, Context::getContext ().config.get ("dependency.indicator"));
|
||||
}
|
||||
|
||||
else if (_style == "count")
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include <utf8.h>
|
||||
#include <util.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnDescription::ColumnDescription ()
|
||||
{
|
||||
|
@ -51,9 +49,9 @@ ColumnDescription::ColumnDescription ()
|
|||
"count",
|
||||
"truncated_count"};
|
||||
|
||||
_dateformat = context.config.get ("dateformat.annotation");
|
||||
_dateformat = Context::getContext ().config.get ("dateformat.annotation");
|
||||
if (_dateformat == "")
|
||||
_dateformat = context.config.get ("dateformat");
|
||||
_dateformat = Context::getContext ().config.get ("dateformat");
|
||||
|
||||
std::string t = Datetime ().toString (_dateformat);
|
||||
std::string d = "Move your clothes down on to the lower peg";
|
||||
|
@ -75,9 +73,9 @@ ColumnDescription::ColumnDescription ()
|
|||
d + " [4]",
|
||||
d.substr (0, 20) + "... [4]"};
|
||||
|
||||
_hyphenate = context.config.getBoolean ("hyphenate");
|
||||
_hyphenate = Context::getContext ().config.getBoolean ("hyphenate");
|
||||
|
||||
_indent = context.config.getInteger ("indent.annotation");
|
||||
_indent = Context::getContext ().config.getInteger ("indent.annotation");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <utf8.h>
|
||||
#include <util.h>
|
||||
|
||||
extern Context context;
|
||||
extern Task& contextTask;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -49,7 +48,7 @@ ColumnProject::ColumnProject ()
|
|||
_examples = {"home.garden",
|
||||
"home",
|
||||
" home.garden"};
|
||||
_hyphenate = context.config.getBoolean ("hyphenate");
|
||||
_hyphenate = Context::getContext ().config.getBoolean ("hyphenate");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -127,7 +126,7 @@ void ColumnProject::modify (Task& task, const std::string& value)
|
|||
Variant v;
|
||||
e.evaluateInfixExpression (value, v);
|
||||
task.set (_name, (std::string) v);
|
||||
context.debug (label + _name + " <-- '" + (std::string) v + "' <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- '" + (std::string) v + "' <-- '" + value + '\'');
|
||||
}
|
||||
catch (const std::string& e)
|
||||
{
|
||||
|
@ -136,7 +135,7 @@ void ColumnProject::modify (Task& task, const std::string& value)
|
|||
if (e == "The value is not an expression.")
|
||||
{
|
||||
task.set (_name, value);
|
||||
context.debug (label + _name + " <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- '" + value + '\'');
|
||||
}
|
||||
else
|
||||
throw;
|
||||
|
@ -145,7 +144,7 @@ void ColumnProject::modify (Task& task, const std::string& value)
|
|||
else
|
||||
{
|
||||
task.set (_name, value);
|
||||
context.debug (label + _name + " <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- '" + value + '\'');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include <format.h>
|
||||
#include <cctype>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnRType::ColumnRType ()
|
||||
{
|
||||
|
@ -52,7 +50,7 @@ void ColumnRType::setStyle (const std::string& value)
|
|||
Column::setStyle (value);
|
||||
|
||||
if (_style == "indicator" && _label == "Recurrence type")
|
||||
_label = _label.substr (0, context.config.get ("rtype.indicator").length ());
|
||||
_label = _label.substr (0, Context::getContext ().config.get ("rtype.indicator").length ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <format.h>
|
||||
#include <utf8.h>
|
||||
|
||||
extern Context context;
|
||||
extern Task& contextTask;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -47,7 +46,7 @@ ColumnRecur::ColumnRecur ()
|
|||
_label = "Recur";
|
||||
_modifiable = true;
|
||||
_styles = {"duration", "indicator"};
|
||||
_examples = {"weekly", context.config.get ("recurrence.indicator")};
|
||||
_examples = {"weekly", Context::getContext ().config.get ("recurrence.indicator")};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -58,7 +57,7 @@ void ColumnRecur::setStyle (const std::string& value)
|
|||
Column::setStyle (value);
|
||||
|
||||
if (_style == "indicator" && _label == "Recur")
|
||||
_label = _label.substr (0, context.config.get ("recurrence.indicator").length ());
|
||||
_label = _label.substr (0, Context::getContext ().config.get ("recurrence.indicator").length ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -75,7 +74,7 @@ void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maxi
|
|||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
minimum = maximum = utf8_width (context.config.get ("recurrence.indicator"));
|
||||
minimum = maximum = utf8_width (Context::getContext ().config.get ("recurrence.indicator"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +93,7 @@ void ColumnRecur::render (
|
|||
renderStringRight (lines, width, color, Duration (task.get (_name)).formatISO ());
|
||||
|
||||
else if (_style == "indicator")
|
||||
renderStringRight (lines, width, color, context.config.get ("recurrence.indicator"));
|
||||
renderStringRight (lines, width, color, Context::getContext ().config.get ("recurrence.indicator"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +121,7 @@ void ColumnRecur::modify (Task& task, const std::string& value)
|
|||
{
|
||||
// Store the raw value, for 'recur'.
|
||||
std::string label = " [1;37;43mMODIFICATION[0m ";
|
||||
context.debug (label + _name + " <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- '" + value + '\'');
|
||||
task.set (_name, value);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include <Context.h>
|
||||
#include <utf8.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnStart::ColumnStart ()
|
||||
{
|
||||
|
@ -38,7 +36,7 @@ ColumnStart::ColumnStart ()
|
|||
_label = "Started";
|
||||
|
||||
_styles.push_back ("active");
|
||||
_examples.push_back (context.config.get ("active.indicator"));
|
||||
_examples.push_back (Context::getContext ().config.get ("active.indicator"));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -60,7 +58,7 @@ void ColumnStart::measure (Task& task, unsigned int& minimum, unsigned int& maxi
|
|||
if (task.has (_name))
|
||||
{
|
||||
if (_style == "active")
|
||||
minimum = maximum = utf8_width (context.config.get ("active.indicator"));
|
||||
minimum = maximum = utf8_width (Context::getContext ().config.get ("active.indicator"));
|
||||
else
|
||||
ColumnTypeDate::measure (task, minimum, maximum);
|
||||
|
||||
|
@ -80,7 +78,7 @@ void ColumnStart::render (
|
|||
if (_style == "active")
|
||||
{
|
||||
if (! task.has ("end"))
|
||||
renderStringRight (lines, width, color, context.config.get ("active.indicator"));
|
||||
renderStringRight (lines, width, color, Context::getContext ().config.get ("active.indicator"));
|
||||
}
|
||||
else
|
||||
ColumnTypeDate::render (lines, task, width, color);
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <utf8.h>
|
||||
#include <main.h>
|
||||
|
||||
extern Context context;
|
||||
extern Task& contextTask;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -47,7 +46,7 @@ ColumnTags::ColumnTags ()
|
|||
_label = "Tags";
|
||||
_styles = {"list", "indicator", "count"};
|
||||
_examples = {"home @chore next",
|
||||
context.config.get ("tag.indicator"),
|
||||
Context::getContext ().config.get ("tag.indicator"),
|
||||
"[2]"};
|
||||
_hyphenate = false;
|
||||
}
|
||||
|
@ -61,7 +60,7 @@ void ColumnTags::setStyle (const std::string& value)
|
|||
|
||||
if (_style == "indicator" &&
|
||||
_label == "Tags")
|
||||
_label = _label.substr (0, context.config.get ("tag.indicator").length ());
|
||||
_label = _label.substr (0, Context::getContext ().config.get ("tag.indicator").length ());
|
||||
|
||||
else if (_style == "count" &&
|
||||
_label == "Tags")
|
||||
|
@ -77,7 +76,7 @@ void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maxim
|
|||
{
|
||||
if (_style == "indicator")
|
||||
{
|
||||
minimum = maximum = utf8_width (context.config.get ("tag.indicator"));
|
||||
minimum = maximum = utf8_width (Context::getContext ().config.get ("tag.indicator"));
|
||||
}
|
||||
else if (_style == "count")
|
||||
{
|
||||
|
@ -139,7 +138,7 @@ void ColumnTags::render (
|
|||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
renderStringRight (lines, width, color, context.config.get ("tag.indicator"));
|
||||
renderStringRight (lines, width, color, Context::getContext ().config.get ("tag.indicator"));
|
||||
}
|
||||
else if (_style == "count")
|
||||
{
|
||||
|
@ -173,12 +172,12 @@ void ColumnTags::modify (Task& task, const std::string& value)
|
|||
Variant v;
|
||||
e.evaluateInfixExpression (value, v);
|
||||
task.addTag ((std::string) v);
|
||||
context.debug (label + "tags <-- '" + (std::string) v + "' <-- '" + tag + '\'');
|
||||
Context::getContext ().debug (label + "tags <-- '" + (std::string) v + "' <-- '" + tag + '\'');
|
||||
}
|
||||
else
|
||||
{
|
||||
task.addTag (tag);
|
||||
context.debug (label + "tags <-- '" + tag + '\'');
|
||||
Context::getContext ().debug (label + "tags <-- '" + tag + '\'');
|
||||
}
|
||||
|
||||
feedback_special_tags (task, tag);
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <Filter.h>
|
||||
#include <format.h>
|
||||
|
||||
extern Context context;
|
||||
extern Task& contextTask;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -55,7 +54,7 @@ ColumnTypeDate::ColumnTypeDate ()
|
|||
|
||||
Datetime now;
|
||||
now -= 125; // So that "age" is non-zero.
|
||||
_examples = {now.toString (context.config.get ("dateformat")),
|
||||
_examples = {now.toString (Context::getContext ().config.get ("dateformat")),
|
||||
format (now.toJulian (), 13, 12),
|
||||
now.toEpochString (),
|
||||
now.toISO (),
|
||||
|
@ -81,11 +80,11 @@ void ColumnTypeDate::measure (Task& task, unsigned int& minimum, unsigned int& m
|
|||
// rc.report.<report>.dateformat
|
||||
// rc.dateformat.report
|
||||
// rc.dateformat.
|
||||
std::string format = context.config.get ("report." + _report + ".dateformat");
|
||||
std::string format = Context::getContext ().config.get ("report." + _report + ".dateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat.report");
|
||||
format = Context::getContext ().config.get ("dateformat.report");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
format = Context::getContext ().config.get ("dateformat");
|
||||
|
||||
minimum = maximum = Datetime::length (format);
|
||||
}
|
||||
|
@ -149,12 +148,12 @@ void ColumnTypeDate::render (
|
|||
// rc.report.<report>.dateformat
|
||||
// rc.dateformat.report
|
||||
// rc.dateformat
|
||||
std::string format = context.config.get ("report." + _report + ".dateformat");
|
||||
std::string format = Context::getContext ().config.get ("report." + _report + ".dateformat");
|
||||
if (format == "")
|
||||
{
|
||||
format = context.config.get ("dateformat.report");
|
||||
format = Context::getContext ().config.get ("dateformat.report");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
format = Context::getContext ().config.get ("dateformat");
|
||||
}
|
||||
|
||||
renderStringLeft (lines, width, color, date.toString (format));
|
||||
|
@ -227,7 +226,7 @@ void ColumnTypeDate::modify (Task& task, const std::string& value)
|
|||
std::string label = " [1;37;43mMODIFICATION[0m ";
|
||||
if (evaluatedValue.type () == Variant::type_duration)
|
||||
{
|
||||
context.debug (label + _name + " <-- '" + format ("{1}", format (evaluatedValue.get_duration ())) + "' <-- '" + (std::string) evaluatedValue + "' <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- '" + format ("{1}", format (evaluatedValue.get_duration ())) + "' <-- '" + (std::string) evaluatedValue + "' <-- '" + value + '\'');
|
||||
Datetime date_now;
|
||||
Variant now (date_now.toEpoch (), Variant::type_date);
|
||||
evaluatedValue += now;
|
||||
|
@ -235,7 +234,7 @@ void ColumnTypeDate::modify (Task& task, const std::string& value)
|
|||
else
|
||||
{
|
||||
evaluatedValue.cast (Variant::type_date);
|
||||
context.debug (label + _name + " <-- '" + format ("{1}", evaluatedValue.get_date ()) + "' <-- '" + (std::string) evaluatedValue + "' <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- '" + format ("{1}", evaluatedValue.get_date ()) + "' <-- '" + (std::string) evaluatedValue + "' <-- '" + value + '\'');
|
||||
}
|
||||
|
||||
// If a date doesn't parse (2/29/2014) then it evaluates to zero.
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <Filter.h>
|
||||
#include <format.h>
|
||||
|
||||
extern Context context;
|
||||
extern Task& contextTask;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -71,7 +70,7 @@ void ColumnTypeDuration::modify (Task& task, const std::string& value)
|
|||
if (evaluatedValue.type () == Variant::type_duration)
|
||||
{
|
||||
// Store the raw value, for 'recur'.
|
||||
context.debug (label + _name + " <-- " + (std::string) evaluatedValue + " <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- " + (std::string) evaluatedValue + " <-- '" + value + '\'');
|
||||
task.set (_name, evaluatedValue);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <Filter.h>
|
||||
#include <format.h>
|
||||
|
||||
extern Context context;
|
||||
extern Task& contextTask;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -66,7 +65,7 @@ void ColumnTypeNumeric::modify (Task& task, const std::string& value)
|
|||
}
|
||||
|
||||
std::string label = " [1;37;43mMODIFICATION[0m ";
|
||||
context.debug (label + _name + " <-- '" + evaluatedValue.get_string () + "' <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- '" + evaluatedValue.get_string () + "' <-- '" + value + '\'');
|
||||
|
||||
// If the result is not readily convertible to a numeric value, then this is
|
||||
// an error.
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#define STRING_INVALID_MOD "The '{1}' attribute does not allow a value of '{2}'."
|
||||
|
||||
extern Context context;
|
||||
extern Task& contextTask;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -71,7 +70,7 @@ void ColumnTypeString::modify (Task& task, const std::string& value)
|
|||
if (validate (strValue))
|
||||
{
|
||||
task.set (_name, strValue);
|
||||
context.debug (label + _name + " <-- '" + strValue + "' <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- '" + strValue + "' <-- '" + value + '\'');
|
||||
}
|
||||
else
|
||||
throw format (STRING_INVALID_MOD, _name, value);
|
||||
|
@ -81,7 +80,7 @@ void ColumnTypeString::modify (Task& task, const std::string& value)
|
|||
if (validate (value))
|
||||
{
|
||||
task.set (_name, value);
|
||||
context.debug (label + _name + " <-- '" + value + '\'');
|
||||
Context::getContext ().debug (label + _name + " <-- '" + value + '\'');
|
||||
}
|
||||
else
|
||||
throw format (STRING_INVALID_MOD, _name, value);
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include <utf8.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnUDAString::ColumnUDAString ()
|
||||
{
|
||||
|
@ -84,7 +82,7 @@ void ColumnUDAString::measure (Task& task, unsigned int& minimum, unsigned int&
|
|||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
auto indicator = context.config.get ("uda." + _name + ".indicator");
|
||||
auto indicator = Context::getContext ().config.get ("uda." + _name + ".indicator");
|
||||
if (indicator == "")
|
||||
indicator = "U";
|
||||
|
||||
|
@ -113,7 +111,7 @@ void ColumnUDAString::render (
|
|||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
auto indicator = context.config.get ("uda." + _name + ".indicator");
|
||||
auto indicator = Context::getContext ().config.get ("uda." + _name + ".indicator");
|
||||
if (indicator == "")
|
||||
indicator = "U";
|
||||
|
||||
|
@ -165,7 +163,7 @@ void ColumnUDANumeric::measure (Task& task, unsigned int& minimum, unsigned int&
|
|||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
auto indicator = context.config.get ("uda." + _name + ".indicator");
|
||||
auto indicator = Context::getContext ().config.get ("uda." + _name + ".indicator");
|
||||
if (indicator == "")
|
||||
indicator = "U";
|
||||
|
||||
|
@ -190,7 +188,7 @@ void ColumnUDANumeric::render (
|
|||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
auto indicator = context.config.get ("uda." + _name + ".indicator");
|
||||
auto indicator = Context::getContext ().config.get ("uda." + _name + ".indicator");
|
||||
if (indicator == "")
|
||||
indicator = "U";
|
||||
|
||||
|
@ -244,18 +242,18 @@ void ColumnUDADate::measure (Task& task, unsigned int& minimum, unsigned int& ma
|
|||
// rc.dateformat.report
|
||||
// rc.dateformat
|
||||
Datetime date ((time_t) strtol (value.c_str (), NULL, 10));
|
||||
auto format = context.config.get ("report." + _report + ".dateformat");
|
||||
auto format = Context::getContext ().config.get ("report." + _report + ".dateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat.report");
|
||||
format = Context::getContext ().config.get ("dateformat.report");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
format = Context::getContext ().config.get ("dateformat");
|
||||
|
||||
minimum = maximum = Datetime::length (format);
|
||||
}
|
||||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
auto indicator = context.config.get ("uda." + _name + ".indicator");
|
||||
auto indicator = Context::getContext ().config.get ("uda." + _name + ".indicator");
|
||||
if (indicator == "")
|
||||
indicator = "U";
|
||||
|
||||
|
@ -281,19 +279,19 @@ void ColumnUDADate::render (
|
|||
// rc.report.<report>.dateformat
|
||||
// rc.dateformat.report
|
||||
// rc.dateformat.
|
||||
auto format = context.config.get ("report." + _report + ".dateformat");
|
||||
auto format = Context::getContext ().config.get ("report." + _report + ".dateformat");
|
||||
if (format == "")
|
||||
{
|
||||
format = context.config.get ("dateformat.report");
|
||||
format = Context::getContext ().config.get ("dateformat.report");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
format = Context::getContext ().config.get ("dateformat");
|
||||
}
|
||||
|
||||
renderStringLeft (lines, width, color, Datetime ((time_t) strtol (value.c_str (), NULL, 10)).toString (format));
|
||||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
auto indicator = context.config.get ("uda." + _name + ".indicator");
|
||||
auto indicator = Context::getContext ().config.get ("uda." + _name + ".indicator");
|
||||
if (indicator == "")
|
||||
indicator = "U";
|
||||
|
||||
|
@ -347,7 +345,7 @@ void ColumnUDADuration::measure (Task& task, unsigned int& minimum, unsigned int
|
|||
{
|
||||
if (task.has (_name))
|
||||
{
|
||||
auto indicator = context.config.get ("uda." + _name + ".indicator");
|
||||
auto indicator = Context::getContext ().config.get ("uda." + _name + ".indicator");
|
||||
if (indicator == "")
|
||||
indicator = "U";
|
||||
|
||||
|
@ -375,7 +373,7 @@ void ColumnUDADuration::render (
|
|||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
auto indicator = context.config.get ("uda." + _name + ".indicator");
|
||||
auto indicator = Context::getContext ().config.get ("uda." + _name + ".indicator");
|
||||
if (indicator == "")
|
||||
indicator = "U";
|
||||
|
||||
|
|
|
@ -56,8 +56,6 @@
|
|||
#include <shared.h>
|
||||
#include <format.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Supports the complete column definition:
|
||||
//
|
||||
|
@ -106,7 +104,7 @@ Column* Column::factory (const std::string& name, const std::string& report)
|
|||
else if (column_name == "wait") c = new ColumnWait ();
|
||||
|
||||
// UDA.
|
||||
else if (context.config.has ("uda." + column_name + ".type"))
|
||||
else if (Context::getContext ().config.has ("uda." + column_name + ".type"))
|
||||
c = Column::uda (column_name);
|
||||
|
||||
else
|
||||
|
@ -156,7 +154,7 @@ void Column::uda (std::map <std::string, Column*>& all)
|
|||
// For each UDA, instantiate and initialize ColumnUDA.
|
||||
std::set <std::string> udas;
|
||||
|
||||
for (const auto& i : context.config)
|
||||
for (const auto& i : Context::getContext ().config)
|
||||
{
|
||||
if (i.first.substr (0, 4) == "uda.")
|
||||
{
|
||||
|
@ -181,9 +179,9 @@ void Column::uda (std::map <std::string, Column*>& all)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
Column* Column::uda (const std::string& name)
|
||||
{
|
||||
auto type = context.config.get ("uda." + name + ".type");
|
||||
auto label = context.config.get ("uda." + name + ".label");
|
||||
auto values = context.config.get ("uda." + name + ".values");
|
||||
auto type = Context::getContext ().config.get ("uda." + name + ".type");
|
||||
auto label = Context::getContext ().config.get ("uda." + name + ".label");
|
||||
auto values = Context::getContext ().config.get ("uda." + name + ".values");
|
||||
|
||||
if (type == "string")
|
||||
{
|
||||
|
@ -251,7 +249,7 @@ void Column::renderHeader (
|
|||
int width,
|
||||
Color& color)
|
||||
{
|
||||
if (context.verbose ("label") &&
|
||||
if (Context::getContext ().verbose ("label") &&
|
||||
_label != "")
|
||||
{
|
||||
// Create a basic label.
|
||||
|
@ -263,8 +261,8 @@ void Column::renderHeader (
|
|||
Color c = color;
|
||||
|
||||
// Now underline the header, or add a dashed line.
|
||||
if (context.color () &&
|
||||
context.config.getBoolean ("fontunderline"))
|
||||
if (Context::getContext ().color () &&
|
||||
Context::getContext ().config.getBoolean ("fontunderline"))
|
||||
{
|
||||
c.blend (Color (Color::nocolor, Color::nocolor, true, false, false));
|
||||
lines.push_back (c.colorize (leftJustify (header, width)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue