KDStateMachineEditor  1.0.0
A framework for creating Qt State Machine metacode using a graphical user interface
runtimecontroller.h
1 /*
2  This file is part of the KDAB State Machine Editor Library.
3 
4  Copyright (C) 2014-2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
5  All rights reserved.
6  Author: Kevin Funk <kevin.funk@kdab.com>
7 
8  Licensees holding valid commercial KDAB State Machine Editor Library
9  licenses may use this file in accordance with the KDAB State Machine Editor
10  Library License Agreement provided with the Software.
11 
12  This file may be distributed and/or modified under the terms of the
13  GNU Lesser General Public License version 2.1 as published by the
14  Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
15 
16  This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
17  WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 
19  Contact info@kdab.com if any conditions of this licensing are not
20  clear to you.
21 */
22 
23 #ifndef KDSME_RUNTIMECONTROLLER_H
24 #define KDSME_RUNTIMECONTROLLER_H
25 
26 #include "kdsme_core_export.h"
27 
28 #include <QObject>
29 #include <QRectF>
30 #include <QSet>
31 
32 namespace KDSME {
33 
34 class State;
35 class Transition;
36 
37 class KDSME_CORE_EXPORT RuntimeController : public QObject
38 {
39  Q_OBJECT
40  Q_PROPERTY(QSet<KDSME::State*> activeConfiguration READ activeConfiguration NOTIFY activeConfigurationChanged)
41  Q_PROPERTY(KDSME::Transition* lastTransition READ lastTransition NOTIFY lastTransitionChanged)
42  Q_PROPERTY(bool isRunning READ isRunning NOTIFY isRunningChanged)
43  Q_PROPERTY(QRectF activeRegion READ activeRegion NOTIFY activeRegionChanged)
44 
45 public:
46  typedef QSet<State*> Configuration;
47 
48  explicit RuntimeController(QObject* parent = nullptr);
49  virtual ~RuntimeController();
50 
51  Configuration activeConfiguration() const;
52  QList<Configuration> lastConfigurations() const;
53  void setActiveConfiguration(const Configuration& configuration);
54 
55  QList<Transition*> lastTransitions() const;
56  Transition* lastTransition() const;
57  void setLastTransition(Transition* transition);
58 
59  bool isRunning() const;
60  void setIsRunning(bool isRunning);
61 
62  Q_INVOKABLE float activenessForState(KDSME::State* state) const;
63  Q_INVOKABLE float activenessForTransition(KDSME::Transition* transition);
64 
65  int historySize() const;
66  void setHistorySize(int size);
67 
68  QRectF activeRegion() const;
69 
70  void clear();
71 
72 Q_SIGNALS:
73  void activeConfigurationChanged(const QSet<State*>& configuration);
74  void lastTransitionChanged(Transition* transition);
75  void isRunningChanged(bool isRunning);
76  void activeRegionChanged(const QRectF& region);
77 
78 private:
79  struct Private;
80  QScopedPointer<Private> d;
81 };
82 
83 }
84 
85 #endif
Definition: state.h:35
Definition: transition.h:30
Definition: runtimecontroller.h:37
Definition: abstractexporter.h:33

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
https://github.com/KDAB/KDStateMachineEditor