From df8496edae404abf1892c95e00ac159e7de30be6 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 2 May 2011 01:50:48 -0400 Subject: [PATCH] View - Implemented ColDate, ColDue, ColEntry, ColEnd, ColStart, ColUntil, ColWait. - Implemented formats: default, iso, julian, epoch. --- src/columns/CMakeLists.txt | 9 +- src/columns/ColDate.cpp | 197 +++++++++++++++++++++++++++++++++++++ src/columns/ColDate.h | 52 ++++++++++ src/columns/ColDue.cpp | 42 ++++++++ src/columns/ColDue.h | 40 ++++++++ src/columns/ColEnd.cpp | 42 ++++++++ src/columns/ColEnd.h | 40 ++++++++ src/columns/ColEntry.cpp | 42 ++++++++ src/columns/ColEntry.h | 40 ++++++++ src/columns/ColStart.cpp | 42 ++++++++ src/columns/ColStart.h | 40 ++++++++ src/columns/ColUntil.cpp | 42 ++++++++ src/columns/ColUntil.h | 40 ++++++++ src/columns/ColWait.cpp | 42 ++++++++ src/columns/ColWait.h | 40 ++++++++ src/columns/Column.cpp | 24 ++--- test/view.t.cpp | 16 ++- 17 files changed, 772 insertions(+), 18 deletions(-) create mode 100644 src/columns/ColDate.cpp create mode 100644 src/columns/ColDate.h create mode 100644 src/columns/ColDue.cpp create mode 100644 src/columns/ColDue.h create mode 100644 src/columns/ColEnd.cpp create mode 100644 src/columns/ColEnd.h create mode 100644 src/columns/ColEntry.cpp create mode 100644 src/columns/ColEntry.h create mode 100644 src/columns/ColStart.cpp create mode 100644 src/columns/ColStart.h create mode 100644 src/columns/ColUntil.cpp create mode 100644 src/columns/ColUntil.h create mode 100644 src/columns/ColWait.cpp create mode 100644 src/columns/ColWait.h diff --git a/src/columns/CMakeLists.txt b/src/columns/CMakeLists.txt index 8695e4ca5..d6b4a43d3 100644 --- a/src/columns/CMakeLists.txt +++ b/src/columns/CMakeLists.txt @@ -5,15 +5,22 @@ include_directories (${CMAKE_SOURCE_DIR}/src ${TASK_INCLUDE_DIRS}) set (columns_SRCS Column.cpp Column.h + ColDate.cpp ColDate.h ColDepends.cpp ColDepends.h ColDescription.cpp ColDescription.h + ColDue.cpp ColDue.h + ColEnd.cpp ColEnd.h + ColEntry.cpp ColEntry.h ColID.cpp ColID.h ColPriority.cpp ColPriority.h ColProject.cpp ColProject.h ColRecur.cpp ColRecur.h + ColStart.cpp ColStart.h ColStatus.cpp ColStatus.h ColTags.cpp ColTags.h - ColUUID.cpp ColUUID.h) + ColUntil.cpp ColUntil.h + ColUUID.cpp ColUUID.h + ColWait.cpp ColWait.h) add_library (columns STATIC ${columns_SRCS}) diff --git a/src/columns/ColDate.cpp b/src/columns/ColDate.cpp new file mode 100644 index 000000000..f536ba290 --- /dev/null +++ b/src/columns/ColDate.cpp @@ -0,0 +1,197 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include + +extern Context context; + +//////////////////////////////////////////////////////////////////////////////// +ColumnDate::ColumnDate () +{ + _type = "date"; + _style = "default"; + _label = ""; + _attribute = ""; + _report = ""; +} + +//////////////////////////////////////////////////////////////////////////////// +ColumnDate::~ColumnDate () +{ +} + +//////////////////////////////////////////////////////////////////////////////// +void ColumnDate::setReport (const std::string& report) +{ + _report = report; +} + +//////////////////////////////////////////////////////////////////////////////// +// Set the minimum and maximum widths for the value. +void ColumnDate::measure (Task& task, int& minimum, int& maximum) +{ + minimum = maximum = 0; + + if (task.has (_attribute)) + { + Date date ((time_t) strtol (task.get (_attribute).c_str (), NULL, 10)); + + if (_style == "default") + { + // Determine the output date format, which uses a hierarchy of definitions. + // rc.report..dateformat + // rc.dateformat.report + // rc.dateformat. + std::string format = context.config.get ("report." + _report + ".dateformat"); + if (format == "") + format = context.config.get ("dateformat.report"); + if (format == "") + format = context.config.get ("dateformat"); + + minimum = maximum = date.toString (format).length (); + } + else if (_style == "julian") + { + // (JD − 2440587.5) × 86400 + double julian = (date.toEpoch () / 86400.0) + 2440587.5; + minimum = maximum = format (julian, 13, 12).length (); + } + else if (_style == "epoch") + { + minimum = maximum = date.toEpochString ().length (); + } + else if (_style == "iso") + { + minimum = maximum = date.toISO ().length (); + } + else if (_style == "age") + { + Date now; + minimum = maximum = Duration (now - date).format ().length (); + } + else if (_style == "short") + { + } + else if (_style == "active") + { + } + else if (_style == "countdown") + { + } + else if (_style == "remaining") + { + } + else + throw std::string ("Unrecognized column format '") + _type + "." + _style + "'"; + } +} + +//////////////////////////////////////////////////////////////////////////////// +void ColumnDate::render ( + std::vector & lines, + Task& task, + int width, + Color& color) +{ + if (task.has (_attribute)) + { + if (_style == "default") + { + // Determine the output date format, which uses a hierarchy of definitions. + // rc.report..dateformat + // rc.dateformat.report + // rc.dateformat. + std::string format = context.config.get ("report." + _report + ".dateformat"); + if (format == "") + format = context.config.get ("dateformat.report"); + if (format == "") + format = context.config.get ("dateformat"); + + lines.push_back ( + color.colorize ( + leftJustify ( + Date ((time_t) strtol (task.get (_attribute).c_str (), NULL, 10)) + .toString (format), width))); + } + else if (_style == "julian") + { + double julian = (Date ((time_t) strtol (task.get (_attribute).c_str (), NULL, 10)) + .toEpoch () / 86400.0) + 2440587.5; + + lines.push_back ( + color.colorize ( + rightJustify ( + format (julian, 13, 12), width))); + } + else if (_style == "epoch") + { + lines.push_back ( + color.colorize ( + rightJustify ( + Date ((time_t) strtol (task.get (_attribute).c_str (), NULL, 10)) + .toEpochString (), width))); + } + else if (_style == "iso") + { + lines.push_back ( + color.colorize ( + leftJustify ( + Date ((time_t) strtol (task.get (_attribute).c_str (), NULL, 10)) + .toISO (), width))); + } + else if (_style == "age") + { + Date date ((time_t) strtol (task.get (_attribute).c_str (), NULL, 10)); + Date now; + + lines.push_back ( + color.colorize ( + rightJustify ( + Duration (now - date).format (), width))); + } + else if (_style == "short") + { + } + else if (_style == "active") + { + } + else if (_style == "countdown") + { + } + else if (_style == "remaining") + { + } + } +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColDate.h b/src/columns/ColDate.h new file mode 100644 index 000000000..88092b08b --- /dev/null +++ b/src/columns/ColDate.h @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDED_COLDATE +#define INCLUDED_COLDATE + +#include +#include +#include +#include +#include + +class ColumnDate : public Column +{ +public: + ColumnDate (); + ~ColumnDate (); + + void setReport (const std::string&); + virtual void measure (Task&, int&, int&); + virtual void render (std::vector &, Task&, int, Color&); + +protected: + std::string _attribute; + std::string _report; +}; + +#endif +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColDue.cpp b/src/columns/ColDue.cpp new file mode 100644 index 000000000..685df755e --- /dev/null +++ b/src/columns/ColDue.cpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// + +#include + +//////////////////////////////////////////////////////////////////////////////// +ColumnDue::ColumnDue () +{ + _label = "Due"; + _attribute = "due"; +} + +//////////////////////////////////////////////////////////////////////////////// +ColumnDue::~ColumnDue () +{ +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColDue.h b/src/columns/ColDue.h new file mode 100644 index 000000000..279e7d2a7 --- /dev/null +++ b/src/columns/ColDue.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDED_COLDUE +#define INCLUDED_COLDUE + +#include + +class ColumnDue : public ColumnDate +{ +public: + ColumnDue (); + ~ColumnDue (); +}; + +#endif +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColEnd.cpp b/src/columns/ColEnd.cpp new file mode 100644 index 000000000..cac405351 --- /dev/null +++ b/src/columns/ColEnd.cpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// + +#include + +//////////////////////////////////////////////////////////////////////////////// +ColumnEnd::ColumnEnd () +{ + _label = "Completed"; + _attribute = "end"; +} + +//////////////////////////////////////////////////////////////////////////////// +ColumnEnd::~ColumnEnd () +{ +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColEnd.h b/src/columns/ColEnd.h new file mode 100644 index 000000000..47c18797b --- /dev/null +++ b/src/columns/ColEnd.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDED_COLEND +#define INCLUDED_COLEND + +#include + +class ColumnEnd : public ColumnDate +{ +public: + ColumnEnd (); + ~ColumnEnd (); +}; + +#endif +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColEntry.cpp b/src/columns/ColEntry.cpp new file mode 100644 index 000000000..ae9b50634 --- /dev/null +++ b/src/columns/ColEntry.cpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// + +#include + +//////////////////////////////////////////////////////////////////////////////// +ColumnEntry::ColumnEntry () +{ + _label = "Added"; + _attribute = "entry"; +} + +//////////////////////////////////////////////////////////////////////////////// +ColumnEntry::~ColumnEntry () +{ +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColEntry.h b/src/columns/ColEntry.h new file mode 100644 index 000000000..251df58e2 --- /dev/null +++ b/src/columns/ColEntry.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDED_COLENTRY +#define INCLUDED_COLENTRY + +#include + +class ColumnEntry : public ColumnDate +{ +public: + ColumnEntry (); + ~ColumnEntry (); +}; + +#endif +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColStart.cpp b/src/columns/ColStart.cpp new file mode 100644 index 000000000..74ba2773b --- /dev/null +++ b/src/columns/ColStart.cpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// + +#include + +//////////////////////////////////////////////////////////////////////////////// +ColumnStart::ColumnStart () +{ + _label = "Started"; + _attribute = "start"; +} + +//////////////////////////////////////////////////////////////////////////////// +ColumnStart::~ColumnStart () +{ +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColStart.h b/src/columns/ColStart.h new file mode 100644 index 000000000..c9cf0ae2d --- /dev/null +++ b/src/columns/ColStart.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDED_COLSTART +#define INCLUDED_COLSTART + +#include + +class ColumnStart : public ColumnDate +{ +public: + ColumnStart (); + ~ColumnStart (); +}; + +#endif +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColUntil.cpp b/src/columns/ColUntil.cpp new file mode 100644 index 000000000..d83443663 --- /dev/null +++ b/src/columns/ColUntil.cpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// + +#include + +//////////////////////////////////////////////////////////////////////////////// +ColumnUntil::ColumnUntil () +{ + _label = "Until"; + _attribute = "until"; +} + +//////////////////////////////////////////////////////////////////////////////// +ColumnUntil::~ColumnUntil () +{ +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColUntil.h b/src/columns/ColUntil.h new file mode 100644 index 000000000..cd355a56c --- /dev/null +++ b/src/columns/ColUntil.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDED_COLUNTIL +#define INCLUDED_COLUNTIL + +#include + +class ColumnUntil : public ColumnDate +{ +public: + ColumnUntil (); + ~ColumnUntil (); +}; + +#endif +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColWait.cpp b/src/columns/ColWait.cpp new file mode 100644 index 000000000..5bc9cc767 --- /dev/null +++ b/src/columns/ColWait.cpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// + +#include + +//////////////////////////////////////////////////////////////////////////////// +ColumnWait::ColumnWait () +{ + _label = "Wait"; + _attribute = "wait"; +} + +//////////////////////////////////////////////////////////////////////////////// +ColumnWait::~ColumnWait () +{ +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColWait.h b/src/columns/ColWait.h new file mode 100644 index 000000000..8d88ec20e --- /dev/null +++ b/src/columns/ColWait.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// taskwarrior - a command line task list manager. +// +// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDED_COLWAIT +#define INCLUDED_COLWAIT + +#include + +class ColumnWait : public ColumnDate +{ +public: + ColumnWait (); + ~ColumnWait (); +}; + +#endif +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/Column.cpp b/src/columns/Column.cpp index 055ff36e5..f2547d510 100644 --- a/src/columns/Column.cpp +++ b/src/columns/Column.cpp @@ -29,19 +29,19 @@ #include #include #include -//#include -//#include -//#include +#include +#include +#include #include #include #include #include -//#include +#include #include #include -//#include +#include #include -//#include +#include #include extern Context context; @@ -71,19 +71,19 @@ Column* Column::factory (const std::string& name) Column* column; if (column_name == "depends") column = new ColumnDepends (); else if (column_name == "description") column = new ColumnDescription (); -// else if (column_name == "due") column = new ColumnDue (); -// else if (column_name == "end") column = new ColumnEnd (); -// else if (column_name == "entry") column = new ColumnEntry (); + else if (column_name == "due") column = new ColumnDue (); + else if (column_name == "end") column = new ColumnEnd (); + else if (column_name == "entry") column = new ColumnEntry (); else if (column_name == "id") column = new ColumnID (); else if (column_name == "priority") column = new ColumnPriority (); else if (column_name == "project") column = new ColumnProject (); else if (column_name == "recur") column = new ColumnRecur (); -// else if (column_name == "start") column = new ColumnStart (); + else if (column_name == "start") column = new ColumnStart (); else if (column_name == "status") column = new ColumnStatus (); else if (column_name == "tags") column = new ColumnTags (); -// else if (column_name == "until") column = new ColumnUntil (); + else if (column_name == "until") column = new ColumnUntil (); else if (column_name == "uuid") column = new ColumnUUID (); -// else if (column_name == "wait") column = new ColumnWait (); + else if (column_name == "wait") column = new ColumnWait (); else throw std::string ("Unrecognized column type '") + column_name + "'"; diff --git a/test/view.t.cpp b/test/view.t.cpp index bc77a6173..6e7d02c4d 100644 --- a/test/view.t.cpp +++ b/test/view.t.cpp @@ -45,6 +45,7 @@ int main (int argc, char** argv) context.config.set ("tag.indicator", "+"); context.config.set ("dependency.indicator", "D"); context.config.set ("recurrence.indicator", "R"); + context.config.set ("dateformat", "Y-M-D"); // Two sample tasks. Task t1 ("[" @@ -53,6 +54,7 @@ int main (int argc, char** argv) "description:\"This is the description text\" " "project:\"Home\" " "priority:\"H\" " + "due:\"1234567890\" " "tags:\"one,two\"" "]"); t1.id = 1; @@ -87,16 +89,20 @@ int main (int argc, char** argv) view.add (Column::factory ("project")); view.add (Column::factory ("priority.long")); view.add (Column::factory ("tags")); - view.add (Column::factory ("tags.indicator")); +// view.add (Column::factory ("tags.indicator")); view.add (Column::factory ("tags.count")); view.add (Column::factory ("description.truncated")); - view.add (Column::factory ("depends")); - view.add (Column::factory ("depends.count")); +// view.add (Column::factory ("depends")); +// view.add (Column::factory ("depends.count")); view.add (Column::factory ("depends.indicator")); - view.add (Column::factory ("recur")); +// view.add (Column::factory ("recur")); view.add (Column::factory ("recur.indicator")); - view.add (Column::factory ("status")); +// view.add (Column::factory ("status")); view.add (Column::factory ("status.short")); +// view.add (Column::factory ("due")); + view.add (Column::factory ("due.julian")); +// view.add (Column::factory ("due.epoch")); +// view.add (Column::factory ("due.iso")); view.width (120); view.leftMargin (4); /*