-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add groundwork for Controller COs #2884
Changes from all commits
715e782
7a57f02
47b14dd
f06786d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,15 @@ | |
#include "controllers/controllervisitor.h" | ||
#include "controllers/engine/controllerengine.h" | ||
#include "util/duration.h" | ||
#include "util/parented_ptr.h" | ||
|
||
class ControlObject; | ||
class ControllerJSProxy; | ||
|
||
class Controller : public QObject, ConstControllerPresetVisitor { | ||
Q_OBJECT | ||
public: | ||
Controller(); | ||
Controller(const QString& group); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. explicit Minor improvement: Since Controller is supposed to be an abstract base class we could reduce the visibility of the ctor from public to protected. |
||
~Controller() override; // Subclass should call close() at minimum. | ||
|
||
/// The object that is exposed to the JS scripts as the "controller" object. | ||
|
@@ -64,6 +66,10 @@ class Controller : public QObject, ConstControllerPresetVisitor { | |
inline const QString& getCategory() const { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could remove all those redundant inline keywords while editing this file. |
||
return m_sDeviceCategory; | ||
} | ||
const QString& getGroup() const { | ||
return m_group; | ||
} | ||
|
||
virtual bool isMappable() const = 0; | ||
inline bool isLearning() const { | ||
return m_bLearning; | ||
|
@@ -102,6 +108,8 @@ class Controller : public QObject, ConstControllerPresetVisitor { | |
void startLearning(); | ||
void stopLearning(); | ||
|
||
void slotReloadScripts(double v); | ||
|
||
protected: | ||
// The length parameter is here for backwards compatibility for when scripts | ||
// were required to specify it. | ||
|
@@ -160,6 +168,10 @@ class Controller : public QObject, ConstControllerPresetVisitor { | |
// Returns a pointer to the currently loaded controller preset. For internal | ||
// use only. | ||
virtual ControllerPreset* preset() = 0; | ||
|
||
/// Group name for control objects | ||
const QString m_group; | ||
|
||
ControllerEngine* m_pEngine; | ||
|
||
// Verbose and unique device name suitable for display. | ||
|
@@ -176,6 +188,8 @@ class Controller : public QObject, ConstControllerPresetVisitor { | |
bool m_bLearning; | ||
QElapsedTimer m_userActivityInhibitTimer; | ||
|
||
parented_ptr<ControlObject> m_pReloadScripts; | ||
|
||
friend class ControllerJSProxy; | ||
// accesses lots of our stuff, but in the same thread | ||
friend class ControllerManager; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ class FakeControllerJSProxy : public ControllerJSProxy { | |
class FakeController : public Controller { | ||
Q_OBJECT | ||
public: | ||
FakeController(); | ||
FakeController(const QString& group); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. explicit (although just a test class) |
||
~FakeController() override; | ||
|
||
QString presetExtension() override { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QStringLiteral("reload_scripts")