|
| 1 | +#include <QMessageBox> |
| 2 | +#include "controllercommands.h" |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +ControllerCommands::ControllerCommands(QMainWindow *parent) : |
| 7 | + QObject(parent) |
| 8 | +{ |
| 9 | + |
| 10 | +} |
| 11 | + |
| 12 | +void ControllerCommands::addNode() { |
| 13 | + QMessageBox::StandardButton ret = QMessageBox::question(qobject_cast<QMainWindow*>(this->parent()), "Include Secure?", "Do you wish to include the new device with encryption?", QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel); |
| 14 | + if (ret == QMessageBox::Cancel) { |
| 15 | + return; |
| 16 | + } |
| 17 | + this->m_msgBox = new QMessageBox(QMessageBox::Information, "Adding Node", "Starting....", QMessageBox::Cancel, qobject_cast<QMainWindow*>(this->parent())); |
| 18 | + this->m_msgBox->setDetailedText("Waiting for the Controller to Enter AddNode Mode..."); |
| 19 | + connect(this->m_msgBox, &QMessageBox::rejected, this, &ControllerCommands::cancelCommand); |
| 20 | + this->m_msgBox->show(); |
| 21 | + if (ret == QMessageBox::Yes) { |
| 22 | + OZWCore::get()->getQTOZWManager()->addNode(true); |
| 23 | + } else if (ret == QMessageBox::No) { |
| 24 | + OZWCore::get()->getQTOZWManager()->addNode(false); |
| 25 | + } |
| 26 | +} |
| 27 | +void ControllerCommands::delNode() { |
| 28 | + OZWCore::get()->getQTOZWManager()->removeNode(); |
| 29 | +} |
| 30 | +void ControllerCommands::healNetwork() { |
| 31 | + QMessageBox::StandardButton ret = QMessageBox::information(qobject_cast<QMainWindow*>(this->parent()), "Heal Network", "Healing the Network Should only be performed after Adding/Removing or Physically Moving Mains Powered Devices. Are you sure?", QMessageBox::Ok|QMessageBox::Cancel); |
| 32 | + if (ret == QMessageBox::Ok) { |
| 33 | + OZWCore::get()->getQTOZWManager()->healNetwork(false); |
| 34 | + } |
| 35 | +} |
| 36 | +void ControllerCommands::cancelCommand() { |
| 37 | + QMessageBox::StandardButton ret = QMessageBox::question(qobject_cast<QMainWindow*>(this->parent()), "Cancel Command", "Are you sure you wish to cancel the command?"); |
| 38 | + if (ret == QMessageBox::Yes) { |
| 39 | + OZWCore::get()->getQTOZWManager()->cancelControllerCommand(); |
| 40 | + } |
| 41 | +} |
| 42 | + |
0 commit comments