File indexing completed on 2025-01-05 04:59:44

0001 /*
0002  * SPDX-FileCopyrightText: 2016-2017 David Faure <faure@kde.org>
0003  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004  */
0005 
0006 
0007 #ifndef PRESENTATION_RUNNINGTASKMODEL_H
0008 #define PRESENTATION_RUNNINGTASKMODEL_H
0009 
0010 #include "domain/taskqueries.h"
0011 #include "domain/taskrepository.h"
0012 
0013 #include "runningtaskmodelinterface.h"
0014 
0015 namespace Presentation {
0016 
0017 class RunningTaskModel : public RunningTaskModelInterface
0018 {
0019     Q_OBJECT
0020 public:
0021     typedef QSharedPointer<RunningTaskModel> Ptr;
0022 
0023     explicit RunningTaskModel(const Domain::TaskQueries::Ptr &taskQueries,
0024                               const Domain::TaskRepository::Ptr &taskRepository,
0025                               QObject *parent = nullptr);
0026     ~RunningTaskModel();
0027 
0028     Domain::Task::Ptr runningTask() const override;
0029     void setRunningTask(const Domain::Task::Ptr &runningTask) override;
0030 
0031     void taskDeleted(const Domain::Task::Ptr &task) override;
0032 
0033 public slots:
0034     void stopTask() override;
0035     void doneTask() override;
0036 
0037 private:
0038     void taskTitleChanged(const QString &title);
0039 
0040     Domain::Task::Ptr m_runningTask;
0041 
0042     Domain::QueryResult<Domain::Task::Ptr>::Ptr m_taskList;
0043     Domain::TaskQueries::Ptr m_queries;
0044     Domain::TaskRepository::Ptr m_taskRepository;
0045 };
0046 
0047 }
0048 
0049 #endif // PRESENTATION_RUNNINGTASKMODEL_H