-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start Work on Dialogs for Controller Commands
- Loading branch information
Showing
11 changed files
with
335 additions
and
142 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <QMessageBox> | ||
#include "controllercommands.h" | ||
|
||
|
||
|
||
ControllerCommands::ControllerCommands(QMainWindow *parent) : | ||
QObject(parent) | ||
{ | ||
|
||
} | ||
|
||
void ControllerCommands::addNode() { | ||
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); | ||
if (ret == QMessageBox::Cancel) { | ||
return; | ||
} | ||
this->m_msgBox = new QMessageBox(QMessageBox::Information, "Adding Node", "Starting....", QMessageBox::Cancel, qobject_cast<QMainWindow*>(this->parent())); | ||
this->m_msgBox->setDetailedText("Waiting for the Controller to Enter AddNode Mode..."); | ||
connect(this->m_msgBox, &QMessageBox::rejected, this, &ControllerCommands::cancelCommand); | ||
this->m_msgBox->show(); | ||
if (ret == QMessageBox::Yes) { | ||
OZWCore::get()->getQTOZWManager()->addNode(true); | ||
} else if (ret == QMessageBox::No) { | ||
OZWCore::get()->getQTOZWManager()->addNode(false); | ||
} | ||
} | ||
void ControllerCommands::delNode() { | ||
OZWCore::get()->getQTOZWManager()->removeNode(); | ||
} | ||
void ControllerCommands::healNetwork() { | ||
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); | ||
if (ret == QMessageBox::Ok) { | ||
OZWCore::get()->getQTOZWManager()->healNetwork(false); | ||
} | ||
} | ||
void ControllerCommands::cancelCommand() { | ||
QMessageBox::StandardButton ret = QMessageBox::question(qobject_cast<QMainWindow*>(this->parent()), "Cancel Command", "Are you sure you wish to cancel the command?"); | ||
if (ret == QMessageBox::Yes) { | ||
OZWCore::get()->getQTOZWManager()->cancelControllerCommand(); | ||
} | ||
} | ||
|
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,25 @@ | ||
#ifndef CONTROLLERCOMMANDS_H | ||
#define CONTROLLERCOMMANDS_H | ||
|
||
#include <QObject> | ||
#include <QMainWindow> | ||
#include "ozwcore.h" | ||
|
||
class OZWCore; | ||
|
||
class ControllerCommands : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit ControllerCommands(QMainWindow *parent = nullptr); | ||
|
||
public slots: | ||
void addNode(); | ||
void delNode(); | ||
void healNetwork(); | ||
void cancelCommand(); | ||
private: | ||
QMessageBox *m_msgBox; | ||
}; | ||
|
||
#endif // CONTROLLERCOMMANDS_H |
Oops, something went wrong.