New Sensor-> Actor -> Item system (half implemented, relay support
only), new ui, Relay dehardcoeding.
This commit is contained in:
		
							parent
							
								
									74f117db69
								
							
						
					
					
						commit
						b04fbfb5bc
					
				
					 66 changed files with 3905 additions and 123 deletions
				
			
		
							
								
								
									
										14
									
								
								src/ui/actorsettingsdialog.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/ui/actorsettingsdialog.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
#include "actorsettingsdialog.h"
 | 
			
		||||
#include "ui_actorsettingsdialog.h"
 | 
			
		||||
 | 
			
		||||
ActorSettingsDialog::ActorSettingsDialog(QWidget *parent) :
 | 
			
		||||
    QDialog(parent),
 | 
			
		||||
    ui(new Ui::ActorSettingsDialog)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ActorSettingsDialog::~ActorSettingsDialog()
 | 
			
		||||
{
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										22
									
								
								src/ui/actorsettingsdialog.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/ui/actorsettingsdialog.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
#ifndef ACTORSETTINGSDIALOG_H
 | 
			
		||||
#define ACTORSETTINGSDIALOG_H
 | 
			
		||||
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class ActorSettingsDialog;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ActorSettingsDialog : public QDialog
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit ActorSettingsDialog(QWidget *parent = nullptr);
 | 
			
		||||
    ~ActorSettingsDialog();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::ActorSettingsDialog *ui;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // ACTORSETTINGSDIALOG_H
 | 
			
		||||
							
								
								
									
										104
									
								
								src/ui/actorsettingsdialog.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								src/ui/actorsettingsdialog.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,104 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>ActorSettingsDialog</class>
 | 
			
		||||
 <widget class="QDialog" name="ActorSettingsDialog">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>400</width>
 | 
			
		||||
    <height>300</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Dialog</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QVBoxLayout" name="vertlayout">
 | 
			
		||||
     <item>
 | 
			
		||||
      <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
       <item>
 | 
			
		||||
        <widget class="QLabel" name="label">
 | 
			
		||||
         <property name="sizePolicy">
 | 
			
		||||
          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
 | 
			
		||||
           <horstretch>0</horstretch>
 | 
			
		||||
           <verstretch>0</verstretch>
 | 
			
		||||
          </sizepolicy>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="text">
 | 
			
		||||
          <string>Action:</string>
 | 
			
		||||
         </property>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <widget class="QComboBox" name="comboBox_action">
 | 
			
		||||
         <item>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>On</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Off</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Toggle</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </item>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
      </layout>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QDialogButtonBox" name="buttonBox">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Horizontal</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="standardButtons">
 | 
			
		||||
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>buttonBox</sender>
 | 
			
		||||
   <signal>accepted()</signal>
 | 
			
		||||
   <receiver>ActorSettingsDialog</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>ActorSettingsDialog</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>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										50
									
								
								src/ui/alarmsettingsdialog.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								src/ui/alarmsettingsdialog.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
#include "alarmsettingsdialog.h"
 | 
			
		||||
#include "ui_alarmsettingsdialog.h"
 | 
			
		||||
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
 | 
			
		||||
AlarmSettingsDialog::AlarmSettingsDialog(AlarmTime* almNight, AlarmTime* almAlarm, QSettings* settings, QWidget *parent): QDialog(parent), ui(new Ui::AlarmSettingsDialog), almNight_(almNight), almAlarm_(almAlarm), settings_(settings)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
 | 
			
		||||
    //restore settings
 | 
			
		||||
    ui->checkBox_Alarm->setChecked(settings_->value("Alarms/alarmOn").toBool());
 | 
			
		||||
    ui->checkBox_Sunrise->setChecked(settings_->value("Alarms/sunrise").toBool());
 | 
			
		||||
    ui->timeEdit_Shutdown->setTime(settings_->value("Alarms/shutdownTime").toTime());
 | 
			
		||||
    ui->timeEdit_Alarm->setTime(settings_->value("Alarms/alarmTime").toTime());
 | 
			
		||||
    ui->lineEdit->setText(settings_->value("Alarms/alarmSoundFile").toString());
 | 
			
		||||
 | 
			
		||||
    connect(ui->pushButton_changeFile, SIGNAL(clicked()), this, SLOT(showFileChooser()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AlarmSettingsDialog::~AlarmSettingsDialog()
 | 
			
		||||
{
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AlarmSettingsDialog::accept()
 | 
			
		||||
{
 | 
			
		||||
    //store settings
 | 
			
		||||
    settings_->setValue("Alarms/alarmOn", ui->checkBox_Alarm->checkState());
 | 
			
		||||
    settings_->setValue("Alarms/sunrise", ui->checkBox_Sunrise->checkState());
 | 
			
		||||
    settings_->setValue("Alarms/shutdownTime", ui->timeEdit_Shutdown->time());
 | 
			
		||||
    settings_->setValue("Alarms/alarmTime", ui->timeEdit_Alarm->time());
 | 
			
		||||
    settings_->setValue("Alarms/alarmSoundFile", ui->lineEdit->text());
 | 
			
		||||
 | 
			
		||||
    //send signals
 | 
			
		||||
    signalAlarmSoundFile(ui->lineEdit->text());
 | 
			
		||||
    signalSunrise(ui->checkBox_Sunrise->checkState());
 | 
			
		||||
 | 
			
		||||
    //modify alarm objects
 | 
			
		||||
    almAlarm_->changeTime(ui->timeEdit_Alarm->time());
 | 
			
		||||
    almNight_->changeTime(ui->timeEdit_Shutdown->time());
 | 
			
		||||
 | 
			
		||||
    QDialog::accept();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AlarmSettingsDialog::showFileChooser()
 | 
			
		||||
{
 | 
			
		||||
    ui->lineEdit->setText(QFileDialog::getOpenFileName(this));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										43
									
								
								src/ui/alarmsettingsdialog.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/ui/alarmsettingsdialog.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,43 @@
 | 
			
		|||
#ifndef ALARMSETTINGSDIALOG_H
 | 
			
		||||
#define ALARMSETTINGSDIALOG_H
 | 
			
		||||
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
#include <QTime>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
 | 
			
		||||
#include "alarmtime.h"
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class AlarmSettingsDialog;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class AlarmSettingsDialog : public QDialog
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
    AlarmTime* almNight_;
 | 
			
		||||
    AlarmTime* almAlarm_;
 | 
			
		||||
    QSettings* settings_;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit AlarmSettingsDialog(AlarmTime* almNight, AlarmTime* almAlarm, QSettings* settings, QWidget* parent = nullptr);
 | 
			
		||||
    ~AlarmSettingsDialog();
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
    void signalAlarmSoundFile(QString fileName);
 | 
			
		||||
    void signalSunrise(bool enabled);
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
    void accept();
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
    void showFileChooser();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::AlarmSettingsDialog *ui;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // ALARMSETTINGSDIALOG_H
 | 
			
		||||
							
								
								
									
										241
									
								
								src/ui/alarmsettingsdialog.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										241
									
								
								src/ui/alarmsettingsdialog.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,241 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>AlarmSettingsDialog</class>
 | 
			
		||||
 <widget class="QDialog" name="AlarmSettingsDialog">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>462</width>
 | 
			
		||||
    <height>406</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Dialog</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QGroupBox" name="groupBox">
 | 
			
		||||
     <property name="title">
 | 
			
		||||
      <string>Alarm</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <layout class="QVBoxLayout" name="verticalLayout_2">
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_alm">
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLabel" name="label_3">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>0</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Time</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QTimeEdit" name="timeEdit_Alarm">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>0</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QCheckBox" name="checkBox_Alarm">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>0</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Enable</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_snd">
 | 
			
		||||
        <property name="leftMargin">
 | 
			
		||||
         <number>0</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="topMargin">
 | 
			
		||||
         <number>0</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLabel" name="label">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>0</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Sound File</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLineEdit" name="lineEdit">
 | 
			
		||||
          <property name="enabled">
 | 
			
		||||
           <bool>true</bool>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="pushButton_changeFile">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>0</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Change</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_2">
 | 
			
		||||
        <property name="topMargin">
 | 
			
		||||
         <number>0</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLabel" name="label_2">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Sunrise</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <spacer name="horizontalSpacer">
 | 
			
		||||
          <property name="orientation">
 | 
			
		||||
           <enum>Qt::Horizontal</enum>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="sizeHint" stdset="0">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>40</width>
 | 
			
		||||
            <height>20</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
         </spacer>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QCheckBox" name="checkBox_Sunrise">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>0</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Enable</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QGroupBox" name="groupBox_2">
 | 
			
		||||
     <property name="sizePolicy">
 | 
			
		||||
      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
 | 
			
		||||
       <horstretch>0</horstretch>
 | 
			
		||||
       <verstretch>0</verstretch>
 | 
			
		||||
      </sizepolicy>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="title">
 | 
			
		||||
      <string>Auto Power off</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <layout class="QVBoxLayout" name="verticalLayout_3">
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_4">
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLabel" name="label_4">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Time</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QTimeEdit" name="timeEdit_Shutdown"/>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QCheckBox" name="checkBox_Shutdown">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>0</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Enable</string>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="checked">
 | 
			
		||||
           <bool>true</bool>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QDialogButtonBox" name="buttonBox">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Horizontal</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="standardButtons">
 | 
			
		||||
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>buttonBox</sender>
 | 
			
		||||
   <signal>accepted()</signal>
 | 
			
		||||
   <receiver>AlarmSettingsDialog</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>AlarmSettingsDialog</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>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										142
									
								
								src/ui/alarmsettingsdialog.ui.orig
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										142
									
								
								src/ui/alarmsettingsdialog.ui.orig
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,142 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>AlarmSettingsDialog</class>
 | 
			
		||||
 <widget class="QDialog" name="AlarmSettingsDialog">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>423</width>
 | 
			
		||||
    <height>281</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Dialog</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QLabel" name="label">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Sound File:</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
     <property name="leftMargin">
 | 
			
		||||
      <number>0</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="topMargin">
 | 
			
		||||
      <number>0</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLineEdit" name="lineEdit">
 | 
			
		||||
       <property name="enabled">
 | 
			
		||||
        <bool>false</bool>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QPushButton" name="pushButton">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Change</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="horizontalLayout_2">
 | 
			
		||||
     <property name="topMargin">
 | 
			
		||||
      <number>0</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLabel" name="label_2">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Sunrise</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <spacer name="horizontalSpacer">
 | 
			
		||||
       <property name="orientation">
 | 
			
		||||
        <enum>Qt::Horizontal</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="sizeHint" stdset="0">
 | 
			
		||||
        <size>
 | 
			
		||||
         <width>40</width>
 | 
			
		||||
         <height>20</height>
 | 
			
		||||
        </size>
 | 
			
		||||
       </property>
 | 
			
		||||
      </spacer>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QCheckBox" name="checkBox">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Enable</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <spacer name="verticalSpacer">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Vertical</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="sizeHint" stdset="0">
 | 
			
		||||
      <size>
 | 
			
		||||
       <width>20</width>
 | 
			
		||||
       <height>40</height>
 | 
			
		||||
      </size>
 | 
			
		||||
     </property>
 | 
			
		||||
    </spacer>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QDialogButtonBox" name="buttonBox">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Horizontal</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="standardButtons">
 | 
			
		||||
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>buttonBox</sender>
 | 
			
		||||
   <signal>accepted()</signal>
 | 
			
		||||
   <receiver>AlarmSettingsDialog</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>AlarmSettingsDialog</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>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										0
									
								
								src/ui/alarmsettingsdialog_BASE_22257.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/ui/alarmsettingsdialog_BASE_22257.ui
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										142
									
								
								src/ui/alarmsettingsdialog_LOCAL_22257.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										142
									
								
								src/ui/alarmsettingsdialog_LOCAL_22257.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,142 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>AlarmSettingsDialog</class>
 | 
			
		||||
 <widget class="QDialog" name="AlarmSettingsDialog">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>423</width>
 | 
			
		||||
    <height>281</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Dialog</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QLabel" name="label">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Sound File:</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
     <property name="leftMargin">
 | 
			
		||||
      <number>0</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="topMargin">
 | 
			
		||||
      <number>0</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLineEdit" name="lineEdit">
 | 
			
		||||
       <property name="enabled">
 | 
			
		||||
        <bool>false</bool>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QPushButton" name="pushButton">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Change</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="horizontalLayout_2">
 | 
			
		||||
     <property name="topMargin">
 | 
			
		||||
      <number>0</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLabel" name="label_2">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Sunrise</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <spacer name="horizontalSpacer">
 | 
			
		||||
       <property name="orientation">
 | 
			
		||||
        <enum>Qt::Horizontal</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="sizeHint" stdset="0">
 | 
			
		||||
        <size>
 | 
			
		||||
         <width>40</width>
 | 
			
		||||
         <height>20</height>
 | 
			
		||||
        </size>
 | 
			
		||||
       </property>
 | 
			
		||||
      </spacer>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QCheckBox" name="checkBox">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Enable</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <spacer name="verticalSpacer">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Vertical</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="sizeHint" stdset="0">
 | 
			
		||||
      <size>
 | 
			
		||||
       <width>20</width>
 | 
			
		||||
       <height>40</height>
 | 
			
		||||
      </size>
 | 
			
		||||
     </property>
 | 
			
		||||
    </spacer>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QDialogButtonBox" name="buttonBox">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Horizontal</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="standardButtons">
 | 
			
		||||
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>buttonBox</sender>
 | 
			
		||||
   <signal>accepted()</signal>
 | 
			
		||||
   <receiver>AlarmSettingsDialog</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>AlarmSettingsDialog</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>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										71
									
								
								src/ui/alarmsettingsdialog_REMOTE_22257.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								src/ui/alarmsettingsdialog_REMOTE_22257.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,71 @@
 | 
			
		|||
<ui version="4.0">
 | 
			
		||||
 <author/>
 | 
			
		||||
 <comment/>
 | 
			
		||||
 <exportmacro/>
 | 
			
		||||
 <class>AlarmSettingsDialog</class>
 | 
			
		||||
 <widget name="AlarmSettingsDialog" class="QDialog">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>400</width>
 | 
			
		||||
    <height>300</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Dialog</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <widget name="buttonBox" class="QDialogButtonBox">
 | 
			
		||||
   <property name="geometry">
 | 
			
		||||
    <rect>
 | 
			
		||||
     <x>30</x>
 | 
			
		||||
     <y>240</y>
 | 
			
		||||
     <width>341</width>
 | 
			
		||||
     <height>32</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="orientation">
 | 
			
		||||
    <enum>Qt::Horizontal</enum>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="standardButtons">
 | 
			
		||||
    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
 | 
			
		||||
   </property>
 | 
			
		||||
  </widget>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <pixmapfunction/>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>buttonBox</sender>
 | 
			
		||||
   <signal>accepted()</signal>
 | 
			
		||||
   <receiver>AlarmSettingsDialog</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>AlarmSettingsDialog</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>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										14
									
								
								src/ui/alarmwidget.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/ui/alarmwidget.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
#include "alarmwidget.h"
 | 
			
		||||
#include "ui_alarmwidget.h"
 | 
			
		||||
 | 
			
		||||
AlarmWidget::AlarmWidget(QWidget *parent) :
 | 
			
		||||
    QWidget(parent),
 | 
			
		||||
    ui(new Ui::AlarmWidget)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AlarmWidget::~AlarmWidget()
 | 
			
		||||
{
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										22
									
								
								src/ui/alarmwidget.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/ui/alarmwidget.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
#ifndef ALARMWIDGET_H
 | 
			
		||||
#define ALARMWIDGET_H
 | 
			
		||||
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class AlarmWidget;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class AlarmWidget : public QWidget
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit AlarmWidget(QWidget *parent = nullptr);
 | 
			
		||||
    ~AlarmWidget();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::AlarmWidget *ui;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // ALARMWIDGET_H
 | 
			
		||||
							
								
								
									
										134
									
								
								src/ui/alarmwidget.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								src/ui/alarmwidget.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,134 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>AlarmWidget</class>
 | 
			
		||||
 <widget class="QWidget" name="AlarmWidget">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>357</width>
 | 
			
		||||
    <height>166</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="sizePolicy">
 | 
			
		||||
   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
 | 
			
		||||
    <horstretch>0</horstretch>
 | 
			
		||||
    <verstretch>0</verstretch>
 | 
			
		||||
   </sizepolicy>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Form</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="autoFillBackground">
 | 
			
		||||
   <bool>false</bool>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QFormLayout" name="formLayout">
 | 
			
		||||
   <property name="fieldGrowthPolicy">
 | 
			
		||||
    <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="rowWrapPolicy">
 | 
			
		||||
    <enum>QFormLayout::DontWrapRows</enum>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="labelAlignment">
 | 
			
		||||
    <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="formAlignment">
 | 
			
		||||
    <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="horizontalSpacing">
 | 
			
		||||
    <number>50</number>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="verticalSpacing">
 | 
			
		||||
    <number>6</number>
 | 
			
		||||
   </property>
 | 
			
		||||
   <item row="0" column="0">
 | 
			
		||||
    <widget class="QLabel" name="label">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Time:</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item row="0" column="1">
 | 
			
		||||
    <widget class="QDateTimeEdit" name="dateTimeEdit">
 | 
			
		||||
     <property name="locale">
 | 
			
		||||
      <locale language="English" country="Germany"/>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="showGroupSeparator" stdset="0">
 | 
			
		||||
      <bool>false</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="currentSection">
 | 
			
		||||
      <enum>QDateTimeEdit::DaySection</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="displayFormat">
 | 
			
		||||
      <string>dd.mM.yyyy hh:mm</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="calendarPopup">
 | 
			
		||||
      <bool>true</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item row="2" column="0">
 | 
			
		||||
    <widget class="QLabel" name="label_2">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Repeating:</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item row="5" column="1">
 | 
			
		||||
    <widget class="QRadioButton" name="radioButton_2">
 | 
			
		||||
     <property name="enabled">
 | 
			
		||||
      <bool>false</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Wee&kly</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item row="6" column="1">
 | 
			
		||||
    <widget class="QRadioButton" name="radioButton_3">
 | 
			
		||||
     <property name="enabled">
 | 
			
		||||
      <bool>false</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Monthly</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item row="7" column="1">
 | 
			
		||||
    <widget class="QRadioButton" name="radioButton_4">
 | 
			
		||||
     <property name="enabled">
 | 
			
		||||
      <bool>false</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Yearly</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item row="4" column="1">
 | 
			
		||||
    <widget class="QRadioButton" name="radioButton">
 | 
			
		||||
     <property name="enabled">
 | 
			
		||||
      <bool>false</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Daily</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="checkable">
 | 
			
		||||
      <bool>true</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="checked">
 | 
			
		||||
      <bool>true</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item row="2" column="1">
 | 
			
		||||
    <widget class="QCheckBox" name="checkBox">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string> Enable</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										78
									
								
								src/ui/mainwindow.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								src/ui/mainwindow.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,78 @@
 | 
			
		|||
#include "mainwindow.h"
 | 
			
		||||
#include "ui_mainwindow.h"
 | 
			
		||||
#include "relayscrollbox.h"
 | 
			
		||||
 | 
			
		||||
MainWindow::MainWindow(Microcontroller *micro , bool isRemoteMode , QWidget *parent) :
 | 
			
		||||
    QMainWindow(parent),
 | 
			
		||||
    ui(new Ui::MainWindow),
 | 
			
		||||
    colorChooser(this),
 | 
			
		||||
    _micro(micro)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
 | 
			
		||||
    if(!_micro->connected()) ui->label_serialRecive->setText("No IO Port! Debug only.");
 | 
			
		||||
 | 
			
		||||
    //Relays
 | 
			
		||||
    connect(ui->pushButton_refesh, SIGNAL(clicked()), _micro, SLOT(requestRelayList()));
 | 
			
		||||
    ui->relayList->setMicrocontoller(_micro);
 | 
			
		||||
    connect(_micro, &Microcontroller::gotRelayList, ui->relayList, &RelayScrollBox::gotRelays);
 | 
			
		||||
    connect(_micro, &Microcontroller::relayStateChanged, ui->relayList, &RelayScrollBox::relaySateChanged);
 | 
			
		||||
 | 
			
		||||
    //RGB Leds
 | 
			
		||||
    connect(ui->presettApply, SIGNAL(clicked()), this, SLOT(slotApplyPreset()));
 | 
			
		||||
    connect(&colorChooser, SIGNAL(colorSelected(const QColor)), this, SLOT(slotChangedRgb(const QColor)));
 | 
			
		||||
    connect(ui->button_lightsOn, SIGNAL(clicked()), _micro, SLOT(rgbOn()));
 | 
			
		||||
    connect(ui->button_lightsOff, SIGNAL(clicked()), _micro, SLOT(rgbOff()));
 | 
			
		||||
    connect(ui->button_quit, SIGNAL(clicked()), this, SLOT(close()));
 | 
			
		||||
    connect(ui->button_color, SIGNAL(clicked()), &colorChooser, SLOT(show()));
 | 
			
		||||
 | 
			
		||||
    new QListWidgetItem(tr("Pattern 0 Solid"), ui->listWidget_patern);
 | 
			
		||||
    new QListWidgetItem(tr("Pattern 1"), ui->listWidget_patern);
 | 
			
		||||
    new QListWidgetItem(tr("Pattern 2 Alarm"), ui->listWidget_patern);
 | 
			
		||||
    new QListWidgetItem(tr("Pattern 3"), ui->listWidget_patern);
 | 
			
		||||
    new QListWidgetItem(tr("Pattern 4 Sunrise"), ui->listWidget_patern);
 | 
			
		||||
 | 
			
		||||
    //Desk light
 | 
			
		||||
 | 
			
		||||
    connect(ui->horizontalSlider_deskLight, &QAbstractSlider::valueChanged, _micro, [this](int value){ _micro->setAuxPwm(value); });
 | 
			
		||||
 | 
			
		||||
    connect(ui->pushButton_alarms, SIGNAL(clicked()), this, SIGNAL(showAlmSettingsDialog()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::remoteMode()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MainWindow::~MainWindow()
 | 
			
		||||
{
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::slotChangedRgb(const QColor color)
 | 
			
		||||
{
 | 
			
		||||
    _micro->changeRgbColor(color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void MainWindow::slotApplyPreset()
 | 
			
		||||
{
 | 
			
		||||
    if(ui->listWidget_patern->selectedItems().count() == 1) _micro->setPattern(ui->listWidget_patern->currentRow());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::slotDoorOpenTimeout()
 | 
			
		||||
{
 | 
			
		||||
    //ui->checkBox_doorOpen->setChecked(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::auxStateChanged(int value)
 | 
			
		||||
{
 | 
			
		||||
    ui->horizontalSlider_deskLight->blockSignals(true);
 | 
			
		||||
    ui->horizontalSlider_deskLight->setValue(value);
 | 
			
		||||
    ui->horizontalSlider_deskLight->blockSignals(false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::changeHeaderLableText(const QString string)
 | 
			
		||||
{
 | 
			
		||||
    ui->label_serialRecive->setText(string);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										59
									
								
								src/ui/mainwindow.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								src/ui/mainwindow.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,59 @@
 | 
			
		|||
#ifndef MAINWINDOW_H
 | 
			
		||||
#define MAINWINDOW_H
 | 
			
		||||
 | 
			
		||||
#include <QMainWindow>
 | 
			
		||||
#include <QColorDialog>
 | 
			
		||||
#include <QListWidgetItem>
 | 
			
		||||
#include <QTime>
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include "alarmtime.h"
 | 
			
		||||
#include "microcontroller.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace Ui
 | 
			
		||||
{
 | 
			
		||||
class MainWindow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class MainWindow : public QMainWindow
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit MainWindow(Microcontroller *micro, bool isRemoteMode = false, QWidget *parent = nullptr);
 | 
			
		||||
    ~MainWindow();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::MainWindow *ui;
 | 
			
		||||
 | 
			
		||||
    QColorDialog colorChooser;
 | 
			
		||||
 | 
			
		||||
    Microcontroller *_micro;
 | 
			
		||||
 | 
			
		||||
    void remoteMode();
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
 | 
			
		||||
    void signalAmpOn();
 | 
			
		||||
    void signalAmpOff();
 | 
			
		||||
 | 
			
		||||
    void showAlmSettingsDialog();
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
 | 
			
		||||
    //RGB
 | 
			
		||||
    void slotChangedRgb(const QColor color);
 | 
			
		||||
    void slotApplyPreset();
 | 
			
		||||
 | 
			
		||||
    void changeHeaderLableText(const QString string);
 | 
			
		||||
 | 
			
		||||
    //door
 | 
			
		||||
    void slotDoorOpenTimeout();
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
 | 
			
		||||
    void auxStateChanged(int value);
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // MAINWINDOW_H
 | 
			
		||||
							
								
								
									
										332
									
								
								src/ui/mainwindow.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										332
									
								
								src/ui/mainwindow.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,332 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>MainWindow</class>
 | 
			
		||||
 <widget class="QMainWindow" name="MainWindow">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>862</width>
 | 
			
		||||
    <height>570</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="sizePolicy">
 | 
			
		||||
   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
 | 
			
		||||
    <horstretch>0</horstretch>
 | 
			
		||||
    <verstretch>50</verstretch>
 | 
			
		||||
   </sizepolicy>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="minimumSize">
 | 
			
		||||
   <size>
 | 
			
		||||
    <width>600</width>
 | 
			
		||||
    <height>197</height>
 | 
			
		||||
   </size>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Smart Home Interface</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowIcon">
 | 
			
		||||
   <iconset resource="resources.qrc">
 | 
			
		||||
    <normaloff>:/images/UVOSicon.bmp</normaloff>:/images/UVOSicon.bmp</iconset>
 | 
			
		||||
  </property>
 | 
			
		||||
  <widget class="QWidget" name="centralWidget">
 | 
			
		||||
   <property name="sizePolicy">
 | 
			
		||||
    <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
 | 
			
		||||
     <horstretch>0</horstretch>
 | 
			
		||||
     <verstretch>0</verstretch>
 | 
			
		||||
    </sizepolicy>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="layoutDirection">
 | 
			
		||||
    <enum>Qt::LeftToRight</enum>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="autoFillBackground">
 | 
			
		||||
    <bool>false</bool>
 | 
			
		||||
   </property>
 | 
			
		||||
   <layout class="QHBoxLayout" name="horizontalLayout_10">
 | 
			
		||||
    <item>
 | 
			
		||||
     <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QVBoxLayout" name="verticalLayout_2">
 | 
			
		||||
        <item>
 | 
			
		||||
         <layout class="QHBoxLayout" name="horizontalLayout_9">
 | 
			
		||||
          <property name="topMargin">
 | 
			
		||||
           <number>0</number>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="bottomMargin">
 | 
			
		||||
           <number>10</number>
 | 
			
		||||
          </property>
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QLabel" name="label_serialRecive">
 | 
			
		||||
            <property name="sizePolicy">
 | 
			
		||||
             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
 | 
			
		||||
              <horstretch>0</horstretch>
 | 
			
		||||
              <verstretch>0</verstretch>
 | 
			
		||||
             </sizepolicy>
 | 
			
		||||
            </property>
 | 
			
		||||
            <property name="frameShape">
 | 
			
		||||
             <enum>QFrame::Box</enum>
 | 
			
		||||
            </property>
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>SHinterface</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
         </layout>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QGroupBox" name="groupBox">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>0</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="title">
 | 
			
		||||
           <string>Relays</string>
 | 
			
		||||
          </property>
 | 
			
		||||
          <layout class="QVBoxLayout" name="verticalLayout_4">
 | 
			
		||||
           <item>
 | 
			
		||||
            <widget class="RelayScrollBox" name="relayList" native="true">
 | 
			
		||||
             <property name="sizePolicy">
 | 
			
		||||
              <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
 | 
			
		||||
               <horstretch>0</horstretch>
 | 
			
		||||
               <verstretch>0</verstretch>
 | 
			
		||||
              </sizepolicy>
 | 
			
		||||
             </property>
 | 
			
		||||
            </widget>
 | 
			
		||||
           </item>
 | 
			
		||||
           <item>
 | 
			
		||||
            <widget class="QPushButton" name="pushButton_refesh">
 | 
			
		||||
             <property name="text">
 | 
			
		||||
              <string>Refesh</string>
 | 
			
		||||
             </property>
 | 
			
		||||
            </widget>
 | 
			
		||||
           </item>
 | 
			
		||||
          </layout>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </item>
 | 
			
		||||
    <item>
 | 
			
		||||
     <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QListWidget" name="listWidget_patern">
 | 
			
		||||
        <property name="sizePolicy">
 | 
			
		||||
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
 | 
			
		||||
          <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>120</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="baseSize">
 | 
			
		||||
         <size>
 | 
			
		||||
          <width>0</width>
 | 
			
		||||
          <height>50</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_2">
 | 
			
		||||
        <item>
 | 
			
		||||
         <spacer name="horizontalSpacer_3">
 | 
			
		||||
          <property name="orientation">
 | 
			
		||||
           <enum>Qt::Horizontal</enum>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="sizeHint" stdset="0">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>40</width>
 | 
			
		||||
            <height>20</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
         </spacer>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="presettApply">
 | 
			
		||||
          <property name="minimumSize">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>128</width>
 | 
			
		||||
            <height>32</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Apply</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QPushButton" name="button_color">
 | 
			
		||||
        <property name="sizePolicy">
 | 
			
		||||
         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
 | 
			
		||||
          <horstretch>0</horstretch>
 | 
			
		||||
          <verstretch>50</verstretch>
 | 
			
		||||
         </sizepolicy>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="minimumSize">
 | 
			
		||||
         <size>
 | 
			
		||||
          <width>0</width>
 | 
			
		||||
          <height>0</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="maximumSize">
 | 
			
		||||
         <size>
 | 
			
		||||
          <width>16777215</width>
 | 
			
		||||
          <height>80</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="baseSize">
 | 
			
		||||
         <size>
 | 
			
		||||
          <width>0</width>
 | 
			
		||||
          <height>128</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Choose Color</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_11">
 | 
			
		||||
        <property name="topMargin">
 | 
			
		||||
         <number>10</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="bottomMargin">
 | 
			
		||||
         <number>10</number>
 | 
			
		||||
        </property>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="button_lightsOn">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>50</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="minimumSize">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>0</width>
 | 
			
		||||
            <height>48</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>ON</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QPushButton" name="button_lightsOff">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
 | 
			
		||||
            <horstretch>0</horstretch>
 | 
			
		||||
            <verstretch>50</verstretch>
 | 
			
		||||
           </sizepolicy>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="minimumSize">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>0</width>
 | 
			
		||||
            <height>48</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>OFF</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_8">
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLabel" name="label_3">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Desk Light</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QSlider" name="horizontalSlider_deskLight">
 | 
			
		||||
          <property name="maximum">
 | 
			
		||||
           <number>254</number>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="tracking">
 | 
			
		||||
           <bool>false</bool>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="orientation">
 | 
			
		||||
           <enum>Qt::Horizontal</enum>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <spacer name="verticalSpacer_2">
 | 
			
		||||
        <property name="orientation">
 | 
			
		||||
         <enum>Qt::Vertical</enum>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="sizeType">
 | 
			
		||||
         <enum>QSizePolicy::Preferred</enum>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="sizeHint" stdset="0">
 | 
			
		||||
         <size>
 | 
			
		||||
          <width>20</width>
 | 
			
		||||
          <height>20</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
       </spacer>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QPushButton" name="pushButton_alarms">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Alarms</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QPushButton" name="button_quit">
 | 
			
		||||
        <property name="sizePolicy">
 | 
			
		||||
         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
 | 
			
		||||
          <horstretch>0</horstretch>
 | 
			
		||||
          <verstretch>0</verstretch>
 | 
			
		||||
         </sizepolicy>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="layoutDirection">
 | 
			
		||||
         <enum>Qt::RightToLeft</enum>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Quit</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </item>
 | 
			
		||||
   </layout>
 | 
			
		||||
  </widget>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <layoutdefault spacing="6" margin="11"/>
 | 
			
		||||
 <customwidgets>
 | 
			
		||||
  <customwidget>
 | 
			
		||||
   <class>RelayScrollBox</class>
 | 
			
		||||
   <extends>QWidget</extends>
 | 
			
		||||
   <header>relayscrollbox.h</header>
 | 
			
		||||
   <container>1</container>
 | 
			
		||||
  </customwidget>
 | 
			
		||||
 </customwidgets>
 | 
			
		||||
 <resources>
 | 
			
		||||
  <include location="resources.qrc"/>
 | 
			
		||||
 </resources>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										230
									
								
								src/ui/relaydialog.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										230
									
								
								src/ui/relaydialog.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,230 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>RelayDialog</class>
 | 
			
		||||
 <widget class="QDialog" name="RelayDialog">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>358</width>
 | 
			
		||||
    <height>320</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Advanced Relays</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QGroupBox" name="groupBox">
 | 
			
		||||
     <property name="title">
 | 
			
		||||
      <string>Advanced</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <layout class="QVBoxLayout" name="verticalLayout_2">
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_3">
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLabel" name="label_3">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>3Dator</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <spacer name="horizontalSpacer_3">
 | 
			
		||||
          <property name="orientation">
 | 
			
		||||
           <enum>Qt::Horizontal</enum>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="sizeHint" stdset="0">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>40</width>
 | 
			
		||||
            <height>20</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
         </spacer>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QCheckBox" name="checkBox_R0">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>On</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="Line" name="line_4">
 | 
			
		||||
        <property name="orientation">
 | 
			
		||||
         <enum>Qt::Horizontal</enum>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_4">
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLabel" name="label_4">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>3040</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <spacer name="horizontalSpacer_4">
 | 
			
		||||
          <property name="orientation">
 | 
			
		||||
           <enum>Qt::Horizontal</enum>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="sizeHint" stdset="0">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>40</width>
 | 
			
		||||
            <height>20</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
         </spacer>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QCheckBox" name="checkBox_R1">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>On</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="Line" name="line_5">
 | 
			
		||||
        <property name="orientation">
 | 
			
		||||
         <enum>Qt::Horizontal</enum>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item>
 | 
			
		||||
       <layout class="QHBoxLayout" name="horizontalLayout_2">
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QLabel" name="label_6">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Aux</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <spacer name="horizontalSpacer_6">
 | 
			
		||||
          <property name="orientation">
 | 
			
		||||
           <enum>Qt::Horizontal</enum>
 | 
			
		||||
          </property>
 | 
			
		||||
          <property name="sizeHint" stdset="0">
 | 
			
		||||
           <size>
 | 
			
		||||
            <width>40</width>
 | 
			
		||||
            <height>20</height>
 | 
			
		||||
           </size>
 | 
			
		||||
          </property>
 | 
			
		||||
         </spacer>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item>
 | 
			
		||||
         <widget class="QCheckBox" name="checkBox_R2">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>On</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="horizontalLayout_5">
 | 
			
		||||
     <property name="leftMargin">
 | 
			
		||||
      <number>0</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="topMargin">
 | 
			
		||||
      <number>0</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLabel" name="label_5">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Enterance Watch</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <spacer name="horizontalSpacer_5">
 | 
			
		||||
       <property name="orientation">
 | 
			
		||||
        <enum>Qt::Horizontal</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="sizeHint" stdset="0">
 | 
			
		||||
        <size>
 | 
			
		||||
         <width>40</width>
 | 
			
		||||
         <height>20</height>
 | 
			
		||||
        </size>
 | 
			
		||||
       </property>
 | 
			
		||||
      </spacer>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QCheckBox" name="checkBox">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Inside</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="checked">
 | 
			
		||||
        <bool>true</bool>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QCheckBox" name="checkBox_2">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Watch</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="checked">
 | 
			
		||||
        <bool>true</bool>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QDialogButtonBox" name="buttonBox">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Horizontal</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="standardButtons">
 | 
			
		||||
      <set>QDialogButtonBox::Ok</set>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>buttonBox</sender>
 | 
			
		||||
   <signal>accepted()</signal>
 | 
			
		||||
   <receiver>RelayDialog</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>RelayDialog</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>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										32
									
								
								src/ui/relayscrollbox.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/ui/relayscrollbox.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
#include "relayscrollbox.h"
 | 
			
		||||
#include "ui_relayscrollbox.h"
 | 
			
		||||
 | 
			
		||||
RelayScrollBox::RelayScrollBox(QWidget *parent) :
 | 
			
		||||
    QWidget(parent),
 | 
			
		||||
    ui(new Ui::RelayScrollBox)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
    QScroller::grabGesture(ui->scrollArea, QScroller::TouchGesture);
 | 
			
		||||
    QScroller::grabGesture(ui->scrollArea, QScroller::LeftMouseButtonGesture);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RelayScrollBox::~RelayScrollBox()
 | 
			
		||||
{
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RelayScrollBox::addRelay(std::weak_ptr<Relay> relay)
 | 
			
		||||
{
 | 
			
		||||
    widgets_.push_back(new RelayWidget(relay));
 | 
			
		||||
    ui->relayWidgetVbox->addWidget(widgets_.back());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RelayScrollBox::removeRelay(const RelayStore& realy)
 | 
			
		||||
{
 | 
			
		||||
    for(unsigned i = 0; i < widgets_.size(); i++)
 | 
			
		||||
    {
 | 
			
		||||
        if(widgets_[i]->controles(realy)) widgets_.erase(widgets_.begin()+i);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										40
									
								
								src/ui/relayscrollbox.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/ui/relayscrollbox.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
#ifndef RELAYSCROLLBOX_H
 | 
			
		||||
#define RELAYSCROLLBOX_H
 | 
			
		||||
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <QScroller>
 | 
			
		||||
#include "relaywidget.h"
 | 
			
		||||
#include "../relay.h"
 | 
			
		||||
#include "../item.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class RelayScrollBox;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class RelayScrollBox : public QWidget
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
private:
 | 
			
		||||
    std::vector< RelayWidget* > widgets_;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit RelayScrollBox(QWidget *parent = nullptr);
 | 
			
		||||
    ~RelayScrollBox();
 | 
			
		||||
 | 
			
		||||
    void setItemStore(ItemStore* itemStore);
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
 | 
			
		||||
    void addRelay(std::weak_ptr<Relay> relay);
 | 
			
		||||
    void removeRelay(const RelayStore& Realy);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::RelayScrollBox *ui;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // RELAYSCROLLBOX_H
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										56
									
								
								src/ui/relayscrollbox.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								src/ui/relayscrollbox.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,56 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>RelayScrollBox</class>
 | 
			
		||||
 <widget class="QWidget" name="RelayScrollBox">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>400</width>
 | 
			
		||||
    <height>300</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Form</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QScrollArea" name="scrollArea">
 | 
			
		||||
     <property name="widgetResizable">
 | 
			
		||||
      <bool>true</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <widget class="QWidget" name="scrollAreaWidgetContents">
 | 
			
		||||
      <property name="geometry">
 | 
			
		||||
       <rect>
 | 
			
		||||
        <x>0</x>
 | 
			
		||||
        <y>0</y>
 | 
			
		||||
        <width>384</width>
 | 
			
		||||
        <height>284</height>
 | 
			
		||||
       </rect>
 | 
			
		||||
      </property>
 | 
			
		||||
      <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
       <item>
 | 
			
		||||
        <layout class="QVBoxLayout" name="relayWidgetVbox"/>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <spacer name="verticalSpacer">
 | 
			
		||||
         <property name="orientation">
 | 
			
		||||
          <enum>Qt::Vertical</enum>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="sizeHint" stdset="0">
 | 
			
		||||
          <size>
 | 
			
		||||
           <width>20</width>
 | 
			
		||||
           <height>40</height>
 | 
			
		||||
          </size>
 | 
			
		||||
         </property>
 | 
			
		||||
        </spacer>
 | 
			
		||||
       </item>
 | 
			
		||||
      </layout>
 | 
			
		||||
     </widget>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										18
									
								
								src/ui/relaysettingsdialog.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/ui/relaysettingsdialog.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
#include "relaysettingsdialog.h"
 | 
			
		||||
#include "ui_relaysettingsdialog.h"
 | 
			
		||||
 | 
			
		||||
RelaySettingsDialog::RelaySettingsDialog(RelayStore* relay, QWidget *parent) :
 | 
			
		||||
    QDialog(parent),
 | 
			
		||||
    relay_(relay),
 | 
			
		||||
    ui(new Ui::RelaySettingsDialog)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
    ui->label_address->setText(QString::number(relay_->getAddress(), 2));
 | 
			
		||||
    ui->label_name->setText(relay_->getName());
 | 
			
		||||
    ui->label_id->setText(QString::number(relay_->getId(), 10));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RelaySettingsDialog::~RelaySettingsDialog()
 | 
			
		||||
{
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										24
									
								
								src/ui/relaysettingsdialog.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/ui/relaysettingsdialog.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
#ifndef RELAYSETTINGSDIALOG_H
 | 
			
		||||
#define RELAYSETTINGSDIALOG_H
 | 
			
		||||
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
#include "relay.h"
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class RelaySettingsDialog;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class RelaySettingsDialog : public QDialog
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
    RelayStore* relay_;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit RelaySettingsDialog(RelayStore* relay, QWidget *parent = nullptr);
 | 
			
		||||
    ~RelaySettingsDialog();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::RelaySettingsDialog *ui;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // RELAYSETTINGSDIALOG_H
 | 
			
		||||
							
								
								
									
										207
									
								
								src/ui/relaysettingsdialog.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										207
									
								
								src/ui/relaysettingsdialog.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,207 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>RelaySettingsDialog</class>
 | 
			
		||||
 <widget class="QDialog" name="RelaySettingsDialog">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>400</width>
 | 
			
		||||
    <height>319</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Relay Settings</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowIcon">
 | 
			
		||||
   <iconset resource="resources.qrc">
 | 
			
		||||
    <normaloff>:/images/UVOSicon.bmp</normaloff>:/images/UVOSicon.bmp</iconset>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QFormLayout" name="formLayout">
 | 
			
		||||
     <property name="fieldGrowthPolicy">
 | 
			
		||||
      <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="rightMargin">
 | 
			
		||||
      <number>0</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="bottomMargin">
 | 
			
		||||
      <number>10</number>
 | 
			
		||||
     </property>
 | 
			
		||||
     <item row="3" column="0">
 | 
			
		||||
      <widget class="QLabel" name="label_5">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Address</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="3" column="1">
 | 
			
		||||
      <widget class="QLabel" name="label_address">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>TextLabel</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="alignment">
 | 
			
		||||
        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="2" column="1">
 | 
			
		||||
      <widget class="QLabel" name="label_name">
 | 
			
		||||
       <property name="sizePolicy">
 | 
			
		||||
        <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
 | 
			
		||||
         <horstretch>5</horstretch>
 | 
			
		||||
         <verstretch>0</verstretch>
 | 
			
		||||
        </sizepolicy>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="layoutDirection">
 | 
			
		||||
        <enum>Qt::LeftToRight</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>TextLabel</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="alignment">
 | 
			
		||||
        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="2" column="0">
 | 
			
		||||
      <widget class="QLabel" name="label">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Name:</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="alignment">
 | 
			
		||||
        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="1" column="1">
 | 
			
		||||
      <widget class="QLabel" name="label_id">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>TextLabel</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="alignment">
 | 
			
		||||
        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="1" column="0">
 | 
			
		||||
      <widget class="QLabel" name="label_2">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>ID:</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QListWidget" name="listWidget"/>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QPushButton" name="pushButton">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Remove</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QComboBox" name="comboBox">
 | 
			
		||||
       <item>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Alarm</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Timer</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Speaker</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>RGB Value</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Temperature</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string/>
 | 
			
		||||
        </property>
 | 
			
		||||
       </item>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QPushButton" name="pushButton_add">
 | 
			
		||||
       <property name="sizePolicy">
 | 
			
		||||
        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
 | 
			
		||||
         <horstretch>0</horstretch>
 | 
			
		||||
         <verstretch>0</verstretch>
 | 
			
		||||
        </sizepolicy>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Add</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QDialogButtonBox" name="buttonBox">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Horizontal</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="standardButtons">
 | 
			
		||||
      <set>QDialogButtonBox::Ok</set>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources>
 | 
			
		||||
  <include location="resources.qrc"/>
 | 
			
		||||
 </resources>
 | 
			
		||||
 <connections>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>buttonBox</sender>
 | 
			
		||||
   <signal>accepted()</signal>
 | 
			
		||||
   <receiver>RelaySettingsDialog</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>RelaySettingsDialog</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>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										50
									
								
								src/ui/relaywidget.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								src/ui/relaywidget.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
#include "relaywidget.h"
 | 
			
		||||
#include "ui_relaywidget.h"
 | 
			
		||||
 | 
			
		||||
#include <QCheckBox>
 | 
			
		||||
 | 
			
		||||
RelayWidget::RelayWidget(Relay* relay, QWidget *parent) :
 | 
			
		||||
    QWidget(parent),
 | 
			
		||||
    relay_(relay),
 | 
			
		||||
    ui(new Ui::RelayWidget)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
 | 
			
		||||
    relay_->setParent(this);
 | 
			
		||||
 | 
			
		||||
    if(!relay->hasActors())
 | 
			
		||||
    {
 | 
			
		||||
        ui->checkBox_auto->hide();
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    ui->checkBox_auto->setChecked(relay->actorsActive());
 | 
			
		||||
    ui->checkBox->setChecked(relay->getState());
 | 
			
		||||
 | 
			
		||||
    ui->label->setText(relay_->getName());
 | 
			
		||||
 | 
			
		||||
    connect(ui->checkBox, &QCheckBox::toggled, relay_, &Relay::moveToState);
 | 
			
		||||
    connect(ui->checkBox_auto, &QCheckBox::toggled, relay_, &Relay::setActorsActive);
 | 
			
		||||
    connect(ui->pushButton, &QPushButton::clicked, this, &RelayWidget::showSettingsDialog);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RelayWidget::showSettingsDialog()
 | 
			
		||||
{
 | 
			
		||||
    RelaySettingsDialog dialog(relay_, this);
 | 
			
		||||
    dialog.exec();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Relay* RelayWidget::getRelay()
 | 
			
		||||
{
 | 
			
		||||
    return relay_;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RelayWidget::stateChanged(bool state)
 | 
			
		||||
{
 | 
			
		||||
    ui->checkBox->setChecked(state);
 | 
			
		||||
    relay_->setState(state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RelayWidget::~RelayWidget()
 | 
			
		||||
{
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								src/ui/relaywidget.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/ui/relaywidget.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
#ifndef RELAYWIDGET_H
 | 
			
		||||
#define RELAYWIDGET_H
 | 
			
		||||
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include "relaysettingsdialog.h"
 | 
			
		||||
#include "relay.h"
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class RelayWidget;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class RelayWidget : public QWidget
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
private:
 | 
			
		||||
    Relay* relay_;
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
    void showSettingsDialog();
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit RelayWidget(Relay* relay_, QWidget *parent = nullptr);
 | 
			
		||||
    Relay* getRelay();
 | 
			
		||||
    ~RelayWidget();
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
    void stateChanged(bool state);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::RelayWidget *ui;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // RELAYWIDGET_H
 | 
			
		||||
							
								
								
									
										65
									
								
								src/ui/relaywidget.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								src/ui/relaywidget.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,65 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>RelayWidget</class>
 | 
			
		||||
 <widget class="QWidget" name="RelayWidget">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>435</width>
 | 
			
		||||
    <height>48</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Form</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QLabel" name="label">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>TextLabel</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <spacer name="horizontalSpacer">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Horizontal</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="sizeHint" stdset="0">
 | 
			
		||||
      <size>
 | 
			
		||||
       <width>40</width>
 | 
			
		||||
       <height>20</height>
 | 
			
		||||
      </size>
 | 
			
		||||
     </property>
 | 
			
		||||
    </spacer>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QCheckBox" name="checkBox">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>On</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QCheckBox" name="checkBox_auto">
 | 
			
		||||
     <property name="enabled">
 | 
			
		||||
      <bool>true</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Auto</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QPushButton" name="pushButton">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Settings</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										14
									
								
								src/ui/sensoractorwidget.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/ui/sensoractorwidget.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
#include "sensoractorwidget.h"
 | 
			
		||||
#include "ui_sensoractorwidget.h"
 | 
			
		||||
 | 
			
		||||
SensorActorWidget::SensorActorWidget(QWidget *parent) :
 | 
			
		||||
    QWidget(parent),
 | 
			
		||||
    ui(new Ui::SensorActorWidget)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SensorActorWidget::~SensorActorWidget()
 | 
			
		||||
{
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										22
									
								
								src/ui/sensoractorwidget.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/ui/sensoractorwidget.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
#ifndef SENSORACTORWIDGET_H
 | 
			
		||||
#define SENSORACTORWIDGET_H
 | 
			
		||||
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class SensorActorWidget;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class SensorActorWidget : public QWidget
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit SensorActorWidget(QWidget *parent = nullptr);
 | 
			
		||||
    ~SensorActorWidget();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::SensorActorWidget *ui;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // SENSORACTORWIDGET_H
 | 
			
		||||
							
								
								
									
										21
									
								
								src/ui/sensoractorwidget.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/ui/sensoractorwidget.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
<ui version="4.0">
 | 
			
		||||
 <author/>
 | 
			
		||||
 <comment/>
 | 
			
		||||
 <exportmacro/>
 | 
			
		||||
 <class>SensorActorWidget</class>
 | 
			
		||||
 <widget name="SensorActorWidget" class="QWidget">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>400</width>
 | 
			
		||||
    <height>300</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Form</string>
 | 
			
		||||
  </property>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <pixmapfunction/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										33
									
								
								src/ui/sensorlistwidget.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/ui/sensorlistwidget.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
#include "sensorlistwidget.h"
 | 
			
		||||
 | 
			
		||||
SensorListWidget::SensorListWidget(QWidget *parent): QListWidget (parent)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
SensorListWidget::SensorListWidget(SensorStore& sensorStore, QWidget* parent): QListWidget (parent)
 | 
			
		||||
{
 | 
			
		||||
      sensorsChanged(*(sensorStore.getSensors()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void SensorListWidget::sensorsChanged(std::vector<Sensor> sensors)
 | 
			
		||||
{
 | 
			
		||||
    clear();
 | 
			
		||||
    for(size_t i = 0; i < sensors.size(); ++i)
 | 
			
		||||
    {
 | 
			
		||||
        QString itemString = sensors[i].name + ": ";
 | 
			
		||||
 | 
			
		||||
        if(sensors[i].type == Sensor::TYPE_DOOR)
 | 
			
		||||
        {
 | 
			
		||||
            if(sensors[i].field) itemString.append("Open");
 | 
			
		||||
            else itemString.append("Closed");
 | 
			
		||||
        }
 | 
			
		||||
        else if(sensors[i].type == Sensor::TYPE_AUDIO_OUTPUT)
 | 
			
		||||
        {
 | 
			
		||||
            if(sensors[i].field) itemString.append("Playing");
 | 
			
		||||
            else itemString.append("Silent");
 | 
			
		||||
        }
 | 
			
		||||
        else itemString.append(QString::number(sensors[i].field));
 | 
			
		||||
        addItem(itemString);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								src/ui/sensorlistwidget.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/ui/sensorlistwidget.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
#include <QListWidget>
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include "../sensor.h"
 | 
			
		||||
 | 
			
		||||
class SensorListWidget : public QListWidget
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    SensorListWidget(QWidget *parent = nullptr);
 | 
			
		||||
    SensorListWidget(SensorStore& sensorStore, QWidget* parent = nullptr);
 | 
			
		||||
    virtual ~SensorListWidget(){}
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
 | 
			
		||||
    void sensorsChanged(std::vector<Sensor> sensors);
 | 
			
		||||
};
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue