fort/src/ui/task/taskmanager.h

48 lines
1.0 KiB
C
Raw Normal View History

2017-09-19 08:35:43 +00:00
#ifndef TASKMANAGER_H
#define TASKMANAGER_H
#include <QObject>
#include <QQmlListProperty>
class FortManager;
2017-09-20 15:43:43 +00:00
class FortSettings;
class TaskInfo;
2017-09-19 08:35:43 +00:00
class TaskManager : public QObject
{
Q_OBJECT
2017-09-20 15:43:43 +00:00
Q_PROPERTY(QQmlListProperty<TaskInfo> taskInfos READ taskInfos NOTIFY taskInfosChanged)
Q_CLASSINFO("DefaultProperty", "taskInfos")
2017-09-19 08:35:43 +00:00
public:
explicit TaskManager(FortManager *fortManager,
QObject *parent = nullptr);
FortManager *fortManager() const { return m_fortManager; }
2017-09-20 15:43:43 +00:00
const QList<TaskInfo *> &taskInfosList() const { return m_taskInfos; }
QQmlListProperty<TaskInfo> taskInfos();
2017-09-19 08:35:43 +00:00
signals:
2017-09-20 15:43:43 +00:00
void taskInfosChanged();
2017-09-19 08:35:43 +00:00
public slots:
2017-09-20 15:43:43 +00:00
void loadSettings(const FortSettings *fortSettings);
bool saveSettings(FortSettings *fortSettings) const;
2017-09-19 08:35:43 +00:00
2017-09-21 13:24:45 +00:00
private slots:
void handleTaskFinished(bool success);
private:
void setupTasks();
void appendTaskInfo(TaskInfo *taskInfo);
2017-09-19 08:35:43 +00:00
private:
FortManager *m_fortManager;
2017-09-20 15:43:43 +00:00
QList<TaskInfo *> m_taskInfos;
2017-09-19 08:35:43 +00:00
};
#endif // TASKMANAGER_H