Added json broadcasting
This commit is contained in:
		
							parent
							
								
									df27b622a0
								
							
						
					
					
						commit
						3cbe947408
					
				
					 37 changed files with 514 additions and 487 deletions
				
			
		| 
						 | 
				
			
			@ -144,5 +144,12 @@ void ItemSettingsDialog::editActor()
 | 
			
		|||
        dialog->setParent(this);
 | 
			
		||||
        dialog->show();
 | 
			
		||||
        dialog->exec();
 | 
			
		||||
 | 
			
		||||
        for(int i = 0; i < ui->tableWidget->rowCount() && i < item_->getActors().size(); ++i)
 | 
			
		||||
        {
 | 
			
		||||
            ui->tableWidget->item(i, 0)->setText(item_->getActors()[i]->getName());
 | 
			
		||||
            ui->tableWidget->item(i, 1)->setText(item_->getActors()[i]->actionName());
 | 
			
		||||
            ui->tableWidget->item(i, 3)->setText(item_->getActors()[i]->isActive() ? "Y" : "N");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,6 @@ ItemWidget::ItemWidget(std::weak_ptr<Item> item, bool analog, QWidget *parent) :
 | 
			
		|||
    {
 | 
			
		||||
        ui->horizontalSpacer->changeSize(0,0);
 | 
			
		||||
        ui->checkBox->hide();
 | 
			
		||||
        //ui->label->hide();
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@
 | 
			
		|||
 | 
			
		||||
#include "itemsettingsdialog.h"
 | 
			
		||||
 | 
			
		||||
MainWindow::MainWindow(Microcontroller *micro, PowerItem* powerItem, ItemStore* itemStore, SensorStore *sensorStore, QWidget *parent) :
 | 
			
		||||
MainWindow::MainWindow(Microcontroller *micro, PowerItem* powerItem, ItemStore* itemStore, SensorStore *sensorStore, bool master, QWidget *parent) :
 | 
			
		||||
    QMainWindow(parent),
 | 
			
		||||
    ui(new Ui::MainWindow),
 | 
			
		||||
    colorChooser(this),
 | 
			
		||||
| 
						 | 
				
			
			@ -13,6 +13,9 @@ MainWindow::MainWindow(Microcontroller *micro, PowerItem* powerItem, ItemStore*
 | 
			
		|||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
 | 
			
		||||
    if(!master) connect(ui->pushButton_broadcast, &QPushButton::clicked, this, &MainWindow::sigBrodcast);
 | 
			
		||||
    else ui->pushButton_broadcast->hide();
 | 
			
		||||
 | 
			
		||||
    connect(ui->pushButton_power, SIGNAL(clicked()), this, SLOT(showPowerItemDialog()));
 | 
			
		||||
 | 
			
		||||
    //Relays
 | 
			
		||||
| 
						 | 
				
			
			@ -20,6 +23,11 @@ MainWindow::MainWindow(Microcontroller *micro, PowerItem* powerItem, ItemStore*
 | 
			
		|||
    connect(itemStore, &ItemStore::itemAdded, ui->relayList, &ItemScrollBox::addItem);
 | 
			
		||||
    connect(itemStore, &ItemStore::itemDeleted, ui->relayList, &ItemScrollBox::removeItem);
 | 
			
		||||
 | 
			
		||||
    for(size_t i = 0; i < itemStore->getItems()->size(); ++i)
 | 
			
		||||
    {
 | 
			
		||||
        ui->relayList->addItem(itemStore->getItems()->at(i));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Sensors
 | 
			
		||||
 | 
			
		||||
    ui->sensorListView->sensorsChanged(*(sensorStore->getSensors()));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@
 | 
			
		|||
#include "../sensors/sensor.h"
 | 
			
		||||
#include "../items/itemstore.h"
 | 
			
		||||
#include "../items/poweritem.h"
 | 
			
		||||
#include "../broadcast.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace Ui
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +24,7 @@ class MainWindow : public QMainWindow
 | 
			
		|||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit MainWindow(Microcontroller *micro, PowerItem* powerItem, ItemStore* itemStore, SensorStore *sensorStore, QWidget *parent = nullptr);
 | 
			
		||||
    explicit MainWindow(Microcontroller *micro, PowerItem* powerItem, ItemStore* itemStore, SensorStore *sensorStore, bool master, QWidget *parent = nullptr);
 | 
			
		||||
    ~MainWindow();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
| 
						 | 
				
			
			@ -35,6 +36,10 @@ private:
 | 
			
		|||
 | 
			
		||||
    PowerItem *_powerItem;
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
 | 
			
		||||
    void sigBrodcast();
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
 | 
			
		||||
    //RGB
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -96,35 +96,49 @@
 | 
			
		|||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QPushButton" name="button_color">
 | 
			
		||||
        <property name="sizePolicy">
 | 
			
		||||
         <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
 | 
			
		||||
          <horstretch>0</horstretch>
 | 
			
		||||
          <verstretch>0</verstretch>
 | 
			
		||||
         </sizepolicy>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_2">
 | 
			
		||||
        <property name="topMargin">
 | 
			
		||||
         <number>0</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="minimumSize">
 | 
			
		||||
         <size>
 | 
			
		||||
          <width>0</width>
 | 
			
		||||
          <height>0</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="maximumSize">
 | 
			
		||||
         <size>
 | 
			
		||||
          <width>16777215</width>
 | 
			
		||||
          <height>48</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="baseSize">
 | 
			
		||||
         <size>
 | 
			
		||||
          <width>0</width>
 | 
			
		||||
          <height>128</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Color</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="button_color">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>0</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="minimumSize">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>0</width>
 | 
			
		||||
            <height>0</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="maximumSize">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>16777215</width>
 | 
			
		||||
            <height>48</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="baseSize">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>0</width>
 | 
			
		||||
            <height>128</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Color</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="pushButton_power">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Config Shutdown</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </item>
 | 
			
		||||
| 
						 | 
				
			
			@ -167,16 +181,16 @@
 | 
			
		|||
         <number>0</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="pushButton_power">
 | 
			
		||||
         <widget class="QPushButton" name="pushButton_refesh">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Config Shutdown</string>
 | 
			
		||||
           <string>Refesh</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="pushButton_refesh">
 | 
			
		||||
         <widget class="QPushButton" name="pushButton_broadcast">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Refesh</string>
 | 
			
		||||
           <string>Broadcast</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue