Removed LED plugin, now using the one from the AnalogWidgets.

Wed, 29 Jun 2022 23:06:38 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 29 Jun 2022 23:06:38 +0200
changeset 318
ff02aca2b63c
parent 317
f78827503fb0
child 319
d1861707054c

Removed LED plugin, now using the one from the AnalogWidgets.

CMakeLists.txt file | annotate | diff | comparison | revisions
designer/LEDPlugin.cpp file | annotate | diff | comparison | revisions
designer/LEDPlugin.h file | annotate | diff | comparison | revisions
src/DetailFermenter.cpp file | annotate | diff | comparison | revisions
src/LED.cpp file | annotate | diff | comparison | revisions
src/LED.h file | annotate | diff | comparison | revisions
ui/DetailFermenter.ui file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Wed Jun 29 22:19:39 2022 +0200
+++ b/CMakeLists.txt	Wed Jun 29 23:06:38 2022 +0200
@@ -131,13 +131,6 @@
     ${GEN_MOC_FILES2}
   )
 
-  QT_WRAP_CPP( GEN_MOC_FILES3 ${SRCDIR}/LED.h designer/LEDPlugin.h)
-  add_library(bmsapp_LED SHARED
-    ${SRCDIR}/LED.cpp
-    designer/LEDPlugin.cpp
-    ${GEN_MOC_FILES3}
-  )
-
   QT_WRAP_CPP(GEN_MOC_FILES4
     ${SRCDIR}/analog/thermometer.h
     ${SRCDIR}/analog/abstractmeter.h
@@ -240,7 +233,6 @@
     ${SRCDIR}/database/db_recipe.cpp
     ${SRCDIR}/RangedSlider.cpp
     ${SRCDIR}/NullDateEdit.cpp
-    ${SRCDIR}/LED.cpp
     ${SRCDIR}/analog/abstractmeter.cpp
     ${SRCDIR}/analog/functions.cpp
     ${SRCDIR}/analog/widgetwithbackground.cpp
@@ -298,7 +290,6 @@
     ${SRCDIR}/database/db_recipe.h
     ${SRCDIR}/RangedSlider.h
     ${SRCDIR}/NullDateEdit.h
-    ${SRCDIR}/LED.h
     ${SRCDIR}/analog/abstractmeter.h
     ${SRCDIR}/analog/functions.h
     ${SRCDIR}/analog/widgetwithbackground.h
@@ -379,7 +370,6 @@
   INSTALL(TARGETS
     bmsapp_rangeslider
     bmsapp_nulldate
-    bmsapp_LED
     bmsapp_thermometer
     bmsapp_manometer
     bmsapp_led
--- a/designer/LEDPlugin.cpp	Wed Jun 29 22:19:39 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-
-#include <QObject>
-#include <QtUiPlugin/QDesignerCustomWidgetInterface>
-#include <QString>
-#include <QWidget>
-#include <QIcon>
-#include <QtPlugin>
-
-#include "LEDPlugin.h"
-#include "LED.h"
-
-LEDPlugin::LEDPlugin(QObject* parent) :
-	QObject(parent)
-{
-}
-
-void LEDPlugin::initialize(QDesignerFormEditorInterface * /* core */)
-{
-   if(initialized)
-      return;
-
-   initialized = true;
-   return;
-}
-
-bool LEDPlugin::isInitialized() const
-{
-   return initialized;
-}
-
-QString LEDPlugin::name() const
-{
-	return "LED";
-}
-
-QString LEDPlugin::group() const
-{
-	return "BMSapp Widgets";
-}
-
-QString LEDPlugin::toolTip() const
-{
-	return QString("An LED");
-}
-
-QString LEDPlugin::whatsThis() const
-{
-	return QString("An LED");
-}
-
-QString LEDPlugin::includeFile() const
-{
-	return "LED.h";
-}
-
-QString LEDPlugin::domXml() const
-{
-   return "<ui language=\"c++\">\n"
-          " <widget class=\"LED\" name=\"LEDWidget\">\n"
-          " </widget>\n"
-          "</ui>\n";
-}
-
-QIcon LEDPlugin::icon() const
-{
-	return QIcon();
-}
-
-bool LEDPlugin::isContainer() const
-{
-	return false;
-}
-
-QWidget * LEDPlugin::createWidget(QWidget *parent)
-{
-	return new LED(parent);
-}
-
--- a/designer/LEDPlugin.h	Wed Jun 29 22:19:39 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#ifndef _LED_PLUGIN_H_
-#define _LED_PLUGIN_H_
-
-#include <QObject>
-#include <QString>
-#include <QWidget>
-#include <QIcon>
-#include <QtUiPlugin/QDesignerCustomWidgetInterface>
-
-class LEDPlugin;
-
-class LEDPlugin : public QObject, public QDesignerCustomWidgetInterface
-{
-    Q_OBJECT
-    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface")
-    Q_INTERFACES(QDesignerCustomWidgetInterface)
-
-public:
-	LEDPlugin(QObject* parent=0);
-
-    QString name() const;
-    QString group() const;
-    QString toolTip() const;
-    QString whatsThis() const;
-    QString includeFile() const;
-    QIcon icon() const;
-    QString domXml() const;
-
-    bool isContainer() const;
-    bool isInitialized() const;
-
-    QWidget *createWidget(QWidget *parent);
-    void initialize(QDesignerFormEditorInterface *core);
-
-private:
-    bool initialized = false;
-};
-
-#endif
--- a/src/DetailFermenter.cpp	Wed Jun 29 22:19:39 2022 +0200
+++ b/src/DetailFermenter.cpp	Wed Jun 29 23:06:38 2022 +0200
@@ -27,6 +27,9 @@
 
     WindowTitle();
 
+    // srcMode = ['OFF', 'NONE', 'FRIDGE', 'BEER', 'PROFILE'];
+    // srcStage = ['PRIMARY', 'SECONDARY', 'TERTIARY', 'CARBONATION'];
+    //
 //    connect(ui->nameEdit, &QLineEdit::textChanged, this, &DetailFermenter::is_changed);
 //    connect(ui->unlimitedEdit, &QCheckBox::stateChanged, this, &DetailFermenter::is_changed);
 //    connect(ui->caEdit, &QDoubleSpinBox::textChanged, this, &DetailFermenter::water_changed);
@@ -46,7 +49,13 @@
     query.exec();
     if (query.next()) {
 
+	ui->uuidEdit->setText(query.value("uuid").toString());
+	ui->systemEdit->setText(query.value("node").toString()+"/"+query.value("alias").toString());
+
 	if (query.value("online").toInt()) {
+	    ui->statusEdit->setText(tr("Online"));
+	    ui->codeEdit->setText(query.value("beercode").toString()+" - "+query.value("beername").toString());
+
 	    if (query.value("mode").toString() == "OFF") {
 	    	ui->powerLED->setChecked(false);
 	    	// disable dropdowns select beer.
--- a/src/LED.cpp	Wed Jun 29 22:19:39 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-#include <math.h>
-
-#include <QPainter>
-#include <QGradient>
-#include <QPaintDevice>
-#include <QTimer>
-
-#include "LED.h"
-
-LED::
-LED(QWidget* parent) :
-	QWidget(parent),
-	diameter_(5),
-	color_(QColor("red")),
-	alignment_(Qt::AlignCenter),
-	initialState_(true),
-	state_(true),
-	flashRate_(200),
-	flashing_(false)
-{
-	timer_ = new QTimer(this);
-	connect(timer_, SIGNAL(timeout()), this, SLOT(toggleState()));
-
-    setDiameter(diameter_);
-}
-
-LED::
-~LED()
-{
-}
-
-
-double LED::
-diameter() const
-{
-	return diameter_;
-}
-
-void LED::
-setDiameter(double diameter)
-{
-	diameter_ = diameter;
-
-	pixX_ = round(double(height())/heightMM());
-	pixY_ = round(double(width())/widthMM());
-
-	diamX_ = diameter_*pixX_;
-	diamY_ = diameter_*pixY_;
-
-	update();
-}
-
-
-QColor LED::
-color() const
-{
-	return color_;
-}
-
-void LED::
-setColor(const QColor& color)
-{
-	color_ = color;
-	update();
-}
-
-Qt::Alignment LED::
-alignment() const
-{
-	return alignment_;
-}
-
-void LED::
-setAlignment(Qt::Alignment alignment)
-{
-	alignment_ = alignment;
-
-	update();
-}
-
-void LED::
-setFlashRate(int rate)
-{
-	flashRate_ = rate;
-
-	update();
-}
-
-void LED::
-setFlashing(bool flashing)
-{
-	flashing_ = flashing;
-
-	update();
-}
-
-void LED::
-startFlashing()
-{
-	setFlashing(true);
-}
-
-void LED::
-stopFlashing()
-{
-	setFlashing(false);
-}
-
-
-void LED::
-setState(bool state)
-{
-	state_ = state;
-	update();
-}
-
-void LED::
-toggleState()
-{
-	state_ = !state_;
-	update();
-}
-
-int LED::
-heightForWidth(int width) const
-{
-	return width;
-}
-
-QSize LED::
-sizeHint() const
-{
-	return QSize(diamX_, diamY_);
-}
-
-QSize LED::
-minimumSizeHint() const
-{
-	return QSize(diamX_, diamY_);
-}
-
-void LED::
-paintEvent(QPaintEvent *event)
-{
-    Q_UNUSED(event);
-
-	QPainter p(this);
-
-	QRect geo = geometry();
-	int width = geo.width();
-	int height = geo.height();
-
-	int x=0, y=0;
-	if ( alignment_ & Qt::AlignLeft )
-		x = 0;
-	else if ( alignment_ & Qt::AlignRight )
-		x = width-diamX_;
-	else if ( alignment_ & Qt::AlignHCenter )
-		x = (width-diamX_)/2;
-	else if ( alignment_ & Qt::AlignJustify )
-		x = 0;
-
-	if ( alignment_ & Qt::AlignTop )
-		y = 0;
-	else if ( alignment_ & Qt::AlignBottom )
-		y = height-diamY_;
-	else if ( alignment_ & Qt::AlignVCenter )
-		y = (height-diamY_)/2;
-
-	QRadialGradient g(x+diamX_/2, y+diamY_/2, diamX_*0.4,
-		diamX_*0.4, diamY_*0.4);
-
-	g.setColorAt(0, Qt::white);
-	if ( state_ )
-		g.setColorAt(1, color_);
-	else
-		g.setColorAt(1, Qt::black);
-	QBrush brush(g);
-
-	p.setPen(color_);
-	p.setRenderHint(QPainter::Antialiasing, true);
-	p.setBrush(brush);
-	p.drawEllipse(x, y, diamX_-1, diamY_-1);
-
-	if ( flashRate_ > 0 && flashing_ )
-		timer_->start(flashRate_);
-	else
-		timer_->stop();
-}
-
-bool LED::
-state() const
-{
-    return state_;
-}
-
-bool LED::
-isFlashing() const
-{
-    return flashing_;
-}
-
-int LED::
-flashRate() const
-{
-    return flashRate_;
-}
--- a/src/LED.h	Wed Jun 29 22:19:39 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#ifndef _LED_H_
-#define _LED_H_
-
-#include <QtDesigner/QtDesigner>
-#include <QWidget>
-
-class QTimer;
-
-class QDESIGNER_WIDGET_EXPORT LED : public QWidget
-{
-	Q_OBJECT
-
-	Q_PROPERTY(double diameter READ diameter WRITE setDiameter) // mm
-	Q_PROPERTY(QColor color READ color WRITE setColor)
-	Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
-	Q_PROPERTY(bool state READ state WRITE setState)
-	Q_PROPERTY(bool flashing READ isFlashing WRITE setFlashing)
-	Q_PROPERTY(int flashRate READ flashRate WRITE setFlashRate)
-
-public:
-	explicit LED(QWidget* parent=0);
-	~LED();
-
-	double diameter() const;
-	void setDiameter(double diameter);
-
-	QColor color() const;
-	void setColor(const QColor& color);
-
-	Qt::Alignment alignment() const;
-	void setAlignment(Qt::Alignment alignment);
-
-    bool state() const;
-
-    bool isFlashing() const;
-
-    int flashRate() const;
-
-public slots:
-	void setState(bool state);
-	void toggleState();
-	void setFlashing(bool flashing);
-	void setFlashRate(int rate);
-	void startFlashing();
-	void stopFlashing();
-
-public:
-	int heightForWidth(int width) const;
-	QSize sizeHint() const;
-	QSize minimumSizeHint() const;
-
-protected:
-	void paintEvent(QPaintEvent* event);
-
-private:
-	double diameter_;
-	QColor color_;
-	Qt::Alignment alignment_;
-	bool initialState_;
-	bool state_;
-	int flashRate_;
-	bool flashing_;
-
-	//
-	// Pixels per mm for x and y...
-	//
-	int pixX_, pixY_;
-
-	//
-	// Scaled values for x and y diameter.
-	//
-	int diamX_, diamY_;
-
-	QRadialGradient gradient_;
-	QTimer* timer_;
-};
-
-#endif
--- a/ui/DetailFermenter.ui	Wed Jun 29 22:19:39 2022 +0200
+++ b/ui/DetailFermenter.ui	Wed Jun 29 23:06:38 2022 +0200
@@ -320,10 +320,13 @@
         <rect>
          <x>140</x>
          <y>40</y>
-         <width>221</width>
+         <width>271</width>
          <height>23</height>
         </rect>
        </property>
+       <property name="frame">
+        <bool>true</bool>
+       </property>
        <property name="readOnly">
         <bool>true</bool>
        </property>
@@ -333,10 +336,13 @@
         <rect>
          <x>140</x>
          <y>70</y>
-         <width>151</width>
+         <width>181</width>
          <height>23</height>
         </rect>
        </property>
+       <property name="frame">
+        <bool>true</bool>
+       </property>
        <property name="readOnly">
         <bool>true</bool>
        </property>
@@ -350,6 +356,9 @@
          <height>23</height>
         </rect>
        </property>
+       <property name="readOnly">
+        <bool>true</bool>
+       </property>
       </widget>
       <widget class="QLineEdit" name="codeEdit">
        <property name="geometry">
@@ -360,6 +369,9 @@
          <height>23</height>
         </rect>
        </property>
+       <property name="readOnly">
+        <bool>true</bool>
+       </property>
       </widget>
       <widget class="QComboBox" name="codePick">
        <property name="geometry">
@@ -396,10 +408,13 @@
         <rect>
          <x>140</x>
          <y>190</y>
-         <width>221</width>
+         <width>271</width>
          <height>23</height>
         </rect>
        </property>
+       <property name="readOnly">
+        <bool>true</bool>
+       </property>
       </widget>
       <widget class="QLineEdit" name="profileShow">
        <property name="geometry">
@@ -410,6 +425,9 @@
          <height>23</height>
         </rect>
        </property>
+       <property name="readOnly">
+        <bool>true</bool>
+       </property>
       </widget>
       <widget class="QPushButton" name="modeButton1">
        <property name="geometry">
@@ -451,7 +469,7 @@
        <property name="geometry">
         <rect>
          <x>290</x>
-         <y>10</y>
+         <y>150</y>
          <width>101</width>
          <height>20</height>
         </rect>
@@ -729,24 +747,120 @@
         </color>
        </property>
       </widget>
+      <widget class="QLabel" name="heatLabel">
+       <property name="geometry">
+        <rect>
+         <x>15</x>
+         <y>50</y>
+         <width>71</width>
+         <height>20</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>Heat</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLabel" name="coolLabel">
+       <property name="geometry">
+        <rect>
+         <x>95</x>
+         <y>50</y>
+         <width>71</width>
+         <height>20</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>Cool</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLabel" name="fanLabel">
+       <property name="geometry">
+        <rect>
+         <x>175</x>
+         <y>50</y>
+         <width>71</width>
+         <height>20</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>Fan</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QToolButton" name="heatSwitch">
+       <property name="geometry">
+        <rect>
+         <x>36</x>
+         <y>80</y>
+         <width>28</width>
+         <height>22</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="checkable">
+        <bool>true</bool>
+       </property>
+       <property name="autoRaise">
+        <bool>false</bool>
+       </property>
+      </widget>
+      <widget class="QToolButton" name="heatSwitch_2">
+       <property name="geometry">
+        <rect>
+         <x>116</x>
+         <y>80</y>
+         <width>28</width>
+         <height>22</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="checkable">
+        <bool>true</bool>
+       </property>
+      </widget>
+      <widget class="QToolButton" name="heatSwitch_3">
+       <property name="geometry">
+        <rect>
+         <x>196</x>
+         <y>80</y>
+         <width>28</width>
+         <height>22</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="checkable">
+        <bool>true</bool>
+       </property>
+      </widget>
      </widget>
      <widget class="QGroupBox" name="buttonBox">
       <property name="geometry">
        <rect>
         <x>720</x>
-        <y>390</y>
+        <y>380</y>
         <width>261</width>
-        <height>131</height>
+        <height>141</height>
        </rect>
       </property>
-      <property name="title">
-       <string>GroupBox</string>
-      </property>
       <widget class="QPushButton" name="quitButton">
        <property name="geometry">
         <rect>
          <x>90</x>
-         <y>90</y>
+         <y>100</y>
          <width>80</width>
          <height>23</height>
         </rect>
@@ -765,6 +879,32 @@
          <normaloff>:icons/silk/door_out.png</normaloff>:icons/silk/door_out.png</iconset>
        </property>
       </widget>
+      <widget class="QPushButton" name="logButton">
+       <property name="geometry">
+        <rect>
+         <x>90</x>
+         <y>20</y>
+         <width>80</width>
+         <height>23</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>Log</string>
+       </property>
+      </widget>
+      <widget class="QPushButton" name="camButton">
+       <property name="geometry">
+        <rect>
+         <x>90</x>
+         <y>60</y>
+         <width>80</width>
+         <height>23</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>Camera</string>
+       </property>
+      </widget>
      </widget>
     </widget>
    </item>

mercurial