From 79c1a942898ef012339164ede0b57afc6ee31d83 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 17 Dec 2016 17:30:44 -0500 Subject: [PATCH] CmdInfo: Migrated from ViewText to Table --- src/commands/CmdInfo.cpp | 36 ++++++++++++++++++++++-------------- src/commands/CmdInfo.h | 4 ++-- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/commands/CmdInfo.cpp b/src/commands/CmdInfo.cpp index 7b87870ae..db4d9643f 100644 --- a/src/commands/CmdInfo.cpp +++ b/src/commands/CmdInfo.cpp @@ -99,10 +99,12 @@ int CmdInfo::execute (std::string& output) std::stringstream out; for (auto& task : filtered) { - ViewText view; + Table view; view.width (context.getWidth ()); - view.add (Column::factory ("string", STRING_COLUMN_LABEL_NAME)); - view.add (Column::factory ("string", STRING_COLUMN_LABEL_VALUE)); + if (context.config.getBoolean ("obfuscate")) + view.obfuscate (); + view.add (STRING_COLUMN_LABEL_NAME); + view.add (STRING_COLUMN_LABEL_VALUE); // If an alternating row color is specified, notify the table. if (context.color ()) @@ -407,7 +409,7 @@ int CmdInfo::execute (std::string& output) } // Create a second table, containing urgency details, if necessary. - ViewText urgencyDetails; + Table urgencyDetails; if (task.urgency () != 0.0) { if (context.color ()) @@ -420,13 +422,16 @@ int CmdInfo::execute (std::string& output) urgencyDetails.colorHeader (label); } + if (context.config.getBoolean ("obfuscate")) + urgencyDetails.obfuscate (); + urgencyDetails.width (context.getWidth ()); - urgencyDetails.add (Column::factory ("string", "")); // Attribute - urgencyDetails.add (Column::factory ("string", "")); // Value - urgencyDetails.add (Column::factory ("string", "")); // * - urgencyDetails.add (Column::factory ("string", "")); // Coefficient - urgencyDetails.add (Column::factory ("string", "")); // = - urgencyDetails.add (Column::factory ("string", "")); // Result + urgencyDetails.add (""); // Attribute + urgencyDetails.add (""); // Value + urgencyDetails.add (""); // * + urgencyDetails.add (""); // Coefficient + urgencyDetails.add (""); // = + urgencyDetails.add (""); // Result urgencyTerm (urgencyDetails, "project", task.urgency_project (), Task::urgencyProjectCoefficient); urgencyTerm (urgencyDetails, "active", task.urgency_active (), Task::urgencyActiveCoefficient); @@ -506,7 +511,7 @@ int CmdInfo::execute (std::string& output) } // Create a third table, containing undo log change details. - ViewText journal; + Table journal; // If an alternating row color is specified, notify the table. if (context.color ()) @@ -519,9 +524,12 @@ int CmdInfo::execute (std::string& output) journal.colorHeader (label); } + if (context.config.getBoolean ("obfuscate")) + journal.obfuscate (); + journal.width (context.getWidth ()); - journal.add (Column::factory ("string", STRING_COLUMN_LABEL_DATE)); - journal.add (Column::factory ("string", STRING_CMD_INFO_MODIFICATION)); + journal.add (STRING_COLUMN_LABEL_DATE); + journal.add (STRING_CMD_INFO_MODIFICATION); if (context.config.getBoolean ("journal.info") && undo.size () > 3) @@ -577,7 +585,7 @@ int CmdInfo::execute (std::string& output) //////////////////////////////////////////////////////////////////////////////// void CmdInfo::urgencyTerm ( - ViewText& view, + Table& view, const std::string& label, float measure, float coefficient) const diff --git a/src/commands/CmdInfo.h b/src/commands/CmdInfo.h index 941569e4b..e3ad8da7b 100644 --- a/src/commands/CmdInfo.h +++ b/src/commands/CmdInfo.h @@ -29,7 +29,7 @@ #include #include -#include +#include class CmdInfo : public Command { @@ -38,7 +38,7 @@ public: int execute (std::string&); private: - void urgencyTerm (ViewText&, const std::string&, float, float) const; + void urgencyTerm (Table&, const std::string&, float, float) const; }; #endif