Skip to content

Commit 29fba4f

Browse files
committed
Start Work on Dialogs for Controller Commands
1 parent 1ad6254 commit 29fba4f

11 files changed

+335
-142
lines changed

.vscode/c_cpp_properties.json

+20-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,26 @@
1313
"compilerPath": "/usr/bin/gcc",
1414
"cStandard": "c11",
1515
"cppStandard": "c++17",
16-
"intelliSenseMode": "clang-x64"
16+
"intelliSenseMode": "clang-x64",
17+
"compileCommands": "${workspaceFolder}/compile_commands.json"
18+
},
19+
{
20+
"name": "Mac",
21+
"includePath": [
22+
"${workspaceFolder}/**",
23+
"${workspaceFolder}/../open-zwave/cpp/src/**",
24+
"${workspaceFolder}/../qt-openzwave/qt-openzwave/include/**",
25+
"${workspaceFolder}/../qt-openzwave/qt-openzwavedatabase/include/**"
26+
],
27+
"macFrameworkPath": [
28+
"/Users/fish/Qt/5.12.6/clang_64/lib/"
29+
],
30+
"defines": [],
31+
"compilerPath": "/usr/bin/gcc",
32+
"cStandard": "c11",
33+
"cppStandard": "c++17",
34+
"intelliSenseMode": "clang-x64",
35+
"compileCommands": "${workspaceFolder}/compile_commands.json"
1736
}
1837
],
1938
"version": 4

ozwadmin-main/controllercommands.cpp

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+

ozwadmin-main/controllercommands.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef CONTROLLERCOMMANDS_H
2+
#define CONTROLLERCOMMANDS_H
3+
4+
#include <QObject>
5+
#include <QMainWindow>
6+
#include "ozwcore.h"
7+
8+
class OZWCore;
9+
10+
class ControllerCommands : public QObject
11+
{
12+
Q_OBJECT
13+
public:
14+
explicit ControllerCommands(QMainWindow *parent = nullptr);
15+
16+
public slots:
17+
void addNode();
18+
void delNode();
19+
void healNetwork();
20+
void cancelCommand();
21+
private:
22+
QMessageBox *m_msgBox;
23+
};
24+
25+
#endif // CONTROLLERCOMMANDS_H

0 commit comments

Comments
 (0)