Remove alarmactions

This commit is contained in:
Carl Philipp Klemm 2026-02-07 18:31:34 +01:00
parent d30c9546b1
commit 8fcca909de
5 changed files with 1 additions and 143 deletions

View file

@ -73,7 +73,6 @@ SOURCES += \
src/items/rgbitem.cpp src/items/rgbitem.cpp
SOURCES += \ SOURCES += \
src/alarmactions.cpp \
src/main.cpp \ src/main.cpp \
src/microcontroller.cpp \ src/microcontroller.cpp \
src/sun.cpp src/sun.cpp
@ -129,7 +128,6 @@ HEADERS += \
src/items/rgbitem.h src/items/rgbitem.h
HEADERS += \ HEADERS += \
src/alarmactions.h \
src/microcontroller.h \ src/microcontroller.h \
src/sun.h src/sun.h

View file

@ -1,100 +0,0 @@
#include "actor.h"
#include<QDebug>
Actor::Actor(QObject *parent): QObject(parent)
{
buildName();
}
Actor::~Actor()
{
}
void Actor::performAction()
{
if(active)
{
trigger();
if(action_ == ACTION_OFF) off();
else if(action_ == ACTION_ON) on();
else if(action_ != ACTION_TOGGLE) toggle();
else if(action_ != ACTION_VALUE) sigValue(value_);
}
}
void Actor::makeActive()
{
active = true;
}
void Actor::makeInactive()
{
active = false;
}
void Actor::buildName()
{
name = "Actor";
appendActionToName();
}
void Actor::appendActionToName()
{
if(action_ == ACTION_OFF || action_ == ACTION_DEFAULT ) name.append("off");
else if(action_ == ACTION_ON ) name.append("on");
else if(action_ == ACTION_TOGGLE ) name.append("toggle");
else if(action_ == ACTION_VALUE ) name.append("value to " + QString::number(value_));
}
void Actor::setActive(int state)
{
state ? makeActive() : makeInactive();
buildName();
}
bool Actor::isActive()
{
return active;
}
bool Actor::isExausted()
{
return exausted;
}
void Actor::saveSettings(QString subsecton, QSettings* settings)
{
settings->setValue(subsecton + "Active", active);
settings->setValue(subsecton + "Exausted", exausted);
settings->setValue(subsecton + "Name", name);
settings->setValue(subsecton + "Action", action_);
}
void Actor::loadSettings(QString subsecton, QSettings* settings)
{
active = settings->value(subsecton + "Active").toBool();
exausted = settings->value(subsecton + "Exausted").toBool();
name = settings->value(subsecton + "Name").toString();
action_ = settings->value(subsecton + "Action").toUInt();
}
void Actor::setAction(uint8_t action)
{
action_ = action;
qDebug()<<"setting action to "<<action;
buildName();
}
void Actor::setValue(uint8_t value)
{
value_=value;
buildName();
}
void Actor::onStateChanged(bool state)
{
}

View file

@ -1,15 +0,0 @@
#include "alarmactions.h"
#include <QProcess>
AlarmActions::AlarmActions(QApplication* a, Microcontroller* micro, QObject *parent) : QObject(parent), _micro(micro),
a_(a)
{
}
void AlarmActions::syncoff()
{
qDebug()<<"syncoff";
QProcess::execute ("syncoff", QStringList());
a_->exit(0);
}

View file

@ -1,25 +0,0 @@
#ifndef POWER_H
#define POWER_H
#include <QApplication>
#include "microcontroller.h"
class AlarmActions : public QObject
{
private:
Q_OBJECT
Microcontroller* _micro;
QApplication* a_;
public:
explicit AlarmActions(QApplication* a, Microcontroller* micro, QObject *parent = nullptr);
signals:
public slots:
void syncoff();
};
#endif // POWER_H

View file

@ -177,7 +177,7 @@ void ItemSettingsDialog::editActor()
dialog->show(); dialog->show();
dialog->exec(); dialog->exec();
for(int i = 0; i < ui->tableWidget->rowCount() && i < static_cast<size_t>(item_->getActors().size()); ++i) for(int i = 0; i < ui->tableWidget->rowCount() && i < static_cast<int>(item_->getActors().size()); ++i)
{ {
ui->tableWidget->item(i, 0)->setText(item_->getActors()[i]->getName()); ui->tableWidget->item(i, 0)->setText(item_->getActors()[i]->getName());
ui->tableWidget->item(i, 1)->setText(item_->getActors()[i]->actionName()); ui->tableWidget->item(i, 1)->setText(item_->getActors()[i]->actionName());