-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: inter controller communication
- Loading branch information
1 parent
c220bf2
commit 7dd2b4c
Showing
9 changed files
with
168 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include <controllers/controllerruntimedata.h> | ||
|
||
#include "moc_controllerruntimedata.cpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#pragma once | ||
|
||
#include <QVariant> | ||
|
||
#include "util/assert.h" | ||
|
||
/// ControllerRuntimeData is a wrapper that allows controllers script runtimes | ||
/// to share arbitrary data via a the JavaScript interface. It doesn't enforce | ||
/// any type consistency and it is the script responsibility to use this data in | ||
/// a considerate, non-destructive way (append to lists, extend to objects, | ||
/// ...), as well as expecting that others won't do so. | ||
class ControllerRuntimeData : public QObject { | ||
Q_OBJECT | ||
public: | ||
ControllerRuntimeData(QObject* parent) | ||
: QObject(parent), m_value() { | ||
} | ||
|
||
const QVariant& get() const { | ||
return m_value; | ||
} | ||
|
||
public slots: | ||
void set(const QVariant& value) { | ||
m_value = value; | ||
emit updated(m_value); | ||
} | ||
|
||
signals: | ||
void updated(const QVariant& value); | ||
|
||
private: | ||
QVariant m_value; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters