Priority: Converted 'priority' attribute to a UDA

- 'priority.long' and 'priority.short' formats now map to 'priority', and
  generate a warning.
- Man page updated.
- Converted priority urgency coefficients to UDA equivalents.
- Converted priority color rules to UDA color rules.
- Removed 'default.priority' support.
- Removed special sort handling for 'priority' field in Variant, added special
  UDA sort handling.
- Removed ColPriority.{h,cpp} source files.
- Removed asorted newly-unused variables.
- The 'show' command now highlights unused priority settings.
- Removed unused localized priority-relateѕ strings.
- Added legacy mapping for columns and sort columns for 'priority.long' and
  'priority.short' columns in report definitions.
- Removed priority color rules implementation.
- Removed obsolete tests for #860, #990, custom.priority_long.t.
- Updated various tests that set priority default, colors.
This commit is contained in:
Paul Beckingham
2015-04-04 19:30:33 -04:00
parent 7a9d314016
commit 5af4579741
33 changed files with 102 additions and 630 deletions

View File

@@ -65,14 +65,12 @@ static const float epsilon = 0.000001;
#endif
std::string Task::defaultProject = "";
std::string Task::defaultPriority = "";
std::string Task::defaultDue = "";
bool Task::searchCaseSensitive = true;
bool Task::regex = false;
std::map <std::string, std::string> Task::attributes;
std::map <std::string, float> Task::coefficients;
float Task::urgencyPriorityCoefficient = 0.0;
float Task::urgencyProjectCoefficient = 0.0;
float Task::urgencyActiveCoefficient = 0.0;
float Task::urgencyScheduledCoefficient = 0.0;
@@ -1396,14 +1394,6 @@ void Task::validate (bool applyDefault /* = true */)
set ("project", Task::defaultProject);
}
// Override with default.priority, if not specified.
if (Task::defaultPriority != "" &&
! has ("priority"))
{
if (context.columns["priority"]->validate (Task::defaultPriority))
set ("priority", Task::defaultPriority);
}
// Override with default.due, if not specified.
if (Task::defaultDue != "" &&
! has ("due"))
@@ -1489,17 +1479,6 @@ void Task::validate (bool applyDefault /* = true */)
throw std::string (format (STRING_TASK_VALID_RECUR, value));
}
}
// Priorities must be valid.
if (has ("priority"))
{
std::string priority = get ("priority");
if (priority != "H" &&
priority != "M" &&
priority != "L" &&
priority != "")
throw format (STRING_TASK_VALID_PRIORITY, priority);
}
}
////////////////////////////////////////////////////////////////////////////////
@@ -1657,7 +1636,6 @@ float Task::urgency_c () const
{
float value = 0.0;
#ifdef PRODUCT_TASKWARRIOR
value += fabsf (Task::urgencyPriorityCoefficient) > epsilon ? (urgency_priority () * Task::urgencyPriorityCoefficient) : 0.0;
value += fabsf (Task::urgencyProjectCoefficient) > epsilon ? (urgency_project () * Task::urgencyProjectCoefficient) : 0.0;
value += fabsf (Task::urgencyActiveCoefficient) > epsilon ? (urgency_active () * Task::urgencyActiveCoefficient) : 0.0;
value += fabsf (Task::urgencyScheduledCoefficient) > epsilon ? (urgency_scheduled () * Task::urgencyScheduledCoefficient) : 0.0;
@@ -1744,18 +1722,6 @@ float Task::urgency ()
return urgency_value;
}
////////////////////////////////////////////////////////////////////////////////
float Task::urgency_priority () const
{
const std::string& value = get_ref ("priority");
if (value == "H") return 1.0;
else if (value == "M") return 0.65;
else if (value == "L") return 0.3;
return 0.0;
}
////////////////////////////////////////////////////////////////////////////////
float Task::urgency_inherit () const
{
@@ -1777,7 +1743,6 @@ float Task::urgency_inherit () const
v += it->urgency_annotations ();
v += it->urgency_due ();
v += it->urgency_next ();
v += it->urgency_priority ();
v += it->urgency_scheduled ();
v += it->urgency_waiting ();