Port to qt6
This commit is contained in:
parent
8fcca909de
commit
cbeb8d49a7
20 changed files with 43 additions and 44 deletions
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui widgets network multimedia
|
||||
QT += core gui widgets network multimedia httpserver
|
||||
|
||||
QT += serialport
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <QString>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "../items/item.h"
|
||||
#include "src/items/item.h"
|
||||
|
||||
class Actor : public Item
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef POLYNOMALACTOR_H
|
||||
#define POLYNOMALACTOR_H
|
||||
#include "actor.h"
|
||||
#include "../sensors/sensor.h"
|
||||
#include "src/sensors/sensor.h"
|
||||
|
||||
class PolynomalActor: public Actor
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <QTimer>
|
||||
|
||||
#include "actor.h"
|
||||
#include "../sensors/sensor.h"
|
||||
#include "src/sensors/sensor.h"
|
||||
|
||||
class Regulator : public Actor
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "actor.h"
|
||||
#include "../sensors/sensor.h"
|
||||
#include "src/sensors/sensor.h"
|
||||
|
||||
class SensorActor : public Actor
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "item.h"
|
||||
#include "../microcontroller.h"
|
||||
#include "src/microcontroller.h"
|
||||
|
||||
class AuxItem: public Item
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <vector>
|
||||
#include <memory>
|
||||
#include "item.h"
|
||||
#include "../sensors/sensor.h"
|
||||
#include "src/sensors/sensor.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,18 @@
|
|||
#include "messageitem.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QSound>
|
||||
|
||||
BroadCast* MessageItem::broadCast = nullptr;
|
||||
#include <QSoundEffect>
|
||||
|
||||
MessageItem::MessageItem(uint32_t itemIdIn, QString name, uint8_t value, QObject *parent):
|
||||
Item(itemIdIn, name, value, parent)
|
||||
{
|
||||
|
||||
alertSound.setVolume(1.0);
|
||||
}
|
||||
|
||||
MessageItem::MessageItem(const ItemData& itemData, QObject *parent):
|
||||
Item(itemData, parent)
|
||||
{
|
||||
|
||||
alertSound.setVolume(1.0);
|
||||
}
|
||||
|
||||
MessageItem::~MessageItem()
|
||||
|
|
@ -27,8 +25,8 @@ void MessageItem::setValue(uint8_t value)
|
|||
Item::setValue(value);
|
||||
if(value && !messageBox_)
|
||||
{
|
||||
if(broadCast) broadCast->sendMessage(name_, message_);
|
||||
if(!alertSoundFileName.isEmpty()) QSound::play(alertSoundFileName);
|
||||
if(!alertSoundFileName.isEmpty())
|
||||
alertSound.play();
|
||||
messageBox_ = new QMessageBox(QMessageBox::NoIcon, name_, message_);
|
||||
messageBox_->setModal(false);
|
||||
connect(messageBox_, &QMessageBox::finished, this, &MessageItem::closeMessageBox);
|
||||
|
|
@ -60,6 +58,7 @@ QString MessageItem::getAlert()
|
|||
void MessageItem::setAlert(const QString &in)
|
||||
{
|
||||
alertSoundFileName = in;
|
||||
alertSound.setSource(QUrl::fromLocalFile(alertSoundFileName));
|
||||
}
|
||||
|
||||
void MessageItem::setMessage(const QString& in)
|
||||
|
|
@ -77,7 +76,8 @@ void MessageItem::store(QJsonObject &json)
|
|||
json["Type"] = "Message";
|
||||
Item::store(json);
|
||||
json["Message"] = message_;
|
||||
if(!alertSoundFileName.isEmpty()) json["Alert"] = alertSoundFileName;
|
||||
if(!alertSoundFileName.isEmpty())
|
||||
json["Alert"] = alertSoundFileName;
|
||||
}
|
||||
|
||||
void MessageItem::load(const QJsonObject &json, const bool preserve)
|
||||
|
|
@ -85,4 +85,6 @@ void MessageItem::load(const QJsonObject &json, const bool preserve)
|
|||
Item::load(json,preserve);
|
||||
message_ = json["Message"].toString("Invalid Message");
|
||||
alertSoundFileName = json["Alert"].toString("");
|
||||
if(!alertSoundFileName.isEmpty())
|
||||
alertSound.setSource(QUrl::fromLocalFile(alertSoundFileName));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
#define MESSAGEITEM_H
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QSoundEffect>
|
||||
|
||||
#include "item.h"
|
||||
#include "../broadcast.h"
|
||||
|
||||
class MessageItem : public Item
|
||||
{
|
||||
|
|
@ -14,9 +14,7 @@ private:
|
|||
QString message_;
|
||||
QMessageBox* messageBox_ = nullptr;
|
||||
QString alertSoundFileName = "";
|
||||
|
||||
public:
|
||||
static BroadCast* broadCast;
|
||||
QSoundEffect alertSound;
|
||||
|
||||
private slots:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "item.h"
|
||||
#include "../sensors/sensor.h"
|
||||
#include "../microcontroller.h"
|
||||
#include "src/sensors/sensor.h"
|
||||
#include "src/microcontroller.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include<stdint.h>
|
||||
#include<QObject>
|
||||
|
||||
#include "../sensors/sensor.h"
|
||||
#include "src/sensors/sensor.h"
|
||||
#include "item.h"
|
||||
|
||||
class Microcontroller;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../microcontroller.h"
|
||||
#include "src/microcontroller.h"
|
||||
#include "item.h"
|
||||
|
||||
class RgbItem: public Item
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef SYSTEMITEM_H
|
||||
#define SYSTEMITEM_H
|
||||
|
||||
|
||||
#include "item.h"
|
||||
|
||||
class SystemItem : public Item
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <QTimer>
|
||||
|
||||
#include "../sun.h"
|
||||
#include "src/sun.h"
|
||||
#include "sensor.h"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,16 +24,16 @@
|
|||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
<enum>QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="rowWrapPolicy">
|
||||
<enum>QFormLayout::DontWrapRows</enum>
|
||||
<enum>QFormLayout::RowWrapPolicy::DontWrapRows</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>50</number>
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="currentSection">
|
||||
<enum>QDateTimeEdit::DaySection</enum>
|
||||
<enum>QDateTimeEdit::Section::DaySection</enum>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>dd.MM.yyyy hh:mm</string>
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@
|
|||
<customwidget>
|
||||
<class>SensorListWidget</class>
|
||||
<extends>QListView</extends>
|
||||
<header location="global">../src/ui/sensorlistwidget.h</header>
|
||||
<header location="local">src/ui/sensorlistwidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@
|
|||
<customwidget>
|
||||
<class>SensorListWidget</class>
|
||||
<extends>QListView</extends>
|
||||
<header location="global">../src/ui/sensorlistwidget.h</header>
|
||||
<header location="local">src/ui/sensorlistwidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
<customwidget>
|
||||
<class>SensorListWidget</class>
|
||||
<extends>QListView</extends>
|
||||
<header location="global">../src/ui/sensorlistwidget.h</header>
|
||||
<header location="local">src/ui/sensorlistwidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
<enum>Qt::LayoutDirection::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
|
|
@ -46,12 +46,12 @@
|
|||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_serialRecive">
|
||||
|
|
@ -62,13 +62,13 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
<enum>QFrame::Shape::Box</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SHinterface</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
<enum>Qt::TextFormat::AutoText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
<enum>QAbstractItemView::SelectionMode::NoSelection</enum>
|
||||
</property>
|
||||
<property name="showGrid" stdset="0">
|
||||
<bool>false</bool>
|
||||
|
|
@ -156,7 +156,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,0">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
|
|
@ -224,7 +224,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
<enum>Qt::LayoutDirection::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quit</string>
|
||||
|
|
@ -245,12 +245,12 @@
|
|||
<customwidget>
|
||||
<class>SensorListWidget</class>
|
||||
<extends>QListView</extends>
|
||||
<header location="global">../src/ui/sensorlistwidget.h</header>
|
||||
<header location="global">src/ui/sensorlistwidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ItemScrollBox</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">../src/ui/itemscrollbox.h</header>
|
||||
<header location="global">src/ui/itemscrollbox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include <QTableWidget>
|
||||
#include <vector>
|
||||
#include "../sensors/sensor.h"
|
||||
#include "src/sensors/sensor.h"
|
||||
|
||||
class SensorListItem : public QTableWidgetItem
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue