- Feature #1033 allows UDAs to contribute to urgency (thanks to Max Muller).
This commit is contained in:
Paul Beckingham
2012-07-18 23:28:33 -04:00
parent 6a2c047beb
commit a469a2c6d5
6 changed files with 20 additions and 2 deletions

View File

@@ -153,6 +153,7 @@ std::string Config::_defaults =
"\n"
"#urgency.user.project.foo.coefficient=5.0 # Urgency coefficients for 'foo' project\n"
"#urgency.user.tag.foo.coefficient=5.0 # Urgency coefficients for 'foo' tag\n"
"#urgency.uda.foo.coefficient=5.0 # Urgency coefficients for UDA 'foo'\n"
"\n"
"# Color controls.\n"
"color=on # Enable color\n"

View File

@@ -92,8 +92,11 @@ void initializeUrgencyCoefficients ()
std::vector <std::string>::iterator var;
for (var = all.begin (); var != all.end (); ++var)
if (var->substr (0, 13) == "urgency.user.")
{
if (var->substr (0, 13) == "urgency.user." ||
var->substr (0, 12) == "urgency.uda.")
coefficients[*var] = context.config.getReal (*var);
}
}
////////////////////////////////////////////////////////////////////////////////
@@ -1365,6 +1368,14 @@ float Task::urgency_c () const
value += var->second;
}
}
else if (var->first.substr (0, 12) == "urgency.uda.")
{
// urgency.uda.<name>.coefficient
std::string::size_type end = var->first.find (".coefficient");
if (end != std::string::npos)
if (has (var->first.substr (12, end - 12)))
value += var->second;
}
}
}

View File

@@ -238,7 +238,8 @@ int CmdShow::execute (std::string& output)
i->substr (0, 6) != "merge." &&
i->substr (0, 4) != "uda." &&
i->substr (0, 21) != "urgency.user.project." &&
i->substr (0, 17) != "urgency.user.tag.")
i->substr (0, 17) != "urgency.user.tag." &&
i->substr (0, 12) != "urgency.uda.")
{
unrecognized.push_back (*i);
}