Finish lerge refactor of systems
This commit is contained in:
parent
6d742e60db
commit
913d7df56d
36 changed files with 614 additions and 634 deletions
|
|
@ -1,10 +1,14 @@
|
|||
#include "mainwindow.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
#include "itemscrollbox.h"
|
||||
#include "itemsettingsdialog.h"
|
||||
#include "itemcreationdialog.h"
|
||||
#include "../mainobject.h"
|
||||
#include <QMessageBox>
|
||||
#include "src/mainobject.h"
|
||||
#include "src/programmode.h"
|
||||
#include "src/items/poweritem.h"
|
||||
|
||||
MainWindow::MainWindow(MainObject * const mainObject, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
|
|
@ -24,15 +28,20 @@ MainWindow::MainWindow(MainObject * const mainObject, QWidget *parent) :
|
|||
for(size_t i = 0; i < globalItems.getItems()->size(); ++i)
|
||||
ui->relayList->addItem(globalItems.getItems()->at(i));
|
||||
|
||||
if(programMode != PROGRAM_MODE_PRIMARY)
|
||||
ui->label_serialRecive->setHidden(true);
|
||||
|
||||
//Sensors
|
||||
ui->sensorListView->setShowHidden(false);
|
||||
ui->sensorListView->sensorsChanged(*globalSensors.getSensors());
|
||||
connect(&globalSensors, &SensorStore::stateChenged, ui->sensorListView, &SensorListWidget::sensorsChanged);
|
||||
|
||||
//RGB Leds
|
||||
connect(&colorChooser, SIGNAL(colorSelected(QColor)), this, SLOT(slotChangedRgb(QColor)));
|
||||
connect(&colorChooser, &QColorDialog::colorSelected, this, &MainWindow::sigSetRgb);
|
||||
connect(ui->button_quit, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(ui->button_color, SIGNAL(clicked()), &colorChooser, SLOT(show()));
|
||||
if(programMode != PROGRAM_MODE_PRIMARY)
|
||||
ui->button_color->hide();
|
||||
|
||||
connect(ui->pushButton_addItem, &QPushButton::clicked, this, &MainWindow::showItemCreationDialog);
|
||||
connect(ui->relayList, &ItemScrollBox::deleteRequest, &globalItems, &ItemStore::removeItem);
|
||||
|
|
@ -47,25 +56,30 @@ MainWindow::~MainWindow()
|
|||
|
||||
void MainWindow::showPowerItemDialog()
|
||||
{
|
||||
ItemSettingsDialog diag(std::shared_ptr<Item>(_powerItem), this);
|
||||
diag.show();
|
||||
diag.exec();
|
||||
std::shared_ptr<PowerItem> powerItem;
|
||||
for(std::shared_ptr<Item> item : *globalItems.getItems())
|
||||
{
|
||||
powerItem = std::dynamic_pointer_cast<PowerItem>(item);
|
||||
if(powerItem)
|
||||
break;
|
||||
}
|
||||
if(powerItem)
|
||||
{
|
||||
ItemSettingsDialog diag(std::shared_ptr<Item>(powerItem), this);
|
||||
diag.show();
|
||||
diag.exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this, "Error", "No power item found, refresh first");
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slotChangedRgb(const QColor color)
|
||||
{
|
||||
(void)color;
|
||||
//_micro->changeRgbColor(color);
|
||||
}
|
||||
|
||||
void MainWindow::showItemCreationDialog()
|
||||
{
|
||||
ItemCreationDialog diag(this);
|
||||
diag.show();
|
||||
if(diag.exec())
|
||||
{
|
||||
createdItem(diag.item);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::changeHeaderLableText(QString string)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue