1 | /* This file is part of the KDE project |
2 | Copyright (C) 2009 Dag Andersen <danders@get2net.dk> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef KPTBUILTINSCHEDULERPLUGIN_H |
21 | #define KPTBUILTINSCHEDULERPLUGIN_H |
22 | |
23 | #include "kplato_export.h" |
24 | #include "kptschedulerplugin.h" |
25 | |
26 | #include "kptschedule.h" |
27 | |
28 | #include <KoXmlReader.h> |
29 | |
30 | #include <QThread> |
31 | #include <QMutex> |
32 | #include <QTimer> |
33 | |
34 | |
35 | class KLocale; |
36 | |
37 | |
38 | namespace KPlato |
39 | { |
40 | |
41 | class KPlatoScheduler; |
42 | class Project; |
43 | class ScheduleManager; |
44 | class Node; |
45 | class XMLLoaderObject; |
46 | |
47 | class KPLATO_EXPORT BuiltinSchedulerPlugin : public SchedulerPlugin |
48 | { |
49 | Q_OBJECT |
50 | public: |
51 | explicit BuiltinSchedulerPlugin(QObject *parent); |
52 | virtual ~BuiltinSchedulerPlugin(); |
53 | |
54 | virtual QString description() const; |
55 | /// Calculate the project |
56 | virtual void calculate( Project &project, ScheduleManager *sm, bool nothread = false ); |
57 | |
58 | signals: |
59 | void sigCalculationStarted( Project*, ScheduleManager* ); |
60 | void sigCalculationFinished( Project*, ScheduleManager* ); |
61 | void maxProgress( int, ScheduleManager* ); |
62 | void sigProgress( int, ScheduleManager* ); |
63 | |
64 | protected slots: |
65 | void slotStarted( SchedulerThread *job ); |
66 | void slotFinished( SchedulerThread *job ); |
67 | }; |
68 | |
69 | |
70 | class KPlatoScheduler : public SchedulerThread |
71 | { |
72 | Q_OBJECT |
73 | |
74 | public: |
75 | KPlatoScheduler( Project *project, ScheduleManager *sm, QObject *parent = 0 ); |
76 | ~KPlatoScheduler(); |
77 | |
78 | KLocale *locale() const; |
79 | |
80 | public slots: |
81 | /// Stop scheduling. |
82 | virtual void stopScheduling(); |
83 | /// Halt scheduling |
84 | virtual void haltScheduling() { m_haltScheduling = true; stopScheduling(); } |
85 | |
86 | protected: |
87 | void run(); |
88 | |
89 | }; |
90 | |
91 | } //namespace KPlato |
92 | |
93 | #endif |
94 | |