Support item tabs based on item group string
This commit is contained in:
parent
0e09b6f46c
commit
a17cd23a4e
29 changed files with 527 additions and 181 deletions
|
|
@ -24,6 +24,7 @@ void Actor::performValueAction(uint8_t value)
|
|||
ItemUpdateRequest request;
|
||||
request.type = ITEM_UPDATE_ACTOR;
|
||||
request.payload = ItemData(QRandomGenerator::global()->generate(), "Item", value);
|
||||
request.changes.value = true;
|
||||
sigItemUpdate(request);
|
||||
}
|
||||
}
|
||||
|
|
@ -47,9 +48,12 @@ void Actor::makeInactive()
|
|||
QString Actor::actionName()
|
||||
{
|
||||
QString string;
|
||||
if(triggerValue == 0 ) string = "off";
|
||||
else if(triggerValue == 1 ) string = "on";
|
||||
else string = "value to " + QString::number(triggerValue);
|
||||
if(triggerValue == 0 )
|
||||
string = "off";
|
||||
else if(triggerValue == 1 )
|
||||
string = "on";
|
||||
else
|
||||
string = "value to " + QString::number(triggerValue);
|
||||
return string;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,13 +39,13 @@ public:
|
|||
virtual void load(const QJsonObject& json, const bool preserve = false);
|
||||
|
||||
uint8_t getRepeat();
|
||||
virtual QString getName() const;
|
||||
|
||||
public slots:
|
||||
|
||||
void run();
|
||||
virtual void makeActive();
|
||||
virtual void makeInactive();
|
||||
virtual QString getName() const;
|
||||
void doTick();
|
||||
void changeTime(const QDateTime& time);
|
||||
void setRepeat(const uint8_t repeat);
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ TimerActor::TimerActor(const int timeoutSec, QObject *parent): Actor(parent), ti
|
|||
timer.setSingleShot(true);
|
||||
}
|
||||
|
||||
void TimerActor::onValueChanged(uint8_t state)
|
||||
void TimerActor::onItemUpdated(ItemUpdateRequest update)
|
||||
{
|
||||
if((state && !triggerValue) || (!state && triggerValue))
|
||||
if(update.changes.value && ((update.payload.getValue() && !triggerValue) || (!update.payload.getValue() && triggerValue)))
|
||||
{
|
||||
if(timer.isActive()) timer.stop();
|
||||
qDebug()<<"Timer started";
|
||||
if(timer.isActive())
|
||||
timer.stop();
|
||||
timer.setInterval(timeoutMsec_);
|
||||
timer.start();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@ private slots:
|
|||
|
||||
public slots:
|
||||
|
||||
virtual void onValueChanged(uint8_t state);
|
||||
virtual void onItemUpdated(ItemUpdateRequest update) override;
|
||||
void setTimeout(const int timeoutSec);
|
||||
|
||||
public:
|
||||
explicit TimerActor(const int timeoutSec = 60, QObject *parent = nullptr);
|
||||
virtual QString getName() const;
|
||||
virtual QString getName() const override;
|
||||
|
||||
int getTimeout();
|
||||
|
||||
virtual void store(QJsonObject& json);
|
||||
virtual void load(const QJsonObject& json, bool preserve);
|
||||
virtual void store(QJsonObject& json) override;
|
||||
virtual void load(const QJsonObject& json, bool preserve) override;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue