diff --git a/SHinterface.pro b/SHinterface.pro index c7ff09f..054b25e 100644 --- a/SHinterface.pro +++ b/SHinterface.pro @@ -73,7 +73,6 @@ SOURCES += \ src/items/rgbitem.cpp SOURCES += \ - src/alarmactions.cpp \ src/main.cpp \ src/microcontroller.cpp \ src/sun.cpp @@ -129,7 +128,6 @@ HEADERS += \ src/items/rgbitem.h HEADERS += \ - src/alarmactions.h \ src/microcontroller.h \ src/sun.h diff --git a/src/actor.cpp.autosave b/src/actor.cpp.autosave deleted file mode 100644 index 72a0dd4..0000000 --- a/src/actor.cpp.autosave +++ /dev/null @@ -1,100 +0,0 @@ -#include "actor.h" -#include - -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 "< - -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); -} diff --git a/src/alarmactions.h b/src/alarmactions.h deleted file mode 100644 index 2922e9d..0000000 --- a/src/alarmactions.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef POWER_H -#define POWER_H - -#include -#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 diff --git a/src/ui/itemsettingsdialog.cpp b/src/ui/itemsettingsdialog.cpp index 1bf371c..23d4f4d 100644 --- a/src/ui/itemsettingsdialog.cpp +++ b/src/ui/itemsettingsdialog.cpp @@ -177,7 +177,7 @@ void ItemSettingsDialog::editActor() dialog->show(); dialog->exec(); - for(int i = 0; i < ui->tableWidget->rowCount() && i < static_cast(item_->getActors().size()); ++i) + for(int i = 0; i < ui->tableWidget->rowCount() && i < static_cast(item_->getActors().size()); ++i) { ui->tableWidget->item(i, 0)->setText(item_->getActors()[i]->getName()); ui->tableWidget->item(i, 1)->setText(item_->getActors()[i]->actionName());