Changeset View
Changeset View
Standalone View
Standalone View
liblegacytaskmanager/strategies/activitysortingstrategy.h
- This file was moved from libtaskmanager/strategies/activitysortingstrategy.h.
Show All 18 Lines | |||||
19 | 19 | | |||
20 | #ifndef ACTIVITYSORTINGSTRATEGY_H | 20 | #ifndef ACTIVITYSORTINGSTRATEGY_H | ||
21 | #define ACTIVITYSORTINGSTRATEGY_H | 21 | #define ACTIVITYSORTINGSTRATEGY_H | ||
22 | 22 | | |||
23 | #include <abstractsortingstrategy.h> | 23 | #include <abstractsortingstrategy.h> | ||
24 | 24 | | |||
25 | #include <QtCore/QHash> | 25 | #include <QtCore/QHash> | ||
26 | 26 | | |||
27 | namespace TaskManager { | 27 | namespace LegacyTaskManager { | ||
28 | 28 | | |||
29 | /** | 29 | /** | ||
30 | * Sorts the tasks by activity. | 30 | * Sorts the tasks by activity. | ||
31 | * The activities with more tasks will be before than the ones with less tasks. | 31 | * The activities with more tasks will be before than the ones with less tasks. | ||
32 | * If one task is in various activities, the one with more tasks will be taken into account. | 32 | * If one task is in various activities, the one with more tasks will be taken into account. | ||
33 | */ | 33 | */ | ||
34 | class ActivitySortingStrategy: public AbstractSortingStrategy | 34 | class ActivitySortingStrategy: public AbstractSortingStrategy | ||
35 | { | 35 | { | ||
36 | Q_OBJECT | 36 | Q_OBJECT | ||
37 | 37 | | |||
38 | public: | 38 | public: | ||
39 | ActivitySortingStrategy(QObject *parent); | 39 | ActivitySortingStrategy(QObject *parent); | ||
40 | ~ActivitySortingStrategy() override; | 40 | ~ActivitySortingStrategy() override; | ||
41 | 41 | | |||
42 | void sortItems(ItemList& items) override; | 42 | void sortItems(ItemList& items) override; | ||
43 | 43 | | |||
44 | protected Q_SLOTS: | 44 | protected Q_SLOTS: | ||
45 | void handleItem(AbstractGroupableItem *item) override; | 45 | void handleItem(AbstractGroupableItem *item) override; | ||
46 | void checkChanges(::TaskManager::TaskChanges changes, ::TaskManager::AbstractGroupableItem *item = 0); | 46 | void checkChanges(::LegacyTaskManager::TaskChanges changes, ::LegacyTaskManager::AbstractGroupableItem *item = 0); | ||
47 | 47 | | |||
48 | private: | 48 | private: | ||
49 | /** | 49 | /** | ||
50 | * Checks if the order of the activities stored in the instance is still valid and if not, it stores the | 50 | * Checks if the order of the activities stored in the instance is still valid and if not, it stores the | ||
51 | * correct order. */ | 51 | * correct order. */ | ||
52 | bool checkActivitiesOrder(ItemList& items); | 52 | bool checkActivitiesOrder(ItemList& items); | ||
53 | void addActivitiesToActivityCount(ItemList& items, QHash<QString, int>& activityCount); | 53 | void addActivitiesToActivityCount(ItemList& items, QHash<QString, int>& activityCount); | ||
54 | static bool lessThanActivityData(QPair<QString, int> &d1, QPair<QString, int> &d2); | 54 | static bool lessThanActivityData(QPair<QString, int> &d1, QPair<QString, int> &d2); | ||
55 | class Comparator; | 55 | class Comparator; | ||
56 | QStringList m_activitiesOrder; | 56 | QStringList m_activitiesOrder; | ||
57 | }; | 57 | }; | ||
58 | 58 | | |||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | #endif | 61 | #endif |