File indexing completed on 2024-05-19 05:21:53

0001 /*
0002  * Copyright (C) 2004 by Mark Bucciarelli <mark@hubcapconsulting.com>
0003  * Copyright (C) 2019  Alexander Potashev <aspotashev@gmail.com>
0004  *
0005  *   This program is free software; you can redistribute it and/or modify
0006  *   it under the terms of the GNU General Public License as published by
0007  *   the Free Software Foundation; either version 2 of the License, or
0008  *   (at your option) any later version.
0009  *
0010  *   This program is distributed in the hope that it will be useful,
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  *   GNU General Public License for more details.
0014  *
0015  *   You should have received a copy of the GNU General Public License along
0016  *   with this program; if not, write to the
0017  *      Free Software Foundation, Inc.
0018  *      51 Franklin Street, Fifth Floor
0019  *      Boston, MA  02110-1301  USA.
0020  *
0021  */
0022 
0023 #ifndef REPORTCRITERIA_H
0024 #define REPORTCRITERIA_H
0025 
0026 #include <QDateTime>
0027 #include <QUrl>
0028 
0029 /**
0030  Stores entries from export dialog.
0031 
0032  Keeps details (like CSV export dialog control names) out of the TaskView
0033  class, which contains the slot triggered by the export action.  
0034  
0035  The dialog and the report logic can change all they want and the TaskView
0036  logic can stay the same.
0037  */
0038 
0039 class ReportCriteria
0040 {
0041 public:
0042     /**
0043      * The different report types.
0044      *
0045      * These numeric constants are part of D-Bus API, don't change them.
0046      */
0047     enum REPORTTYPE {
0048         /**
0049          * Writes all tasks and their totals to a Comma-Separated Values file.
0050          *
0051          * The format of this file is zero or more lines of:
0052          *    taskName,subtaskName,..,sessionTime,time,totalSessionTime,totalTime
0053          * the number of subtasks is determined at runtime.
0054          */
0055         CSVTotalsExport = 0,
0056         /**
0057          * Export history report as csv, all tasks X all dates in one block.
0058          * Write task history as comma-delimited data.
0059          */
0060         CSVHistoryExport = 1,
0061         /**
0062          * Totals for current and all sub tasks.
0063          * This function stores the user's tasks.
0064          * rc tells how the user wants his report, e.g. all times or session times.
0065          */
0066         TextTotalsExport = 2,
0067         /**
0068          * Export the history of all events as csv
0069          */
0070         CSVEventLogExport = 3,
0071     };
0072 
0073     /**
0074     The type of report we are running.
0075     */
0076     REPORTTYPE reportType;
0077 
0078     /**
0079      For history reports, the lower bound of the date range to report on.
0080      */
0081     QDate from;
0082 
0083     /**
0084      For history reports, the upper bound of the date range to report on.
0085      */
0086     QDate to;
0087 
0088     /**
0089      True if the durations should be output in decimal hours.  Otherwise,
0090      output durations as HH24:MI
0091      */
0092     bool decimalMinutes;
0093 
0094     /**
0095      True if user chose to export session times, not all times
0096      */
0097     bool sessionTimes;
0098 
0099     /**
0100      True if user chose to export all tasks, not only the selected one
0101      */
0102     bool allTasks;
0103 
0104     /**
0105      The delimiter to use when outputting comma-separated value reports.
0106      */
0107     QString delimiter;
0108 
0109     /**
0110      The quote to use for text fields when outputting comma-separated reports.
0111      */
0112     QString quote;
0113 };
0114 
0115 #endif