File indexing completed on 2024-11-17 04:49:33
0001 /* 0002 * Copyright (c) 2019 Alexander Potashev <aspotashev@gmail.com> 0003 * 0004 * This program is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU General Public License as 0006 * published by the Free Software Foundation; either version 2 of 0007 * the License or (at your option) version 3 or any later version 0008 * accepted by the membership of KDE e.V. (or its successor approved 0009 * by the membership of KDE e.V.), which shall act as a proxy 0010 * defined in Section 14 of version 3 of the license. 0011 * 0012 * This program is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 * GNU General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU General Public License 0018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0019 */ 0020 0021 #ifndef KTIMETRACKER_PROJECTMODEL_H 0022 #define KTIMETRACKER_PROJECTMODEL_H 0023 0024 #include <memory> 0025 0026 #include "file/filecalendar.h" 0027 0028 class EventsModel; 0029 class Task; 0030 class TasksModel; 0031 0032 class ProjectModel 0033 { 0034 public: 0035 ProjectModel(); 0036 0037 TasksModel *tasksModel(); 0038 EventsModel *eventsModel(); 0039 0040 std::unique_ptr<FileCalendar> asCalendar(const QUrl &url) const; 0041 0042 /** 0043 * Reset session and total time to zero for all tasks. 0044 * 0045 * This procedure resets all times (session and overall) for all tasks and subtasks. 0046 */ 0047 void resetTimeForAllTasks(); 0048 0049 /** Import tasks from Imendio Planner */ 0050 void importPlanner(const QString &fileName, Task *currentTask); 0051 0052 /** Used to refresh (e.g. after import) */ 0053 void refresh(); 0054 0055 /** 0056 * Refresh the times of the tasks, e.g. when the history has been changed by the user. 0057 * Re-calculate the time for every task based on events in the history. 0058 */ 0059 void refreshTimes(); 0060 0061 private: 0062 TasksModel *m_tasksModel; 0063 EventsModel *m_eventsModel; 0064 }; 0065 0066 #endif // KTIMETRACKER_PROJECTMODEL_H