#ifndef TASKMANAGER_H #define TASKMANAGER_H #include #include #include class FortManager; class FortSettings; class TaskInfo; class TaskManager : public QObject { Q_OBJECT Q_PROPERTY(QQmlListProperty taskInfos READ taskInfos NOTIFY taskInfosChanged) Q_CLASSINFO("DefaultProperty", "taskInfos") public: explicit TaskManager(FortManager *fortManager, QObject *parent = nullptr); FortManager *fortManager() const { return m_fortManager; } const QList &taskInfosList() const { return m_taskInfos; } QQmlListProperty taskInfos(); signals: void taskInfosChanged(); public slots: void loadSettings(const FortSettings *fortSettings); bool saveSettings(FortSettings *fortSettings); private slots: void handleTaskFinished(bool success); void runExpiredTasks(); private: void setupTasks(); void appendTaskInfo(TaskInfo *taskInfo); private: FortManager *m_fortManager; QList m_taskInfos; QTimer m_timer; }; #endif // TASKMANAGER_H