Skip to content

Commit

Permalink
Start Work on Dialogs for Controller Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishwaldo committed May 25, 2020
1 parent 1ad6254 commit 29fba4f
Show file tree
Hide file tree
Showing 11 changed files with 335 additions and 142 deletions.
21 changes: 20 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,26 @@
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
"intelliSenseMode": "clang-x64",
"compileCommands": "${workspaceFolder}/compile_commands.json"
},
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/../open-zwave/cpp/src/**",
"${workspaceFolder}/../qt-openzwave/qt-openzwave/include/**",
"${workspaceFolder}/../qt-openzwave/qt-openzwavedatabase/include/**"
],
"macFrameworkPath": [
"/Users/fish/Qt/5.12.6/clang_64/lib/"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"compileCommands": "${workspaceFolder}/compile_commands.json"
}
],
"version": 4
Expand Down
42 changes: 42 additions & 0 deletions ozwadmin-main/controllercommands.cpp
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();
}
}

25 changes: 25 additions & 0 deletions ozwadmin-main/controllercommands.h
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
Loading

0 comments on commit 29fba4f

Please sign in to comment.