mirror of
https://github.com/Fishwaldo/ozw-admin.git
synced 2025-03-15 19:31:38 +00:00
Docking Widgets, Event Window, Start on some Network Management Commands
This commit is contained in:
parent
29fba4f4d6
commit
190d84132e
14 changed files with 490 additions and 144 deletions
|
@ -1,23 +1,32 @@
|
|||
#include <QMessageBox>
|
||||
#include "controllercommands.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
|
||||
ControllerCommands::ControllerCommands(QMainWindow *parent) :
|
||||
QObject(parent)
|
||||
QObject(parent),
|
||||
m_msgBox(parent)
|
||||
{
|
||||
|
||||
connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::controllerCommand, this, &ControllerCommands::controllerCommandNotification);
|
||||
}
|
||||
|
||||
|
||||
void ControllerCommands::addNode() {
|
||||
|
||||
|
||||
this->m_command = ControllerCommands::Command_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();
|
||||
this->m_msgBox.setIcon(QMessageBox::Information);
|
||||
this->m_msgBox.setWindowTitle("Adding Node");
|
||||
this->m_msgBox.setText("Starting...");
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
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) {
|
||||
|
@ -25,18 +34,306 @@ void ControllerCommands::addNode() {
|
|||
}
|
||||
}
|
||||
void ControllerCommands::delNode() {
|
||||
this->m_command = ControllerCommands::Command_delNode;
|
||||
this->m_msgBox.setIcon(QMessageBox::Information);
|
||||
this->m_msgBox.setWindowTitle("Exclude Node");
|
||||
this->m_msgBox.setText("Starting...");
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
this->m_msgBox.setDetailedText("Waiting for the Controller to Enter Exclusion Mode...");
|
||||
connect(&this->m_msgBox, &QMessageBox::rejected, this, &ControllerCommands::cancelCommand);
|
||||
this->m_msgBox.show();
|
||||
OZWCore::get()->getQTOZWManager()->removeNode();
|
||||
}
|
||||
void ControllerCommands::healNetwork() {
|
||||
this->m_command = ControllerCommands::Command_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) {
|
||||
this->m_msgBox.setIcon(QMessageBox::Information);
|
||||
this->m_msgBox.setWindowTitle("Heal Network");
|
||||
this->m_msgBox.setText("Starting...");
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
this->m_msgBox.setDetailedText("Waiting for the Controller to Enter Heal Network Mode...");
|
||||
connect(&this->m_msgBox, &QMessageBox::rejected, this, &ControllerCommands::cancelCommand);
|
||||
this->m_msgBox.show();
|
||||
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();
|
||||
switch (this->m_command) {
|
||||
case ControllerCommands::Command_none:
|
||||
case ControllerCommands::Command_healNetwork:
|
||||
case ControllerCommands::Command_cancel:
|
||||
{
|
||||
/* These Don't need to be Canceled */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
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();
|
||||
} else {
|
||||
this->m_msgBox.show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ControllerCommands::controllerCommandNotification(quint8 node, NotificationTypes::QTOZW_Notification_Controller_Cmd command, NotificationTypes::QTOZW_Notification_Controller_State state, NotificationTypes::QTOZW_Notification_Controller_Error error)
|
||||
{
|
||||
qCDebug(ozwadmin) << "ControllerCommandNotification: " << node << command << state << error;
|
||||
switch (this->m_command) {
|
||||
case ControllerCommands::Command_none:
|
||||
case ControllerCommands::Command_cancel:
|
||||
{
|
||||
qCDebug(ozwadmin) << "Ignoring Notification as we are not in a ControllerCommand Mode";
|
||||
return;
|
||||
}
|
||||
case ControllerCommands::Command_addNode: {
|
||||
if (command != NotificationTypes::Ctrl_Cmd_AddNode) {
|
||||
qCDebug(ozwadmin) << "Ignoring Notification as we are not in addNode Mode";
|
||||
return;
|
||||
}
|
||||
switch (state) {
|
||||
case NotificationTypes::Ctrl_State_Starting: {
|
||||
this->m_msgBox.setText("Add Node Starting...");
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Waiting: {
|
||||
this->m_msgBox.setText("Started - Waiting to discover new Node");
|
||||
this->m_msgBox.setDetailedText("Please Activate the Pairing Mode on the device you wish to include now");
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Normal: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Cancel: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Error: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Sleeping: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_InProgress: {
|
||||
this->m_msgBox.setIcon(QMessageBox::Information);
|
||||
if (node) {
|
||||
this->m_msgBox.setText(QString("Adding Node %1 in Progress").arg(node));
|
||||
} else {
|
||||
this->m_msgBox.setText("Adding Node in Progress");
|
||||
}
|
||||
this->m_msgBox.setDetailedText("OpenZWave is Querying Node Capabilities...");
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::NoButton);
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Completed: {
|
||||
this->m_msgBox.setIcon(QMessageBox::Information);
|
||||
this->m_msgBox.setText(QString("Add Node Completed for new Node %1").arg(node));
|
||||
this->m_msgBox.setDetailedText("Add Node Has Completed. OpenZWave is querying the the Node now");
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Close);
|
||||
this->m_command = ControllerCommands::Command_none;
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Failed: {
|
||||
this->m_msgBox.setIcon(QMessageBox::Critical);
|
||||
this->m_msgBox.setText("AddNode Command Failed");
|
||||
this->m_msgBox.setDetailedText("Please Consult the Logs Window for further infomation");
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Close);
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_NodeOk: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_NodeFailed: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_count: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ControllerCommands::Command_delNode: {
|
||||
if (command != NotificationTypes::Ctrl_Cmd_RemoveNode) {
|
||||
qCDebug(ozwadmin) << "Ignoring Notification as we are not in delNode Mode";
|
||||
return;
|
||||
}
|
||||
switch (state) {
|
||||
case NotificationTypes::Ctrl_State_Starting: {
|
||||
this->m_msgBox.setText("Delete Node Starting...");
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Waiting: {
|
||||
this->m_msgBox.setText("Delete Node Mode Started - Waiting...");
|
||||
this->m_msgBox.setDetailedText("Please activate the exclude mode function on the device you wish to exclude now");
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Normal: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Cancel: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Error: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Sleeping: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_InProgress: {
|
||||
this->m_msgBox.setIcon(QMessageBox::Information);
|
||||
if (node) {
|
||||
this->m_msgBox.setText(QString("Exectuting Exclusion on Node %1").arg(node));
|
||||
} else {
|
||||
this->m_msgBox.setText("Exectuting Exclusion on Device");
|
||||
}
|
||||
this->m_msgBox.setDetailedText("Node is currently being removed from its Network Association");
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::NoButton);
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Completed: {
|
||||
this->m_msgBox.setIcon(QMessageBox::Information);
|
||||
if (node) {
|
||||
this->m_msgBox.setText(QString("Delete Node Completed for Node %1").arg(node));
|
||||
} else {
|
||||
this->m_msgBox.setText(QString("Delete Node Completed").arg(node));
|
||||
}
|
||||
this->m_msgBox.setDetailedText("Delete Node Has Completed");
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Close);
|
||||
this->m_command = ControllerCommands::Command_none;
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Failed: {
|
||||
this->m_msgBox.setIcon(QMessageBox::Warning);
|
||||
this->m_msgBox.setText("Delete Node Command Failed");
|
||||
this->m_msgBox.setDetailedText("If you were excluding a device associated from another Network, the Node may have been removed from that network and is ready to be included in a new Network");
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Close);
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_NodeOk: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_NodeFailed: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_count: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ControllerCommands::Command_healNetwork: {
|
||||
static int sleeping = 0;
|
||||
static int failed = 0;
|
||||
if (command != NotificationTypes::Ctrl_Cmd_RequestNodeNeighborUpdate) {
|
||||
qCDebug(ozwadmin) << "Ignoring Notification as we are not in healNetwork Mode";
|
||||
return;
|
||||
}
|
||||
switch (state) {
|
||||
case NotificationTypes::Ctrl_State_Starting: {
|
||||
sleeping = 0;
|
||||
failed = 0;
|
||||
this->m_msgBox.setText("Heal Network Mode Starting...");
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Waiting: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Normal: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Cancel: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Error: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Sleeping: {
|
||||
sleeping++;
|
||||
QString details;
|
||||
if (sleeping > 0) {
|
||||
this->m_msgBox.setIcon(QMessageBox::Warning);
|
||||
details.append("Some Devices are Sleeping\n");
|
||||
}
|
||||
if (failed > 0) {
|
||||
this->m_msgBox.setIcon(QMessageBox::Critical);
|
||||
details.append("Some Devices Failed\n");
|
||||
}
|
||||
|
||||
this->m_msgBox.setIcon(QMessageBox::Warning);
|
||||
this->m_msgBox.setDetailedText(details);
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Close);
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_InProgress: {
|
||||
QString details;
|
||||
if (sleeping > 0) {
|
||||
this->m_msgBox.setIcon(QMessageBox::Warning);
|
||||
details.append("Some Devices are Sleeping\n");
|
||||
}
|
||||
if (failed > 0) {
|
||||
this->m_msgBox.setIcon(QMessageBox::Critical);
|
||||
details.append("Some Devices Failed\n");
|
||||
}
|
||||
if (node) {
|
||||
this->m_msgBox.setText(QString("Exectuting Heal Network on Node %1").arg(node));
|
||||
} else {
|
||||
this->m_msgBox.setText("Exectuting Heal Network");
|
||||
}
|
||||
if (!details.isEmpty()) this->m_msgBox.setDetailedText(details);
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Close);
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Completed: {
|
||||
QString details;
|
||||
if (sleeping > 0) {
|
||||
this->m_msgBox.setIcon(QMessageBox::Warning);
|
||||
details.append("Some Devices are Sleeping\n");
|
||||
}
|
||||
if (failed > 0) {
|
||||
this->m_msgBox.setIcon(QMessageBox::Critical);
|
||||
details.append("Some Devices Failed\n");
|
||||
}
|
||||
this->m_msgBox.setText("Heal Network Completed");
|
||||
this->m_msgBox.setDetailedText(details);
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Close);
|
||||
this->m_command = ControllerCommands::Command_none;
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_Failed: {
|
||||
if (node == OZWCore::get()->getQTOZWManager()->getControllerNodeId()) {
|
||||
/* controller Nodes always fail this */
|
||||
return;
|
||||
}
|
||||
failed++;
|
||||
QString details;
|
||||
if (sleeping > 0) {
|
||||
this->m_msgBox.setIcon(QMessageBox::Warning);
|
||||
details.append("Some Devices are Sleeping\n");
|
||||
}
|
||||
if (failed > 0) {
|
||||
this->m_msgBox.setIcon(QMessageBox::Critical);
|
||||
details.append("Some Devices Failed\n");
|
||||
}
|
||||
this->m_msgBox.setText("Heal Network Finished");
|
||||
this->m_msgBox.setDetailedText(details);
|
||||
this->m_msgBox.setStandardButtons(QMessageBox::Close);
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_NodeOk: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_NodeFailed: {
|
||||
break;
|
||||
}
|
||||
case NotificationTypes::Ctrl_State_count: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,18 @@ class ControllerCommands : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit ControllerCommands(QMainWindow *parent = nullptr);
|
||||
|
||||
enum Command {Command_addNode, Command_delNode, Command_healNetwork, Command_cancel, Command_none};
|
||||
Q_ENUM(Command);
|
||||
public slots:
|
||||
void addNode();
|
||||
void delNode();
|
||||
void healNetwork();
|
||||
void cancelCommand();
|
||||
|
||||
void controllerCommandNotification(quint8 node, NotificationTypes::QTOZW_Notification_Controller_Cmd command, NotificationTypes::QTOZW_Notification_Controller_State state, NotificationTypes::QTOZW_Notification_Controller_Error error);
|
||||
private:
|
||||
QMessageBox *m_msgBox;
|
||||
QMessageBox m_msgBox;
|
||||
Command m_command;
|
||||
};
|
||||
|
||||
#endif // CONTROLLERCOMMANDS_H
|
||||
|
|
40
ozwadmin-main/eventwindow.cpp
Normal file
40
ozwadmin-main/eventwindow.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include <QTableWidgetItem>
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
|
||||
#include "eventwindow.h"
|
||||
#include "ui_eventwindow.h"
|
||||
|
||||
|
||||
EventWindow::EventWindow(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::EventWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->eventTable->horizontalHeader()->setStretchLastSection(true);
|
||||
ui->eventTable->setHorizontalHeaderItem(0, new QTableWidgetItem("Time"));
|
||||
ui->eventTable->setHorizontalHeaderItem(1, new QTableWidgetItem("Message"));
|
||||
ui->eventTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
|
||||
}
|
||||
|
||||
EventWindow::~EventWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void EventWindow::newEvent(QString Msg) {
|
||||
QTableWidgetItem *timeStamp = new QTableWidgetItem(QTime::currentTime().toString());
|
||||
timeStamp->setFlags(timeStamp->flags() ^ Qt::ItemIsEditable);
|
||||
QTableWidgetItem *message = new QTableWidgetItem(Msg);
|
||||
message->setFlags(message->flags() ^ Qt::ItemIsEditable);
|
||||
|
||||
this->ui->eventTable->insertRow ( this->ui->eventTable->rowCount() );
|
||||
this->ui->eventTable->setItem(this->ui->eventTable->rowCount() -1,
|
||||
0,
|
||||
timeStamp);
|
||||
this->ui->eventTable->setItem(this->ui->eventTable->rowCount() -1,
|
||||
1,
|
||||
message);
|
||||
QTimer::singleShot(10, this->ui->eventTable, &QTableWidget::scrollToBottom);
|
||||
}
|
24
ozwadmin-main/eventwindow.h
Normal file
24
ozwadmin-main/eventwindow.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef EVENTWINDOW_H
|
||||
#define EVENTWINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class EventWindow;
|
||||
}
|
||||
|
||||
class EventWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EventWindow(QWidget *parent = nullptr);
|
||||
~EventWindow();
|
||||
|
||||
public slots:
|
||||
void newEvent(QString);
|
||||
private:
|
||||
Ui::EventWindow *ui;
|
||||
};
|
||||
|
||||
#endif // EVENTWINDOW_H
|
30
ozwadmin-main/eventwindow.ui
Normal file
30
ozwadmin-main/eventwindow.ui
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EventWindow</class>
|
||||
<widget class="QWidget" name="EventWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="eventTable">
|
||||
<property name="columnCount">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<column/>
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -4,11 +4,12 @@
|
|||
#include "ui_logwindow.h"
|
||||
|
||||
LogWindow::LogWindow(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
QWidget(parent),
|
||||
ui(new Ui::LogWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->logview->verticalHeader()->hide();
|
||||
this->ui->logview->horizontalHeader()->setStretchLastSection(true);
|
||||
this->ui->logview->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
// this->ui->val_system_tbl->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
// this->ui->logview->resizeColumnsToContents();
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Ui {
|
|||
class LogWindow;
|
||||
}
|
||||
|
||||
class LogWindow : public QDialog
|
||||
class LogWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LogWindow</class>
|
||||
<widget class="QDialog" name="LogWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget" name="LogWindow">
|
||||
<property name="windowTitle">
|
||||
<string>OZW Log</string>
|
||||
</property>
|
||||
|
@ -42,51 +34,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>LogWindow</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>LogWindow</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -43,29 +43,34 @@
|
|||
#include "nodeflagswidget.h"
|
||||
#include "qt-ads/DockAreaWidget.h"
|
||||
#include "ozwcore.h"
|
||||
#include "eventwindow.h"
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
sbMsg(this)
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
connect(OZWCore::get(), &OZWCore::raiseCriticalError, this, &MainWindow::openCriticalDialog, Qt::DirectConnection);
|
||||
OZWCore::get()->initilize();
|
||||
|
||||
this->sbMsg = new statusBarMessages(this);
|
||||
connect(this->sbMsg, &statusBarMessages::newMessage, this, &MainWindow::setStatusBarMsg);
|
||||
|
||||
|
||||
this->ui->setupUi(this);
|
||||
this->m_DockManager = new ads::CDockManager(this);
|
||||
this->m_controllerCommands = new ControllerCommands(this);
|
||||
this->connected(false);
|
||||
|
||||
|
||||
connect(OZWCore::get(), &OZWCore::raiseCriticalError, this, &MainWindow::openCriticalDialog, Qt::DirectConnection);
|
||||
OZWCore::get()->initilize();
|
||||
|
||||
|
||||
|
||||
DeviceInfo *di = new DeviceInfo(this);
|
||||
NodeStatus *ni = new NodeStatus(this);
|
||||
EventWindow *ew = new EventWindow(this);
|
||||
LogWindow *lw = new LogWindow(this);
|
||||
connect(this->sbMsg, &statusBarMessages::newMessage, ew, &EventWindow::newEvent);
|
||||
|
||||
|
||||
statusBar()->showMessage(tr("Starting..."));
|
||||
this->ui->action_Close->setEnabled(false);
|
||||
connect(ui->actionOpen_Log_Window, SIGNAL(triggered()), this, SLOT(openLogWindow()));
|
||||
|
||||
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(OpenConnection()));
|
||||
connect(ui->action_Close, SIGNAL(triggered()), this, SLOT(CloseConnection()));
|
||||
|
@ -114,18 +119,24 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
|
||||
RightDockWidget->setCurrentDockWidget(DeviceInfoDW);
|
||||
|
||||
ads::CDockWidget *eventViewDW = new ads::CDockWidget("Event List");
|
||||
eventViewDW->setWidget(ew);
|
||||
auto BottomDockWidget = this->m_DockManager->addDockWidget(ads::BottomDockWidgetArea, eventViewDW);
|
||||
|
||||
ads::CDockWidget *logWindowDW = new ads::CDockWidget("OZW Logs");
|
||||
logWindowDW->setWidget(lw);
|
||||
this->m_DockManager->addDockWidget(ads::CenterDockWidgetArea, logWindowDW, BottomDockWidget);
|
||||
BottomDockWidget->setCurrentDockWidget(eventViewDW);
|
||||
|
||||
|
||||
this->sbMsg.setQTOZWManager(OZWCore::get()->getQTOZWManager());
|
||||
|
||||
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::ready, this, &MainWindow::QTOZW_Ready);
|
||||
|
||||
OZWCore::get()->getQTOZWManager()->initilizeSource(OZWCore::get()->settings.value("StartServer").toBool());
|
||||
this->m_logWindow.setModel(OZWCore::get()->getQTOZWManager()->getLogModel());
|
||||
|
||||
userValues->setModel(OZWCore::get()->getQTOZWManager()->getValueModel(), this->ntw->selectionModel());
|
||||
systemValues->setModel(OZWCore::get()->getQTOZWManager()->getValueModel(), this->ntw->selectionModel());
|
||||
configValues->setModel(OZWCore::get()->getQTOZWManager()->getValueModel(), this->ntw->selectionModel());
|
||||
|
||||
lw->setModel(OZWCore::get()->getQTOZWManager()->getLogModel());
|
||||
|
||||
di->setQTOZWManager(OZWCore::get()->getQTOZWManager());
|
||||
ni->setQTOZWManager(OZWCore::get()->getQTOZWManager());
|
||||
|
@ -247,10 +258,6 @@ void MainWindow::NodeSelected(QModelIndex current,QModelIndex previous) {
|
|||
}
|
||||
|
||||
|
||||
void MainWindow::openLogWindow() {
|
||||
this->m_logWindow.show();
|
||||
}
|
||||
|
||||
void MainWindow::openMetaDataWindow() {
|
||||
qCDebug(ozwadmin) << "Opening Window";
|
||||
QModelIndex index = this->ntw->currentIndex();
|
||||
|
@ -299,4 +306,8 @@ void MainWindow::connected(bool connected) {
|
|||
this->ui->action_AddNode->setEnabled(connected);
|
||||
this->ui->action_Delete_Node->setEnabled(connected);
|
||||
this->ui->action_Heal_Network->setEnabled(connected);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setStatusBarMsg(QString Msg) {
|
||||
this->statusBar()->showMessage(QTime::currentTime().toString("hh:m:ss ap").append(" Event: ").append(Msg), 5000);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ public slots:
|
|||
void CloseConnection();
|
||||
void resizeColumns();
|
||||
void NodeSelected(QModelIndex,QModelIndex);
|
||||
void openLogWindow();
|
||||
void OpenDeviceDB();
|
||||
void QTOZW_Ready();
|
||||
void openAboutWindow();
|
||||
|
@ -55,6 +54,7 @@ public slots:
|
|||
void addNode();
|
||||
void delNode();
|
||||
void healNetwork();
|
||||
void setStatusBarMsg(QString);
|
||||
|
||||
QMessageBox::StandardButton openCriticalDialog(QString title, QString msg);
|
||||
|
||||
|
@ -63,10 +63,8 @@ private:
|
|||
ControllerCommands *m_controllerCommands;
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
statusBarMessages sbMsg;
|
||||
statusBarMessages *sbMsg;
|
||||
nodeTableWidget *ntw;
|
||||
|
||||
LogWindow m_logWindow;
|
||||
ads::CDockManager* m_DockManager;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
<property name="title">
|
||||
<string>Window</string>
|
||||
</property>
|
||||
<addaction name="actionOpen_Log_Window"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_Driver_Statistics"/>
|
||||
</widget>
|
||||
|
@ -73,7 +72,6 @@
|
|||
<addaction name="action_Delete_Node"/>
|
||||
<addaction name="action_Heal_Network"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionOpen_Log_Window"/>
|
||||
<addaction name="actionDevice_Database"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
|
@ -87,11 +85,6 @@
|
|||
<string>E&xit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Log_Window">
|
||||
<property name="text">
|
||||
<string>Open Log Window</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Driver_Statistics">
|
||||
<property name="text">
|
||||
<string>&Driver Statistics</string>
|
||||
|
|
|
@ -22,6 +22,7 @@ SOURCES += main.cpp\
|
|||
configuration.cpp \
|
||||
controllercommands.cpp \
|
||||
deviceinfo.cpp \
|
||||
eventwindow.cpp \
|
||||
logwindow.cpp \
|
||||
mainwindow.cpp \
|
||||
metadatawindow.cpp \
|
||||
|
@ -39,6 +40,7 @@ HEADERS += mainwindow.h \
|
|||
configuration.h \
|
||||
controllercommands.h \
|
||||
deviceinfo.h \
|
||||
eventwindow.h \
|
||||
logwindow.h \
|
||||
metadatawindow.h \
|
||||
nodestatus.h \
|
||||
|
@ -54,6 +56,7 @@ HEADERS += mainwindow.h \
|
|||
FORMS += mainwindow.ui \
|
||||
configuration.ui \
|
||||
deviceinfo.ui \
|
||||
eventwindow.ui \
|
||||
logwindow.ui \
|
||||
metadatawindow.ui \
|
||||
nodestatus.ui \
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#include <QMainWindow>
|
||||
#include <QStatusBar>
|
||||
#include "statusbarmessages.h"
|
||||
#include "ozwcore.h"
|
||||
|
||||
statusBarMessages::statusBarMessages(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void statusBarMessages::setQTOZWManager(QTOZWManager *qtozwm) {
|
||||
QTOZWManager *qtozwm = OZWCore::get()->getQTOZWManager();
|
||||
QObject::connect(qtozwm, &QTOZWManager::manufacturerSpecificDBReady, this, &statusBarMessages::manufacturerSpecificDBReady);
|
||||
QObject::connect(qtozwm, &QTOZWManager::ready, this, &statusBarMessages::ready);
|
||||
QObject::connect(qtozwm, &QTOZWManager::starting, this, &statusBarMessages::starting);
|
||||
|
@ -40,109 +38,101 @@ void statusBarMessages::setQTOZWManager(QTOZWManager *qtozwm) {
|
|||
QObject::connect(qtozwm, &QTOZWManager::manufacturerSpecificDBReady, this, &statusBarMessages::manufacturerSpecificDBReady);
|
||||
}
|
||||
|
||||
void statusBarMessages::setMessage(QString Msg) {
|
||||
QMainWindow *mw = qobject_cast<QMainWindow *>(parent());
|
||||
if (mw)
|
||||
mw->statusBar()->showMessage(QTime::currentTime().toString("hh:m:ss ap").append(" Event: ").append(Msg), 5000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void statusBarMessages::ready() {
|
||||
setMessage("OpenZwave Ready");
|
||||
emit newMessage("OpenZwave Ready");
|
||||
}
|
||||
void statusBarMessages::valueAdded(quint64 vidKey) {
|
||||
setMessage(QString("Value Added: %1").arg(vidKey));
|
||||
emit newMessage(QString("Value Added: %1").arg(vidKeyDetails(vidKey)));
|
||||
}
|
||||
void statusBarMessages::valueRemoved(quint64 vidKey) {
|
||||
setMessage(QString("Value Removed: %1").arg(vidKey));
|
||||
emit newMessage(QString("Value Removed: %1").arg(vidKeyDetails(vidKey)));
|
||||
}
|
||||
void statusBarMessages::valueChanged(quint64 vidKey) {
|
||||
setMessage(QString("Value Changed: %1").arg(vidKey));
|
||||
emit newMessage(QString("Value Changed: %1").arg(vidKeyDetails(vidKey)));
|
||||
}
|
||||
void statusBarMessages::valueRefreshed(quint64 vidKey) {
|
||||
setMessage(QString("Value Refreshed: %1").arg(vidKey));
|
||||
emit newMessage(QString("Value Refreshed: %1").arg(vidKeyDetails(vidKey)));
|
||||
}
|
||||
void statusBarMessages::nodeNew(quint8 node) {
|
||||
setMessage(QString("New Node: %1").arg(node));
|
||||
emit newMessage(QString("New Node: %1").arg(node));
|
||||
}
|
||||
void statusBarMessages::nodeAdded(quint8 node) {
|
||||
setMessage(QString("Node Added: %1").arg(node));
|
||||
emit newMessage(QString("Node Added: %1").arg(node));
|
||||
}
|
||||
void statusBarMessages::nodeRemoved(quint8 node) {
|
||||
setMessage(QString("Node Removed: %1").arg(node));
|
||||
emit newMessage(QString("Node Removed: %1").arg(node));
|
||||
}
|
||||
void statusBarMessages::nodeReset(quint8 node) {
|
||||
setMessage(QString("Node Reset: %1").arg(node));
|
||||
emit newMessage(QString("Node Reset: %1").arg(node));
|
||||
}
|
||||
void statusBarMessages::nodeNaming(quint8 node) {
|
||||
setMessage(QString("Node Name Received: %1").arg(node));
|
||||
emit newMessage(QString("Node Name Received: %1").arg(node));
|
||||
}
|
||||
void statusBarMessages::nodeEvent(quint8 node, quint8 event) {
|
||||
setMessage(QString("Node %1 Basic Event Received: %2").arg(node).arg(event));
|
||||
emit newMessage(QString("Node %1 Basic Event Received: %2").arg(node).arg(event));
|
||||
}
|
||||
void statusBarMessages::nodeProtocolInfo(quint8 node) {
|
||||
setMessage(QString("Node Basic Protocol Information Received: %2").arg(node));
|
||||
emit newMessage(QString("Node Basic Protocol Information Received: %2").arg(node));
|
||||
}
|
||||
void statusBarMessages::nodeEssentialNodeQueriesComplete(quint8 node) {
|
||||
setMessage(QString("Essential Node Queries Complete: %2").arg(node));
|
||||
emit newMessage(QString("Essential Node Queries Complete: %2").arg(node));
|
||||
}
|
||||
void statusBarMessages::nodeQueriesComplete(quint8 node) {
|
||||
setMessage(QString("Node Queries Complete: %2").arg(node));
|
||||
emit newMessage(QString("Node Queries Complete: %2").arg(node));
|
||||
}
|
||||
void statusBarMessages::nodeGroupChanged(quint8 node, quint8 group) {
|
||||
setMessage(QString("Node %1 Group Update Received: %2").arg(node).arg(group));
|
||||
emit newMessage(QString("Node %1 Group Update Received: %2").arg(node).arg(group));
|
||||
}
|
||||
void statusBarMessages::driverReady(quint32 homeID) {
|
||||
setMessage(QString("Driver Ready for HomeID: %2").arg(homeID));
|
||||
emit newMessage(QString("Driver Ready for HomeID: %2").arg(homeID));
|
||||
}
|
||||
void statusBarMessages::driverFailed(quint32 homeID) {
|
||||
setMessage(QString("Driver Failed for HomeID: %2").arg(homeID));
|
||||
emit newMessage(QString("Driver Failed for HomeID: %2").arg(homeID));
|
||||
}
|
||||
void statusBarMessages::driverReset(quint32 homeID) {
|
||||
setMessage(QString("Driver Reset for HomeID: %2").arg(homeID));
|
||||
emit newMessage(QString("Driver Reset for HomeID: %2").arg(homeID));
|
||||
}
|
||||
void statusBarMessages::driverRemoved(quint32 homeID) {
|
||||
setMessage(QString("Driver Removed for HomeID: %2").arg(homeID));
|
||||
emit newMessage(QString("Driver Removed for HomeID: %2").arg(homeID));
|
||||
}
|
||||
void statusBarMessages::driverAllNodesQueriedSomeDead() {
|
||||
setMessage(QString("ZWave Network Node Queries Completed - Some Dead Nodes"));
|
||||
emit newMessage(QString("ZWave Network Node Queries Completed - Some Dead Nodes"));
|
||||
}
|
||||
void statusBarMessages::driverAllNodesQueried() {
|
||||
setMessage(QString("ZWave Network Node Queries Completed"));
|
||||
emit newMessage(QString("ZWave Network Node Queries Completed"));
|
||||
}
|
||||
void statusBarMessages::driverAwakeNodesQueried() {
|
||||
setMessage(QString("ZWave Network Awake Node Queries Completed"));
|
||||
emit newMessage(QString("ZWave Network Awake Node Queries Completed"));
|
||||
}
|
||||
void statusBarMessages::controllerCommand(quint8 node, NotificationTypes::QTOZW_Notification_Controller_Cmd command, NotificationTypes::QTOZW_Notification_Controller_State state, NotificationTypes::QTOZW_Notification_Controller_Error error) {
|
||||
Q_UNUSED(node);
|
||||
Q_UNUSED(command);
|
||||
Q_UNUSED(state);
|
||||
Q_UNUSED(error);
|
||||
setMessage(QString("ZWave Controller Command Executed"));
|
||||
QMetaEnum commandEnum = QMetaEnum::fromType<NotificationTypes::QTOZW_Notification_Controller_Cmd>();
|
||||
QMetaEnum stateEnum = QMetaEnum::fromType<NotificationTypes::QTOZW_Notification_Controller_State>();
|
||||
QMetaEnum errorEnum = QMetaEnum::fromType<NotificationTypes::QTOZW_Notification_Controller_Error>();
|
||||
emit newMessage(QString("ZWave Controller Command Executed: %1 State: %2 Error: %3").arg(commandEnum.valueToKey(command)).arg(stateEnum.valueToKey(state)).arg(errorEnum.valueToKey(error)));
|
||||
}
|
||||
void statusBarMessages::ozwNotification(quint8 node, NotificationTypes::QTOZW_Notification_Code event) {
|
||||
Q_UNUSED(node);
|
||||
Q_UNUSED(event);
|
||||
setMessage(QString("ZWave Network Notification Received"));
|
||||
QMetaEnum eventEnum = QMetaEnum::fromType<NotificationTypes::QTOZW_Notification_Code>();
|
||||
emit newMessage(QString("ZWave Network Notification Received: %1").arg(eventEnum.valueToKey(event)));
|
||||
}
|
||||
void statusBarMessages::ozwUserAlert(quint8 node, NotificationTypes::QTOZW_Notification_User event, quint8 retry) {
|
||||
Q_UNUSED(node);
|
||||
Q_UNUSED(event);
|
||||
Q_UNUSED(retry);
|
||||
setMessage(QString("ZWave User Alert Received"));
|
||||
QMetaEnum eventEnum = QMetaEnum::fromType<NotificationTypes::QTOZW_Notification_User>();
|
||||
emit newMessage(QString("ZWave User Alert Received: %1").arg(eventEnum.valueToKey(event)));
|
||||
}
|
||||
void statusBarMessages::manufacturerSpecificDBReady() {
|
||||
setMessage(QString("Manufacturer Specific Database Loaded"));
|
||||
emit newMessage(QString("Manufacturer Specific Database Loaded"));
|
||||
}
|
||||
void statusBarMessages::starting() {
|
||||
setMessage(QString("Starting Z-Wave Network"));
|
||||
emit newMessage(QString("Starting Z-Wave Network"));
|
||||
}
|
||||
void statusBarMessages::started(quint32 homeID) {
|
||||
setMessage(QString("Started Z-Wave Network: %1").arg(homeID));
|
||||
emit newMessage(QString("Started Z-Wave Network: %1").arg(homeID));
|
||||
}
|
||||
void statusBarMessages::stopped(quint32 homeID) {
|
||||
setMessage(QString("Stopped Z-Wave Network: %1").arg(homeID));
|
||||
emit newMessage(QString("Stopped Z-Wave Network: %1").arg(homeID));
|
||||
}
|
||||
#if 0
|
||||
void statusBarMessages::remoteConnectionStatus(connectionStatus status, QAbstractSocket::SocketError error) {
|
||||
|
@ -150,3 +140,10 @@ void statusBarMessages::remoteConnectionStatus(connectionStatus status, QAbstrac
|
|||
}
|
||||
#endif
|
||||
|
||||
QString statusBarMessages::vidKeyDetails(quint64 key) {
|
||||
quint8 node = OZWCore::get()->getQTOZWManager()->getNodeId(key);
|
||||
quint8 instance = OZWCore::get()->getQTOZWManager()->getInstance(key);
|
||||
QString label = OZWCore::get()->getQTOZWManager()->getValueLabel(key);
|
||||
QString status(QString("Node %1, Instance %2, Label %3").arg(node).arg(instance).arg(label));
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,8 @@ class statusBarMessages : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit statusBarMessages(QObject *parent = nullptr);
|
||||
void setQTOZWManager(QTOZWManager *m_qtozwmanager);
|
||||
signals:
|
||||
|
||||
void newMessage(QString);
|
||||
public slots:
|
||||
void ready();
|
||||
void valueAdded(quint64 vidKey);
|
||||
|
@ -46,9 +45,9 @@ public slots:
|
|||
void stopped(quint32 homeID);
|
||||
// void remoteConnectionStatus(WebSocketIoDevice::connectionStatus status, QAbstractSocket::SocketError error);
|
||||
|
||||
QString vidKeyDetails(quint64);
|
||||
|
||||
private:
|
||||
void setMessage(QString);
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue