switched from qsettings to json added editng of actors
This commit is contained in:
parent
b04fbfb5bc
commit
df27b622a0
141 changed files with 4402 additions and 5068 deletions
|
|
@ -1,47 +1,34 @@
|
|||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "relayscrollbox.h"
|
||||
#include "itemscrollbox.h"
|
||||
|
||||
MainWindow::MainWindow(Microcontroller *micro , bool isRemoteMode , QWidget *parent) :
|
||||
#include "itemsettingsdialog.h"
|
||||
|
||||
MainWindow::MainWindow(Microcontroller *micro, PowerItem* powerItem, ItemStore* itemStore, SensorStore *sensorStore, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
colorChooser(this),
|
||||
_micro(micro)
|
||||
_micro(micro),
|
||||
_powerItem(powerItem)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
if(!_micro->connected()) ui->label_serialRecive->setText("No IO Port! Debug only.");
|
||||
connect(ui->pushButton_power, SIGNAL(clicked()), this, SLOT(showPowerItemDialog()));
|
||||
|
||||
//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);
|
||||
connect(ui->pushButton_refesh, SIGNAL(clicked()), _micro, SLOT(requestState()));
|
||||
connect(itemStore, &ItemStore::itemAdded, ui->relayList, &ItemScrollBox::addItem);
|
||||
connect(itemStore, &ItemStore::itemDeleted, ui->relayList, &ItemScrollBox::removeItem);
|
||||
|
||||
//Sensors
|
||||
|
||||
ui->sensorListView->sensorsChanged(*(sensorStore->getSensors()));
|
||||
connect(sensorStore, &SensorStore::stateChenged, ui->sensorListView, &SensorListWidget::sensorsChanged);
|
||||
|
||||
//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()
|
||||
|
|
@ -49,30 +36,24 @@ MainWindow::~MainWindow()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::showPowerItemDialog()
|
||||
{
|
||||
ItemSettingsDialog diag(_powerItem, this);
|
||||
diag.show();
|
||||
diag.exec();
|
||||
}
|
||||
|
||||
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)
|
||||
void MainWindow::changeHeaderLableText(QString string)
|
||||
{
|
||||
if(string.size() > 28)
|
||||
{
|
||||
string.remove(28, string.size()-(28));
|
||||
string.append("...");
|
||||
}
|
||||
ui->label_serialRecive->setText(string);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue