mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
ColTemplate: New recurrence attribute
This commit is contained in:
parent
b600671e53
commit
5ac7ca6885
14 changed files with 159 additions and 0 deletions
|
@ -24,6 +24,7 @@ set (columns_SRCS Column.cpp Column.h
|
||||||
ColStatus.cpp ColStatus.h
|
ColStatus.cpp ColStatus.h
|
||||||
ColString.cpp ColString.h
|
ColString.cpp ColString.h
|
||||||
ColTags.cpp ColTags.h
|
ColTags.cpp ColTags.h
|
||||||
|
ColTemplate.cpp ColTemplate.h
|
||||||
ColTypeDate.cpp ColTypeDate.h
|
ColTypeDate.cpp ColTypeDate.h
|
||||||
ColTypeDuration.cpp ColTypeDuration.h
|
ColTypeDuration.cpp ColTypeDuration.h
|
||||||
ColTypeNumeric.cpp ColTypeNumeric.h
|
ColTypeNumeric.cpp ColTypeNumeric.h
|
||||||
|
|
78
src/columns/ColTemplate.cpp
Normal file
78
src/columns/ColTemplate.cpp
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// http://www.opensource.org/licenses/mit-license.php
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <cmake.h>
|
||||||
|
#include <ColTemplate.h>
|
||||||
|
#include <format.h>
|
||||||
|
#include <i18n.h>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
ColumnTemplate::ColumnTemplate ()
|
||||||
|
{
|
||||||
|
_name = "template";
|
||||||
|
_style = "long";
|
||||||
|
_label = STRING_COLUMN_LABEL_TEMPLATE;
|
||||||
|
_modifiable = false;
|
||||||
|
_styles = {"long", "short"};
|
||||||
|
_examples = {"f30cb9c3-3fc0-483f-bfb2-3bf134f00694", "f30cb9c3"};
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Set the minimum and maximum widths for the value.
|
||||||
|
void ColumnTemplate::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||||
|
{
|
||||||
|
minimum = maximum = 0;
|
||||||
|
|
||||||
|
if (task.has (_name))
|
||||||
|
{
|
||||||
|
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
||||||
|
else if (_style == "short") minimum = maximum = 8;
|
||||||
|
else
|
||||||
|
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void ColumnTemplate::render (
|
||||||
|
std::vector <std::string>& lines,
|
||||||
|
Task& task,
|
||||||
|
int width,
|
||||||
|
Color& color)
|
||||||
|
{
|
||||||
|
if (task.has (_name))
|
||||||
|
{
|
||||||
|
// f30cb9c3-3fc0-483f-bfb2-3bf134f00694 default
|
||||||
|
// f30cb9c3 short
|
||||||
|
if (_style == "default" ||
|
||||||
|
_style == "long")
|
||||||
|
renderStringLeft (lines, width, color, task.get(_name));
|
||||||
|
|
||||||
|
else if (_style == "short")
|
||||||
|
renderStringLeft (lines, width, color, task.get (_name).substr (0, 8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
43
src/columns/ColTemplate.h
Normal file
43
src/columns/ColTemplate.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// http://www.opensource.org/licenses/mit-license.php
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDED_COLTEMPLATE
|
||||||
|
#define INCLUDED_COLTEMPLATE
|
||||||
|
|
||||||
|
#include <ColTypeString.h>
|
||||||
|
|
||||||
|
class ColumnTemplate : public ColumnTypeString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ColumnTemplate ();
|
||||||
|
void measure (Task&, unsigned int&, unsigned int&);
|
||||||
|
void render (std::vector <std::string>&, Task&, int, Color&);
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
|
@ -46,6 +46,7 @@
|
||||||
#include <ColStatus.h>
|
#include <ColStatus.h>
|
||||||
#include <ColString.h>
|
#include <ColString.h>
|
||||||
#include <ColTags.h>
|
#include <ColTags.h>
|
||||||
|
#include <ColTemplate.h>
|
||||||
#include <ColUntil.h>
|
#include <ColUntil.h>
|
||||||
#include <ColUrgency.h>
|
#include <ColUrgency.h>
|
||||||
#include <ColUUID.h>
|
#include <ColUUID.h>
|
||||||
|
@ -96,6 +97,7 @@ Column* Column::factory (const std::string& name, const std::string& report)
|
||||||
else if (column_name == "start") c = new ColumnStart ();
|
else if (column_name == "start") c = new ColumnStart ();
|
||||||
else if (column_name == "status") c = new ColumnStatus ();
|
else if (column_name == "status") c = new ColumnStatus ();
|
||||||
else if (column_name == "tags") c = new ColumnTags ();
|
else if (column_name == "tags") c = new ColumnTags ();
|
||||||
|
else if (column_name == "template") c = new ColumnTemplate ();
|
||||||
else if (column_name == "until") c = new ColumnUntil ();
|
else if (column_name == "until") c = new ColumnUntil ();
|
||||||
else if (column_name == "urgency") c = new ColumnUrgency ();
|
else if (column_name == "urgency") c = new ColumnUrgency ();
|
||||||
else if (column_name == "uuid") c = new ColumnUUID ();
|
else if (column_name == "uuid") c = new ColumnUUID ();
|
||||||
|
@ -138,6 +140,7 @@ void Column::factory (std::map <std::string, Column*>& all)
|
||||||
c = new ColumnStart (); all[c->_name] = c;
|
c = new ColumnStart (); all[c->_name] = c;
|
||||||
c = new ColumnStatus (); all[c->_name] = c;
|
c = new ColumnStatus (); all[c->_name] = c;
|
||||||
c = new ColumnTags (); all[c->_name] = c;
|
c = new ColumnTags (); all[c->_name] = c;
|
||||||
|
c = new ColumnTemplate (); all[c->_name] = c;
|
||||||
c = new ColumnUntil (); all[c->_name] = c;
|
c = new ColumnUntil (); all[c->_name] = c;
|
||||||
c = new ColumnUrgency (); all[c->_name] = c;
|
c = new ColumnUrgency (); all[c->_name] = c;
|
||||||
c = new ColumnUUID (); all[c->_name] = c;
|
c = new ColumnUUID (); all[c->_name] = c;
|
||||||
|
|
25
src/l10n/check_translations.sh
Executable file
25
src/l10n/check_translations.sh
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
REFERENCE_LANGUAGE_FILE="eng-USA.h"
|
||||||
|
TESTED_LANGUAGE_FILES=`ls *.h | grep -v $REFERENCE_LANGUAGE_FILE`
|
||||||
|
|
||||||
|
# At the beginning, we haven't detected any invalid translation files
|
||||||
|
MISMATCHED=0
|
||||||
|
|
||||||
|
# Generate list of keys, not including defines that are commented out. Strips out the leading whitespace.
|
||||||
|
cat $REFERENCE_LANGUAGE_FILE | grep "^[[:space:]]*#define" | sed -e 's/^ *//' - | cut -f2 -d' ' | sort > identifiers
|
||||||
|
|
||||||
|
# Generate report
|
||||||
|
for LANGUAGE_FILE in $TESTED_LANGUAGE_FILES
|
||||||
|
do
|
||||||
|
echo "Comparing $REFERENCE_LANGUAGE_FILE (left) to $LANGUAGE_FILE (right)"
|
||||||
|
cat $LANGUAGE_FILE | grep "^[[:space:]]*#define" | sed -e 's/^ *//' - | cut -f2 -d' ' | sort | diff identifiers -
|
||||||
|
MISMATCHED=$(($MISMATCHED+$?))
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
rm -f identifiers
|
||||||
|
|
||||||
|
# Exit with number of not synced translations files
|
||||||
|
exit $MISMATCHED
|
|
@ -211,6 +211,7 @@
|
||||||
#define STRING_COLUMN_LABEL_MASK "Maske"
|
#define STRING_COLUMN_LABEL_MASK "Maske"
|
||||||
#define STRING_COLUMN_LABEL_MASK_IDX "Masken-Index"
|
#define STRING_COLUMN_LABEL_MASK_IDX "Masken-Index"
|
||||||
#define STRING_COLUMN_LABEL_PARENT "Vorgänger-Aufgabe"
|
#define STRING_COLUMN_LABEL_PARENT "Vorgänger-Aufgabe"
|
||||||
|
#define STRING_COLUMN_LABEL_TEMPLATE "Template task"
|
||||||
#define STRING_COLUMN_LABEL_DATE "Datum"
|
#define STRING_COLUMN_LABEL_DATE "Datum"
|
||||||
#define STRING_COLUMN_LABEL_COLUMN "Spalten"
|
#define STRING_COLUMN_LABEL_COLUMN "Spalten"
|
||||||
#define STRING_COLUMN_LABEL_STYLES "Unterstützte Formate"
|
#define STRING_COLUMN_LABEL_STYLES "Unterstützte Formate"
|
||||||
|
|
|
@ -211,6 +211,7 @@
|
||||||
#define STRING_COLUMN_LABEL_MASK "Mask"
|
#define STRING_COLUMN_LABEL_MASK "Mask"
|
||||||
#define STRING_COLUMN_LABEL_MASK_IDX "Mask Index"
|
#define STRING_COLUMN_LABEL_MASK_IDX "Mask Index"
|
||||||
#define STRING_COLUMN_LABEL_PARENT "Parent task"
|
#define STRING_COLUMN_LABEL_PARENT "Parent task"
|
||||||
|
#define STRING_COLUMN_LABEL_TEMPLATE "Template task"
|
||||||
#define STRING_COLUMN_LABEL_DATE "Date"
|
#define STRING_COLUMN_LABEL_DATE "Date"
|
||||||
#define STRING_COLUMN_LABEL_COLUMN "Columns"
|
#define STRING_COLUMN_LABEL_COLUMN "Columns"
|
||||||
#define STRING_COLUMN_LABEL_STYLES "Supported Formats"
|
#define STRING_COLUMN_LABEL_STYLES "Supported Formats"
|
||||||
|
|
|
@ -211,6 +211,7 @@
|
||||||
#define STRING_COLUMN_LABEL_MASK "Masko"
|
#define STRING_COLUMN_LABEL_MASK "Masko"
|
||||||
#define STRING_COLUMN_LABEL_MASK_IDX "Mask-indico"
|
#define STRING_COLUMN_LABEL_MASK_IDX "Mask-indico"
|
||||||
#define STRING_COLUMN_LABEL_PARENT "Patra tasko"
|
#define STRING_COLUMN_LABEL_PARENT "Patra tasko"
|
||||||
|
#define STRING_COLUMN_LABEL_TEMPLATE "Template task"
|
||||||
#define STRING_COLUMN_LABEL_DATE "Dato"
|
#define STRING_COLUMN_LABEL_DATE "Dato"
|
||||||
#define STRING_COLUMN_LABEL_COLUMN "Kolumnoj"
|
#define STRING_COLUMN_LABEL_COLUMN "Kolumnoj"
|
||||||
#define STRING_COLUMN_LABEL_STYLES "Formaĝoj Subtenataj"
|
#define STRING_COLUMN_LABEL_STYLES "Formaĝoj Subtenataj"
|
||||||
|
|
|
@ -212,6 +212,7 @@
|
||||||
#define STRING_COLUMN_LABEL_MASK "Máscara"
|
#define STRING_COLUMN_LABEL_MASK "Máscara"
|
||||||
#define STRING_COLUMN_LABEL_MASK_IDX "Máscara de Índice"
|
#define STRING_COLUMN_LABEL_MASK_IDX "Máscara de Índice"
|
||||||
#define STRING_COLUMN_LABEL_PARENT "Tarea madre"
|
#define STRING_COLUMN_LABEL_PARENT "Tarea madre"
|
||||||
|
#define STRING_COLUMN_LABEL_TEMPLATE "Template task"
|
||||||
#define STRING_COLUMN_LABEL_DATE "Fecha"
|
#define STRING_COLUMN_LABEL_DATE "Fecha"
|
||||||
#define STRING_COLUMN_LABEL_COLUMN "Columnas"
|
#define STRING_COLUMN_LABEL_COLUMN "Columnas"
|
||||||
#define STRING_COLUMN_LABEL_STYLES "Formatos soportados"
|
#define STRING_COLUMN_LABEL_STYLES "Formatos soportados"
|
||||||
|
|
|
@ -211,6 +211,7 @@
|
||||||
#define STRING_COLUMN_LABEL_MASK "Masque"
|
#define STRING_COLUMN_LABEL_MASK "Masque"
|
||||||
#define STRING_COLUMN_LABEL_MASK_IDX "Indice de masque"
|
#define STRING_COLUMN_LABEL_MASK_IDX "Indice de masque"
|
||||||
#define STRING_COLUMN_LABEL_PARENT "Tâche mère"
|
#define STRING_COLUMN_LABEL_PARENT "Tâche mère"
|
||||||
|
#define STRING_COLUMN_LABEL_TEMPLATE "Template task"
|
||||||
#define STRING_COLUMN_LABEL_DATE "Date"
|
#define STRING_COLUMN_LABEL_DATE "Date"
|
||||||
#define STRING_COLUMN_LABEL_COLUMN "Colonnes"
|
#define STRING_COLUMN_LABEL_COLUMN "Colonnes"
|
||||||
#define STRING_COLUMN_LABEL_STYLES "Formats supportés"
|
#define STRING_COLUMN_LABEL_STYLES "Formats supportés"
|
||||||
|
|
|
@ -211,6 +211,7 @@
|
||||||
#define STRING_COLUMN_LABEL_MASK "Maschera"
|
#define STRING_COLUMN_LABEL_MASK "Maschera"
|
||||||
#define STRING_COLUMN_LABEL_MASK_IDX "Indice Maschera"
|
#define STRING_COLUMN_LABEL_MASK_IDX "Indice Maschera"
|
||||||
#define STRING_COLUMN_LABEL_PARENT "Task genitore"
|
#define STRING_COLUMN_LABEL_PARENT "Task genitore"
|
||||||
|
#define STRING_COLUMN_LABEL_TEMPLATE "Template task"
|
||||||
#define STRING_COLUMN_LABEL_DATE "Data"
|
#define STRING_COLUMN_LABEL_DATE "Data"
|
||||||
#define STRING_COLUMN_LABEL_COLUMN "Colonna"
|
#define STRING_COLUMN_LABEL_COLUMN "Colonna"
|
||||||
#define STRING_COLUMN_LABEL_STYLES "Formati Supportati"
|
#define STRING_COLUMN_LABEL_STYLES "Formati Supportati"
|
||||||
|
|
|
@ -211,6 +211,7 @@
|
||||||
#define STRING_COLUMN_LABEL_MASK "Mask"
|
#define STRING_COLUMN_LABEL_MASK "Mask"
|
||||||
#define STRING_COLUMN_LABEL_MASK_IDX "Mask Index"
|
#define STRING_COLUMN_LABEL_MASK_IDX "Mask Index"
|
||||||
#define STRING_COLUMN_LABEL_PARENT "Parent task"
|
#define STRING_COLUMN_LABEL_PARENT "Parent task"
|
||||||
|
#define STRING_COLUMN_LABEL_TEMPLATE "Template task"
|
||||||
#define STRING_COLUMN_LABEL_DATE "Date"
|
#define STRING_COLUMN_LABEL_DATE "Date"
|
||||||
#define STRING_COLUMN_LABEL_COLUMN "Columns"
|
#define STRING_COLUMN_LABEL_COLUMN "Columns"
|
||||||
#define STRING_COLUMN_LABEL_STYLES "Supported Formats"
|
#define STRING_COLUMN_LABEL_STYLES "Supported Formats"
|
||||||
|
|
|
@ -211,6 +211,7 @@
|
||||||
#define STRING_COLUMN_LABEL_MASK "Maska"
|
#define STRING_COLUMN_LABEL_MASK "Maska"
|
||||||
#define STRING_COLUMN_LABEL_MASK_IDX "Indeks Maski"
|
#define STRING_COLUMN_LABEL_MASK_IDX "Indeks Maski"
|
||||||
#define STRING_COLUMN_LABEL_PARENT "Zadanie rodzic"
|
#define STRING_COLUMN_LABEL_PARENT "Zadanie rodzic"
|
||||||
|
#define STRING_COLUMN_LABEL_TEMPLATE "Template task"
|
||||||
#define STRING_COLUMN_LABEL_DATE "Data"
|
#define STRING_COLUMN_LABEL_DATE "Data"
|
||||||
#define STRING_COLUMN_LABEL_COLUMN "Kolumny"
|
#define STRING_COLUMN_LABEL_COLUMN "Kolumny"
|
||||||
#define STRING_COLUMN_LABEL_STYLES "Formaty"
|
#define STRING_COLUMN_LABEL_STYLES "Formaty"
|
||||||
|
|
|
@ -212,6 +212,7 @@
|
||||||
#define STRING_COLUMN_LABEL_MASK "Máscara"
|
#define STRING_COLUMN_LABEL_MASK "Máscara"
|
||||||
#define STRING_COLUMN_LABEL_MASK_IDX "Índice de Máscara"
|
#define STRING_COLUMN_LABEL_MASK_IDX "Índice de Máscara"
|
||||||
#define STRING_COLUMN_LABEL_PARENT "Tarefa mãe"
|
#define STRING_COLUMN_LABEL_PARENT "Tarefa mãe"
|
||||||
|
#define STRING_COLUMN_LABEL_TEMPLATE "Template task"
|
||||||
#define STRING_COLUMN_LABEL_DATE "Data"
|
#define STRING_COLUMN_LABEL_DATE "Data"
|
||||||
#define STRING_COLUMN_LABEL_COLUMN "Colunas"
|
#define STRING_COLUMN_LABEL_COLUMN "Colunas"
|
||||||
#define STRING_COLUMN_LABEL_STYLES "Formatos Suportados"
|
#define STRING_COLUMN_LABEL_STYLES "Formatos Suportados"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue