123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #ifndef ITEMDATA_H
- #define ITEMDATA_H
- #include "oneitem.h"
- #define IData ItemData::getInstance()
- /**
- * @brief 存储创建的Item
- *
- */
- class ItemData
- {
- ItemData();
- ItemData(const ItemData&) = delete;
- ItemData& operator=(const ItemData&) = delete;
- public:
- ~ItemData();
- static ItemData& getInstance()
- {
- static ItemData instance;
- return instance;
- }
- /* 添加一项计划 */
- void addOneItem(int week, OneItem* item);
- /* 删除一项计划 */
- void deleteOneItem(int week, int num);
- /* 清空一天的计划 */
- void clearOneDay(int week);
- /* 清空所有的计划数据 */
- void clearAllItem();
- /* 查找有没有这个项 */
- bool findItem(OneItem* item);
- bool findItem(int week, OneItem* item);
- /* 获取整个容器 */
- QMap<int, QList<OneItem*>*>& getMapItem() { return m_mapItem; }
- /* 获取一天的容器 */
- QList<OneItem*>* getOneDay(int week);
- /* 获取一天的计划 */
- QList<ExecPlanItemInfo> getOneDayExecPlan(int week);
- /* 新增判断是否有重复 */
- bool judgeTimeRepetitionWithAdd(int weekDay, const QString& devName, const QTime& time);
- bool judgeDateTimeRepetitionWithAdd(int weekDay, const QString& devName, const QDate& date, const QTime& time);
- /* 判断已有的项修改时间后和其他项是否重复 */
- bool judgeTimeRepetitionWithEdit(int weekDay, OneItem* item, const QTime& newTime);
- /* 判断特殊日的已有项修改时间后和其他项是否重复 */
- bool judgeDateTimeRepetitionWithEdit(int weekDay, OneItem* item, const QDate& newDate, const QTime& newTime);
-
- /* 获取计划是否有更新 */
- bool isUpdate() { return m_isUpdate; }
- /* 设置计划是否有更新 */
- void setUpdate(bool isUpdate) { m_isUpdate = isUpdate; }
- private:
- bool m_isUpdate = false; /* 是否有更新计划 */
- QMap<int, QList<OneItem*>*> m_mapItem; /* int是周几 */
- };
- #endif // ITEMDATA_H
|