ItemData.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef ITEMDATA_H
  2. #define ITEMDATA_H
  3. #include "oneitem.h"
  4. #define IData ItemData::getInstance()
  5. /**
  6. * @brief 存储创建的Item
  7. *
  8. */
  9. class ItemData
  10. {
  11. ItemData();
  12. ItemData(const ItemData&) = delete;
  13. ItemData& operator=(const ItemData&) = delete;
  14. public:
  15. ~ItemData();
  16. static ItemData& getInstance()
  17. {
  18. static ItemData instance;
  19. return instance;
  20. }
  21. /* 添加一项计划 */
  22. void addOneItem(int week, OneItem* item);
  23. /* 删除一项计划 */
  24. void deleteOneItem(int week, int num);
  25. /* 查找有没有这个项 */
  26. bool findItem(OneItem* item);
  27. bool findItem(int week, OneItem* item);
  28. /* 获取一天的容器 */
  29. QList<OneItem*>* getOneDay(int week);
  30. /* 新增判断是否有重复 */
  31. bool judgeTimeRepetitionWithAdd(int weekDay, const QString& devName, const QTime& time);
  32. /* 判断已有的项修改时间后和其他项是否重复 */
  33. bool judgeTimeRepetitionWithEdit(int weekDay, OneItem* item, const QTime& newTime);
  34. /* 判断特殊日的已有项修改时间后和其他项是否重复 */
  35. bool judgeDateTimeRepetitionWithEdit(int weekDay, OneItem* item, const QDate& newDate, const QTime& newTime);
  36. private:
  37. QMap<int, QList<OneItem*>*> m_mapItem; /* int是周几 */
  38. };
  39. #endif // ITEMDATA_H