mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
View
- Implemented ColDate, ColDue, ColEntry, ColEnd, ColStart, ColUntil, ColWait. - Implemented formats: default, iso, julian, epoch.
This commit is contained in:
parent
8f00665268
commit
df8496edae
17 changed files with 772 additions and 18 deletions
|
@ -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})
|
||||
|
||||
|
|
197
src/columns/ColDate.cpp
Normal file
197
src/columns/ColDate.cpp
Normal file
|
@ -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 <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <Context.h>
|
||||
#include <ColDate.h>
|
||||
#include <Date.h>
|
||||
#include <Duration.h>
|
||||
#include <text.h>
|
||||
|
||||
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.<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 <std::string>& 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.<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")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
52
src/columns/ColDate.h
Normal file
52
src/columns/ColDate.h
Normal file
|
@ -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 <vector>
|
||||
#include <string>
|
||||
#include <Column.h>
|
||||
#include <Color.h>
|
||||
#include <Task.h>
|
||||
|
||||
class ColumnDate : public Column
|
||||
{
|
||||
public:
|
||||
ColumnDate ();
|
||||
~ColumnDate ();
|
||||
|
||||
void setReport (const std::string&);
|
||||
virtual void measure (Task&, int&, int&);
|
||||
virtual void render (std::vector <std::string>&, Task&, int, Color&);
|
||||
|
||||
protected:
|
||||
std::string _attribute;
|
||||
std::string _report;
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
42
src/columns/ColDue.cpp
Normal file
42
src/columns/ColDue.cpp
Normal file
|
@ -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 <ColDue.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnDue::ColumnDue ()
|
||||
{
|
||||
_label = "Due";
|
||||
_attribute = "due";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnDue::~ColumnDue ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
40
src/columns/ColDue.h
Normal file
40
src/columns/ColDue.h
Normal file
|
@ -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 <ColDate.h>
|
||||
|
||||
class ColumnDue : public ColumnDate
|
||||
{
|
||||
public:
|
||||
ColumnDue ();
|
||||
~ColumnDue ();
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
42
src/columns/ColEnd.cpp
Normal file
42
src/columns/ColEnd.cpp
Normal file
|
@ -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 <ColEnd.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnEnd::ColumnEnd ()
|
||||
{
|
||||
_label = "Completed";
|
||||
_attribute = "end";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnEnd::~ColumnEnd ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
40
src/columns/ColEnd.h
Normal file
40
src/columns/ColEnd.h
Normal file
|
@ -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 <ColDate.h>
|
||||
|
||||
class ColumnEnd : public ColumnDate
|
||||
{
|
||||
public:
|
||||
ColumnEnd ();
|
||||
~ColumnEnd ();
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
42
src/columns/ColEntry.cpp
Normal file
42
src/columns/ColEntry.cpp
Normal file
|
@ -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 <ColEntry.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnEntry::ColumnEntry ()
|
||||
{
|
||||
_label = "Added";
|
||||
_attribute = "entry";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnEntry::~ColumnEntry ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
40
src/columns/ColEntry.h
Normal file
40
src/columns/ColEntry.h
Normal file
|
@ -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 <ColDate.h>
|
||||
|
||||
class ColumnEntry : public ColumnDate
|
||||
{
|
||||
public:
|
||||
ColumnEntry ();
|
||||
~ColumnEntry ();
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
42
src/columns/ColStart.cpp
Normal file
42
src/columns/ColStart.cpp
Normal file
|
@ -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 <ColStart.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnStart::ColumnStart ()
|
||||
{
|
||||
_label = "Started";
|
||||
_attribute = "start";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnStart::~ColumnStart ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
40
src/columns/ColStart.h
Normal file
40
src/columns/ColStart.h
Normal file
|
@ -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 <ColDate.h>
|
||||
|
||||
class ColumnStart : public ColumnDate
|
||||
{
|
||||
public:
|
||||
ColumnStart ();
|
||||
~ColumnStart ();
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
42
src/columns/ColUntil.cpp
Normal file
42
src/columns/ColUntil.cpp
Normal file
|
@ -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 <ColUntil.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnUntil::ColumnUntil ()
|
||||
{
|
||||
_label = "Until";
|
||||
_attribute = "until";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnUntil::~ColumnUntil ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
40
src/columns/ColUntil.h
Normal file
40
src/columns/ColUntil.h
Normal file
|
@ -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 <ColDate.h>
|
||||
|
||||
class ColumnUntil : public ColumnDate
|
||||
{
|
||||
public:
|
||||
ColumnUntil ();
|
||||
~ColumnUntil ();
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
42
src/columns/ColWait.cpp
Normal file
42
src/columns/ColWait.cpp
Normal file
|
@ -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 <ColWait.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnWait::ColumnWait ()
|
||||
{
|
||||
_label = "Wait";
|
||||
_attribute = "wait";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnWait::~ColumnWait ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
40
src/columns/ColWait.h
Normal file
40
src/columns/ColWait.h
Normal file
|
@ -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 <ColDate.h>
|
||||
|
||||
class ColumnWait : public ColumnDate
|
||||
{
|
||||
public:
|
||||
ColumnWait ();
|
||||
~ColumnWait ();
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -29,19 +29,19 @@
|
|||
#include <Column.h>
|
||||
#include <ColDepends.h>
|
||||
#include <ColDescription.h>
|
||||
//#include <ColDue.h>
|
||||
//#include <ColEnd.h>
|
||||
//#include <ColEntry.h>
|
||||
#include <ColDue.h>
|
||||
#include <ColEnd.h>
|
||||
#include <ColEntry.h>
|
||||
#include <ColID.h>
|
||||
#include <ColPriority.h>
|
||||
#include <ColProject.h>
|
||||
#include <ColRecur.h>
|
||||
//#include <ColStart.h>
|
||||
#include <ColStart.h>
|
||||
#include <ColStatus.h>
|
||||
#include <ColTags.h>
|
||||
//#include <ColUntil.h>
|
||||
#include <ColUntil.h>
|
||||
#include <ColUUID.h>
|
||||
//#include <ColWait.h>
|
||||
#include <ColWait.h>
|
||||
#include <text.h>
|
||||
|
||||
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 + "'";
|
||||
|
||||
|
|
|
@ -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);
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue